http://stackoverflow.com/a/24755563
score: 16
has comment: http://stackoverflow.com/comment/38444338
upvote count: 16
has body: Isn't it just because you didn't initialize the Map&lt;String, ImageResponse&gt; response field? Caused by: java.lang.NullPointerException at be.kava.farma.modules.prins.ImageListingResponse.set(ImageListingResponse.java:21) 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 com.fasterxml.jackson.databind.deser.SettableAnyProperty.set(SettableAnyProperty.java:129) ... 99 more enter code here
answers question: http://stackoverflow.com/q/24752326
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38411678
type: Answer
accepted answer of: http://stackoverflow.com/q/24752326
has comment: http://stackoverflow.com/comment/38444239

http://stackoverflow.com/q/24873868
tagged with: solr
has comment: http://stackoverflow.com/comment/38668780
has comment: http://stackoverflow.com/comment/38633342
type: Question
has comment: http://stackoverflow.com/comment/38635386
has title: SolrException: An invalid XML character (Unicode: 0xffffffff) was found
has comment: http://stackoverflow.com/comment/38662675
score: 0
answer count: 1
tagged with: unicode
has body: I am passing a text file into Apache Solr and am getting the exception: SolrException: An invalid XML character (Unicode: 0xffffffff) was found I want to skip indexing the full content of this text file as a result. How do I find if a text file has this character in Java? To find Unicode 0xffff to fix a similar issue, I am currently using: File file = [somefile]; String contents = getContentsAsString(file); if (contents.contains("\uFFFF")) { [skip it] } I need to determine if a text file contains Unicode: 0xffffffff.
has comment: http://stackoverflow.com/comment/38678320
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28224365
tagged with: java

http://stackoverflow.com/a/24841748
answers question: http://stackoverflow.com/q/24841484
score: 0
has comment: http://stackoverflow.com/comment/38571181
has comment: http://stackoverflow.com/comment/38571263
has body: Here's something that is most likely not efficient, but it works, it's based on a lot of string manipulation and truncating parts off the string: public class StringSplitter { public static String[] transform(String string) { String[] splitString = string.split(" "); List&lt;String&gt; listOfStrings = new ArrayList&lt;String&gt;(); int i = 0; while(i &lt; splitString.length) { if(!splitString[i].startsWith("{")) { listOfStrings.add(splitString[i]); i++; } else { boolean concatEnd = false; StringBuffer sb = new StringBuffer(); splitString[i] = splitString[i].substring(1); sb.append(splitString[i]); i++; while(!concatEnd) { if(!splitString[i].endsWith("}")) { sb.append(" " + splitString[i]); i++; } else { splitString[i] = splitString[i].substring(0, splitString[i].length()-1); sb.append(" " + splitString[i]); concatEnd = true; i++; } } listOfStrings.add(sb.toString()); } } return listOfStrings.toArray(new String[listOfStrings.size()]); } public static void main(String[] args) { String s = "Mary Mark {John Brown} Honey lollipop Badger {Oh My God} {Such stupid}"; for(String string : transform(s)) { System.out.println(string); } } } Output: Mary Mark John Brown Honey lollipop Badger Oh My God Such stupid
type: Answer
has comment: http://stackoverflow.com/comment/38571366

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

http://stackoverflow.com/comment/38682314
comment on: http://stackoverflow.com/q/24899985
type: Comment
type: QuestionComment
score: 0
has text: @MadProgrammer can you explain or give me a link to a tutorial on how to build and deploy my Maven project? I did try a "Clean and Build" on MyLibMaven and I see a .jar file at `...NetBeansProjects\MyLibMaven\target`. If I add that .jar file to MyProject I get the exception from my previous SO question (linked in this SO question). I just need to fix this for a quick deploy now and tomorrow I'll move MyProject to a Maven project as you suggested on the second part of your comment.

http://stackoverflow.com/a/24751366
upvote count: 1
has comment: http://stackoverflow.com/comment/38401115
answers question: http://stackoverflow.com/q/24751071
has comment: http://stackoverflow.com/comment/38401038
has body: As per your comment, change you definition of mDirectors to ArrayList&lt;Director&gt; mDirectors = new ArrayList&lt;Director&gt;(); or check for null in your for as for(int i = 0; mDirectors != null &amp;&amp; i &lt; mDirectors.size(); i++)
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/24771492
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24751472
score: 0
has body: So I've found a solution. The mistake was in the class-name attribute of connection definition part. The correct class for that is org.apache.cxf.jca.cxf.AssociatedManagedConnectionFactoryImpl.
accepted answer of: http://stackoverflow.com/q/24751472

http://stackoverflow.com/comment/38426032
has text: so you rely on eclipse's default builder (if you have build automatically checked) that doesn't respect mavens build profile, you can add directory as source directory and configure where properties file is placed so it will remain limited to eclipse env (i.e. dev env) and it will be available as well
comment on: http://stackoverflow.com/q/24764367
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24820060
tagged with: message-listener
answer count: 1
tagged with: jsp
tagged with: jms
has answer: http://stackoverflow.com/a/24837368
type: AnsweredQuestion
has title: Implementing ActiveMQ Message Listener in/using JSP
tagged with: activemq-classic
score: 0
has body: I have implemented Message Listener in core java using Active MQ/JMS. The purpose of this listener is to subscribe a topic on ActiveMQ and then listen to the messages received from the topic. My code is working fine as a console application. Now I need to extend my application into a web application so that the messages received could be used in the web page i.e JSP. I am confused about how the message listener will work in JSP, how I will receive and process messages from active MQ topic. So far I have following code but doesn't seem to help in current scenario: &lt;%! public void handleReceivedMessages() { String url = ActiveMQConnection.DEFAULT_BROKER_URL; String subject = "XXXXX"; try { ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); Connection connection = connectionFactory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic(subject); MessageConsumer consumer = session.createConsumer(topic); MessageListener listner = new MessageListener() { @Override public void onMessage(Message message) { try { if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; System.out.println("Received message : " + textMessage.getText() + "'"); } } catch (JMSException e) { System.out.println("Caught:" + e); } } }; consumer.setMessageListener(listner); try { System.in.read(); } catch (IOException e) { } connection.close(); } catch (JMSException ex) { // Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex); } }//end method %&gt; How I am supposed to use this code so that i can e.g print every message on my web page which is received by the topic?
type: Question
accepted answer: http://stackoverflow.com/a/24837368
tagged with: java

http://stackoverflow.com/a/24953878
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24831844
downvote count: 0
type: Answer
has body: As an alternative You could try switching to Android Studio, Its built on top of ItelliJ. If you are creating a new project Android Studio creates the test directory automatically for you.

http://stackoverflow.com/comment/38649291
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24882535
score: 0
has text: My problem is that files I download with my app are completely blank, but if I write something after PHP code, it will be written on my file. I think problem is in input because when I do log of this, value returned is -1.

http://stackoverflow.com/a/24769608
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24769413
type: Answer
accepted answer of: http://stackoverflow.com/q/24769413
has body: First of all, you don't need void in front of your constructor. Your constructor could be constructed like this: Vector2f(float x, float y){ _x = x; _y = y; } For function inside the class, you don't have to create another parameter for its. So your functions could be: float dot(Vector2f b){ return (getX()*b.getX()) + (getY()*b.getY()); } float mod(){ return sqrt((getX()*getX()) + (getY()*getY())); } Same thing with the other function. To access the function inside a class. You do this: className.functionName(); You don't have to use the keyword new to create a new instance. What new does is it will create your object inside heap and if you use new to create an object, you have to use delete after you've done with it. Otherwise, it will cause leak memory. In main, you could just do like this: int main() { Vector2f a(2.0f, 4.0f); std::cout &lt;&lt; "Magnitude :" &lt;&lt; a.mod() &lt;&lt; std::endl; return 0; }
score: 0

http://stackoverflow.com/comment/38941075
type: AnswerComment
has text: That is almost the way I deceided to go, so I guess I can give the bounty to you, since there does not seem to be any easier way to serialize fx objects. I used xStream, and created some converter with my own template objects representing the fx-objects to persist them. Thank you for sharing your point of view!
type: Comment
comment on: http://stackoverflow.com/a/25021951
score: 0

http://stackoverflow.com/q/24842666
answer count: 5
has answer: http://stackoverflow.com/a/24842814
possible better answer: http://stackoverflow.com/a/24842699
has answer: http://stackoverflow.com/a/24842730
has answer: http://stackoverflow.com/a/24842699
has comment: http://stackoverflow.com/comment/38572880
type: AnsweredQuestion
score: 1
tagged with: java
has body: I wrote this simple program, that takes a command line argument, converts it into int type, and prints integers starting from that number till infinity on console. If i don't pass any argument, then my exception message is printed. public class Infinity { public static void main(String args[]) { try { n=Integer.parseInt(args[0]); while(true) { System.out.println(n); n++; } } catch(Exception ex) { System.out.println("A number was not entered."); } } } Is there any way that if i don't pass any argument, the program itself assigns a value to 'n'? Like this: n=Integer.parseInt(args[0]); if(args[0]==NULL) { n=0; }
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38572895
accepted answer: http://stackoverflow.com/a/24842814
has title: In Java, how to assign the variable number=Integer.parseInt(args[0]) a value if no argument is passed?
has answer: http://stackoverflow.com/a/24842896
has answer: http://stackoverflow.com/a/24842715
tagged with: parseint
downvote count: 0
tagged with: variables
tagged with: assign
favorite count: 0

http://stackoverflow.com/q/24870730
has body: I have added below repository in my project pom.xml file spring-milestone http://repo.spring.io/libs-milestone false But My project using Servlet3.0 but when i am doing mvn eclipse:eclipse its downloading servlet jar from this link Servlet API And my project referring servlet-api2.3.jar in Java build path and my project not working due to this Because i used HttpServletRequest request = (HttpServletRequest) FacesContext .getCurrentInstance().getExternalContext().getRequest(); request.login(username, password); and now i am getting compilation issue The method login(String, String) is undefined for the type HttpServletRequest Can any on tell why its showing old servlet-api.jar file can any one tell me how to fix it? **EDIT :-**pom.xml file 4.0.0 com.ccc 3c war 1.0.0 3c Maven Webapp http://maven.apache.org <spring.version>4.0.3.RELEASE</spring.version> prime-repo Prime Repo http://repository.primefaces.org spring-milestone http://repo.spring.io/libs-milestone false sonatype-oss-public https://oss.sonatype.org/content/groups/public/ true terracotta-releases http://www.terracotta.org/download/reflector/releases true false internal Archiva Managed Internal Repository http://myip:8888/repository/internal/ true false java.net2 Repository hosting the jee6 artifacts http://download.java.net/maven/2 org.primefaces primefaces 5.0 org.primefaces.themes all-themes 1.0.10 org.primefaces.extensions primefaces-extensions 2.0.0 com.sun.faces jsf-api 2.1.11 com.sun.faces jsf-impl 2.1.11 javax.servlet jstl 1.2 org.glassfish.web el-impl 2.2 org.springframework spring-core ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-aop ${spring.version} org.springframework spring-context-support ${spring.version} org.springframework spring-aspects ${spring.version} org.springframework spring-tx ${spring.version} org.springframework spring-orm ${spring.version} org.springframework spring-test ${spring.…
has comment: http://stackoverflow.com/comment/38627742
tagged with: java
accepted answer: http://stackoverflow.com/a/24871551
has title: Issue With Spring repository wrong servlet-api.jar downloaded
type: Question
has comment: http://stackoverflow.com/comment/38628100
has comment: http://stackoverflow.com/comment/38627653
has comment: http://stackoverflow.com/comment/38628028
tagged with: servlets
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38634946
has comment: http://stackoverflow.com/comment/38627044
has answer: http://stackoverflow.com/a/24871551
linked to: http://stackoverflow.com/q/24873480
has comment: http://stackoverflow.com/comment/38626933
has comment: http://stackoverflow.com/comment/38626998
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/38628328
has comment: http://stackoverflow.com/comment/38627003
tagged with: repository
type: AnsweredQuestion

http://stackoverflow.com/comment/38599155
comment on: http://stackoverflow.com/a/24855739
score: 0
type: AnswerComment
has text: This is your code after edit and it's show the result as you want without any problem, check it http://pastie.org/9408144
type: Comment

http://stackoverflow.com/comment/38443432
type: Comment
has text: somehow it doesn't work since cluster name is not in every row, only the first time it is there and then host nnames related to that cluster. And then another cluster name followed by its host names.
comment on: http://stackoverflow.com/a/24773413
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38430734
comment on: http://stackoverflow.com/q/24766605
score: 0
has text: I will edit my answer in response to your edits
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24756415
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24756183
answers question: http://stackoverflow.com/q/24756183
type: Answer
has body: does this block code needs syncronization? Answer is Yes ( if you need synchronized access to new arraylist you have created). You have created a new ArrayList using the elements of another list. JavaDoc public ArrayList(Collection&lt;? extends E&gt; c) Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. So, regardless whether the collection you passed was synchronized or not, it will be an entirely new list.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38410719
has comment: http://stackoverflow.com/comment/38410667
has comment: http://stackoverflow.com/comment/38411423
upvote count: 1

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/24761082
tags question: http://stackoverflow.com/q/24800965
tags question: http://stackoverflow.com/q/24755750
tag name: jfreechart

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

http://stackoverflow.com/q/24818989
has answer: http://stackoverflow.com/a/24819027
accepted answer: http://stackoverflow.com/a/24819098
has answer: http://stackoverflow.com/a/24819035
favorite count: 0
tagged with: printf
linked to: http://stackoverflow.com/q/8629995
has title: What printf conversion should be used for boolean values?
upvote count: 81
has body: I know it's a very simple question, but I would like to know the string format for the boolean type. For instance, below shows the string formats for integer, string and float. What would be the proper format for boolean values true/false? System.out.printf("The value of the float " + "variable is %f, while " + "the value of the " + "integer variable is %d, " + "and the string is %s", floatVar, intVar, stringVar);
has comment: http://stackoverflow.com/comment/38528421
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38528445
has answer: http://stackoverflow.com/a/24819125
has answer: http://stackoverflow.com/a/24819267
has answer: http://stackoverflow.com/a/24819053
downvote count: 2
has answer: http://stackoverflow.com/a/24819098
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/140105040
tagged with: formatting
answer count: 6
score: 79
possible better answer: http://stackoverflow.com/a/24819035

http://stackoverflow.com/q/24834511
type: AnsweredQuestion
downvote count: 0
tagged with: nosuchfileexception
tagged with: java
type: Question
answer count: 2
has body: Recently I have an issue with Java. I've tried some things I found on the web but they haven't worked, so I need help. I have a Java project in Eclipse. My main class is in src/programCode/UI_Main2.java. In that .java I try to access to a file in src/files/File.file And this is when the things fo weird. If I use /src/files/File.file it gives me NoSuchFileException. If I use src/files/File.file it works in Eclipse but when I compile it to a executable .jar it gives me NoSuchFileException. If I use /files/File.file it gives me NoSuchFileException. If I use files/File.file it gives me NoSuchFileException. If I use files/File.file it gives meNoSuchFileException. If I use this.getClass().getResource("/files/File.file").getPath().substring(1) (without substring it gives me Invalid character) it gives me NoSuchFileException (but it shows me the absolute path and the file exists there!) If I use this.getClass().getResource("files/File.file").getPath() it gives me NullPointerException and the program crashes. If I use this.getClass().getResource("src/files/File.file").getPath() it gives me NullPointerException and the program crashes. If I use this.getClass().getResource("/src/files/File.file").getPath() it gives me NullPointerException and the program crashes. So, I don't know what to do. src/files/File.file is the only one that works, but it doesn't when compiled to executable jar. So please, help me, I haven't found any solution yet. Thanks!
has answer: http://stackoverflow.com/a/24834685
accepted answer: http://stackoverflow.com/a/24834685
score: 4
has answer: http://stackoverflow.com/a/24834615
favorite count: 0
tagged with: nullpointerexception
upvote count: 4
linked to: http://stackoverflow.com/q/1096398
has comment: http://stackoverflow.com/comment/38557945
tagged with: file
has title: Java isn't getting the file in the source code when compiled
linked to: http://stackoverflow.com/q/6433469
possible better answer: http://stackoverflow.com/a/24834615

http://stackoverflow.com/a/24902055
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24901922
score: 2
downvote count: 0
has body: Have you tried setImageURI(Uri uri) see this : How to use setImageUri() on Android

http://stackoverflow.com/comment/38501964
has text: I'm using MyISAM is it supporting transactions ?
comment on: http://stackoverflow.com/a/24804973
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38599643
comment on: http://stackoverflow.com/q/24856355
score: 0
has text: The error also implies some sort of GUI is involved, which was not mentioned .
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24899653
has comment: http://stackoverflow.com/comment/38858999
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38782168
has comment: http://stackoverflow.com/comment/38781967
has comment: http://stackoverflow.com/comment/38856423
upvote count: 1
has body: The server asked for a client certificate and you didn't send one, so it closed the connection. Either you don't have a client certificate at all, or at least you don't have one that's trusted by the server. You can see the signers the server trusts in the CertificateRequest message immediately before your trace starts.
answers question: http://stackoverflow.com/q/24885833
type: Answer

http://stackoverflow.com/a/28984529
answers question: http://stackoverflow.com/q/24766118
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24766118
has body: A Full GC where in both the young and old generations are collected occurs when there's change in region size. For example, if we mention -Xms1024m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=1024m JVM initially starts with 1GB of heap but reserves space for 2GB from OS. So as the usage of these regions increases, based on VM ergonomics, Young and old generations are resized until they reach the max reserved size of 2GB. Same thing applies for PermSize as well, every time PermGen resizes, a full GC will occur.
upvote count: 11
type: AcceptedAnswer
type: Answer
score: 11

http://stackoverflow.com/comment/50724014
has text: Hey Mr.G, I see that there is no response here :) But still do you need some more help for this problem?
comment on: http://stackoverflow.com/q/24860255
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24868170
has title: UPnP send/receive
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38628772
has comment: http://stackoverflow.com/comment/38628576
tagged with: upnp
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/56488217
has comment: http://stackoverflow.com/comment/38628893
has body: For approximately one week I have been trying to create a simple chat-program to learn how to use datagrams and sockets, proceeding with success I'm now trying to make a more functional final version of it, to test what I have learned but I have run into a huge problem. Sending packets between two local computers is easy as a breeze, but when it comes to sending them to other computers on the internet port-forwarding have been an issue. Looking into this I discovered UPnP and created an automatic UPnP port on the client using Cling to make it more user-friendly, server-side I always port-forward "manually", which means it can always receive under normal circumstances. but the client is facing a problem I didn't anticipate: they can't receive datagrams through the UPnP port. if you port forward them "manually" they can receive (they can always send though, and the server reads them loud and clear). So my question is: can someone show me how to send/receive (don't know if it's the servers fault or the clients fault, problem lies either in how the server receives, or how the client sends) through UPnP ports? or am I using UPnP ports all wrong? my router, which is the test subject, have UPnp port enabled, and I have tested UDP and TCP ports along with datagramsockets and multicastsockets in every configuration I could think of. TL:DR use UPnP or find other solution on how to send/receive datagrams through a router/modem. I am extremely sorry if the code is a bit messy/buggy, not the full code, will post pastebin if asked. Client: public class Client { public MulticastSocket rsocket = new MulticastSocket(25566); public Client() throws IOException { //creating UPnP port using Cling... InetAddress inet = InetAddress.getLocalHost(); PortMapping desiredMapping = new PortMapping(25566, inet.getHostAddress(), PortMapping.Protocol.UDP, "Chatt program"); UpnpServiceImpl upnpService = new UpnpServiceImpl( new PortMappingListener(desiredMapping)); upnpService.getControlPoint().sea…
score: 1
tagged with: java
tagged with: nat
type: Question
upvote count: 2

http://stackoverflow.com/comment/38697043
comment on: http://stackoverflow.com/q/24898970
type: Comment
score: 0
has text: If you post an answer and explain how you fixed it would be better than an answer with only a link :)
type: QuestionComment

datetimeoffset
type: Tag
tags question: http://stackoverflow.com/q/24851732
tag name: datetimeoffset

http://stackoverflow.com/comment/38581549
has text: Start by choosing a development strategy. Either use a `JAppelt` OR a `JFrame`, you shouldn't be mixing them together like this. Second, applets have very tight security restrictions, one of which is the ability to write to the local file system, so you might want to reconsider that. Third, I see no button in your code, see [How to use buttons](http://docs.oracle.com/javase/tutorial/uiswing/components/button.html) and [How to write an action listener](http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html).
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24847192

http://stackoverflow.com/q/24872548
score: 0
type: Question
has answer: http://stackoverflow.com/a/24872917
has body: Coming from a background of being taught Javascript with Douglas Crockford where he places a high emphasis on not using eval, and an educational background that it's just bad form to use general blanket methods like exec that pose security vulnerabilities, is there anyway to delete a SQLite table if it exists w/o having to resort to execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE)? The current method documentation seems to suggest execSQL is the only way as the only delete method is: Convenience method for deleting rows in the database. and deleteDatabase is for databases, not tables.
tagged with: java
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/38630537
accepted answer: http://stackoverflow.com/a/24872917
tagged with: android
type: AnsweredQuestion
has title: How to delete SQLite table IF EXISTS without calling execSQL?

http://stackoverflow.com/comment/38598096
type: Comment
comment on: http://stackoverflow.com/a/24854970
type: AnswerComment
score: 0
has text: Ok cool but then i am using ListAdapter. `notifyDataSetChanged();` won't work with ListAdapter. `ListAdapter lstAdpt = listView.getAdapter();` Now how do i update that adapter?

http://stackoverflow.com/a/24804267
type: Answer
has comment: http://stackoverflow.com/comment/38500897
has comment: http://stackoverflow.com/comment/38501622
downvote count: 1
score: -1
has body: Looks like, it is just syntactical sugar that you are interested in. Here you go: // write new PrintWriter("the-file-name.txt", "UTF-8").append("this string").close(); // read String thisStr = new BufferedReader(new FileReader("the-file-name.txt")).readLine(); System.out.println(thisStr);
accepted answer of: http://stackoverflow.com/q/24804108
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38500930
answers question: http://stackoverflow.com/q/24804108
has comment: http://stackoverflow.com/comment/38527037

java
tags question: http://stackoverflow.com/q/24853023
tags question: http://stackoverflow.com/q/24810028
tags question: http://stackoverflow.com/q/24861088
tags question: http://stackoverflow.com/q/24785434
tags question: http://stackoverflow.com/q/24756321
tags question: http://stackoverflow.com/q/24906259
tags question: http://stackoverflow.com/q/24845556
tags question: http://stackoverflow.com/q/24863833
tags question: http://stackoverflow.com/q/24830515
tags question: http://stackoverflow.com/q/24903563
tags question: http://stackoverflow.com/q/24837939
tags question: http://stackoverflow.com/q/24795291
tags question: http://stackoverflow.com/q/24845255
tags question: http://stackoverflow.com/q/24782280
tags question: http://stackoverflow.com/q/24846276
tags question: http://stackoverflow.com/q/24806922
tags question: http://stackoverflow.com/q/24885169
tags question: http://stackoverflow.com/q/24799168
tags question: http://stackoverflow.com/q/24781246
tags question: http://stackoverflow.com/q/24773153
tags question: http://stackoverflow.com/q/24762217
tags question: http://stackoverflow.com/q/24824317
tags question: http://stackoverflow.com/q/24784905
tags question: http://stackoverflow.com/q/24810494
tags question: http://stackoverflow.com/q/24885303
tags question: http://stackoverflow.com/q/24861976
tags question: http://stackoverflow.com/q/24788431
tags question: http://stackoverflow.com/q/24772520
tags question: http://stackoverflow.com/q/24894123
tags question: http://stackoverflow.com/q/24754881
tags question: http://stackoverflow.com/q/24778054
tags question: http://stackoverflow.com/q/24843181
tags question: http://stackoverflow.com/q/24805167
tags question: http://stackoverflow.com/q/24878589
tags question: http://stackoverflow.com/q/24831291
tags question: http://stackoverflow.com/q/24774373
tags question: http://stackoverflow.com/q/24751472
tags question: http://stackoverflow.com/q/24850125
tags question: http://stackoverflow.com/q/24767702
tags question: http://stackoverflow.com/q/24847288
tags question: http://stackoverflow.com/q/24894109
tags question: http://stackoverflow.com/q/24783743
tags question: http://stackoverflow.com/q/24884555
tags question: http://stackoverflow.com/q/24777294
tags question: http://stackoverflow.com/q/24898477
tags question: http://stackoverflow.com/q/24781318
tags question: http://stackoverflow.com/q/24906464
tags question: http://stackoverflow.com/q/24775329
tags question: http://stackoverflow.com/q/24906226
tags question: http://stackoverflow.com/q/24872343
tags question: http://stackoverflow.com/q/24894828
tags question: http://stackoverflow.com/q/24892779
tags question: http://stackoverflow.com/q/24878815
tags question: http://stackoverflow.com/q/24759252
tags question: http://stackoverflow.com/q/24814152
tags question: http://stackoverflow.com/q/24798893
tags question: http://stackoverflow.com/q/24895444
tags question: http://stackoverflow.com/q/24848979
tags question: http://stackoverflow.com/q/24756615
tags question: http://stackoverflow.com/q/24892211
tags question: http://stackoverflow.com/q/24808477
tags question: http://stackoverflow.com/q/24818408
tags question: http://stackoverflow.com/q/24794887
tags question: http://stackoverflow.com/q/24756874
tags question: http://stackoverflow.com/q/24855928
tags question: http://stackoverflow.com/q/24892637
tags question: http://stackoverflow.com/q/24894830
tags question: http://stackoverflow.com/q/24843179
tags question: http://stackoverflow.com/q/24791096
tags question: http://stackoverflow.com/q/24781844
tags question: http://stackoverflow.com/q/24835445
tags question: http://stackoverflow.com/q/24892696
tags question: http://stackoverflow.com/q/24808610
tags question: http://stackoverflow.com/q/24854398
tags question: http://stackoverflow.com/q/24834815
tags question: http://stackoverflow.com/q/24835007
tags question: http://stackoverflow.com/q/24809711
tags question: http://stackoverflow.com/q/24769468
tags question: http://stackoverflow.com/q/24873827
tags question: http://stackoverflow.com/q/24776177

http://stackoverflow.com/q/24902849
has answer: http://stackoverflow.com/a/24902903
has comment: http://stackoverflow.com/comment/38687652
has comment: http://stackoverflow.com/comment/38687989
tagged with: function
downvote count: 0
has answer: http://stackoverflow.com/a/24902921
has comment: http://stackoverflow.com/comment/38687830
favorite count: 0
has answer: http://stackoverflow.com/a/73825850
has answer: http://stackoverflow.com/a/24902915
answer count: 5
linked to: http://stackoverflow.com/q/1703351
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/24902983
has body: How to call oracle function from java?. I have a oracle function aaa.fucntion(number,date);, this method returns true or false. how do call this from java and get the returned value? I am using Hibernate this is what i tried, Session session = null; String associateHistorySQL=""; try { session = HibernateUtil.currentSession(); associateHistorySQL = "SELECT aa.myFunction(:aorId,:givenDate) from dual"; Query associateHistoryQuery = session.createQuery(associateHistorySQL); associateHistoryQuery.setParameter("aorId", associateOfficeRecordId); associateHistoryQuery.setParameter("givenDate", date); List associateHistoryList = associateHistoryQuery.list(); if (associateHistoryList != null &amp;&amp; associateHistoryList.size() &gt; 0 &amp;&amp; new Integer(associateHistoryQuery.uniqueResult().toString()) &gt; 0) return true; else return false; } finally { HibernateUtil.cleanUpHibernateFromDao(false); } This is the exception i get unexpected token: aa: line 1:1: unexpected token: aa thanks
has comment: http://stackoverflow.com/comment/38687817
has title: How to call oracle function from java
has comment: http://stackoverflow.com/comment/38687511
has comment: http://stackoverflow.com/comment/38687699
tagged with: return-value
upvote count: 3
has comment: http://stackoverflow.com/comment/38688044
type: Question
score: 3
has comment: http://stackoverflow.com/comment/38687462
tagged with: java

http://stackoverflow.com/comment/38655917
score: 2
has text: @feuerball:- Yes I got the human verification check which delayed me to answer!
comment on: http://stackoverflow.com/a/24886423
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38412536
score: 0
comment on: http://stackoverflow.com/q/24756862
has text: Did you try using two Collections? `HashSet<String, UrlCounter>` and `PriorityQueue<UrlCounter>`, where `class UrlCounter{ String url; int count = 0; }`? (or TreeSet). I still would suggest that you describe your complete problem a bit better, so that more appropriate solutions can be given. Also see this: http://mywiki.wooledge.org/XyProblem
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38441949
type: Comment
has text: @user2169777:- A loss of precision means that you are losing information of the given value.(*The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive).*) In your first case the range of short is crossed(1073741824) and hence you are loosing the information. So you are receiving the error.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24772991

http://stackoverflow.com/q/24903658
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38688959
possible better answer: http://stackoverflow.com/a/24904018
has answer: http://stackoverflow.com/a/24904145
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38689877
has title: Spring ThreadPoolTaskExecutor vs Java Executorservice cachedthreadpool
answer count: 2
has body: What are the pros and cons of using Spring ThreadPoolTaskExecutor vs Java Executorservice cachedthreadpool even though spring is wrapper of Java concurrency. Just would like to know the flexibility in using them.
favorite count: 0
score: 39
has comment: http://stackoverflow.com/comment/38689175
accepted answer: http://stackoverflow.com/a/24904145
has comment: http://stackoverflow.com/comment/89608177
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/24904018
downvote count: 1
type: Question
upvote count: 40

mysql
tags question: http://stackoverflow.com/q/24834051
tags question: http://stackoverflow.com/q/24827886
tags question: http://stackoverflow.com/q/24768114
tags question: http://stackoverflow.com/q/24860721
tags question: http://stackoverflow.com/q/24852581
tags question: http://stackoverflow.com/q/24870622
tags question: http://stackoverflow.com/q/24865998
tags question: http://stackoverflow.com/q/24896035
tags question: http://stackoverflow.com/q/24903209
tags question: http://stackoverflow.com/q/24858428
tags question: http://stackoverflow.com/q/24800982
tags question: http://stackoverflow.com/q/24771392
tag name: mysql
tags question: http://stackoverflow.com/q/24814415
tags question: http://stackoverflow.com/q/24796986
tags question: http://stackoverflow.com/q/24841094
tags question: http://stackoverflow.com/q/24886504
tags question: http://stackoverflow.com/q/24808669
tags question: http://stackoverflow.com/q/24862846
tags question: http://stackoverflow.com/q/24894320
tags question: http://stackoverflow.com/q/24779441
tags question: http://stackoverflow.com/q/24835800
tags question: http://stackoverflow.com/q/24837169
tags question: http://stackoverflow.com/q/24789504
tags question: http://stackoverflow.com/q/24887927
tags question: http://stackoverflow.com/q/24888745
tags question: http://stackoverflow.com/q/24771253
tags question: http://stackoverflow.com/q/24864117
tags question: http://stackoverflow.com/q/24850530
tags question: http://stackoverflow.com/q/24750412
tags question: http://stackoverflow.com/q/24893734
tags question: http://stackoverflow.com/q/24812019
tags question: http://stackoverflow.com/q/24838298
tags question: http://stackoverflow.com/q/24774208
tags question: http://stackoverflow.com/q/24837236
tags question: http://stackoverflow.com/q/24791197
tags question: http://stackoverflow.com/q/24847023
tags question: http://stackoverflow.com/q/24779206
tags question: http://stackoverflow.com/q/24848463
tags question: http://stackoverflow.com/q/24904956
tags question: http://stackoverflow.com/q/24792112
tags question: http://stackoverflow.com/q/24770563
tags question: http://stackoverflow.com/q/24862179
tags question: http://stackoverflow.com/q/24771890
tags question: http://stackoverflow.com/q/24840038
tags question: http://stackoverflow.com/q/24795830
tags question: http://stackoverflow.com/q/24782596
tags question: http://stackoverflow.com/q/24788101
tags question: http://stackoverflow.com/q/24797478
tags question: http://stackoverflow.com/q/24818374
tags question: http://stackoverflow.com/q/24758541
tags question: http://stackoverflow.com/q/24794098
tags question: http://stackoverflow.com/q/24896220
tags question: http://stackoverflow.com/q/24796743
type: Tag
tags question: http://stackoverflow.com/q/24873455
tags question: http://stackoverflow.com/q/24761974
tags question: http://stackoverflow.com/q/24761082
tags question: http://stackoverflow.com/q/24908535
tags question: http://stackoverflow.com/q/24815520
tags question: http://stackoverflow.com/q/24870004
tags question: http://stackoverflow.com/q/24769318
tags question: http://stackoverflow.com/q/24779771
tags question: http://stackoverflow.com/q/24845357
tags question: http://stackoverflow.com/q/24795291
tags question: http://stackoverflow.com/q/24772126
tags question: http://stackoverflow.com/q/24804952
tags question: http://stackoverflow.com/q/24818764
tags question: http://stackoverflow.com/q/24784922
tags question: http://stackoverflow.com/q/24835592
tags question: http://stackoverflow.com/q/24859173
tags question: http://stackoverflow.com/q/24778827
tags question: http://stackoverflow.com/q/24782810
tags question: http://stackoverflow.com/q/24890657
tags question: http://stackoverflow.com/q/24878579
tags question: http://stackoverflow.com/q/24799059
tags question: http://stackoverflow.com/q/24851444
tags question: http://stackoverflow.com/q/24825402
tags question: http://stackoverflow.com/q/24773896
tags question: http://stackoverflow.com/q/24872852

http://stackoverflow.com/q/24899038
has comment: http://stackoverflow.com/comment/38680405
answer count: 3
possible better answer: http://stackoverflow.com/a/24899170
has answer: http://stackoverflow.com/a/24899170
tagged with: string
accepted answer: http://stackoverflow.com/a/24899138
score: 0
has comment: http://stackoverflow.com/comment/38680458
has body: Input: T (number of inputs) T number of integers (range 1 &lt; n &lt; 1000000000) Output: Number of trailing zero's in the factorial of the given numbers. My code is: import java.util.Scanner; import java.util.Scanner; import java.lang.StringBuilder; import java.lang.StringBuilder; import java.math.BigInteger; public class fact1 { public static void main(String args[]) { long t1, t2; Scanner sc = new Scanner(System.in); StringBuilder sb; int T = 0, i = 0, len = 0; BigInteger count = BigInteger.ZERO; T = sc.nextInt(); String[] c = new String[T]; BigInteger[] b = new BigInteger[T]; BigInteger[] result = new BigInteger[T]; for(i = 0; i &lt; T; i++) c[i]=sc.next(); for(i = 0; i &lt; T; i++) b[i]=new BigInteger(c[i]); for(i = 0; i &lt; T; i++) { result[i] = BigInteger.ONE; while( !b[i].equals(BigInteger.ONE)) { result[i] = result[i].multiply(b[i]); b[i] = b[i].subtract(BigInteger.ONE); } } t1 = System.nanoTime(); for(i = 0; i &lt; T; i++) { len = result[i].toString().length() - 1; sb = new StringBuilder(result[i].toString()); while(len &gt;= 0) { if(sb.toString().charAt(len) == '0') { count = count.add(BigInteger.ONE); len--; } else { System.out.println(count); break; } } } t2=System.nanoTime(); System.out.println(t2-t1); } Sample input/output: Input 2 (T) 10 c[0] 100 c[1] Output: 2 26 It works perfectly but the problem being it's very slow and I need to improve the speed drastically and for like 1 million inputs it takes like 40 seconds to execute. My guess is the conversion of BigInteger to String and charAt() operation are the culprits. Is there any way to improve the performance? Update: I changed my code according to Peter Lawrey's suggestion and it works like a charm and I can't measure the time taken in seconds and ended up changing to nano Seconds. My edited code is: import java.util.Scanner; public class fact2 { public static void main(String args[]) { int T=0,i=0,count=0,result=0,k=0; Scanner sc=new Scanner(System.in); T=sc.nextInt(); int n[]=new int[T]; for(i=…
has comment: http://stackoverflow.com/comment/38680889
tagged with: biginteger
type: Question
type: AnsweredQuestion
has title: How to improve performance of charAt with BigIntegers?
tagged with: performance
has answer: http://stackoverflow.com/a/24899138
tagged with: java
has answer: http://stackoverflow.com/a/24899396

http://stackoverflow.com/comment/38530398
has text: `int` is a primitive. `Integer` is a wrapper on `int`. AutoBoxing/ Unboxing is done by the compiler. So, unless you have explicit need to store the primitive `int` as an `Integer` *object*, I'd almost always go with `int`.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24819965

http://stackoverflow.com/comment/38472324
comment on: http://stackoverflow.com/q/24788707
type: Comment
type: QuestionComment
has text: But why are you using `for` loops when you are reading only one value?
score: 0

http://stackoverflow.com/comment/38584514
type: AnswerComment
comment on: http://stackoverflow.com/a/24802891
type: Comment
has text: @Sandeep To find additional proper pairs - when `1/a[R]+1/a[L]` exceeds 1, but `1/a[R-k]+1/a[L+p]` still less than 1
score: 0

http://stackoverflow.com/comment/38419092
has text: Well, as I understand, it isn't true - he builds bigger graph for debug mode and reinject mock implementation of ApplicationContainer (DebugAppContainer) for Mock Mode. In my opinion it isn't rebuilding graph. Yes, Activity is destroyed but graph is still the same.
comment on: http://stackoverflow.com/a/24760463
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38500586
type: Comment
type: QuestionComment
has text: MouseMotionListener doesn't react to mousePressed/Clicked
comment on: http://stackoverflow.com/q/24804172
score: 0

http://stackoverflow.com/comment/38520653
type: AnswerComment
type: Comment
has text: That's the wonderful and terrible thing about software - it changes :)
comment on: http://stackoverflow.com/a/24797839
score: 0

http://stackoverflow.com/q/24840038
tagged with: jdbc
has answer: http://stackoverflow.com/a/24840173
has answer: http://stackoverflow.com/a/24840184
has comment: http://stackoverflow.com/comment/38567723
tagged with: mysql
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/24840184
has comment: http://stackoverflow.com/comment/38568042
tagged with: prepared-statement
type: AnsweredQuestion
has title: JDBC How can I use a place holder in a prepared statement with a where clause?
accepted answer: http://stackoverflow.com/a/24840173
tagged with: java
type: Question
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/24826029
favorite count: 0
has comment: http://stackoverflow.com/comment/38568381
has comment: http://stackoverflow.com/comment/38585852
has body: I'm having a hard time understanding why this wont work, if I type the exact same thing straight into a MySQL console it accepts it but when ever I try to run it, it reports a syntax error. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '6'' at line 1 All I'm trying to do is receive the data in the row with the member_id value of whatever the user inputs. For testing purposes the value is always 6, I have tried parsing it as int instead of a string, which gave the same error, and I tried just adding the ID variable onto the end of the string instead of using a place holder but it didn't like that much either. Here is the code: public class MemberDAO { public PreparedStatement ps = null; public Connection dbConnection = null; public List&lt;Member&gt; getMembersDetails(String ID) throws SQLException{ List&lt;Member&gt; membersDetails = new ArrayList(); String getMembershipDetails = "SELECT first_name, last_name, phone_number, email, over_18, date_joined, date_expire, fines FROM members" + "WHERE member_id = ?"; try { DBConnection mc = new DBConnection(); dbConnection = mc.getConnection(); ps = dbConnection.prepareStatement(getMembershipDetails); ps.setString(1, ID); ps.executeQuery(); ResultSet rs = ps.executeQuery(getMembershipDetails); String firstName = rs.getString("first_name"); String lastName = rs.getString("last_name"); String phoneNumber = rs.getString("phone_number"); String email = rs.getString("email"); String over18 = rs.getString("over_18"); String dateJoined = rs.getString("date_joined"); String dateExpired = rs.getString("date_expire"); String fines = rs.getString("fines"); Member m; m = new Member(firstName, lastName, phoneNumber, email, over18, dateJoined, dateExpired, fines); membersDetails.add(m); } catch (SQLException ex){ System.err.println(ex); System.out.println("Failed to get Membership Details."…
has comment: http://stackoverflow.com/comment/38568287

linux
tags question: http://stackoverflow.com/q/24823523
tags question: http://stackoverflow.com/q/24899683
tags question: http://stackoverflow.com/q/24832607
tags question: http://stackoverflow.com/q/24810805
tags question: http://stackoverflow.com/q/24845267
tags question: http://stackoverflow.com/q/24852782
tags question: http://stackoverflow.com/q/24835316
tags question: http://stackoverflow.com/q/24875970
tags question: http://stackoverflow.com/q/24827358
tags question: http://stackoverflow.com/q/24814966
type: Tag
tags question: http://stackoverflow.com/q/24763534
tags question: http://stackoverflow.com/q/24833296
tags question: http://stackoverflow.com/q/24831291
tags question: http://stackoverflow.com/q/24898477
tags question: http://stackoverflow.com/q/24895362
tag name: linux
tags question: http://stackoverflow.com/q/24785875
tags question: http://stackoverflow.com/q/24811416
tags question: http://stackoverflow.com/q/24794524
tags question: http://stackoverflow.com/q/24891347
tags question: http://stackoverflow.com/q/24899959
tags question: http://stackoverflow.com/q/24789321
tags question: http://stackoverflow.com/q/24767786
tags question: http://stackoverflow.com/q/24867411
tags question: http://stackoverflow.com/q/24866814
tags question: http://stackoverflow.com/q/24853314
tags question: http://stackoverflow.com/q/24750522
tags question: http://stackoverflow.com/q/24850014
tags question: http://stackoverflow.com/q/24802470
tags question: http://stackoverflow.com/q/24763487
tags question: http://stackoverflow.com/q/24802042
tags question: http://stackoverflow.com/q/24806154
tags question: http://stackoverflow.com/q/24852305
tags question: http://stackoverflow.com/q/24872995
tags question: http://stackoverflow.com/q/24792337

http://stackoverflow.com/comment/38488647
score: 0
comment on: http://stackoverflow.com/q/24797675
has text: Something like this? http://www.mastertheboss.com/interceptors/listeners/jpa-entity-listeners
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24832467
has comment: http://stackoverflow.com/comment/38555806
answer count: 1
tagged with: java-io
has body: I have a java application running into a weblogic server. The application have to write a file into the path \bla\john doe (for example). For this, I used the java.io.File library to: 1. Verify if the path exists 2. If not, create it. 3. Verify if the file exists 4. if not, create it 5. Write the bytes into the file. The correct behavior would be to create the directory bla into the root of the weblogic's current domain and then create a john doe inside it. The problem is: in my current enviroment it works like a charm, but in the client's one, the application does not consider the backslash as an element of the path, and instead of creating two directories, the application only creates one, literally named as \bla\john does. So, instead of: -domain_root -bla -john does I get the following: -domain_root -\bla\john does (and if I escape it, occurres the same but with two backslash) The odd is that if I use the commom slash (/bla/john doe), it works.. -domain_root -bla -john does Does any one knows what possibly can be happening? script for check the path public File checkPath(String path) { File f = new File(cls_Util.NeutralizeFilePath(path)); if (!(f.exists() &amp;&amp; f.isDirectory())) { try { f.mkdirs(); } catch (Exception e) { e.printStackTrace(); return null; } } return f; } script for check the file: public File checkFile(String path){ File f = new File(path); return checkFile(f); } public File checkFile(File f) { if (!(f.exists() &amp;&amp; f.isFile())) { try { f.createNewFile(); } catch (IOException e) { e.printStackTrace(); return null; } } return f; } script for create file public File writeFile(String path, byte[] binaryfile) { File file = checkFile(path); if (file != null) { FileOutputStream fos; try { fos = new FileOutputStream(path); try { fos.write(binaryfile); fos.close(); } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } return file; } return null; } And to create the file: String filePathPub…
has comment: http://stackoverflow.com/comment/38556186
accepted answer: http://stackoverflow.com/a/24836417
score: 0
tagged with: file
has comment: http://stackoverflow.com/comment/38555136
has comment: http://stackoverflow.com/comment/38559620
type: Question
type: AnsweredQuestion
has title: java.io.file backslash saving in weblogic's root
tagged with: weblogic
has comment: http://stackoverflow.com/comment/38555916
tagged with: java
tagged with: fileoutputstream
has answer: http://stackoverflow.com/a/24836417

http://stackoverflow.com/q/24809167
tagged with: java
tagged with: formatter
type: Question
has title: Eclipse formatter to allow aligning ='s and Javadoc tab
score: 5
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/43946430
downvote count: 0
has answer: http://stackoverflow.com/a/44076757
favorite count: 0
accepted answer: http://stackoverflow.com/a/44076757
upvote count: 5
type: AnsweredQuestion
has body: I am working with an Eclipse formatter and I want the following code formatting. Note how the JavaDoc and ='s are aligned. What I want: /** * Description. * * @param alpha this is what alpha does * @param beta this is what beta does * @param gamma this is what gamma does * @param delta this is what delta does */ public Foo(Bar alpha, Bar beta, Bar gamma, Bar delta) { this.alpha = alpha; this.beta = beta; this.gamma = gamma; this.delta = delta; } What eclipse formats: /** * * @param alpha this is what alpha does * @param beta this is what beta does * @param gamma this is what gamma does * @param delta this is what delta does */ public Foo(Bar alpha, Bar beta, Bar gamma, Bar delta) { this.alpha = alpha; this.beta = beta; this.gamma = gamma; this.delta = delta; } Does anyone know if this is possible? If it is not possible to do this automatically, is it possible to have the formatter ignore the whitespace on those lines?
linked to: http://stackoverflow.com/q/234594
possible better answer: http://stackoverflow.com/a/43946430

http://stackoverflow.com/comment/38587857
score: 1
comment on: http://stackoverflow.com/q/24850359
has text: What size of data do you expect?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24859212
tagged with: gridbaglayout
has body: I'm about to learn Java. And I'm trying to write a GUI for a simple calculator with a GridBagLayout. The problem is that my "+" Button isn't over 2 rows hight. I don't know why? I tried to do it once in the last row with: c.gridwidth = 1; c.gridy = 4; c.gridx = 3; c.gridheight = 2; c.ipady = 26; subpanel.add(bplus, c); and once in the 2. last row. c.gridwidth = 1; c.gridy = 3; c.gridx = 3; c.gridheight = 2; c.ipady = 26; subpanel.add(bplus, c); Here is the hole code of the gui, if you want to test it, maybe you have to adjust the main. package gui; import classes.Rechner; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; /** * Created by tq67 on 17.07.2014. */ public class CalculatorGUI extends JFrame { public static void main(String[] args) { CalculatorGUI gui = new CalculatorGUI(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setVisible(true); } public CalculatorGUI() { setTitle("Calculator"); setBounds(300, 300, 220, 225); JPanel subpanel = new JPanel(); JPanel headpanel = new JPanel(); final JTextField input = new JTextField(); input.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { if (10 == e.getKeyCode()) { Rechner rechner = new Rechner(input.getText()); input.setText(rechner.rechnen().toPlainString()); } if (27 == e.getKeyCode()) { input.setText(""); } } }); ActionListener buttonListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { input.setText(input.getText() + e.getActionCommand()); } }; ActionListener resultListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("=")) { Rechner rechner = new Rechner(input.getText()); input.setText(rechner.rechnen().toPlainString()); } else { input.setText("…
tagged with: user-interface
downvote count: 0
answer count: 1
tagged with: layout-manager
score: 4
favorite count: 0
has title: GridBagLayout doesn't accept my rowspan command(gridtheight)
accepted answer: http://stackoverflow.com/a/24859344
tagged with: swing
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24859344
type: Question
upvote count: 4

http://stackoverflow.com/comment/38555345
comment on: http://stackoverflow.com/q/24825010
type: Comment
type: QuestionComment
has text: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Web_Platform/5/html/Hibernate_Core_Reference_Guide/objectstate-flushing.html
score: 1

http://stackoverflow.com/q/24901391
upvote count: 5
tagged with: jackson
score: 5
tagged with: playframework
has answer: http://stackoverflow.com/a/24904506
has comment: http://stackoverflow.com/comment/38688394
answer count: 1
downvote count: 0
has body: Summary How can I map a JSON name to a Java class' field name that might be (slightly) different when using the Jackson parser? Details I have incoming JSON documents I would like to convert to a Java object using the Jackson parser. This works well for where the JSON names match the eventual Java object field names (I am doing this within the Play Framework). However some JSON names in the incoming JSON document do not lend themselves to nice Java field names. Changing all the existing JSON documents to use proper Java naming conventions is currently not feasible. For example { "goodName": "value", "not-so-handy": "value" } I can't create a Java class with a field name of "not-so-handy" since that is not a legal name in Java. How can I translate an incoming JSON name to a designated Java class' field name using the Jackson parser?
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24904506
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Mapping JSON names to Java class fields/methods (Jackson Parser)
type: Question

http://stackoverflow.com/q/24799307
tagged with: unix
has comment: http://stackoverflow.com/comment/38504213
score: -1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38491803
tagged with: ksh
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38491941
has comment: http://stackoverflow.com/comment/38492263
has comment: http://stackoverflow.com/comment/38491879
accepted answer: http://stackoverflow.com/a/24799484
has body: I need to write a function (logic) so that for a set say A{1,2,3,4,5} i generate a unique value . and when i pass back the same value back to the function it should return me the set of values present in the set . For example the unique value generated is say '5' then when i pass 5 as input to the function it should give me all the values of set A i.e 1,2,3,4,5. So i need to know if it can be achieved using any statistical approach like mean median mode etc something like that .
upvote count: 0
tagged with: sql
answer count: 1
has title: regarding generating a unique value for a set of numbers and regenerating the set of values when we pass back the same unique value
favorite count: 0
tagged with: php
has answer: http://stackoverflow.com/a/24799484

http://stackoverflow.com/comment/38469183
comment on: http://stackoverflow.com/q/24781490
has text: Please go to [The Java Tutorials: **Learning the Java Language**](http://docs.oracle.com/javase/tutorial/java/index.html)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24769243
answers question: http://stackoverflow.com/q/24768353
has body: If you are using the command line to compile and manage your spring framework application, you are totally on the wrong way! Letting go a wonderful IDE like eclipse with spring plugins which suit perfectly with your application! If you ask me, I use all that stuff above and I almost manage to get something out of my web application, and what about you? I mean to run and compile a hello world application with notepad and command line is ok, But an application as complex as Spring Framework 3, you gotta be kidding me. It's the time to use a serious IDE. Note: All the keywords in my answer are hypertexts to enable you surf instantly a proper site.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38470322

http://stackoverflow.com/comment/38626079
comment on: http://stackoverflow.com/q/24829831
type: Comment
has text: When you say you "reinstalled", are you referring to jenkins or the operating system? If you're getting 1.570, your ports tree may be out of date, try updating it. I wouldn't recommend having multiple JDKs installed, that will just make things confusing. Jenkins works well with openjdk7. Jenkins expects to be headless, so adding that manually shouldn't be needed. And you should always use the rc script for jenkins, not start it manually. It sets JENKINS_HOME, which you are not setting, I think that is the source of the issue.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38694186
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24906254
type: QuestionComment
has text: Actually problem solved, I was identifying the different object and using different object to send the values. Now it works fine. Thank you so much Sing31:) The correct code is WebElement CCExpiryMonth1 = wd.findElement(By.xpath("//*[@id='cc_exp_year']")); Select clickCCExpiryMonth1 = new Select(CCExpiryMonth1); clickCCExpiryMonth1.selectByValue("2018");

http://stackoverflow.com/comment/52009894
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24824481
has text: @AmrAbdelwahab did you manage to do RTMP encoder using android Camera??
score: 0

http://stackoverflow.com/comment/38579215
score: 0
has text: Thanks, that fixed it. The tutorial I was using said to use PreferenceFragment over PreferenceActivity because it is no longer used above API 11.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24845949

http://stackoverflow.com/a/24820426
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24819556
type: Answer
answers question: http://stackoverflow.com/q/24819556
has body: Try that : @FunctionalInterface interface TwoArgumentFunction&lt;T, K, V&gt; { T doJob(K arg1, V arg2); } //I know I've ommited return value in that case public &lt;T, K, V&gt; T runLongAction(final TwoArgumentFunction&lt;? extends T, ? super K, ? super V&gt; action, final K arg1, final V arg2) { return action.doJob(arg1, arg2); } private void test() { final String a = "A"; final Long b = 1L; this.runLongAction((ta, tb) -&gt; {return 1;}, a, b); } You were putting the generics on the method, while I putted it on the interface. And I also added ? super and ? extends (but this work without it). In case you don't know it and if you need it, you can also put the type in the lambda : this.runLongAction((String ta, Long tb) -&gt; {return 1;}, a, b);
upvote count: 10
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/38531589

http://stackoverflow.com/a/24759280
accepted answer of: http://stackoverflow.com/q/24759279
score: 2
upvote count: 2
has body: I found the answer while writing the question itself. Here is the list of supported character encodings for Java, and how to specify them in the code block I provided in the question: http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html So this is what works for me: writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("test.txt"), "ibm-437")); What caused problems in my case was that Google was littered with questions for UTF-8 character encoding. Furthermore, PC8 is not the official name for the character encoding, so I couldn't find the needed information with that name. Hope this helps generally with encoding problems.
answers question: http://stackoverflow.com/q/24759279
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24788565
has comment: http://stackoverflow.com/comment/38472310
upvote count: 1
has body: If you write multiple objects in a thread, and one of them fails because it's a duplicate, then you'll have to work out which one was the duplicate, remove it from the set, and retry writing it to the DB (with a change of another failure). This takes a lot of time. Alternatively, you could read the DB to see if there are any duplicates before writing the set, and remove the duplicates before writing. This read/check/write pattern is flawed if it is not contained within a synchronised block, because other threads could write duplicates between the steps. The synchronisation needed to fix this will stall your server on every write, pausing all existing threads, potentially harming performance. Instead, spawn a thread per object, and write the object within this thread (without the read/check). Most objects will write without issue, because most objects are not duplicated (an assumption, but it's probably right). Objects that are duplicates will fail with an exception, at which point you can terminate that thread because the relevant work is already done.
has comment: http://stackoverflow.com/comment/38472597
has comment: http://stackoverflow.com/comment/38472418
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24766184
answers question: http://stackoverflow.com/q/24766184
has comment: http://stackoverflow.com/comment/38473348
type: Answer

http://stackoverflow.com/comment/38445355
comment on: http://stackoverflow.com/a/24774948
score: 0
type: Comment
has text: @Dani sorry what? A `Map` is an excellent sparse array as _is_ used for that purpose. After all, what is an array apart from a special case of a `Map`?
type: AnswerComment

http://stackoverflow.com/a/24764484
type: Answer
has comment: http://stackoverflow.com/comment/38426544
downvote count: 1
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/24764378
has body: You can try calling @Override public void onBackPressed() { finish(); }
has comment: http://stackoverflow.com/comment/38425855
has comment: http://stackoverflow.com/comment/38425976

http://stackoverflow.com/comment/38578870
comment on: http://stackoverflow.com/q/24845767
score: 9
type: Comment
has text: 4094? Don't worry, you will be fine ...
type: QuestionComment

http://stackoverflow.com/comment/38642880
score: 1
has text: @omega that means you cant do `T[] names = new T[items.size()];` in your code.
comment on: http://stackoverflow.com/a/24879151
type: AnswerComment
type: Comment

spring
tags question: http://stackoverflow.com/q/24755600
tags question: http://stackoverflow.com/q/24891310
tags question: http://stackoverflow.com/q/24798695
tags question: http://stackoverflow.com/q/24885621
tags question: http://stackoverflow.com/q/24782810
tags question: http://stackoverflow.com/q/24890657
tags question: http://stackoverflow.com/q/24853949
tags question: http://stackoverflow.com/q/24837233
tags question: http://stackoverflow.com/q/24763580
tags question: http://stackoverflow.com/q/24881302
tags question: http://stackoverflow.com/q/24793247
tags question: http://stackoverflow.com/q/24879599
tags question: http://stackoverflow.com/q/24897158
tags question: http://stackoverflow.com/q/24888042
tags question: http://stackoverflow.com/q/24866145
tags question: http://stackoverflow.com/q/24786090
tags question: http://stackoverflow.com/q/24872350
tags question: http://stackoverflow.com/q/24794379
tags question: http://stackoverflow.com/q/24755207
tags question: http://stackoverflow.com/q/24818614
tags question: http://stackoverflow.com/q/24813947
tags question: http://stackoverflow.com/q/24813303
tags question: http://stackoverflow.com/q/24754954
tags question: http://stackoverflow.com/q/24750517
tags question: http://stackoverflow.com/q/24870730
tags question: http://stackoverflow.com/q/24756134
tags question: http://stackoverflow.com/q/24845871
tags question: http://stackoverflow.com/q/24872529
tags question: http://stackoverflow.com/q/24840534
tags question: http://stackoverflow.com/q/24885948
tags question: http://stackoverflow.com/q/24842754
tags question: http://stackoverflow.com/q/24827963
tags question: http://stackoverflow.com/q/24829212
tags question: http://stackoverflow.com/q/24880646
tags question: http://stackoverflow.com/q/24881938
tags question: http://stackoverflow.com/q/24830965
tags question: http://stackoverflow.com/q/24785423
tags question: http://stackoverflow.com/q/24899312
tags question: http://stackoverflow.com/q/24760488
tags question: http://stackoverflow.com/q/24812260
tags question: http://stackoverflow.com/q/24857003
tags question: http://stackoverflow.com/q/24890351
tags question: http://stackoverflow.com/q/24759373
tags question: http://stackoverflow.com/q/24874980
tags question: http://stackoverflow.com/q/24864836
tags question: http://stackoverflow.com/q/24870297
tags question: http://stackoverflow.com/q/24786962
tags question: http://stackoverflow.com/q/24755676
tags question: http://stackoverflow.com/q/24767749
tags question: http://stackoverflow.com/q/24866189
tags question: http://stackoverflow.com/q/24789581
tags question: http://stackoverflow.com/q/24757819
tags question: http://stackoverflow.com/q/24756618
tags question: http://stackoverflow.com/q/24808196
tags question: http://stackoverflow.com/q/24773077
tags question: http://stackoverflow.com/q/24796435
tags question: http://stackoverflow.com/q/24886278
tags question: http://stackoverflow.com/q/24854527
tags question: http://stackoverflow.com/q/24903881
tags question: http://stackoverflow.com/q/24784165
tags question: http://stackoverflow.com/q/24797912
type: Tag
tags question: http://stackoverflow.com/q/24778540
tags question: http://stackoverflow.com/q/24891098
tags question: http://stackoverflow.com/q/24847025
tags question: http://stackoverflow.com/q/24752326
tags question: http://stackoverflow.com/q/24887914
tags question: http://stackoverflow.com/q/24757575
tags question: http://stackoverflow.com/q/24878980
tags question: http://stackoverflow.com/q/24826775
tags question: http://stackoverflow.com/q/24863018
tags question: http://stackoverflow.com/q/24907449
tags question: http://stackoverflow.com/q/24814174
tags question: http://stackoverflow.com/q/24843520
tags question: http://stackoverflow.com/q/24848784
tags question: http://stackoverflow.com/q/24838284
tags question: http://stackoverflow.com/q/24816920
tags question: http://stackoverflow.com/q/24901118
tags question: http://stackoverflow.com/q/24808195
tags question: http://stackoverflow.com/q/24772329

http://stackoverflow.com/q/24777242
has comment: http://stackoverflow.com/comment/38451416
has comment: http://stackoverflow.com/comment/38459269
has title: Redirection or Refresh Page After Zip Download
has comment: http://stackoverflow.com/comment/38458887
has comment: http://stackoverflow.com/comment/38460116
has body: I am calling the servlet through href in my .vm file(as I am using velocity framwork for front end) when the request goes to servlet I am downloading a file on that. The file genration for downloading in takes around 30 seconds so I want to indicate end user through pop-up, For this I have called a function on same href in my .vm file which is opening a pop up indicating that file is generating currently so please wait. but when file generation and downloading finish I want to remove that pop up. I was tried this through redirection on servlet but after googled I found that we can't change the status of response after downloading (link). I am calling javascript function and servlet in my vm file like this Generate Report overriderulehandler is calling my servlet and I am preparing file for download here and reportResponse is JS function in which I am opening popup. Please suggest me how should I do this task. If anyone have other idea about this please share. Any help is appreciated.
score: 8
has answer: http://stackoverflow.com/a/24782527
tagged with: java
type: UnansweredQuestion
tagged with: servlets
linked to: http://stackoverflow.com/q/17921797
answer count: 2
has comment: http://stackoverflow.com/comment/38501839
linked to: http://stackoverflow.com/q/19596657
downvote count: 0
has comment: http://stackoverflow.com/comment/38459145
tagged with: javascript
has answer: http://stackoverflow.com/a/40402519
favorite count: 0
has comment: http://stackoverflow.com/comment/38456544
upvote count: 8
type: Question

http://stackoverflow.com/comment/38434297
has text: right! but i wasnt sure how to test my histogram object with my map... i believe i cant see the relation between the histogram and the hashmap object witch is why my logic for testing is jumbled up. in my constructor, my conditions are for hashmap. but how do i test hashmap through my constructor object?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24768076

http://stackoverflow.com/comment/38672591
score: 0
comment on: http://stackoverflow.com/q/24894658
type: Comment
type: QuestionComment
has text: Have you considered using already existing SDKs to work with BLE on android? Like those provided by Estimote or Radiusnetwork.

http://stackoverflow.com/comment/38659372
has text: Sorry Kaijiro, I wrote my answer from memory, the file name is `cacerts` not -truststore- I'll correct my answer
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24872636

http://stackoverflow.com/comment/38561284
type: QuestionComment
has text: Are you familiar with the MCV design pattern, model-view-control? That's what many folks use, and you'd link the model and the view (the GUI) through the control.
score: 0
comment on: http://stackoverflow.com/q/24836365
type: Comment

http://stackoverflow.com/a/24811635
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/24793823
answers question: http://stackoverflow.com/q/24793823
type: Answer
upvote count: 6
has body: Just wanted to follow up and post code for if anyone finds this via search. My code in the question was taking 3.4s on average, the code below using Gabe's advice is taking under 200ms. I also added a length variable because I read not calling array.length() every iteration could improve performance, but in testing there doesn't seem to be much of a benefit int width = img.getWidth(); int height = img.getHeight(); int length = width * height; int[] pixels = new int[width*height]; img.getPixels(pixels, 0, width, 0, 0, width, height); for (int i = 0; i &lt; length; i++) { if (filter(pixels[i])) { pixels[i] = Color.rgb(0, 0, 0); } else pixels[i] = Color.rgb(255, 255, 255); } img.setPixels(pixels, 0, width, 0, 0, width, height);
type: AcceptedAnswer

http://stackoverflow.com/q/24797675
has comment: http://stackoverflow.com/comment/38488647
has answer: http://stackoverflow.com/a/24797761
favorite count: 0
type: Question
answer count: 1
tagged with: java
has body: I've found out that the database I'm using contains in some fields some special characters, like ASCII control characters (26 SUB etc.). They are causing problems because they made XMLs invalid etc. I'd like to filter them out with the most transparent way as possible. Is it possible to activate some filter in JPA, that will process the string values read from database and will apply to every text field, without doing the filtering manually? Applying filters like those mentioned in removing invalid XML characters from a string in java works, when I manually change the string field in entity.
upvote count: 1
linked to: http://stackoverflow.com/q/4237625
has title: Remove 'invalid' characters from strings in JPA
type: UnansweredQuestion
tagged with: jpa
downvote count: 0
score: 1
tagged with: unicode

http://stackoverflow.com/comment/38539088
has text: @Seb I'm trying to process annotations let's say 100 times in a row and then collect results, I don't need to actually compile source into the bytecode
type: QuestionComment
comment on: http://stackoverflow.com/q/24824343
score: 0
type: Comment

http://stackoverflow.com/comment/38728843
comment on: http://stackoverflow.com/a/24911842
score: 0
has text: When `SESSION_TRANSACTED` is true. The message listener cannot get the message when I test. I also have like that problem. When `MessageSender` is use `SESSION_TRANSACTED` with true, How to get the message from `MessageConsumer`?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/47610753
score: 1
upvote count: 1
has body: public class ReverseStack { public static void main(String[] args) { Stack&lt;Integer&gt; stack =new Stack&lt;Integer&gt;(); stack.add(3);stack.add(0);stack.add(2);stack.add(1); sortStack(stack); System.out.println(stack.toString()); } public static void sortStack(Stack&lt;Integer&gt; stack){ int tempElement=stack.pop(); if(!stack.isEmpty()){ sortStack(stack); } insertStack(stack,tempElement); } private static void insertStack(Stack&lt;Integer&gt; stack, int element) { if(stack.isEmpty()){ stack.push(element); return; } int temp=stack.pop(); //********* For sorting in ascending order******** if(element&lt;temp){ insertStack(stack,element); stack.push(temp); }else{ stack.push(temp); stack.push(element); } return; } }
answers question: http://stackoverflow.com/q/24768011
downvote count: 0
type: Answer

http://stackoverflow.com/q/24858574
has comment: http://stackoverflow.com/comment/38603931
duplicate of: http://stackoverflow.com/q/4870667
has title: using getsystemservice function outside activity
favorite count: 0
type: Question
tagged with: android
linked to: http://stackoverflow.com/q/17914170
tagged with: android-activity
has comment: http://stackoverflow.com/comment/38603932
has body: I want to use getSystemService in a non-Activity class but when i do I get some error. here is the code below: double latitude,longitude; android.location.Location l; static LocationManager lm; Toast.makeText(context, "Before", Toast.LENGTH_SHORT).show(); lm = (LocationManager)getSystemService(LOCATION_SERVICE); l = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); latitude= l.getLatitude(); longitude = l.getLongitude(); String po="after"; Toast.makeText(context, po1, Toast.LENGTH_LONG).show(); I do not want to use any other activity class. Any help would be appreciated. All this work is done in a non activity class method. here is the full code of broadcast reciever public class SMSReciever extends BroadcastReceiver { android.location.Location l; static LocationManager lm; SmsMessage[] msgs = null; String str = ""; double lat,lng; String request,ipaddress="",originatingno; public void onReceive (Context context, Intent intent) { // Parse the SMS. Bundle bundle = intent.getExtras(); if(bundle != null) { // Retrieve the SMS. Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for (int i=0; i&lt;msgs.length; i++) { msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]); request=msgs[i].getMessageBody().toString(); ipaddress=request.substring(4); originatingno= msgs[i].getOriginatingAddress(); } if(request.startsWith("fr")) { sabkuch db =new sabkuch(context); db.open(); long id = db.insertContact(originatingno,"shubh"); db.close(); } if(request.startsWith("lr")) { double latitude,longitude; Toast.makeText(context, "Before", Toast.LENGTH_SHORT).show(); lm = (LocationManager)context.getSystemService(context.LOCATION_SERVICE); //String provider = LocationManager.GPS_PROVIDER; l = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); latitude= l.getLatitude(); longitude = l.getLongitude(); String po="Shubham's location: " + " Latitude: "+String.valueOf(latitude)+ " Longitude: "+String.valueOf(longitude); Toast.makeText(context, po,…
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24858651
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4870667

http://stackoverflow.com/a/24774490
has comment: http://stackoverflow.com/comment/38444598
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
has body: LinkedList has a listIterator(int) method. So you can use: // Start at the end... ListIterator&lt;Foo&gt; iterator = list.listIterator(list.size()); while (iterator.hasPrevious()) { Foo foo = iterator.previous(); } That doesn't prove that it's a doubly-linked list - that could be implemented very inefficiently in a single-linked list, for example - but that's how I'd go about iterating over a linked list backwards.
has comment: http://stackoverflow.com/comment/38447684
type: Answer
has comment: http://stackoverflow.com/comment/38444590
answers question: http://stackoverflow.com/q/24774399
has comment: http://stackoverflow.com/comment/38444673
accepted answer of: http://stackoverflow.com/q/24774399

http://stackoverflow.com/q/24898375
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38679060
type: Question
has comment: http://stackoverflow.com/comment/38680479
answer count: 1
score: -1
has answer: http://stackoverflow.com/a/24898404
has body: I have a json file that contains lots of field which i want to seperate so that i can use it as each different field.Basically i want to split them and store them as each individual field so that i can use that file with the mysql.
linked to: http://stackoverflow.com/q/1688099
downvote count: 1
has comment: http://stackoverflow.com/comment/38680493
favorite count: 0
upvote count: 0
has title: How to split the data in json file using java?
duplicate of: http://stackoverflow.com/q/1688099
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38679045
has comment: http://stackoverflow.com/comment/38714610
has comment: http://stackoverflow.com/comment/38720422
has comment: http://stackoverflow.com/comment/38679111
has comment: http://stackoverflow.com/comment/38679056

http://stackoverflow.com/q/24754495
has title: Java Applet working only on Maximized Mode
answer count: 1
score: 0
tagged with: java
has body: I wrote a simple Java Applet code in Eclipse. It is a Centimeter to Meter converter code. It shows the result only when the Applet is in the Maximized Mode. On minimized mode when I click Submit Button, the result is not displayed. But without changing anything in the applet if I maximize the Applet, the answer is displayed. Why is it so? My other codes work fine in the minimized mode. Following is the code package converter; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.applet.*; public class convert extends Applet implements ActionListener { private static final long serialVersionUID = 1L; Button a; String msg =""; String msg1 = ""; String msg2 = ""; TextField m,n; Label l,p; float x,y; public void init() { setLayout(new GridLayout(5,5)); a = new Button("Submit"); m = new TextField(msg,10); n = new TextField(msg,10); l = new Label("IN CM"); p = new Label("IN M"); add(l); add(m); add(a); add(p); add(n); a.addActionListener(this); m.addActionListener(this); n.addActionListener(this); } public void actionPerformed(ActionEvent ae) { msg1 = ae.getActionCommand(); if(msg1.equals("Submit")) { repaint();} } public void paint(Graphics g) { msg2 = m.getText(); x = Integer.parseInt(msg2); y = x/100; msg = y + ""; n.setText(msg); } }
tagged with: awt
has answer: http://stackoverflow.com/a/24755216
type: AnsweredQuestion
tagged with: applet
accepted answer: http://stackoverflow.com/a/24755216
type: Question

http://stackoverflow.com/a/24807543
has body: Define your spinner where you want it As a spinner_button_dropdown you can use a selector like this (I know you're not asking for this but it shows how to customize the look): <?xml version="1.0" encoding="utf-8"?> <item android:drawable="@drawable/spinner_pressed" android:state_pressed="true" /> <item android:drawable="@drawable/spinner_normal" android:state_focused="true" /> <item android:drawable="@drawable/spinner_normal" /> in your code you inflate it mySpinner = (Spinner)getView().findViewById(R.id.spinner); mySpinner.setAdapter(myAdapter); myAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); As you can see, the look of the spinner in this example is not set from within, but user 3249477 said, from outside. Hope it helps you get going.
answers question: http://stackoverflow.com/q/24798884
type: Answer
score: 0

http://stackoverflow.com/comment/38654331
score: 0
comment on: http://stackoverflow.com/q/24884165
type: QuestionComment
type: Comment
has text: No problem, the duplication is not very obvious :-). But your program does exit very soon after allocating the object, and therefore before the garbage collector has run, and therefore before the finalizer is executed - just like in the linked question. Its answers should therefore be applicable.

http://stackoverflow.com/comment/38701695
type: QuestionComment
comment on: http://stackoverflow.com/q/24907155
has text: Interesting. I'd be tempted to try and suss out the structural differences between .dotx and .docx files, perhaps by comparing a file that has been converted successfully, using a tool like [DOTX to DOCX Converter](http://techblissonline.com/dotx-what-is-dotx-file/)
score: 1
type: Comment

http://stackoverflow.com/a/24812380
downvote count: 0
score: 1
has body: Use an XSLT transformation to convert your XML into an XSLT stylesheet and then execute the XSLT stylesheet. It's simple enough to convert &lt;parameters&gt; &lt;parameter name="parent-id" value="1" /&gt; &lt;parameter name="child-id" value="1" /&gt; &lt;/parameters&gt; into &lt;xsl:param name="parent-id" select="1" /&gt; &lt;xsl:param name="child-id" select="1" /&gt; and &lt;Parent id="$(parent-id)"&gt; into &lt;Parent id="{$parent-id}"&gt; and to add a wrapper xsl:stylesheet and xsl:template element, and then you're done.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24807000
accepted answer of: http://stackoverflow.com/q/24807000
type: Answer

http://stackoverflow.com/q/24837236
favorite count: 0
has comment: http://stackoverflow.com/comment/38562852
type: UnansweredQuestion
has title: Couldn't insert fields in database
has comment: http://stackoverflow.com/comment/38562880
has comment: http://stackoverflow.com/comment/38563047
has comment: http://stackoverflow.com/comment/38562904
has comment: http://stackoverflow.com/comment/38563069
has comment: http://stackoverflow.com/comment/38563094
has answer: http://stackoverflow.com/a/24838480
has comment: http://stackoverflow.com/comment/38562807
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/38562998
tagged with: mysql
type: Question
has body: I am a new to java web development. I am trying to develop a project. I got SQLException Error. Here is my servlet code: protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { // TODO Auto-generated method stub res.setContentType("text/html"); PrintWriter pw=res.getWriter(); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ocp2","root", ""); ps=con.createStatement(); RequestDispatcher rr; String courseid=req.getParameter("courseid"); String coursename=req.getParameter("coursename"); String s1=req.getParameter("sday"); String s2=req.getParameter("smonth"); String s3=req.getParameter("syear"); String sdate=s1+'-'+s2+'-'+s3; String s4=req.getParameter("eday"); String s5=req.getParameter("emonth"); String s6=req.getParameter("eyear"); String edate=s4+'-'+s5+'-'+s6; String duration=req.getParameter("duration"); String fee=req.getParameter("fee"); pw.println("insert into course values('"+courseid+"','"+coursename+"','"+sdate+"','"+edate+"','"+duration+"',"+fee+")"); ps.executeUpdate("insert into course values('"+courseid+"','"+coursename+"','"+sdate+"','"+edate+"','"+duration+"',"+fee+")"); con.commit(); rr= req.getRequestDispatcher("incousuc.html"); rr.forward(req,res); } catch(ClassNotFoundException e) { pw.println("exception"+e); } catch(SQLException e) { pw.println("SQL EXCEPTION"); pw.println("TRY AGAIN"); } catch(Exception e) { pw.println("can't load driver"+e.getMessage()); } } Here is my HTML Code: &lt;/table&gt; &lt;/td&gt; &lt;td width="75%" align="center"&gt; &lt;h2&gt;New Course Details&lt;/h2&gt; &lt;form name="facreg" onsubmit="return check()" action="./inscourse" method="post"&gt; &lt;table width="500" height="30" border="0"&gt; &lt;tr&gt; &lt;td&gt; &lt;center&gt;courseid&lt;/center&gt; &lt;/td&gt; &lt;td&gt; &lt;input id="courseid" name="courseid" type="text" size="50" maxlength="100" value=""&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;…
has comment: http://stackoverflow.com/comment/38562916
score: -2
tagged with: servlets
has comment: http://stackoverflow.com/comment/38562827
upvote count: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/38584451
comment on: http://stackoverflow.com/q/24848539
type: Comment
score: 0
has text: @BasileStarynkevitch yes.
type: QuestionComment

http://stackoverflow.com/q/24841326
tagged with: android-scroll
tagged with: java
has title: Android Java - ListView and other elements in layout
tagged with: listview
type: Question
answer count: 2
score: 0
tagged with: android-listview
accepted answer: http://stackoverflow.com/a/24841797
tagged with: android
has answer: http://stackoverflow.com/a/24841797
possible better answer: http://stackoverflow.com/a/24841396
has body: I have the following layout: <?xml version="1.0" encoding="utf-8"?> <ImageView android:contentDescription="@string/feed_icon_typeofgame_description" android:id="@+id/typeOfGame" android:layout_width="@dimen/feed_item_profile_pic" android:layout_height="@dimen/feed_item_profile_pic" android:scaleType="fitCenter" /> <TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/feed_itemview_profile_name" android:textStyle="bold" /> <TextView android:id="@+id/type" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/feed_itemview_type_text" android:layout_alignParentRight="true" android:textColor="@color/feed_item_text_color" /> <TextView android:id="@+id/timestamp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/timestamp" android:textSize="@dimen/feed_itemview_timestamp" /> <TextView android:id="@+id/txtStatusMsg" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="5dp" android:paddingLeft="@dimen/feed_item_status_pad_left_right" android:paddingRight="@dimen/feed_item_status_pad_left_right" android:paddingTop="@dimen/feed_item_status_pad_top" android:textSize="@dimen/feed_itemview_desc" /> <View android:layout_width="fill_parent" android:layout_height="1dp" android:background="@color/feed_divider" android:layout_marginLeft="1dp" android:layout_marginRight="1dp" /> <ListView android:id="@+id/list_comment" android:layout_width="fill_parent" android:layout_height="fill_parent" android:divider="@color/feed_divider" android:dividerHeight="1px" /> The ListView doesn't scroll down, see the below picture How fix this problem? Maybe add ScrollView ? Or make the upper part of this element in view and add header of listvew?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24841396

http://stackoverflow.com/comment/67150655
comment on: http://stackoverflow.com/a/24797928
type: AnswerComment
score: 0
has text: Well, it's much better to add String.valueOf(personId) in selectionArgs.
type: Comment

http://stackoverflow.com/a/24893799
score: 2
answers question: http://stackoverflow.com/q/24893718
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38674025
upvote count: 2
has body: Are all attributes serializable? See: http://tomcat.apache.org/tomcat-8.0-doc/config/manager.html#Persistence_Across_Restarts
accepted answer of: http://stackoverflow.com/q/24893718

http://stackoverflow.com/comment/38482502
has text: I was told to just use ESC/POS commands? but I don't know how to use it... can anyone help me with ESC/POS?
score: 0
comment on: http://stackoverflow.com/q/24793655
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24757933
score: 0
tagged with: ejb
answer count: 1
has answer: http://stackoverflow.com/a/24759889
has title: java.lang.Class cannot be cast to java.lang.String when invoking a EJB Bean Method
has comment: http://stackoverflow.com/comment/38419129
has body: I've faced with the problem. I've successfully lookuped my remote bean from JBoss, but when I try to invoke any of its method next exception is about to appear: java.lang.Class cannot be cast to java.lang.String. Full stack trace is: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String at org.jboss.ejb.client.remoting.ProtocolMessageHandler.readAttachments(ProtocolMessageHandler.java:56) at org.jboss.ejb.client.remoting.InvocationExceptionResponseHandler$MethodInvocationExceptionResultProducer.getResult(InvocationExceptionResponseHandler.java:85) at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:212) at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:47) at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:214) at org.jboss.ejb.client.ReceiverInterceptor.handleInvocationResult(ReceiverInterceptor.java:96) at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:203) at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:341) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:126) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:107) at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:90) at com.sun.proxy.$Proxy32.createEvent(Unknown Source) at com.mypackage.FacadeImpl.createEvent(FacadeImpl.java:89) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) at com.sun.proxy.$Proxy28.createEvent(Un…
has comment: http://stackoverflow.com/comment/38413208
has comment: http://stackoverflow.com/comment/38415569
type: UnansweredQuestion
tagged with: classcastexception
tagged with: java
has comment: http://stackoverflow.com/comment/38418308
tagged with: jboss
type: Question

http://stackoverflow.com/comment/38403131
comment on: http://stackoverflow.com/a/24751802
score: 0
type: Comment
has text: @goodyzain It is a compiler error (not throwm) telling you I used the wrong class (i have fixed it now)
type: AnswerComment

http://stackoverflow.com/q/24835796
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/63041695
has comment: http://stackoverflow.com/comment/38560323
type: Question
has title: NoSuchMethodError: org.apache.commons.codec.binary.Base64.(I)V at org.apache.http.impl.auth.BasicScheme.(BasicScheme.java:65)
tagged with: httpclient
has comment: http://stackoverflow.com/comment/38560305
tagged with: glassfish
tagged with: post
answer count: 3
has answer: http://stackoverflow.com/a/24836734
has comment: http://stackoverflow.com/comment/38560330
has answer: http://stackoverflow.com/a/49773177
downvote count: 0
favorite count: 0
has body: This is occurring even though I'm not using Base64. I do have commons-codec-1.9 referenced and in the lib directory of my domain in Glassfish, and the code that causes the error is also referenced in httpclient-4.3.4 and in the lib directory. try { Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("myusername", "mypassword".toCharArray()); } }); String xmlRequestString = formatXMLRequest((Exception) exception); HttpClient client = HttpClientBuilder.create().build(); HttpPost post = new HttpPost("http://mysite.org/post.xml"); StringEntity entity = new StringEntity(xmlRequestString); entity.setContentType("text/xml"); post.setEntity(entity); client.execute(post); // &lt;--- HERE is where the error is thrown } catch (Exception ex) { Logger.getLogger(LogManagerBean.class.getName()).log(Level.SEVERE, null, ex); } Any ideas?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38560349
tagged with: apache-commons

http://stackoverflow.com/comment/38639158
comment on: http://stackoverflow.com/q/24877140
type: Comment
score: 1
has text: `MediaPlayer nasheed` is creating a local reference to the MediaPlayer in onCreate so your global reference is never getting set. Thus producing the NullPointerException in onPause. Change it to just `nasheed = MediaPlayer.create(LayoutClass.this, R.raw.yamanyara)`
type: QuestionComment

http://stackoverflow.com/a/24767442
has body: Found the answer...seems as though I was changing my local working directory, not remote. I had to change boolean result = client.storeFile("/example2.png", in); to boolean result = client.storeFile("/img/Places/Uploads/example2.png", in);
type: AcceptedAnswer
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24767276
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24767276
score: 1

http://stackoverflow.com/a/24821952
type: Answer
answers question: http://stackoverflow.com/q/24774208
score: 0
has body: Ok, for everyone having the same problem in the future: The computer with XAMPP may have given me all rights to the MySQL database, the computer itself however didn't allow access to any other computers. It's just a temporary solution, but I turned of the Windows Firewall on the computer with XAMPP and it worked.

http://stackoverflow.com/comment/38638562
type: Comment
comment on: http://stackoverflow.com/q/24860490
score: 0
has text: lib META-INF A.class C.class E.class In lib folder, there are 2.jar and some .dll file. In META-INF, there is MANIFEST.MF file.
type: QuestionComment

http://stackoverflow.com/q/24808196
has body: My test looks like public class ITCache extends AbstractIntegrationTest { @Test public void readCache() { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); assertNotNull(applicationContext); final SimpleCacheManager simpleCacheManager = (SimpleCacheManager) applicationContext.getBean("cacheManager"); System.out.println("cacheName:" + simpleCacheManager.getCacheNames().toString()); System.out.println(simpleCacheManager.getCache("genders").toString()); } } I deploy my project using maven-cargo plugin and can see the contents and find applicationContext.xml as well ➜ comma git:(S120297) ✗ jar -tvf integration/target/cargo/configurations/tomcat7x/webapps/common.war | grep app 2342 Wed Jul 16 20:28:32 PDT 2014 WEB-INF/classes/applicationContext.xml ➜ comma git:(S120297) ✗ But when I run test, I see failures as Tests in error: readCache(com.org.comma.integration.ITCache): IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist I also tried annotating my test as @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration (locations = "classpath*:/applicationContext*.xml") public class ITCache extends AbstractIntegrationTest { but still same issue What is going wrong here? UPDATE My web.xml has entry as following contextConfigLocation classpath:applicationContext.xml org.springframework.web.context.ContextLoaderListener
tagged with: maven
has comment: http://stackoverflow.com/comment/38508585
type: Question
has comment: http://stackoverflow.com/comment/38508344
has comment: http://stackoverflow.com/comment/38508439
tagged with: maven-cargo
has answer: http://stackoverflow.com/a/24811963
has comment: http://stackoverflow.com/comment/38508408
score: 0
has comment: http://stackoverflow.com/comment/38508284
has comment: http://stackoverflow.com/comment/38512897
answer count: 1
has comment: http://stackoverflow.com/comment/38508414
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38508551
has comment: http://stackoverflow.com/comment/38508627
has title: Spring: Can not find applicationContext even though it's present in war file
tagged with: java
has comment: http://stackoverflow.com/comment/38508732

http://stackoverflow.com/comment/38422821
score: 2
comment on: http://stackoverflow.com/q/24761843
has text: I cannot reproduce this. When I read the json sting as a tree I`m getting an ArrayNode for the third element. Can you show your code? Since you mentioned Play it could be something Scala specific.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24831501
has body: Eclipse seems to be generating a lot of these unnecessary warnings about JavaDoc in my code, and I can't seem to be able to get rid of the warnings. First of all, the warnings don't make sense. These appear in links, like: /** * {@link Foo#bar} */ Where Foo.bar definitely exists. Eclipse can find it via right click > open declaration. The field is protected. At first, I thought it was because Foo inherits from another class, which is where bar actually belongs, but changing the link to the super class doesn't remove the warning. All the warnings are for the same field. I've tried accessing it in different ways (including Foo#bar, SuperClass#bar, #bar, and the fully qualified name). I used to have enabled JavaDoc warnings in Java > Compiler > Javadoc, but have since disabled them. The project settings are also disabled. The code base is using Java 8, which changed how Javadoc warnings and errors work, so it may be related to this (the JavaDoc can't be created by Eclipse because of errors in the Javadoc, presumably caused by Java 8, but we only use Eclipse's JavaDoc on hover, anyway). I have two pieces of additional software installed in Eclipse: m2e v1.5 and CodePro v7.1. mvn compile has no warnings, so I'm pretty sure that this is an Eclipse issue. Using Eclipse 4.4. I've tried restarting and rebuilding the project several times. The warnings only show up in the problems view if I choose Show > Show all. Ticking all the individual "show options" does not display these warnings. They're still displayed in the editor, though.
accepted answer: http://stackoverflow.com/a/24869938
type: Question
type: AnsweredQuestion
score: 0
answer count: 1
has title: Eclipse creating "Javadoc: [identifier] cannot be resolved or is not a field" warnings unnecessarily
has answer: http://stackoverflow.com/a/24869938
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/253357

http://stackoverflow.com/comment/38424107
type: QuestionComment
comment on: http://stackoverflow.com/q/24762641
score: 0
type: Comment
has text: Did you try to put in description without all these conversions?

http://stackoverflow.com/comment/38639775
score: 0
has text: Sorry guys i'm kind of new to this.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24877347

http://stackoverflow.com/comment/38482201
comment on: http://stackoverflow.com/q/24780815
score: 0
has text: Can you figure out what your "JDBC Connection URL" is? It should be a string like "jdbc:derby:mydb", or "jdbc:derby://localhost:1527/my/db". If you can post that, it will help us give you more information.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24770080
accepted answer: http://stackoverflow.com/a/24770091
has body: I used the same code previously and it used to work. But now it doesn't work and say doesn't show 3.0 like 3.00. Any idea? double result=3.0; System.out.println(new DecimalFormat("#.##").format(result));
has title: Double formatting doesn't work
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24770091
has comment: http://stackoverflow.com/comment/38436381
type: Question
has answer: http://stackoverflow.com/a/24770107
has comment: http://stackoverflow.com/comment/38436386
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/24770107
favorite count: 0
tagged with: double

http://stackoverflow.com/a/24781663
has body: You can't do this with pure Java, but if you write a JNI DLL you can do it via SetWindowPos in Windows. Check the API: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx You can get the HWND of the remote process via a combination of calls to EnumWindows and GetWindowThreadProcessId.
answers question: http://stackoverflow.com/q/24781533
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/28129081
answers question: http://stackoverflow.com/q/24783844
score: 0
has comment: http://stackoverflow.com/comment/44631356
type: Answer
has body: Thanks Syam S. for your answer. $.response.data.*.id indeed work!

http://stackoverflow.com/a/24773942
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24773739
score: 2
downvote count: 0
has body: A simple recursion will do the trick: public static void main(String[] args) { // create the array: [1, [2, 3], 4] Object[] arr = new Object[3]; arr[0] = 1; arr[1] = new Object[2]; arr[2] = 4; ((Object[])arr[1])[0] = 2; ((Object[])arr[1])[1] = 3; // print printArr(arr); } // print the array in order - recursively static void printArr(Object[] arr) { for (Object i : arr) { if (i instanceof Integer) { System.out.print(i + " "); } else { printArr((Object[])i); } } } OUTPUT 1 2 3 4

http://stackoverflow.com/q/24758945
has title: Parentheses and order of operations
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24759075
has comment: http://stackoverflow.com/comment/38415622
has answer: http://stackoverflow.com/a/24759075
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38415263
has body: I have a function in java that returns an integer. I know what it is supposed to return so I know when it runs correctly or not. Anyway, there is this line of code at some point in a for loop: If I write it like this miuf = miuf_ant * nf_ant / nf - ((double) ((t - 1) * hist[t - 1]) / (double) nf);` the result is fine. If I write it like this miuf = (miuf_ant * (nf_ant / nf) - ((double) ((t - 1) * hist[t - 1]) / (double) nf)); the result is way off. nf_ant, nf and t are ints, the rest are doubles. I have evaluated these 2 expressions in the debugger for a few iterations and the results differ by some 0.3 in general. Why does this happen and why is it that one works and the other doesn't?
tagged with: operator-precedence
possible better answer: http://stackoverflow.com/a/24759025
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24759025

http://stackoverflow.com/a/24886314
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24885719
has body: IF you take a look at implementing-factory-design-pattern-in-java you'll see a factory based on an enumeration. so here one could use an Animal factory, have an enum AnimalFamily { CAT, DOG } and use that to create animals. I doubt the factory pattern makes sense here. However discovery of capabilities (lookup) is similar to the factory pattern. And concerns this case. Usage: Optional&lt;MakingSound&gt; soundCapability = animal.lookup(MakingSound.class); if (soundCapability.isPresent()) { makingSound.makeSound(); } interface Animal { &lt;T&gt; Optional&lt;T&gt; lookup(Class&lt;T&gt; klazz); } interface MakingSound { void makeSound(); } // Base class class AbstractAnimal implements Animal { protected Map&lt;Class&lt;?&gt;, Object&gt; capabilities; @Override public &lt;T&gt; Optional&lt;T&gt; lookup(Class&lt;T&gt; klazz) { Object capability = capabilities.get(klazz); T c = klazz.cast(capability); return Optional.ofNullabel(c); } } class Dog extends Abstract Animal { Dog() { capabilities.put(MakingSound.class, new MakingSound() { @Override public void makeSound() { System.out.println("Ruf Ruf"); } }); // Java 8 style capabilities.put(MakingSound.class, () -&gt; System.out.println("Ruf Ruf")); } } This allows fish without making sounds, adding dynamic capabilties like flying. And so on. Whether this is done as factory or as above, using a prefilled map, ... (I have use java 8's Optional here as it fits.)
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38580427
comment on: http://stackoverflow.com/a/24797868
has text: Your answer is marked as accepted since it actually answers the original question (excluding the EDIT addendum) quite nicely. Thanks
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24812826
type: Answer
has comment: http://stackoverflow.com/comment/38616366
answers question: http://stackoverflow.com/q/24812089
has body: This is an OS/Java/TCP limitation. It's not impossible, but it doesn't work on most machines so JAIN-SIP uses ephemeral ports like most other SIP devices. See this answer https://serverfault.com/questions/326819/does-the-tcp-source-port-have-to-be-unique-per-host
has comment: http://stackoverflow.com/comment/38626083
score: 0

http://stackoverflow.com/a/24833534
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24833533
type: Answer
upvote count: 1
has body: Found that the swagger maven dependency I am using: com.wordnik swagger-jersey2-jaxrs_2.10 1.3.5 Has a dependency on jersey-container-servlet-core, but to an older version than the one I already had in my jersey dependencies, it is 2.1 while I am using 2.10. Maven is then using that and overriding the one that my jersey app needs. What I did is just to exclude that transitive dependency: com.wordnik swagger-jersey2-jaxrs_2.10 1.3.5 jersey-container-servlet-core org.glassfish.jersey.containers After that update, the exception has not come anymore so far.

http://stackoverflow.com/a/24838939
type: Answer
accepted answer of: http://stackoverflow.com/q/24838903
answers question: http://stackoverflow.com/q/24838903
type: AcceptedAnswer
has body: Use the @Transient annotation to tell Hibernate that the password2 property shouldn't be persisted.
score: 0

http://stackoverflow.com/comment/38611914
score: 0
comment on: http://stackoverflow.com/q/24863091
has text: Well what format is the original image?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38506722
type: Comment
comment on: http://stackoverflow.com/q/24807058
has text: Which IDE are you using?
score: 0
type: QuestionComment

http://stackoverflow.com/a/24885598
type: Answer
has comment: http://stackoverflow.com/comment/38654482
has body: Line by line: Random rand = new Random(); create new instance of the Random object, this is responsible for the creation of random numbers. int[] freq = new int[7]; create a new int array that can store 7 elements, with indices from 0...6. It is worth noting that in Java, the ints stored in the array are initialized to 0. (This is not true for all languages, an example being C, as in C the int arrays initially store memory junk data, and must be explicitly initialized to zero). for(int roll = 1; roll &lt; 10; roll++) this rolls 9 times (because 1...9, but it's better practice to go from 0) (++freq[1 + rand.nextInt(6)]); this line is something that you shouldn't ever do in this sort of fashion, because it's a monstrosity as you can see. Do something like this: for(int roll = 0; roll &lt; 9; roll++) { int randomNumber = rand.nextInt(6); //number between 0...5 int index = 1 + randomNumber; //number between 1...6 freq[index]++; //increment the number specified by the index by 1 //nearly equivalent to freq[index] += 1; } So basically it randomizes the number of 9 dice throws, and stores the dice throw count (or so it calls it, frequency) in the array. Thus, it's simulating 9 dice throws (numbers from 1...6), and each time it "rolls" a particular number, it increases the number stored in the array at that specific location. So in the end, if you say: for(int i = 1; i &lt;= 6; i++) { System.out.println("Thrown " + freq[i] + " times of number " + i); } Then it will be clearly visible what's happened.
answers question: http://stackoverflow.com/q/24885391
has comment: http://stackoverflow.com/comment/38695409
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38654577
score: 4
has comment: http://stackoverflow.com/comment/38654437

http://stackoverflow.com/a/24854983
type: Answer
accepted answer of: http://stackoverflow.com/q/24854861
has body: I think you miss the point of ViewTypeCount. You should return the number of Different View Types in your list. This is important for recycling of the Views inside the List. Imaging you have 2 Types of Listitems, one with a white Background and one with black Background. When you return 2 as ViewTypeCount the Listview knows ok, there a 2 types of Listitems and will not mix them up in the getView view recycling. so just use: public int getViewTypeCount() { return 1; } or dont override that method at all.
answers question: http://stackoverflow.com/q/24854861
score: 28
type: AcceptedAnswer
downvote count: 0
upvote count: 28

http://stackoverflow.com/a/24862695
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24862206
answers question: http://stackoverflow.com/q/24862206
upvote count: 3
type: Answer
downvote count: 0
has body: I suspect that you are not passing a repository-relative path to addFilepattern. See the documentation of addFilepattern for details. From your example, it looks like your task should look like this instead: &lt;gitadd repository="./project" dir="src"/&gt;
has comment: http://stackoverflow.com/comment/38611296

http://stackoverflow.com/comment/64589608
has text: I should've been a bit more clear in my answer - I can update when I get home. Perhaps I'm misunderstanding your question, but it sounds like you have a set of Futures and a set of tasks that need the result of all of those Futures before they can execute - is that correct? If so, then you can combine those Futures into a single one. Then, you can queue an asynchronous task which will only execute once the given Future is complete. In this case, that given future would actually contain the results of all of those first tasks.
comment on: http://stackoverflow.com/a/38600738
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24869716
score: 1
tagged with: java
tagged with: webview
tagged with: eclipse
type: Question
has body: I am developing an application where I am using a webview. I'm just a beginner in Android and I started to deal with webViews When i tried it in my emulator it doesn't show up. Would really appreciate your help. I am currently using eclipse juno 32 bit windows . I am currently stuck here . This is MainActivity.java package bulku.lucky; import android.support.v7.app.ActionBarActivity; import android.annotation.SuppressLint; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebView; @SuppressLint("SetJavaScriptEnabled") public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // applications are run through the emulator //to access "localhost" from the emulator String url = "http://e-promotion.al/"; WebView view = (WebView) this.findViewById(R.id.webView1); view.getSettings().setJavaScriptEnabled(true); view.loadUrl(url); } @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); } } activity_main.xml &lt;WebView android:id="@+id/webView1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" /&gt; AndroidManifest.xml &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" tools:ignore="OldTargetApi"/&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;application …
upvote count: 2
has title: Webview App doesn't work
has answer: http://stackoverflow.com/a/24869970
downvote count: 1
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/38487970
comment on: http://stackoverflow.com/q/24796112
has text: You should put commons-logging.jar in lib folder.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38538753
score: 0
type: Comment
type: QuestionComment
has text: is there any other code you have not mentioned here, for displaying loading dialog
comment on: http://stackoverflow.com/q/24824546

http://stackoverflow.com/a/24774736
score: -1
has comment: http://stackoverflow.com/comment/38445013
upvote count: 0
has comment: http://stackoverflow.com/comment/38444940
type: Answer
has body: like this char arr[]=new char[30]; //declares an array which can hold 30 characters arr[2]='a'; arr[20]='b'; but if you don't want to specify the length,than arraylist is something which will help you to accomplish your task because array's size is always fixed in Java
downvote count: 1
has comment: http://stackoverflow.com/comment/38445049
answers question: http://stackoverflow.com/q/24774683

http://stackoverflow.com/q/24772894
answer count: 3
has comment: http://stackoverflow.com/comment/38441716
has comment: http://stackoverflow.com/comment/38441690
has answer: http://stackoverflow.com/a/24773043
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38441504
has title: Separating chars and digits in a given set of strings and adding only the digits
has answer: http://stackoverflow.com/a/24773009
has comment: http://stackoverflow.com/comment/38441516
tagged with: java
has answer: http://stackoverflow.com/a/24773122
type: Question
has body: here is my code, I want from a given string value only integers to be get calculated. eg:abc123as34 output:13 here ignoring the strings only digits should get calculated,
has comment: http://stackoverflow.com/comment/38441501
has comment: http://stackoverflow.com/comment/38441469
score: 0

http://stackoverflow.com/q/24897670
linked to: http://stackoverflow.com/q/2307896
has comment: http://stackoverflow.com/comment/38677804
tagged with: java
has answer: http://stackoverflow.com/a/24898270
upvote count: 1
duplicate of: http://stackoverflow.com/q/2307896
has comment: http://stackoverflow.com/comment/38677883
downvote count: 1
type: Question
tagged with: tostring
tagged with: object
has comment: http://stackoverflow.com/comment/38677729
has body: When we need a String representation of an object, we can override the toString() method. However, what are the real benefits and reasons for overriding toString() when we can just define a new method to return the string? Please see example below: class One { private String name; public One(String _name) { name = _name; } @Override public String toString() { return name; } } class Two { private String name; public Two(String _name) { name = _name; } public String printMyClass() //Self-defined to print class details { return name; } } In the above example, printMyClass() which is self-defined seemed to does the same thing as toString(). So my question is: Why do we still use toString() ?
has comment: http://stackoverflow.com/comment/38677821
has answer: http://stackoverflow.com/a/24897713
tagged with: class
has answer: http://stackoverflow.com/a/24897697
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/11064409
has comment: http://stackoverflow.com/comment/38678016
favorite count: 0
duplicate of: http://stackoverflow.com/q/11064409
has title: What are the reasons and benefits of overriding toString() for string representation of an object?
type: UnansweredQuestion

http://stackoverflow.com/comment/38446775
has text: i tried to read the file line by line and split on the space then reorder the file but i didn't get the right output always still a problem in the order, the text changing the direction
comment on: http://stackoverflow.com/a/24757429
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24774464
has body: I have a set of EJBs. I want to handle the business exceptions those EJBs rise in a single way. Of course, it would be great if I implement that exception handling policy it in a single "point". I didn't find any best practice to achieve this, does anyone has already experienced something? Any suggestion? I was looking after Interceptor, could be a good idea or not?
tagged with: interceptor
tagged with: exception
has answer: http://stackoverflow.com/a/26970389
accepted answer: http://stackoverflow.com/a/26970389
type: AnsweredQuestion
tagged with: java
tagged with: ejb-3.1
type: Question
has title: Centralize EJB exception handling
score: 0
answer count: 1

http://stackoverflow.com/comment/38687920
score: 0
has text: Jarfiles are zip files, and zip files aren't really modifiable in place. You might hack something out that works, but the more usual approach is to write to a local filesystem.
type: QuestionComment
comment on: http://stackoverflow.com/q/24903107
type: Comment

http://stackoverflow.com/comment/38675873
score: 0
type: AnswerComment
type: Comment
has text: Sorry that the answer has been repeated on comments above.
comment on: http://stackoverflow.com/a/24876018

http://stackoverflow.com/a/24817096
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24817022
has comment: http://stackoverflow.com/comment/38525197
answers question: http://stackoverflow.com/q/24817022
type: AcceptedAnswer
type: Answer
has body: The constructor BoxOfficeMoviesAdapter(FindPeopleFragment, ArrayList) is undefined In your Fragment use getActivity() instead of this when you pass context to the constructor. Change this adapterMovies = new BoxOfficeMoviesAdapter(this, aMovies); to adapterMovies = new BoxOfficeMoviesAdapter(getActivity(), aMovies); The method setContentView(int, FindPeopleFragment) is undefined for the type FindPeopleFragment setContentView(R.layout.activity_box_office, this); must be removed setContentview is a method of Activity class not Fragment Change to @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_box_office,container,false); // rest of the code return view; } Further getView() returns null Change this lvMovies = (ListView) getView().findViewById(R.id.lvMovies); to lvMovies = (ListView) view.findViewById(R.id.lvMovies); The constructor Intent(FindPeopleFragment, Class) is undefined Finally Change this Intent i = new Intent(FindPeopleFragment.this, BoxOfficeDetailActivity.class); to Intent i = new Intent(getActivity(), BoxOfficeDetailActivity.class); You better read the Fragment documentation before going any further.
has comment: http://stackoverflow.com/comment/38525182
score: 2
downvote count: 0

http://stackoverflow.com/q/24801450
has title: How to add database to HSQLDB server programmatically without restarting the server?
tagged with: hsqldb
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38495329
has body: As per the need of my java application,i am trying to add new database to the already running HSQLDB server. As i am new to HSQLDB, I just want to know,is it possible to add database to the server in such dynamic way ? all Suggestions to achieve this functionality are most welcome,thank you.
type: Question
has comment: http://stackoverflow.com/comment/38527630
tagged with: lan
has comment: http://stackoverflow.com/comment/38496077
has comment: http://stackoverflow.com/comment/38495905
has comment: http://stackoverflow.com/comment/38495681

http://stackoverflow.com/a/25338943
accepted answer of: http://stackoverflow.com/q/24819538
type: Answer
has body: e.printStacktrace is using System.err. System.out and System.err are different object. It has Buffered writer to display to client window. Even it will execute in different order , it will go to different Buffer. If Err buffer prints first err will come first.Otherwise out will come first.
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24819538
upvote count: 1

http://stackoverflow.com/q/24750600
has answer: http://stackoverflow.com/a/24750660
has title: How to develop web ui with Google App Engine Java platform
score: 0
answer count: 1
has body: I have started learning Google App Engine Java. Although, I guess Java is good for server side coding, its just not efficient to code for web in Java. Is there any framework or language that I can use to write code for Web front end in Google App Engine, Java?
tagged with: web
accepted answer: http://stackoverflow.com/a/24750660
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/38538403
type: Comment
comment on: http://stackoverflow.com/a/24812347
has text: @CodeAngel : Create with Netbeans a new Database . How to, look above. And search with your System search for that file.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/68397524
type: QuestionComment
comment on: http://stackoverflow.com/q/24840667
score: 1
type: Comment
has text: I came here trying to find a regex that I can paste into Sublime Text to find emojis. No luck.

http://stackoverflow.com/comment/38665300
has text: Wrong - JCR allows for binary properties which work well for storing images and other binaries. That's assuming the performance of the underlying implementation is adequate, so Rajesh's question makes perfect sense.
score: 0
comment on: http://stackoverflow.com/q/24880768
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24908854
answers question: http://stackoverflow.com/q/24908535
type: Answer
has comment: http://stackoverflow.com/comment/38698587
has body: This is what you may want int ans= JOptionPane.showInputDialog(null, "Enter full name", "Enter full name", JOptionPane.INFORMATION_MESSAGE); if(ans==JOptionPane.OK_OPTION) { int optionSelected= JOptionPane.showInputDialog(null, "Enter phone number", "Enter phone number", JOptionPane.INFORMATION_MESSAGE); } P.S: This is just to give you the idea.Modify /improve the code as you need. Indeed I haven't checked for the Syntax or API while posting this answer.
score: 0

http://stackoverflow.com/comment/38513453
score: 0
type: Comment
has text: I tried this but it still only uses the first file and just processes it 3 times.
comment on: http://stackoverflow.com/a/24810910
type: AnswerComment

http://stackoverflow.com/a/56397188
type: Answer
has body: I solved this challange by following Confluence Support article. The Causes and Resolutions as stated by the above blog post for the issue of cannot establish a connection to its database. are The database configuration details you entered are incorrect or have changed. For example, the database name or database username/password for your Confluence database. Confirm that the database username, password, and connection URL in /confluence.cfg.xml are incorrect, and if not update them accordingly. The URL for the database is incorrect. For example, if the database connection is jdbc:mysql://yma/confluence?autoReconnect=true, does the host 'yma' exist and is the database server installed on 'yma'? Check /confluence.cfg.xml to find this entry. The database server is not running. If your database server is down, restart it and check the logs to see why it had failed or stopped. The network is down (or there is a firewall in between Confluence and its database) and the connection to the database cannot be established. If your network is down, or a new firewall is installed, consult with your System Administrator for further troubleshooting. Your database password has expired. If your password has expired (and you will only discover this if you try to connect to your database via your database client or an external database tool such as DbVisualizer), update your password. You may want to deactivate expiring passwords for your Confluence database user to prevent the problem from happening again. Be sure to consult with your DBA about this. Postgres specific issue: the Postgres encryption method has been altered or changed when migrating or upgrading Confluence, the environment, etc. Check the pg_hba.conf file. If the method is set to ident change it to md5. MySQL specific issue: there are too many connection requests that triggered MySQL server to block Confluence from making any requests. See this MySQL article for resolution.
answers question: http://stackoverflow.com/q/24835592
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/38682921
type: Comment
has text: What do you _think_ should be happening?
type: QuestionComment
comment on: http://stackoverflow.com/q/24900443
score: 0

http://stackoverflow.com/q/24807952
tagged with: jpanel
linked to: http://stackoverflow.com/q/7217623
has comment: http://stackoverflow.com/comment/38534038
has answer: http://stackoverflow.com/a/24808703
answer count: 2
has comment: http://stackoverflow.com/comment/38542047
has answer: http://stackoverflow.com/a/24821738
downvote count: 0
has comment: http://stackoverflow.com/comment/38534756
score: 1
has comment: http://stackoverflow.com/comment/38534424
favorite count: 0
possible better answer: http://stackoverflow.com/a/24808703
has comment: http://stackoverflow.com/comment/38534698
linked to: http://stackoverflow.com/q/11427743
has title: Using a JPanel extension class to set a background
linked to: http://stackoverflow.com/q/24805191
has body: In my Main I want to create a JFrame, then I want to create a BackgroundPanel and I want to add this one in the JFrame. This is Main class: public class Main { public static void main(String args[]) { Frame frame = new Frame(); BackgroundPanel back = new BackgroundPanel(); frame.getContentPane().add(back); frame.setSize(400, 287); frame.setVisible(true); } } This is BackgroundPanel class: import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JPanel; public class BackgroundPanel extends JPanel { private Image img; public BackgroundPanel() { img = Toolkit.getDefaultToolkit().createImage(getClass().getResource("sfondo.png")); loadImage(img); } private void loadImage(Image img) { try { MediaTracker track = new MediaTracker(this); track.addImage(img, 0); track.waitForID(0); } catch (InterruptedException e) { e.printStackTrace(); } } protected void paintComponent(Graphics g) { super.paintComponent(g); setOpaque(false); g.drawImage(img, 0, 0, null); } } And the JFrame is a normal JFrame class. When I execute it, there are no errors, simply it put out a normal JFrame without background. Help me Please! @nIcEcOw I used the code in the first answear to print my image on a JPanel. But when I execute it, there's an error in output. this the error: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1388) at paintingexample.CustomPanel.&lt;init&gt;(PaintingExample.java:82) at paintingexample.PaintingExample.displayGUI(PaintingExample.java:28) at paintingexample.PaintingExample.access$000(PaintingExample.java:19) at paintingexample.PaintingExample$1.run(PaintingExample.java:42) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:6…
linked to: http://stackoverflow.com/q/9864267
has comment: http://stackoverflow.com/comment/38534575
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38522815
tagged with: drawimage
accepted answer: http://stackoverflow.com/a/24821738
has comment: http://stackoverflow.com/comment/38509836
has comment: http://stackoverflow.com/comment/38537623
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38535396
type: Question
has comment: http://stackoverflow.com/comment/38532474
has comment: http://stackoverflow.com/comment/38533794
has comment: http://stackoverflow.com/comment/38533870
linked to: http://stackoverflow.com/q/11369171
tagged with: java

http://stackoverflow.com/comment/38607341
type: QuestionComment
comment on: http://stackoverflow.com/q/24860273
type: Comment
has text: Is your post right and I'm stupid or do you do some magic there?
score: 0

http://stackoverflow.com/comment/38585426
comment on: http://stackoverflow.com/a/24846303
type: AnswerComment
score: 0
type: Comment
has text: @Scott I don't get why this would get flagged... The answer/code is sooooo self-explanatory... It's not like it's a huge chunk of code, which one need to wrap one's head around!

http://stackoverflow.com/a/24763757
type: Answer
has body: the idea of a database "transaction" is that it is supposed to provide a guarantee of "consistency" across multiple conceptual operations. the database is in charge of enforcing this. so, when the transaction commits, the database should only allow the transaction to complete if it can ensure that everything that happened during the transaction is still valid. In practice, a database will typically handle this such that once one of the updates succeeds, the relevant row will be write locked until the relevant transaction completes. Thus, one of the updates is guaranteed to fail. Note: this also requires an appropriate isolation level in your jdbc connection. the isolation level ensures that the test for the current value done before the update is still applicable at the time of the write.
accepted answer of: http://stackoverflow.com/q/24762811
answers question: http://stackoverflow.com/q/24762811
has comment: http://stackoverflow.com/comment/38424255
score: 0
has comment: http://stackoverflow.com/comment/38424342
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38424447

http://stackoverflow.com/q/24875816
type: Question
score: 3
has answer: http://stackoverflow.com/a/24875906
answer count: 1
downvote count: 0
tagged with: generics
favorite count: 0
has body: I have a class named FamilyHistoryPersonModel that extends a class named PersonModel. MapValue mapValue = new MapValue("relatives", new GenericType&lt;FamilyHistoryPersonModel&gt;() {}, new GenericType&lt;List&lt;FamilyHistoryPersonModel&gt;&gt;() {} //error here ); Constructor: private MapValue(String pluralUrl, GenericType&lt;? extends PersonModel&gt; singleResultGenericType, GenericType&lt;List&lt;? extends PersonModel&gt;&gt; listResultGenericType) { this.pluralUrl = pluralUrl; this.singleResultGenericType = singleResultGenericType; this.listResultGenericType = listResultGenericType; } Error: cannot find symbol symbol : constructor MapValue(java.lang.String,&lt;anonymous com.sun.jersey.api.client.GenericType&lt;com.models.FamilyHistoryPersonModel&gt;&gt;,&lt;anonymous com.sun.jersey.api.client.GenericType&lt;java.util.List&lt;com.models.FamilyHistoryPersonModel&gt;&gt;&gt;) location: class com.rest.v2.resource.CreatePersonModelIntegrationTest.MapValue Why am I getting this error? How do I fix it? I don't want to change the constructor to accept GenericType&lt;List&lt;FamilyHistoryPersonModel&gt;&gt; listResultGenericType I am using JDK 1.6
linked to: http://stackoverflow.com/q/24188824
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38636689
has title: Why can't I pass a list of children into a method that accepts List<? extends Parent>?
linked to: http://stackoverflow.com/q/2745265
upvote count: 3
tagged with: java

http://stackoverflow.com/a/24798652
type: Answer
has comment: http://stackoverflow.com/comment/38713910
upvote count: 1
answers question: http://stackoverflow.com/q/24790973
has comment: http://stackoverflow.com/comment/38676250
score: 1
has body: ELKI will load classes via the standard Java Classloader. Therefore, they must be on the class path or they cannot be loaded. An example call (assuming your classes are in the bin folder) is java -cp elki.jar:bin/ de.lmu.ifi.dbs.elki.application.ELKILauncher Parameters are interpreted as follows: If there is a class with this name (including the package name!) it is used. Otherwise, ELKI tries prepending the package name of the expected interface. Which enables shortcut names. Otherwise, known classes (from the service files) are checked for aliases. For example, the Euclidean distance has an alias name of l2, Manhattan has an alias l1. The class must have a parameterless public constructor or a inner public static class Parameterizer. Input assistance is built as follows: .jar files on the classpath are checked for service files in META-INF/elki/&lt;interface&gt; folders on the classpath put you in development mode, where a recursive list is performed and all .class files are inspected. This is much slower, but removes the need to edit the service files. Discovered classes show up below the ones listed in the service file. Furthermore, the package de.lmu.ifi.dbs.elki.application.internal includes classes that will inspect everything on your classpath, and will report e.g. classes that do not have a parameterless public constructor, or a inner public static class Parameterizer.
accepted answer of: http://stackoverflow.com/q/24790973
type: AcceptedAnswer
downvote count: 0

android
tags question: http://stackoverflow.com/q/24816624
tags question: http://stackoverflow.com/q/24861249
tags question: http://stackoverflow.com/q/24830703
tags question: http://stackoverflow.com/q/24866567
tags question: http://stackoverflow.com/q/24781627
tags question: http://stackoverflow.com/q/24760457
tags question: http://stackoverflow.com/q/24854837
tags question: http://stackoverflow.com/q/24834777
tags question: http://stackoverflow.com/q/24842927
tags question: http://stackoverflow.com/q/24831898
tags question: http://stackoverflow.com/q/24800318
tags question: http://stackoverflow.com/q/24801006
tags question: http://stackoverflow.com/q/24831647
tags question: http://stackoverflow.com/q/24868362
tags question: http://stackoverflow.com/q/24869820
tags question: http://stackoverflow.com/q/24892789
tags question: http://stackoverflow.com/q/24852581
tags question: http://stackoverflow.com/q/24841751
tags question: http://stackoverflow.com/q/24759596
tags question: http://stackoverflow.com/q/24885731
tags question: http://stackoverflow.com/q/24772652
tags question: http://stackoverflow.com/q/24866258
tags question: http://stackoverflow.com/q/24796127
tags question: http://stackoverflow.com/q/24846886
tags question: http://stackoverflow.com/q/24838417
tags question: http://stackoverflow.com/q/24751275
tags question: http://stackoverflow.com/q/24846909
tags question: http://stackoverflow.com/q/24829322
tags question: http://stackoverflow.com/q/24852219
tags question: http://stackoverflow.com/q/24895690
tags question: http://stackoverflow.com/q/24817721
tags question: http://stackoverflow.com/q/24846096
tags question: http://stackoverflow.com/q/24858574
tags question: http://stackoverflow.com/q/24857795
tags question: http://stackoverflow.com/q/24838883
tags question: http://stackoverflow.com/q/24855901
tags question: http://stackoverflow.com/q/24907914
tags question: http://stackoverflow.com/q/24780497
tags question: http://stackoverflow.com/q/24850099
tags question: http://stackoverflow.com/q/24804068
tags question: http://stackoverflow.com/q/24798745
tags question: http://stackoverflow.com/q/24837337
tags question: http://stackoverflow.com/q/24900478
tags question: http://stackoverflow.com/q/24851367
tags question: http://stackoverflow.com/q/24853395
tags question: http://stackoverflow.com/q/24801463
tags question: http://stackoverflow.com/q/24843966
tags question: http://stackoverflow.com/q/24792278
tags question: http://stackoverflow.com/q/24788150
tags question: http://stackoverflow.com/q/24893605
tags question: http://stackoverflow.com/q/24762754
tags question: http://stackoverflow.com/q/24830314
tags question: http://stackoverflow.com/q/24772446
tags question: http://stackoverflow.com/q/24849380
tags question: http://stackoverflow.com/q/24813589
tags question: http://stackoverflow.com/q/24858744
tags question: http://stackoverflow.com/q/24859090
tags question: http://stackoverflow.com/q/24876938
tags question: http://stackoverflow.com/q/24795655
tags question: http://stackoverflow.com/q/24872433
tags question: http://stackoverflow.com/q/24784054
tags question: http://stackoverflow.com/q/24799067
tags question: http://stackoverflow.com/q/24908797
tags question: http://stackoverflow.com/q/24839030
tags question: http://stackoverflow.com/q/24800982
tags question: http://stackoverflow.com/q/24755080
tags question: http://stackoverflow.com/q/24828418
tags question: http://stackoverflow.com/q/24870103
tags question: http://stackoverflow.com/q/24764687
tags question: http://stackoverflow.com/q/24857417
tags question: http://stackoverflow.com/q/24822116
tags question: http://stackoverflow.com/q/24850060
tags question: http://stackoverflow.com/q/24876045
tags question: http://stackoverflow.com/q/24763823
tags question: http://stackoverflow.com/q/24900868
tags question: http://stackoverflow.com/q/24869255
tags question: http://stackoverflow.com/q/24771153
tags question: http://stackoverflow.com/q/24804652
tags question: http://stackoverflow.com/q/24885223
tags question: http://stackoverflow.com/q/24890639

http://stackoverflow.com/a/24833445
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38556544
has comment: http://stackoverflow.com/comment/38557270
has comment: http://stackoverflow.com/comment/38556150
has comment: http://stackoverflow.com/comment/38556325
has body: Your signature is wrong. It needs to be JNIEXPORT int JNICALL Java_classname_methodname(JNIENV* env, jobject obj, ...) where ... are the parameters you actually want to pass. pointers cannot be passed, if you want an array you'd use a jdoublearray, if you want to just pass a double by reference you'd need to pass down a class that holds a double and set that field on the object.
answers question: http://stackoverflow.com/q/24833296
has comment: http://stackoverflow.com/comment/38556181
downvote count: 0
has comment: http://stackoverflow.com/comment/38556446

spring-ws
tags question: http://stackoverflow.com/q/24895549
tag name: spring-ws
tags question: http://stackoverflow.com/q/24787605
tags question: http://stackoverflow.com/q/24779373
type: Tag
tags question: http://stackoverflow.com/q/24781074

http://stackoverflow.com/q/24844369
has answer: http://stackoverflow.com/a/24844747
accepted answer: http://stackoverflow.com/a/24844747
type: AnsweredQuestion
tagged with: java
has body: I have a service running on Virgo that occasionally needs to prompt the user and get some feedback. I've created a class that extends the JDialog class: public class PPNDialog extends JDialog implements ActionListener, WindowListener{ public PPNDialog(JFrame frame, String title){ super(frame, title, true); ... //rest of dialog initialisation code } ... //(other methods } And another class that creates a new JFrame and popups up the dialog: public class GUIStarter { JFrame frame; public GUIStarter(){ this.initialise(); dialog = new PPNDialog(this.frame, ""); dialog.setVisible(true); } private void initialise() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } } Everything works out ok except when the JDialog pops up, it starts in the background behind all my other windows (other apps). The problem is that since the JDialog doesn't create a taskbar entry, the dialog goes unnoticed unless all the existing windows are minimised. I understand that this happens because the GUI is started from virgo but I was wondering if it's possible to bring it forward so it starts in the foreground. I noticed that the same thing happens when I use JOptionPane. All JOptionPane messages appear in the background. That's only when the GUI is started from a virgo service. I don't have that issue if I run the GUI as a standalone application.
tagged with: swing
type: Question
has title: Spring/Virgo - java swing: JDialog starts behind other windows
score: 0
answer count: 1
tagged with: eclipse-virgo
tagged with: jdialog

http://stackoverflow.com/q/24793800
possible better answer: http://stackoverflow.com/a/24827214
answer count: 2
has comment: http://stackoverflow.com/comment/38543729
downvote count: 0
linked to: http://stackoverflow.com/q/24784749
has body: This is a follow up to: Followup questions: Using Maven to only sign and deploy jars to Maven Central. Build and compilation is done entirely with Ant Thanks to the answer to the previous questions, and some advice from a sonatype support person, I've just had my first "non failure". Here's the current output for mvn deploy: [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building XBN-Java 0.1.2-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ xbnjava --- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ xbnjava --- [INFO] Installing R:\jeffy\programming\sandbox\xbnjava\pom.xml to C:\Users\jeffy\.m2\repository\com\github\aliteralmind\xbnjava\0.1.2-SNAPSHOT\xbnjava-0.1.2-SNAPSHOT.pom [INFO] [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ xbnjava --- Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/0.1.2-SNAPSHOT/maven-metadata.xml 607/607 B Downloaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/0.1.2-SNAPSHOT/maven-metadata.xml (607 B at 0.5 KB/sec) Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/0.1.2-SNAPSHOT/xbnjava-0.1.2-20140717.010135-5.pom 2/4 KB 4/4 KB Uploaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/0.1.2-SNAPSHOT/xbnjava-0.1.2-20140717.010135-5.pom (4 KB at 11.9 KB/sec) Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/maven-metadata.xml 290/290 B Downloaded: https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/maven-metadata.xml (290 B at 1.5 KB/sec) Uploading: https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/0.1.2-SNAPSHO…
favorite count: 0
accepted answer: http://stackoverflow.com/a/24796508
has comment: http://stackoverflow.com/comment/38546166
has comment: http://stackoverflow.com/comment/38484938
tagged with: maven
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24827214
score: 1
tagged with: ant
tagged with: java
has answer: http://stackoverflow.com/a/24796508
has title: Followup part 2 -- Using Maven to only sign and deploy jars to Maven Central. Build and compilation is done entirely with Ant

http://stackoverflow.com/comment/41809472
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24798353
type: Comment
has text: thank you for mentioning it. I corrected the command in my post.

http://stackoverflow.com/q/24860770
has title: Getting error while trying to generate the Classes from an Schema using JAXB(xjc)
tagged with: xsd
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: jaxb
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24866851
accepted answer: http://stackoverflow.com/a/24866851
downvote count: 0
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38607785
has body: I am unable to generate the Classes from an Schema using JAXB(xjc), using both command prompt as well as eclipse. I keep on getting error, i.e parsing a schema... [ERROR] The markup in the document following the root element must be well-formed. line 16 of file:/C:/Users/xyz/workspace/JaxBClasses/src/all.xsd Failed to parse a schema. PFB the complete schema: "&lt;xs:element name="Action" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt; The audited action. One of INSERT, UPDATE, or DELETE: entity was created, changed or deleted. &lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;xs:simpleType&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:enumeration value="INSERT"&gt;&lt;/xs:enumeration&gt; &lt;xs:enumeration value="UPDATE"&gt;&lt;/xs:enumeration&gt; &lt;xs:enumeration value="DELETE"&gt;&lt;/xs:enumeration&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;/xs:element&gt; " Please help.

http://stackoverflow.com/a/48904064
type: Answer
answers question: http://stackoverflow.com/q/24811229
has body: Sure it is replaceable but I don't understand what problem Lint sees with "old school for loop". It works in both ways. Seems to be religious stuff: "So when should you use the for-each loop? Any time you can. It really beautifies your code." (https://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html)
upvote count: 1
downvote count: 1
score: 0

http://stackoverflow.com/a/53388105
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24805360
has body: The default JAXB implementation of WebLogic 12c causing the problem and you need to override the jaxb at the weblogic server startup. Add the below classpath to startWebLogic.cmd before echo CLASSPATH=%CLASSPATH% SET CLASSPATH=C:\Oracle\Middleware\Oracle_Home\wlserver\modules\databinding.override.jar;%CLASSPATH% Tow JARS are added to support weblogic 12c. jaxb-core.jar jaxb-impl.jar

http://stackoverflow.com/comment/38428104
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24757607
type: Comment
has text: That's not exactly true, it depends on your environment. 1.5 is the default for GMavenPlus (following the pattern established by the Maven Compiler Plugin). Gradle defaults to whatever JDK you use to compile. Gant I assume would take the default that Groovyc sets (different, depending on Groovy version). Grails seems to have its own defaults beside those of Gant.

http://stackoverflow.com/comment/38655317
type: Comment
comment on: http://stackoverflow.com/a/24885576
has text: @DavidWallace-I already mentioned in my answer that I am only talking about this particular piece of code,not the whole.Secondly,any result which comes out of an expression can be considered as an output.If you contradict,please explain as to where I am wrong! Also,I'll be happy than ever to modify it!
type: AnswerComment
score: 0

http://stackoverflow.com/a/28723181
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/24765219
score: 3
has body: The MockMvcBuilders standaloneSetup is manual by definition meaning that rather than discovering Spring beans of interest like @ControllerAdvice in Spring configuration, it lets you manually set up what you need for the test. Instead the standaloneSetup should let you also manually register @ControllerAdvice beans. There is a ticket for making that happen. See https://jira.spring.io/browse/SPR-12751.
has comment: http://stackoverflow.com/comment/54956454

http://stackoverflow.com/a/24836577
type: Answer
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24836493
answers question: http://stackoverflow.com/q/24836493
has body: Servlet itself has nothing to do with inheritance. It will call exactly the same class as provided in servlet tag of your web.xml file, e.g. if you want to map a class org.company.D to a servlet, you would need to write something like this: servletd org.company.D and then map the 'servletd' to a URL that it should listen on: servletd /some-path

http://stackoverflow.com/q/24837771
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24837935
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: swing
type: Question
tagged with: image
has title: Adding using Images GUI
has body: I'm a beginner. I'm making a kid's math game. All it has to do is add the 2 pictures given. The problem is, I don't know how the JTextField will know that the answer is correct. Here's the picture. ImageIcon[] images = new ImageIcon[10]; images[0] = new ImageIcon("0.jpg"); images[1] = new ImageIcon("1.jpg"); images[2] = new ImageIcon("2.jpg"); images[3] = new ImageIcon("3.jpg"); images[4] = new ImageIcon("4.jpg"); images[5] = new ImageIcon("5.jpg"); images[6] = new ImageIcon("6.jpg"); images[7] = new ImageIcon("7.jpg"); images[8] = new ImageIcon("8.jpg"); images[9] = new ImageIcon("9.jpg"); ImageIcon[] image = new ImageIcon[10]; image[0] = new ImageIcon("0.jpg"); image[1] = new ImageIcon("1.jpg"); image[2] = new ImageIcon("2.jpg"); image[3] = new ImageIcon("3.jpg"); image[4] = new ImageIcon("4.jpg"); image[5] = new ImageIcon("5.jpg"); image[6] = new ImageIcon("6.jpg"); image[7] = new ImageIcon("7.jpg"); image[8] = new ImageIcon("8.jpg"); image[9] = new ImageIcon("9.jpg"); int image_number = (int) (Math.random() * 10); int image_number1 = (int) (Math.random() * 10); Pic1.setIcon(images[image_number]); Pic2.setIcon(image[image_number1]);
answer count: 2
has answer: http://stackoverflow.com/a/24838233

http://stackoverflow.com/comment/38600461
has text: vermaraj - no I'm using notepad
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24856754
type: Comment

http://stackoverflow.com/a/24978803
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24897418
type: Answer
has body: My method was placed within the wrong set of braces.
accepted answer of: http://stackoverflow.com/q/24897418
score: 0

http://stackoverflow.com/q/24895551
has body: I have a problem with entering numbers with a comma (.), Thanks to your help last time I solved another problem, I hope even today. the problem is this, I have a decimal numeric input field, but just inserico a number with a comma application crashes someone knows how to help me? The code below is java and xml Code java. EditText x_tensione = (EditText)findViewById(R.id.Tensione); EditText x_potenza = (EditText)findViewById(R.id.Potenza); EditText x_lunghezza = (EditText)findViewById(R.id.Lunghezza); EditText x_caduta_tensione = (EditText)findViewById(R.id.Caduta_tensione); String xtensione = x_tensione.getText().toString(); String xpotenza = x_potenza.getText().toString(); String xlunghezza = x_lunghezza.getText().toString(); String xcaduta_tensione = x_caduta_tensione.getText().toString(); double NumeroTensione = Integer.parseInt(xtensione); double NumeroPotenza = Integer.parseInt(xpotenza); double NumeroLunghezza= Integer.parseInt(xlunghezza); double NumeroCaduta = Integer.parseInt(xcaduta_tensione); double molt = 2* NumeroPotenza; double resistenza = (NumeroCaduta / molt) * NumeroTensione; double xx = 0.0178; double x3 = xx * (NumeroLunghezza / resistenza); double x = x3; TextView Tview = (TextView)findViewById(R.id.uscita); Tview.setText(String.valueOf(x)); code xml <TextView android:text="Seleziona corrente" android:layout_width="130dp" android:layout_height="wrap_content" /> <RadioButton android:id="@+id/continua" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Continua" android:onClick="onRadioButtonClicked" /> <RadioButton android:id="@+id/monofase" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Monofase alternata" android:onClick="onRadioButtonClicked" /> <RadioButton android:id="@+id/trifase" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Trifase alternata" android:onClick="onRadioButtonClicked" /> <TextView android:text="Tensione" androi…
has comment: http://stackoverflow.com/comment/38673880
score: 0
has comment: http://stackoverflow.com/comment/38674249
tagged with: android
has comment: http://stackoverflow.com/comment/51539882
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38673732
type: UnansweredQuestion
has title: Caused by: java.lang.NumberFormatException: Invalid int: "9.9"
linked to: http://stackoverflow.com/q/18672456
tagged with: java
has answer: http://stackoverflow.com/a/24897535
type: Question
has answer: http://stackoverflow.com/a/24895582
answer count: 2

http://stackoverflow.com/comment/38570063
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24841090
has text: Why can't you use observer design pattern? There may be specific requirements in you app that does not comply with observer design pattern, but unless I am aware of all the requirements, I cannot be very sure
score: 0

http://stackoverflow.com/comment/38422343
has text: possible duplicate of [SWT No More Handles](http://stackoverflow.com/questions/2018553/swt-no-more-handles)
score: 0
comment on: http://stackoverflow.com/q/24759572
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38436185
score: 0
comment on: http://stackoverflow.com/q/24769979
type: Comment
type: QuestionComment
has text: The way you're doing it, if you delete the `original` array, the `copy` will be empty too. You're just copying the references, not the values.

http://stackoverflow.com/a/24813315
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/38519340
score: 3
accepted answer of: http://stackoverflow.com/q/24813273
has comment: http://stackoverflow.com/comment/38518990
has comment: http://stackoverflow.com/comment/38519216
has body: You're not yet creating any instance of a Deck. Create an instance of Deck somewhere with new Deck(). You could then share references to this one Deck via: Create a class Game, and in it create one Deck and pass a reference to it to the Human instances. Make Deck a singleton class. [Note: Singletons are frequently frowned upon - what if you later want to manipulate multiple decks in the same application?] For example, here's how you could pass a Deck reference to a Human: class Human { ... private Deck deck; public Human( String name, Deck deck ) { ... this.deck = deck; } And then here's how you would implement hit(): public void hit(){ hand.add( deck.getCard()); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24813273

http://stackoverflow.com/q/24756207
has title: CCD document serialization error on setting EnGiven
has answer: http://stackoverflow.com/a/24756508
tagged with: ccd
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/33957813
type: Question
has answer: http://stackoverflow.com/a/24780085
has body: I am working on generating CCD document by marshalling generated jaxb classes. I am stuck for few days in initial portion of the document. I will try my best to explain my problem. Henry I am stuck in generating above portion of the document, to be precise the portion of generating . I am posting all relevant jaxb classes. package com.smartdatasolutions.referralmanager.ccd; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * * A name for a person. A sequence of name parts, such as * given name or family name, prefix, suffix, etc. PN differs * from EN because the qualifier type cannot include LS * (Legal Status). * * * Java class for PN complex type. * * The following schema fragment specifies the expected content contained within this class. * * * * * * * * * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PN") public class PN extends EN { } package com.smartdatasolutions.referralmanager.ccd; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; /** * * A name for a person, organization, place or thing. A * sequence of name parts, such as given name or family * name, prefix, suffix, etc. Examples for entity name * values are "Jim Bob Walton, Jr.", "Health Level Seven, * Inc.", "Lake Tahoe", etc. An entity name may be as simple * as a character string or may consist of several entity name * parts, such as, "Jim", "Bob", "Walton", and "Jr.", "Health * Level Seven" and "Inc.", "Lake" and "Tahoe". * * * Java class for EN complex type. * * …
has answer: http://stackoverflow.com/a/61512533
score: 0
tagged with: hl7
has answer: http://stackoverflow.com/a/24760768
possible better answer: http://stackoverflow.com/a/24756508
answer count: 5
accepted answer: http://stackoverflow.com/a/24780085

http://stackoverflow.com/comment/38467151
comment on: http://stackoverflow.com/q/24786284
score: 0
has text: Instead of dumping code please elaborate on what you mean by `in more than one method`, is it the same button or different buttons. Would the use of the button differ and if so how? etc.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24789060
has comment: http://stackoverflow.com/comment/38472658
has title: Could not autowire field: Spring-Hibernate
has answer: http://stackoverflow.com/a/24793377
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24793377
tagged with: exception
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: hibernate
has body: Following is the exception which I am getting while I am trying to integrate Hibernate with my Spring MVC project and add Autowired feature. Exception: SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userBOImpl': Injection of autowired dependencies fai led; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.inspireme.dao.UserDA O com.inspireme.boimpl.UserBOImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExcep tion: Could not autowire field: private org.hibernate.SessionFactory com.inspireme.daoimpl.UserDAOImpl.sessionFactory; nested exception is j ava.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider; Dispatcher-servlet.xml <context:annotation-config /> <context:component-scan base-package="com.inspireme." /> /WEB-INF/jsp/ .jsp classpath:hibernate.cfg.xml org.hibernate.cfg.AnnotationConfiguration ${jdbc.dialect} true <mvc:resources mapping="/resources/**" location="/resources/inspiremetheme/" /> <mvc:annotation-driven/> <tx:annotation-driven /> hibernate.cfg.xml <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration> </hibernate-configuration> Controller class package com.inspireme.controller; @Controller @RequestMapping("/") public class InspireMeController { public ApplicationContext applicationContext; private static final Logger LOGGER = Logger.getLogger(InspireMeController.class); @Autowired private UserBO userBO; Service class: package com.inspireme.boimpl; @Service public class UserBOImpl implements UserBO { private static final Logger LOGGER = Logger.getLogger(UserBOImpl.class); @Autowired private UserDAO us…
has comment: http://stackoverflow.com/comment/38473192
has comment: http://stackoverflow.com/comment/38473557
has comment: http://stackoverflow.com/comment/38474539
has comment: http://stackoverflow.com/comment/38480770
type: Question
has comment: http://stackoverflow.com/comment/38472896

http://stackoverflow.com/a/31959511
upvote count: 10
downvote count: 0
answers question: http://stackoverflow.com/q/24885223
type: Answer
has body: After reading @MLProgrammer-CiM's answer, here is my code: class NormalViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ @Bind(R.id.card_item_normal) CardView cardView; public NormalViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); cardView.setOnClickListener(this); } @Override public void onClick(View v) { if(v instanceof CardView) { // use getAdapterPosition() instead of getLayoutPosition() int itemPosition = getAdapterPosition(); removeItem(itemPosition); } } }
has comment: http://stackoverflow.com/comment/108688113
score: 10

eclipse
tags question: http://stackoverflow.com/q/24815375
tags question: http://stackoverflow.com/q/24840849
tags question: http://stackoverflow.com/q/24828453
tags question: http://stackoverflow.com/q/24829808
tags question: http://stackoverflow.com/q/24821551
tag name: eclipse
tags question: http://stackoverflow.com/q/24784695
tags question: http://stackoverflow.com/q/24809167
tags question: http://stackoverflow.com/q/24763978
tags question: http://stackoverflow.com/q/24762754
tags question: http://stackoverflow.com/q/24811274
tags question: http://stackoverflow.com/q/24801372
tags question: http://stackoverflow.com/q/24828722
tags question: http://stackoverflow.com/q/24828418
tags question: http://stackoverflow.com/q/24778693
tags question: http://stackoverflow.com/q/24753045
tags question: http://stackoverflow.com/q/24814943
tags question: http://stackoverflow.com/q/24773147
tags question: http://stackoverflow.com/q/24876478
tags question: http://stackoverflow.com/q/24802068
tags question: http://stackoverflow.com/q/24768824
tags question: http://stackoverflow.com/q/24795313
tags question: http://stackoverflow.com/q/24799650
tags question: http://stackoverflow.com/q/24793920
tags question: http://stackoverflow.com/q/24757702
tags question: http://stackoverflow.com/q/24855444
tags question: http://stackoverflow.com/q/24779627
tags question: http://stackoverflow.com/q/24866771
tags question: http://stackoverflow.com/q/24894123
tags question: http://stackoverflow.com/q/24857927
tags question: http://stackoverflow.com/q/24764765
tags question: http://stackoverflow.com/q/24808477
tags question: http://stackoverflow.com/q/24891228
tags question: http://stackoverflow.com/q/24899723
tags question: http://stackoverflow.com/q/24884062
tags question: http://stackoverflow.com/q/24808295
tags question: http://stackoverflow.com/q/24775118
tags question: http://stackoverflow.com/q/24875476
tags question: http://stackoverflow.com/q/24826855
tags question: http://stackoverflow.com/q/24894698
tags question: http://stackoverflow.com/q/24749894
tags question: http://stackoverflow.com/q/24858514
tags question: http://stackoverflow.com/q/24790834
tags question: http://stackoverflow.com/q/24806400
tags question: http://stackoverflow.com/q/24897865
tags question: http://stackoverflow.com/q/24863518
tags question: http://stackoverflow.com/q/24779281
tags question: http://stackoverflow.com/q/24835403
tags question: http://stackoverflow.com/q/24843491
tags question: http://stackoverflow.com/q/24878216
tags question: http://stackoverflow.com/q/24803233
tags question: http://stackoverflow.com/q/24817936
tags question: http://stackoverflow.com/q/24780733
tags question: http://stackoverflow.com/q/24886506
tags question: http://stackoverflow.com/q/24783000
tags question: http://stackoverflow.com/q/24903458
tags question: http://stackoverflow.com/q/24899195
tags question: http://stackoverflow.com/q/24806916
tags question: http://stackoverflow.com/q/24881196
tags question: http://stackoverflow.com/q/24851941
tags question: http://stackoverflow.com/q/24764149
tags question: http://stackoverflow.com/q/24829415
tags question: http://stackoverflow.com/q/24786361
tags question: http://stackoverflow.com/q/24759191
tags question: http://stackoverflow.com/q/24851987
tags question: http://stackoverflow.com/q/24764429
tags question: http://stackoverflow.com/q/24908652
tags question: http://stackoverflow.com/q/24874817
tags question: http://stackoverflow.com/q/24890088
tags question: http://stackoverflow.com/q/24751116
tags question: http://stackoverflow.com/q/24831501
tags question: http://stackoverflow.com/q/24762522
tags question: http://stackoverflow.com/q/24796341
tags question: http://stackoverflow.com/q/24774728
tags question: http://stackoverflow.com/q/24830728
tags question: http://stackoverflow.com/q/24780532
tags question: http://stackoverflow.com/q/24840414
tags question: http://stackoverflow.com/q/24779657
tags question: http://stackoverflow.com/q/24764935
tags question: http://stackoverflow.com/q/24861995

http://stackoverflow.com/comment/38731922
comment on: http://stackoverflow.com/a/24883197
type: AnswerComment
has text: @JuannStrauss: I object - because toString() is not meant for that use case, the switch would be a fragile construct, since it would mean to expect every sub class to do so as well.
score: 3
type: Comment

http://stackoverflow.com/comment/38451506
has text: Css file you want to add to give some styling to content inside your pdf? Or one more css file you want to create along with pdf file?
type: Comment
comment on: http://stackoverflow.com/q/24777549
score: 0
type: QuestionComment

http://stackoverflow.com/comment/60082351
score: 0
type: AnswerComment
has text: wouldn't putting the private key file under WEB-INF pose a security concern?
comment on: http://stackoverflow.com/a/35947003
type: Comment

http://stackoverflow.com/a/24900645
score: 0
answers question: http://stackoverflow.com/q/24900614
type: Answer
has body: From the Oracle Java documentation (http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html) Note that this implementation is not synchronized. If multiple threads access a hash map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map: Map m = Collections.synchronizedMap(new HashMap(...)); When you add elements to a hashmap, it's internal structure is changed, so you cannot trust the ordering of elements in a hashmap. If you want to maintain ordering, use a TreeMap.

http://stackoverflow.com/q/24850014
tagged with: lwjgl
type: Question
has answer: http://stackoverflow.com/a/24850330
answer count: 2
has answer: http://stackoverflow.com/a/36673560
has comment: http://stackoverflow.com/comment/38587341
possible better answer: http://stackoverflow.com/a/36673560
tagged with: windows
downvote count: 0
score: 1
has body: In LWJGL, (I am on a mac), I am making a program in it but as I debug/run my code, it requires the LWJGL OS X natives to run. Same goes for Windows, Linux or anything else but I want it to be a little bit like the game Minecraft which was made in LWJGL. You start the game and it automatically picks your operating systems natives. Is there a way I can do this so I dont have to switch around manually on different operating systems? Please share your source if you know!!
tagged with: macos
accepted answer: http://stackoverflow.com/a/24850330
favorite count: 0
tagged with: linux
upvote count: 1
type: AnsweredQuestion
has title: LWJGL Automatic Native Picker
tagged with: java

http://stackoverflow.com/a/24903644
has comment: http://stackoverflow.com/comment/38688982
has body: Offset, read on this: http://docs.oracle.com/javaee/7/tutorial/doc/partpersist.htm#BNBPY SELECT a.question FROM Answer a WHERE a.student.id = :studentId; If you really want to do it manually using the alias select: SELECT q FROM Question q WHERE EXISTS(SELECT a FROM Answer a WHERE a.question.id = q.id);
accepted answer of: http://stackoverflow.com/q/24903434
score: 0
has comment: http://stackoverflow.com/comment/38689129
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38689213
answers question: http://stackoverflow.com/q/24903434

http://stackoverflow.com/q/24795355
upvote count: 2
possible better answer: http://stackoverflow.com/a/24795496
has answer: http://stackoverflow.com/a/24795834
downvote count: 1
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24795499
accepted answer: http://stackoverflow.com/a/24795499
type: AnsweredQuestion
has body: While writing code for my program I thought of testing the first part before moving on and writing the operations. Although I have the user input, but I want the options to be displayed after each operation (add, deltete..) is done untill the users presses exit. How do I modify my code to do it? import java.io.*; import java.util.*; public class Records { public static void main(String[] args) { int choice; do { System.out.println("1.Add \n 2.Delete \n 3.Update \n 4.Show \n Exit"); //BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //int choice; System.out.println("Enter your Choice : "); Scanner sc = new Scanner(System.in); choice = sc.nextInt(); switch (choice) { case 1: System.out.println("Getting ready to Add a Record "); //set(); break; case 2: System.out.println("Getting ready to Delete a Record "); //delete(); break; case 3: System.out.println("Getting ready to Update a Record "); //update(); break; case 4: System.out.println("Here is your record "); //display(); break; case 5: System.out.println("Out we go."); System.exit(0); //exit(); break; default: System.out.println("Try again"); break; } } while ( choice &gt; 5 || choice &lt; 1 ); } }
has answer: http://stackoverflow.com/a/24795496
score: 1
tagged with: java
has title: How to make this program go back to prompt until the user exits
has answer: http://stackoverflow.com/a/24795740
type: Question

http://stackoverflow.com/comment/54633181
type: Comment
has text: This still isn't working for me with v23 of app compat.
comment on: http://stackoverflow.com/a/27644579
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38480724
comment on: http://stackoverflow.com/a/24793144
score: 0
type: Comment
has text: What I have mentioned in the post. It should be under the src folder of the project. click on read more..
type: AnswerComment

http://stackoverflow.com/q/24899825
has comment: http://stackoverflow.com/comment/38681902
tagged with: regex
has comment: http://stackoverflow.com/comment/38681949
answer count: 4
possible better answer: http://stackoverflow.com/a/24899861
has comment: http://stackoverflow.com/comment/38681893
accepted answer: http://stackoverflow.com/a/24899967
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38682148
has body: I trying to get an input to format a certain way. For example input: Before: "12/4" I need a space after each letter in the string. After: " 12 / 4 " Another example: Before "-10/-4*5" After " -10 / -4 * 5 " Before 6*-8/(-4+2) After 6 * -8 / ( -4 + 2 ) I use the spacing to parse and split the input but if theirs not spacing then I can't split by space.
tagged with: java
has answer: http://stackoverflow.com/a/24899967
type: Question
has comment: http://stackoverflow.com/comment/38682193
tagged with: replaceall
has answer: http://stackoverflow.com/a/24900015
has title: Java - Parse an input with ReplaceALL expression
score: 0
has answer: http://stackoverflow.com/a/24899861
has answer: http://stackoverflow.com/a/24899876

http://stackoverflow.com/q/24789310
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: python
has answer: http://stackoverflow.com/a/25134661
score: 2
downvote count: 0
has title: Connect Android App to Python script on Mac OS X via Bluetooth
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/22899475
tagged with: bluetooth
upvote count: 2
has body: My goal is very basic. I am trying to transmit a String from my android device to my Mac running OSX 10.9 via bluetooth. On my Mac I am using the lightblue python library to do the connections. I am pretty sure that the issue is raised by a cast-like exception between what methods are expecting (more detail below). I am relatively new to this type of networking. This is ultimately going to become a rough proof of concept. Any advice would work as well. Thanks! Android Code (Sending String): public class Main extends Activity { private OutputStream outputStream; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { init(); write("Test"); } catch (IOException e) { e.printStackTrace(); } } private void init() throws IOException { BluetoothAdapter blueAdapter = BluetoothAdapter.getDefaultAdapter(); if (blueAdapter != null) { if (blueAdapter.isEnabled()) { Set&lt;BluetoothDevice&gt; bondedDevices = blueAdapter.getBondedDevices(); if(bondedDevices.size() &gt; 0){ BluetoothDevice device = (BluetoothDevice) bondedDevices.toArray()[0]; ParcelUuid[] uuids = device.getUuids(); BluetoothSocket socket = device.createRfcommSocketToServiceRecord(uuids[0].getUuid()); socket.connect(); outputStream = socket.getOutputStream(); } Log.e("error", "No appropriate paired devices."); }else{ Log.e("error", "Bluetooth is disabled."); } } } public void write(String s) throws IOException { outputStream.write(s.getBytes()); } public void run() { final int BUFFER_SIZE = 1024; byte[] buffer = new byte[BUFFER_SIZE]; int bytes = 0; while (true) { try { bytes = inStream.read(buffer, bytes, BUFFER_SIZE - bytes); } catch (IOException e) { e.printStackTrace(); } } } } Adapted from: Android sample bluetooth code to send a simple string via bluetooth Python LightBlue Example Code (Receiving String): import lightblue # create and set up server socket sock = lightblue.socket() sock.bind(("", 0)) # bind to 0 to bind t…
answer count: 1
tagged with: macos

http://stackoverflow.com/comment/38484866
has text: Ok then. Thank you for your help :) Please add this line to your answer so I can accept it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24795003
type: Comment

http://stackoverflow.com/comment/93917249
type: QuestionComment
has text: You can order by modified date and sometimes is enough
score: 0
comment on: http://stackoverflow.com/q/24762063
type: Comment

http://stackoverflow.com/a/24845697
type: Answer
has comment: http://stackoverflow.com/comment/38590080
downvote count: 0
has comment: http://stackoverflow.com/comment/38587469
accepted answer of: http://stackoverflow.com/q/24834702
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24834702
has body: HotSpot JVM prints the exceptions thrown from the UncaughtExceptionHandler. See JavaThread::exit if (HAS_PENDING_EXCEPTION) { ResourceMark rm(this); jio_fprintf(defaultStream::error_stream(), "\nException: %s thrown from the UncaughtExceptionHandler" " in thread \"%s\"\n", pending_exception()-&gt;klass()-&gt;external_name(), get_thread_name()); CLEAR_PENDING_EXCEPTION; } JVM prints these exceptions itself directly on stderr regardless of the System.err state - whether it was redirected or not. Well, this kind of warning does not affect the application - in this sense the exception is "ignored". But you are right, this behavior is not obvious. Javadoc is misleading and is better to be fixed.
upvote count: 5

http://stackoverflow.com/comment/38715881
score: 0
type: Comment
has text: perfect. Also does the code edtUser.setText(sharedPref.getString("user", "")); gets the "user" infoo from the shared preff and store it inside of edtUser?
type: AnswerComment
comment on: http://stackoverflow.com/a/24900523

http://stackoverflow.com/q/24768597
has comment: http://stackoverflow.com/comment/38469489
has comment: http://stackoverflow.com/comment/38457364
has comment: http://stackoverflow.com/comment/38457855
has title: Data Nucleus error: Class "has application-identity and no objectid-class specified yet has 0 primary key fields"
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/38507930
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38524353
upvote count: 3
tagged with: java
type: Question
tagged with: datanucleus
has body: I am receiving an error when my JPA code is invoked and the EntityManagerFactory is being retrieved: Caused by: org.datanucleus.metadata.InvalidClassMetaDataException: Class com.analytics.jpa.model.Providers has application-identity and no objectid-class specified yet has 0 primary key fields. Unable to use SingleFieldIdentity. at org.datanucleus.metadata.AbstractClassMetaData.determineObjectIdClass(AbstractClassMetaData.java:1415) at org.datanucleus.metadata.ClassMetaData.populate(ClassMetaData.java:209) at org.datanucleus.metadata.MetaDataManager$1.run(MetaDataManager.java:2806) at java.security.AccessController.doPrivileged(Native Method) at org.datanucleus.metadata.MetaDataManager.populateAbstractClassMetaData(MetaDataManager.java:2800) at org.datanucleus.metadata.MetaDataManager.populateFileMetaData(MetaDataManager.java:2623) at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:1183) at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:1046) at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialiseNucleusContext(JPAEntityManagerFactory.java:855) at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialise(JPAEntityManagerFactory.java:470) at org.datanucleus.api.jpa.JPAEntityManagerFactory.<init>(JPAEntityManagerFactory.java:428) at org.datanucleus.api.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:116) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:152) My model class looks like this: @Entity @Table(name = "PROVIDERS") @SequenceGenerator(name = "PROVIDERS_SEQ", sequenceName = "PROVIDERS_SEQ", allocationSize = 1) public class Providers { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PROVIDERS_SEQ") @Column(name = "PROVIDER_ID") private Long providerId; @Column(name = "PROVIDER_NAME", nullable = false, length = 1000) private String providerName; @OneToOne(optional = false, orphanRemoval = true, cas…
has comment: http://stackoverflow.com/comment/38447648
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/38456903

http://stackoverflow.com/q/24764306
favorite count: 0
tagged with: jclouds
type: Question
tagged with: openstack-swift
has answer: http://stackoverflow.com/a/24767573
upvote count: 1
has body: I have an openstack-swift blob store set up with v1 authentication that I wish to access via jclouds. Is there a way to do this? (As far as I can tell, the KeystoneAuthenticationModule is always installed.) Thank you.
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24767573
has title: jclouds - use authentication v1 for openstack-swift?
type: AnsweredQuestion
downvote count: 0
score: 1

javascript
tags question: http://stackoverflow.com/q/24820869
tags question: http://stackoverflow.com/q/24813560
tags question: http://stackoverflow.com/q/24811967
tags question: http://stackoverflow.com/q/24821467
tags question: http://stackoverflow.com/q/24774757
tags question: http://stackoverflow.com/q/24890690
tags question: http://stackoverflow.com/q/24753093
tags question: http://stackoverflow.com/q/24834900
tags question: http://stackoverflow.com/q/24772981
tags question: http://stackoverflow.com/q/24882608
tags question: http://stackoverflow.com/q/24822593
tags question: http://stackoverflow.com/q/24855910
tags question: http://stackoverflow.com/q/24855182
tags question: http://stackoverflow.com/q/24776340
tags question: http://stackoverflow.com/q/24871661
tag name: javascript
tags question: http://stackoverflow.com/q/24752111
tags question: http://stackoverflow.com/q/24839530
tags question: http://stackoverflow.com/q/24792150
tags question: http://stackoverflow.com/q/24876087
tags question: http://stackoverflow.com/q/24906118
tags question: http://stackoverflow.com/q/24777242
tags question: http://stackoverflow.com/q/24826386
tags question: http://stackoverflow.com/q/24891886
tags question: http://stackoverflow.com/q/24839209
tags question: http://stackoverflow.com/q/24843957
tags question: http://stackoverflow.com/q/24814899
tags question: http://stackoverflow.com/q/24807730
tags question: http://stackoverflow.com/q/24887761
tags question: http://stackoverflow.com/q/24902328
tags question: http://stackoverflow.com/q/24893032
type: Tag
tags question: http://stackoverflow.com/q/24805540
tags question: http://stackoverflow.com/q/24771788
tags question: http://stackoverflow.com/q/24749405
tags question: http://stackoverflow.com/q/24903771
tags question: http://stackoverflow.com/q/24765503
tags question: http://stackoverflow.com/q/24819528
tags question: http://stackoverflow.com/q/24798961
tags question: http://stackoverflow.com/q/24877700
tags question: http://stackoverflow.com/q/24788800
tags question: http://stackoverflow.com/q/24893158
tags question: http://stackoverflow.com/q/24755319
tags question: http://stackoverflow.com/q/24884963
tags question: http://stackoverflow.com/q/24847591
tags question: http://stackoverflow.com/q/24778208
tags question: http://stackoverflow.com/q/24868265
tags question: http://stackoverflow.com/q/24851837
tags question: http://stackoverflow.com/q/24859083
tags question: http://stackoverflow.com/q/24784792
tags question: http://stackoverflow.com/q/24824238
tags question: http://stackoverflow.com/q/24800567
tags question: http://stackoverflow.com/q/24842754
tags question: http://stackoverflow.com/q/24906934
tags question: http://stackoverflow.com/q/24827446
tags question: http://stackoverflow.com/q/24755952
tags question: http://stackoverflow.com/q/24865961
tags question: http://stackoverflow.com/q/24756749
tags question: http://stackoverflow.com/q/24872619
tags question: http://stackoverflow.com/q/24823909
tags question: http://stackoverflow.com/q/24900705
tags question: http://stackoverflow.com/q/24847951
tags question: http://stackoverflow.com/q/24786584
tags question: http://stackoverflow.com/q/24812758
tags question: http://stackoverflow.com/q/24830987

http://stackoverflow.com/a/24790309
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/38475287
downvote count: 0
has comment: http://stackoverflow.com/comment/38476900
has body: Your issue is that an EditText is not a number or even a String. It is a View that has a String contained in it. EditText x1 = (EditText)findViewById(R.id.Tensione); EditText x2 = (EditText)findViewById(R.id.Potenza); ... // get the Strings from the EditTexts String x1Contents = x1.getText().toString(); String x2Contents = x2.getText().toString(); // convert Strings to ints int x1Number = Integer.parseInt(x1Contents); int x2Number = Integer.parseInt(x2Contents); // then add them together int x3Number = x1Number + x2Number; This is not a complete solution. You will still need to grab the contents when you know the EditTexts have values and make sure that it is numeric input or ensure you handle non-numeric input appropriately.
has comment: http://stackoverflow.com/comment/38476714
has comment: http://stackoverflow.com/comment/38476808
has comment: http://stackoverflow.com/comment/38476935
score: 4
answers question: http://stackoverflow.com/q/24790238
has comment: http://stackoverflow.com/comment/38476762

http://stackoverflow.com/a/24892448
has comment: http://stackoverflow.com/comment/38724042
type: Answer
has comment: http://stackoverflow.com/comment/38724510
answers question: http://stackoverflow.com/q/24883075
has comment: http://stackoverflow.com/comment/38670743
has comment: http://stackoverflow.com/comment/38729641
has body: Your problem here is at a more fundamental level: you built Vehicle in such a way that Garage needs to know more about its objects than the Vehicle interface gives away. You should try and build the Vehicle class from the Garage perspective (and in general from the perspective of everything that's going to use Vehicle): what kind of things do they need to do with their vehicles? How can I make those things possible with my methods? For example, from your example: bool carIsAutomatic = myGarage[0].auto; Your garage want to know about a vehicle's engine for... reasons? Anyway, there is no need for this to be just exposed by Car. You can still expose an unimplemented isAutomatic() method in Vehicle, then implement it as return True in Boat and return this.auto in Car. It would be even better to have a three-valued EngineType enum (HAS_NO_GEARS, HAS_GEARS_AUTO_SHIFT, HAS_GEARS_MANUAL_SHIFT), which would let your code reason on the actual characteristics of a generic Vehicle cleanly and accurately. (You'd need this distinction to handle motorbikes, anyway.)
downvote count: 0
score: 8
has comment: http://stackoverflow.com/comment/38670583
upvote count: 8

http://stackoverflow.com/comment/38542932
comment on: http://stackoverflow.com/a/24825833
has text: As in , can you tell me exactly what I am supposed to alter / change my code ? I am quite clueless :x
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24799714
downvote count: 0
has body: It look like it wants the org.eclipse.osgi.framework.internal.core.FrameworkProperties class, but this is not part of the Eclipse Luna release, it was part of earlier releases. So it looks like this version of JBoss is not compatible with Eclipse Luna.
type: Answer
has comment: http://stackoverflow.com/comment/38500174
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24799162
answers question: http://stackoverflow.com/q/24799162
type: AcceptedAnswer

http://stackoverflow.com/comment/38606945
score: 0
type: Comment
type: QuestionComment
has text: Your question is not very clear - do you want to remove the entire line that matches a pattern (e.g. `medical_data*`) ? If so, you may like to skip the matched pattern, instead of replacing it. Take a look at Scanner API to match using regexp as well.
comment on: http://stackoverflow.com/q/24860120

http://stackoverflow.com/comment/38504284
comment on: http://stackoverflow.com/q/24806045
score: 0
type: QuestionComment
type: Comment
has text: Show some code of what you tried or what you thought of so far. You can't expect an answer with the full code solving your problem on stackoverflow. Show some code and the people will gladly give you a push in the right direction.

http://stackoverflow.com/q/24750906
linked to: http://stackoverflow.com/q/8748960
has body: this is a work in progress, but I was wondering about how to access a specific file. My main method is supposed to construct a new FileInputStream with a new file as its parameter. Then, I am supposed to call getCounts method that accepts a FileInputStream object to return some kind of map. Inside the getCounts method, I am having trouble finishing this as I have to be able to access the file inside it, and FileInputStream doesn't seem to have a accessor for it. In other words, how do I access this file used to construct the FileInputStream object that goes into the getCounts Method as a parameter, inside the getCounts method? Ultimately, I am supposed to use the keys/values of the map to get the most reoccurring character of the text file. Thanks. Here is my code: import java.util.*; import java.io.*; public class test2 { public static void main(String[] q) throws FileNotFoundException { // This is for the character mapping Scanner console = new Scanner(System.in); System.out.println("Count characters of which file? "); FileInputStream output = new FileInputStream(new File(console.nextLine())); Map&lt;Character, Integer&gt; results = getCounts(output); // do stuff with this map later on... } // character counting method (WIP) public static Map&lt;Character, Integer&gt; getCounts(FileInputStream input) { Map&lt;Character, Integer&gt; output = new TreeMap&lt;Character, Integer&gt;(); // treemap keeps keys in sorted order (chars alphabetized) // Problem here: need to access the file object that was instiantiated byte[] fileContent = new byte[(int) file.length()]; // puts all the bytes from file into byte[] to process input.read(fileContent); String test = new String(fileContent); // missing stuff here; use map to map keys as characters and occurrences as values. return output; } }
type: Question
answer count: 2
tagged with: fileinputstream
downvote count: 0
has comment: http://stackoverflow.com/comment/38400351
possible better answer: http://stackoverflow.com/a/24751013
favorite count: 0
tagged with: character
upvote count: 1
tagged with: dictionary
has answer: http://stackoverflow.com/a/24751066
has answer: http://stackoverflow.com/a/24751013
accepted answer: http://stackoverflow.com/a/24751066
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to access the parameter of a parameter?

memory-leaks
tags question: http://stackoverflow.com/q/24888121
tags question: http://stackoverflow.com/q/24762966
tags question: http://stackoverflow.com/q/24907311
tags question: http://stackoverflow.com/q/24789988
type: Tag
tags question: http://stackoverflow.com/q/24852553
tags question: http://stackoverflow.com/q/24908709
tag name: memory-leaks
tags question: http://stackoverflow.com/q/24780226
tags question: http://stackoverflow.com/q/24863959
tags question: http://stackoverflow.com/q/24869645
tags question: http://stackoverflow.com/q/24806938
tags question: http://stackoverflow.com/q/24878270

http://stackoverflow.com/comment/38901113
type: Comment
type: QuestionComment
has text: @AndreiStefan That was bogus, it was caused by my code in the context closed listener which I introduced just for debugging. It went away when I replaced it with `System.err.println`. But it did show that classloading is compromised at this point in the shutdown procedure.
comment on: http://stackoverflow.com/q/24759373
score: 0

http://stackoverflow.com/a/24771353
has body: If you're really using RMI you can do it with the RMI codebase feature. Put your JAR file somewhere on an HTTP server, and start your server JVM with -Djava.rmi.server.codebase=&lt;URL of the JAR file&gt; Make sure the URL is correct: you can check it with a browser. It should try to start a download of the JAR, which you can cancel once you see it works. Then your client needs to be run under a SecurityManager and an appropriate .policy file. If you want to load client classes into the server, the client JVM needs to be started with the codebase argument, and the server needs the security manager and the .policy file. This is pretty unusual. When you have this configured correctly, it is all automatic. No ClassLoader code of yours required at all.
type: Answer
accepted answer of: http://stackoverflow.com/q/24770948
score: 0
answers question: http://stackoverflow.com/q/24770948
type: AcceptedAnswer

http://stackoverflow.com/a/24765564
type: Answer
has comment: http://stackoverflow.com/comment/38427668
upvote count: 1
downvote count: 1
has body: If my memory serves me right, the problem is the method you're calling. Try using setTextContent For example firstname.setTextContent("† José do Capêta †"); That should escape the text automatically.
answers question: http://stackoverflow.com/q/24765410
score: 0

http://stackoverflow.com/comment/38561617
score: 0
type: Comment
type: QuestionComment
has text: All of that and more, with a real problem as the starting point. Namely, extracting a predefined set of keys (and their values) from long strings that have numerous other key-value pairs that should be ignored an interesting and not rare use case.
comment on: http://stackoverflow.com/q/24836588

setter
tags question: http://stackoverflow.com/q/24859700
type: Tag
tags question: http://stackoverflow.com/q/24815737
tags question: http://stackoverflow.com/q/24771575
tag name: setter

http://stackoverflow.com/comment/38415532
has text: Ok, I see. So in the second case, because nf_ant and nf are both ints and they sit inside parentheses, they are evaluated to an int and I lose some precision. In the first case the double is multiplied by the int and the result goes into a double. Then it is divided by the other int ant the result goes, again, into a double. So this way I don't lose precision. Thank you.
type: Comment
comment on: http://stackoverflow.com/a/24759025
score: 0
type: AnswerComment

http://stackoverflow.com/a/24834558
has body: So, after some trial and error, I came to find out that the issue with the .get() (and apparently .save() too) was that I did not have a hibernate.default_schema set in config. Looks like it is used to create the 'dynamic' SQL for .save() and .get(), but if you use .createSQLQuery(), it just uses what ever String you pass as an argument for the SQL, and therefor works with out needing to have hibernate.default_schema set.
answers question: http://stackoverflow.com/q/24814415
score: 0
type: Answer

recursion
type: Tag
tags question: http://stackoverflow.com/q/24893049
tags question: http://stackoverflow.com/q/24875189
tag name: recursion
tags question: http://stackoverflow.com/q/24843174
tags question: http://stackoverflow.com/q/24827824
tags question: http://stackoverflow.com/q/24795838
tags question: http://stackoverflow.com/q/24749282
tags question: http://stackoverflow.com/q/24798173
tags question: http://stackoverflow.com/q/24792250
tags question: http://stackoverflow.com/q/24831088
tags question: http://stackoverflow.com/q/24831010
tags question: http://stackoverflow.com/q/24860851
tags question: http://stackoverflow.com/q/24816735

http://stackoverflow.com/q/24837157
score: 2
type: AnsweredQuestion
has body: The Problem: Given an array of ints, is it possible to choose a group of some of the ints, such that the group sums to the given target with this additional constraint: If a value in the array is chosen to be in the group, the value immediately following it in the array must not be chosen. For eg:- groupNoAdj(0, {2, 5, 10, 4}, 12) → true groupNoAdj(0, {2, 5, 10, 4}, 14) → false groupNoAdj(0, {2, 5, 10, 4}, 7) → false As you can see in the last case though there exists as subset {2,5} which sums to target value '7' but they are adjacent values and hence can't to chosen together. Also there is another condition that you can't use a local variable. I came up with the solution below: public boolean groupNoAdj(int start, int[] nums, int target) { if(start==nums.length) return target==0; if(start==nums.length-1&amp;&amp;!(target==0)) return (target-nums[start]==0); if(target==0) return true; if((start&lt;nums.length-1)&amp;&amp;groupNoAdj(start+1, nums, target-nums[start])) return groupNoAdj(start+2, nums, target-nums[start]); return groupNoAdj(start+1, nums, target); } But it's failing in case groupNoAdj(0, {2, 5, 10, 4, 2}, 7) it's returning false when it should actually return true Can't really spot what's causing it to fail in this case.
downvote count: 0
has comment: http://stackoverflow.com/comment/38563019
favorite count: 0
type: Question
upvote count: 2
has title: Determining if there exists a subset in a Array of Integers that sums to a given target value under a couple of conditions
has comment: http://stackoverflow.com/comment/38562632
tagged with: java
has answer: http://stackoverflow.com/a/24837358
answer count: 1
accepted answer: http://stackoverflow.com/a/24837358
has comment: http://stackoverflow.com/comment/38562661
tagged with: arrays
has comment: http://stackoverflow.com/comment/38562905
has comment: http://stackoverflow.com/comment/38562643
has comment: http://stackoverflow.com/comment/38562856

http://stackoverflow.com/comment/81752466
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24882927
has text: Possible duplicate of [Java: convert List<String> to a String](https://stackoverflow.com/questions/1751844/java-convert-liststring-to-a-string)

http://stackoverflow.com/comment/38601444
has text: How are you calling this class?
comment on: http://stackoverflow.com/q/24857322
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/38858070
has text: I did try using getBaseContext(), but had an error. See my edited question. I have also tried to use getSpecificationContext(), but that also failed. Thanks.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24969695

http://stackoverflow.com/comment/38597677
has text: so once I create String item would it make sense to have item = k??
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24855253

http://stackoverflow.com/comment/38462652
type: Comment
comment on: http://stackoverflow.com/a/24783403
score: 1
type: AnswerComment
has text: I was just interested in how jvm handles naming collisions, there is no sane reason for using $ sign in class and variable names.

http://stackoverflow.com/q/24884967
possible better answer: http://stackoverflow.com/a/24885574
has body: I've an issue that'll nearly make go mad. I've declared a servlet Filter in web.xml in order to use it to encode file name (I want to get rid of accents to prevent any problems in the future for upload/download files). The thing is before I used the Servlet Filter, I've been using Request parameters normally. Now that I want to use the Servlet Filter for the purpose explained before, when I try to used the request inside the Filter, oddly enough, I get an empty request. I searched for days seekin' some solutions, in vain sadly. I put down my servlet filter declaration in web.xml file and the servlet filter doFilter code. web.xml Encoding Filter com.util.encoding.EncodingCharsFilter Encoding Filter /AppUpload Servlet Filter Class public final void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; // if (req.getCharacterEncoding() == null && this.encoding != null) { // // String oldFile = req.getParameter("fileName"); // // String newFile= Normalizer.decompose(oldFile,false,0).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); // // req.setAttribute("fileName", newFile); // // req.setCharacterEncoding(encoding); // } Map<String, String[]> parameters = request.getParameterMap(); for(String parameter : parameters.keySet()) { System.out.println(parameter); } // Enumeration<String> parameterNames = req.getParameterNames(); // // while (parameterNames.hasMoreElements()) { // // // // String paramName = parameterNames.nextElement(); // // System.out.println(paramName); // // System.out.println("n"); // // // // String[] paramValues = req.getParameterValues(paramName); // // for (int i = 0; i < paramValues.length; i++) { // // String paramValue = paramValues[i]; // // System.out.println("t" + paramValue); // // System.out.println("n"); // // } // // } chain.doFilter(req, resp); } Thanks in advance.
has answer: http://stackoverflow.com/a/24885574
has answer: http://stackoverflow.com/a/25085566
tagged with: java
tagged with: servlets
type: AnsweredQuestion
upvote count: 0
has title: Request null in Servlet Filter
tagged with: jsp
favorite count: 0
tagged with: filter
accepted answer: http://stackoverflow.com/a/25085566
type: Question
score: -1
tagged with: http://stackoverflow.com/tag/xml
answer count: 2
downvote count: 1

http://stackoverflow.com/comment/38535530
type: QuestionComment
has text: Regex seems fine.. for what input is it failing?
score: 2
comment on: http://stackoverflow.com/q/24822849
type: Comment

http://stackoverflow.com/q/24769594
has title: Replace one word from user input
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38436050
tagged with: input
has body: For a project, I need to take a user input such as "I hate you" and I need to replace the word "hate" with "love". I can't use replace all. I understand that I can use .indexOf and find the position of the word hate and then use concatenation to form a new sentence I'm just really confused on how to do that. I'll show what I have below. Also can you guys keep in mind that I'm new to this site and programming. I'm not just here for a quick fix, I'm actually trying to learn this. I've been doing a lot of research and I can't seem to find an answer. import java.util.Scanner; public class ReplaceLab { public static void main(String[]args){ Scanner input = new Scanner(System.in); System.out.print("Please enter a line of text:"); String userInput = input.nextLine(); int position = userInput.indexOf("hello"); System.out.println("I have rephrased that line to read"); } }
tagged with: java
has answer: http://stackoverflow.com/a/24770656
type: Question
tagged with: string-concatenation
tagged with: replace
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24770049

http://stackoverflow.com/comment/38522601
score: 0
has text: @user3135757 Here are the files I used: https://gist.github.com/kmb385/e5555bdc43f209c96889
type: AnswerComment
comment on: http://stackoverflow.com/a/24815540
type: Comment

http://stackoverflow.com/comment/38652293
type: AnswerComment
comment on: http://stackoverflow.com/a/24884279
has text: it depends on formatting you have. There are multiple libraries e.g. https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringEscapeUtils.html
type: Comment
score: 0

http://stackoverflow.com/a/24831734
type: Answer
has body: You can try button.setBorder(null); This will remove all of the graphics for the button and therefore the button will look the same whether it has been pressed or not.
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24831603

http://stackoverflow.com/comment/38506247
score: 2
type: AnswerComment
has text: That's all well and good, but doesn't really explain why you can't/shouldn't instantiate an abstract class...
comment on: http://stackoverflow.com/a/24807242
type: Comment

http://stackoverflow.com/comment/38696135
score: 0
has text: Thanks kharyam for your quick response.
type: AnswerComment
comment on: http://stackoverflow.com/a/24907538
type: Comment

http://stackoverflow.com/comment/38414403
score: 0
type: Comment
type: QuestionComment
has text: Nope, It is 8081. I have been using it for quiet some time now. Even so, the error should come up with 8081, if that was the case. I have the URL defined in POM
comment on: http://stackoverflow.com/q/24758369

http://stackoverflow.com/a/24837875
upvote count: 1
has body: That error so far as I am aware means that the specific method hasn't been implemented, you can try however converting the file into a byte array and storing it using ps.setBytes(&lt;Byte Array&gt;) instead if the column is set to storing BLOB data
has comment: http://stackoverflow.com/comment/38565189
type: Answer
answers question: http://stackoverflow.com/q/24837831
downvote count: 0
score: 1

http://stackoverflow.com/comment/38466333
comment on: http://stackoverflow.com/a/24769643
type: AnswerComment
has text: Hi and thanks again for your help. Sadly, the simple addition of `propagation=Propagation.REQUIRES_NEW` to the `@Transactional(...)` annotation didn't solve the problem. I have, however found an alternate solution that appears to work: I've implemented the `ApplicationListener<ContextRefreshedEvent>` interface as described in [this question](http://stackoverflow.com/questions/17346679/transactional-on-postconstruct-method). This appears to solve my problem. Again my thanks to you both for your help.
score: 0
type: Comment

http://stackoverflow.com/comment/38696159
type: QuestionComment
type: Comment
has text: @Yogi: no, no file generated, the dir always empty. All these files were not exists.
score: 0
comment on: http://stackoverflow.com/q/24907311

http://stackoverflow.com/q/24857795
tagged with: error-handling
has body: I have this code.When i run it it gets data from a JSON and displays. I want an xml layout with a button called 'News' at the start of my application and when you click that 'News' button i want to display my JSON data. How to add that layout with a button? http://www.megafileupload.com/en/file/551807/AdaDerana-rar.html this is my source code. Here's my MainActivity class package com.example.adaderana; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ListView; public class MainActivity extends Activity { // Declare Variables JSONObject jsonobject; JSONArray jsonarray; ListView listview; ListViewAdapter adapter; ProgressDialog mProgressDialog; ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist; static String TITLE = "title"; static String AUTHOR = "author"; static String THUMBNAIL = "thumbnail"; static String CONTENTS = "contents"; static String IMAGE = "image"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from list_main.xml setContentView(R.layout.listview_main); // Execute DownloadJSON AsyncTask new DownloadJSON().execute(); } // DownloadJSON AsyncTask private class DownloadJSON extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); // Create a progressdialog mProgressDialog = new ProgressDialog(MainActivity.this); // Set progressdialog title mProgressDialog.setTitle("Derana News"); // Set progressdialog message mProgressDialog.setMessage("Loading..."); mProgressDialog.setIndeterminate(false); // Show progressdialog mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { // Cr…
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: android-layout
possible better answer: http://stackoverflow.com/a/24857852
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38602704
score: -1
accepted answer: http://stackoverflow.com/a/24858031
answer count: 2
upvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38602312
has comment: http://stackoverflow.com/comment/38603529
has title: Layout with a button at start
has comment: http://stackoverflow.com/comment/38603224
has answer: http://stackoverflow.com/a/24858031
has answer: http://stackoverflow.com/a/24857852
tagged with: java

http://stackoverflow.com/comment/38441483
comment on: http://stackoverflow.com/q/24772360
has text: The import android.support.v7.app cannot be resolved
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24825135
tagged with: design-patterns
score: 2
tagged with: oop
answer count: 0
downvote count: 0
tagged with: java
tagged with: jaxb
type: Question
tagged with: xslt
has body: The project I'm currently working on is a web application (mostly Web Services, not JSP or anything like that) which functions as a 'façade' between an older interface coming from the front (a web page it exposes a couple of web services to) and a more complex interface at the bottom (using web services to call them). A lot of the web services at the bottom have quite complex structures (part of a standard I can't change). What I like to do in cases like that, is create simple JAXB POJOs and use XSLT to convert them to their complex structures. For example: @XmlRootElement(name = "simplequery", namespace="http://www.foo.com") @XmlAccessorType(XmlAccessType.FIELD) public class SimpleQuery { @XmlElement(name = "id") private String name; public void setId(String id) { this.id = id; } } And I can call it like this: SimpleQuery sq = new SimpleQuery(); sq.setId("12264736376374"); org.w3c.dom.Document sqDoc = new XsltTransformer("SimpleQuery-to-VeryComplexQuery.xsl").transform(); QueryConsumer.sendQuery(sqDoc); You'll just have to assume those classes exist and do what you think they do. Here's a relevant snippet from my example XSLT: <x:value-of select="foo:id"/> I like doing it like this for 2 reasons: The "configuration" is done in XSLT and not in compiled code so I can easily maintain it I don't have to create horrible (what I like to call) "pyramid code" like this with a complex JAXB object: Some s = new Some(); s.setComplex(new Complex()); s.getComplex().setStructure(new Structure()); s.getComplex().getStructure().setId(new Id()); s.getComplex().getStructure().getId().setValue("1222333232"); Time to get to the point. There are a couple of complex interfaces pointing to different web services and even servers, all in their respective namespaces. During some refactoring OCD I want to place this part: SimpleQuery sq = new SimpleQuery(); sq.setId("12264736376374"); org.w3c.dom.Document sqDoc = new XsltTransformer("SimpleQuery-to-VeryComplexQuery.xsl").transform(); ...int…
upvote count: 2
favorite count: 0
has title: Conveyor Belt Pattern?
type: UnansweredQuestion

http://stackoverflow.com/comment/40149780
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24807362
has text: Since posting, I have upgraded Android Studio. I no longer have the sample app I used before, so I tried to recreate it. I am not getting the message I originally received. I can't swear if I am doing the exact same sample, or if an upgrade to Studio fixed it (I am on the latest canary 0.8.9 build) or if something else on my system changed. I think I added the compileOptions to the build.gradle. Do you have java 7 installed?

http://stackoverflow.com/comment/38458177
type: Comment
comment on: http://stackoverflow.com/a/24780173
has text: I don't use any xml file in my project, only java classes. Do you know the equivalent to that line in java code?
score: 0
type: AnswerComment

http://stackoverflow.com/q/24801476
tagged with: lwuit
has body: I have tried going to the plugin download center and I refreshed over 50 times over the course of a week and still i cannot see the LWUIT plugin for Java ME. Is there a way for me to manually install this plugin without using the plugin download center?
has answer: http://stackoverflow.com/a/24823944
has title: Manually add the LWUIT plugin to netbeans
upvote count: 1
tagged with: plugins
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24823944
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: netbeans-8

http://stackoverflow.com/comment/38645087
type: Comment
has text: But it get NullPointerException at this line = if (prefs.getString("EMAIL_ID", copyEmail).equals(strEmailId))
comment on: http://stackoverflow.com/a/24879585
score: 0
type: AnswerComment

http://stackoverflow.com/q/24780233
type: Question
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38456004
has title: Remove quotes from json array
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/24780761
tagged with: arrays
has comment: http://stackoverflow.com/comment/38455370
downvote count: 0
has comment: http://stackoverflow.com/comment/38455639
has body: I have the following problem: I have an ArrayList in Java. I convert the ArrayList to string like this: Gson gson = new Gson(); String feeds += gson.toJson(arrayList); This is the result: [{"status":"ERROR","position":"[48.2748206,8.849529799999999]"}] But i need the following output: [{"status":"ERROR","position": [48.2748206,8.849529799999999]}] The Value of position should be without quotes. How can i realize that? Many thanks in advance Greets
favorite count: 0
has comment: http://stackoverflow.com/comment/38455293
has answer: http://stackoverflow.com/a/24780761
has answer: http://stackoverflow.com/a/24781779
has answer: http://stackoverflow.com/a/24781381
accepted answer: http://stackoverflow.com/a/24781381
has comment: http://stackoverflow.com/comment/38457157
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: gson
has comment: http://stackoverflow.com/comment/38455097

http://stackoverflow.com/a/24878960
answers question: http://stackoverflow.com/q/24876978
has comment: http://stackoverflow.com/comment/38669243
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38660760
has body: You could have another shader program that you use just for "parking" the shader while it's detached from the shader you're operating on. That will maintain a reference that keeps it from getting deleted for good. Just showing the extended parts of the code, with dummyProgram being a program you created solely for this purpose: if (currVertexShader != 0) { glAttachShader(dummyProgram, currVertexShader); glDetachShader(currProgram, currVertexShader); } ... if (currVertexShader != 0) { glAttachShader(currProgram, currVertexShader); glDetachShader(dummyProgram, currVertexShader); } This will work based on the following definition in the spec (appendix D.1.2 in OpenGL 3.3 spec): When a shader object or program object is deleted, it is flagged for deletion, but its name remains valid until the underlying object can be deleted because it is no longer in use. A shader object is in use while it is attached to any program object. So simply attaching the shader to any program is enough for it being considered "in use", and preventing it from being deleted. If you're interested in more details about the subtle aspects of program/shader lifetimes, this is an answer I wrote to an earlier question: glDeleteShader - is the order irrelevant?.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24876978

http://stackoverflow.com/q/24764302
tagged with: arraylist
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24764363
accepted answer: http://stackoverflow.com/a/24764363
has comment: http://stackoverflow.com/comment/38425315
has comment: http://stackoverflow.com/comment/38425342
has title: Should i store Arraylist or extend it?
has body: i am making a game and it uses a gird i can implement it by extending arraylist for example: public class Grid extends ArrayList&lt;ArrayList&lt;obj&gt;&gt; { public void addObj(Obj obj ,int x, int y) { get(x).set(y,obj); } } or should i do it by storing it public class Grid { private ArrayList&lt;ArrayList&lt;obj&gt;&gt; objs = new ArrayList&lt;...&gt;(); public void addObj( Obj obj, int x, int y) { objs.get(x).set(y,obj); } } help plz
duplicate of: http://stackoverflow.com/q/49002
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38425509
tagged with: java
linked to: http://stackoverflow.com/q/383947
type: Question
has answer: http://stackoverflow.com/a/24764661
possible better answer: http://stackoverflow.com/a/24764365
linked to: http://stackoverflow.com/q/49002
has answer: http://stackoverflow.com/a/24764365

http://stackoverflow.com/a/24815609
upvote count: 2
answers question: http://stackoverflow.com/q/24815494
score: 2
has body: So, you need two things... First of all, you need some way to monitor the progress of the image loading and writing...This gets a little complex very quickly, as to be able to monitor the progress of the operations, you need to know the actual reader/writer used by ImageIO.... File file = new File("..."); try (ImageInputStream iis = ImageIO.createImageInputStream(file)) { Iterator&lt;ImageReader&gt; readers = ImageIO.getImageReaders(iis); if (readers.hasNext()) { ImageReader reader = readers.next(); reader.addIIOReadProgressListener(new IIOReadProgressListener() { @Override public void sequenceStarted(ImageReader source, int minIndex) { } @Override public void sequenceComplete(ImageReader source) { } @Override public void imageStarted(ImageReader source, int imageIndex) { } @Override public void imageProgress(ImageReader source, float percentageDone) { //TODO: Update progress... } @Override public void imageComplete(ImageReader source) { } @Override public void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex) { } @Override public void thumbnailProgress(ImageReader source, float percentageDone) { } @Override public void thumbnailComplete(ImageReader source) { } @Override public void readAborted(ImageReader source) { } }); reader.setInput(iis); try { BufferedImage img = reader.read(0); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (ImageOutputStream ios = ImageIO.createImageOutputStream(baos)) { Iterator&lt;ImageWriter&gt; writers = ImageIO.getImageWritersByFormatName("png"); if (writers.hasNext()) { ImageWriter writer = writers.next(); writer.addIIOWriteProgressListener(new IIOWriteProgressListener() { @Override public void imageStarted(ImageWriter source, int imageIndex) { } @Override public void imageProgress(ImageWriter source, float percentageDone) { // TODO: Update progress } @Override public void imageComplete(ImageWriter source) { } @Override public void thumbnailStarted(ImageWriter source, int imageIndex, int thumbnailI…
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24815494

http://stackoverflow.com/a/24864201
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24752350
answers question: http://stackoverflow.com/q/24752350
has body: After a little Prototyping I was able to make a drag gable flextable.I created a class which extended the flex table.Here is the code public class DragFlexTable extends FlexTable implements MouseDownHandler,MouseUpHandler,MouseMoveHandler, MouseOutHandler { private int row,column,draggedrow,draggedcolumn; private Element td; private Widget w; private boolean emptycellclicked; DragFlexTable() { sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONMOUSEDOWN | Event.ONMOUSEMOVE); this.addMouseDownHandler(this); this.addMouseMoveHandler(this); this.addMouseUpHandler(this); this.addMouseOutHandler(this); } @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); td = getEventTargetCell(event); if (td == null) { return; } Element tr = DOM.getParent((com.google.gwt.user.client.Element) td); Element body = DOM.getParent((com.google.gwt.user.client.Element) tr); row = DOM.getChildIndex((com.google.gwt.user.client.Element) body, (com.google.gwt.user.client.Element) tr);//(body, tr); column = DOM.getChildIndex((com.google.gwt.user.client.Element) tr, (com.google.gwt.user.client.Element) td); } boolean mousedown; @Override public void onMouseDown(MouseDownEvent event) { if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) { //to ensure empty cell is not clciked if (!td.hasChildNodes()) { emptycellclicked = true; } event.preventDefault(); start(event); mousedown = true; } } @Override public void onMouseMove(MouseMoveEvent event) { if (mousedown) { drag(event); } } @Override public void onMouseUp(MouseUpEvent event) { if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) { if (!emptycellclicked) { end(event); } emptycellclicked = false; mousedown = false; } } @Override public void onMouseOut(MouseOutEvent event) { this.getCellFormatter().getElement(row, column).getStyle().clearBorderStyle(); this.getCellFormatter().getElement(row, column).getStyle().clearBorderColor(); this.getCellFormatter().getElement(row, column).getStyle().clearBorderWidth();…

http://stackoverflow.com/a/24812718
has comment: http://stackoverflow.com/comment/38517053
has comment: http://stackoverflow.com/comment/38516939
has comment: http://stackoverflow.com/comment/38516971
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38516904
accepted answer of: http://stackoverflow.com/q/24812684
has body: Placing the suffix l or L on the end of a numeric literal indicates a long literal, and not a Long object. Section 3.10.1 of the JLS specifies the data type of a numeric literal with an l or L suffix: An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (§4.2.1). The type can matter when specifying literals of large quantity that are too large to fit in an int literal. // 10 billion is illegal; too big to fit in an int, // even if later assigned to a long long tooBigInt = 10000000000; // 10 billion here is a legal long literal long justRight = 10000000000L;
answers question: http://stackoverflow.com/q/24812684
type: Answer
has comment: http://stackoverflow.com/comment/38517131
score: 0

http://stackoverflow.com/a/24750928
upvote count: 2
has body: If You are displaying message on jsp page the you can use JSTL tags fo checking the size of list, for example <c:if test="${fn:length(issuedItemList) eq 0}"> No data found </c:if> I think this is what you are looking for...
type: Answer
answers question: http://stackoverflow.com/q/24750703
score: 2
downvote count: 0

http://stackoverflow.com/q/24769746
accepted answer: http://stackoverflow.com/a/24774050
type: AnsweredQuestion
tagged with: libgdx
score: 1
tagged with: java
tagged with: box2d
type: Question
has comment: http://stackoverflow.com/comment/38436038
upvote count: 2
answer count: 1
has body: I want to create game like a flappy bird. I want player to jump continuously on the screen. I created this code, and it's not like a flappy bird jumping Code: float jump = 100; // Just example if(Gdx.input.justTouched()) body.applyForceToCenter(0, jump * delta, true); The problem is when user fast tap on screen, the player is shot like a rocket. Also when player falling the jump is lower. How can I fix this, and get always the same jump strength? My solution: jumpTimer += delta; if(Gdx.input.justTouched()) { if (jumpTimer &gt; jumpTime) { body.setLinearVelocity(body.getLinearVelocity().x, 0); body.applyForceToCenter(0, jump * delta, true); } jumpTimer = 0; }
has title: LibGdx - Box2d - Jumping
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/24774050
favorite count: 0

http://stackoverflow.com/a/24884797
type: Answer
has comment: http://stackoverflow.com/comment/38656140
answers question: http://stackoverflow.com/q/24884315
score: 1
upvote count: 1
downvote count: 0
has body: The entire point of GridLayout is to make things equal sizes. It sounds like you want to be using another layout manager such as GridBagLayout or MigLayout (not built into Java, see http://www.miglayout.com) instead.
has comment: http://stackoverflow.com/comment/38680555

timer
tags question: http://stackoverflow.com/q/24863698
tag name: timer
tags question: http://stackoverflow.com/q/24782699
tags question: http://stackoverflow.com/q/24850688
tags question: http://stackoverflow.com/q/24877069
tags question: http://stackoverflow.com/q/24890098
tags question: http://stackoverflow.com/q/24781716
type: Tag
tags question: http://stackoverflow.com/q/24892623
tags question: http://stackoverflow.com/q/24813255
tags question: http://stackoverflow.com/q/24894501
tags question: http://stackoverflow.com/q/24816652
tags question: http://stackoverflow.com/q/24799644

http://stackoverflow.com/a/24841847
answers question: http://stackoverflow.com/q/24841801
has comment: http://stackoverflow.com/comment/38571495
has body: I don't see where you are creating an instance of DummyDB class, but if you create such an instance in your jsp code, you can pass the data String to it in the constructor, or add a setData method that would accept that String. For example : &lt;% HttpSession Session = request.getSession(true); String data = Session.getAttribute("data").toString(); DummyDB db = new DummyDB (data); %&gt; &lt;%! public class DummyDB { ... public DummyDB(String data) { countries = new ArrayList&lt;String&gt;(); StringTokenizer st = new StringTokenizer(data, ","); ...
score: 0
has comment: http://stackoverflow.com/comment/38577643
type: Answer

http://stackoverflow.com/comment/38665343
has text: if doing correctly then when opening mydomain.com/images/uploaded/pic1.png will show an image
comment on: http://stackoverflow.com/a/24891059
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38437588
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24753150
type: Comment
has text: My results: OS X 10.7, Java 8u5, no difference with or without the println. Note, I'm running this in a terminal window, not an IDE.

http://stackoverflow.com/comment/38685643
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24901771
has text: Only if it's in response to a mobile device request. As in the client says I want to "pull" data. It could also be used with push notification.
type: Comment

http://stackoverflow.com/q/24908711
tagged with: ant
tagged with: java
tagged with: ivy
type: Question
score: 0
has body: I have some problems understanding how the publication works. I have to publish a jar file to my web repository, but I have found some probably maybe by the fact that I missing something about the artifact and the publication. These are my three files for the publication: Build.xml inizio pubblicare un artifact"> <ivy:settings file="archivaIvySetting.xml" /> <ivy:publish resolver="publish-artifact" conf="publicConf" organisation="bbi" module="resutil" revision="1.0"> <artifacts pattern="./[artifact]-[revision].[type]"/> </ivy:publish> Ivy.xml <info organisation="org.apache" module="central"/> <conf name="publicConf" visibility="public" /> <artifact name="[organisation]-resutil" ext="jar" conf="publicConf"/> archivaIvySetting.xml <?xml version="1.0" encoding="UTF-8"?> <property name="archiva-internal" value="http://host.com:8080/repository /internal/"/> <credentials host="host.com" realm="Repository Archiva Managed internal Repository" username="username" passwd="passwd" /> <ibiblio name="central" m2compatible="true" usepoms="true" root="${archiva- internal}" /> My problem is that when I do the build that ant says there is no module with that name in the cache. Now the question: 1) In the pattern do I set the jar that I want to publish? 2) If not how do I must to do practically that: take the jar give it the info params and publish it in the repo? I repeat the file already exist, and this is a test file.
linked to: http://stackoverflow.com/q/1200762
linked to: http://stackoverflow.com/q/8304562
answer count: 1
linked to: http://stackoverflow.com/q/9426011
has title: Publishing a jar file that already exists
linked to: http://stackoverflow.com/q/5111831
accepted answer: http://stackoverflow.com/a/24920540
linked to: http://stackoverflow.com/q/24957374
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24920540
type: AnsweredQuestion

http://stackoverflow.com/q/24888559
type: Question
upvote count: 0
has body: I'm writing an android code... I have made a menu item ("+") on the top right. I have defined the OnClick for this item as you see in my code but MyApp does not run and says unfortunately stopped. Before that I used public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.add: // Toast.makeText(this, "Adding button selected", Toast.LENGTH_SHORT).show(); return true; default: return true; } } for when the user clicks on that item and it worked. But I need to know what should I do in this way?! Because after that I want to make layout (Dialog) so that when I push that item that dialog shows and I think I should use this method to do that myActivity: package com.example.myapp; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.*; import android.widget.TextView; import android.widget.Toast; public class MyActivity extends Activity { /** * Called when the activity is first created. */ //@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public boolean onCreateMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); return true; } public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; } public void AddOnClick (View view) { Toast.makeText(this, "Button 1 pressed", Toast.LENGTH_LONG).show(); } } menu.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/add" android:icon="@drawable/plus" android:title="Adding" android:orderInCategory="50" android:showAsAction="always" android:onClick="AddOnClick" /&gt; &lt;/menu&gt; Where I am wrong?! Is my way for showing dialog right or I should do something else?! Tnx in advance
score: -1
has answer: http://stackoverflow.com/a/24888620
answer count: 3
has answer: http://stackoverflow.com/a/24888606
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: OnClick in android does not work
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38660291
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/24888613
tagged with: java
has comment: http://stackoverflow.com/comment/38660217

http://stackoverflow.com/q/24856967
tagged with: wolframalpha
tagged with: android-asynctask
type: UnansweredQuestion
has title: android wolfram alpha Exception downloading URL
tagged with: android
has answer: http://stackoverflow.com/a/24857123
has body: I am trying to use walfram alpha in my app I already got my code working in a java project but when I'm trying to use it in android I'm getting "Exception downloading URL" Here is my code public class AlphaAPISample extends Activity{ // PUT YOUR APPID HERE: private static String appid = MYAPPID; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String input = "who is the president"; WAEngine engine = new WAEngine(); engine.setAppID(appid); engine.addFormat("plaintext"); WAQuery query = engine.createQuery(); query.setInput(input); try { System.out.println("Query URL:"); System.out.println(engine.toURL(query)); WAQueryResult queryResult = engine.performQuery(query); if (queryResult.isError()) { System.out.println("Query error"); System.out.println(" error code: " + queryResult.getErrorCode()); System.out.println(" error message: " + queryResult.getErrorMessage()); } else if (!queryResult.isSuccess()) { System.out.println("Query was not understood; no results available."); } else { // Got a result. System.out.println("Successful query. Pods follow:\n"); for (WAPod pod : queryResult.getPods()) { if (!pod.isError()) { if(pod.getTitle().equals("Result")) { System.out.println(pod.getTitle()); for (WASubpod subpod : pod.getSubpods()) { for (Object element : subpod.getContents()) { if (element instanceof WAPlainText) { System.out.println(((WAPlainText) element).getText()); } } } } } } // We ignored many other types of Wolfram|Alpha output, such as warnings, assumptions, etc. // These can be obtained by methods of WAQueryResult or objects deeper in the hierarchy. } } catch (WAException e) { e.printStackTrace(); } } } Here is my log cat 07-21 05:13:23.276 30688-30688/com.assist.me I/System.out﹕ Query URL: 07-21 05:13:23.276 30688-30688/com.assist.me I/System.out﹕ http://api.wolframalpha.com/v2/query?appid=MYAPPID&amp;input=who+is+the+president&amp;format=plaintext&amp;async=false&amp;reinterpret=true 07-21 05:13:23.276 30688-306…
tagged with: android-studio
tagged with: java
type: Question
score: 0
answer count: 1

http://stackoverflow.com/a/24891517
score: 1
has body: TL;DR: Generally the answer is no. But there are some system-specific ways to handle such exceptional situations. Let me first explain the "no" part. C++ does not throw exceptions in case of dereferencing null pointer, or other segmentation fault errors. Those errors are treated in the same way as e.g. out-of-bounds array access - nothing is checked and the code is just executed. The programmer is responsible for ensuring that such errors are not encountered - e.g. the pointer can be explicitly checked if it is null before using. In most of the systems the underlying hardware and OS mechanism disallows access and e.g. stops the program with segmentation fault error when null pointer is dereferenced. But there are systems where dereferencing null pointer will not cause segmentation fault. No matter how such cases are handled, C++ does not (and most probably never will) contain mechanisms to check for them and throw exceptions. Still there are system-dependent ways of handling such situations such as signals in *nix systems, SEH in Windows.
upvote count: 1
answers question: http://stackoverflow.com/q/24890963
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38459664
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24782500
type: QuestionComment
has text: Why does it surprise you that there is a particular seed that would generate this exact sequence of random integers?

http://stackoverflow.com/q/24904265
downvote count: 0
score: 1
has body: I'm having some problems with my async task and ViewHolder... Before even using ViewHolder everything worked nice but I wanted to optimize and reuse childViews for better performance. However, since I added ViewHolder the images start to loop through until it imageload is done and then it shows correct image. My problem is I don't want this random loop until load, why is it happening? I've been trying to set visibity to GONE before it go into async task and even set the ImageView.setBitmap to null...still it does this loop of images until loading the correct one.. It looks like a cool feature but I dont want it right now :) My code looks like this: Adapter public class ContactAdapter extends ArrayAdapter&lt;Contacts&gt; { private final Context _context; private final ArrayList&lt;Contact&gt; _contactList; ViewHolder holder; ImageHelper task; public ContactAdapter(Context context, ArrayList contactList) { super(context, R.layout.row_contact_list, contactList); this._context = context; this._contactList = contactList; } @Override public View getView(int position, View convertView, ViewGroup parent) { // Create inflater LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if(convertView == null) { // Get rowView from inflater convertView = inflater.inflate(R.layout.row_contact_list, parent, false); this.holder = new ViewHolder(); // Get childViews within rowView holder.urlView = (ImageView) convertView.findViewById(R.id.contact_url); holder.contactLoading = (ProgressBar) convertView.findViewById(R.id.contact_loading); holder.nameView = (TextView) convertView.findViewById(R.id.contact_name); convertView.setTag(holder); } else{ holder = (ViewHolder) convertView.getTag(); holder.urlView.setImageBitmap(null); } // Assign the values to the childViews // Either using library Picasso or own AsyncTask, in this case named ImageHelper //Picasso.with(this._context).load(_contactList.get(position).getUrl()).into(urlView); task = ne…
favorite count: 0
type: Question
tagged with: android
has title: Images loop until async succeeds after adding ViewHolder
upvote count: 1
tagged with: performance
tagged with: java
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/a/24844413
downvote count: 0
score: 1
has body: Ok. Let's try. try { Scanner input = new Scanner (file); // input.hasNextLine() checks if there are more lines that can be read from // the file. If there is a line, hasNextLine() will return true, and the code // inside the while block will be executed. // Then execution will come back here to perform the check again. This // goes on until there are no more lines to consume. while (input.hasNextLine()) { // We are going to read two numbers from file. // Ideally, we should check if there a line available before reading // each of these lines. But since you confirm that the file will // always have multiple number of triplets containing two lines // with numbers, followed by a blank line, we are not going to // call input.hasNextLine() here. String number1 = input.nextLine(); String number2 = input.nextLine(); // Now, two numbers are read, read the next (empty) line to a variable // but we will not use it anywhere. String emptyLine = input.nextLine(); // ...or we could read it, but just discard it without assigning it to a variable // input.nextLine(); // Print what we read to the output, like a boss. System.out.println("String: " + number1); System.out.println("String: " + number2); System.out.println(number1 + " " + number2); // This is not needed here (see below to understand why): //number1= input.nextLine(); //number2= input.nextLine(); // after the following brace (}), execution will go back to the start // of the while loop. and if there are more lines to be read, code // inside while loop will be executed again. } } Hope this clears it up. Warning: For this code to work without an error, your input file must contain an empty line after the very last number pair in it. Otherwise it will throw a NoSuchElementException.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24844298
type: Answer
answers question: http://stackoverflow.com/q/24844298

http://stackoverflow.com/comment/38549929
comment on: http://stackoverflow.com/a/24824078
has text: the dataTable is vanishing FTER I WRITE YOUR CODE
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24762962
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24762662
has body: Your error line tells you clearly what and where the error is: Exception in thread "main" java.util.InputMismatchException Something in your catch clause for your second and third example is giving you error, but not the first one. Do you see why? Upon simple inspection, for your second and third try and catch, after an exception has occured due to invalid input, your are still attempting to process input using userInput.nextInt() and userInput.nextDouble(). The exception this causes will not be caught and is therefore causing problems. You need to do userInput.next() in your catch in order to move to the next input
has comment: http://stackoverflow.com/comment/38422890
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38442243
type: AnswerComment
has text: yes Stuart is correct, but by putting objects in static collection there will always a strong reference pointing it.
type: Comment
comment on: http://stackoverflow.com/a/24773218
score: 0

http://stackoverflow.com/a/24861494
has body: you can simply use this Intent intent = getIntent(); finish(); startActivity(intent); I hope thats work
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24861126
upvote count: 1
score: 0

http://stackoverflow.com/q/24821287
downvote count: 0
favorite count: 0
type: Question
tagged with: selecteditem
has answer: http://stackoverflow.com/a/24822193
has title: Is there a way to select a text field in code without clicking on it (javafx)?
has body: I am not sure how to or even if it is possible to select text fields in code. I could not find anything on the subject. If the is indeed a way to do so i have a template that could be modified to demonstrate how this could be done. Here is the template/sample code: Main class: package application; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { public void start(Stage primaryStage) { try { Parent root = FXMLLoader.load(getClass().getResource("/fxml/Main.fxml")); Scene scene = new Scene(root,600,400); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.setTitle("Test"); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) { launch(args); } } MainControl class: package application; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.TextField; public class MainControl implements Initializable { @FXML Button button; @FXML TextField field1; @FXML TextField field2; boolean field1selected=true; public void initialize(URL arg0, ResourceBundle arg1) { } public void switchTextFeild(ActionEvent event){ /* The code for switch on witch TextField is selected would go here */ } } Main.fxml: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.text.*?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <TextField fx:id="field1" layoutX="6.0" layoutY="2.0" prefHeight="394.0" prefWidth="149.0" /> <TextField fx:id="field2" layoutX="445.0" layoutY="2.0" prefHeight="394.0" prefWidth="149.0" />
tagged with: javafx-2
accepted answer: http://stackoverflow.com/a/24822193
tagged with: textfield
upvote count: 2
tagged with: javafx
answer count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/46159202
has answer: http://stackoverflow.com/a/29916306
has answer: http://stackoverflow.com/a/46159202
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/24749550
has answer: http://stackoverflow.com/a/24760586
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38416720
has body: This single threaded echo server works fine. public class Server { public static void main(String[] args) throws IOException { try (ServerSocket sc = new ServerSocket(1111)) { while (true) { try (Socket dataSocket = sc.accept(); BufferedReader is = new BufferedReader( new InputStreamReader( dataSocket.getInputStream())); PrintWriter out = new PrintWriter( dataSocket.getOutputStream());) { String line; while ((line = is.readLine()) != null) { System.out.println(line); out.println(line); out.flush(); if (line.equals("Bye.")) break; } } } } } } But why does this multi-threaded version not work? It simply passes input and output streams to construct a TestServer1 thread and start it. Nothing special. But somehow when a client connects to this server, A "Stream close" exception is thrown in run() and "error in run" is printed. public class TestServer1 extends Thread{ BufferedReader in; PrintWriter out; public TestServer1(BufferedReader in, PrintWriter out){ this.in=in; this.out=out; } @Override public void run(){ String line; try{ while ((line = in.readLine()) != null) { System.out.println(line); out.println(line); out.flush(); if (line.equals("Bye.")) break; } } catch (IOException e){ System.out.println("error in run"); e.printStackTrace(); } } public static void main(String[] args) throws IOException { try (ServerSocket sc = new ServerSocket(1111)) { while (true) { try (Socket dataSocket = sc.accept(); BufferedReader in = new BufferedReader( new InputStreamReader( dataSocket.getInputStream())); PrintWriter out = new PrintWriter( dataSocket.getOutputStream());) { TestServer1 ts1=new TestServer1(in, out); ts1.start(); } } } } } Here is the stacktrace error in run java.io.IOException: Stream closed at java.io.BufferedReader.ensureOpen(BufferedReader.java:115) at java.io.BufferedReader.readLine(BufferedReader.java:310) at java.io.BufferedReader.readLine(BufferedReader.java:382) at server.TestServer1.run(TestServer1.java:22)
downvote count: 0
has answer: http://stackoverflow.com/a/24749718
has comment: http://stackoverflow.com/comment/38397906
favorite count: 0
has answer: http://stackoverflow.com/a/24749758
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/24749731
has comment: http://stackoverflow.com/comment/38398004
answer count: 4
has title: Why does multithreading my single-threaded simple echo server cause it to stop working?

http://stackoverflow.com/comment/38416056
has text: Because it's interpreted from left to right. `[` opens a character class. And it's not closed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24759421
score: 0

http://stackoverflow.com/comment/38644934
type: QuestionComment
comment on: http://stackoverflow.com/q/24879949
has text: `pie` and `ass` are not good names for variables. Consider changing them to `score` and `name` so the names are actually meaningful.
score: 0
type: Comment

http://stackoverflow.com/comment/38684904
type: Comment
has text: In the original post, note the line `array.add(jsonArray.getJSONObject(i));` This is necessary for sorting. In your code, this line is missing.
comment on: http://stackoverflow.com/a/24901450
type: AnswerComment
score: 0

http://stackoverflow.com/q/24876660
has comment: http://stackoverflow.com/comment/38638280
has comment: http://stackoverflow.com/comment/38638268
has title: Java: should I use "this" keyword or "m_" prefix?
has comment: http://stackoverflow.com/comment/38638976
has comment: http://stackoverflow.com/comment/38638540
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38638186
downvote count: 0
has comment: http://stackoverflow.com/comment/38638367
has comment: http://stackoverflow.com/comment/38830944
tagged with: instance-variables
favorite count: 0
type: Question
answer count: 2
score: 5
possible better answer: http://stackoverflow.com/a/24876766
has answer: http://stackoverflow.com/a/24876766
has answer: http://stackoverflow.com/a/24876666
accepted answer: http://stackoverflow.com/a/24876666
has comment: http://stackoverflow.com/comment/38638505
has comment: http://stackoverflow.com/comment/38638249
has body: To refer to instance variables, should I use the "this" keyword... class Foo { private int bar; public Foo(int bar) { this.bar = bar; } } OR the "m_" prefix (Hungarian naming convention where m means "member variable")... class Foo { private int m_bar; public Foo(int bar) { m_bar = bar; } } Are there any situations where one provides an advantage over the other?
tagged with: java
has comment: http://stackoverflow.com/comment/38638452
has comment: http://stackoverflow.com/comment/38830989
upvote count: 5

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/24768908
tags question: http://stackoverflow.com/q/24822000
tags question: http://stackoverflow.com/q/24795368
type: Tag
tags question: http://stackoverflow.com/q/24858978
tags question: http://stackoverflow.com/q/24750694
tags question: http://stackoverflow.com/q/24759926
tags question: http://stackoverflow.com/q/24792667
tags question: http://stackoverflow.com/q/24858259
tags question: http://stackoverflow.com/q/24816624
tags question: http://stackoverflow.com/q/24804172
tags question: http://stackoverflow.com/q/24787091
tags question: http://stackoverflow.com/q/24899178
tags question: http://stackoverflow.com/q/24772268

http://stackoverflow.com/q/24802704
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24804477
has comment: http://stackoverflow.com/comment/38540500
has comment: http://stackoverflow.com/comment/38539146
upvote count: 4
has body: I have a performance problem with String Handling. I have a log file (simple text file) that I have to manipulate and performa several changes in text. So the program adds line by line in one huge String. Basically it do. while (not_finished) { // create new stringAdd; stringResult=stringResult + stringAdd + "\n"; } // output to a textArea in window textArea.setText(stringResult); Now the performances for this is horrible, so I upgraded to StringBuilder StringBuilder result= new StringBuilder(); while (not_finished) { // create new stringAdd; result.append( stringAdd +"\n"); } // output to a textArea in window textArea.setText(result.toString()); This is much faster. String once added to result will not be changed. The problem is not with the performances when there are more than 400,000 lines (one line has from 1 to 70 characters). How to increase performances of building String? Do you have any idea?
answer count: 2
has title: String building performance in Java
possible better answer: http://stackoverflow.com/a/24804477
has answer: http://stackoverflow.com/a/24802827
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38497775
has comment: http://stackoverflow.com/comment/38497624
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38502502
tagged with: java
accepted answer: http://stackoverflow.com/a/24802827
has comment: http://stackoverflow.com/comment/38497733

http://stackoverflow.com/comment/38681902
type: Comment
has text: Is the format always going to be <number><operator><number>etc...?
comment on: http://stackoverflow.com/q/24899825
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38560138
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24835682
score: 0
has text: I have change image file's path to whole path as below, this.setLayout( new BorderLayout( ) ); URL url = getClass().getResource("C:\\Documents and Settings\\evergreen\\workspace\\login\\src\\login\\logo"); ImageIcon imageicon = new ImageIcon( url ); JLabel label = new JLabel( imageicon ); this.add( label, BorderLayout.NORTH );

http://stackoverflow.com/a/24847464
has comment: http://stackoverflow.com/comment/38582146
has comment: http://stackoverflow.com/comment/38582217
has comment: http://stackoverflow.com/comment/38582313
has comment: http://stackoverflow.com/comment/38582161
has comment: http://stackoverflow.com/comment/127384783
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38582154
has comment: http://stackoverflow.com/comment/38582159
accepted answer of: http://stackoverflow.com/q/24847436
type: Answer
has comment: http://stackoverflow.com/comment/38582094
answers question: http://stackoverflow.com/q/24847436
has comment: http://stackoverflow.com/comment/38582265
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38582213
has comment: http://stackoverflow.com/comment/38582205
has comment: http://stackoverflow.com/comment/38582251
has body: It won't compile in one go.Actually,your src directory doesn't contain any .java file,SO it won't be done in that way! I am afraid that you'll have to do it by changing your path under src folder to do the same. You'll have to perform for each chess,color,game,etc. directories to achieve the same. So,change path at each run or go as advised in the comments to achieve compilation of all the java files. OR As proposed by David Ehrmann in your comment,you can do it by compiling in one go using javac $(find . -name '*.java'). It will compile all .java files under your present directory(src(.)).
has comment: http://stackoverflow.com/comment/38582360

http://stackoverflow.com/a/24807737
has comment: http://stackoverflow.com/comment/38511790
has comment: http://stackoverflow.com/comment/38533296
type: Answer
answers question: http://stackoverflow.com/q/24803315
has comment: http://stackoverflow.com/comment/38524479
score: 3
accepted answer of: http://stackoverflow.com/q/24803315
upvote count: 3
has body: You need to check for both Null and Blank cells. Null cells are ones that have never been used, Blank ones are ones that have been used or styled in some way that Excel has decided to keep them around in the file The easiest way to control this fetching is with a MissingCellPolicy. Your code can then be something like: Row r = getRow(); // Logic here to get the row of interest // Iterate over all cells in the row, up to at least the 10th column int lastColumn = Math.max(r.getLastCellNum(), 10); for (int cn = 0; cn &lt; lastColumn; cn++) { Cell c = r.getCell(cn, Row.RETURN_BLANK_AS_NULL); if (c == null) { // The spreadsheet is empty in this cell } else { // Do something useful with the cell's contents // eg... System.out.println("There is data in cell " + (new CellReference(c)).formatAsString()); } } You can find more on this in the POI docs on iterating over rows and cells
has comment: http://stackoverflow.com/comment/38512245
has comment: http://stackoverflow.com/comment/38538477
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24918874
score: 0
accepted answer of: http://stackoverflow.com/q/24850489
type: Answer
answers question: http://stackoverflow.com/q/24850489
type: AcceptedAnswer
has body: As indicated in one of the previous comments, a working solution was found by moving the session beans to the web archive as well. Thus the separation between the ejb .jar file and the disclosing web service containing project is gone, however it seems rational to have the services in the artifact that is also supposed to provide the web services. Thanks for the hints, however it is still not clear to me (according to the specification) why the initially described approach should not be feasible (but i realized it isn't...).

http://stackoverflow.com/comment/38601716
has text: Swing GUIs might have to work on different platforms, using different PLAFs, on different screen sizes and resolutions with different default settings for font size. As such, they are not conducive to exact placement of components. Instead use layout managers, or [combinations of layout managers](http://stackoverflow.com/a/5630271/418556) as well as [layout padding and borders](http://stackoverflow.com/q/17874717/418556) for white space.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24853845

http://stackoverflow.com/a/24831290
upvote count: 0
has comment: http://stackoverflow.com/comment/38552238
has comment: http://stackoverflow.com/comment/38551815
has body: Well your organization of your code needs a little bit of work. First I would take this whole block of code outside file read in while loop. for (int i=0; i &lt; wordsInLine.length(); i++) { char c = word.charAt(i); int j = (int) c; total += c; } Why? Lets split what you are doing into two steps. Read in all the words into the word list. After doing this you will find where your core root of the problem is. You aren't reading the words from your word list at all. Further code cleanup for(int i=0, isize = wordsInLine.length; i &lt; isize; i++){ This line is a little bit bloated. You don't need isize at all you are essentially doing denoting it for no reason. (Well actually caching the length does improve efficiency, another talk for another day). Cleaning up. for(int i=0, ; i &lt; wordsInLine.length; i++){ Then fixing the entire project //import list of words BufferedReader File = new BufferedReader(new FileReader(LOC)); //Create a temporary ArrayList to store data ArrayList&lt;String&gt; words = new ArrayList&lt;String&gt;(); //Find number of lines in txt file String line; String delimiter = "\t"; // adds all the words into the list. while ((line = File.readLine()) != null) { String[] wordsInLine = line.split(delimiter); for(int i=0, ; i &lt; wordsInLine.length; i++){ // compute alg and store the value some how to the word. words.add(wordsInLine[i]) } } // notice outside the while loop. // .size() is used for lists and .length is used for arrays. for(int i = 0; i &lt; words.size(); i++){ // compare }
answers question: http://stackoverflow.com/q/24830945
type: Answer
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/38552090

http://stackoverflow.com/comment/38855821
score: 0
type: Comment
has text: Thank you! It is much more clear than it is in JPA Documentation.
comment on: http://stackoverflow.com/a/24878652
type: AnswerComment

http://stackoverflow.com/comment/38501425
type: Comment
comment on: http://stackoverflow.com/a/24759816
has text: Not in detail, but if the current zoom and scale of your map matters, you need to look at methods like `mapView.getScreenRect()`, `mapView.getBoundingBox()`, `mapView.getLatitudeSpan()` etc. and make calculations with your points or locations. (Why delete accepted answer though, this still answers you question.. consider opening a new one for how to do calculations like that if you run into problems).
score: 0
type: AnswerComment

http://stackoverflow.com/q/24763580
favorite count: 0
has answer: http://stackoverflow.com/a/24842767
has comment: http://stackoverflow.com/comment/38545281
has comment: http://stackoverflow.com/comment/38546640
has comment: http://stackoverflow.com/comment/38548496
has comment: http://stackoverflow.com/comment/38424055
has comment: http://stackoverflow.com/comment/38546164
has comment: http://stackoverflow.com/comment/38463651
has comment: http://stackoverflow.com/comment/38546393
has comment: http://stackoverflow.com/comment/38546357
has comment: http://stackoverflow.com/comment/38555757
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38424683
has comment: http://stackoverflow.com/comment/38550855
downvote count: 0
has comment: http://stackoverflow.com/comment/38546779
tagged with: spring
tagged with: autowired
has comment: http://stackoverflow.com/comment/38544958
type: Question
tagged with: spring-boot
tagged with: stomp
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24842767
has comment: http://stackoverflow.com/comment/38546274
has comment: http://stackoverflow.com/comment/38550396
has body: I am attempting to use a @Service class in my messaging application, however the class is not instantiated via @Autowire when I try from a generic class. It is only instantiated when I use the Controller. Here is my controller: package hello; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.messaging.simp.SimpMessageSendingOperations; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import hello.Application; @Controller public class HelloController { @Autowired private MessageSender sender; @RequestMapping(value="/", method=RequestMethod.GET) public String index() { return "index"; } @MessageMapping("/hello") @SendTo("/topic/greetings") public Greeting greeting(HelloMessage message) throws Exception { System.out.println("Sending message..."); beginRoute(message.getName()); sender.greet("thunder"); return new Greeting("Hello, " + message.getName() + "!"); } public void beginRoute(String message) { Application.startBody(message); } } The above call to sender.greet is successful. Here is the other class I attempt to use the service in: package com.routing.integration; import hello.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.simp.SimpMessageSendingOperations; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Component; @Component public class modifier { @Autowired private MessageSender sender; public boolean adder(String words) throws Exception { sender.greet(words); } } When I attempt to call sender.greet as above, I get a NullPointerException and when debugging, I find that sender is null at the t…
has comment: http://stackoverflow.com/comment/38546482
has comment: http://stackoverflow.com/comment/38546115
upvote count: 1
has title: Service Class not being instantiated during @Autowire call
answer count: 1
has comment: http://stackoverflow.com/comment/38545597

http://stackoverflow.com/q/24846983
has comment: http://stackoverflow.com/comment/38591671
has comment: http://stackoverflow.com/comment/38581075
tagged with: java
has comment: http://stackoverflow.com/comment/38589157
has body: I want to do the same as in the answers to this question: Check if table exists but I want to check if any table exist, not just a particular table and not iterating through table names, I mean if there's any table at all in the database. According to the API, the third argument of getTables(), tableNamePattern - a table name pattern; must match the table name as it is stored in the database So it seems the tableName should match exactly in the database. Is there a better way to find if any table exist in the database? Or I really have to loop through an array of table names and call: getConnection().getMetaData().getTables(null, null, "table", null).next(); each iteration?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38589192
tagged with: database
tagged with: sql-server
has answer: http://stackoverflow.com/a/24846994
score: 0
accepted answer: http://stackoverflow.com/a/24846994
duplicate of: http://stackoverflow.com/q/2942788
tagged with: sql
has answer: http://stackoverflow.com/a/24847409
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/24847409
linked to: http://stackoverflow.com/q/2942788
type: AnsweredQuestion
has title: Check if there are any table in database

http://stackoverflow.com/a/35703058
has body: Answer from @eric-peladan didn't work out of the box, but was pretty close, maybe that worked for previous versions of Spring Boot. Now this is how it is supposed to be configured instead, correct me if I'm wrong: import org.springframework.context.annotation.Configuration; import org.springframework.data.rest.core.config.RepositoryRestConfiguration; import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter; @Configuration public class RepositoryConfiguration extends RepositoryRestConfigurerAdapter { @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { config.exposeIdsFor(User.class); config.exposeIdsFor(Comment.class); } }
downvote count: 0
score: 24
has comment: http://stackoverflow.com/comment/61540200
upvote count: 24
answers question: http://stackoverflow.com/q/24839760
type: Answer

http://stackoverflow.com/comment/38637419
type: Comment
comment on: http://stackoverflow.com/a/24868538
type: AnswerComment
score: 0
has text: Thanks Gimby, I have tried to use @PostConstruct but nothing changes ?!! dose I have to implement local interface ?

http://stackoverflow.com/comment/38671699
has text: @dognose i know that but that is what OP asked for
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24894476

http://stackoverflow.com/q/24847143
has answer: http://stackoverflow.com/a/24847200
has comment: http://stackoverflow.com/comment/38581571
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24847447
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/24847176
has title: Can an 'if' statement have more than one resulting 'then'?
score: -1
has comment: http://stackoverflow.com/comment/38581436
type: Question
has comment: http://stackoverflow.com/comment/38581534
favorite count: 0
has answer: http://stackoverflow.com/a/24847155
accepted answer: http://stackoverflow.com/a/24847176
has comment: http://stackoverflow.com/comment/38581416
answer count: 5
has comment: http://stackoverflow.com/comment/38581356
has comment: http://stackoverflow.com/comment/38581403
has answer: http://stackoverflow.com/a/24847194
has comment: http://stackoverflow.com/comment/38581378
has body: I do apologize if this question is too simple but I have tried Google and I cannot find a concrete answer (mostly because I do not know how to word my question). I am just wondering if an if statement in Java can have more than one 'then' i.e. public class test { if (condition) { then...; then 2...?; } } For example, the first condition is true. The first then occurs, which say throws an exception. Could I add on another then after that which would also occur after the exception is thrown? Thanks for looking EDIT: I understand my question is a bit ambiguous. I guess what I'm trying to say is something like this: public class test { public String checkAnswer(String answer) throws Exception { if (!a == b) { throw new Exception; this.ans = this.ans + a; } else { return "You are wrong." } Is that second line (this.ans ...) allowed to be there? As in would both throw new Exception and that line both occur if the condition was not met?
has comment: http://stackoverflow.com/comment/38581387
downvote count: 2
possible better answer: http://stackoverflow.com/a/24847200
upvote count: 1

http://stackoverflow.com/q/24892524
tagged with: dynamic-programming
has answer: http://stackoverflow.com/a/24893197
accepted answer: http://stackoverflow.com/a/24893197
has comment: http://stackoverflow.com/comment/38669035
has comment: http://stackoverflow.com/comment/38668073
has comment: http://stackoverflow.com/comment/38669136
type: AnsweredQuestion
tagged with: dynamic
tagged with: java
tagged with: execution-time
has comment: http://stackoverflow.com/comment/38668981
has answer: http://stackoverflow.com/a/24893194
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/38668014
possible better answer: http://stackoverflow.com/a/24893194
score: 0
answer count: 2
has title: Improve Execution Time
has body: How can the following program execution time improved. I have used dynamic programming in both "recursive" as well as "prime" function. But not getting the efficient execution time. QUESTION:There is a wall of size 4xN in the victim's house where. The victim also has an infinite supply of bricks of size 4x1 and 1x4 in her house. In every configuration, the wall has to be completely covered using the bricks. Gale Bertram wants to know the total number of ways in which the bricks can be arranged on the wall so that a new configuration arises every time. Let the number of Configuration = M. So, he wants Patrick to calculate the number of prime numbers (say P) up to M (i.e. &lt;= M). You are required to help Patrick correctly solve the puzzle. Sample Input The first line of input will contain an integer T followed by T lines each containing an integer N. Sample Output Print exactly one line of output for each test case. The output should contain the number P. Constraints 1&lt;=T&lt;=20 1&lt;=N&lt;=40 import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class Solution{ public static int[] b = new int[217287]; public static void main(String[] args){ Scanner stdin = new Scanner(System.in); int t = stdin.nextInt(); int[] a = new int[41]; for(int j=0;j&lt;4;j++){ a[j] = 1; //till n&lt;=3, number of possiblities = 1. These will work as base cases. } a[4] = 2; for(int x=0;x&lt;t;x++){ int n = stdin.nextInt(); for(int i=5;i&lt;=n;i++){ a[i] = -1; //initialise all value in the array as -1. } if(n&lt;4) System.out.println("0"); // if n&lt;4, number of possibilities =1. So no prime number before that is 0. else{ //for n=4, possibilities = 2. This is a base case. int num1 = recursive(a,n); // storing number of possibilities in num1. int num2 = prime(num1); //calling to calculate number of prime numbers before or equal to num1. System.out.println(num2); } } } public static int recursive(int[] a, int n){ if(a[n]!=-1) // retrieving a[…

http://stackoverflow.com/comment/38659932
comment on: http://stackoverflow.com/q/24888353
score: 0
type: Comment
type: QuestionComment
has text: Ah, I understand. I just updated - thanks.

http://stackoverflow.com/a/24792897
score: 7
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24792877
has body: With this line if(truth = true) You are assigning true to truth with =, when you probably meant == to compare. It's already a boolean, so just have it as the condition. if (truth)
upvote count: 7

http://stackoverflow.com/comment/38461626
type: QuestionComment
type: Comment
has text: I fail to see an actual problem here, yet. Yes the objects are not cleaned up... so what? Apparently the garbage collector saw no need yet. Do you have an actual performance problem (such as a CPU spike when garbage collection DOES happen), out of memory issues, etc. ?
comment on: http://stackoverflow.com/q/24782627
score: 0

http://stackoverflow.com/q/24884315
has answer: http://stackoverflow.com/a/24884797
linked to: http://stackoverflow.com/q/21270656
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38652523
tagged with: calculator
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38652537
has title: Windows Calculator Buttons
has comment: http://stackoverflow.com/comment/38652598
tagged with: java
has body: I want to get long button like the '=' &amp; '0' buttons on the windows calculator: . Please any one help me. Also i need to modify this same code, is there way do that from GRIDLAYOUT? import java.awt.*; class Cal{ Cal(){ Frame f=new Frame(); f.setVisible(true); f.setSize(350,500); f.setTitle("Nano Cal"); Panel p1=new Panel(); p1.setBackground(Color.lightGray); Panel p2=new Panel(); p2.setBackground(Color.gray); BorderLayout br=new BorderLayout(); f.add(p1,br.NORTH); f.add(p2,br.CENTER); TextField t1=new TextField(57); p1.add(t1); Button b1=new Button("MC"); Button b2=new Button("MR"); Button b3=new Button("MS"); Button b4=new Button("M+"); Button b5=new Button("M-"); Button b6=new Button("&lt;-"); Button b7=new Button("CE"); Button b8=new Button("C"); Button b9=new Button("±"); Button b10=new Button("√"); etc. p2.add(b1); p2.add(b2); p2.add(b3); p2.add(b4); p2.add(b5); p2.add(b6); p2.add(b7); p2.add(b8); p2.add(b9); p2.add(b10); GridLayout gr=new GridLayout(6,5,5,5); p2.setLayout(gr); MenuBar mb=new MenuBar(); f.setMenuBar(mb); Menu m1=new Menu("View"); Menu m2=new Menu("Edit"); Menu m3=new Menu("Help"); mb.add(m1); mb.add(m2); mb.add(m3); MenuItem mview=new MenuItem("Copy"); MenuItem mview2=new MenuItem("Paste"); m1.add(mview); m1.add(mview2); } } class testCal{ public static void main(String sr[]){ Cal c = new Cal(); } }
type: Question

http://stackoverflow.com/comment/84162961
comment on: http://stackoverflow.com/a/24780184
type: AnswerComment
score: 0
type: Comment
has text: ...also your code after edit in worst case scenario is just equal to calling `new OnCreateListenerImpl.onObjCreate();` from second activity ... which makes passing interface via Intent usless.

http://stackoverflow.com/comment/38456588
score: 0
type: AnswerComment
has text: @TimB Yep, messed up there.
comment on: http://stackoverflow.com/a/24780806
type: Comment

http://stackoverflow.com/a/24862232
accepted answer of: http://stackoverflow.com/q/24858599
score: 8
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/24858599
has comment: http://stackoverflow.com/comment/56238007
downvote count: 0
has body: For Tomcat 7 use mvn tomcat7:run Ref: Maven Tomcat 7
type: AcceptedAnswer

http://stackoverflow.com/comment/38561980
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24836754
has text: Did you read your school book?
score: 0

http://stackoverflow.com/q/24902135
has answer: http://stackoverflow.com/a/24902345
tagged with: java
type: Question
score: 0
answer count: 1
has title: Android Service Client communication best appraoch
has body: I have a bound service which do some async tasks, once the task is finished the service calls the registered listener, I'm wondering if this is approach has any flaws or if there is better way to do it. SomeService Handler handler = new Handler(); public void doSomeTask(OnTasksFinishListener listener) { final OnTasksFinishListener _listener = listener; new Thread(){ @Override public void run() { // some extensive code handler.post(new Runnable(){ public void run() { _listener.onTaskFinish(); }; }); } }.start(); } Client mLocalService.doSomeTask(this); public void onTaskFinish(){ //something will happen in the UI. }
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/61696873
comment on: http://stackoverflow.com/a/24831550
type: AnswerComment
has text: double check that the id for the repository you configured your credentials for (in your settings.xml or POM) matches the repository you want to deploy to. Just stumbled over this.
type: Comment
score: 3

http://stackoverflow.com/comment/38566044
comment on: http://stackoverflow.com/a/24837204
type: Comment
has text: Looks like you are missing some dependencies in your classpath. Make sure you have all the required libraries.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24878216
has comment: http://stackoverflow.com/comment/38641281
score: 1
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38641157
type: Question
has answer: http://stackoverflow.com/a/24878384
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38641238
has answer: http://stackoverflow.com/a/24878628
favorite count: 0
linked to: http://stackoverflow.com/q/17622622
has comment: http://stackoverflow.com/comment/38641269
tagged with: android
has body: I am basically trying to create a dialogue box that takes user input text as a "Note" and it saves the note and shows the note the next time the dialogue box is opened, then the user can add on to the note or take away from the note and save it again. Thank you very much in advance. Here's what I have so far: AlertDialog.Builder alert = new AlertDialog.Builder(ViewTask.this); alert.setTitle("Task Note"); alert.setMessage("Please enter your note"); // Set an EditText view to get user input final EditText input = new EditText(ViewTask.this); alert.setView(input); alert.setPositiveButton("Save", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); //String usernote = value; } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.setCancelable(false); alert.show(); break;
has comment: http://stackoverflow.com/comment/38641227
has title: How to save user input in dialogue box?
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38567296
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24839641
has text: the resource i am trying to get is a picture in the "res" folder and it is called "sprite_sheet.png"

http://stackoverflow.com/a/24801560
answers question: http://stackoverflow.com/q/24801392
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38496573
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38496241
has body: As per my knowledge, JMX connections are RMI Connector objects and hence can be held in the client app. + use a heartbeat approach to reconnect. This way we can avoid overhead of re-establishing RMI connections which are not light weight. Refer: javax.management.remote.rmi.RMIConnector
accepted answer of: http://stackoverflow.com/q/24801392
type: AcceptedAnswer

http://stackoverflow.com/q/24877806
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38640422
tagged with: deserialization
has comment: http://stackoverflow.com/comment/38641067
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38640457
has title: Unable to Deserialize an Object from a Plugin
has comment: http://stackoverflow.com/comment/38640483
has body: My java application has a plugin architecture whereby its functionality can be extended by adding a jar file that implements its plugin interface. I have successfully used and deployed this architecture in the past. This time, however, I am trying to serialize/de-serialize plugin objects from the main application. Loading the plugin works just fine. The test application can even use it. Serializing the object works just fine too (at least, it appears to). An object is written to disk. When I attempt to de-serialize the object, ClassNotFound is thrown. Even when done in the same application as discovering the plugin and serializing the object (i.e. the class should already be by one of the class loaders). I wrote a single test application that loads the plugin (loads the jar file and all of the classes in it), creates an instance of the plugin object, serializes the plugin object, and then attempts to deserialize the object into a new object (where it fails). The failure occurs on the: Class.forName(...) call that is within readObject(). I have even implemented a custom ObjectInputStream that uses the same ClassLoader as the class that loads the plugin and this still doesn't work. Am I breaking some Java rule that I don't know about? Other than in-theory, is this even possible? Any other ideas?
answer count: 0
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/38640427

http://stackoverflow.com/q/24807472
tagged with: jakarta-mail
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/51000554
has answer: http://stackoverflow.com/a/51000554
has answer: http://stackoverflow.com/a/24807774
has title: Java Mail Issue with Session.getInstance
upvote count: 17
type: AnsweredQuestion
tagged with: java
tagged with: noclassdeffounderror
score: 17
accepted answer: http://stackoverflow.com/a/24807774
has body: I am receiving the following exception when trying to use java mail; java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger at javax.mail.Session.initLogger(Session.java:226) at javax.mail.Session.<init>(Session.java:210) at javax.mail.Session.getInstance(Session.java:247) at com.secondstory.mailsender.MailSender.createSmtpSession(MailSender.java:67) at com.secondstory.mailsender.MailSender.sendSimpleMessage(MailSender.java:38) at com.secondstory.mailsender.MailSender.generateLostPasswordEmail(MailSender.java:79) at com.secondstory.mailsender.MailSenderTest.shouldReturnTrueWithCredentialsSet(MailSenderTest.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.…
type: Question

http://stackoverflow.com/comment/38451948
has text: is an example function to generate a Date. For your case, to save Strings you use putString instead of putLong and you dont need to generate dates
comment on: http://stackoverflow.com/a/24778281
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38612628
type: Comment
comment on: http://stackoverflow.com/a/24862867
has text: I use toplink-essentials-agent.jar and toplink-essentials.jar. i have exactly the same .jars than the other workspace.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24876423
tagged with: command-line
possible better answer: http://stackoverflow.com/a/24876689
has answer: http://stackoverflow.com/a/24876689
tagged with: fileutils
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38637708
has comment: http://stackoverflow.com/comment/38638205
has comment: http://stackoverflow.com/comment/38638176
tagged with: java
has comment: http://stackoverflow.com/comment/38638159
type: Question
has answer: http://stackoverflow.com/a/24876752
answer count: 2
has body: I'm trying to run a Java program that calls on the C:\Users\Brandon\Downloads\commons-io-2.4 folder. It compiled fine with this code javac -cp "C:\Users\Brandon\Downloads\commons-io-2.4\*" Login.java but when I tried to run it with this code java -cp C:\Users\Brandon\Downloads\commons-io-2.4\* Login it gave me thiserror: Could not find or load main class Login.class How do I fix this? P.S. The program calls on the FileUtils.
score: 0
has title: Run A Java Program That Calls On An External Jar
tagged with: windows
has comment: http://stackoverflow.com/comment/38638131
has comment: http://stackoverflow.com/comment/38637965
accepted answer: http://stackoverflow.com/a/24876752
tagged with: command

http://stackoverflow.com/q/24898783
tagged with: java
type: UnansweredQuestion
tagged with: forms
has answer: http://stackoverflow.com/a/24910008
upvote count: 0
favorite count: 0
tagged with: ajax
type: Question
tagged with: wicket
score: -1
has title: Wicket - Ajax form submit from one list to another
has body: In wicket, how would I create the following behavior: have a ListMultipleChoice on the left that takes in data models from the server, a button in the middle that would take the selected components from that list and insert them into another list on the right using ajax.
downvote count: 1
answer count: 1

http://stackoverflow.com/comment/38441764
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24773043
type: AnswerComment
has text: r u sure this will give accurate result i don't think so because `(int) c` this will not typecast the char into int .

http://stackoverflow.com/comment/38488311
comment on: http://stackoverflow.com/q/24797085
type: Comment
type: QuestionComment
has text: -1 for ASAP/urgent...
score: 3

http://stackoverflow.com/q/24752040
tagged with: volatility
has comment: http://stackoverflow.com/comment/38402315
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24753043
linked to: http://stackoverflow.com/q/26551
type: Question
accepted answer: http://stackoverflow.com/a/24752281
has answer: http://stackoverflow.com/a/24752169
linked to: http://stackoverflow.com/q/24750149
possible better answer: http://stackoverflow.com/a/24752169
has body: I heard that java code cannot be to add into batch file in a comment on my previous question: But is there any alternatives to it? Is it possible to add java code into batch file? I tried the following in the batch file but it does not work: vol231.exe -f m.walkin(new File(d.detectDrive())) imageinfo > Volatility.txt This is cmdenv.bat that i created to run in command prompt from java: E: echo off cls ... //This part is a long part for reducing footprint whereby the command prompt is switched to Helix vol231.exe -f E:\KOHMOHOJOJO-PC-20140714-152414.raw imageinfo &gt; Volatility.txt vol231.exe -f E:\KOHMOHOJOJO-PC-20140714-152414.raw --profile=Win7SP0x86 pslist &gt;&gt; Volatility.txt pause exit This allows my volatility commands to run in a enclosed command prompt (Helix) which reduces footprint. However, the volatility commands are all hardcoded. The E:\KOHMOHOJOJO-PC-20140714-152414.raw and --profile=Win7SP0x86 varies. Is there any alternative to do it since batch file does allow java coding? I am new to java and batch file. Edit1: I tried changing the java_path but it still have errors. Edit2: I tried different paths like: C:\Program Files\Java\jdk1.8.0_05\bin and C:\Program Files\Java\jre8\bin I get Error: Could not find or load main class TestRun1. C:\Users\User\workspace\Volatility\bin and C:\Users\User\workspace\Volatility\src (this is the workspace where the class is saved) I get C:\Users\User\workspace\Volatility\(bin or src)\java is not recognised as an internal or external command, operable program or batch file. So I added java.exe into the file. And the error gets back to Error: Could not find or load main class TestRun1. This batch file doesn't seem to be able to read the java.. I tried adding a . in front of the TestRun1 but still it has the same error. I also found out that I have the environment variable under Control Panel\System and Security\System\Advance System Settings\Environment Variables (Path). I tried deleting C:\Program Files\Java\jdk1.8.…
tagged with: batch-file
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38403088
has title: alternatives to batch file since i am unable to include java code in it
favorite count: 0
tagged with: command-line
upvote count: 2
has answer: http://stackoverflow.com/a/24752281
downvote count: 2

http://stackoverflow.com/comment/38511356
type: Comment
score: 0
has text: Ok, the key point is you just want one single instance. And you don't like your code to be instantiated twice by mistake anywhere else in your project. So my suggestion is to make that class singleton. This link might help you. You may not happen to use DI for your project but it is good to implement something similar by your own (in terms of design perspective): http://blog.rocketscience.io/dependency-injection-with-cdi-in-java-se/
type: AnswerComment
comment on: http://stackoverflow.com/a/24809567

http://stackoverflow.com/comment/38416962
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24759860
has text: Looks like a design smell to me. What's your use case for such an equals method?
score: 0

http://stackoverflow.com/q/24852252
tagged with: jpa
has title: java.lang.ClassNotFoundException: javax.persistence.Persistence
tagged with: tomcat
has body: I have an application using JPA and i am trying to deploy it on a Tomcat 7. It seems that I didn't include all the libraries correctly since I get the stack error mentioned below. But when i run as a java application it compiles correctly. Basically, my servlet calls Persistence.createEntityManagerFactory(PERSISTENCE_UNIT) with the factory, it calls factory.createEntityManager() and with the entity manager, it will try to persist an object made with the parameters from Http request. The server is raising an exception of java.lang.ClassNotFoundException: javax.persistence. when I call the first method to get the factory from Persistence. Here is the stack: Stacktrace:] with root cause java.lang.ClassNotFoundException: javax.persistence.Persistence at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at dao.ImplementDao.<clinit>(ImplementDao.java:18) at controller.ListServlet.<init>(ListServlet.java:28) 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 java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:140) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) at org.apache.catalina.core.ApplicationDispatcher…
tagged with: eclipselink
score: 3
tagged with: hibernate-entitymanager
favorite count: 0
has comment: http://stackoverflow.com/comment/38592470
has comment: http://stackoverflow.com/comment/38591519
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38591396
has comment: http://stackoverflow.com/comment/38591655
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38594105
downvote count: 1
type: Question
upvote count: 4

http://stackoverflow.com/comment/38701574
score: 1
has text: Did you read the links in my post that you commented on to bring me here? To delete from the Content Provider, you need write access to it. You cannot acquire write access to that Provider in KitKat without being the default SMS app. Any app can still send SMS messages the old way, and the system will take care of those writes for you. But, to directly delete anything, your app _must be_ the default.
comment on: http://stackoverflow.com/q/24862166
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38407253
type: Comment
score: 0
has text: No, you don't. If it works, you have done something different.
type: AnswerComment
comment on: http://stackoverflow.com/a/24754487

http://stackoverflow.com/q/24856327
answer count: 1
has title: How to get RevoluteJoint to move to a certain angle
tagged with: algorithm
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/38611529
accepted answer: http://stackoverflow.com/a/24856559
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: physics
has answer: http://stackoverflow.com/a/24856559
upvote count: 1
tagged with: box2d
has body: I have a RevoluteJoint (the Box2D/AndEngine kind) That needs to be moved it a certain angle from time to time. The direction and speed it is moving at when it needs to move to said angle can be anything. The tricky part is to get it to slow down at the right moment, so that the joint does not overshoot the target and start oscillating around the target angle. The way i see it, the variables are: V - Angular velocity (in radians/sec) the joint is trying to achieve. Negative is going counter clockwise. W - Actual angular velocity. Negative if moving away from the target angle. D - Distance to go (in radians) until target angle is achieved Q - Motor torque L - Angular momentum Did i miss any? Any physics buffs or mechanical engineers who could tell me a formula that will allow me to adjust Q and V based on these variables, so that the joint will stop at the right place? PS: If V is set to 0, the joint will try to hold its position

http://stackoverflow.com/comment/38574305
score: 0
type: Comment
type: QuestionComment
has text: @BartKiers Sorry for the typo. Edited with correction.
comment on: http://stackoverflow.com/q/24843117

http://stackoverflow.com/a/24906521
answers question: http://stackoverflow.com/q/24906464
score: 0
has body: If you want to read a file line by line, is has nothing to do with XML. Simply use an BufferedReader as it provides an readLine method. With a simple counter you can check, how many lines you have already read and quit the loop after you hit the 800 mark.
type: Answer
has comment: http://stackoverflow.com/comment/38694271

http://stackoverflow.com/a/24841195
has body: out.print(" cancellare "); ================================================================================== instead of you should write like this out.print(" cancellare "); now to get id String str=request.getParameter("id");
has comment: http://stackoverflow.com/comment/38570753
score: 0
has comment: http://stackoverflow.com/comment/38602810
type: Answer
answers question: http://stackoverflow.com/q/24841094

json-rpc
tag name: json-rpc
tags question: http://stackoverflow.com/q/24830314
type: Tag

http://stackoverflow.com/a/24969695
has comment: http://stackoverflow.com/comment/38896137
has body: Spock is one of the most widely used frameworks in the Groovy and Java ecosystem that allows the creation of BDD tests in a very intuitive language and facilitates some common tasks such as mocking and extensibility. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers. To work with Spock you basically need to perform a set of steps, such as following a recipe, that will allow you to effectively implement both a unit test and a web integration. Your current error message reads: Create a sqlite database for Android FAILED Try these steps and see how it goes: Including to your code getWritableDatabase and getReadableDatabase should help: jokesHelper dbHelper = new jokesHelper(getBaseContext()); SQLiteDatabase db = dbHelper.getWritableDatabase(); Doing so, Android will be able manage and cache the connection. Yet if you got any error message from getBaseContext, try to uninstall the testing plugin and recreate the STS resources (.classpath &amp; .project) using integrate-with --eclipse, then it should work. If you are having any problem with getSpecificationContext, it means that some detail was left out and you need to double check your specifications. In case you are not using Eclipse, to create your Java Jar file with spock, you can interface it with Emacs through command-line Java development tools as usual, for instance Sun’s JDK or any other approach expected for Enterprise Development. To only run a SampleTest you must invoke the test task from the command-line with the Java system property: gradle -Dtest.single=Sample test Or alternatively gradle -Dtest.single=SoapTest clean test Also check what are the permissions on the directory in use. And in case you haven't done yet, remember to include dependencies: dependencies { classpath 'com.android.tools.build:gradle:0.8.+' classpath 'org.robospock:robospock…
type: Answer
downvote count: 1
upvote count: 17
answers question: http://stackoverflow.com/q/24901978
score: 16
has comment: http://stackoverflow.com/comment/38847722
has comment: http://stackoverflow.com/comment/38858070

http://stackoverflow.com/comment/38488553
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24797221
has text: minSdk is 14, that's not the problem
type: AnswerComment

http://stackoverflow.com/comment/38640103
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24875210
has text: @user3772253: It works for me. If you've changed your code and are getting errors, then show the code and the error as an edit to the end of your original question. Don't paraphrase and say that it's not working since we can't do much to help you with that.

http://stackoverflow.com/q/24763245
tagged with: operators
has comment: http://stackoverflow.com/comment/38423113
accepted answer: http://stackoverflow.com/a/24763332
has comment: http://stackoverflow.com/comment/38423386
has comment: http://stackoverflow.com/comment/38423766
has title: I'm confused about Logical Operators, can someone help me clear up my mess? Multiple arguments?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24763332
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/24763602
tagged with: logic
score: 0
answer count: 2
has body: this is my first post here, but I often use this site to help me with coding issues I run into. I'm an intermediate level Java programmer. I'm going to college next year and I'm considering a minor in Computer Science. I'm making a pretty basic mock-credit card validator that reads in a credit card, checks if it's valid, and then emails information to the user. This is not to be used for anything other than educational purposes. So I have a bit of code that checks multiple conditions for a credit card string that someone types in. For example, as you'll see, it checks the starting digit, the name of the card, and the number of digits. It checks the conditions, and if they are met the program continues, if not it gives an error and stops immediately. I'm like 99% sure that I'm entering my information in correctly, but it gives me the error no matter what and I'm at a loss here. Sorry if I typed so much, again I'm new here. So I'm asking for help on my logic here, thanks! if((cardType.equals("Visa") &amp;&amp; card.substring(0).equals("4")) &amp;&amp; (length == 13 || length == 16)){ System.out.println("Thank you, next step"); cardValid = true; } if((cardType.equals("Master Card")) &amp;&amp; (card.substring(0,1).equals("51") || card.substring(0,1).equals("52") || card.substring(0,1).equals("53") || card.substring(0,1).equals("54") || card.substring(0,1).equals("55")) &amp;&amp; (length == 16)){ System.out.println("Thank you, next step"); cardValid = true; } if((cardType.equals("American Express") &amp;&amp; card.substring(0,1).equals("37") &amp;&amp; length == 15)){ System.out.println("Thank you, next step"); cardValid = true; } if(cardValid != true){ System.out.println("ERROR"); System.exit(0); } }
has answer: http://stackoverflow.com/a/24763602

http://stackoverflow.com/q/24764314
has body: Mongodb java driver recently added (in version 2.12) the following methods to MongoClientOptions.Builder class: heartbeatConnectRetryFrequency(int heartbeatConnectRetryFrequency) heartbeatConnectTimeout(int heartbeatConnectTimeout) heartbeatFrequency(int heartbeatFrequency) heartbeatThreadCount(int heartbeatThreadCount) As per this bug, it looks like these methods expose properties using which the MongoDB Java driver will try to regenerate connection pool, in case the connections in the driver connection pool are dead due to network outage or mongodb-server restart. I have already read the concerned javadocs and searched on web, but could not find any detailed example or good article explaining how to use them. Does anyone here know how to use these properties?
type: Question
tagged with: mongodb
score: 5
has comment: http://stackoverflow.com/comment/38460611
has answer: http://stackoverflow.com/a/24864650
accepted answer: http://stackoverflow.com/a/24864650
tagged with: mongodb-java
answer count: 1
favorite count: 0
upvote count: 5
linked to: http://stackoverflow.com/q/23295333
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: How to use heartbeats?

http://stackoverflow.com/a/24815234
type: Answer
has body: Check your connection string in the configuration something like hibernate.connection.url = jdbc:postgresql://localhost/mydatabase You may be missing the schema name in the url(mydatabase).
score: 0
answers question: http://stackoverflow.com/q/24814415

annotations
tags question: http://stackoverflow.com/q/24765368
tags question: http://stackoverflow.com/q/24862058
tags question: http://stackoverflow.com/q/24772621
type: Tag
tags question: http://stackoverflow.com/q/24846206
tags question: http://stackoverflow.com/q/24765754
tags question: http://stackoverflow.com/q/24857927
tags question: http://stackoverflow.com/q/24897735
tags question: http://stackoverflow.com/q/24754451
tags question: http://stackoverflow.com/q/24884527
tags question: http://stackoverflow.com/q/24908652
tags question: http://stackoverflow.com/q/24798933
tags question: http://stackoverflow.com/q/24841621
tags question: http://stackoverflow.com/q/24768113
tags question: http://stackoverflow.com/q/24750230
tags question: http://stackoverflow.com/q/24766665
tags question: http://stackoverflow.com/q/24848875
tags question: http://stackoverflow.com/q/24832336
tags question: http://stackoverflow.com/q/24844042
tags question: http://stackoverflow.com/q/24834055
tags question: http://stackoverflow.com/q/24890351
tags question: http://stackoverflow.com/q/24767749
tags question: http://stackoverflow.com/q/24863956
tag name: annotations
tags question: http://stackoverflow.com/q/24776294
tags question: http://stackoverflow.com/q/24866791
tags question: http://stackoverflow.com/q/24824343

http://stackoverflow.com/a/24830254
has body: This means you created a class extending the arraylist and added a static block. List&lt;String&gt; list = new ArrayList&lt;String&gt;(){}; // At this step you have created an instance of an anonymus class assigned to the list varibale new ArrayList&lt;String&gt;() { { add("one"); add("two"); add("three"); } // This is a static block inside your newly created anonymus class. };
upvote count: 1
answers question: http://stackoverflow.com/q/24830205
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/38564653
has text: I've added a free PDF link to my answer
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24838114

http://stackoverflow.com/comment/38440171
score: 0
comment on: http://stackoverflow.com/q/24772179
has text: Have you examined it through a debugger? There's a lot that could be going wrong with it, frankly - examining it with a step debugger would be a good first step towards figuring out the issue.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38690529
type: QuestionComment
comment on: http://stackoverflow.com/q/24904403
score: 0
has text: Your code seems fine for the purpose you have mentioned (replacing value 0 with 1). Please share your array initialization code and the code that calls these methods. Please post the full code. These extracts are not much of help to analyze the problem.
type: Comment

http://stackoverflow.com/a/24798341
downvote count: 0
has body: IntStreamFactory class resides in lucene-codecs-4.9.0.jar, package org.apache.lucene.codecs.sep. Make sure you have this jar in your classpath.
type: Answer
accepted answer of: http://stackoverflow.com/q/24792837
has comment: http://stackoverflow.com/comment/38491457
has comment: http://stackoverflow.com/comment/38491741
answers question: http://stackoverflow.com/q/24792837
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/38505251
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24806672
has text: Do you want to return `CurrClass` or subclass of it?

http://stackoverflow.com/a/24846204
has comment: http://stackoverflow.com/comment/38580446
type: Answer
has body: For your amusement, here is a test program demonstrating a "whoAmI" that will print to any required depth of ancestry: public class Test { public static void main(String[] args) { Sub2 sub2 = new Sub2(); System.out.println("Four levels"); sub2.whoAmi(4); System.out.println("Two levels"); sub2.whoAmi(2); } public void whoAmi(int levels){ if(levels &gt; 1){ Class&lt;? extends Object&gt; ancestor = getClass(); for(int i=1; i&lt;levels &amp;&amp; ancestor != null; i++){ ancestor = ancestor.getSuperclass(); } if(ancestor != null){ System.out.println(ancestor.getName()); } whoAmi(levels - 1); } else { System.out.println(getClass().getName()); } } } class Sub1 extends Test { } class Sub2 extends Sub1 { }
answers question: http://stackoverflow.com/q/24846017
score: 0
has comment: http://stackoverflow.com/comment/38580213

http://stackoverflow.com/q/24843018
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24843114
has title: how to create 2 content panels in north widget
score: 0
answer count: 1
has body: can we create 2 content panels in north widget. BorderLayoutContainer con = new BorderLayoutContainer(); ContentPanel cp = new ContentPanel(); VerticalLayoutContainer logoLayout = new VerticalLayoutContainer(); BorderLayoutData d = new BorderLayoutData(.20); d.setMargins(new Margins()); Image logo = new Image("/IMAGES/Logo.png"); logoLayout.add(logo); cp.add(logoLayout); cp.setHeaderVisible(false); con.setNorthWidget(cp, d); please suggest me how to create two content panels. Basically what I need to do is - please look into the image and let me know what I can do for that
tagged with: extjs
accepted answer: http://stackoverflow.com/a/24843114
tagged with: gxt
type: Question
tagged with: gwt

http://stackoverflow.com/a/24910839
answers question: http://stackoverflow.com/q/24907492
score: 0
has body: You could try something like this schema.xsd: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="c1"> <xs:sequence> <xs:element name="c1e1" minOccurs="0" /> </xs:sequence> </xs:complexType> <xs:complexType name="rootType" mixed="true"> <xs:sequence> <xs:choice maxOccurs="unbounded"> <xs:element name="e1" minOccurs="0"/> <xs:element name="e2" type="c1" minOccurs="0" /> </xs:choice> </xs:sequence> </xs:complexType> <xs:element name="sdfjsn" type="rootType" /> <xs:element name="abc" type="rootType" /> </xs:schema> This validates abc.xml with abc as root element <?xml version="1.0"?> <e1 /> <c1e1 /> <c1e1 /> and sdfjsn.xml with sdfjsn as root element <?xml version="1.0"?> <e1 />
type: Answer

http://stackoverflow.com/q/24758598
has comment: http://stackoverflow.com/comment/38414652
has body: My current application has a number of rules in the form of if-else conditional statements that work on some parameters to either modify some set of variables or set/unset other variables. Due the increasing clients that we are having, the application code is now getting cluttered with these if-else rules. Also, these rules are not static they change quite frequently tweaked, some are made to expire other's activated etc. I have seen that drools etc based on JSR094 provide this functionality to separate logic/rules from application source code. My requirement is not so complex, I don't need complex rule visualization software, editing UI, etc. but definitely dynamic(modifications/editable rules), also my requirement requires low latency as it processes some 100s of million requests a day. Any ideas of a light weight implementation to solve this as I feel drools is overkill? My platform for development is Java. Example rule: if ( age &gt; 15 &amp;&amp; item belongs_to(footwear) || using(mobile_device) ) discount = 2%
tagged with: soa
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38414491
type: Question
has title: Implementing logic/business rules in application without compile/deploy process?
linked to: http://stackoverflow.com/q/53844
upvote count: 3
tagged with: rule-engine
answer count: 1
has answer: http://stackoverflow.com/a/24769549
favorite count: 0
tagged with: rules
tagged with: business-logic
type: UnansweredQuestion

http://stackoverflow.com/a/62962294
score: 0
type: Answer
has body: I think you can try this DefaultTableModel Model = (DefaultTableModel)jTableName.getModel(); TableRowSorter&lt;DefaultTableModel&gt; tr = new TableRowSorter&lt;DefaultTableModel&gt;(Model); jTableName.setRowSorter(tr); tr.setRowFilter(RowFilter.regexFilter(JtextfieldName.getText().trim()));
answers question: http://stackoverflow.com/q/24821476

http://stackoverflow.com/comment/38437475
comment on: http://stackoverflow.com/a/24770678
score: 1
type: AnswerComment
has text: @user3068269 no, `ListAdapter` is an interface implemented by `ArrayAdapter`. Continue to use `ArrayAdapter` but change the `super` call.
type: Comment

http://stackoverflow.com/comment/38541004
has text: @A4L the version of the Dynamic web module is 2.3 in Project Facets and i am not able to change it to 2.5 like the version in the pom.xml
comment on: http://stackoverflow.com/q/24825347
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24878041
accepted answer of: http://stackoverflow.com/q/24877844
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38641095
has body: First, your json is wrong, but I think I see what you're trying. No it's not possible. HashMap&lt;String,String&gt; implies your object contains only top level string properties like: { "something": "value", "somethingelse": "value2", "someAdditionalThing": "value3" } To deserialize that you probably need to have a more strongly typed object. Jackson is falling over trying to turn: { "entry": [ {"key":"one", "value":"avalue"}, {"key":"two", "value":"bvalue"} ] } Into a string.
answers question: http://stackoverflow.com/q/24877844
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38517329
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24791086
score: 0
has text: i dont get it. I explained my question well, and ask for some possible fixes. (& I contacted the author). I didn't expect u guys to know everything. If u guys dont know the answer, then leave it. Downvote my question makes me feel like this website is full of impatience and unhelpful people who think they're expert and so busy until the point that they don't have time for others. Have u ever asked a question in ur life at all? If someone says NO, i'll admit that i am stupid

http://stackoverflow.com/q/24790834
score: 35
has comment: http://stackoverflow.com/comment/38476207
has answer: http://stackoverflow.com/a/29641510
has answer: http://stackoverflow.com/a/42631837
has answer: http://stackoverflow.com/a/36937064
has comment: http://stackoverflow.com/comment/38476252
has answer: http://stackoverflow.com/a/44883036
has answer: http://stackoverflow.com/a/35907603
has comment: http://stackoverflow.com/comment/38476441
tagged with: java
has answer: http://stackoverflow.com/a/63184431
has comment: http://stackoverflow.com/comment/38478154
has comment: http://stackoverflow.com/comment/38476325
type: Question
has answer: http://stackoverflow.com/a/24791708
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39232225
has answer: http://stackoverflow.com/a/39226228
has answer: http://stackoverflow.com/a/43064211
answer count: 13
tagged with: eclipse
has answer: http://stackoverflow.com/a/54089324
has body: When I try running my java .jar on another machine I get the error Unsupported major.minor version 52.0 I compiled my program using the jdk 1.6 and my machine (separate one) has java 7 installed. This is the java version my machine is running: Here are the settings in my IDE (Eclipse Lunar) Why am I still getting an unsupported error? I did check my run configuration and change it to jre6, but when I do I can't even run my program in the IDE. Note: I would like my program to work with jdk 6, if that is not possible jdk 7. My Class Path:
has title: Can't fix Unsupported major.minor version 52.0 even after fixing compatibility
upvote count: 35
downvote count: 0
accepted answer: http://stackoverflow.com/a/24791708
possible better answer: http://stackoverflow.com/a/36195741
has comment: http://stackoverflow.com/comment/38483051
favorite count: 0
has answer: http://stackoverflow.com/a/30947050
has answer: http://stackoverflow.com/a/36195741

http://stackoverflow.com/q/24795534
has answer: http://stackoverflow.com/a/24795712
upvote count: 1
has answer: http://stackoverflow.com/a/24795752
has body: I have an app that worked up to just recently. The error in the Google play store is as follows: java.lang.RuntimeException: Unable to instantiate application org.marsfirst.mars_app: java.lang.ClassNotFoundException: Didn't find class "org.marsfirst.mars_app" on path: DexPathList[[zip file "/data/app/org.marsfirst.mars_app-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.marsfirst.mars_app-2, /vendor/lib, /system/lib]] at android.app.LoadedApk.makeApplication(LoadedApk.java:516) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4703) at android.app.ActivityThread.access$1600(ActivityThread.java:175) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5602) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.marsfirst.mars_app" on path: DexPathList[[zip file "/data/app/org.marsfirst.mars_app-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.marsfirst.mars_app-2, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:457) at android.app.Instrumentation.newApplication(Instrumentation.java:981) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) ... 11 more MainActivity: import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar;//this gives me a warning that states its unused but it has been used in the past import android.support.v4.app.Fragment;//this gives me a w…
tagged with: java
has answer: http://stackoverflow.com/a/24795718
answer count: 5
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/24795813
has title: I have an java.lang.ClassNotFoundException error that I cannot trace
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24795780
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/38484846

http://stackoverflow.com/q/24838495
answer count: 1
tagged with: bufferedreader
accepted answer: http://stackoverflow.com/a/24838759
has title: Read a set of lines from a file using BufferedReader
tagged with: file-io
has answer: http://stackoverflow.com/a/24838759
has body: I have one large CSV file of around 1.6 GB and I am trying to read that file and create JSON array of these lines and send it to other consumables processes. I have the following code while(consumeover){ try (BufferedReader br = new BufferedReader(new FileReader ("/my/path/largefile"),65536)) { for (String line; (line = br.readLine()) != null;) { String[] dataRow = line.split("\\|"); //create json array //add each dataRow element to array } } } Now what is happening is above code reads entire file and creates json array which throws "Out of Memory" error. I want to read set of lines say 1000 lines every time I create json array. How do I set my last read position to i+1000? As file is very large, Java is throwing out of memory because of data arrays getting created.
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: java-io
score: 0
has comment: http://stackoverflow.com/comment/127054255

http://stackoverflow.com/comment/38402222
type: AnswerComment
comment on: http://stackoverflow.com/a/24750559
type: Comment
score: 0
has text: I think you misunderstood my meaning. Here is my "more explained" question. Click this --> [link](http://stackoverflow.com/questions/24752040/alternatives-to-batch-file-since-i-am-unable-to-include-java-code-in-it)

http://stackoverflow.com/a/25730635
accepted answer of: http://stackoverflow.com/q/24887693
type: Answer
score: 1
upvote count: 1
has body: Unfortunately, Jimfs currently doesn't support any kind of permission checking. It's definitely something that might be nice to have in the future, it's just somewhat complicated (by the differences in how permissions are set between POSIX and Windows file systems, for example) and didn't seem necessary for most use cases.
has comment: http://stackoverflow.com/comment/123221193
answers question: http://stackoverflow.com/q/24887693
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/24854552
tags question: http://stackoverflow.com/q/24750287
tags question: http://stackoverflow.com/q/24880613
tags question: http://stackoverflow.com/q/24808687
tags question: http://stackoverflow.com/q/24843179
tags question: http://stackoverflow.com/q/24835007
tags question: http://stackoverflow.com/q/24868064
tags question: http://stackoverflow.com/q/24820389
tags question: http://stackoverflow.com/q/24898375
tags question: http://stackoverflow.com/q/24893158
tags question: http://stackoverflow.com/q/24785013
tags question: http://stackoverflow.com/q/24860613
tags question: http://stackoverflow.com/q/24860897
tags question: http://stackoverflow.com/q/24755319
tags question: http://stackoverflow.com/q/24899609
tags question: http://stackoverflow.com/q/24832336
tags question: http://stackoverflow.com/q/24883045
tags question: http://stackoverflow.com/q/24799904
tags question: http://stackoverflow.com/q/24762641
tags question: http://stackoverflow.com/q/24772318
tags question: http://stackoverflow.com/q/24765039
tags question: http://stackoverflow.com/q/24868265
tags question: http://stackoverflow.com/q/24769415
tags question: http://stackoverflow.com/q/24806916
tags question: http://stackoverflow.com/q/24889081
tags question: http://stackoverflow.com/q/24819442
tags question: http://stackoverflow.com/q/24760790
tags question: http://stackoverflow.com/q/24899839
tags question: http://stackoverflow.com/q/24869708
tags question: http://stackoverflow.com/q/24807998
tags question: http://stackoverflow.com/q/24890447
tags question: http://stackoverflow.com/q/24843850
tags question: http://stackoverflow.com/q/24781246
tags question: http://stackoverflow.com/q/24844779
tags question: http://stackoverflow.com/q/24842204
tags question: http://stackoverflow.com/q/24824695
type: Tag
tags question: http://stackoverflow.com/q/24752326
tags question: http://stackoverflow.com/q/24833696
tags question: http://stackoverflow.com/q/24890200
tags question: http://stackoverflow.com/q/24839760
tags question: http://stackoverflow.com/q/24769322
tags question: http://stackoverflow.com/q/24841751
tags question: http://stackoverflow.com/q/24838379
tags question: http://stackoverflow.com/q/24797873
tags question: http://stackoverflow.com/q/24805884
tags question: http://stackoverflow.com/q/24783836
tags question: http://stackoverflow.com/q/24801288
tags question: http://stackoverflow.com/q/24880260
tags question: http://stackoverflow.com/q/24889998
tags question: http://stackoverflow.com/q/24796900
tags question: http://stackoverflow.com/q/24828421
tags question: http://stackoverflow.com/q/24778058
tags question: http://stackoverflow.com/q/24856436
tags question: http://stackoverflow.com/q/24760488
tags question: http://stackoverflow.com/q/24844295
tags question: http://stackoverflow.com/q/24827012
tags question: http://stackoverflow.com/q/24884381
tags question: http://stackoverflow.com/q/24755676
tags question: http://stackoverflow.com/q/24844049
tags question: http://stackoverflow.com/q/24830699
tags question: http://stackoverflow.com/q/24821565
tags question: http://stackoverflow.com/q/24827886
tags question: http://stackoverflow.com/q/24876560
tags question: http://stackoverflow.com/q/24879668
tags question: http://stackoverflow.com/q/24767172
tags question: http://stackoverflow.com/q/24820329
tags question: http://stackoverflow.com/q/24832614
tag name: json
tags question: http://stackoverflow.com/q/24769981
tags question: http://stackoverflow.com/q/24818826
tags question: http://stackoverflow.com/q/24813594
tags question: http://stackoverflow.com/q/24834193
tags question: http://stackoverflow.com/q/24901391
tags question: http://stackoverflow.com/q/24783844
tags question: http://stackoverflow.com/q/24866567
tags question: http://stackoverflow.com/q/24820328
tags question: http://stackoverflow.com/q/24815821
tags question: http://stackoverflow.com/q/24780233
tags question: http://stackoverflow.com/q/24803147

http://stackoverflow.com/comment/38516175
type: QuestionComment
has text: I use the GPSstatuslistener to get the number of satellites.
comment on: http://stackoverflow.com/q/24804652
type: Comment
score: 0

http://stackoverflow.com/q/24758195
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38413585
has comment: http://stackoverflow.com/comment/38413584
type: Question
has body: hi i have developed a app to post data from android to website. now when i run app i got message Unfortunately app has stopped an then ap closed. what is the issue.?? if you have some better idea or tutorial for this purpose please share that also java code package com.latlongapp; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import android.app.Activity; public class MainActivity extends Activity { Button sendButton; EditText msgTextField; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // make message text field object msgTextField = (EditText) findViewById(R.id.msgTextField); // make send button object sendButton = (Button) findViewById(R.id.sendButton); } public void send(View v) { // get the message from the message text box String msg = msgTextField.getText().toString(); // make sure the fields are not empty if (msg.length()&gt;0) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://http://tayyab001.base.pk/kami.php"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("id", "12345")); nameValuePairs.add(new BasicNameValuePair("message", msg)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httpclient.execute(httppost); msgTextField.setText(""); // clear text box } catch (ClientProtocolException e) { // TODO Auto-generated catch…
downvote count: 0
has comment: http://stackoverflow.com/comment/38414139
linked to: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/38413747
favorite count: 0
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38414247
has title: How To Post Data From An Android App To a Website
upvote count: 1
has comment: http://stackoverflow.com/comment/38413773
tagged with: php
tagged with: android-intent
has comment: http://stackoverflow.com/comment/38416076

http://stackoverflow.com/q/24798961
answer count: 1
tagged with: javascript
score: -1
has answer: http://stackoverflow.com/a/24799310
has comment: http://stackoverflow.com/comment/38491043
has body: In a rare situation, a name of a person has an apostrophe due to which the javascript error occurs. ctx.println(" " + childrenVar2 + "['" + gb.getCode() + "'].push( new Array('" + clientSummary.getFullName() + "', '" +clientSummary.getId().toString() + "'));"); the above line of code generates below line in javascript groupLetterRegardingOptionChildren['ADLTMEM'].push( new Array('Mr Java O'Reilly', '3117482')); please suggest a solution for above so that the name is not affected.
favorite count: 0
has title: Name containing an apostrophe is returned by getter method
type: UnansweredQuestion
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38491066
type: Question
upvote count: 0

http://stackoverflow.com/comment/38694209
score: 0
type: Comment
type: QuestionComment
has text: You should not work with an array but with a List. Lists provide contains() method with which you can check if certain objects (Strings in this case) are within that list.
comment on: http://stackoverflow.com/q/24906523

http://stackoverflow.com/q/24773896
type: Question
has title: Hibernate many to many mapping additional column Timestamp
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24774440
tagged with: timestamp
tagged with: many-to-many
has body: I am a newbie to Hibernate and trying to do something like this: I have 2 tables. One is Visitor and another is Visited_Page. The Visitor table has a structure: { visitor_id *int*, visitor_username *varchar*, visito_name *varchar* } The Visited_Page table structure is: { vipage_id *int*, vipage_url *varchar* } And many to many mapped table structure is like: visitor_id int, vipage_id int. When the User hits a URL in my website, a new entry should get created in the mapped table with the structure as mentioned above. I have completed this part using hibernate with annotations in Java. Now I have to add another column Timestamp in the mapped table. I am not able to find how to do it. Please help.
tagged with: java
tagged with: hibernate
tagged with: mysql
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24774440

http://stackoverflow.com/comment/38684930
comment on: http://stackoverflow.com/a/24901356
type: AnswerComment
score: 0
has text: how can i make changes to the variables such that they are unique? even if i remove the static reference, 2 instance of StatVisualizer still shows the same. do i need additional methods to get/set ?
type: Comment

http://stackoverflow.com/comment/38458145
has text: Checking if the process helps with some types of crash but sometimes the JVM will zombie, so the process is still running but not responding.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24781056

http://stackoverflow.com/comment/38538034
type: Comment
comment on: http://stackoverflow.com/q/24824103
score: 0
has text: specify another phase in execution?
type: QuestionComment

http://stackoverflow.com/a/24791688
answers question: http://stackoverflow.com/q/24791657
upvote count: 6
score: 6
type: Answer
has body: You are just declaring an array of objects: itemClass[] m = new itemClass[1500]; but you never instantiate the objects within this array. So accessing any instance variable in will throw a NullPointerException Add instantiation of array objects in your loop: while ((line = reader.readLine()) != null) { m[i] = new itemClass();// change the constructor if u need to m[i].index = line; // crash is here : should no more crash m[i].location = reader.readLine(); m[i].item = reader.readLine(); m[i].description = reader.readLine(); i++; }
downvote count: 0

jboss7.x
tags question: http://stackoverflow.com/q/24867267
type: Tag
tags question: http://stackoverflow.com/q/24884528
tags question: http://stackoverflow.com/q/24822228
tags question: http://stackoverflow.com/q/24868300
tag name: jboss7.x
tags question: http://stackoverflow.com/q/24866883
tags question: http://stackoverflow.com/q/24903118
tags question: http://stackoverflow.com/q/24800965

http://stackoverflow.com/comment/45552190
has text: I did all these steps but kept getting the error message, so I restarted the computer and now Android Studio launches. I'm on Windows 10 Tech Preview.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27914068
type: Comment

http://stackoverflow.com/comment/38587684
comment on: http://stackoverflow.com/q/24849950
score: 4
has text: I'm sorry to say this, but I think your design is fundamentally broken. When I try to fix the issues in this code, I get a horribly unwieldy reimplementation of string concatenation. There is literally no advantage over `num1 + " " + operator.getSign() + " " + num2 + " = " + total`. Any apparent reduction in complexity at the call site is due to that complexity being shifted to a non-reusable `Expression` class. None of it is any safer than string concatenation. Trying to add compile-time safety results in the whole thing becoming a wrapper around string concatenation.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38452171
type: QuestionComment
has text: Add a `resources/` folder in your `src/` folder. Then use the `ClassLoader.getResource()` method to load the resource. Also make sure that the file exists in your classpath.
comment on: http://stackoverflow.com/q/24778705
score: 0
type: Comment

http://stackoverflow.com/a/24756870
answers question: http://stackoverflow.com/q/24756748
has body: Here is a method I wrote that might help you, public JSONObject connectClient(){ HttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, 20000); httpClient= new DefaultHttpClient(params); HttpResponse httpResponse; InputStream inputStream=null; try{ HttpPost httpPost=new HttpPost(__PUT_YOUR_URL_HERE__); StringEntity se=new StringEntity(__PUT_YOUR_STRING_HERE__); se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); httpPost.setEntity(se); httpPost.setHeader("Content-Type", "application/json"); httpPost.setHeader("Accept", "application/json"); httpResponse = httpClient.execute(httpPost); responseCode = httpResponse.getStatusLine().getStatusCode(); long responsesize = httpResponse.getEntity().getContentLength(); HttpEntity entity=httpResponse.getEntity(); try{ inputStream=entity.getContent(); } catch(IllegalStateException ise){ ise.printStackTrace(); } catch(IOException ioe){ ioe.printStackTrace(); } BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { e.printStackTrace(); } String s=sb.toString(); if(responseCode==200) output= new JSONObject(s); else{ output.put("STATUS", "FAIL"); output.put("ERRORCODE", responseCode); output.put("DATA_SIZE", responsesize); output.put("DATA_CONTENT", s); } } catch(Exception e){ e.printStackTrace(); } return output; } Response is again given back is a JSONObject, you can edit that out if you want.
downvote count: 0
has comment: http://stackoverflow.com/comment/38412857
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38413220
upvote count: 1

http://stackoverflow.com/comment/38601434
has text: I suggest that it would be faster *not* to do this. Let the file system do the caching. It's *really* good at this. Or use a `MappedByteBuffer,` if the file isn't enormous. I also draw your attention to the [`ByteBuffer.slice()`](http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#slice()) method.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24855415

http://stackoverflow.com/q/24767786
score: 0
tagged with: java
has body: I need to execute this Linux command in Java using BufferedReader: grep 'auth\.' /var/lib/iscsi/nodes/10.1.1.36/*/default What I was trying to execute is : String inputThis = ""; String executeThis = "grep" + " " + "'auth\\.'" + " " + "/var/lib/iscsi/nodes/10.1.1.36" + "/*/default"; Process process = ServerHelper.callProcessWithInput(executeThis, inputThis); BufferedReader stdOutput = new BufferedReader( new InputStreamReader(process.getInputStream())); try { logger.debug("stdOutput for editing:"); String s = null; while ((s = stdOutput.readLine()) != null) { logger.info("####################" + s); } } catch (IOException e) { logger.fatal(e); } It has no error warning: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) But it works incorrect. I run the command in Linux terminal, it works fine and returned the desired results without error message. But when I execute the above code, the result is null. If you check the the error message,it says: ####################grep: /var/lib/iscsi/nodes/10.1.1.36/*/default: No such file or directory Any idea how to modify the string? Update: Figured it out! We cannot use "*" in the string, java cannot detect it.Just executeThis = "ls" + " " + "/var/lib/iscsi/nodes/"+ 10.1.1.36; to find what * is, and executeThis = "cat" + " " + "/var/lib/iscsi/nodes/" + 10.1.1.36 + "/" + myString + "/default";
has comment: http://stackoverflow.com/comment/38433582
has comment: http://stackoverflow.com/comment/38433701
type: Question
has answer: http://stackoverflow.com/a/24767844
has comment: http://stackoverflow.com/comment/38433317
has title: Invalid escape sequence to run Linux command in JAVA
answer count: 1
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38433859

http://stackoverflow.com/comment/38422201
score: 0
comment on: http://stackoverflow.com/q/24762274
type: QuestionComment
type: Comment
has text: I just found out that indri wont work on linux since it is dependant to som ewindows dlls, I think I should delete this post. Thank you so much for your help.

http://stackoverflow.com/comment/51288610
score: 0
has text: Since both Google and Samsung are not helpful in resolving this HUGE issue, can anyone think of a solution that does not involve Proguard (which raises other issues)?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24809580

http://stackoverflow.com/a/24870107
has body: You're using == instead of .equals which doesn't check if strings are equal. .equals will check that the values are equal, not just the reference numbers like this: if( myArray[j].equals(search)){
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24870074
downvote count: 0

http://stackoverflow.com/q/24826933
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24934754
upvote count: 1
possible better answer: http://stackoverflow.com/a/24843184
has body: I have a problem with IBM-RFT (version 8.5). I am making an automated testing framework for a relatively complex application which uses a lot of tabs and panels. The problem is that I can find no way to check that the objects found by using the find method are actually visible on screen right now (are in front/on top of all the others). In other words, I need an algorythm which will only search through the currently active (brought to front) tabs. I've done a very simple application for debugging this problem using Delphi: a single TPageControl containing 2 tabs and a single text field (TEdit) on each of the tabs. The main window is a mapped object, so this is the way I do the search: TestObject[] objs = window().find(atDescendant(".class", "TEdit")); If the application has just been started (only the first text field is visible - the first tab is active) then the find method will return an array of only one text field. But if I activate the second tab then (with no matter what I do after) RFT will find both text fields and there will be no way to differentiate which one of them is actually on the screen. I've been working with several automation tools but this thing in RFT frustrates me. Here is some more information to avoid obvious advices. Believe me, I've been looking for an answer A LOT. None of the fields' properties (which are available at object inspector) change when I switch between tabs. Standard properties like .enabled and .visible are always true. And that's right since they are simply properties of the controls and not some real-time things. RFT object's method isShowing() always returns true for both fields. RFT object's method ensureObjectIsVisible() always returns true for both fields and never switches the tabs to bring the needed field into the view. I can call click(), hover() or whatever user-simulation actions for an invisible field and the test continues to run without any exceptions. Even more - if the window was not in focus at the moment …
type: Question
tagged with: rft
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/24934754
favorite count: 0
type: AnsweredQuestion
has title: IBM-RFT: finding _really_ visible objects within a window
has answer: http://stackoverflow.com/a/24843184
has answer: http://stackoverflow.com/a/24867188

http://stackoverflow.com/comment/38515993
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24812251
has text: Unfortunately I need to do this search without actually running the code. I need to know if there is any possible branch in the conditionals that will get me from A to D. And there are so many classes and methods interconnected that doing that analysis by hand isn't realistic.

http://stackoverflow.com/comment/38581643
type: QuestionComment
has text: Why do you have 6 buttons declared at your layout?
comment on: http://stackoverflow.com/q/24847288
score: 0
type: Comment

http://stackoverflow.com/q/24884124
has answer: http://stackoverflow.com/a/24952647
score: 1
tagged with: java
has body: I'd like to offer a simple webservice that takes a complex object as input parameter. The complex object is a simple pojo, and I want to expose all the member fields via soap. class Customer { private int id; private String name; private List&lt;String&gt; values; private XMLGregorianCalendar birthDate; } @WebService public clcass CustomerService { @WebMethod public String process(@WebParam(name = "customer") Customer customer) { } } Is there any plugin/mechanism that can auto-generate the missing JAXB annotations on the Customer class so that JAX-WS can publish the webservice?
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/24952647
type: Question
downvote count: 0
answer count: 1
has title: How to autogenerate JAXB annotations from POJOs?
favorite count: 0
tagged with: soap
upvote count: 1
tagged with: web-services
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/38591578
has text: The dependencies in this project are not correct. If this is a multi-module build your dependencies are not correct as well.
comment on: http://stackoverflow.com/q/24850557
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24751116
has answer: http://stackoverflow.com/a/25643368
accepted answer: http://stackoverflow.com/a/25643368
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/57423363
has answer: http://stackoverflow.com/a/79390058
has body: I change the theme in the manifest to BlackNotitleFullscreen and i cant run the app. I use 4.4W &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /&gt;
has answer: http://stackoverflow.com/a/57423363
has comment: http://stackoverflow.com/comment/39836783
tagged with: sdk
tagged with: android
type: AnsweredQuestion
type: Question
has title: not targeting the latest versions of android compatibility modes apply 4.4W
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/24841484
has comment: http://stackoverflow.com/comment/38571332
has comment: http://stackoverflow.com/comment/38570773
has comment: http://stackoverflow.com/comment/38570691
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38571250
has comment: http://stackoverflow.com/comment/38570778
has body: I have a string (example below) that I would like to parse into an array //just a stupid example String s = "Mary Mark {John Brown} Honey lollipop Badger {Oh My God} {Such stupid}"; I'm interested in breaking that string to String[][] or ArrayList, so if i called: String[][] x = transform(s); x would contain something like this: String[][] x = {{"Mary"}, {"Mark"}, {"John", "Brown"}, {"Honey"}, {"lollipop"}, {"Badger"}, {"Oh", "My", "God"}, {"Such", "stupid"}}; how do i do that? EDIT: changed to 2d array
has comment: http://stackoverflow.com/comment/38570695
has comment: http://stackoverflow.com/comment/38570703
has comment: http://stackoverflow.com/comment/38570846
has answer: http://stackoverflow.com/a/24841756
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/38570785
favorite count: 0
has comment: http://stackoverflow.com/comment/38571150
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38570631
has answer: http://stackoverflow.com/a/24841659
has comment: http://stackoverflow.com/comment/38571312
has answer: http://stackoverflow.com/a/24841748
has comment: http://stackoverflow.com/comment/38571160
answer count: 4
has comment: http://stackoverflow.com/comment/38571650
upvote count: 2
has answer: http://stackoverflow.com/a/24841802
has comment: http://stackoverflow.com/comment/38570851
score: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/38570742
has title: How do I parse a String into an array

http://stackoverflow.com/a/25133033
accepted answer of: http://stackoverflow.com/q/24877741
answers question: http://stackoverflow.com/q/24877741
has body: Thank you so much. I fixed the problem by changing the configuration of spring data. I set socket-timeout="1500" before. I should not set socket timeout. Defaults to 0 (infinite time).
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/46805553
has comment: http://stackoverflow.com/comment/46875541
type: AcceptedAnswer

http://stackoverflow.com/q/24802680
answer count: 1
has title: Putting the Criterions into List for 'OR' condition
tagged with: hibernate-criteria
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I have the requirement where I need to use Criterion for or condition. This Criterion will be created in loop. So I am adding the Criterion into a List. And outside of the loop I am adding these Criterion's into Criteria and typecasting the list(which contains the Criterion) into Criterion[] array. List&lt;Criterion&gt; criterions = new ArrayList&lt;Criterion&gt;(); for (XYZ xyz : xyzs) { Integer[] age = findMinAndMaxAgeXYZ(xyz); Date minAge = prepareDateByAge(age[0]); Date maxAge = prepareDateByAge(age[1]); // Ordering has been changed to fetch the records for // between condition. criterions.add(Restrictions.between("dob", maxAge, minAge)); } criteria.add(Restrictions.or((Criterion[]) criterions.toArray())); But it gives me exception java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.hibernate.criterion.Criterion; Any other solution to add the Criterion as or instead of putting into the list.
tagged with: orm
type: Question
has answer: http://stackoverflow.com/a/24802909
accepted answer: http://stackoverflow.com/a/24802909
score: 0

http://stackoverflow.com/comment/38585246
comment on: http://stackoverflow.com/q/24848918
has text: What is your `JAVA_HOME` environment variable set to?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24809844
has answer: http://stackoverflow.com/a/24818041
possible better answer: http://stackoverflow.com/a/24815759
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24815759
has comment: http://stackoverflow.com/comment/38531371
has title: Mapping Hibernate : <composite-id> 3
has comment: http://stackoverflow.com/comment/38521451
type: Question
has comment: http://stackoverflow.com/comment/38530676
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24818041
has comment: http://stackoverflow.com/comment/38512028
answer count: 2
has comment: http://stackoverflow.com/comment/38522562
tagged with: composite-primary-key
score: 0
has body: I have a problem mapping to my webapp, I have a table (TacheTicket) contains two primary key and the mapping file I put the following code: &lt;hibernate-mapping&gt; &lt;class name="com.model.TacheTicket" table="TACHETICKET"&gt; &lt;composite-id&gt; &lt;key-property name="idTache" column ="idTache" type="com.model.Tache"/&gt; &lt;key-property name="idTicket" column="idTicket" type="com.model.Ticket"/&gt; &lt;/composite-id&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; but when I execute the program this error appear : org.hibernate.MappingException: Could not determine type for: com.model.Tache, at table: TACHETICKET, for columns: [org.hibernate.mapping.Column(idTache)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:269) at org.hibernate.tuple.PropertyFactory.buildStandardProperty(PropertyFactory.java:120) at org.hibernate.tuple.component.ComponentMetamodel.&lt;init&gt;(ComponentMetamodel.java:45) at org.hibernate.mapping.Component.buildType(Component.java:152) at org.hibernate.mapping.Component.getType(Component.java:145) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253) at org.hibernate.mapping.RootClass.validate(RootClass.java:193) at org.hibernate.cfg.Configuration.validate(Configuration.java:1108) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1293) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:855) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:774) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398) ... 21 more Table definition. C…

http://stackoverflow.com/comment/38651536
has text: This is almost the same as `names[number]`. Lists have the benefit that you have no constraints in the size.
comment on: http://stackoverflow.com/a/24883925
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24858098
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24846243
answers question: http://stackoverflow.com/q/24846243
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38637479
has body: You should use getColumnCells on Result to get all versions (depending on MAX_VERSION_COUNT you have set in Get). getValue returns the latest value. Sample Code: List&lt;Cell&gt; values = result.getColumnCells(Bytes.toBytes(family), Bytes.toBytes(qualifier)); for ( Cell cell : values ) { System.out.println( Bytes.toString( CellUtil.cloneValue( cell ) ) ); }
type: AcceptedAnswer

http://stackoverflow.com/a/24764609
has comment: http://stackoverflow.com/comment/38426087
has body: The purpose of moveTaskToBack: http://developer.android.com/reference/android/app/Activity.html Moves the task containing this activity to the back of the activity stack. Meaning activity is running still, just in the back of all the activities in your app. If you only have one activity, I'm sure you can guess what that means. Your onBackPressed() isn't going to kill the app. If you wanted to do that try: public void onBackPressed() { super.onBackPressed(); }
has comment: http://stackoverflow.com/comment/38426558
type: Answer
answers question: http://stackoverflow.com/q/24764378
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/24862470
has title: Hibernate Many to Many integrity constraint violation
has answer: http://stackoverflow.com/a/24862817
favorite count: 0
upvote count: 1
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24862817
type: Question
has body: I am having trouble with a Many to Many relationship that i have mapped with hibernate! I have 3 tables: Clients - Contain information about a client Resources - Contains information about a resource ClientAccessResource - Contain information about which resource a client has access to! Now, everything is working fine except when i try to delete a resource that has a reference to "clients_access_resources", it gives " Referential integrity constraint violation". But the wierd thing is that, if i delete a Client that has a reference to "clients_access_resource" it works, no problem here! Client @ManyToMany(fetch = FetchType.EAGER, targetEntity=Resources.class) @JoinTable(name = "clients_access_resources", joinColumns = { @JoinColumn(name = "client_id") }, inverseJoinColumns = { @JoinColumn(name = "res_id") }) public Set&lt;Resources&gt; getClientResources() { return this.clientResources; } Resources @ManyToMany(fetch = FetchType.EAGER, mappedBy = "clientResources") public Set&lt;ClientsBasic&gt; getClientsBasics() { return this.clientsBasics; } Resources DAO public void delete(Resources res) throws HibernateException{ synchronized (this) { Transaction tx = null; session = this.sessionFactory.openSession(); tx = session.beginTransaction(); session.delete(res); tx.commit(); session.close(); } } Clients DAO public ClientsBasic save(ClientsBasic client) throws HibernateException { synchronized (this) { Transaction tx = null; session = this.sessionFactory.openSession(); tx = session.beginTransaction(); session.saveOrUpdate(client); tx.commit(); session.close(); return client; } } I've tried to add "cascade = CascadeType.ALL" but it didn't work. Can anyone please help me? Thank you.
downvote count: 0
answer count: 1
tagged with: database

http://stackoverflow.com/a/24902885
has comment: http://stackoverflow.com/comment/52796796
accepted answer of: http://stackoverflow.com/q/24902387
has body: ok, i found the problem... @Self should not be used.
answers question: http://stackoverflow.com/q/24902387
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38687975
type: Answer
has comment: http://stackoverflow.com/comment/38690816
has comment: http://stackoverflow.com/comment/38696452
upvote count: 1
score: 1

google-cloud-messaging
tags question: http://stackoverflow.com/q/24789860
tags question: http://stackoverflow.com/q/24889998
tag name: google-cloud-messaging
type: Tag
tags question: http://stackoverflow.com/q/24888084

http://stackoverflow.com/a/24826776
has comment: http://stackoverflow.com/comment/38543219
type: Answer
has body: As others have said, your class needs a method called a setter. Something like this: public void SetPos(String NewPos) { this.vehiclepos = NewPos; ; More information can be found here: http://docs.oracle.com/javaee/6/tutorial/doc/gjbbp.html
score: 0
answers question: http://stackoverflow.com/q/24826566
has comment: http://stackoverflow.com/comment/38543700

http://stackoverflow.com/a/24854507
upvote count: 2
type: Answer
score: 2
type: AcceptedAnswer
has body: On this line: a[i].subtract(BigInteger.valueOf(1)); Since BigIntegers are immutable, subtract() returns a new BigInteger. You need to store the result, or you will get an endless loop. Change to a[i] = a[i].subtract(BigInteger.ONE);
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24854456
answers question: http://stackoverflow.com/q/24854456

http://stackoverflow.com/comment/38665684
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24890008
has text: Are you scanning a package to detect your entities? If you are using spring for example it looks like this <context:component-scan base-package="foo.bar"/>

http://stackoverflow.com/a/24821571
answers question: http://stackoverflow.com/q/24795421
score: 0
has body: I would advise you to look at different assertion libraries. JUnit and TestNG have their own assertions. You can also take a look at hamcrest (https://code.google.com/p/hamcrest/)
type: Answer

http://stackoverflow.com/q/24782717
has answer: http://stackoverflow.com/a/24782788
has comment: http://stackoverflow.com/comment/38460316
has body: I'm using hibernate 4.2.6 and PostgreSQL 9.1 I've been trying to execute sql query with hibernate. I've written: Session session = Hibernate.util.HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); String sql = String.format("INSERT INTO products (name,cost) VALUES('%s',%s);", product.getName(), product.getCost()); createSQLQuery(sql);//has no effect. Query doesn't execute. session.getTransaction().commit(); session.close(); This query does not executed in DB. But if I write String sql = String.format("INSERT INTO products (name,cost) VALUES('%s',%s);", product.getName(), product.getCost()); Properties connectionProps = new Properties(); connectionProps.put("user", "postgres"); connectionProps.put("password", "123"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/solid",connectionProps); conn.createStatement().execute(sql); corresponding row will add to table. Why hibernate doesn't work, but native query wth JDBC works?
score: 12
has comment: http://stackoverflow.com/comment/38460271
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38460224
possible better answer: http://stackoverflow.com/a/24783414
has answer: http://stackoverflow.com/a/24783414
upvote count: 12
has answer: http://stackoverflow.com/a/54911759
answer count: 5
accepted answer: http://stackoverflow.com/a/24782788
has answer: http://stackoverflow.com/a/68650051
type: AnsweredQuestion
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/31561681
favorite count: 0
has title: Execute native sql with hibernate
tagged with: postgresql
type: Question
tagged with: jdbc

http://stackoverflow.com/a/24802053
has comment: http://stackoverflow.com/comment/38496610
answers question: http://stackoverflow.com/q/24801966
type: Answer
score: 0
has body: I guess you want to loop the JSONArray, if so: JSONObject obj = new JSONObject(jsonString); JSONArray array = obj.getJSONArray("contacts"); for(int i=0;i&lt;array.length();i++){ JSONObject contact = array.getJSONObject(i); String state = contact.getString("state"); //Here you can get "state" for each contact }

http://stackoverflow.com/q/24773332
upvote count: 1
has comment: http://stackoverflow.com/comment/38442365
score: 1
tagged with: java
tagged with: character-encoding
type: Question
has answer: http://stackoverflow.com/a/24773422
has answer: http://stackoverflow.com/a/24773375
answer count: 2
downvote count: 0
has body: I am trying to read UTF-8 encoded XML file and pass UTF-8 string to native code (C++ dll) My problem is best explained with a Sample program import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; public class UniCodeTest { private static void testByteConversion(String input) throws UnsupportedEncodingException { byte[] utf_8 = input.getBytes("UTF-8"); // convert unicode string to UTF-8 String test = new String(utf_8); // Build String with UTF-8 equvalent chars byte[] utf_8_converted = test.getBytes();// Get the bytes: in effect this will be called in JNI wrapper on C++ side to read it in char* // simple workaround to print hex values String utfString = ""; for (int i = 0; i &lt; utf_8.length; i++) { utfString += " " + Integer.toHexString(utf_8[i]); } String convertedUtfString = ""; for (int i = 0; i &lt; utf_8_converted.length; i++) { convertedUtfString += " " + Integer.toHexString(utf_8_converted[i]); } if (utfString.equals(convertedUtfString)) { System.out.println("Success" ); } else { System.out.println("Failure" ); } } public static void main(String[] args) { try { File inFile = new File("c:/test.txt"); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(inFile), "UTF8")); String str; while ((str = in.readLine()) != null) { testByteConversion(str); } in.close(); } catch (IOException e) { e.printStackTrace(); } } } and the test file has stored in UTF-8 format (Tamil Locale) #just test நனமை நன்மை I did the following experiments: set file.encoding property to 'UTF-8' I get success for both inputs when I set file.encoding to 'CP-1252' First input, i get 'Success' and for the second input I am getting 'Failure' Here is what I got for the failure case utf_8 : e0 ae a8 e0 ae a9 e0 af 8d e0 ae ae e0 af 88 utf_8_converted : e0 ae a8 e0 ae a9 e0 af 3f e0 ae ae e0 af 88 I do not understand why 8d is converted i…
tagged with: utf-8
favorite count: 0
type: UnansweredQuestion
has title: Java file.encoding on reading UTF-8 file and handling UTF-8 string

http://stackoverflow.com/comment/38580137
comment on: http://stackoverflow.com/a/24846370
type: Comment
has text: `...which is would work perfectly fine for my purposes, since that would mean...` no that is not what it means. It means your code won't work. An ActionListener responds to events. So there is no way it can respond to the Enter key if you haven't even created the Key Bindings yet. If you only want `Enter` to work when the button has focus then you would NOT set the default button. See [Enter Key and Button](http://tips4java.wordpress.com/2008/10/25/enter-key-and-button/) for more information and a different solution.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38691476
has text: Your original question asked how to left align in a toolbar, which is what happens by default, so it pointless until it was edited. [Node Orientation](https://wiki.openjdk.java.net/display/OpenJFX/Node+Orientation+in+JavaFX) is a different concept than [alignment](http://docs.oracle.com/javase/8/javafx/api/javafx/scene/layout/HBox.html#alignmentProperty), so mixing the two in the question was confusing to me without further context, code or graphics (not of checking the check box, but of what the desired toolbar would look like and what your current code generated).
score: 0
comment on: http://stackoverflow.com/q/24896498
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38624202
has text: I would add each element to a set, sets shouldn't contain any duplicates. Then output the set to an array. I believe there is a toArray function for sets in Java
type: QuestionComment
comment on: http://stackoverflow.com/q/24869318
score: 0
type: Comment

http://stackoverflow.com/comment/38500203
has text: please show us what you have tried, some code and maybe a jsfiddle
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24804172

http://stackoverflow.com/comment/38625597
has text: First thing to do: learn how to format your code. It'll make it *much* easier for you to understand, and for others to help you.
type: QuestionComment
type: Comment
score: 4
comment on: http://stackoverflow.com/q/24870088

http://stackoverflow.com/comment/38896185
comment on: http://stackoverflow.com/q/24759373
has text: Then enable remote debugging in your Tomcat instance and place a breakpoint at the line you have in logs (`DefaultLifecycleProcessor - Stopping beans in phase 2147483647`) and spend some time debugging.
score: 0
type: Comment
type: QuestionComment

substring
tags question: http://stackoverflow.com/q/24900711
type: Tag
tags question: http://stackoverflow.com/q/24816954
tags question: http://stackoverflow.com/q/24802128
tag name: substring

http://stackoverflow.com/comment/38606504
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example).
comment on: http://stackoverflow.com/q/24855191
score: 0
type: Comment

http://stackoverflow.com/a/24868624
has body: It seems that this regex matches what you want String regex = "[^-]*(-[^-]+)*-?;.*"; DEMO Explanation: matches will accept string that: [^-]* can start with non dash characters (-[^-]+)*-?; is a bit tricky because before we will match ; we need to make sure that each - do not have another - after it so: (-[^-]+)* each - have at least one non - character after it -? or - was placed right before ; ;.* if earlier conditions ware fulfilled we can accept ; and any .* characters after it. More readable version, but probably little slower ((?!--)[^;])*;.* Explanation: To make sure that there is ; in string we can use .*;.* in matches. But we need to add some conditions to characters before first ;. So to make sure that matched ; will be first one we can write such regex as [^;]*;.* which means: [^;]* zero or more non semicolon characters ; first semicolon .* zero or more of any characters (actually . can't match line separators like \n or \r) So now all we need to do is make sure that character matched by [^;] is not part of --. To do so we can use look-around mechanisms for instance: (?!--)[^;] before matching [^;] (?!--) checks that next two characters are not --, in other words character matched by [^;] can't be first - in series of two -- [^;](?&lt;!--) checks if after matching [^;] regex engine will not be able to find -- if it will backtrack two positions, in other words [^;] can't be last character in series of --.
type: Answer
answers question: http://stackoverflow.com/q/24868130
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/24908709
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38699538
has body: I created a GUI (Eclipse Wizard) where a user can log in into a database. I swapped the db-access into an external thread. The method startDBCheck() is called from the listeners when user inputs some text. Here's the code: public class DBPage extends MyWizardPage { public final class ConnectionCheckingThread extends Thread { boolean interrupted; @Override public void run() { updateStatus("Checking connection..."); // Method in MyWizardPage using Display.getDefault().asyncExec() to make changes to the GUI String dbError = Database.getInstance().checkDBAccess(); //checkDBAccess() is synchronized if (interrupted) return; if (dbError != null) { updateStatus("Error connecting database: " + dbError); return; } updateStatus(null); } public void disable() { interrupted = true; } } private ConnectionCheckingThread connectionCheckingThread; private void startDBCheck() { if (connectionCheckingThread != null) connectionCheckingThread.disable(); connectionCheckingThread = new ConnectionCheckingThread(); connectionCheckingThread.start(); } } I am watching the memory usage and notice that the eclipse instance is taking more memory with every change on the graphical interface. If I play with the GUI for some time I get a OutOfMemoryError. This makes me think the dead threads aren't being deleted by garbage collector for some reason. I don't see any problem in my code though. If i set the reference on connectionCheckingThread to a new thread, there are no other references pointing the old one, so it should be removed. Am I right and the memory leak is somewhere else, or is there really a problem with this part of code? upd: I get a PermGen space error which makes me consider if this code look suspicious. private synchronized Connection getConnection() throws Exception { // load JDBC drivers from jar file File driverFile = new File(pathToJar); URL[] urls = {driverFile.toURI().toURL()}; URLClassLoader child = new URLClassLoader(urls, this.getClass().getClassLoader()); Class&lt; ? &gt;…
has comment: http://stackoverflow.com/comment/38701350
has comment: http://stackoverflow.com/comment/38708402
has comment: http://stackoverflow.com/comment/38699892
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/38699009
favorite count: 0
has title: Memory leak: Thread objects not picked up by GC or is it a classloading issue?
has comment: http://stackoverflow.com/comment/38701175
has answer: http://stackoverflow.com/a/24913048
has comment: http://stackoverflow.com/comment/38701761
has comment: http://stackoverflow.com/comment/38701429
tagged with: multithreading
tagged with: garbage-collection
upvote count: 1
has comment: http://stackoverflow.com/comment/38698313
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20113926
has comment: http://stackoverflow.com/comment/38699253
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2423284
has comment: http://stackoverflow.com/comment/38699337
has comment: http://stackoverflow.com/comment/38700810
type: Question
accepted answer: http://stackoverflow.com/a/24913048
has comment: http://stackoverflow.com/comment/38702253

http://stackoverflow.com/a/24797492
upvote count: 2
answers question: http://stackoverflow.com/q/24797331
downvote count: 0
has body: The last line has not the same amount of elements as the other lines. After splitting the last line, you try to access fields of the array, that do not exist. That is indicated by the exception http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayIndexOutOfBoundsException.html. Before you access the fields of the array, you have to check if there is the expected amount of items in it. Like this: BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader(fname)); while ((sCurrentLine = br.readLine()) != null){ String[] values = sCurrentLine.split("\\t", -1); // don't truncate empty fields if (5 == values.length) { System.out.println("Col1: " + values[0] + " Col2: " + values[1] + " Col3: " + values[2] + " Col4: " + values[3] + " Col5: " + values[4] ); } // System.out.println(sCurrentLine); } } catch (IOException e) { System.out.println("IOException"); e.printStackTrace(); } finally { try { if(br != null){ br.close(); } } catch (IOException ex) { System.out.println("ErrorClosingFile"); ex.printStackTrace(); } }
type: Answer
score: 2

http://stackoverflow.com/q/24837169
has answer: http://stackoverflow.com/a/24837376
tagged with: apache
downvote count: 0
tagged with: tomcat
has answer: http://stackoverflow.com/a/24837506
has title: How to connect to mysql using eclipse running apache
has answer: http://stackoverflow.com/a/24837287
has answer: http://stackoverflow.com/a/24837204
answer count: 4
favorite count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: database
has body: I am creating a dynamic web project in eclipse. I have my local apache server running and configured with appropriate resource, mysql running and configured with the appropriate port. I downloaded the appropriate driver, included it in the lib directory - I even tried adding it as an external JAR file to no avail. On the dynamic web page the result is "error connecting to database". I created a JSP with the following code: &lt;%@ page import="java.sql.*"%&gt;&lt;%@ page import="java.io.*"%&gt;&lt;%@ page import="com.mysql.*"%&gt;&lt;?xml version="1.0"?&gt; &lt;tours&gt; &lt;% Connection connection = null; Statement statement = null; ResultSet result = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection("jbdc:mysql://localhost:3306/tours", "root", "root"); out.println("connected to database!"); } catch(SQLException e) { out.print("error connecting to database"); } %&gt; &lt;/tours&gt; Please advise... Thanks in advance.
has comment: http://stackoverflow.com/comment/38562942
tagged with: mysql
type: Question

http://stackoverflow.com/a/24773455
type: Answer
answers question: http://stackoverflow.com/q/24773187
score: 0
has body: As far as I understood the aim is to develop the described system and the question is about its general architecture. I'll try to give a couple of tips, hopefully they would help. The primary indicator of the primary supervisor response is its e-mail reply? If its so, I think its not a good approach. I wouldn't reply on e-mails for managing a "protocol" which is, essentially a part of the business logic of your application. Using e-mail is totally fine to "notify" the supervisor that the employee wants to quit. Now, as for me, you should build a server based application what will run in some container (you mention java), so take a look on tomcat, jetty and so forth. This application will have the following logic: The employee that wishes to quit, opens the application and gets to the screen "Report my will to quit" (I omit credentials and everything for brevity) with a button "Report". Now, when the employee hits the report button, the system should find out who is the direct supervisor of that employee, generate an e-mail to him/her and send. Now, this mail is a notification it should contain the information like this: - Employee "John Johnson" has reported that he wants to quit. Please check the now the link should come. The link leads to the aforementioned system (with parameters and everything). The Supervisor now gets to the special screen where he/she has an option to agree (a button) or to disagree (another button). If the supervisor agrees, the system generated an e-mail to HR and to the employee. General notes: Pay attention, everything is done within the system, the e-mail is used only as a notification mechanism. In addition to this fairly basic functionality the system should "memorize" the state of the whole process. The states should be like "employee X has asked to quit", "the supervisor agreed" and so forth. The system is independent of the e-mails (If e-mails go offline or something your system will still work). Moreover sometimes the supervisor jus…

tomcat
tags question: http://stackoverflow.com/q/24878270
tags question: http://stackoverflow.com/q/24795060
tags question: http://stackoverflow.com/q/24812590
tags question: http://stackoverflow.com/q/24852252
tags question: http://stackoverflow.com/q/24767137
tags question: http://stackoverflow.com/q/24758638
tags question: http://stackoverflow.com/q/24887168
tags question: http://stackoverflow.com/q/24808789
tags question: http://stackoverflow.com/q/24764935
tags question: http://stackoverflow.com/q/24830965
tags question: http://stackoverflow.com/q/24895177
tags question: http://stackoverflow.com/q/24803037
tags question: http://stackoverflow.com/q/24773272
tags question: http://stackoverflow.com/q/24825530
tags question: http://stackoverflow.com/q/24749602
tags question: http://stackoverflow.com/q/24750342
tags question: http://stackoverflow.com/q/24862809
tags question: http://stackoverflow.com/q/24819478
tags question: http://stackoverflow.com/q/24806419
tags question: http://stackoverflow.com/q/24784655
tags question: http://stackoverflow.com/q/24767708
tags question: http://stackoverflow.com/q/24785875
tags question: http://stackoverflow.com/q/24893718
tags question: http://stackoverflow.com/q/24825209
tags question: http://stackoverflow.com/q/24811588
tags question: http://stackoverflow.com/q/24841894
tags question: http://stackoverflow.com/q/24780409
tags question: http://stackoverflow.com/q/24869684
tags question: http://stackoverflow.com/q/24844193
tags question: http://stackoverflow.com/q/24868256
tags question: http://stackoverflow.com/q/24810527
tags question: http://stackoverflow.com/q/24837414
tags question: http://stackoverflow.com/q/24865762
tags question: http://stackoverflow.com/q/24905069
tags question: http://stackoverflow.com/q/24757230
tags question: http://stackoverflow.com/q/24828020
tags question: http://stackoverflow.com/q/24856453
tags question: http://stackoverflow.com/q/24837169
tags question: http://stackoverflow.com/q/24844261
tags question: http://stackoverflow.com/q/24769878
tags question: http://stackoverflow.com/q/24768377
tags question: http://stackoverflow.com/q/24891098
tag name: tomcat
tags question: http://stackoverflow.com/q/24811475
tags question: http://stackoverflow.com/q/24878118
tags question: http://stackoverflow.com/q/24882765
tags question: http://stackoverflow.com/q/24903954
tags question: http://stackoverflow.com/q/24772433
tags question: http://stackoverflow.com/q/24821614
tags question: http://stackoverflow.com/q/24779410
tags question: http://stackoverflow.com/q/24903392
tags question: http://stackoverflow.com/q/24881551
tags question: http://stackoverflow.com/q/24806357
tags question: http://stackoverflow.com/q/24847353
tags question: http://stackoverflow.com/q/24758369
tags question: http://stackoverflow.com/q/24875452
tags question: http://stackoverflow.com/q/24803224
tags question: http://stackoverflow.com/q/24872259
tags question: http://stackoverflow.com/q/24803004
tags question: http://stackoverflow.com/q/24890743
tags question: http://stackoverflow.com/q/24873307
tags question: http://stackoverflow.com/q/24905011
tags question: http://stackoverflow.com/q/24784508
tags question: http://stackoverflow.com/q/24849700
tags question: http://stackoverflow.com/q/24902142
tags question: http://stackoverflow.com/q/24878911
tags question: http://stackoverflow.com/q/24780733
tags question: http://stackoverflow.com/q/24798115
type: Tag
tags question: http://stackoverflow.com/q/24757430
tags question: http://stackoverflow.com/q/24781056
tags question: http://stackoverflow.com/q/24859341
tags question: http://stackoverflow.com/q/24805540
tags question: http://stackoverflow.com/q/24809584
tags question: http://stackoverflow.com/q/24823478
tags question: http://stackoverflow.com/q/24885169
tags question: http://stackoverflow.com/q/24850125
tags question: http://stackoverflow.com/q/24873403
tags question: http://stackoverflow.com/q/24857193
tags question: http://stackoverflow.com/q/24832946

http://stackoverflow.com/a/30780210
has comment: http://stackoverflow.com/comment/49633922
answers question: http://stackoverflow.com/q/24767164
type: Answer
has body: I am hoping to not have to define an object that only contains a long value just so that I can run validation on it. Defining a wrapping bean would IMHO be the smartest move, as hibernate-validator is completly centered around the notion of the bean, and is, after all, a reference implementation of the bean validation specification. One of the primary motivators of the spec is to acknowledge validation as a cross-cutting concern that spans across different app layers, and provide a mechanism to gracefully handle this. That is the reason why it is centered around beans, its the objects that get passed through the layers. On the other hand, validating primitves programtically is not a big deal after all, your code can simply be something like @RequestMapping(value = "test", method = RequestMethod.POST) @ResponseBody public String getTest(@RequestBody long longValue, BindingResult result) { if (longValue &gt; 32) { result.rejectValue("longValue", "error.longValue", "longValue max constrained failed"); return "failed validation"; } else { return "passed validation"; } } So in my opinion, either go for the programatic validation if its simple enough, or simply wrap the value.
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24767164

asp.net
tags question: http://stackoverflow.com/q/24865961
tags question: http://stackoverflow.com/q/24765937
tags question: http://stackoverflow.com/q/24864117
type: Tag
tag name: asp.net

http://stackoverflow.com/comment/38497015
score: 0
type: AnswerComment
type: Comment
has text: @Unihedron Unfortunately, in this project, unless there's a lot of these one-message issues, adding another library is not going to be accepted.
comment on: http://stackoverflow.com/a/24794013

http://stackoverflow.com/q/24751041
has title: Fragment is trying to cast to activity
answer count: 1
downvote count: 0
tagged with: android
has body: I know this answer is probably simple but i cannot figure it out. I am modifying example code for a project and keep getting a ClassCastException when i try to launch the app. Says that ListActivityFragment cannot be cast to android.app.Activity. What im not understanding(which is probably the simple part) is why its trying to cast it onto an activity when my main is a fragmentactivity. I know the code is rough, still trying to finish it up but cant get past this. FragmentActivity public class MainActivity extends FragmentActivity { private boolean isLargeScreen = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (findViewById(R.id.normal_screen_layout) != null) { isLargeScreen = false; ListActivityFragment listActivityFragment = new ListActivityFragment(); listActivityFragment.setArguments(getIntent().getExtras()); getSupportFragmentManager().beginTransaction() .add(R.id.normal_screen_layout, listActivityFragment) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.addItem: ListActivityFragment newFragment = new ListActivityFragment(); FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction.replace(R.id.normal_screen_layout, newFragment); transaction.addToBackStack(null); transaction.commit(); break; default: return super.onOptionsItemSelected(item); } return true; } } } ListActivity public class ListActivityFragment extends ListFragment implements OnClickListener { private ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;(); private ListView listView; private View outerView; private Button deleteButton; private ListActivityListener listener; public interface ListActivityListener { public void meetingAdded(); } public ListActivityFragment()…
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24751518
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/24751518

http://stackoverflow.com/a/24799327
has comment: http://stackoverflow.com/comment/38650252
has comment: http://stackoverflow.com/comment/40707530
score: 0
accepted answer of: http://stackoverflow.com/q/24798172
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24798172
has comment: http://stackoverflow.com/comment/40684560
has comment: http://stackoverflow.com/comment/38631447
type: Answer
has comment: http://stackoverflow.com/comment/38629907
has body: No, at the moment there is no such option. You could easily implement your use case by modifying ClassMetadataConverter. If you do it, it might be great to make a PR with your changes. Update In latest Genson release 1.1, you have now an option in the builder to enable this behaviour: new GensonBuilder().useClassMetadataWithStaticType(false).create();

http://stackoverflow.com/comment/38440556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24757825
score: 0
has text: yeah i have a root element called <Root>.. it was nt fitting in the format so removed it

http://stackoverflow.com/comment/38635475
has text: Or use java 7's try-with-resources ;)
type: Comment
comment on: http://stackoverflow.com/a/24875210
type: AnswerComment
score: 4

http://stackoverflow.com/q/24828722
has comment: http://stackoverflow.com/comment/38547581
possible better answer: http://stackoverflow.com/a/24836642
tagged with: robotium
has comment: http://stackoverflow.com/comment/38548246
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38546872
has answer: http://stackoverflow.com/a/24836642
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38548272
has comment: http://stackoverflow.com/comment/38547127
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38547202
type: Question
has comment: http://stackoverflow.com/comment/38548086
answer count: 2
upvote count: 1
has title: Null Pointer exception - Robotium Unit test
has comment: http://stackoverflow.com/comment/38547976
has comment: http://stackoverflow.com/comment/38547901
has comment: http://stackoverflow.com/comment/38547484
favorite count: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38548571
tagged with: android
has comment: http://stackoverflow.com/comment/38547311
has answer: http://stackoverflow.com/a/24831283
accepted answer: http://stackoverflow.com/a/24831283
has body: I am trying to perform unittest using robotium ... every time i try i get a null pointer exception ... Everything is fine until the app loads and then the exception occurs ... In the tutorial it is said that this error would occur but the solution was not clear .. kindly help .. the code is as follows : package com.testCalculator; import android.test.ActivityInstrumentationTestCase2; import com.jayway.android.robotium.solo.Solo; @SuppressWarnings("unchecked") public class TestApk extends ActivityInstrumentationTestCase2 { private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.calculator.Main"; private static Class launcherActivityClass; static { try { launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } public TestApk() throws ClassNotFoundException { super(launcherActivityClass); } private Solo solo; @Override protected void setUp() throws Exception { solo = new Solo(getInstrumentation(), getActivity()); } public void testDisplayBlackBox() { // Enter any integer/decimal value for first edit-field, we are writing 10 solo.clearEditText(0); solo.enterText(0, "10"); // Enter any integer/decimal value for first edit-field, we are writing 20 solo.clearEditText(1); solo.enterText(1, "20"); // Tap on Multiply button solo.clickOnButton("Multiply"); //Assert that the correct resultant of 10 x 20 is returned assertTrue("Problem asserting multiply", solo.searchText("200")); } @Override public void tearDown() throws Exception { solo.finishOpenedActivities(); } } The Blackbox testing Failure Trace: TestApk (2) samsung-samsung_sm_n900a-a0964e35 com.testCalculator.TestApk testDisplayBlackBox (com.testCalculator.TestApk) [samsung-samsung_sm_n900a-a0964e35] java.lang.NullPointerException at com.jayway.android.robotium.solo.ViewFetcher.getNonDecorViews(ViewFetcher.java:163) at com.jayway.android.robotium.solo.ViewFetcher.getAllViews(ViewFetcher.java:85) at com.jayway.android.robot…

http://stackoverflow.com/q/24793247
has title: How to configure transaction management for spring 4/hibernate 4.3 app deployed to WAS 8
linked to: http://stackoverflow.com/q/4293098
tagged with: spring
has answer: http://stackoverflow.com/a/24870216
accepted answer: http://stackoverflow.com/a/24870216
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38484090
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38483981
has comment: http://stackoverflow.com/comment/38601643
linked to: http://stackoverflow.com/q/24422678
type: Question
has comment: http://stackoverflow.com/comment/38601276
tagged with: websphere-8
has comment: http://stackoverflow.com/comment/38520636
score: 0
has body: Have found a million posts on this and tried just as many approaches. Fact is I can't find anywhere an example of configuring a Spring app with Hibernate, that has transactions supported OK in Websphere 8(.5). Here's my spring config: @Configuration @ComponentScan(basePackages={"foobar"}) @EnableTransactionManagement // equiv to <tx:annotation-driven/> @EnableAspectJAutoProxy(proxyTargetClass=true) // equiv to <aop:aspectj-autoproxy/> public class MySpringConfiguration { @Autowired private AutowireCapableBeanFactory beanFactory; @Bean(name = "dataSource") public DataSource dataSource() { try { final javax.naming.InitialContext ic = new javax.naming.InitialContext(); return (javax.sql.DataSource) ic.lookup(FoobarConfiguration.getInstance().getDatasourceJNDIName()); } catch (final NamingException ne) { throw new RuntimeException("Failed to access JNDI lookup using (" + FoobarConfiguration.getInstance().getDatasourceJNDIName() + ")", ne); } } @Bean(name = "sessionFactory") public SessionFactory sessionFactory() { LocalSessionFactoryBuilder builder = new LocalSessionFactoryBuilder(dataSource()); builder.scanPackages("foobar.om"); // builder.setJtaTransactionManager(new WebSphereUowTransactionManager()); // Didn't work. gave: org.hibernate.TransactionException: Could not register synchronization for container transaction Properties props = buildHibernateProperties(); builder.addProperties(props); return builder.buildSessionFactory(); } /** * These were taken, with comments, from application-config conversion */ private Properties buildHibernateProperties() { Properties props = new Properties(); // Set the default-schema for Hibernate to use. props.setProperty("hibernate.default_schema", "foobar"); props.setProperty("hibernate.dialect", "org.hibernate.dialect.DB2Dialect"); props.setProperty("hibernate.hbm2ddl.auto", "validate"); // Sets the DEBUG Level of the hibernate: SQL generation layer. props.setProperty("hibernate.show_sql", "true"); props.setProperty("hibernate.gen…
has comment: http://stackoverflow.com/comment/38601287
answer count: 1
has comment: http://stackoverflow.com/comment/38520701
has comment: http://stackoverflow.com/comment/38483999

http://stackoverflow.com/comment/86364485
score: 1
type: AnswerComment
has text: Should be Collectors.toList() unless you're importing static.
type: Comment
comment on: http://stackoverflow.com/a/27542779

http://stackoverflow.com/a/26804323
has body: A better but slightly not so reusable way is to use ZPL or EPL (whatever your particular zebra printer supports). By the way ZPL is Zebra programming language which is proprietary to Zebra. You can directly write the ZPL String on to the serial or parallel port without installing any Zebra driver (rather using Windows Generic Text Printer driver). For example you can send following string directly to printer port (Serial, Parallel or Network) ^XA^FO40,40^AC2,20^FD^FS^FO40,60^BY2,2.8,10^BCN,100,Y,N,N^FD Barcode label ^FS^XZ Hope it helps.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24887961
score: 2
downvote count: 0

http://stackoverflow.com/comment/38593626
score: 0
type: AnswerComment
has text: Well i get the lenght that was 50, but just have 1 int. Do you know how to get the lenght of the int inside the array?
type: Comment
comment on: http://stackoverflow.com/a/24853227

http://stackoverflow.com/q/24806215
has answer: http://stackoverflow.com/a/24808312
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24808312
tagged with: reasoning
score: 2
type: AnsweredQuestion
tagged with: mapping
tagged with: jena-rules
upvote count: 2
tagged with: java
has body: Goal: I wan´t to achieve a rule based Mapping between ontologies in order to fulfill a common task of data migration. Way to achieve the goal: To achieve this i developed a abstract data structure which is capable to store all information provided by the xml representation of any datatype. Then i wrote a parser, which constructs a ontology out of targeted document-type definition. Now when i read the data in it is first associated to the abstractDatatype namespace, lets call it aS. The targeted data structure lies in the namespace tS. Problem: If i try to express type equity between two Resources with same name but different namespace via a rule like that: [mappingRule1: (aS:?a rdf:type aS:?b) (tS:?c rdf:type tS:?b) -&gt; (aS:?a rdf:type tS:?b)] the reasoner does not get it. Maybe there is a mistake in the rule, which should be interpreted as: if there is the same typename mapped to the different namespace tS as it is in aS, all individuals of aS get also the same type in tS The other problem is that this kind of rule might not work if there are no individuals of a type and i´ve been told that expressing it like that might not be sufficient. Nearly alternatively i could also create SubClassOf rules which do the mapping between all combinations, but that would produce a lot of dirt in the model and i would like to be able to add even more filtering conditions instead of making more general. However if, someone has some experience with rule based ontology mapping, i will be very glad to get some insights. Here is a java unit test that demonstrates the not working mapping problem: import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util…
has title: Ho to achieve Mapping between namespaces in Apache Jena thru Reasoning?
type: Question
tagged with: jena

http://stackoverflow.com/comment/38442590
type: Comment
has text: I thought if I close buffers then socket is closed also isn't it?
comment on: http://stackoverflow.com/a/24773282
score: 0
type: AnswerComment

http://stackoverflow.com/q/24857078
has comment: http://stackoverflow.com/comment/38601071
has title: Hibernate ManyToMany results in cartesian product
possible better answer: http://stackoverflow.com/a/24875677
tagged with: java
tagged with: hibernate
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38606606
has comment: http://stackoverflow.com/comment/38601067
has answer: http://stackoverflow.com/a/24895973
upvote count: 5
accepted answer: http://stackoverflow.com/a/24895973
answer count: 2
score: 5
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/38673886
has comment: http://stackoverflow.com/comment/38636721
favorite count: 0
has comment: http://stackoverflow.com/comment/38601755
has body: I am a newbie in hibernate/JPA and apologies for this noob question. I have follow relations with in entities Manager has many to many relation with Worker Worker has many to many relation with Task Following is the ERD Following are my java classes @Entity @table(name="manager") public class Manager { private long id; private String name; @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "manager_worker", joinColumns = { @JoinColumn(name = "manager_id") }, inverseJoinColumns = { @JoinColumn(name = "worker_id") }) private ArrayList&lt;Worker&gt; workers = new ArrayList&lt;Worker&gt;(); // ......getter setter } @Entity @Table(name = "worker") public class Worker { @Id private long id; private String name; @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "worker_task", joinColumns = { @JoinColumn(name = "worker_id") }, inverseJoinColumns = { @JoinColumn(name = "task_id") }) private ArrayList&lt;Task&gt; tasks = new ArrayList&lt;Task&gt;(); ........................... } @Entity @Table(name = "task") public class Task { @Id private long id; private String title; ................. } I have following data: Manager M1 has worker W1 and W2 W1 has tasks TW1, TW2, TW3 W2 has tasks TW2 and TW2 When I get Manager object for Id M1, the result has cartesian product of Worker and Task i.e. W1 data is repeated for 3 times and W2 data is repeated for 2 times i.e. Manager.worker array list have 5 worker object instead of 2. To load the data I am using Session.get() method public E find(final K key) { return (E) currentSession().get(daoType, key); } Can anyone please tell me how I can fix this and point me to any best practices that I should use in this case. Thanks
has answer: http://stackoverflow.com/a/24875677

http://stackoverflow.com/comment/38670630
score: 1
type: AnswerComment
type: Comment
has text: Google has now released source for Wear here: https://android.googlesource.com/platform/frameworks/base/+/android-4.4w_r1 I'm not familiar enough with the Android source to track this down; anybody else up for the challenge?
comment on: http://stackoverflow.com/a/24781964

http://stackoverflow.com/comment/38413054
has text: Try [XmlPullParser](http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24757825

http://stackoverflow.com/comment/38581752
type: Comment
type: QuestionComment
has text: Add empty `View`s on either side, and adjust the weights as necessary.
comment on: http://stackoverflow.com/q/24847288
score: 0

http://stackoverflow.com/q/24821753
has comment: http://stackoverflow.com/comment/38559119
tagged with: jvm
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/38533514
linked to: http://stackoverflow.com/q/16794783
answer count: 0
tagged with: java
type: Question
has title: what is effect of this in gc log?
has comment: http://stackoverflow.com/comment/38534178
has body: I viewed gc log, some of the information is as follows: 1182.030: [GC[YG occupancy: 8729512 K (9216000 K)]1182.030: [Rescan (parallel) , 7.6001940 secs]1189.630: [weak refs processing, 0.0000190 secs] [1 CMS-remark: 262120K(436904K)] 8991632K(9652904K), 7.6004580 secs] [Times: user=86.06 sys=0.42, real=7.60 secs] 13901.282: [GC 13901.283: [ParNew: 8766574K-&gt;400883K(9216000K), 1.9300940 secs] 10239467K-&gt;1917256K(11578944K), 1.9309390 secs] [Times: user=13.68 sys=0.07, real=1.93 secs] I have some doubt，My question is: What is effect "times" very large?
score: 0

http://stackoverflow.com/a/24783592
score: 0
type: Answer
has body: Using regex I've come up with the following solution. Although it can potentially find undesired matches as described in the code comments: // "\\" is first because we don't want to escape any escape characters we will // be adding ourselves private static final String[] regexSpecial = {"\\", "(", ")", "[", "]", "{", "}", ".", "+", "*", "?", "^", "$", "|"}; private static final String regexEscape = "\\"; private static final String[] regexEscapedSpecial; static { regexEscapedSpecial = new String[regexSpecial.length]; for (int i = 0; i &lt; regexSpecial.length; i++) { regexEscapedSpecial[i] = regexEscape + regexSpecial[i]; } } public static void main(String[] args) throws Throwable { Set&lt;String&gt; searchWords = new HashSet&lt;String&gt;(Arrays.asList("c++", "c", ".net", "asp.net", "java")); String text = "Hello, java is what I want. Hmm .net should be fine too. C, C++ are also need. So, get me\nC,C++,Java,asp.net skills."; System.out.println(numOccurrences(text, searchWords, false)); } /** * Counts the number of occurrences of the given words in the given text. This * allows the given "words" to contain non-word characters. Note that it is * possible for unexpected matches to occur. For example if one of the words * to match is "c" then while none of the "c"s in "coconut" will be matched, * the "c" in "c-section" will even if only matches of "c" as in the "c * programming language" were intended. */ public static Map&lt;String, Integer&gt; numOccurrences(String text, Set&lt;String&gt; searchWords, boolean caseSensitive) { Map&lt;String, String&gt; lowerCaseToSearchWords = new HashMap&lt;String, String&gt;(); List&lt;String&gt; searchWordsInOrder = sortByNonInclusion(searchWords); StringBuilder regex = new StringBuilder("(?&lt;!\\w)("); boolean started = false; for (String searchWord : searchWordsInOrder) { lowerCaseToSearchWords.put(searchWord.toLowerCase(), searchWord); if (started) { regex.append("|"); } else { started = true; } regex.append(escapeRegex(searchW…
answers question: http://stackoverflow.com/q/24781885

http://stackoverflow.com/comment/38620233
has text: Why convert a `Date` to a `long` and immediately convert it back again?
type: Comment
comment on: http://stackoverflow.com/q/24867344
score: 5
type: QuestionComment

http://stackoverflow.com/comment/38444620
comment on: http://stackoverflow.com/q/24774047
type: Comment
has text: Related - [BorderLayout center command won't center](http://stackoverflow.com/q/8276559/2982225)
type: QuestionComment
score: 0

http://stackoverflow.com/a/24810973
has body: On a side note - Are you creating macro for game? You can download jNativeHook https://code.google.com/p/jnativehook/ and hook global listener to globalScreen that way it doesn't matter if you have focus over application. Then you can use it like normal swing/fx listener. CAUTION Make sure that you unhook it correctly otherwise after some hooks it might be blocked and you will have to restart the PC to hook it again (fixed in future release). If you are doing a macro for a game you might have a problem when focused on window - some fullscreen games and even in windowed mode, at least from my personal experience. Robot will also fail in some games to execute event.
has comment: http://stackoverflow.com/comment/38560016
upvote count: 2
answers question: http://stackoverflow.com/q/24810859
has comment: http://stackoverflow.com/comment/38590754
has comment: http://stackoverflow.com/comment/38576465
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38560375
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24810859

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/24822593
tags question: http://stackoverflow.com/q/24880822
tags question: http://stackoverflow.com/q/24783292
tags question: http://stackoverflow.com/q/24802724
tags question: http://stackoverflow.com/q/24854837
tags question: http://stackoverflow.com/q/24821583
tags question: http://stackoverflow.com/q/24867750
tags question: http://stackoverflow.com/q/24827753
tags question: http://stackoverflow.com/q/24767852
tags question: http://stackoverflow.com/q/24831348
tags question: http://stackoverflow.com/q/24820869
tags question: http://stackoverflow.com/q/24868204
tags question: http://stackoverflow.com/q/24891886
tags question: http://stackoverflow.com/q/24882740
tags question: http://stackoverflow.com/q/24865636
tags question: http://stackoverflow.com/q/24893032
type: Tag
tags question: http://stackoverflow.com/q/24816076
tags question: http://stackoverflow.com/q/24904366
tags question: http://stackoverflow.com/q/24837884
tags question: http://stackoverflow.com/q/24867922
tags question: http://stackoverflow.com/q/24819449
tags question: http://stackoverflow.com/q/24850304
tags question: http://stackoverflow.com/q/24794887
tags question: http://stackoverflow.com/q/24873827
tags question: http://stackoverflow.com/q/24872855
tags question: http://stackoverflow.com/q/24906885
tags question: http://stackoverflow.com/q/24848167
tags question: http://stackoverflow.com/q/24902328
tags question: http://stackoverflow.com/q/24820497
tags question: http://stackoverflow.com/q/24772828
tags question: http://stackoverflow.com/q/24763307
tags question: http://stackoverflow.com/q/24765503
tags question: http://stackoverflow.com/q/24828266
tags question: http://stackoverflow.com/q/24906934
tags question: http://stackoverflow.com/q/24827446
tags question: http://stackoverflow.com/q/24756191
tags question: http://stackoverflow.com/q/24756749
tags question: http://stackoverflow.com/q/24867734
tags question: http://stackoverflow.com/q/24839824
tags question: http://stackoverflow.com/q/24814305
tags question: http://stackoverflow.com/q/24859173
tags question: http://stackoverflow.com/q/24799647
tag name: html
tags question: http://stackoverflow.com/q/24862210
tags question: http://stackoverflow.com/q/24799059
tags question: http://stackoverflow.com/q/24812758
tags question: http://stackoverflow.com/q/24822964
tags question: http://stackoverflow.com/q/24884568
tags question: http://stackoverflow.com/q/24887650
tags question: http://stackoverflow.com/q/24891272
tags question: http://stackoverflow.com/q/24836632
tags question: http://stackoverflow.com/q/24777689
tags question: http://stackoverflow.com/q/24803636
tags question: http://stackoverflow.com/q/24823422
tags question: http://stackoverflow.com/q/24864416

http://stackoverflow.com/q/24866028
tagged with: jax-rs
has answer: http://stackoverflow.com/a/25165612
possible better answer: http://stackoverflow.com/a/24868773
favorite count: 0
tagged with: scala
has title: Access @ApiOperation attributes in Swagger ApiAuthorizationFilter
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swagger
type: Question
answer count: 2
has body: I have a Jax-RS webservice, which I document using Swagger. Now I want to check the parameters from the @ApiOperation annotation of each method to do some filtering. @GET @ApiOperation(value = "a description", response = String.class, hidden=true) public static Response get(){} I created an ApiAuthorizationFilterImpl according to this example: https://github.com/wordnik/swagger-core/blob/master/samples/java-jaxrs/src/main/java/com/wordnik/swagger/sample/util/ApiAuthorizationFilterImpl.java#L60 I overwrote the isOperationAllowed method: public boolean isOperationAllowed(Operation operation, ApiDescription api, Map&lt;String, List&lt;String&gt;&gt; params, Map&lt;String, String&gt; cookies, Map&lt;String, List&lt;String&gt;&gt; headers) { System.out.println("params: "+params.keySet()); //&lt;--params is empty } Now, when I am trying to access params, it is empty. On the opposite, I can print the parameters from operation.parameters() but I also can't access them, as I get a Scala list with parameters. The filter in general is access when starting the Swagger-UI, so it seems to be correctly passed in my web.xml. Is this a silly mistake from my side, or how will I be able to access the parameters? As a workaround I also wouldn't mind to access parameters from @ApiModelProperty annotation.
accepted answer: http://stackoverflow.com/a/25165612
has answer: http://stackoverflow.com/a/24868773
upvote count: 1

http://stackoverflow.com/comment/38685690
type: AnswerComment
type: Comment
has text: That is a different question, and would definitely have to be treated as a debug-type question, requiring a lot more information about your code.
comment on: http://stackoverflow.com/a/24901799
score: 0

http://stackoverflow.com/comment/38438936
comment on: http://stackoverflow.com/a/24771299
has text: Maybe you forgot to define the language. Below the code you typed, you can define the languages in which this live template should be available.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24821552
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24821522
has body: From **service method ()** only your actual method (get,post ...etc) decides to call. The default service() method in an HTTP servlet routes the request to another method based on the HTTP transfer method (POST, and GET). For example, HTTP POST requests are routed to the doPost() method, HTTP GET requests are routed to the doGet() method. This routing enables the servlet to perform different request data processing depending on the transfer method. Because the routing takes place in service(), you do not need to override service() in an HTTP servlet. Instead, override doGet(), anddoPost() depending on the expected request type.
has comment: http://stackoverflow.com/comment/38533324
answers question: http://stackoverflow.com/q/24821522
type: Answer
has comment: http://stackoverflow.com/comment/38533364
score: 5
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/38664048
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24890314
score: 1
has text: But given that you're trying to group similar colours, you should probably abandon RGB and use the HSV colour space: if it really is only brightness the colours in a group differ in, you can probably group them very easily just by looking at the hue.

http://stackoverflow.com/comment/38488459
type: AnswerComment
has text: Enums are comparable, every enum value has ordinal() method returning int.
type: Comment
comment on: http://stackoverflow.com/a/24797497
score: 0

http://stackoverflow.com/a/65376899
answers question: http://stackoverflow.com/q/24832229
downvote count: 0
type: Answer
has body: Solution: Add Java EE Web API Library. In the project window, right-click &lt;libraries&gt;. Then click &lt;Add Library&gt;. then choose &lt;Java EE Web API Library&gt;
upvote count: 14
score: 14

http://stackoverflow.com/a/24884784
has comment: http://stackoverflow.com/comment/38653411
has comment: http://stackoverflow.com/comment/38655041
answers question: http://stackoverflow.com/q/24884669
has comment: http://stackoverflow.com/comment/38654009
has comment: http://stackoverflow.com/comment/38653008
has comment: http://stackoverflow.com/comment/38664820
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/24884669
has comment: http://stackoverflow.com/comment/38653098
has comment: http://stackoverflow.com/comment/38653443
type: Answer
has comment: http://stackoverflow.com/comment/38653239
has body: use private Context context= getApplicationContext(); in OnCreate method of your Intent service.as context= getApplicationContext(); and change private Context context= getApplicationContext(); to private Context context; And the Exception is telling you that you need to implement the default public constructor. public TrackService() { super("TrackService"); } The default public constructor is a constructor with no parameters. Here you call super() and pass a String that will be used to name the IntentService

http://stackoverflow.com/comment/38634084
has text: @Swapnil There are a few more keywords within the lookbehind that I removed for simplicity and the xxxx is a placeholder for a longer expression, but I've tested that part and it is not the problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24874404
score: 0

http://stackoverflow.com/q/24765433
has title: How can I check in Android if a specific App is running and put a PIN Code on it?
score: -5
has answer: http://stackoverflow.com/a/24765665
tagged with: java
has comment: http://stackoverflow.com/comment/38427452
has body: I would like to check if a specific Android App is running. Then I want to ask the user for a PIN before he can use the App. Is this possible? How?
type: Question
downvote count: 5
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38427640
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38427400

http://stackoverflow.com/comment/38432613
score: 0
comment on: http://stackoverflow.com/q/24756758
type: Comment
type: QuestionComment
has text: See: http://docs.oracle.com/javase/tutorial/i18n/resbundle/

http://stackoverflow.com/comment/38489512
comment on: http://stackoverflow.com/a/24796230
has text: Turns out in my manifest I typed in <receiver android:name=".AlarmReciever" /> instead of <receiver android:name=".AlarmReceiver" /> ............BRB GONNA GO KILL MYSELF IN THE MOST BRUTAL WAY POSSIBLE
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24857570
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24857644
has comment: http://stackoverflow.com/comment/38601823
downvote count: 4
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24857586
has comment: http://stackoverflow.com/comment/38601920
favorite count: 0
tagged with: arraylist
has title: How to modify elements at a specific index in an arraylist
possible better answer: http://stackoverflow.com/a/24857586
has answer: http://stackoverflow.com/a/24857644
score: -4
has comment: http://stackoverflow.com/comment/38601989
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38601909
has body: I have a problem modifying elements in an array list at a specific index. Please help me how to do that. Thank you. This is my Arraylist of type List(class). How to modify values in the arraylist at a specific index ArrayList&lt;List&gt; al = new ArrayList&lt;List&gt;(); This is my list class public class List{ private int x; private int y; public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } }

http://stackoverflow.com/comment/38583555
comment on: http://stackoverflow.com/q/24846818
has text: @StephenC ...without others doing the thinking/learning for them
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24790047
has body: You can also use @Qualifier to specify which one @Component("main") public class MyInterfaceMainImpl implements MyInterface { ... } @Component("mock") public class MyInterfaceMockImpl implements MyInterface { ... } @Inject @Qualifer("mock") private MyInterface myInterface;
answers question: http://stackoverflow.com/q/24784165
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/38556220
type: AnswerComment
type: Comment
has text: I worry that I can't rely on having only single values. I'm thinking there must be an easy way -- meaning, a "magical" library/API way -- of doing it, where the queries can be taken from the incoming request and then wrapped up in a new outgoing request. As of yet, though, I haven't managed to find it. (I'm still looking.) Thanks.
comment on: http://stackoverflow.com/a/24833458
score: 0

http://stackoverflow.com/comment/38538231
comment on: http://stackoverflow.com/a/24824263
score: 1
type: AnswerComment
type: Comment
has text: You can add some info that `transient` prevents serialization of field with this modifier.

http://stackoverflow.com/q/24867896
has title: How to import properties file within shared jar in Spring?
has comment: http://stackoverflow.com/comment/38621548
answer count: 2
score: 5
downvote count: 0
favorite count: 0
has body: I'd like to create a shared project jar, that has some services. These service should make use of a properties file. Ideally I just want to make use of the services lateron when I add the shared jar as a dependency to other projects. I don't want to make any further configuration like importing the shared property file or so. Within the shared jar, I'd like to inject the properties using Spring. But how can I do this? project-commons/src/main/java: @Service public class MyService { @Value("${property.value}") private String value; public String getValue() { return value; } } project-commons/src/main/resources/application.properties: property.value=test project-web/src/main/java: @Component public class SoapService { @Autowired private MyService service; //should return "test" public String value() { return service.getValue(); } } When I run it: Illegal character in path at index 1: ${property.value} So, the propertyfile is not resolved. But how can I tell spring to automatically use it when using the appropriate service?
tagged with: spring
possible better answer: http://stackoverflow.com/a/24868041
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38621461
tagged with: java
has answer: http://stackoverflow.com/a/24868096
accepted answer: http://stackoverflow.com/a/24868096
type: Question
has comment: http://stackoverflow.com/comment/38621428
has comment: http://stackoverflow.com/comment/38621455
upvote count: 5
has answer: http://stackoverflow.com/a/24868041

http://stackoverflow.com/a/24834890
downvote count: 0
has comment: http://stackoverflow.com/comment/38558778
type: Answer
has comment: http://stackoverflow.com/comment/38558734
answers question: http://stackoverflow.com/q/24834856
upvote count: 1
has body: You are using the same layout params object for both views lp2. You need to create a seperate layout params object when adding your play and stop buttons. For example, you should have lpPlay and lpStop.
score: 1
has comment: http://stackoverflow.com/comment/38558806

http://stackoverflow.com/q/24813594
linked to: http://stackoverflow.com/q/24819442
score: -2
tagged with: spring-mvc
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Hi guys! Maybe you can help me Now my json response from service is : {"Security":450,"Economical":1850,"IT":1233} I need to parse it to html table. I think that i responce my json from rest service in wrong way. At least i need list of json objects. But i dont know how to do it. My goal is return NAME of Departments(DEPARTMENTS entity) and AVERAGE SALARY FROM Worker entity. And i have no idea how to make the list of objects in my json file, when i call get method on my service Here are my sources: DEPARTMENT ENTITY @Entity @Table(name ="departments") public class Department implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(nullable = false) private String name; //getters setters.... WORKER ENTITY @Entity @Table(name = "workers") public class Worker { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(nullable = false) private String fio; @ManyToOne private Department department; @Column(nullable = false) private Integer salary; //getters setters.... My service(DepartmentService.class) method which returns my data from mysql @Override public List&lt;Object[]&gt; getAllDepartments() { List&lt;Object[]&gt; list; Query query = entityManager.createQuery("SELECT dp.name, avg (wr.salary) FROM Worker wr join wr.department dp GROUP BY dp.name"); list = query.getResultList(); return list; } And my Contollers method which returns json object(jackson library) @RequestMapping(value = "/all", method = RequestMethod.GET) @ResponseBody public JsonNode getAllDeps() { List&lt;Object[]&gt; list = departmentService.getAllDepartments(); ObjectMapper objectMapper = new ObjectMapper(); Map&lt;String, Integer&gt; resultMap = new HashMap&lt;String, Integer&gt;(list.size()); for (Object[] result : list) resultMap.put((String)result[0], ((Double)result[1]).intValue() ); final JsonNode json = objectMapper.valueToTree(resultMap); return json; } As results i want to get from my service json with list of objec…
downvote count: 3
upvote count: 1
type: Question
tagged with: jquery
has answer: http://stackoverflow.com/a/24814011
answer count: 1
has title: Convert JSON String to Table
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/38519537
type: UnansweredQuestion

http://stackoverflow.com/comment/38606955
type: Comment
type: QuestionComment
has text: hm? so If I connect the drawer directly to the computer will it not recognize ESCPOS commands?
comment on: http://stackoverflow.com/q/24860063
score: 0

http://stackoverflow.com/a/24770224
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38451771
has comment: http://stackoverflow.com/comment/38480921
has body: You want something more like this: A.java class A { int x; int y; public A (int x, int y) { this.x = x; this.y = y } public int sum() { return x + y; } } B.java class B { public static void main(String[] args) { A obj = new A(5, 8); System.out.println("Result=" + obj.sum()); } } Since you are instantiating A, it doesn't need a main it needs a constructor to set the values. It does not need to take parameters as I have written it, you could just set them in the constructor to some hard coded value if you like. B needs a main method the way it is as I'm assuming you're going to be running it? If not, you can change that to a constructor to be called from somewhere else.
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24770160
answers question: http://stackoverflow.com/q/24770160
upvote count: 2

http://stackoverflow.com/a/24861563
type: Answer
has body: You can convert ArrayList to Array and then pass array to the PrepareStatement using setArray() method. http://docs.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html#setArray%28int,%20java.sql.Array%29
answers question: http://stackoverflow.com/q/24861400
score: 0

http://stackoverflow.com/comment/50777663
has text: how did you solve your problem eventually?
type: Comment
comment on: http://stackoverflow.com/q/24842224
score: 0
type: QuestionComment

http://stackoverflow.com/q/24808575
tagged with: numbers
tagged with: java
type: Question
tagged with: sorting
tagged with: jtable
score: 0
has title: jTable still sorts numbers incorrectly after overriding getColumnClass method
answer count: 1
accepted answer: http://stackoverflow.com/a/24809945
has answer: http://stackoverflow.com/a/24809945
has body: I am trying to make my jTable sort numbers but it still does not work. I am not sure what I am doing wrong, but everything seems alright. My code: public static javax.swing.JTable jTable1; public void fillMain() { jTable1 = new javax.swing.JTable(); //finalcolumns is a List&lt;String&gt; of all my column names //types is List&lt;Class&gt; of classes of my columns DefaultTableModel tm = new DefaultTableModel(new Object[0][], new String[] {"testcolumn1", "testcolumn2", "testcolumn3"}) { @Override public Class&lt;?&gt; getColumnClass(int col) { System.out.println("Class: " types.get(col).toString()); //here it really returns the right column class (Integer.class) return types.get(col); } @Override public int getColumnCount() { return finalcolumns.size(); } @Override public String getColumnName(int col) { return finalcolumns.get(col); } }; jTable1.setModel(tm); jTable1.setAutoCreateRowSorter(true); } As I tagged inside the code, I am Overriding DefaultTableModel methods and the overriding works as it should, all methods that I Override returns proper values. So it is like: TableModel says: "this column is Integer class and it contains integer objects so I sort it like a String". Why it happens ?
tagged with: integer
type: AnsweredQuestion

http://stackoverflow.com/q/24836960
answer count: 2
tagged with: bash
tagged with: rackspace
favorite count: 0
tagged with: jclouds
possible better answer: http://stackoverflow.com/a/24875739
upvote count: 1
has answer: http://stackoverflow.com/a/24875739
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24875377
has title: jclouds ScriptBuilder not sending the statement correctly to execute
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24875377
has body: I am trying to build a bash script dynamically and created the file on rackspace centos instance and one of the following behave differently not sure what i am missing here. String script = new ScriptBuilder() .addStatement(exec("echo ' expect \"Enter Password :\"' &gt;&gt; config.sh ")) .addStatement(exec("echo ' send -- \"123\"' &gt;&gt; config.sh ")) .addStatement(exec("echo ' send -- \"\\r\"' &gt;&gt; config.sh ")) .render(OsFamily.UNIX); When I loggin to the box and view config.sh . expect "Enter Password:" send -- "123" "send --" But I want to see expect "Enter Password:" send -- "123" send -- "\r" I am not sure what I am doing wrong.
tagged with: centos6
score: 0

http://stackoverflow.com/q/24763051
has title: JavaFX shift focus on TextField after entering characters
has comment: http://stackoverflow.com/comment/38423232
type: Question
has comment: http://stackoverflow.com/comment/38431092
score: 0
accepted answer: http://stackoverflow.com/a/24767363
answer count: 1
has comment: http://stackoverflow.com/comment/38431976
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38425297
tagged with: java
tagged with: javafx
has body: Background I am creating a JavaFX form that requires the user to enter an IP address. Instead of having a single TextField, my design currently uses four TextFields, one for each byte of the address. My intention is that once the user has entered three characters in one field, the focus should automatically jump to the next one. Problem When the user types the third character, focus remains in the text field. When they then type a fourth character, the character they typed gets placed at the beginning of the field (instead of the end), and then focus changes to the next field. Have I made a mistake in my handler methods? Should I be responding to a different event? View <TextField fx:id="textIP1" alignment="CENTER" onKeyTyped="#ip1Change" prefWidth="40.0" /> <TextField fx:id="textIP2" alignment="CENTER" onKeyTyped="#ip2Change" prefWidth="40.0" /> <TextField fx:id="textIP3" alignment="CENTER" onKeyTyped="#ip3Change" prefWidth="40.0" /> <TextField fx:id="textIP4" alignment="CENTER" prefWidth="40.0" /> <VBox.margin> <Insets bottom="25.0" /> </VBox.margin> Controller public class Controller { public void ip1Change() { if (textIP1.getText().length() >= 3) { textIP2.requestFocus(); } } public void ip2Change() { if (textIP2.getText().length() >= 3) { textIP3.requestFocus(); } } public void ip3Change() { if (textIP3.getText().length() >= 3) { textIP4.requestFocus(); } } }
has answer: http://stackoverflow.com/a/24767363

http://stackoverflow.com/q/24906705
has answer: http://stackoverflow.com/a/24910554
has answer: http://stackoverflow.com/a/24907067
answer count: 4
tagged with: reference
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: While I was creating a program to compress a string I ran into this strange problem, I will paste the code snippets with their outputs, I would like someone to clearly explain why this is happening. The first code snippet: here if same letter appears consecutively, then the successive occurrences of the letter is replaced by the total count of same letters. Ex: aaabbb should be written as a3b3. public static String compress(String str){ String compressed = ""; char prev = str.charAt(0); int count = 1; for (int i = 1; i &lt; str.length(); i++) { char curr = str.charAt(i); if (curr == prev) { // in case curr is equal to prev count++; } else { // in case curr is not equal to prev //compressed=compressed+prev+count; compressed+=prev+count; // Shorthand used here count=1; prev=curr; } } compressed=compressed+prev+count; // Shorthand not used System.out.println(compressed); return compressed; } the output for this above code when inputted with aabbccaabbccaabbccaabb is 99100101991001019910010199b2, observe the last two elements of the output, this is because outside the loop, shorthand is not used. If I write the expression as compressed = compressed +prev+count inside the loop, I'll get the intended output. I thought this output is because the operation is messing with the address of the String. But the next code confused me again. String prev= "abc"; String curr = "def"; String result=""; result+=prev+curr; System.out.println(result); I think this is because the right hand operation is performing an ASCII addition, I cannot come to a conclusion, can anyone clarify. I am sleep deprived and hence I am not able to come to a conclusion, hence asking someone to clarify my trivial doubt.
type: Question
has answer: http://stackoverflow.com/a/24907295
has comment: http://stackoverflow.com/comment/38694626
accepted answer: http://stackoverflow.com/a/24906779
tagged with: shorthand
has comment: http://stackoverflow.com/comment/38694652
downvote count: 0
tagged with: string
favorite count: 0
has title: Java String += Shorthand explanation needed
has comment: http://stackoverflow.com/comment/38694422
possible better answer: http://stackoverflow.com/a/24907067
linked to: http://stackoverflow.com/q/20515911
has answer: http://stackoverflow.com/a/24906779

http://stackoverflow.com/comment/38659666
score: 0
type: Comment
type: QuestionComment
has text: FYI: Setting JavaMaxHeapSize that large on a Domino server can have nasty side effects. Your file is only 1 MB, so it's very hard to believe that you need 512 MB of heap to deal with it. Strongly suggest you try 128 MB. Also strongly suggest that you search your code for memory leaks.
comment on: http://stackoverflow.com/q/24870467

connectivity
tags question: http://stackoverflow.com/q/24750860
type: Tag
tags question: http://stackoverflow.com/q/24837337
tag name: connectivity

http://stackoverflow.com/a/24782540
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24781254
accepted answer of: http://stackoverflow.com/q/24781254
type: Answer
has comment: http://stackoverflow.com/comment/38460227
has body: Have you considered doing a simple lexicographic comparison rather than comparing lengths (or whatever it is that you try to do, it's not particularly easy to tell): for(int i=0; i&lt;a.length() &amp;&amp; i&lt;b.length(); i++) { if(a.charAt(i) != b.charAt(i)) return a.charAt(i) &lt; b.charAt(i) ? -1 : 1; } return a.length() &lt; b.length() ? -1 : a.length() == b.length() ? 0 : 1; This is basically the same as what java.lang.Strings do except it only uses public methods.
upvote count: 5

http://stackoverflow.com/comment/38443391
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24773840
has text: Thanks a lot. Let me check it out in practical and i will get back to you

http://stackoverflow.com/a/24749406
answers question: http://stackoverflow.com/q/24749282
has comment: http://stackoverflow.com/comment/38438645
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/38438604
has body: Make sure your class Person implements Comparable. By doing that you have to implement the method: int compareTo(Person o) when you implement it you compare this.birthYear with o.birthYear and return 1,0 or -1 depends if the first is bigger than, equals or less than the latter. After you've finished doing that, you can use Collections.sort(people) to sort the collection by birthYear. You can also sort a collection of Person using a comparator: List&lt;Person&gt; people = new ArrayList&lt;Person&gt;(); // add a few "Person"s to the list... Collections.sort(people, new Comparator&lt;Person&gt;() { public int compare(Person a1, Person a2) { return a1.getBirthYear() - a2.getBirthYear(); } });
upvote count: 3
has comment: http://stackoverflow.com/comment/38397595
downvote count: 0

http://stackoverflow.com/comment/38657791
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24851941
has text: With classpath* it works again - thanks!

sockets
tags question: http://stackoverflow.com/q/24781899
tags question: http://stackoverflow.com/q/24889323
tags question: http://stackoverflow.com/q/24788067
tags question: http://stackoverflow.com/q/24845518
tags question: http://stackoverflow.com/q/24773074
tags question: http://stackoverflow.com/q/24833430
tags question: http://stackoverflow.com/q/24906448
tags question: http://stackoverflow.com/q/24788628
tags question: http://stackoverflow.com/q/24800016
tags question: http://stackoverflow.com/q/24878580
tags question: http://stackoverflow.com/q/24810942
type: Tag
tags question: http://stackoverflow.com/q/24875905
tags question: http://stackoverflow.com/q/24830903
tags question: http://stackoverflow.com/q/24856440
tags question: http://stackoverflow.com/q/24859090
tags question: http://stackoverflow.com/q/24884371
tags question: http://stackoverflow.com/q/24834815
tags question: http://stackoverflow.com/q/24832887
tags question: http://stackoverflow.com/q/24908276
tags question: http://stackoverflow.com/q/24800896
tags question: http://stackoverflow.com/q/24766216
tags question: http://stackoverflow.com/q/24772447
tags question: http://stackoverflow.com/q/24826040
tags question: http://stackoverflow.com/q/24905478
tags question: http://stackoverflow.com/q/24814848
tags question: http://stackoverflow.com/q/24772069
tag name: sockets
tags question: http://stackoverflow.com/q/24859421
tags question: http://stackoverflow.com/q/24864862
tags question: http://stackoverflow.com/q/24784933
tags question: http://stackoverflow.com/q/24795615
tags question: http://stackoverflow.com/q/24807170
tags question: http://stackoverflow.com/q/24854454
tags question: http://stackoverflow.com/q/24825547
tags question: http://stackoverflow.com/q/24770120

http://stackoverflow.com/comment/38461632
has text: org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.NullPointerException java.text.SimpleDateFormat.parse(Unknown Source) java.text.DateFormat.parse(Unknown Source) org.apache.jsp.inserisciassociazionefermata_005ffermata_jsp._jspService(inserisciassociazionefermata_005ffermata_jsp.java:167) org.apache.jasper.runtime.HttpJspBase.service
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24783246

http://stackoverflow.com/comment/38511569
comment on: http://stackoverflow.com/q/24809465
score: 0
type: QuestionComment
has text: @Tenfour04 any ideas of the problem?
type: Comment

http://stackoverflow.com/q/24811796
has answer: http://stackoverflow.com/a/24815339
tagged with: jsf
has title: Can't get filtering to work on PrimeFaces DataTable
type: UnansweredQuestion
score: 3
tagged with: primefaces
tagged with: java
has body: The DataTable does not filter me using primefaces 4.0, I want to filter the Estado field. <?xml version='1.0' encoding='UTF-8' ?> <h:head> Facelet Title </h:head> <h:body> <h:form> <p:dataTable var="persona" value="#{filtroBean.lstPersona}" widgetVar="lstPersona" emptyMessage="No cars found with given criteria" filteredValue="#{filtroBean.lstPersonaFiltro}"> <f:facet name="header"> <p:outputPanel> <h:outputText value="Search all fields:" /> <p:inputText id="globalFilter" onkeyup="PF('lstPersona').filter()" style="width:150px" placeholder="Enter keyword"/> </p:outputPanel> </f:facet> <p:column filterBy="#{filtroBean.getEstado(persona.estado)}" headerText="Estado" footerText="contains" filterMatchMode="contains"> <h:outputText value="#{filtroBean.getEstado(persona.estado)}" /> </p:column> </p:dataTable> </h:form> </h:body> Bean method for state and correspondiante information to list the table package com.msp.controladores; import com.msp.modelo.Persona; import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; /** * * @author admin */ @ManagedBean @SessionScoped public class FiltroBean { private Persona persona; private List<Persona> lstPersonaFiltro; private List<Persona> lstPersona; public FiltroBean() { persona = new Persona(); lstPersona = new ArrayList<>(); lstPersona.add(new Persona(1, "Edisson", "Llinin", 28, 0)); lstPersona.add(new Persona(2, "Juan", "Valverde", 29, 1)); lstPersona.add(new Persona(3, "Alex", "Torres", 30, 2)); lstPersona.add(new Persona(4, "Karla", "Malonado", 31, 3)); lstPersona.add(new Persona(5, "Jhonatan", "Oviedo", 32, 4)); } public Persona getPersona() { return persona; } public void setPersona(Persona persona) { this.persona = persona; } public List<Persona> getLstPersona() { return lstPersona; } public void setLstPersona(List<Persona> lstPersona) { this.lstPersona = lstPersona; } public List<Persona> getLstPersonaFiltro() { return lstPersonaFiltro; } public void setL…
type: Question
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 3

http://stackoverflow.com/comment/38469972
comment on: http://stackoverflow.com/q/24787671
has text: put the path in when it says `Type the full pathname of a JDK installation (or Ctrl-C to quit), the path will be stored in /root/.sqldeveloper/4.0.0/product.conf`
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24791073
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38476553
has comment: http://stackoverflow.com/comment/38476845
has answer: http://stackoverflow.com/a/24791865
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38476799
score: 0
has comment: http://stackoverflow.com/comment/38477156
answer count: 1
has body: This is a part of my java code, I want to get the number of bytes read from the file, I increase 4 bytes in each loop cycle because the size of an integer is 4 bytes, but this code is not working properly, the loop of this code runs beyond the size of file. Please solve the problem. import java.io.File; import java.util.Scanner; public class S { public S() throws Exception { Scanner sc = new Scanner(new File("file.txt")); for(int i=0; sc.hasNext(); i+=4) { sc.nextInt(); System.out.println("Read = "+i+" bytes"); } System.out.println("done"); } public static void main(String arg[]) throws Exception { new S(); } }
has title: getting the progress of reading file

http://stackoverflow.com/comment/55057030
type: Comment
comment on: http://stackoverflow.com/a/24889493
has text: this also might be a problem. go to UAC (user access control) in your windows settings and lower the security checks for your user and try again.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24839648
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24839678
tagged with: algorithm
has answer: http://stackoverflow.com/a/24839980
has body: I have defined a Map in my class storing like position ---&gt; rule, say: 1---&gt;police 2---&gt;teacher 3---&gt;police 4---&gt;student What I hope is that every time a player join my game, I can randomly read a pair from that map and get his/her position--&gt;rule, and then when another joins, get ANOTHER(unique) pair. Is there any good way to acheive that? What I can figure out is that : Convert the map into a entities set Convert the set into a list Collections.shuffle(list); But I don't think this is a good idea. PS: The key is not integer in the future, but now, it is. Every player must own the unque pair. I don't want to change my map, which will be still used.
has title: How to randomly read a pair from a Map until it is empty(Java)
downvote count: 0
has answer: http://stackoverflow.com/a/24839743
accepted answer: http://stackoverflow.com/a/24839678
favorite count: 0
has comment: http://stackoverflow.com/comment/38567417
linked to: http://stackoverflow.com/q/1519736
answer count: 5
possible better answer: http://stackoverflow.com/a/24839743
has answer: http://stackoverflow.com/a/24840032
tagged with: dictionary
has comment: http://stackoverflow.com/comment/38567323
score: 2
has answer: http://stackoverflow.com/a/24840631

http://stackoverflow.com/a/24769406
has body: Json Sub types is your answer. @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="@class") @JsonSubTypes({ @JsonSubTypes.Type(value=BigEvent.class, name="big"), @JsonSubTypes.Type(value=LittleEvent.class, name="little") }) public class SomeEvent&lt;T&gt; { private long time; @JsonProperty("event_type") private String eventType; ... Also see: http://wiki.fasterxml.com/JacksonPolymorphicDeserialization
has comment: http://stackoverflow.com/comment/38435660
answers question: http://stackoverflow.com/q/24769322
score: 0
has comment: http://stackoverflow.com/comment/38436229
type: Answer

http://stackoverflow.com/comment/38459145
type: QuestionComment
comment on: http://stackoverflow.com/q/24777242
has text: Please check the first link of shailesh which is saying that we cann't download resource through ajax.
score: 0
type: Comment

http://stackoverflow.com/q/24788150
type: Question
tagged with: java
score: 4
tagged with: android-networking
upvote count: 4
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
has body: I'm making an android app that gets a list of all the devices connected to my lan(as their IPs and MACs), something similar to what the app Fing does. Now what I want to do is get the host names of the devices on my LAN. For example - The IP address "192.168.1.221" returns host name "Sherlock". Here Sherlock is the device name (or the host name) of my pc. I have already tried InetAddress.getByName("192.168.1.221").getHostName(); InetAddress.getByName("192.168.1.221").getCanonicalHostName(); But these keep returning the IP address itself. Can anyone please help me with the right way? Probably there is some Linux command that I could run in Runtime. Anything that helps. Thanks in advance :)
has title: How to get the HostName or the Device name of devices connected to my LAN through android?

http://stackoverflow.com/q/24890851
answer count: 1
has body: Upon invoking the method PlatformUI.getWorkbench().restart() the application is simply closing and refusing to restart the product.
tagged with: java
has comment: http://stackoverflow.com/comment/38665336
tagged with: eclipse
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38666307
downvote count: 0
has comment: http://stackoverflow.com/comment/38666445
has answer: http://stackoverflow.com/a/24891955
favorite count: 0
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/38665197
type: Question
has title: Eclipse restart using 'PlatformUI.getWorkbench().restart()' is not restarting the RCP product
has comment: http://stackoverflow.com/comment/38665962
has comment: http://stackoverflow.com/comment/38666103
upvote count: 2
has comment: http://stackoverflow.com/comment/38664815
accepted answer: http://stackoverflow.com/a/24891955

jvm
tags question: http://stackoverflow.com/q/24842731
tags question: http://stackoverflow.com/q/24876197
tags question: http://stackoverflow.com/q/24828014
tags question: http://stackoverflow.com/q/24838906
tags question: http://stackoverflow.com/q/24834746
tags question: http://stackoverflow.com/q/24884165
type: Tag
tags question: http://stackoverflow.com/q/24834702
tags question: http://stackoverflow.com/q/24892779
tags question: http://stackoverflow.com/q/24782924
tags question: http://stackoverflow.com/q/24754299
tags question: http://stackoverflow.com/q/24781056
tags question: http://stackoverflow.com/q/24832442
tags question: http://stackoverflow.com/q/24784368
tags question: http://stackoverflow.com/q/24875840
tags question: http://stackoverflow.com/q/24889957
tag name: jvm
tags question: http://stackoverflow.com/q/24877818
tags question: http://stackoverflow.com/q/24898684
tags question: http://stackoverflow.com/q/24836854
tags question: http://stackoverflow.com/q/24845811
tags question: http://stackoverflow.com/q/24821753
tags question: http://stackoverflow.com/q/24758741
tags question: http://stackoverflow.com/q/24824387
tags question: http://stackoverflow.com/q/24798929

http://stackoverflow.com/comment/38518095
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24813273
has text: It would involve significant reworking but Having the Deck object track what player has which cards (and having players keep a list that has their cards as well for ease but this doesn't need to be a bunch of references back to the Deck) might be easier in the long run?
type: QuestionComment

http://stackoverflow.com/q/24846268
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38591351
has comment: http://stackoverflow.com/comment/38580092
answer count: 0
has body: I have some problem to passing value from jsp #A to jsp #B. In jsp #A i will pass value using url, example below : Webpage URL : http://localhost:8080/hrms/applyvacan/index.htm for jsp #B : Vacancy Name <c:forEach items="${vacList}" var="vacancy" varStatus="loop"> ${vacancy.vacname} </c:forEach> i got the answer like this Vacancy for Business System Analyst Vacancy for Chairman Vacancy for CCO test What i want is everytime i click on webpage url it will send only 1 id
type: Question
tagged with: java
has title: pass value from jsp servlet to other jsp servlet
score: 0
has comment: http://stackoverflow.com/comment/38580240
tagged with: jsp

http://stackoverflow.com/comment/38481105
has text: The comparator right now sets the order only based off of the scoreDistance variable when I need it to also factor majorsDistance.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24793399
score: 0

http://stackoverflow.com/a/24795968
has body: I faced a similar problem with rounded image , i tried adding background to imageview and giving it padding but it didn't work , so i ended up using RoundedImageView. The usage is pretty simple and it works perfectly
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24795798

http://stackoverflow.com/q/24791072
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38476578
has answer: http://stackoverflow.com/a/24791295
has comment: http://stackoverflow.com/comment/38476673
has answer: http://stackoverflow.com/a/24791369
tagged with: java
possible better answer: http://stackoverflow.com/a/24791295
answer count: 3
accepted answer: http://stackoverflow.com/a/24791184
score: -4
has body: I have a class that contains a Public Static Array List of the Same Object that the Class is, so the class is called Image and the Array list inside the Class is ArrayList. I have a method to store the object from within the Class, will a public void method store the object in the ArrayList for all to use if I do list.add(this)? I'm a bit new so sorry if this sounds stupid or anything XD or doesn't make sense. Basically I want to make a storage system of Image Objects inside the Image Class, now initialised Image Objects can perform the function ImageExampleObject.addLib(), this public method addLib() performs list.add(this), list being the ArrayList of Image Objects. Will this work? I didn't know how to search for a short sentence to describe what I want to find out, which is basically why I didn't find any question in this site that asks the same thing if you intend to say, someone already asked, why didn't you go look at that question, you should search next time. P: Regards :)
downvote count: 4
has comment: http://stackoverflow.com/comment/38476610
type: AnsweredQuestion
upvote count: 0
has title: Arraylist Add "This" Class
has answer: http://stackoverflow.com/a/24791184

http://stackoverflow.com/comment/38471668
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57440/discussion-between-mo-and-thomas-jungblut).
type: Comment
comment on: http://stackoverflow.com/a/24768213
score: 0

http://stackoverflow.com/comment/38536036
type: AnswerComment
has text: Where is your Profile class located? You need to specify a path in your template. For example: @(message: String, profile: my.model.package.Profile) Besides, you missed @ before *profile1.getLastname*
type: Comment
comment on: http://stackoverflow.com/a/24819925
score: 0

http://stackoverflow.com/comment/38689093
type: QuestionComment
has text: yeah, that's the reason!!! I think I've missed some repo!!!
comment on: http://stackoverflow.com/q/24903578
score: 0
type: Comment

http://stackoverflow.com/a/24899170
downvote count: 0
has comment: http://stackoverflow.com/comment/38680580
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24899038
has body: Instead of converting to string you can do some basic math: Trailing digit = number mod 10 To remove last digit: shorterDigit = number/10. You can do both operations with divideAndRemainder function. So your code could look something like BigInt result = ...; while (result.compareTo(BigInteger.ZERO)&gt;0) { BigInteger[] d = result.divideAndRemainder(BigInteger.TEN); if (d[1].compareTo(BigInteger.ZERO) == 0) { ++count; } else { break; } result = d[0]; } System.out.println(count);

http://stackoverflow.com/q/24875132
answer count: 1
accepted answer: http://stackoverflow.com/a/24981362
tagged with: java
has body: I have two objects that have two separate representations of a string and I am using Dozer to perform object-to-object mapping. I am having a problem running bi-directional data conversion when a string on one object is mapped to a string on another using a custom converter. Say for example you have: public class ClassA { private string1; } and public class ClassB { private string1; } The data conversion is setup as follows: ClassA String ClassB String --------------- --------------- STRING_A_1 &lt;-&gt; STRING_A_2 STRING_B_1 &lt;-&gt; STRING_B_2 STRING_C_xxx &lt;-&gt; STRING_C_xxx My mapper is set up as follows: public class CustomConverter extends DozerConverter&lt;String, String&gt; implements MapperAware { public CustomConverter() { super(String.class, String.class); } @Override public String convertTo(String source, String target) { return MyEnum.toA(source); } @Override public String convertFrom(String source, String target) { return MyEnum.toB(source); } } The only method that gets called is convertFrom(String, String). I tried implementing the MapperAware interface but did not see any means of loading the source and target class types. I was hoping to detect in either method what is being called to figure out the appropriate mapping direction to use. How can I use my converter to detect what the actual direction of the mapping should be?
has title: Dozer map between two strings knowing what is source and what is target
has comment: http://stackoverflow.com/comment/52836118
has comment: http://stackoverflow.com/comment/38834985
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: dozer
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24981362

http://stackoverflow.com/q/24831071
has answer: http://stackoverflow.com/a/24831449
score: 0
answer count: 1
tagged with: jackson
tagged with: resteasy
tagged with: http://stackoverflow.com/tag/xml
has title: Jax-b and Jackson marshalling for unspecified amount of elements?
has body: In a project I am working on with restEASY I am pulling people from a database. One of the requested features is allowing the user to specify fields they would like in the url via query parameters. Because of this the number of fields I would like to return when marshalling to xml or json won't be known until runtime. Is there a way to get jax-b and jackson to ignore a field at runtime? Another thought I had was maintaining an collection of type Field that would essentially be a key value pair, but I would like to control the root element name. What I am looking for in the output is something like Bob Smith 12345 There could be up to 50 of those fields and I don't want to show a bunch of empty fields. I want to only show what the user requests. With my collection of fields (basically a marked up key value pair) I could do this. FirstName Bob LastName Smith</value id 1234 So to summarize I either want to be able to ignore fields that have xml markup based on a condition during runtime, or I want to be able to set XMLRootElement name's programatically. Any ideas?
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/38519849
has text: Can you include some screenshots of your job please? I think you might be over complicating your process here. A screenshot of the job layout and then screenshots of the configuration of some key components or expand on how they're configured in text in your question.
score: 0
comment on: http://stackoverflow.com/q/24811028
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38512975
comment on: http://stackoverflow.com/q/24810494
score: 0
has text: If they are never going to change, frankly hardcoding them isn't all that terrible. Just create a method "addCoordinates()", fill them in that method and return the filled ArrayList (you should never have so much unecessary code in the main to begin with). A more "correct" (as far as what a professor might want or something) thing to do, would be to have these values stored in a file, and read them. Example: http://developer.android.com/reference/android/util/JsonReader.html
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38423139
type: QuestionComment
has text: I know, but thanks for pointing it out. I only add them once.
comment on: http://stackoverflow.com/q/24763029
score: 0
type: Comment

http://stackoverflow.com/comment/38874323
type: AnswerComment
type: Comment
has text: Yes, it doesn't really test anything much. If your goal is to inject current HttpServletRequest objects, you should go with Spring MVC which has extensive capabilities in doing so. If you're trying to initialize a Spring bean with a reference to another bean, autowiring or using @Value directly on a field or field's setter will work just fine. If you want to test whether the autowiring/@Value worked, just test it by checking that the field's getter returns a value.
comment on: http://stackoverflow.com/a/24979073
score: 0

http://stackoverflow.com/a/24868229
has comment: http://stackoverflow.com/comment/83241157
score: 0
type: Answer
has body: You need a negative lookahead! This regex will match any string which does not contain your original match pattern: (?!-{2,}.*?;.*).*?;.* This Regex matches a string which contains a semicolon, but not one occuring after 2 or more dashes. Example:
answers question: http://stackoverflow.com/q/24868130

http://stackoverflow.com/q/24839323
has body: I am developing an android application in which i need to implement some encryption. At the same time i have to keep compatibility with other versions of application (e.g. for the WP platform), which are already in production. This is C# code: static public byte[] Encrypt(String passphrase, byte[] data) { //encrypted data byte[] buffer = null; //crypto handles IntPtr hProvider = IntPtr.Zero; IntPtr hKey = IntPtr.Zero; try { if (!WinApi.CryptAcquireContext(ref hProv, null, WinApi.MS_DEF_PROV, WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT)) Failed("CryptAcquireContext"); //128 bit hash object if (!WinApi.CryptCreateHash(hProv, WinApi.CALG_MD5, IntPtr.Zero, 0, ref hHash)) Failed("CryptCreateHash"); // add passphrase to hash byte[] keyData = ASCIIEncoding.ASCII.GetBytes(passphrase); if (!WinApi.CryptHashData(hHash, keyData, (uint)keyData.Length, 0)) Failed("CryptHashData"); // create 40 bit crypto key from passphrase hash if (!WinApi.CryptDeriveKey(hProv, WinApi.CALG_RC2, hHash, WinApi.CRYPT_EXPORTABLE, ref hKey)) Failed("CryptDeriveKey"); // determine how large of a buffer is required // to hold the encrypted data uint dataLength = (uint)data.Length; uint bufLength = (uint)data.Length; if (!WinApi.CryptEncrypt(hKey, IntPtr.Zero, true, 0, null, ref dataLength, bufLength)) Failed("CryptEncrypt"); // allocate and fill buffer with encrypted data buffer = new byte[dataLength]; Buffer.BlockCopy(data, 0, buffer, 0, data.Length); dataLength = (uint)data.Length; bufLength = (uint)buffer.Length; if (!WinApi.CryptEncrypt(hKey, IntPtr.Zero, true, 0, buffer, ref dataLength, bufLength)) Failed("CryptEncrypt"); } ....... } I have tried to implement it in Java. AFAIK, there is no default RC2 crypto provider in android, so i used Spongy Castle library (bouncycastle fork for android). This is my Java code: public static byte[] encryptLB(byte[] key, byte[] iv, byte[] unencrypted) throws NoSuchAlgorithmException, ... { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.upd…
has comment: http://stackoverflow.com/comment/38568563
tagged with: java
tagged with: spongycastle
has comment: http://stackoverflow.com/comment/38567513
type: Question
has comment: http://stackoverflow.com/comment/38567086
has comment: http://stackoverflow.com/comment/38566487
has title: C# encryption realization in java
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/24841795
tagged with: bouncycastle
type: UnansweredQuestion
tagged with: encryption

http://stackoverflow.com/comment/38674892
has text: This answer was relly helpful and it worked.Thank you so much.Now i understand it.
comment on: http://stackoverflow.com/a/24876975
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38440578
type: Comment
type: QuestionComment
has text: Your ideal design would achieve [high cohesion](http://en.wikipedia.org/wiki/Cohesion_(computer_science)) and [loose coupling](http://en.wikipedia.org/wiki/Coupling_(computer_science)) of your classes. Though your task is extra trivial you can nevertheless think about it in OO way. You may decide to implement `Player` and `Dealer` as separate classes.
comment on: http://stackoverflow.com/q/24772297
score: 0

http://stackoverflow.com/a/24878011
accepted answer of: http://stackoverflow.com/q/24877958
type: AcceptedAnswer
upvote count: 5
has body: Note the javadoc for HashSet: The iterators returned by this class's iterator method are fail-fast: if the set is modified at any time after the iterator is created, in any way except through the iterator's own remove method, the Iterator throws a ConcurrentModificationException. This does not actually require multiple threads. It only requires the set being modified by something other than the Iterator itself.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24877958
score: 5

http://stackoverflow.com/comment/38614316
type: QuestionComment
comment on: http://stackoverflow.com/q/24864291
has text: in case of two string literals it doesn't matter
score: 0
type: Comment

http://stackoverflow.com/a/48694975
downvote count: 0
has body: First and foremost, get the drawer/cutter code for your printer from http://keyhut.com/popopen4.htm Drawer code for my printer is = 27,112,0,100,250 Then, use the code below to open your cash drawer. public void openCashDrawer() { byte[] open = {27,112,0,100,(byte) 250}; // byte[] cutter = {29, 86,49}; PrintService pservice = PrintServiceLookup.lookupDefaultPrintService(); DocPrintJob job = pservice.createPrintJob(); DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE; Doc doc = new SimpleDoc(open,flavor,null); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); try { job.print(doc, aset); } catch (PrintException ex) { System.out.println(ex.getMessage()); } } This should work. Thank you.
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24860063

http://stackoverflow.com/q/24805091
has title: Java : How to add jar file to build, using build.xml or project's .classpath file?
tagged with: ant
tagged with: eclipse
has answer: http://stackoverflow.com/a/24808161
answer count: 1
downvote count: 0
tagged with: jar
favorite count: 0
linked to: http://stackoverflow.com/q/3770071
accepted answer: http://stackoverflow.com/a/24808161
tagged with: build
type: AnsweredQuestion
score: 1
has body: This may be a very basic question but I am really confused. I want to add a few jar files to the build, so that when the build is generated using ant, the jars will be correctly included. In my IDE eclipse, I have added the jar file to build path but have not selected it for export. Now I want to make sure the jar is exported when build is generated. If I go to build path &gt; order and export and select the jars to be added for export, I can see that its entry is added in .classpath file of the project. i.e. if the project was X then X.classpath file will be modified. My question is, is doing what I have described above enough to export a jar? Or Am I supposed to change the build.xml file of the project? Should I change both the .classpath file &amp; build.xml file or just one of them? Whats the difference between these two files?
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/38673948
score: 0
has text: This will only ever be run on Linux, so I suppose it's okay to just shell out and call `ip` or `ifconfig` or parse `/proc` or something. I was really just getting hung up on the doc, which was tantalizingly suggesting there might be another way elsewhere via Java. Why would they bother putting the word *convenient* if there wasn't? Then wouldn't everything in the Java SDK be about convenience? "As opposed to doing <blank> yourself, we've provided it in the SDK as a convenience..."
type: Comment
comment on: http://stackoverflow.com/a/24895534
type: AnswerComment

http://stackoverflow.com/comment/38418468
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24760488
type: QuestionComment
has text: Ok so can guide me a bit how to do it.

http://stackoverflow.com/a/24836879
accepted answer of: http://stackoverflow.com/q/24836802
has body: Yes, you can declare it as an array of Nodes. A SinglyLinkedList is just a wrapper which contains some methods a reference to the first node of the list. With an array of nodes, you can simply iterate across them with your own methods to achieve the same functionality. For example, your find method might look something like this: Node n = arr[obj.hashCode() % TABLE_SIZE]; while (n != null) { if(n.key.equals(obj)) return n.value; n = n.next; } return null;
has comment: http://stackoverflow.com/comment/38562172
answers question: http://stackoverflow.com/q/24836802
has comment: http://stackoverflow.com/comment/38562236
has comment: http://stackoverflow.com/comment/38562263
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38562266
has comment: http://stackoverflow.com/comment/38562128
type: Answer

http://stackoverflow.com/q/24766103
has comment: http://stackoverflow.com/comment/38429104
type: Question
has title: Shortcut Eclipse open declaration type
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38429259
has body: I know there is open declaration shortcut F3 but is there also a shortcut or possibility to set it for open declaration type action? I searched key preferences but could not find it? Is there any trick to open it using just keyboard ?
answer count: 1
tagged with: keyboard-shortcuts
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37269258
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/38431810

http://stackoverflow.com/comment/38447758
score: 0
type: QuestionComment
type: Comment
has text: Hope following link will give you some idea. http://stackoverflow.com/questions/10630522/how-to-create-different-log-files-for-different-packages-using-same-log4j-logger
comment on: http://stackoverflow.com/q/24775706

http://stackoverflow.com/comment/38565599
type: Comment
comment on: http://stackoverflow.com/q/24838585
has text: Also,please add proper tags like `eclipse`,`scrollpane`,etc.which form the basis of your question.This behaviour you found in Eclipse IDE,and your scrolls were missing from jTextArea!
score: 0
type: QuestionComment

http://stackoverflow.com/a/24852404
answers question: http://stackoverflow.com/q/24850693
has body: HttpBasic in Spring Security is to set up with default standart configuration. At this point, to learn more about how Spring Security process the requests, you can read about the Spring Security FilterChain. http://docs.spring.io/spring-security/site/docs/3.0.x/reference/security-filter-chain.html
type: Answer
score: 0

http://stackoverflow.com/q/24889677
answer count: 1
has comment: http://stackoverflow.com/comment/38662815
accepted answer: http://stackoverflow.com/a/24902718
has comment: http://stackoverflow.com/comment/38664001
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38663759
has comment: http://stackoverflow.com/comment/38664096
tagged with: java
score: 0
tagged with: swt
type: Question
tagged with: canvas
has comment: http://stackoverflow.com/comment/38663655
has body: I understand that Draw2D doesn't provide support for more complex figures like cylinders and that we have to "construct them ourselves". I couldn't find much support for that route online. Is there any way I can construct a custom Figure representing a cylinder. I hope this isn't too broad but could someone please point me in the right direction?
has title: Cylinder Figures on Canvas SWT Draw2D
has answer: http://stackoverflow.com/a/24902718
has comment: http://stackoverflow.com/comment/38663047
tagged with: draw2d
tagged with: user-interface

http://stackoverflow.com/a/24794039
answers question: http://stackoverflow.com/q/24793318
has body: I'm going to assume that z are the pixels within your structuring element. I'm also going to assume that "structuring element" is in the case of morphology. Here are a few pointers before we start: You can convert a colour pixel to its graylevel intensity by using the Luminance formula. By consulting the SMPTE Rec. 709 standard, the output graylevel intensity, given the RGB components is: Y = 0.2126*R + 0.7152*G + 0.0722*B. We're going to assume that the structuring element is odd. This will allow for the symmetric analysis of the structuring element for each pixel in your image where it is placed I'm going to assume that your image is already loaded in as a BufferedImage. Your structuring element will be a 2D array of int. I'm not going to process those pixels where the structuring element traverses out of bounds to make things easy. As such, the basic algorithm is this: For each pixel in our image, place the centre of the structuring element at this location For each pixel location where the structuring element is 1 that coincides with this position, find the max and minimum graylevel intensity Set the output image pixel at this location to be (max(z) + min(z)) / 2). Without further ado: public BufferedImage calculateMiddleGray(BufferedImage img, int[][] mask) { // Declare output image BufferedImage outImg = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB); // For each pixel in our image... for (int i = mask.length/2; i &lt; img.getWidth() - mask.length/2; i++) { for (int j = mask[0].length/2; j &lt; img.getHeight() - mask[0].length/2; j++) { int maxPix = -1; int minPix = 256; // For each pixel in the mask... for (int x = -mask.length/2; x &lt;= mask.length/2; x++) { for (int y = -mask[0].length/2; y &lt;= mask[0].length/2; y++) { //Obtain structuring element pixel int structPix = mask[y+mask.length/2][x+mask[0].length/2]; // If not 1, continue if (structPix != 1) continue; // Get RGB pixel int rgb = img.getRGB(i+x, j+y); // Get red, …
type: Answer
score: 0

http://stackoverflow.com/q/24853395
has comment: http://stackoverflow.com/comment/38593729
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24853873
has comment: http://stackoverflow.com/comment/38593833
tagged with: java
has comment: http://stackoverflow.com/comment/38594005
type: Question
accepted answer: http://stackoverflow.com/a/24853873
tagged with: layout
answer count: 1
has comment: http://stackoverflow.com/comment/38593585
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38594288
has comment: http://stackoverflow.com/comment/38594042
tagged with: http://stackoverflow.com/tag/xml
has title: Unfortunately Audio has stopped
has body: I am trying to design the app that has 3 buttons on the main screen; when the user presses on the first two buttons it plays the different music located in the raw folder. The third button on the main screen should drive the user to the next screen which also has buttons. I tried to run my app on the emulator. It plays the music on first two buttons of the main screen, but when I click on the third (Next) button it says, "Unfortunately Your App has stopped". I don't know what's wrong with my code. Any help will be greatly appreciated. Below is my MAIN and Second class JAVA code, main.xml,activity_second.xml and manifest.xml. Main Java Code import android.app.Activity; import android.content.Intent; import android.media.AudioManager; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; public class Audio extends Activity implements OnClickListener { private MediaPlayer mp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setVolumeControlStream(AudioManager.STREAM_MUSIC); findViewById(R.id.button_1).setOnClickListener(this); findViewById(R.id.button_2).setOnClickListener(this); findViewById(R.id.button_3).setOnClickListener(this); } public void onClick(View v) { int resId = 1; switch (v.getId()) { case R.id.button_1: resId = R.raw.button_1; break; case R.id.button_2: resId = R.raw.button_2; break; case R.id.button_3: startActivity(new Intent(Audio.this,SecondActivity.class)); break; } // Release any resources from previous MediaPlayer if (mp != null) { mp.release(); } // Create a new MediaPlayer to play this sound mp = MediaPlayer.create(this, resId); mp.start(); } } Second Class Java Code import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; public class SecondActivity extends Activity { private MediaPlayer mp; @Override p…

http://stackoverflow.com/q/24881348
has comment: http://stackoverflow.com/comment/38647468
tagged with: netbeans
downvote count: 0
tagged with: maven
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to run Grunt task on save inside NetBeans 8.0?
has body: I'm working on a typical Maven Spring MVC project inside NetBeans 8.0 where front end development is done in AngularJS. Since I have over 30 .js files already and they are growing I decided to use Grunt to merge and minify those files. I have installed Node.js, npm and grunt-cli and have manually installed grunt (via npm) at the root folder of my project and everything is working as expected. What I'm doing now is running grunt manually from the console to build those files. What I would like to do is automate this process and have grunt run each time I press save button. I'm trying to achieve exact thing how less and sass preprocessors work inside netbeans. You just setup "watch" folders and on each save less or sass runs and compiles files down to css.
type: Question
has answer: http://stackoverflow.com/a/24881685
accepted answer: http://stackoverflow.com/a/24881685
upvote count: 1
answer count: 1
favorite count: 0
tagged with: angularjs
tagged with: spring-mvc

http://stackoverflow.com/a/24782792
type: Answer
has body: Twitter no longer offer RESTful access to the Public Timeline. All of their requests require authentication. See their API Docs https://dev.twitter.com/docs/api/1.1
answers question: http://stackoverflow.com/q/24777883
score: 0

http://stackoverflow.com/q/24790764
score: 0
answer count: 2
tagged with: diagram
has answer: http://stackoverflow.com/a/24791492
has answer: http://stackoverflow.com/a/24791264
tagged with: oop
tagged with: java
type: UnansweredQuestion
tagged with: class
tagged with: types
type: Question
has body: I was talking with my fellow Java programmers, and came across a novice question, polemic and perhaps even silly, which unfortunately confuse me. In order for my question becomes understandable, I'll give a quick example here. Consider the following situation: I have a car engine. Every engine is designed to work with one type of fuel (named combustible). In this type of problem, I created a "Vehicle" class, which uses a "Engine" as a class field member, because every engine has properties and behaviors. Let's suppose that the car fuel container is part of the car engine, therefore, an engine knows how to fuel itself, and knows how to store it. With these things in mind, I sought to develop an "Engine" class (as said before), which has such properties. The problem is basically this. I get to be in doubt when I think of the following: There are several types of car engines. Different engines have the same properties, but configured differently. Supposing that engine models do not suffer polymorphism, I got two different types of designs... I will call this "model A": And this, "model B": Note that model A shows a concrete class "Engine", while model B demonstrates an abstract class "Engine" with it's implementations. My question is what are the implications, advantages and disadvantages present among different types of models. I was always instructed by programmers, analysts, and database administrators to never tie data into programming code, and never limit a program to be recompiled (over and over), where only the recompilation offer results. According to model B, a change in "engine market" and companies will always reflect a change of code. As a consequence, this will lead to creation of a new type of engine, its extension of the "Engine" class, its implementation, and compilation. However, the model "A" shows that it is difficult to distribute the same engine for different vehicles, for example, with the same model. The creation of each new instance of an engin…
has title: Implementation of types, or abstraction ... Advantages and disadvantages

http://stackoverflow.com/comment/38655187
type: Comment
has text: thanks, i added your uname solution, but since wmic output is bit more complicated to parse and i dont have windows and there seems to be a getenv solution ill stick which Environment properties on windows
comment on: http://stackoverflow.com/a/24884575
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38452077
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24778705
has text: Try to remove the leading `/`.

http://stackoverflow.com/comment/38513280
has text: Thanks, will accept this answer in four minutes when SO lets me :-)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24810846
type: Comment

http://stackoverflow.com/q/24907478
tagged with: unit-testing
upvote count: 9
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/61411604
tagged with: mockito
downvote count: 0
has title: JMockit MockUp class and Mockito/mock equivalent
tagged with: jmockit
favorite count: 0
type: Question
has body: I am attempting to convert a test suite which uses JMockit to use Mockito &amp; powermock. In the test setup there is the following snippet of code: new MockUp&lt;Controller&gt;() { @Mock public boolean sendMessage(final String string1, final String string2) { queue.add(string1); return true; } }; I am guessing that this means whenever that method is called during testing, then use this mocked implementation. Is this correct? Also is there an equivalent to MockUp in Mockito or Powermock? Thank you!
has comment: http://stackoverflow.com/comment/38754039
score: 9
answer count: 1

http://stackoverflow.com/a/24773348
downvote count: 0
score: 4
has body: You should use varStatus attribute of that tag which keep track of loop status &lt;c:forEach items="${item.getApps()}" var="app" varStatus="counter"&gt; &lt;tr&gt;&lt;td&gt; ${counter.count}"&lt;/td&gt; //need to display serial number here &lt;td&gt;&lt;c:out value="${app.getApp()}"&gt;&lt;/c:out&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/c:forEach&gt; This should work for you.
type: Answer
accepted answer of: http://stackoverflow.com/q/24773208
answers question: http://stackoverflow.com/q/24773208
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/38488897
comment on: http://stackoverflow.com/a/24797053
type: Comment
has text: I am so sorry. I already try it and again now "javah -jni com.example.I2CInterface" not work and I entry project folder on command line try again "javah -jni com.example.I2CInterface" not work The problem can be about my java code.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24815795
answer count: 2
tagged with: encryption
upvote count: 1
has body: Short question: I do NOT want to use bcrypt random generated salts. Let's say the password I am hashing is "abcd1234". In the good old days, the salt would be "ab" or "abcd" or "abcd12", in other words, the salt would be the first N characters of the password where N is the required minimum length of a password. So how do I generate a valid bcrypt salt from the password itself? Long question: I am working with a messaging system, in other words, a message will be sent out internally for authentication and I cannot include the plain-text password in this message for obvious reasons. So the flow should be something like that: Machine A gets the password in clear-text Machine A hashes the password with bcrypt The hashed (i.e. safe) password is sent in my internal message Machine B, which is the authentication machine with the database of hashed passwords, get the message and now it has to compare the hashed password it received with the hashed password in the database for authentication. But how can I do that if BCrypt does NOT allow me to use a salt derived from my plain-text password? Machine A knows nothing about any salt. It does not have any access to the database. Machine B is the one who will know that. So there must be a way to derive my bcrypt salt from "abcd1234" or bcrypt should have a method: check(String hashedPasswordWithSaltA, String hashedPasswordWithSaltB); Putting it down in straightforward terms: Machine A gets the password and Machine B is the one that has the authentication database. I don't want to have to pass the password in clear text from A to B, but it looks like bcrypt forces me to do that. :(
has comment: http://stackoverflow.com/comment/38522784
tagged with: java
type: UnansweredQuestion
has title: BCrypt: how can I generate a salt from the string I am hashing?
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38522858
has answer: http://stackoverflow.com/a/24819215
has answer: http://stackoverflow.com/a/24815863
favorite count: 0
tagged with: hash
type: Question
has comment: http://stackoverflow.com/comment/38522809
tagged with: bcrypt

http://stackoverflow.com/q/24900443
has title: java code, no output after compile
has comment: http://stackoverflow.com/comment/38683016
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24900515
downvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/38682939
has comment: http://stackoverflow.com/comment/38682927
score: -8
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38682952
has comment: http://stackoverflow.com/comment/38682925
type: Question
has comment: http://stackoverflow.com/comment/38683043
has comment: http://stackoverflow.com/comment/38682977
answer count: 1
favorite count: 0
has body: when i compile this java code, i got blank (nothing in the output). why the output is blank ? whats the problem in the code ? the code as you see is about Linkedlist. I tried a lot of ways with no success, seems like theres something i am not aware of. I really appreciate your help. thanks. public class Node { private String data; private Node next; public Node (String data, Node next) { this.data=data; this.next=next; } public String getData() { return data; } public Node getNext() { return next; } public void setData(String s) { data=s; } public void setNext(Node n) { next=n; } public String toString() { return "Node [data=" + data + ", next=" + next + "]"; } public static void main(String[] args) { // Node cNode = new Node ("c",null); // Node bNode = new Node ("b",cNode); // Node list = new Node ("a",bNode); Node list = new Node ("A", new Node("B",new Node("C",null))); getThird(list); insertSecond(list,"k"); size(list); } //1st method public static String getThird(Node list) { return list.getNext().getNext().getData(); } //2nd method public static void insertSecond (Node list, String s) { Node newNode=new Node("s",null); newNode.setNext(list.getNext()); list.setNext(newNode); } //3rd method public static int size(Node list) { int count=0; while(list!=null) { count++; list=list.getNext(); } return count; } }
has comment: http://stackoverflow.com/comment/38682921
accepted answer: http://stackoverflow.com/a/24900515
has comment: http://stackoverflow.com/comment/38682942
linked to: http://stackoverflow.com/q/16565045
has comment: http://stackoverflow.com/comment/38683002
has comment: http://stackoverflow.com/comment/38682978
upvote count: 1

http://stackoverflow.com/q/24898988
has comment: http://stackoverflow.com/comment/38683512
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38680308
has title: HttpURLConnection and json android
has answer: http://stackoverflow.com/a/24899336
accepted answer: http://stackoverflow.com/a/24899336
tagged with: android
tagged with: httpurlconnection
favorite count: 0
score: 2
has body: I'm new to Java and Android development and try to create a simple app which use json. Can anyone help me to figure out what's wrong? Log: problem z transferem java.lang.nullpointerexception Manifest: android.permission.INTERNET String adres = "http://pclive.pl/example.json"; URL url_HTTPRequest = null; try { url_HTTPRequest = new URL(adres); } catch (MalformedURLException e) { Log.e("URL ERROR", "problem z url"); } String response = null; try { response = transfer(url_HTTPRequest); } catch (Exception e) { Log.e("URL ERROR", "problem z transferem"); } JSONArray mJSONArray = null; try { mJSONArray = new JSONObject(response).getJSONArray("features"); } catch (JSONException e) { Log.e("JSON ERROR", "problem z JSONArray features"); } JSONObject obj; try { obj = mJSONArray.getJSONObject(0); double lat = obj.getJSONObject("centroid") .getJSONArray("coordinates").getDouble(0); double lon = obj.getJSONObject("centroid") .getJSONArray("coordinates").getDouble(1); Log.w("JSON Parsing", "lat=" + lat + " lon=" + lon); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String transfer(URL url) throws IOException { HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); // inputStream = url.openStream(); InputStream inputStream = urlConnection.getInputStream(); BufferedReader bin = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String line = bin.readLine(); StringBuffer sb = new StringBuffer(); while (line != null) { sb.append(line); sb.append("\r\n"); line = bin.readLine(); } inputStream.close(); return sb.toString(); }
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
upvote count: 2

http://stackoverflow.com/q/24760775
downvote count: 2
has comment: http://stackoverflow.com/comment/38493374
type: Question
has comment: http://stackoverflow.com/comment/38419118
has body: I'm trying to receive data from remote server and insert the data to variable "respond" but the app crashes... I don't have log , because my emulator doesnt work, and sdk driver's for my phone also doesnt work, so I install the apk file via usb cable... the compiler doesn't show error. thanks for help public class MainActivity extends Activity { String serverURL = "http://www.adoninetwork.com/index.html"; String respond = "test"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_main); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(serverURL); ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); try { respond = httpclient.execute(httppost, responseHandler); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } new AlertDialog.Builder(this).setMessage(respond).show();
score: -2
accepted answer: http://stackoverflow.com/a/24761412
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24762363
tagged with: android-activity
has title: android - trying to receive data from php file - app crashes
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24761412
possible better answer: http://stackoverflow.com/a/24762363
tagged with: java

http://stackoverflow.com/comment/38666632
comment on: http://stackoverflow.com/a/24832315
has text: You realize that is a functionality provided by the operating system, and not your application, right?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38487418
type: QuestionComment
comment on: http://stackoverflow.com/q/24796460
has text: yes, it's only a name, i have fill the report using Jaspersoft Studio with the field, but i saved it as Blank_A4.jasper filename http://postimg.org/image/yj2bx9u4t/ but it shows only white PDF
score: 0
type: Comment

http://stackoverflow.com/q/24854406
accepted answer: http://stackoverflow.com/a/24854464
has comment: http://stackoverflow.com/comment/38595649
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38595570
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/24854464
tagged with: equality
type: Question
answer count: 2
tagged with: validation
tagged with: palindrome
has title: Why does this always result in try?
possible better answer: http://stackoverflow.com/a/24854468
favorite count: 0
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/38595549
has body: Im writing this java code for school. I need to see if the data is a palindrome or not and then let the user know the results. My eyes are bleeding. I can't figure this out! import javax.swing.JOptionPane; import helpers.*; public class Palindrome { public static boolean check(String dataInput) { boolean test = false; String reverseDataInput = new StringBuffer(dataInput).reverse().toString(); if (dataInput == reverseDataInput){ test=true; return test; } return test; } public static void main(String[] args) { String inputString = ""; int number = 0; boolean isPalindrome = false; number = helpers.InputUtilities.getIntegerInput(inputString, -99999, 99999); String str = Integer.toString(number); isPalindrome = check(str); if (isPalindrome = true){ JOptionPane.showMessageDialog(null, str + " is a palindrome!", "Area", JOptionPane.PLAIN_MESSAGE); } else { JOptionPane.showMessageDialog(null, str + " is not a palindrome!", "Area", JOptionPane.PLAIN_MESSAGE); } } }
has answer: http://stackoverflow.com/a/24854468
downvote count: 4
linked to: http://stackoverflow.com/q/15605079
upvote count: 0
has comment: http://stackoverflow.com/comment/38595565
score: -4

http://stackoverflow.com/q/24797873
has comment: http://stackoverflow.com/comment/38489515
has comment: http://stackoverflow.com/comment/38489705
has comment: http://stackoverflow.com/comment/38489092
tagged with: jackson
has comment: http://stackoverflow.com/comment/38489050
score: 0
has comment: http://stackoverflow.com/comment/38489176
linked to: http://stackoverflow.com/q/1770010
has comment: http://stackoverflow.com/comment/38489684
accepted answer: http://stackoverflow.com/a/24798255
answer count: 1
has comment: http://stackoverflow.com/comment/38489546
has title: Is it ok to use Jackson?
has body: Recently I wanted find a POJO to JSON mapper and finally ended up using Jackson because it is recommended in most places, but when I just did a small test I found out that to serialize java object which is even having 2 attributes it takes average time of 450ms but if I do the mapping manually it takes only less than 10ms , below is my simple code for calculating the time. public static void main(String[] args) throws Exception{ long time = new Date().getTime(); User user = new User(); user.set_id("100"); user.setName("testuser"); ObjectMapper mapper = new ObjectMapper(); StringWriter write = new StringWriter(); mapper.writeValue(write, user); long endtime = new Date().getTime(); System.out.println("Spent Time : "+(endtime-time)); } So my question is should I still use Jackon? is any other benefits that I have not understood. for your note project that I'm currently working is having spring and mongodb and our task is to develop REST Service, and we don't want a particular request to hang unwanted time.
has comment: http://stackoverflow.com/comment/38488996
has comment: http://stackoverflow.com/comment/38489140
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38489478
has answer: http://stackoverflow.com/a/24798255
type: Question
tagged with: mongodb

http://stackoverflow.com/a/24763285
type: Answer
has body: You have set -fx-fill to the same color in text and text:hover. For me it works, when I use your CSS: the text of a label and button show a hover effect (I changed fx-fill to another value in text:hover). Example code: http://pastebin.com/GNDwz626
score: 0
answers question: http://stackoverflow.com/q/24762821

http://stackoverflow.com/a/25009884
answers question: http://stackoverflow.com/q/24826062
score: 0
type: Answer
has body: The way that I managed to solve this issue was to explicitly include melody's deps to BuildConfig.groovy (copy from plugin's dependencies): dependencies { // Deps for grails-melody (copied from plugin deps) that are *not* included automatically with plugin. compile "net.bull.javamelody:javamelody-core:1.44.0" compile ("com.lowagie:itext:2.1.7") { excludes "bcmail-jdk14", "bcprov-jdk14", "bctsp-jdk14" } compile "org.jrobin:jrobin:1.5.9" } plugins { compile ":grails-melody:1.21" } I saw a few bugs open in Grails JIRA that might be related to what I was experiencing and was resolved in 2.x https://jira.grails.org/browse/GRAILS-7608
accepted answer of: http://stackoverflow.com/q/24826062
type: AcceptedAnswer

http://stackoverflow.com/comment/38507638
comment on: http://stackoverflow.com/a/24807150
type: AnswerComment
has text: Assuming Android even has that setting, I'm suggesting he experiment running his app with that JVM argument. That argument controls how much memory OpenCV's native code will have to run in, not the heap. At least that's how it works with Oracles JVM.
score: 0
type: Comment

http://stackoverflow.com/a/24824522
answers question: http://stackoverflow.com/q/24822839
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24822839
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: You can make it so a TextArea is not editable. JTextArea ta = new JTextArea(); ta.setEditable(false); You may also want to look into using a JTextPane.
has comment: http://stackoverflow.com/comment/38540912

http://stackoverflow.com/a/24889503
accepted answer of: http://stackoverflow.com/q/24882946
has comment: http://stackoverflow.com/comment/38663487
answers question: http://stackoverflow.com/q/24882946
downvote count: 0
has comment: http://stackoverflow.com/comment/38665721
has comment: http://stackoverflow.com/comment/38673198
score: 11
has comment: http://stackoverflow.com/comment/38665165
upvote count: 11
has comment: http://stackoverflow.com/comment/38665679
has comment: http://stackoverflow.com/comment/38663575
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38673173
has comment: http://stackoverflow.com/comment/38664957
has body: Preamble: Writing microbenchmarks manually is almost always doomed to a failure. There are frameworks that have already solved the common benchmarking problems. JIT compilation unit is a method. Incorporating several benchmarks into a single method leads to unpredictable results. JIT heavily relies on the execution profile, i.e. the run-time statistics. If a method runs the first scenario for a long time, JIT will optimize the generated code for it. When the method suddenly switches to another scenario, do not expect it to run at the same speed. JIT may skip optimizing the code that is not executed. It will leave an uncommon trap for this code. If the trap is ever hit, JVM will deoptimize the compiled method, switch to interpreter and after that recompile the code with the new knowledge. E.g. when your method run is compiled for the first time inside the first hot loop, JIT does not know about System.out.println yet. As soon as the execution reaches println, the earlier compiled code is likely to get deoptimized. The bigger is method - the harder is to optimize it for JIT compiler. E.g. it may appear that there is not enough spare registers to hold all local variables. That's what happen in your case. To sum it up, your benchmark seem to pass through the following scenario: The first hot loop (addStatic) triggers the compilation of run method. The execution profile does not know anything except addStatic method. System.out.println triggers the deoptimization and after that the second hot loop (addDynamic) leads to recompilation of run method. Now the execution profile contains information only about addDynamic, so JIT optimizes the second loop, and the first loop appears to have extra register spills: Optimized loop: 0x0000000002d01054: add %rbx,%r14 0x0000000002d01057: add $0x1,%rbx ;*ladd ; - TestPerformanceOfStaticVsDynamicCalls::addDynamic@2 ; - TestPerformanceOfStaticVsDynamicCalls::run@105 0x0000000002d0105b: add $0x1,%r14 ; OopMap{rbp=Oop off=127} ;*goto ; - …
type: Answer

http://stackoverflow.com/comment/38402134
comment on: http://stackoverflow.com/q/24751889
type: Comment
type: QuestionComment
has text: Use `interfaces` and aggregation. Otherwise (although not recommended) you can use multilevel inheritance.
score: 0

http://stackoverflow.com/a/66231604
upvote count: 0
has body: #include &lt;bits/stdc++.h&gt; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int sm=100,lr=999,ans=0; for(int i=sm;i&lt;=lr;i++) //for every number we traverse and find its // product with other number { for(int j=sm;j&lt;=lr;j++) { int pro=i*j; //find product of number string str=to_string(pro); // convert to string string rev = string(str.rbegin(),str.rend()); //reverse it if(str==rev) //check it with { //string it is equal or // with reverse ans=max(ans,pro);} //storing only max value if it satisfy the //condition } } cout&lt;&lt;ans; // ans is 906609 return 0; }
score: -1
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/117099596
answers question: http://stackoverflow.com/q/24772179

http://stackoverflow.com/q/24824044
score: -2
has answer: http://stackoverflow.com/a/24826691
linked to: http://stackoverflow.com/q/22202822
favorite count: 0
has comment: http://stackoverflow.com/comment/38543719
linked to: http://stackoverflow.com/q/3504642
upvote count: 2
accepted answer: http://stackoverflow.com/a/24824174
has comment: http://stackoverflow.com/comment/38537822
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 4
has title: Whats the logic to print the truth table values given the x in 2^x?
tagged with: algorithm
has comment: http://stackoverflow.com/comment/38537994
has body: given x=2 rows= pow(2,2)=4 and colums=2 output: T T T F F T F F x=3 rows= pow(2,3)=8 and colums=8 output: T T T T T F T F T T F F F T T F T F F F T F F F and so on. it could be to print like this or to create an char array with 2^x rows and x columns and with T/F as values. I can think of it as for say column number j - change should occur after pow(2,x-(j+1)) thanks; pseudo code or java is preferred
has answer: http://stackoverflow.com/a/24824268
has answer: http://stackoverflow.com/a/24824174
tagged with: logic
has comment: http://stackoverflow.com/comment/38538036
answer count: 3
has comment: http://stackoverflow.com/comment/38538031
linked to: http://stackoverflow.com/q/4221258
has comment: http://stackoverflow.com/comment/38537829
possible better answer: http://stackoverflow.com/a/24826691

http://stackoverflow.com/q/24795388
tagged with: java
type: Question
upvote count: 0
has title: Can we limit records by using named queries?
answer count: 1
favorite count: 0
has body: There are about 20000 records in my DB but I only want to fetch 500 records at a time. I am using named queries for fetching data. So, how can I put a limit to named queries? I tried like this, @NamedQuery(name = "qryChildEventByOrganization", query = "select childEvent from ChildEvent childEvent limit 500" + "left outer join fetch childEvent.child as ceChild " + "left outer join fetch ceChild.address as address " + "left outer join fetch ceChild.user as cuser " + "left outer join fetch childEvent.user as ceuser " + "left outer join fetch cuser.address as caddress " + "left outer join fetch ceuser.address as ceaddress " + "left outer join fetch ceChild.immunization as cimmunization " + "left outer join fetch ceChild.insurance as cinsurance " + "left outer join fetch ceChild.healthHistory as chealthHistory " + "left outer join fetch ceChild.emergencyContact as cemergencyContact " + "left outer join fetch ceChild.doctor as cdoctor " + "left outer join fetch ceChild.dietActivityRestriction as cdietActivityRestriction " + "left outer join fetch ceChild.allergy as cAllergy " + "left outer join fetch ceChild.medication as cMedication " + "left outer join fetch ceChild.provider as cProvider " + "left join fetch childEvent.event as ceEvent " + "left join fetch ceEvent.organization as eOrganization " + "left join fetch eOrganization.address as oAddress " + "left outer join fetch ceChild.childEvent as cChildEvent " + "left join fetch cChildEvent.event as ceEventChildCe " + "left join fetch ceEventChildCe.organization as eCeOrganization " + "left join fetch eCeOrganization.address as oCeAddress " + "left outer join fetch cChildEvent.child as cCEChild " + "left outer join fetch cCEChild.address as address " + "left outer join fetch cCEChild.user as cuser " + "left outer join fetch cuser.address as ceaddress " + "left outer join fetch cCEChild.immunization as cimmunization " + "left outer join fetch cCEChild.insurance as cinsurance " + "left outer join fetch cCEChild.healthHisto…
has answer: http://stackoverflow.com/a/24795469
has comment: http://stackoverflow.com/comment/38484476
type: UnansweredQuestion
downvote count: 3
score: -3

http://stackoverflow.com/q/24812755
has comment: http://stackoverflow.com/comment/38623220
has comment: http://stackoverflow.com/comment/38616666
has comment: http://stackoverflow.com/comment/38550564
type: Question
tagged with: openssl
has title: SSL Handshake_failure in Java test client while connecting to server with two-way authentication
has body: I've been stuck for a couple of days now, and I've checked several answers already ( this, this, this, this, this, this, this, this ), but I haven't been able to solve my problem. I'm new to SSL, and there does not appear to be anyone else in my organization who has done this. Background We currently have a set of terminals in retailer outlets connecting to a server via SSL. The connection includes client authentication. My organization is acting as a CA and has issued a cacert.crt certificate and used it to sign a certificate for the server and one certificate for all of the client terminals. The terminals currently work correctly with the server, but I'm unable to get detailed information about the current connection or configuration from the people who support the environment... It appears that the system was purchased years ago from a combination of vendors, and the knowledge has been lost. I'm currently trying to develop a separate client that can communicate with the server outside of the existing terminals. Problem I've developed a very simple Java SSL client in order to better understand the SSL configuration and learn where and how the certificates and keys need to be referenced in order to connect. Unfortunately, I've been unable to connect successfully to the server, and I'm not sure what is wrong or what else to check. I've been able to produce a debug log of the SSL connection (attached below). I've also been able to produce a log from running openssl's s_client function, but I'm not familiar with the tool and so I'm not sure what it's telling me. I've attached all of the code and logs, and I'm hoping you can provide me with some insight on what the problem is. Since I'm new to SSL, I'm not sure if I've provided all of the pertinent information. Please let me know if you need any further information. Simple Java Client public class Client { private static String serverIP = "{snip: server IP}"; private static int serverPort = {snip: port number}; public …
downvote count: 0
has comment: http://stackoverflow.com/comment/38554551
linked to: http://stackoverflow.com/q/4738397
has comment: http://stackoverflow.com/comment/38577981
has comment: http://stackoverflow.com/comment/38620631
accepted answer: http://stackoverflow.com/a/24868894
linked to: http://stackoverflow.com/q/6353849
answer count: 1
has comment: http://stackoverflow.com/comment/38555126
linked to: http://stackoverflow.com/q/16801547
linked to: http://stackoverflow.com/q/21704989
favorite count: 0
has comment: http://stackoverflow.com/comment/38550161
linked to: http://stackoverflow.com/q/2159586
score: 6
linked to: http://stackoverflow.com/q/11047100
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38624501
has comment: http://stackoverflow.com/comment/38625886
linked to: http://stackoverflow.com/q/10108654
tagged with: java
has answer: http://stackoverflow.com/a/24868894
linked to: http://stackoverflow.com/q/15212263
tagged with: ssl
tagged with: authentication

java-native-interface
tags question: http://stackoverflow.com/q/24875905
tags question: http://stackoverflow.com/q/24884142
tags question: http://stackoverflow.com/q/24826617
tags question: http://stackoverflow.com/q/24869389
tags question: http://stackoverflow.com/q/24793593
tags question: http://stackoverflow.com/q/24883056
tags question: http://stackoverflow.com/q/24796534
tags question: http://stackoverflow.com/q/24869502
type: Tag
tag name: java-native-interface
tags question: http://stackoverflow.com/q/24882809
tags question: http://stackoverflow.com/q/24845811
tags question: http://stackoverflow.com/q/24754375
tags question: http://stackoverflow.com/q/24864166
tags question: http://stackoverflow.com/q/24872597
tags question: http://stackoverflow.com/q/24789988
tags question: http://stackoverflow.com/q/24803697
tags question: http://stackoverflow.com/q/24867307
tags question: http://stackoverflow.com/q/24834746

http://stackoverflow.com/a/24789116
has body: It depends on how the user enters the information. If they input "knife, pistol, key" you would interpret that differently than "knife pistol key." If you would like to do it that way, look into using the split function. So, if you wanted to split the first way, it would go something like this: String[] items = threeItems.split(", "); where items[0] = "knife", the first thing they wrote, items[1] would equals "pistol", etc. However, it might be better to clarify how the user should enter the input so you don't need to deal with a bunch of edge cases on how the user might format their input. You could have a new line for each item, like this: System.out.print("First Item: "); String first = s.next(); System.out.println(); System.out.print("Second Item: "); String first = s.next(); System.out.println(); System.out.print("Third Item: "); String first = s.next(); System.out.println(); The user enters an item on each line, and now you have their inputs in three seperate variables. This reduces the variability on how the user may enter information and allow for a cleaner, less-error prone game.
has comment: http://stackoverflow.com/comment/38473779
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24788918

http://stackoverflow.com/a/41873146
downvote count: 0
answers question: http://stackoverflow.com/q/24810805
has body: To solve: java.security.spec.InvalidKeySpecException: key spec not recognised Modify security providers: sudo nano $JAVA_HOME/jre/lib/security/java.security Add security provider: security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider Copy bcprov-jdk15on-1.54.jar to: $JAVA_HOME/jre/lib/ext/bcprov-jdk15on-1.54.jar Restart Tomcat.
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/a/24792698
type: Answer
has body: You have to upload your php script to your server : Ex : Your php is in : myserver.com/myscript.php In your Android app, You post your variables, and you connect your php script with HttpClient : URL_TO_YOUR_SCRIPT = "myserver.com/myscript.php"; ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("userId", userId)); HttpClient httpclient = new DefaultHttpClient(); // specify the URL you want to post to HttpPost httppost = new HttpPost(URL_TO_YOUR_SCRIPT); try { // create a list to store HTTP variables and their values httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); HttpResponse response = httpclient.execute(httppost); StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpURLConnection.HTTP_OK) { HttpEntity getResponseEntity = response.getEntity(); return getResponseEntity.getContent(); } else { Log.e("ERROR", statusLine.getStatusCode() + ""); HttpEntity getResponseEntity = response.getEntity(); return getResponseEntity.getContent(); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } In your php : &lt;? $userId=$_REQUEST['userId']; .... // in general you return a json string to get status and result ?&gt;
score: 0
answers question: http://stackoverflow.com/q/24792659

http://stackoverflow.com/comment/38628139
has text: Are you saying java class is trying to find the yes.txt in my local system ? All the files are present in the remote system. The directory and login are same.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24871442

http://stackoverflow.com/a/24901450
score: 0
has body: That is just a warning. You can use @SuppressWarnings to avoid it if you feel uncomfortable, provided your app is not meant for multi languages OR You can use : toLowerCase(Locale.getDefault()); to avoid this warning. Make sure to import import java.util.Locale; EDIT Hope below code will help you: ArrayList&lt;JSONObject&gt; array = new ArrayList&lt;JSONObject&gt;(); JSONArray jsonArray = new JSONArray(); for (int i = 0; i &lt; jsonArray.length(); i++) { try { JSONObject c = jsonArray.getJSONObject(i); if(c.getString("category_id").equals("1") { // Adding to array. Only items with category_id = 1 will be sorted. array.add(jsonArray.getJSONObject(i)); // This line is important // All other stuff here..... String item_id = c.getString(TAG_ITEM_ID); // tmp hashmap for single contact HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;(); // adding each child node to HashMap key =&gt; value contact.put(TAG_ITEM_ID, item_id); // adding contact to contact list foodslist.add(contact); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Collections.sort(array, new Comparator&lt;JSONObject&gt;() { @Override public int compare(JSONObject lhs, JSONObject rhs) { // TODO Auto-generated method stub try { return (lhs.getString("Name").toLowerCase(Locale.getDefault()).compareTo(rhs.getString("Name").toLowerCase(Locale.getDefault()))); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); return 0; } } }); EDIT AGAIN if (jsonStr != null) { try { ArrayList&lt;JSONObject&gt; array = new ArrayList&lt;JSONObject&gt;(); JSONArray jsonArray = new JSONArray(); // looping through All Contacts for (int i = 0; i &lt; foods.length(); i++) { try { JSONObject c = foods.getJSONObject(i); if(c.getString("category_id").equals("1")) { // Adding to array. Only items with category_id = 1 will be sorted. array.add(foods.getJSONObject(i)); // This line is important String item_id = c.getString(TAG_ITEM_ID); // tmp h…
has comment: http://stackoverflow.com/comment/38689504
has comment: http://stackoverflow.com/comment/38686472
has comment: http://stackoverflow.com/comment/38687125
type: Answer
has comment: http://stackoverflow.com/comment/38686632
has comment: http://stackoverflow.com/comment/38686904
has comment: http://stackoverflow.com/comment/38689905
has comment: http://stackoverflow.com/comment/38689017
has comment: http://stackoverflow.com/comment/38688408
has comment: http://stackoverflow.com/comment/38684838
has comment: http://stackoverflow.com/comment/38684904
has comment: http://stackoverflow.com/comment/38688042
has comment: http://stackoverflow.com/comment/38688816
has comment: http://stackoverflow.com/comment/38687898
has comment: http://stackoverflow.com/comment/38684893
answers question: http://stackoverflow.com/q/24901431
has comment: http://stackoverflow.com/comment/38689917
has comment: http://stackoverflow.com/comment/38686011

http://stackoverflow.com/q/24802155
has comment: http://stackoverflow.com/comment/38498381
has answer: http://stackoverflow.com/a/24802316
has comment: http://stackoverflow.com/comment/38496719
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24802266
tagged with: generics
possible better answer: http://stackoverflow.com/a/24802316
has comment: http://stackoverflow.com/comment/38497848
type: Question
has comment: http://stackoverflow.com/comment/38496636
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38496652
has body: I have a class ShapeDescriber that looks like this: public class ShapeDescriber&lt;T extends Shape&gt; { public void describe(T shape) { System.out.println("Its color is " + shape.getColor()); } } I use T so that subclasses can do something like: public class CircleDescriber&lt;T extends Circle&gt; extends ShapeDescriber&lt;T&gt; { public void describe(T circle) { super.describe(circle); System.out.println("Its radius is " + circle.getRadius()); } } Ultimately, I want this Describer type hierarchy to match the type hierarchy of my model. The problem that I run into, is that inside the CircleDescriber, I can't pass a Circle to my describe() method! When I try this: public class CircleDescriber ... { ... public void printATest() { Circle c = new Circle(Colors.GREEN, 10); this.describe(c); } } There's a compilation error on my describe() call, because: The method describe(T) in the type CircleDescriber&lt;T&gt; is not applicable for the arguments (Circle) Wait. What? I feel like this class knows that every instance of a T will be a subclass of Circle, no? Edit: I have created a Gist here for easy copypasting: https://gist.github.com/craigotis/135f88b1ce8beca07400 Note the above Gist will fail to compile.
has comment: http://stackoverflow.com/comment/38496856
accepted answer: http://stackoverflow.com/a/24802266
tagged with: java
has comment: http://stackoverflow.com/comment/38497216
has title: Providing concrete class instance to generic method accepting T, where T extends concrete class

http://stackoverflow.com/comment/38570234
comment on: http://stackoverflow.com/a/24841225
score: 0
type: AnswerComment
type: Comment
has text: @Braj Disables or enables decorations for this frame.

http://stackoverflow.com/q/24773565
type: UnansweredQuestion
tagged with: selenium
type: Question
has title: Selenium Automation for Firefox
tagged with: java
tagged with: eclipse
score: 0
answer count: 1
has body: I am new to selenium automation. I have installed Selenium IDE and selenium RC ( java -jar selenium.jar) as administrator in the system. Also I am using Eclipse SDK version 3.7.1. Getting below error on compiling code (Run As -> TestNG Test) package com.test.webdriver; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; import org.testng.annotations.Test; public class Driver { @Test //This is TestNG annotation public void testRegister() { WebDriver driver = new FirefoxDriver(); driver.get("http://newtours.demoaut.com/"); driver.findElement(By.linkText("REGISTER")).click(); driver.findElement(By.name("firstName")).sendKeys("User1"); driver.findElement(By.name("lastName")).sendKeys("Surname1"); driver.findElement(By.name("phone")).sendKeys("123456789"); driver.findElement(By.name("userName")).sendKeys("user1@test.com"); driver.findElement(By.name("address1")).sendKeys("Test Address"); driver.findElement(By.name("city")).sendKeys("Test City"); Select select = new Select(driver.findElement(By.name("country"))); select.selectByVisibleText("ANGOLA"); driver.findElement(By.name("email")).sendKeys("user1@test.com"); driver.findElement(By.name("password")).sendKeys("user1"); driver.findElement(By.name("confirmPassword")).sendKeys("user1"); driver.findElement(By.name("register")).click(); driver.close(); driver.quit(); } } Selenium RC version is 2.42.2 and firefox version 23.0 Error: FAILED: testRegister org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms Build info: version: '2.19.0', revision: '15849', time: '2012-02-08 16:12:19' System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_25' Driver info: driver.version: Driver at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:95) at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConne…
has answer: http://stackoverflow.com/a/24773933

http://stackoverflow.com/comment/69249844
has text: I just had the same problem and it is definitely a thread safety issue.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24848977

http://stackoverflow.com/comment/38530361
comment on: http://stackoverflow.com/q/24818802
has text: Does the first case really work? There is no mapping matching `second`, there is only one matching `main/second`, am I wrong?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24904888
has answer: http://stackoverflow.com/a/24904970
has title: JavaMail and Gmail account suspended
favorite count: 0
type: UnansweredQuestion
tagged with: gmail
tagged with: java
has comment: http://stackoverflow.com/comment/38720701
downvote count: 1
has body: I have a java program that send the output via email with attached the configuration file. For this work I have registered an email on Gmail and I self-send the output from and to this email address. Now google have suspended my account. What i can do now? there is free email that i can configure with Java mail and that does not give me problems of this kind?
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/38691154
score: -1
tagged with: jakarta-mail
answer count: 1

http://stackoverflow.com/a/24799321
has comment: http://stackoverflow.com/comment/38493151
has comment: http://stackoverflow.com/comment/38496347
type: Answer
accepted answer of: http://stackoverflow.com/q/24789291
has comment: http://stackoverflow.com/comment/38499562
answers question: http://stackoverflow.com/q/24789291
has body: Code is mostly correct. The reducer implementation has to be modified slightly. The below code snipper creating the problem for(Iterator&lt;Text&gt; it = values; it.hasNext();) { // add the values in the arrayList dateList.add((Text) it.next()); } In the above code snippet same value object is used in each itreation, only their contents are being changed. For example, Assume Mapreduce run with following input PRAVEEN,4002013454,Baby,026A12,12/04/2015 PRAVEEN,4002013454,TOY,020383,1/04/2014 PRAVEEN,2727272727272,BOOK,03383,03/14/2013 PRAVEEN,2263637373,BIKE,7373737,12/24/2012 In the reduce method 'dateList' object elemets has values (12/24/2012, 12/24/2012, 12/24/2012, 12/24/2012) after the for loop completion on the values. This leads to incorrect execution of the remaining code and final output is wrong. Instead you change code as below public static class Reduce extends MapReduceBase implements Reducer&lt;Text, Text, Text, Text&gt; { public void reduce(Text key, Iterator&lt;Text&gt; values, OutputCollector&lt;Text, Text&gt; output, Reporter reporter) throws IOException { SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); Date date = new Date(); //-----Modified section START----------- List&lt;String&gt; dateList = new ArrayList&lt;String&gt;(); for(Iterator&lt;Text&gt; it = values; it.hasNext();) { // add the values in the arrayList dateList.add(((Text)it.next()).toString()); } //----Modified section END-------------- if(dateList.size()==1){ //If the mapper output has only one date , then select that date // as the VALUE try { date = formatter.parse(dateList.get(0).toString()); } catch (ParseException e) { e.printStackTrace(); } } //If part ends else { String str = dateList.get(0).toString(); try { date = formatter.parse(dateList.get(0).toString()); //select the first date from list } catch (ParseException e1) { e1.printStackTrace(); } for(int i=0 ; i &lt;dateList.size();++i){ try { //compare the selected date with the rest of the dates in the list. …
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/38548872
score: 0
comment on: http://stackoverflow.com/q/24828014
has text: all the machines are on Java 7; plus, I would be very surprised if Java had this backward incompatibility with 7...
type: QuestionComment
type: Comment

servlets
tags question: http://stackoverflow.com/q/24883154
tags question: http://stackoverflow.com/q/24884967
tags question: http://stackoverflow.com/q/24842754
tags question: http://stackoverflow.com/q/24828020
tags question: http://stackoverflow.com/q/24846178
tags question: http://stackoverflow.com/q/24864354
tags question: http://stackoverflow.com/q/24750572
tags question: http://stackoverflow.com/q/24781383
tags question: http://stackoverflow.com/q/24830318
tags question: http://stackoverflow.com/q/24805826
tags question: http://stackoverflow.com/q/24769878
tags question: http://stackoverflow.com/q/24873691
tags question: http://stackoverflow.com/q/24758359
tags question: http://stackoverflow.com/q/24762311
tags question: http://stackoverflow.com/q/24775599
tags question: http://stackoverflow.com/q/24804579
tags question: http://stackoverflow.com/q/24878118
tags question: http://stackoverflow.com/q/24806992
tags question: http://stackoverflow.com/q/24864035
tags question: http://stackoverflow.com/q/24838284
tags question: http://stackoverflow.com/q/24823483
tags question: http://stackoverflow.com/q/24815873
tags question: http://stackoverflow.com/q/24837424
tags question: http://stackoverflow.com/q/24779529
tags question: http://stackoverflow.com/q/24806357
tags question: http://stackoverflow.com/q/24827787
tags question: http://stackoverflow.com/q/24817238
tags question: http://stackoverflow.com/q/24767852
tags question: http://stackoverflow.com/q/24884347
tags question: http://stackoverflow.com/q/24907311
tags question: http://stackoverflow.com/q/24777242
tags question: http://stackoverflow.com/q/24796334
tags question: http://stackoverflow.com/q/24764765
tags question: http://stackoverflow.com/q/24779441
tags question: http://stackoverflow.com/q/24799871
tags question: http://stackoverflow.com/q/24795864
tags question: http://stackoverflow.com/q/24845753
tags question: http://stackoverflow.com/q/24853071
tags question: http://stackoverflow.com/q/24883982
tags question: http://stackoverflow.com/q/24793964
tags question: http://stackoverflow.com/q/24849700
tags question: http://stackoverflow.com/q/24827026
tags question: http://stackoverflow.com/q/24772409
tags question: http://stackoverflow.com/q/24807954
tags question: http://stackoverflow.com/q/24893032
tags question: http://stackoverflow.com/q/24859569
tags question: http://stackoverflow.com/q/24852315
tags question: http://stackoverflow.com/q/24772433
tags question: http://stackoverflow.com/q/24832470
tags question: http://stackoverflow.com/q/24903392
tags question: http://stackoverflow.com/q/24871661
tags question: http://stackoverflow.com/q/24875452
tags question: http://stackoverflow.com/q/24837236
tags question: http://stackoverflow.com/q/24819962
tags question: http://stackoverflow.com/q/24833851
tags question: http://stackoverflow.com/q/24768824
tags question: http://stackoverflow.com/q/24868174
tags question: http://stackoverflow.com/q/24863443
tags question: http://stackoverflow.com/q/24874203
tags question: http://stackoverflow.com/q/24756321
tags question: http://stackoverflow.com/q/24880768
tags question: http://stackoverflow.com/q/24821263
tags question: http://stackoverflow.com/q/24858514
tags question: http://stackoverflow.com/q/24759551
tags question: http://stackoverflow.com/q/24772447
tags question: http://stackoverflow.com/q/24757542
tags question: http://stackoverflow.com/q/24804028
tags question: http://stackoverflow.com/q/24836493
tags question: http://stackoverflow.com/q/24840475
tags question: http://stackoverflow.com/q/24883364
tags question: http://stackoverflow.com/q/24833609
tags question: http://stackoverflow.com/q/24768488
tags question: http://stackoverflow.com/q/24813346
tags question: http://stackoverflow.com/q/24889141
tags question: http://stackoverflow.com/q/24774138
tags question: http://stackoverflow.com/q/24763307
tags question: http://stackoverflow.com/q/24821522
tags question: http://stackoverflow.com/q/24755146
tags question: http://stackoverflow.com/q/24868826
tags question: http://stackoverflow.com/q/24814177

http://stackoverflow.com/q/24830891
linked to: http://stackoverflow.com/q/22288868
tagged with: android
tagged with: scala
has answer: http://stackoverflow.com/a/35868947
type: AnsweredQuestion
has title: Retrofit HTTP reporting "HTTP method annotation is required" in Scala code on Android
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24832903
type: Question
answer count: 2
upvote count: 1
downvote count: 0
possible better answer: http://stackoverflow.com/a/35868947
has answer: http://stackoverflow.com/a/24832903
favorite count: 0
has body: I'm running into an issue where the Retrofit library is recognizing the method but not its annotations. It's reporting the error message in the title above. (Background: I'm using SBT with the sbt-android-plugin and Retrofit 1.6.1) My code is like so: private trait MyService { @GET("/api/test") def test(): Observable[Any] } object MyService { private val restAdapter = new RestAdapter.Builder().setEndpoint("http://somewhere").build() val service = restAdapter.create(classOf[MyService]) service.test().subscribe(/* you get the idea */) // This line throws a RuntimeException with message in title above } There's a very similar example scattered around GitHub apparently from the Reactive principles course, e.g. here. Suffice it to say, my setup is the same. When I step through RestMethodInfo.parseMethodAnnotations(), the requestMethod variable is indeed null, the requestType is SIMPLE. If I add the @FormUrlEncoded annotation to my test method, the requestType is still set to SIMPLE. Any ideas on what could be causing this?
tagged with: retrofit

http://stackoverflow.com/comment/38580608
score: 0
type: AnswerComment
has text: Seriously? You know how to implement the mousePressed() and mouseClicked() methods, what is so difficult about implementing the mouseReleased() method? You just said you know how to get the location and write it to a file, so what is the problem?
type: Comment
comment on: http://stackoverflow.com/a/24846738

http://stackoverflow.com/q/24814174
score: 0
has answer: http://stackoverflow.com/a/24828090
has title: Include parameters for spring shell before method
tagged with: spring-shell
tagged with: spring
type: AnsweredQuestion
tagged with: java
has body: I am working on a Spring Shell project. The tool is a command line tool to manipulate data in a database. There are commands like add user (which adds a record to a table in database). In order to execute any commands the user of the tool has to be connected to the database. I would like to be able to run this all in one line. The user of my tool should be able to write a command like the following. --database connection string xyz --username abc --password mno add user --username bob --role AA_ADMIN --company Microsoft Here the three parameters database connection string, username and password are required to run the add user command. Below I have included some sample code it is from the spring shell reference docs package commands; import org.springframework.shell.core.CommandMarker; import org.springframework.shell.core.annotation.CliAvailabilityIndicator; import org.springframework.shell.core.annotation.CliCommand; import org.springframework.shell.core.annotation.CliOption; import org.springframework.stereotype.Component; @Component public class UserManipulation implements CommandMarker { private boolean simpleCommandExecuted = false; @CliAvailabilityIndicator({"hw simple"}) public boolean isSimpleAvailable() { //always available return true; } @CliAvailabilityIndicator({"hw complex", "hw enum"}) public boolean isComplexAvailable() { if (simpleCommandExecuted) { return true; } else { return false; } } @CliCommand(value = "hw simple", help = "Print a simple hello world message") public String simple( @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message, @CliOption(key = { "location" }, mandatory = false, help = "Where you are saying hello", specifiedDefaultValue="At work") final String location) { simpleCommandExecuted = true; return "Message = [" + message + "] Location = [" + location + "]"; } @CliCommand(value = "hw complex", help = "Print a complex hello world message") public String hello( @CliOption(key = …
type: Question
accepted answer: http://stackoverflow.com/a/24828090
answer count: 1

http://stackoverflow.com/comment/38445422
type: Comment
comment on: http://stackoverflow.com/a/24770315
has text: hi same way have in hierarchy classes, any structure is possible. Give me a example of JSON exactly what you need will update the code.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24816920
answer count: 1
has title: How to identify guest user using Spring Security
downvote count: 0
has comment: http://stackoverflow.com/comment/38529580
has comment: http://stackoverflow.com/comment/77759613
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/45455605
tagged with: encryption
tagged with: spring
has comment: http://stackoverflow.com/comment/110704377
has body: My website is an e-commerce where users can add items to their carts. Each user has a cart even if he/she doesn't login (i.e. a guest user). I would like to identify the guest users by put some kind of key to their cookies. I wonder if Spring Framework can handle this already? If that is not the case, I have to implement it myself but I am not sure about the key to put in the cookies. I know about HMAC but the key need to be unique, right? What is the algorithm should I use to generate the key in this case?
score: 2
tagged with: cookies
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38530821
linked to: http://stackoverflow.com/q/51045564

http://stackoverflow.com/comment/38541887
comment on: http://stackoverflow.com/q/24825804
has text: @Haresh , does it guarantee that the random NPE's will stop??
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24860721
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
type: Question
has body: I ask you for help because for a long time I'm trying to find the solution to this code ... I have a txt of gps track like this. WGS 84; U 1; C 255,0,0,2,-1.0; L -02:00:00 V 0.0 0.0 0 0 0 0 0.0 -1.0 0 E 0|1|00-NUL-00 00:00:00|00:00:00|0|2984 i I00 z 12.716222,42.410293,12.736302,42.449607 T A 42.41060087ºN 12.72081354ºE 25-SEP-08 07:13:34 N 841.8 0.0 0.0 0.0 0 -1000.0 9999999562023526400000000.0 -1 -1.0 -1.0 T A 42.41060045ºN 12.72082259ºE 25-SEP-08 07:13:39 s 842.7 0.0 0.0 0.0 0 -1000.0 9999999562023526400000000.0 -1 -1.0 -1.0 T A 42.41060296ºN 12.72083248ºE 25-SEP-08 07:13:44 s 842.3 0.0 0.0 0.0 0 -1000.0 9999999562023526400000000.0 -1 -1.0 -1.0 ` I need to import this coordinates ..into database of this format ... { TracksDB tracksDB = new TracksDB(context); TrackPointsDB trackPointsDB = new TrackPointsDB(context); tracksDB.open(); trackPointsDB.open(); File file = new File(path); ObjectInputStream in = new ObjectInputStream(new FileInputStream(file)); int count = 0; try { Track track; while ((track = (Track) in.readObject()) != null) { long id = tracksDB.insert(track.getName()); ArrayList&lt;TrackPoint&gt; points = track.getTrackPoints(); for (TrackPoint point : points) { trackPointsDB.insert(id, point.getLongitude(), point.getLatitude(), point.getAltitude(), point.getAccuracy(), Long.toString(point.getTime())); } count++; } } catch (EOFException eof) { } // !// finally? in.close(); tracksDB.close(); trackPointsDB.close(); return count; } I try to open a track file but I do not undestand how to create a db with same of import procedure ..please help! Thanks
downvote count: 0
tagged with: sql
has answer: http://stackoverflow.com/a/24860802
answer count: 1
has title: Import data from an txt file to android database
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/38568201
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24826922
has text: Wanted to use KDF as suggested by Owlstead Any info on KDF using sha-256 implementaions on java or bouncy castle.Didnt find much info even after long hours of trying

http://stackoverflow.com/q/24806421
has answer: http://stackoverflow.com/a/24807229
has comment: http://stackoverflow.com/comment/38504697
answer count: 1
has comment: http://stackoverflow.com/comment/38504739
favorite count: 0
has comment: http://stackoverflow.com/comment/38504752
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38504800
has comment: http://stackoverflow.com/comment/38504683
has body: I am writing a regularExpression to validate FileName some thing like this "GktAb_140715T1015.txt". PLease provide regEx to validate File name
upvote count: 0
score: -5
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38504880
has comment: http://stackoverflow.com/comment/38504630
has title: regEx to validate File name "GktAb_140715T1015.txt"

http://stackoverflow.com/q/24871892
linked to: http://stackoverflow.com/q/2949203
has comment: http://stackoverflow.com/comment/38629212
has comment: http://stackoverflow.com/comment/38630243
linked to: http://stackoverflow.com/q/4616383
has answer: http://stackoverflow.com/a/63587209
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38629817
has comment: http://stackoverflow.com/comment/38629800
has comment: http://stackoverflow.com/comment/38630018
has body: I've seen the answers provided [here] (Formatting XML file using StAX) and [here] (merge XML using STAX XMLStreamWriter) In both cases it did not work. In both cases it was because my IDE, netbeans, doesn't recognize the methods as valid. This is driving me crazy. thanks in advance for your help. Here's the code that doesn't work, I'm simply trying to wrap my writer in an IndentingWriter. XMLOutputFactory outputFactory = XMLOutputFactory.newFactory(); XMLEventWriter writer = null; try { writer = outputFactory .createXMLEventWriter(new FileOutputStream(args[1]), "UTF-8"); writer = new IndentingXMLEventWriter(writer); } catch (XMLStreamException ex) { Logger.getLogger(XMLReader.class.getName()).log(Level.SEVERE, null, ex); } Here is a list of my imports: import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Iterator; import java.util.logging.Level; import java.util.logging.Logger; import java.util.StringTokenizer; import javax.xml.stream.XMLEventFactory; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.Characters; import javax.xml.stream.events.EndElement; import javax.xml.stream.events.StartDocument; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent;
score: 0
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/38630352
answer count: 1
has title: How to add newlines to an XML file being written by XMLEventWriter
has comment: http://stackoverflow.com/comment/38630285
tagged with: http://stackoverflow.com/tag/xml
tagged with: stax
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21724468

http://stackoverflow.com/q/24861733
accepted answer: http://stackoverflow.com/a/24883984
tagged with: java
linked to: http://stackoverflow.com/q/12639280
tagged with: selenium
has comment: http://stackoverflow.com/comment/38609616
type: Question
has comment: http://stackoverflow.com/comment/38651409
has comment: http://stackoverflow.com/comment/38610309
has body: I have a scenario in which clicking on "Save" button can give three different alerts based on the data entered. It can give "Saved successfully", "User already registered" and "Username already exist" alerts. I have tried: driver.findElement(By.id("dnn_ctr5995_View_btnsavesession")).click(); Thread.sleep(10000); Alert alert = driver.switchTo().alert(); String A = alert.getText(); if (A == "Username already exist"){ System.out.println("Admission number already exist."); alert.accept(); } else if (A == "User already registered"){ System.out.println("User already registered"); alert.accept(); } else if (A == "Saved Successfully."){ System.out.println("Saved Successfully."); alert.accept(); } But it is showing No Alert present exception. I have tried increasing the sleep time but still it shows the same exception.
has comment: http://stackoverflow.com/comment/38610551
score: 0
has comment: http://stackoverflow.com/comment/38655020
answer count: 3
has comment: http://stackoverflow.com/comment/38612551
has answer: http://stackoverflow.com/a/24883984
possible better answer: http://stackoverflow.com/a/24866146
has comment: http://stackoverflow.com/comment/38647518
has answer: http://stackoverflow.com/a/24866146
has title: Handling alerts in Selenium
has answer: http://stackoverflow.com/a/24866363
has comment: http://stackoverflow.com/comment/38644793
has comment: http://stackoverflow.com/comment/38648928
has comment: http://stackoverflow.com/comment/38609907
tagged with: selenium-webdriver
type: AnsweredQuestion

http://stackoverflow.com/a/24765529
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38428259
has comment: http://stackoverflow.com/comment/38427757
type: Answer
has comment: http://stackoverflow.com/comment/38427590
has comment: http://stackoverflow.com/comment/38427716
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38427650
accepted answer of: http://stackoverflow.com/q/24765410
has comment: http://stackoverflow.com/comment/38427746
answers question: http://stackoverflow.com/q/24765410
has body: Don't generate your xml to a String or Writer. Generate the xml to bytes and write the bytes directly to a file (or generate directly to a file). By generating the xml to a String/Writer, you are generating the xml using the platform default character encoding. In general, you should use "utf-8" unless you have a really good reason not to (which is generally what the xml library will do on it's own if you write to a OutputStream instead of a Writer).

http://stackoverflow.com/a/51239088
score: 4
answers question: http://stackoverflow.com/q/24765193
has body: go to any IntelliJ Decompiled .class file of any library. as shown in image attached here. you will notice Intellij is giving you 2 options Choose source - From Directory Download - from Maven
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/38645243
comment on: http://stackoverflow.com/a/24880331
score: 0
type: AnswerComment
type: Comment
has text: Thanks @Steven, but you can not do this, ArrayList is fail-fast, so you can not iterate using for loop and call remove on it. http://stackoverflow.com/questions/17377407/what-is-fail-safe-fail-fast-iterators-in-java-how-they-are-implemented. You need to iterate using Iterator and then remove use remove.

http://stackoverflow.com/comment/38660563
type: Comment
type: QuestionComment
has text: Is this for some kind of serialisation? If so then there are better ways of doing this in Java.
score: 1
comment on: http://stackoverflow.com/q/24888629

http://stackoverflow.com/a/25625783
accepted answer of: http://stackoverflow.com/q/24760198
type: AcceptedAnswer
downvote count: 0
has body: try adding src/main/java/ in sub directory (in coveralls page indicating the source was not found)
answers question: http://stackoverflow.com/q/24760198
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/24808890
tagged with: directx
has comment: http://stackoverflow.com/comment/38613692
has title: java-Is taking screenshot with JNA allows to capture fullscreen OpenGL/DirectX application?
has body: I want to take screenshots with my Java application in order to record the screen, I success to do it by using Robot and it was working good until I try with fullscreen games. So I decided to use JNA to take screenshot by using the fallowing code that I found here: import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.DataBuffer; import java.awt.image.DataBufferInt; import java.awt.image.DataBufferUShort; import java.awt.image.DirectColorModel; import java.awt.image.Raster; import java.awt.image.WritableRaster; import com.sun.jna.Native; import com.sun.jna.win32.W32APIOptions; import com.sun.jna.platform.win32.WinDef; import com.sun.jna.platform.win32.WinNT; import com.sun.jna.platform.win32.WinGDI; public class JNAScreenShot { public static BufferedImage getScreenshot(Rectangle bounds) { WinDef.HDC windowDC = GDI.GetDC(USER.GetDesktopWindow()); WinDef.HBITMAP outputBitmap = GDI.CreateCompatibleBitmap(windowDC, bounds.width, bounds.height); try { WinDef.HDC blitDC = GDI.CreateCompatibleDC(windowDC); try { WinNT.HANDLE oldBitmap = GDI.SelectObject(blitDC, outputBitmap); try { GDI.BitBlt(blitDC, 0, 0, bounds.width, bounds.height, windowDC, bounds.x, bounds.y, GDI32.SRCCOPY); } finally { GDI.SelectObject(blitDC, oldBitmap); } WinGDI.BITMAPINFO bi = new WinGDI.BITMAPINFO(40); bi.bmiHeader.biSize = 40; boolean ok = GDI.GetDIBits(blitDC, outputBitmap, 0, bounds.height, (byte[]) null, bi, WinGDI.DIB_RGB_COLORS); if (ok) { WinGDI.BITMAPINFOHEADER bih = bi.bmiHeader; bih.biHeight = -Math.abs(bih.biHeight); bi.bmiHeader.biCompression = 0; return bufferedImageFromBitmap(blitDC, outputBitmap, bi); } else { return null; } } finally { GDI.DeleteObject(blitDC); } } finally { GDI.DeleteObject(outputBitmap); } } private static BufferedImage bufferedImageFromBitmap(WinDef.HDC blitDC, WinDef.HBITMAP outputBitmap, WinGDI.BITMAPINFO bi) { WinGDI.BITMAPINFOHEADER bih = bi.bmiHeader; int height = Math.abs(bih.biHeight); fin…
answer count: 0
tagged with: screenshot
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38653323
tagged with: opengl
tagged with: java
type: Question
tagged with: jna
score: 0

http://stackoverflow.com/q/24767749
type: Question
tagged with: java
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/24770951
favorite count: 0
accepted answer: http://stackoverflow.com/a/24770951
has body: How can I achieve something similar to this: &lt;jee:jndi-lookup id="datasSource" jndi-name="jdbc/dataSourceName" expected-type="javax.sql.DataSource" /&gt; &lt;tx:jta-transaction-manager/&gt; Using annotations? @Configuration @EnableTransactionManagement public class AppConfig { @Bean public DataSource dataSource() { // What goes here? } @Bean public PlatformTransactionManager txManager() { // What goes here? } } I've seen a lot of examples with DataSourceTransactionManager and BasicDataSource, but I couldn't find a equivalent annotation driven configuration (that finds the container UserTransaction, etc).
tagged with: spring
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: annotations
has title: Annotation equivalent of <tx:jta-transaction-manager/> for Java EE environments

http://stackoverflow.com/comment/38686537
comment on: http://stackoverflow.com/a/24901455
type: AnswerComment
score: 0
type: Comment
has text: Okay, so I assume that your images and audio need to be stored in `/home/charles/workspace/nevermind/bin`

http://stackoverflow.com/comment/119722751
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24868636
has text: ```mvn spring-boot:run``` helped for spring-boot v2.4.0 on Eclipse 4.19.0
type: AnswerComment

http://stackoverflow.com/q/24863725
tagged with: soap
has title: How to define jaxws-endpoint with Spring annotations?
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
type: Question
tagged with: java
has body: Is it possible to rewrite the following xml soap webservice config to annotation based spring config? &lt;jaxws:endpoint xmlns:tns="http://ws.sample.org/" id="helloservice" implementor="org.sample.ws.HelloServiceImpl" wsdlLocation="wsdl/helloserviceimpl.wsdl" endpointName="tns:HelloServiceImplPort" serviceName="tns:HelloServiceImplService" address="/HelloServiceImplPort" /&gt; The following approach is not detected: @Service @Webservice(serviceName="helloservice", wsdlLocation="wsdl/helloserviceimpl.wsdl", targetNamespace = "http://ws.sample.org/") public class HelloServiceImpl { @WebMethod public String getVersion() { return "1.0"; } }
tagged with: wsdl
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24857277
has body: This is how you draw rectangles. Google a bit before you post questions :) // Draw rectangles import java.awt.*; import java.applet.*; public class Rectangles extends Applet { public void paint(Graphics g) { g.drawRect(10, 10, 60, 50); g.fillRect(100, 10, 60, 50); g.drawRoundRect(190, 10, 60, 50, 15, 15); g.fillRoundRect(70, 90, 140, 100, 30, 40); } } EDIT: Example taken from Java The complete reference by Herbert Schildt
has comment: http://stackoverflow.com/comment/38601333
has comment: http://stackoverflow.com/comment/38601280
type: Answer
has comment: http://stackoverflow.com/comment/38601281
answers question: http://stackoverflow.com/q/24857236
has comment: http://stackoverflow.com/comment/38601329
score: 0
has comment: http://stackoverflow.com/comment/38601295
has comment: http://stackoverflow.com/comment/38601630

http://stackoverflow.com/comment/50104015
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24796056
score: 0
has text: why don't you use waypoints with optimize flag? https://developers.google.com/maps/documentation/directions/#Waypoints

http://stackoverflow.com/comment/38517264
type: Comment
has text: E.g. 0.7 + 0.1 != 0.8
comment on: http://stackoverflow.com/a/24812707
type: AnswerComment
score: 0

http://stackoverflow.com/q/24813980
has title: Check when a process finishes in java?
has comment: http://stackoverflow.com/comment/38520189
tagged with: java
type: Question
answer count: 2
tagged with: upload
tagged with: file-upload
favorite count: 0
has answer: http://stackoverflow.com/a/24814402
has answer: http://stackoverflow.com/a/24814800
accepted answer: http://stackoverflow.com/a/24814402
possible better answer: http://stackoverflow.com/a/24814800
score: 0
tagged with: process
upvote count: 1
has body: How to check when a particular process has been finished? In my scenario download, process, upload is happening sequentially. Below is what I'm trying to accomplish - 1) Downloading an excel file from a server (Size varies - which is the reason I'm trying to check time) call S3DataGetUrlForDownload( parameters ) 2) Process the excel file inside java servlet, upload it to an API (which is different from the first server). upload.fileUpload( parameters ); Never programmed with the threads/timers. Added this part of sleep code, but when excel is big it fails. try { Thread.sleep(2000); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); }
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/38661179
type: Comment
comment on: http://stackoverflow.com/a/24888880
score: 0
type: AnswerComment
has text: how can I override methods?

http://stackoverflow.com/comment/38542172
has text: try reading Process's error stream and output stream for possible issues
score: 0
comment on: http://stackoverflow.com/q/24825772
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38548329
type: Comment
comment on: http://stackoverflow.com/a/24829454
has text: Its a typo error in settings.xml, Thanks @Thorbjørn Ravn Andersen
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38447824
has text: Thank you for your answer. I tried to get that cookie, but I run into a problem. I made HttpServletRequest with code: `public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { HttpServletRequest httpReq = WebScriptServletRuntime.getHttpServletRequest(req); Cookie[] cookies = httpReq.getCookies();` but the getCookies() method returns null.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24761078

http://stackoverflow.com/q/24806797
has title: bug retrofit.RetrofitError: java.io.EOFException for Android
answer count: 3
tagged with: retrofit
accepted answer: http://stackoverflow.com/a/24826076
favorite count: 0
has answer: http://stackoverflow.com/a/24826076
tagged with: android
score: 6
tagged with: okhttp
has answer: http://stackoverflow.com/a/51469625
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24824806
type: Question
has answer: http://stackoverflow.com/a/24824806
has body: I search a lot, I found some solutions like this: System.setProperty("http.keepAlive", "false"); arg0.addHeader("Connection", "close"); arg0.addHeader("Accept-Language", "en-US,en;q=0.8"); I try them but didn't work for me. How can I correct this bug? Here is my log: D/Retrofit(28969): ---&gt; HTTP POST http://release.api.jeunesse.build.indus.ftven.net/app.php/api/users D/Retrofit(28969): Connection: close D/Retrofit(28969): Content-Type: application/json D/Retrofit(28969): Content-Length: 169 D/Retrofit(28969): {"birthday":"2010-06-05T12:16:42+0200", \ "devices":[{"device":"ae045e7bead6f933487a237f8b5f298d","primary":true}],\ "email":"test@test.fr","login":"test9","password":"9876"} D/Retrofit(28969): ---&gt; END HTTP (169-byte body) D/Retrofit(28969): ---- ERROR http://release.api.jeunesse.build.indus.ftven.net/app.php/api/users D/Retrofit(28969): java.io.EOFException D/Retrofit(28969): at libcore.io.Streams.readAsciiLine(Streams.java:203) D/Retrofit(28969): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579) D/Retrofit(28969): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827) D/Retrofit(28969): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283) D/Retrofit(28969): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497) D/Retrofit(28969): at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73) D/Retrofit(28969): at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38) D/Retrofit(28969): at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321) D/Retrofit(28969): at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240) D/Retrofit(28969): at $Proxy3.createUser(Native Method) D/Retrofit(28969): at fr.francetv.ludo.backend.services.businessdelegate .RetrieveFluxDonneesBDL.postInscription(RetrieveFluxDonneesBDL.java:323) D/Retrofit(28969): at fr.francetv.ludo.backend.services.metier.user .AdministrerUse…
upvote count: 6

http://stackoverflow.com/a/24878795
score: 0
answers question: http://stackoverflow.com/q/24878777
type: Answer
has body: You should look at the Java Array documentation, especially the function copyOfRange(). This will allow you to copy some parts of your array used for either shrinking or expanding.

http://stackoverflow.com/comment/38520039
has text: That last BTW turned out to be the answer! Putting the \b before the \)? instead of after did exactly what I wanted. It becomees ((?:19|20)(?:\d){2})\b\)?
comment on: http://stackoverflow.com/a/24814115
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38686755
type: QuestionComment
comment on: http://stackoverflow.com/q/24902182
type: Comment
has text: The stream isn't getting closed. The *pipe,* to the external process, is getting closed. By the external process.
score: 0

http://stackoverflow.com/a/24876986
has comment: http://stackoverflow.com/comment/38639030
has comment: http://stackoverflow.com/comment/38638829
score: 0
has body: No, no need to use the src folder as workspace. Put it somewhere else, cause every project you make will end up in the src folder and most likely mess up everything. When you get a different workspace, import the src folder. Then it should work. If you need help, just ask in the comments!
type: Answer
answers question: http://stackoverflow.com/q/24876933

http://stackoverflow.com/comment/38696109
type: QuestionComment
comment on: http://stackoverflow.com/q/24907492
score: 0
has text: Can you tell us more about the content/structure XML files, it's not clear what you're exactly trying to do.
type: Comment

http://stackoverflow.com/a/24818320
type: Answer
has comment: http://stackoverflow.com/comment/38527766
score: 1
answers question: http://stackoverflow.com/q/24818238
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24818238
has body: You're consuming everything that you want to read in the estimateWords method call. By the time the scanner advances to the end of the file, you've read pretty much everything there is to read in the file, and the scanner's next call to hasNext() will return false. You can fix this in one of two ways: Open the file twice with a Scanner instance in each method call and pass in the filename, or Open the file once, perform both a count and a reading of data in one method only. I would opt for the latter, since it would be more straightforward and better practice (you typically don't see Scanner instances passed around).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38527558

http://stackoverflow.com/comment/38597796
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24855324
type: AnswerComment
has text: But what happens if a superclass declares an instance method called foo? Which method should be called: instance method or static method? I believe the instance method is called in preference to the static method. Meaning another person could alter the superclass and not realise they are effecting the subclass.

http://stackoverflow.com/q/24781960
has answer: http://stackoverflow.com/a/24782021
has answer: http://stackoverflow.com/a/24782036
has comment: http://stackoverflow.com/comment/38458489
type: Question
duplicate of: http://stackoverflow.com/q/7924961
possible better answer: http://stackoverflow.com/a/24782040
tagged with: java
has answer: http://stackoverflow.com/a/24782040
has comment: http://stackoverflow.com/comment/38458516
upvote count: 12
accepted answer: http://stackoverflow.com/a/24782021
has comment: http://stackoverflow.com/comment/38687897
favorite count: 0
answer count: 3
score: 9
has body: I stumbled upon this code on internet public class Test { /** * @param args */ public static void main(String[] args) { int i = (byte) + (char) - (int) + (long) - 1; System.out.println(i); } } It prints 1. Can i know why ? Here is the source --> http://www.javacodegeeks.com/2011/10/weird-funny-java.html
has title: Why "int i = (byte) + (char) - (int) + (long) - 1" is 1?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38458511
downvote count: 3
linked to: http://stackoverflow.com/q/7924961

http://stackoverflow.com/q/24856355
has comment: http://stackoverflow.com/comment/38599642
tagged with: java
has title: Counting the number of common elements between two arraylists - Java
has comment: http://stackoverflow.com/comment/38599676
has answer: http://stackoverflow.com/a/24856401
has comment: http://stackoverflow.com/comment/38599643
has body: I'm trying to see how many common elements two array lists have. This is the code I've come up with but this unfortunately returns: Exception in thread "AWT-EventQueue-0" Here is the code: private int score(int correctAnswers){ correctAnswers = 0; Collections.addAll(quiz1Answers, "ottawa", "toronto", "tokyo", "northamerica", "seoul", "Asia", "unitedstates", "50"); Collections.addAll(quiz1UserAnswers, "ottawa", "dfdf", "tokyo", "northamerica", "seoul", "x", "unitedstates", "50"); for (int i = 0; i &lt;= quiz1Answers.size(); i++) { if (quiz1Answers.contains(quiz1UserAnswers.get(i))) { correctAnswers++; } } return correctAnswers; } How would I go about solving this? EDIT: Here is the full error messsage: Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 8, Size: 8 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at Quiz1.score(Quiz1.java:309) at Quiz1.jButton4ActionPerformed(Quiz1.java:364) at Quiz1.access$400(Quiz1.java:16) at Quiz1$5.actionPerformed(Quiz1.java:148) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retar…
type: AnsweredQuestion
tagged with: arrays
favorite count: 0
tagged with: arraylist
type: Question
has comment: http://stackoverflow.com/comment/38599686
accepted answer: http://stackoverflow.com/a/24856401
has comment: http://stackoverflow.com/comment/38599654
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38599637

http://stackoverflow.com/q/24761974
has title: How to handle "No suitable driver found" exception while connecting MySQL with Eclipse?
has answer: http://stackoverflow.com/a/24762054
tagged with: java
tagged with: mysql
type: Question
tagged with: eclipse
score: 0
linked to: http://stackoverflow.com/q/2839321
answer count: 1
has body: I am using Eclipse LUNA package and MySQL 6.0 Workbench. I pasted "mysql-connector-java-5.0.8-bin.jar" file in Referenced Library file. My coding: package a1; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; class a2 { public static void main(String[] args) { String dbURL = "jdbc:mysql://localhost:3306/test"; String username = "root"; String password = "root"; Connection dbCon = null; Statement stmt = null; ResultSet rs = null; String query = "select * from k111"; try { dbCon = DriverManager.getConnection(dbURL, username, password); stmt = dbCon.prepareStatement(query); rs = stmt.executeQuery(query); System.out.println("Success"); while (rs.next()) { System.out.println(query); } } catch (SQLException ex) { System.out.println(ex); } finally { rs.close(); stmt.close(); dbCon.close(); } } } My database name is "test". My table name is k111. I need to print "Success" as per the program to know whether the database connectivity is successful. My output: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test
accepted answer: http://stackoverflow.com/a/24762054
type: AnsweredQuestion

http://stackoverflow.com/a/24784974
answers question: http://stackoverflow.com/q/24784707
has comment: http://stackoverflow.com/comment/38464619
has comment: http://stackoverflow.com/comment/79699653
type: Answer
has body: Try the below regex to remove &lt;DATE&gt; tag along with it's content, content = content.replaceAll("(?s)&lt;DATE&gt;.*?&lt;/DATE&gt;", ""); Explanation: (?s) DOTALL Modifier enables DOTALL mode. It make dot to match even newline characters also. &lt;DATE&gt; Matches the starting &lt;DATE&gt; tag. .*? Matches any character upto the next &lt;/DATE&gt; string. ? after * tells the regex engine to does a shortest match. Finally the matched characters are replaced with null string.
upvote count: 15
downvote count: 0
has comment: http://stackoverflow.com/comment/38464772
has comment: http://stackoverflow.com/comment/38464728
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24784707
score: 15

http://stackoverflow.com/comment/38445795
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24775057
has text: But currently the plugin just support these drivers:org.hsqldb.jdbc.JDBCDriver oracle.jdbc.driver.OracleDriver com.microsoft.sqlserver.jdbc.SQLServerDriver

http://stackoverflow.com/comment/38557797
type: Comment
has text: Isn't this a library bug then?
comment on: http://stackoverflow.com/a/24833674
score: 0
type: AnswerComment

http://stackoverflow.com/a/24876194
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24876045
has body: The correct method to override is onCreateOptionsMenu(Menu menu). You inflate the menu in this method and returns true. It should display on the right side of the action bar.

http://stackoverflow.com/a/24835935
answers question: http://stackoverflow.com/q/24835638
type: Answer
has comment: http://stackoverflow.com/comment/88214675
has comment: http://stackoverflow.com/comment/136182857
has comment: http://stackoverflow.com/comment/136182942
has comment: http://stackoverflow.com/comment/88213954
has comment: http://stackoverflow.com/comment/136182886
has body: You seem to not understand what SwingWorker does. SwingWorker provides a means by which you can execute long running tasks outside the context of the Event Dispatching Thread. This means that your program won't appear to have become frozen. The benefit of using a SwingWorker (over using a simple Thread) is that it provides a number of easy to use methods to re-sync the updates back to the EDT, which is indented to stop you from breaking the single thread rules of Swing: No UI element should be created or modified on any thread other then the EDT. Tak a closer look at Worker Threads and SwingWorker and javax.swing.SwingWorker<T,V> and Concurrency in Swing for more details import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.ByteArrayOutputStream; import java.io.File; import java.util.Iterator; import java.util.List; import java.util.concurrent.ExecutionException; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.ImageWriter; import javax.imageio.event.IIOReadProgressListener; import javax.imageio.event.IIOWriteProgressListener; import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class ConvertImage { public static void main(String[] args) { new ConvertImage(); } public ConvertImage() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } …
score: 9
has comment: http://stackoverflow.com/comment/136182919
has comment: http://stackoverflow.com/comment/136182826
has comment: http://stackoverflow.com/comment/38573357
has comment: http://stackoverflow.com/comment/136182879
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24835638
upvote count: 9

emf
tags question: http://stackoverflow.com/q/24803734
type: Tag
tag name: emf

http://stackoverflow.com/q/24816179
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38671100
answer count: 0
score: 1
upvote count: 1
has title: JMockIt: Inner class testing
type: Question
has body: So I have a piece of code as follows: public Observable&lt;Map&lt;String, Object&gt;&gt; fetch(final String id) { Client client = mClient.get(); return client.performRequest(new Client.Request() { @Override public void doRequest(Subscriber subscriber) { Map&lt;String, Object&gt; response = getEndpoint().getUser(id); setAttributes(response); subscriber.onNext(response); } }); } /** * Get the endpoint * @return reference to the endpoint */ private Endpoint getEndpoint() { if (mEndpoint == null) { RestAdapter restAdapter = getClient().getRestAdapter(); mEndpoint = restAdapter.create(Endpoint.class); } return mEndpoint; } And here is my test: @Test public void fetch(@Cascading final Client client, @Mocked final Client.Request request, @Mocked final Subscriber subscriber, @Cascading final User.Endpoint endpoint) { new NonStrictExpectations(mUser){{ mUser.setAttributes((Map) any); subscriber.onNext(any); Deencapsulation.invoke(mUser, "getEndpoint"); returns(endpoint); }}; // returns the observable assertThat(mUser.fetch(User.ID_ME)).isInstanceOf(Observable.class); new Verifications() {{ Client.Request clientRequest; client.performRequest(clientRequest = withCapture()); clientRequest.doRequest(subscriber); mUser.setAttributes((Map) any); subscriber.onNext(any); endpoint.getUser(anyString); }}; } For some reason I keep getting an exception: java.lang.RuntimeException: java.lang.NoSuchMethodException: me.magneto.groups.models.User$Endpoint.getEndpoint() at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.lang.reflect.Method.invoke(Method.java:483) at me.magneto.groups.models.UserTest$1.&lt;init&gt;(UserTest.java:75) at me.magneto.groups.models.UserTest.fetch(UserTest.java:72) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.lang.reflect.Method.invoke(Method.java:483) at java.lang.reflect.Method.invoke(Method.java:483) I know for a fact I have a private method as listed above getEndpoint which I'm stubbing so a network request isn't ma…
tagged with: java
tagged with: jmockit
has comment: http://stackoverflow.com/comment/38663785
tagged with: junit
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24902610
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24901668
has body: I hope this one helps you :) You just have to add the ListCellRenderer to your ComboBox. class MyComboBoxRenderer extends JLabel implements ListCellRenderer { . . . public ComboBoxRenderer() { setOpaque(true); setHorizontalAlignment(CENTER); setVerticalAlignment(CENTER); } public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { //Get the selected index. (The index param isn't //always valid, so just use the value.) int selectedIndex = ((Integer)value).intValue(); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } //Set the icon and text. If icon was null, say so. ImageIcon icon = images[selectedIndex]; String pet = petStrings[selectedIndex]; setIcon(icon); if (icon != null) { setText(pet); setFont(list.getFont()); //HERE YOU ALSO HAVE TO SET THE COLOR OR SOMETHING LIKE THAT } else { setUhOhText(pet + " (no image available)", list.getFont()); } return this; } . . . }

android-preferences
tags question: http://stackoverflow.com/q/24830937
type: Tag
tag name: android-preferences

http://stackoverflow.com/q/24883729
type: UnansweredQuestion
tagged with: multithreading
has body: I'm trying to list down all available devices on a local WiFi network. To do this I'm using simple ICMP echo technique to check if a device is connected or not. The problem is the time it takes to scan the entire subnet. I'm using 7 ms wait time between subsequent scan. My question is, can I use Java multi threading for this purpose where each thread would work independently to scan different segments? Would there be any link-layer constraints? Thanks for your help!
tagged with: java
has comment: http://stackoverflow.com/comment/38651147
type: Question
score: 0
tagged with: network-programming
answer count: 1
has answer: http://stackoverflow.com/a/24923737
has title: Host scanning on a private network

http://stackoverflow.com/comment/38434351
type: AnswerComment
type: Comment
has text: The layout manager is probably the culprit given that the default layout for the `JFrame` is a `BorderLayout` vs. `FlowLayout` for the `JPanel`. However, if you're looking to use one of these components as a mask to block input into the frame while a task is running, then I'd recommend looking at using the glass pane component of the JFrame instead especially if you have many controls in your JFrame.
comment on: http://stackoverflow.com/a/24768997
score: 0

http://stackoverflow.com/comment/38522901
type: AnswerComment
comment on: http://stackoverflow.com/a/24815863
has text: This will NOT work :( :( :( Why? At least [jBcrypt](http://www.mindrot.org/projects/jBCrypt/) does NOT allow me to compare two hashed passwords. It only allows me to compare a plain-text with hashed. I may be missing something here, but transmitting passwordHashed + salt from Machine A will do nothing for Machine B when it comes to authenticating because jBcrypt needs plain-text :( :( :( (see the [jBcrypt](http://www.mindrot.org/projects/jBCrypt/) website)
type: Comment
score: 0

http://stackoverflow.com/comment/38617512
comment on: http://stackoverflow.com/q/24865758
type: Comment
has text: oki, give me a sec I just double check
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38441516
comment on: http://stackoverflow.com/q/24772894
score: 0
has text: first try to extract digit from the strings. Then you can easily sum them.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38530984
has text: @Makoto I would argue that, apart from the "accepted" answer is link to an offsite resource, this isn't so much about how to create a custom cursor, as the OP has already shown working code, but why there particular image doesn't work, which sounds more like an issue with the location of the image or the means by which it is been loaded and/or the size of the image under Windows - IMHO
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24818948
type: Comment

http://stackoverflow.com/q/24784685
tagged with: java
has answer: http://stackoverflow.com/a/24788480
accepted answer: http://stackoverflow.com/a/24788480
tagged with: bukkit
type: Question
has title: (Java, Bukkit) Using extended class methods don't work (Noob oop)
tagged with: extending-classes
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/38464758
has body: I have one class named 'Regions', which make region and check if coordinates are in it. Then I have other class 'ArrowTower' which extends 'Region'. Class 'ArrowTower' creates towers. All day I was experimenting with no results. What I want to do is assign first and second location to class 'Regions' then make region and check if coordinates belongs to it. I also have events - 'BlockTouch' class which creates 'ArrowTower' object.. When I try to tower.insideRegion(e.getClickedBlock()); it gives me my location and then zeros, because it didin't set values in public void buildArrowTower, but values are right here. So I just don't understand why this isn't working :/ My Events class: import eu.anavicius.TomTom1997.TomTowerDefence.Towers.ArrowTower; public class BlockTouch implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent e) { ArrowTower tower = new ArrowTower(); if (e.getAction() == Action.RIGHT_CLICK_BLOCK ) { if (e.getItem().getType() == Material.ARROW) { tower.buildArrowTower(e.getClickedBlock(),e.getPlayer()); } else if (e.getItem().getType() == Material.BONE) { Bukkit.broadcastMessage("Bone"); tower.insideRegion(e.getClickedBlock()); } } } } My Region.class: public class Regions { private int xl,yl,zl,xh,yh,zh; public void setLRegion (int x, int y, int z) { xl = x; yl = y; zl = z; //Bukkit.broadcastMessage("SetLMethod" + " \t " + "|" + xl + "|"+ xh + "||" + "|" + yl + "|" + yh + "||" + "|" +zl + "|" + zh + "||"); } public void setHRegion (int x, int y, int z) { xh = x; yh = y; zh = z; //Bukkit.broadcastMessage("SetHMethod" + " \t " + "|" + xl + "|"+ xh + "||" + "|" + yl + "|" + yh + "||" + "|" +zl + "|" + zh + "||"); } public void insideRegion (Block l) { int x,y,z; x = l.getX(); y = l.getY(); z =l.getZ(); Bukkit.broadcastMessage("InsideMethod" + " \\t " + x + "|" + xl + "|"+ xh + "||" +y + "|" + yl + "|" + yh + "||" + z + "|" +zl + "|" + zh + "||"); if (x &gt;= xl &amp;&amp; x &lt;= xh ) { Bukkit.broadcastMessage("Region check 1"…
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/38464425

http://stackoverflow.com/q/24895056
tagged with: localization
accepted answer: http://stackoverflow.com/a/24897281
type: Question
answer count: 2
tagged with: locale
upvote count: 5
downvote count: 0
tagged with: chinese-locale
has title: Different representation of unicode code points in Japanese and chinese
possible better answer: http://stackoverflow.com/a/24944657
has body: I am trying to display the glyph corresponding to unicode 0x95E8. This codepoint is basically of CJK block (chinese, Japanese, Korean). I am struggling to know if the glyph representation of this particular codepoint can be different for Japanese and Chinese. When I am displaying this U+95E8 in a JTextArea, i am able to see "门" character on linux/windows. But when I am trying to display the same codepoint in my "embedded device". the displayed character changes to. I want to know if this codepoint U+95E8 should have uniform representation in all the CJK (Chinese, Japanese, Korean) locales or is different for some of them. Can this kind of manifestation be because of different kind of font installed in different devices? I am sorry for my ignorance but I am not too much into internationalization. import java.awt.*; import java.awt.event.*; import java.util.Locale; import javax.swing.*; public class TextDemo extends JPanel implements ActionListener { public TextDemo() { } public void actionPerformed(ActionEvent evt) { } /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event dispatch thread. * @throws InterruptedException */ private static void createAndShowGUI() throws InterruptedException { JFrame frame = new JFrame(java.util.Locale.getDefault().getDisplayName()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); contentPane.setLayout(new SpringLayout()); Dimension size = new Dimension(500, 500); frame.setSize(size); JTextArea textArea = new JTextArea(); //Font font1 = new Font("SansSerif", Font.BOLD, 20); //textArea.setFont(font1); textArea.setEditable(true); textArea.setSize(new Dimension(400,400)); textArea.setDefaultLocale(java.util.Locale.SIMPLIFIED_CHINESE); textArea.setText("Printing U+95E8 : \u95e8"); contentPane.add(textArea); frame.setVisible(true); } public static void main (String[] args) { java.util.Locale.setDefault(java.util.Locale.JAPANESE); javax.swing.…
has answer: http://stackoverflow.com/a/24944657
tagged with: unicode
has answer: http://stackoverflow.com/a/24897281
favorite count: 0
score: 5
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24766499
has body: I have a custom DialogFragment class. In OnCreateDialog I inflate my view like so: AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); myView = inflater.inflate(R.layout.my_layout, null); builder.setView(myView); I then capture the reference to my EditText: mText = (EditText)myView.findViewById(R.id.mtext_id); Everything works fine if I try to edit the editText from within the onCreateDialog method. But if try to edit the editText from a different method in the same class, using the same captured reference, it doesn't work. mText.setText("foo"); Produces the error InvocationTargetException with the cause NullPointerException. I've tried using a new reference to the id, calling it from the parent Activity instead of the DialogFragment itself, always with the same result. Edited to include more code: The complete onCreateDialog public class TimeInputFragment extends DialogFragment { OnTimeEnteredListener myCallback; View myView; EditText mText; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("foo") .setPositiveButton("Start timer", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { myCallback.callbackMethod(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Cancel } }); LayoutInflater inflater = getActivity().getLayoutInflater(); myView = inflater.inflate(R.layout.dialog_timeentry, null); builder.setView(myView); mText = (EditText)myView.findViewById(R.id.TimeDialogInput); return builder.create(); } The complete method to edit the editText (in the same class as onCreateDialog public void setDialogText(String text) { mText.setText(text); } And the code calling the fragment from the parent activity: FragmentManager fragmentManager = getSupportFragmentManager(); …
has comment: http://stackoverflow.com/comment/38430005
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38429506
answer count: 0
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38433133
score: 0
has title: Edit editText in DialogFragment after layout has been inflated
has comment: http://stackoverflow.com/comment/38429562

http://stackoverflow.com/a/24839151
answers question: http://stackoverflow.com/q/24838284
score: 0
type: Answer
has body: 5 Hours wasted :( Can anybody please tell me why the below code not working : &lt;property name="prefix" value="/WEB-INF/html/" /&gt; &lt;property name="suffix" value=".html" /&gt; but if I change it to : &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; it worked fine. The directory structure after modification is : Why it is not picking up html file and throwing No mapping found for HTTP request with URI… in DispatcherServlet and working file with JSP.

arrays
tags question: http://stackoverflow.com/q/24767022
tags question: http://stackoverflow.com/q/24776970
tags question: http://stackoverflow.com/q/24754451
tags question: http://stackoverflow.com/q/24792485
tags question: http://stackoverflow.com/q/24872063
tags question: http://stackoverflow.com/q/24892874
tags question: http://stackoverflow.com/q/24811003
tags question: http://stackoverflow.com/q/24845012
tags question: http://stackoverflow.com/q/24769415
tags question: http://stackoverflow.com/q/24902305
tags question: http://stackoverflow.com/q/24757968
tags question: http://stackoverflow.com/q/24878777
tags question: http://stackoverflow.com/q/24794815
type: Tag
tags question: http://stackoverflow.com/q/24874817
tags question: http://stackoverflow.com/q/24819037
tags question: http://stackoverflow.com/q/24896142
tags question: http://stackoverflow.com/q/24876323
tags question: http://stackoverflow.com/q/24788718
tags question: http://stackoverflow.com/q/24776296
tags question: http://stackoverflow.com/q/24852744
tags question: http://stackoverflow.com/q/24773739
tags question: http://stackoverflow.com/q/24836402
tags question: http://stackoverflow.com/q/24755952
tags question: http://stackoverflow.com/q/24860273
tags question: http://stackoverflow.com/q/24837939
tags question: http://stackoverflow.com/q/24845255
tags question: http://stackoverflow.com/q/24816084
tags question: http://stackoverflow.com/q/24770296
tags question: http://stackoverflow.com/q/24846579
tags question: http://stackoverflow.com/q/24815342
tags question: http://stackoverflow.com/q/24904403
tags question: http://stackoverflow.com/q/24860613
tags question: http://stackoverflow.com/q/24850618
tags question: http://stackoverflow.com/q/24855711
tags question: http://stackoverflow.com/q/24799928
tags question: http://stackoverflow.com/q/24869318
tags question: http://stackoverflow.com/q/24800639
tags question: http://stackoverflow.com/q/24769853
tags question: http://stackoverflow.com/q/24869695
tags question: http://stackoverflow.com/q/24751495
tags question: http://stackoverflow.com/q/24828547
tags question: http://stackoverflow.com/q/24821938
tags question: http://stackoverflow.com/q/24846818
tags question: http://stackoverflow.com/q/24802091
tags question: http://stackoverflow.com/q/24822714
tags question: http://stackoverflow.com/q/24749657
tags question: http://stackoverflow.com/q/24831874
tags question: http://stackoverflow.com/q/24832191
tags question: http://stackoverflow.com/q/24813676
tags question: http://stackoverflow.com/q/24841484
tags question: http://stackoverflow.com/q/24832046
tags question: http://stackoverflow.com/q/24884381
tags question: http://stackoverflow.com/q/24878211
tags question: http://stackoverflow.com/q/24860857
tags question: http://stackoverflow.com/q/24753146
tags question: http://stackoverflow.com/q/24903941
tags question: http://stackoverflow.com/q/24875710
tags question: http://stackoverflow.com/q/24834900
tags question: http://stackoverflow.com/q/24789354
tags question: http://stackoverflow.com/q/24837157
tags question: http://stackoverflow.com/q/24765630
tags question: http://stackoverflow.com/q/24899854
tags question: http://stackoverflow.com/q/24856355
tag name: arrays
tags question: http://stackoverflow.com/q/24826566
tags question: http://stackoverflow.com/q/24900705
tags question: http://stackoverflow.com/q/24775940
tags question: http://stackoverflow.com/q/24892789
tags question: http://stackoverflow.com/q/24790437
tags question: http://stackoverflow.com/q/24864964
tags question: http://stackoverflow.com/q/24789030
tags question: http://stackoverflow.com/q/24771394
tags question: http://stackoverflow.com/q/24895096
tags question: http://stackoverflow.com/q/24842585
tags question: http://stackoverflow.com/q/24827403
tags question: http://stackoverflow.com/q/24774676
tags question: http://stackoverflow.com/q/24787781
tags question: http://stackoverflow.com/q/24846624
tags question: http://stackoverflow.com/q/24885036

http://stackoverflow.com/q/24805338
downvote count: 3
type: Question
score: -1
linked to: http://stackoverflow.com/q/7849192
has body: Can anybody explain, what are possible ways of getting Sim State as UNKNOWN.
answer count: 1
tagged with: telephonymanager
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24805475
has title: Possible ways of geting Sim State as UNKNOWN
upvote count: 2
tagged with: java

http://stackoverflow.com/q/24821980
linked to: http://stackoverflow.com/q/818255
has title: Get Java Version using `Runtime.getRuntime().exec(commands)`
type: Question
has comment: http://stackoverflow.com/comment/38534493
linked to: http://stackoverflow.com/q/2591083
answer count: 2
linked to: http://stackoverflow.com/q/13483443
accepted answer: http://stackoverflow.com/a/24822108
has comment: http://stackoverflow.com/comment/38533996
downvote count: 0
tagged with: cmd
favorite count: 0
has comment: http://stackoverflow.com/comment/38533860
possible better answer: http://stackoverflow.com/a/49845397
has answer: http://stackoverflow.com/a/49845397
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24822108
score: 1
has body: I found, we can find out Java version using System.getProperty("java.version"). from here - Getting Java version at runtime But I have already done so coding using Runtime.getRuntime().exec(commands) - String[] commands ={"java", "-version"}; String line; String cmdOutput = ""; try { Process process = Runtime.getRuntime().exec(commands); process.waitFor(); BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream())); while ((line = input.readLine()) != null) { cmdOutput += (line + "\n"); } System.out.println("output "+cmdOutput); input.close(); } catch (Exception ex) { ex.printStackTrace(); } But getting blank output. When I run java -version from command prompt, we get version, I feel it should also return same output. Before I discard it and use System.getProperty("java.version"), Can I please know what I am missing here ? Thanks in advance.
tagged with: java
upvote count: 1

http://stackoverflow.com/a/24766695
has comment: http://stackoverflow.com/comment/38430558
type: Answer
has comment: http://stackoverflow.com/comment/38430030
has body: You use radian to degree conversation (180/Math.Pi). However, you need degree to radian conversastion which is; Then, it is better to implement a utility function like public int degreeToRadian(int degree) { return degree * (Math.pi / 180); } You should use Math#tan like this for degree values Math.tan(degreeToRadian(angle)); You can also use Math#toRadians instead of above. From Doc; public static double tan(double a) Returns the trigonometric tangent of an angle. Special cases: If the argument is NaN or an infinity, then the result is NaN. If the argument is zero, then the result is a zero with the same sign as the argument. The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic. Parameters: a - an angle, in radians. Returns: the tangent of the argument. See also Radian
score: 0
answers question: http://stackoverflow.com/q/24766572

http://stackoverflow.com/q/24786681
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has title: Render scala template outside of controller? (Play 2)
accepted answer: http://stackoverflow.com/a/24819077
tagged with: playframework-2.2
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has body: I'm trying to decouple the sending of notification emails from the events that cause them. So far I'm passing a mail object (DocumentIssuedMail) from a controller to an Akka actor(EmailDispatcher), which is then sending the mail via the play-easymail wrapper of the Play mailer plugin. The email body is generated by the mail object after being passed to the actor, and the HTML is generated from a Scala template. This template contains link with absolute URLs, obtained by calling @routes.SomeController.someAction().absoluteURL() However, I'm getting a RuntimeException when trying to render the template. The stack trace is as follows: java.lang.RuntimeException: There is no HTTP Context available from here. at play.mvc.Http$Context.current(Http.java:30) at play.mvc.Http$Context$Implicit.ctx(Http.java:196) at play.core.j.PlayMagicForJava$.requestHeader(TemplateMagicForJava.scala:56) at views.html.email._learner_main$.apply(_learner_main.template.scala:41) at views.html.documents.email.new_doc_unregistered$.apply(new_doc_unregistered.template.scala:47) at views.html.documents.email.new_doc_unregistered$.render(new_doc_unregistered.template.scala:67) at views.html.documents.email.new_doc_unregistered.render(new_doc_unregistered.template.scala) at email.DocumentIssuedMail.getUnregisteredMail(DocumentIssuedMail.java:71) at email.DocumentIssuedMail.getMail(DocumentIssuedMail.java:67) at actors.email.EmailDispatcher.onReceive(EmailDispatcher.java:32) at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:167) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:498) at akka.actor.ActorCell.invoke(ActorCell.scala:456) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:237) at akka.dispatch.Mailbox.run(Mailbox.scala:219) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(Fork…
has answer: http://stackoverflow.com/a/24819077
tagged with: playframework

http://stackoverflow.com/a/24792501
has body: Use a for loop for(int i = 0; i &lt; array.length; i++){ if(string.charAt(0) != array[i]) { //Code here break; } } Or maybe even a while loop int i = 0; while(i &lt; array.length){ if(string.charAt(0) != array[i]) { //Code here break; } } Why the hell not lets screw iteration and do some recursion. (assuming array's type is char). The other methods are better I just wanted to show that you can do it with recursion. boolean checkChar(String string Char[] array){ return checkCharHelper(string, array, 0); } boolean checkCharHelper(String string, Char[] array, int index){ if(index &gt;= string.length){ return false; } if(string.charAt(0) != array[i]) { //Code here return true; } return checkCharHelper(string, array, index + 1); }
accepted answer of: http://stackoverflow.com/q/24792485
upvote count: 2
answers question: http://stackoverflow.com/q/24792485
has comment: http://stackoverflow.com/comment/38487079
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38509292
type: Answer

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/24880635
tags question: http://stackoverflow.com/q/24893490
tags question: http://stackoverflow.com/q/24887784
tags question: http://stackoverflow.com/q/24777549
tags question: http://stackoverflow.com/q/24761293
type: Tag
tags question: http://stackoverflow.com/q/24780726
tag name: pdf
tags question: http://stackoverflow.com/q/24898413
tags question: http://stackoverflow.com/q/24828234
tags question: http://stackoverflow.com/q/24846958
tags question: http://stackoverflow.com/q/24772212
tags question: http://stackoverflow.com/q/24798926
tags question: http://stackoverflow.com/q/24757326
tags question: http://stackoverflow.com/q/24876853
tags question: http://stackoverflow.com/q/24887961
tags question: http://stackoverflow.com/q/24777795

http://stackoverflow.com/comment/38680820
has text: Creative the h ttp. I know this is lame, but some of these errors went away because of a rouge process. So, restart the stuff.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24899195
type: Comment

http://stackoverflow.com/comment/38650439
score: 0
has text: A use case where you add new child entities to OneToMany Set, you pass the parent to merge and return it to the view, only to discover the Set doesn't iterate at all, even if the size is greater than zero. I fixed that once upon a time. The Address entity is a fairly simple example. Each address is unique, otherwise the postman would get lost while delivering the mail. Most of the time is: PostCode + Street Number + Apartment Number.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24879391

http://stackoverflow.com/comment/38699756
has text: If I start tomcat manually, app starts as soon as tomcat is started. Is there any reason why it happens when maven plugin used?
comment on: http://stackoverflow.com/q/24908727
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38659277
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24882946
has text: I've just run the code with `-server` option and it makes a difference. Now times are different, by about 50% off each other. If `r` is an instance variable then `dynamic` takes 50% longer than `static`, and vice versa if you declare `r` as static. That would somehow match your code rearrangement results. There's almost no difference when running without the `-server` option.
type: QuestionComment

http://stackoverflow.com/a/29890683
downvote count: 1
answers question: http://stackoverflow.com/q/24863598
score: 3
upvote count: 4
has body: I'm posting this answer so that other users can see the solution we adopted. Due to Kafka limitations (the large no. of partitions which cause the OS to reach almost reach max open files) and somewhat weak performance we decided to build a custom framework for exactly our needs using libraries like apache commons , guava, trove etc to achieve the performance we needed. The entire system (distributed and scalable) has 3 main parts: ETL (reads the data , process it and writes it to binary files) Framework Core (used to read from the binary files and calculate stats) API (used by many system to get data for display) As a side note: we tried other solutions like HBase, Storm etc but none live up to our needs.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24863598
type: Answer

http://stackoverflow.com/a/24842298
has comment: http://stackoverflow.com/comment/38572227
has comment: http://stackoverflow.com/comment/38572497
downvote count: 0
has body: To set Position simply use this code import java.awt.*; import javax.swing.*; class SetTextfield extends JFrame { JTextField t1,t2; public SetTextfield() { t1=new JTextfield(); t2=new JTextField(); t1.setBounds(100,100,200,40); t2.setBounds(180,100,200,40); add(t1); add(t2); } public static void main(String []args) { SetTextfield obj=new SetTextfield(); obj.setSize(500,500); obj.setVisible(true); obj.setResizable(false); } }
type: Answer
has comment: http://stackoverflow.com/comment/38572300
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38572655
has comment: http://stackoverflow.com/comment/38573535
answers question: http://stackoverflow.com/q/24842068

http://stackoverflow.com/comment/38482453
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24794013
type: Comment
has text: also, the loop version has an extra map lookup. if it used the entrySet(), your description would be accurate.

http://stackoverflow.com/comment/38939395
score: 0
has text: If you have a sparse bit set (which is usually the case for very large sets) then there are several techniques to deal with that efficiently, by compressing out the zero regions. The trick is to have a scheme which is efficient (and doesn't require decompression/recompression) when doing ANDs and ORs.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24758927

http://stackoverflow.com/q/24884165
has body: So i was studying Garbage collection, how it works internally inside the java virtual machine. I came across a method called finalize(which is situated in java.lang.Object). I tried this code: class Demo { int x= 10; int y = 20; public void finalize() throws Throwable { System.out.println("Finalize method"); } static void show() { Demo d1= new Demo(); display(); } static void display() { Demo d2 = new Demo(); } } class Temp { public static void main(String args[]) throws Exception { Demo.show(); } } I was able to compile this code, but when I run this code there is no exception and no output. Please assist me if you can. I tried Google and many other reputed blogs to sort out my Problem (tutorialsPoint), (JavaRevisited). I even searched stackoverflow, but i am unable to solve my problem. P.S :- Output should be Finalize method which you can point out. PLEASE assist me. To summarize, my question is: Why cant I execute the Finalize Method?
tagged with: garbage-collection
upvote count: 1
has comment: http://stackoverflow.com/comment/38651877
accepted answer: http://stackoverflow.com/a/24884447
has comment: http://stackoverflow.com/comment/38654331
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38651942
score: 1
linked to: http://stackoverflow.com/q/18681412
tagged with: java
has comment: http://stackoverflow.com/comment/38651841
type: Question
duplicate of: http://stackoverflow.com/q/18681412
has title: Finalize Method in java [Garbage collection]
downvote count: 0
has comment: http://stackoverflow.com/comment/38651924
has comment: http://stackoverflow.com/comment/38653632
favorite count: 0
has answer: http://stackoverflow.com/a/24884928
possible better answer: http://stackoverflow.com/a/24884313
has comment: http://stackoverflow.com/comment/38652519
has answer: http://stackoverflow.com/a/24884447
answer count: 3
has answer: http://stackoverflow.com/a/24884313
tagged with: jvm

http://stackoverflow.com/q/24871473
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: How to stop Second Screen music when user presses the back button?
has comment: http://stackoverflow.com/comment/38628780
accepted answer: http://stackoverflow.com/a/24876792
has comment: http://stackoverflow.com/comment/38629271
has comment: http://stackoverflow.com/comment/38628442
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38628316
score: 0
tagged with: layout
answer count: 1
linked to: http://stackoverflow.com/q/24867102
has body: I asked this question a couple of hours ago and I did made some changes in my code as suggested by stack overflow users. However, One more problem started to emerge. The problem is that whenever, I try to go back from the second Screen to the main screen ..The music from second screen doesn't stop. [ "I am trying to design the app that has 3 buttons on the main screen; when the user presses on the first two buttons it plays the different music located in the raw folder. The third button on the main screen should drive the user to the next screen which also has 2 buttons. I tried to run my app on the emulator. It plays the music on first two buttons of the main screen, and when I click on the third (Next) button it takes the user to the next screen. However, when I click on 1st or 2nd button of the Second Screen. It says "Unfortunately your app has stopped". I don't now what's wrong with my SecondActivity.Java code . Any help will be greatly appreciated. Below is my MAIN and Second class JAVA code. I did declare my second Activity in manifest.xml file." ] Second Activity.Java import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; public class SecondActivity extends Activity implements OnClickListener { private MediaPlayer mp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); setVolumeControlStream(AudioManager.STREAM_MUSIC); findViewById(R.id.button_4).setOnClickListener(this); findViewById(R.id.button_5).setOnClickListener(this); } public void onClick(View v) { int resId = 1; switch (v.getId()) { case R.id.button_4: resId = R.raw.button_4; break; case R.id.button_5: resId = R.raw.button_5; break; } // Release any resources from previous MediaPlayer if (mp != null) { mp.release(); } // Create a new MediaPlayer to play this sound mp = MediaPlayer.…
has answer: http://stackoverflow.com/a/24876792
tagged with: android

http://stackoverflow.com/a/24786896
type: AcceptedAnswer
downvote count: 0
has body: Your settings.xml file configuration is the problem cause your Id's in your server configurations do not correspond with the entries in distributionManagement: <distributionManagement> ossrh https://oss.sonatype.org/content/repositories/snapshots </distributionManagement> You have to use the following server id's: ossrh username password They have to correspond with the entries in distributionManagement.
type: Answer
has comment: http://stackoverflow.com/comment/38481604
has comment: http://stackoverflow.com/comment/38478386
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24784749
score: 3
answers question: http://stackoverflow.com/q/24784749

http://stackoverflow.com/q/24867650
tagged with: java
has title: How to test the program has quit? [JUnit]
upvote count: 2
has comment: http://stackoverflow.com/comment/38621075
has answer: http://stackoverflow.com/a/24867907
accepted answer: http://stackoverflow.com/a/24867907
has comment: http://stackoverflow.com/comment/38621030
tagged with: mockito
tagged with: junit
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38621243
has body: I'm trying to build a simple app, which has a switch/case statement as follows: public void handleUserInput(char input){ switch(input) { case 'L': printBooksList(); break; case 'Q': System.exit(0); default: System.out.println("The option you chose was invalid"); } } I'm trying to do this TDD to learn some of the basics, with JUnit and Mockito. However I have absolutely no idea how to test a program has quit. I have to create an object of MyApp to then pass in a mocked InputStream with the value 'Q' quit, so somehow mocking doesn't fit. Even if this method was public, it's not exactly a method I can verify has been called through mocks. Does anyone know any way on how to go about this? I'm aware of this answer but I'm not testing a static method, and having another constructor to pass in a mocked out System seems overkill. This is the test I have written taking answers from the question I linked to: @Test public void shouldCallSystemExit() { inputStream = new ByteArrayInputStream("X".getBytes()); testSubject = new BibliotecaApp(inputStream); PowerMockito.mockStatic(System.class); testSubject.handleUserInput('Q'); PowerMockito.verifyStatic(); System.exit(0); System.out.println("If this message displays them System.exit() was mocked successfully"); } But this is throwing dependency issues left right and centre! I've had to download 5 jars for PowerMock to work and it's still asking for hamcrest/SelfDescribing. This can't be right, I'll be downloading everything at this rate.
linked to: http://stackoverflow.com/q/12234526
has comment: http://stackoverflow.com/comment/38622337
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38632809
tagged with: unit-testing
type: Question

http://stackoverflow.com/a/24838426
type: Answer
has body: You can get entrySet() and iterate using advanced for loop. Map.Entry class represents a single pair in map, it has two properties key and value for(Map&lt;String, String&gt; map : placesLived){ Set&lt;Map.Entry&lt;String, String&gt;&gt; entrySet = map.entrySet(); for (Map.Entry&lt;String, String&gt; entry : entrySet) { String key = entry.getKey(); String value = entry.getValue(); } }
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24838379

http://stackoverflow.com/q/24888657
tagged with: jakarta-ee
has title: Vaadin 7: Filters, EntityManager per Request(hibernate), JPAContainer and push/websockets usage
tagged with: java
tagged with: hibernate
tagged with: vaadin
accepted answer: http://stackoverflow.com/a/24920794
upvote count: 2
linked to: http://stackoverflow.com/q/24914008
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24920794
has body: I am using Wildfly 8.1 and Vaadin 7.3.beta1. I am starting an EntityManager in a @WebFilter and managing the transaction at that layer, that is folowing the entitymanager-per-request pattern recommended for the usage of the JPAContainer addon. Before Vaadin 7 it was clear to me that for every event in the browser that had a listener in the server a simple HTTP Request will be made and it will go through my Filter, thus initiating a transaction before vaadin code gets executed, and properly finishing that entitymanager transaction after vaadin code executed. But I am concernet now that Vaadin 7 supports push and might use websocket under the hood that my Filter might not allways be executed. Will my filter run regardless of the transport being used when using @Push in the UI? How does this work in Vaadin 7?
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: vaadin-push
type: Question

http://stackoverflow.com/q/24797610
has answer: http://stackoverflow.com/a/24797707
has answer: http://stackoverflow.com/a/24797724
downvote count: 0
possible better answer: http://stackoverflow.com/a/24797707
has answer: http://stackoverflow.com/a/24798088
tagged with: string
favorite count: 0
tagged with: byte
answer count: 5
has answer: http://stackoverflow.com/a/24797658
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24797776
accepted answer: http://stackoverflow.com/a/24797658
score: 1
tagged with: java
upvote count: 1
type: Question
has title: how to use bytes in java?
has body: Why does this code return 221 here? What is the logic behind this? How this working? Please explain this to me for I am new to Java. import java.io.UnsupportedEncodingException; public class Checksrting { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub byte[] byteArray = new byte[2]; byteArray[0] = 100; byteArray[1] = 100; Long ID = null; try { ID = Long.parseLong(new String(byteArray, "utf-8").trim(), 16); System.out.print(ID); } catch (NumberFormatException | UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } So please explain to me what is the use of utf-8 and ,16?

http://stackoverflow.com/q/24828811
has answer: http://stackoverflow.com/a/24829161
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24828927
score: 1
tagged with: java
tagged with: loops
has body: I have problem with aggregating data based on their timestamp per day for a timespan of one week. There is a SQLite database, which has a table which I save the number of walking steps in (timestamp column is UTC and created_At is local time, but I don't use the created_at column anyway). What I want to do is get the total data which happened in 7 days ago until the midnight of a day before. So I have this jodatime expression to find start and end for timestamps long start = new DateTime().withMillisOfDay(0).minusDays(7).getMillis(); long end = new DateTime().withTimeAtStartOfDay().getMillis(); //start milli:1405029600000 DateTime: 2014-07-11 00:00:00 //end milli:1405634400000 DateTime: 2014-07-18 00:00:00 Then I execute this sql command: SELECT * FROM pa_data WHERE timestamp BETWEEN 1405029600000 AND 1405634400000 And I am pretty sure that it returns the correct rows ( I have compared the android database result with SQLite Database Browser on my pc, both return same number of rows). For this, I tried to use this nested iteration: the Object I am trying to create is: public class PhysicalActivityPerDay { private List&lt;PhysicalActivity&gt; mList; public PhysicalActivityPerDay(List&lt;PhysicalActivity&gt; list) { mList = new ArrayList&lt;PhysicalActivity&gt;(list); } //methods.... } Now the problem is, I want to have a data object that can hold the rows for each day. List&lt;PhysicalActivity&gt; all = getPhysicalActivitiesBetween(start, end); List&lt;PhysicalActivityPerDay&gt; perDays = new ArrayList&lt;PhysicalActivityPerDay&gt;(); List&lt;PhysicalActivity&gt; tempList; PhysicalActivityPerDay tempPerDay; for (int i = 0; i &lt; 7; i++) { long begin = start; long stop = (begin + 86400000); //add 24 hours tempList = new ArrayList&lt;PhysicalActivity&gt;(); for (int j = 0; j &lt; all.size(); j++) { PhysicalActivity p = all.get(j); DateTime when = new DateTime(p.getTimestamp()); if (when.isAfter(start) &amp;&amp; when.isBefore(stop)) { tempList.add(p); all.remove(j); /…
type: Question
tagged with: jodatime
answer count: 2
downvote count: 0
has title: Aggregating objects by timestamp per day for a timespan of week
favorite count: 0
accepted answer: http://stackoverflow.com/a/24828927
tagged with: sql
tagged with: android
possible better answer: http://stackoverflow.com/a/24829161
upvote count: 1

http://stackoverflow.com/comment/38457023
score: 0
has text: @Adi You are using same network in your device ? Your URL is local url. see this http://stackoverflow.com/a/15721482/1405983
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24779771

http://stackoverflow.com/a/37424885
type: Answer
has body: Most of the time, these type of issues happen due to incorrect java version. Make sure your PATH and JAVA_HOME variables are pointing to the correct version.
has comment: http://stackoverflow.com/comment/64171480
upvote count: 9
answers question: http://stackoverflow.com/q/24766591
score: 9
downvote count: 0

http://stackoverflow.com/comment/38638287
has text: Loud, uproarious nurses? I dont understand??
comment on: http://stackoverflow.com/q/24875762
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24809928
score: 0
has body: Even if we accept your premise that generic class names (names with &lt;&gt; in them) are "unreadable", given that you expect only two classes to implement I1, most of your code will probably refer to the classes A1 and A2 directly. These class names won't have any generic parameters.
has comment: http://stackoverflow.com/comment/38528043
type: Answer
answers question: http://stackoverflow.com/q/24808996

http://stackoverflow.com/comment/38463357
comment on: http://stackoverflow.com/a/24772803
has text: I found the solution here https://stackoverflow.com/questions/5585779/how-to-convert-string-to-int-in-java and it was int foo = Integer.parseInt("1234");
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24902915
answers question: http://stackoverflow.com/q/24902849
downvote count: 0
type: Answer
score: 4
has body: Use session.doWork from hibernate. How to call a Oracle function from hibernate with return parameter? From Oracle documentation - http://docs.oracle.com/cd/F49540_01/DOC/java.815/a64686/04_call5.htm FUNCTION balance (acct_id NUMBER) RETURN NUMBER IS acct_bal NUMBER; BEGIN SELECT bal INTO acct_bal FROM accts WHERE acct_no = acct_id; RETURN acct_bal; END; From a JDBC program, your call to the function balance might look like this: CallableStatement cstmt = conn.prepareCall("{? = CALL balance(?)}"); cstmt.registerOutParameter(1, Types.FLOAT); cstmt.setInt(2, acctNo); cstmt.executeUpdate(); float acctBal = cstmt.getFloat(1);
upvote count: 4

http://stackoverflow.com/q/24767164
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/30890841
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/30780210
downvote count: 0
possible better answer: http://stackoverflow.com/a/30890841
has answer: http://stackoverflow.com/a/30780210
tagged with: hibernate-validator
answer count: 3
has title: Spring MVC with hibernate Validator to validate single basic type
favorite count: 0
has answer: http://stackoverflow.com/a/30896574
upvote count: 14
has body: Below is the mapped method that I am having trouble with, no matter what value I pass to it the validation returns "passed validation." @RequestMapping(value = "test", method = RequestMethod.POST) @ResponseBody public String getTest(@RequestBody @Valid @Max(32) long longValue, BindingResult result) { if (result.hasErrors()) { return "failed validation"; } else { return "passed validation"; } } I know the @Max works with my application because I use it for validation on custom objects that return a lot of data to the controller. It only doesn't run the validation in this case where I call @Valid and the type of validation on the object in the method parameters. Is this not allowed with hibernate-validator? I am hoping to not have to define an object that only contains a long value just so that I can run validation on it.
type: Question
score: 14

http://stackoverflow.com/comment/38467744
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24786636
has text: No. You cannot get this information for obvious reasons.
type: AnswerComment

http://stackoverflow.com/comment/38452312
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24776904
type: Comment
has text: I went through these filters, this is much like comparison of collection with external parameters, can I use these filters to compare the collection or sort the same?

http://stackoverflow.com/q/24778679
accepted answer: http://stackoverflow.com/a/24778895
has comment: http://stackoverflow.com/comment/38452221
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/38452247
tagged with: android-view
score: -1
has comment: http://stackoverflow.com/comment/38452493
has comment: http://stackoverflow.com/comment/38452439
has comment: http://stackoverflow.com/comment/38452342
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38452283
tagged with: android
has body: I've searched a lot this but I really did not find what I need exactly. What I want is : I have a listview and load it on my main class. I load it like this: ArrayAdapter<String> adapter = new ArrayAdapter<String>(Main.this, R.layout.myrow,R.id.text ); if (friends != null) { for (ParseObject friend : friends) { adapter.add((String) friend.get("name")); } } setListAdapter(adapter); and myrow layout xml is here: < RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" > </RelativeLayout > You can see I have progress bar on textview so I need to reach it and set it's visible. I mean sometimes I set it invisible sometimes visible What I did is: On my MainActivity on create method the code is here : ProgressBar my_prog; my_prog=(ProgressBar)findViewById(R.id.my_prog); my_prog.setVisibility(View.INVISIBLE); The error is: 07-16 13:35:39.219: E/AndroidRuntime(29096): java.lang.RuntimeException: Unable to start activity ComponentInfo{....MainActivity}: java.lang.NullPointerException I think I cant reach my_prog on my main activity but I need it. How can I do that. thanks in adnvace...
has title: How can I use a view from different class?
type: AnsweredQuestion
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24778895

http://stackoverflow.com/comment/38680405
has text: Can you format your code properly? It's very hard to read and understand with the inconsistent indentation and random blank lines thrown in all over the place.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24899038

http://stackoverflow.com/comment/38508408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24808196
score: 0
has text: Try to put the file in the WEB-INF folder in order to have WEB-INF/applicationContext.xml

http://stackoverflow.com/comment/38475397
has text: You can use GSON library to convert it into Java Object.
type: Comment
comment on: http://stackoverflow.com/q/24790433
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38628893
has text: multicast does not cross subnet boundaries, unless every router on the entire trip is specifically configured to propogate the traffic; that is never going to happen on the general internet. `nat` is going to break it anyway.
comment on: http://stackoverflow.com/q/24868170
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24825163
has comment: http://stackoverflow.com/comment/38540023
has comment: http://stackoverflow.com/comment/38540054
has body: Most common cause is not realising that the "User", "Role" and "Installation" classes are special, their actual names are "_User", "_Role" and "_Installation", though to do a query on the User class the recommended method is: ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery();
accepted answer of: http://stackoverflow.com/q/24820406
has comment: http://stackoverflow.com/comment/38539938
answers question: http://stackoverflow.com/q/24820406
has comment: http://stackoverflow.com/comment/38559617
score: 9
upvote count: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/38541337
type: AcceptedAnswer
type: Answer

block-cipher
tags question: http://stackoverflow.com/q/24781318
type: Tag
tag name: block-cipher

http://stackoverflow.com/a/24824776
has comment: http://stackoverflow.com/comment/38617363
has body: Go to your cassandra.yaml file. It will be present in the conf folder of your cassandra installation. For listen_address give the IP address of the cassandra server. eg. listen_address: 10.181.13.239 and then restart the cassandra server. Also check the port for native transport is not commented. There should be an entry like native_transport_port: 9042
has comment: http://stackoverflow.com/comment/38774631
has comment: http://stackoverflow.com/comment/38617494
has comment: http://stackoverflow.com/comment/38614612
has comment: http://stackoverflow.com/comment/38769054
has comment: http://stackoverflow.com/comment/38791545
has comment: http://stackoverflow.com/comment/38567466
score: 0
has comment: http://stackoverflow.com/comment/38563527
has comment: http://stackoverflow.com/comment/38563605
has comment: http://stackoverflow.com/comment/38774827
answers question: http://stackoverflow.com/q/24821966
has comment: http://stackoverflow.com/comment/38608350
has comment: http://stackoverflow.com/comment/38657580
type: Answer
has comment: http://stackoverflow.com/comment/38623608

https
tags question: http://stackoverflow.com/q/24850060
tags question: http://stackoverflow.com/q/24900209
tags question: http://stackoverflow.com/q/24780708
type: Tag
tags question: http://stackoverflow.com/q/24807704
tags question: http://stackoverflow.com/q/24908938
tags question: http://stackoverflow.com/q/24797796
tag name: https
tags question: http://stackoverflow.com/q/24751929
tags question: http://stackoverflow.com/q/24776378

http://stackoverflow.com/comment/39810502
type: QuestionComment
has text: Did you manage to fix this problem? I have similar issue. I use latest version with maven
comment on: http://stackoverflow.com/q/24813096
score: 0
type: Comment

http://stackoverflow.com/a/24757564
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24757230
has comment: http://stackoverflow.com/comment/38412617
type: Answer
accepted answer of: http://stackoverflow.com/q/24757230
upvote count: 2
has body: Look at the POMs of your project. Somewhere, someone added them without the proper scope. In Eclipse, you can use the POM editor. There is a set of tabs at the bottom of the editor. One reads "Dependency Hierarchy". Here you can search for "tomcat" and m2e will tell you which POMs contain such a dependency.
score: 2

http://stackoverflow.com/comment/38600233
type: Comment
has text: Based on what I read, wouldn't it be underdamping? Seeing as it moves slightly past the point and then back and forth a few times before settling.
type: AnswerComment
comment on: http://stackoverflow.com/a/24856559
score: 0

http://stackoverflow.com/q/24908276
answer count: 1
has comment: http://stackoverflow.com/comment/38697307
score: 0
tagged with: sockets
accepted answer: http://stackoverflow.com/a/24908750
tagged with: python
has comment: http://stackoverflow.com/comment/38697321
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38697406
has title: Python socket in java
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24908750
has body: Can a java module be modified or used within a python application when programming network socket? Is there any library for that or can jython be used for that purpose ?

http://stackoverflow.com/comment/38579277
comment on: http://stackoverflow.com/q/24846000
has text: @HovercraftFullOfEels I did something similar http://stackoverflow.com/questions/24844884/checkbox-in-jtable-always-return-false-despite-of-its-checked/24844930 but got fruitless. Unable to isolate this particular issue as a separate program
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24802799
has body: If you want to test the bytes returned by getBytes then you should test them directly, not by converting them back into another string. byte[] actual = "Oberbüren".getBytes("ISO-8859-1"); byte[] expected = new byte[] { 0x4f, 0x62, 0x65, 0x72, 0x62, 0xfc, ....}; assertArrayEquals(expected, actual); The single-argument String constructor always uses the platform default encoding to decode bytes to characters, you should always prefer the two-argument version where you can specify the correct encoding explicitly.
has comment: http://stackoverflow.com/comment/38498985
score: 0
accepted answer of: http://stackoverflow.com/q/24802552
has comment: http://stackoverflow.com/comment/38498447
answers question: http://stackoverflow.com/q/24802552
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38499075
type: Answer

http://stackoverflow.com/comment/38474166
type: AnswerComment
comment on: http://stackoverflow.com/a/24789557
type: Comment
has text: So if the answer to my original question is "yes", wouldn't this have serious implications for classes like `String`, since the elements of an array cannot be made final? The article suggests that making `x` final would eliminate the issue. Would making `a` final have the same effect?
score: 0

http://stackoverflow.com/q/24752404
has title: Get status of handling request by Spring's ResourceHttpRequestHandler.handleRequest() method
has body: I have the code like: @PostConstruct public void init() throws IOException { resourceHttpRequestHandler = new ResourceHttpRequestHandler(); resourceHttpRequestHandler.setServletContext(servletContext); resourceHttpRequestHandler.setLocations(... my locations here... ); } @RequestMapping(value = "/mypath/**", method = RequestMethod.GET) public void getResource(HttpServletRequest request, HttpServletResponse response) throws Exception { resourceHttpRequestHandler.handleRequest(request, response); /* here */ } Is it possible to know if the resolving of resource request was successful or not (after the call of method handleRequest() )?
score: 0
has comment: http://stackoverflow.com/comment/38410735
has comment: http://stackoverflow.com/comment/38407215
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38410260
tagged with: spring
tagged with: java
type: Question

http://stackoverflow.com/comment/128022984
type: AnswerComment
comment on: http://stackoverflow.com/a/24777035
score: 0
has text: There is a trackpad gesture (multi-touch swipe) that makes the view of the table change, even if the view is disabled.
type: Comment

http://stackoverflow.com/q/24780956
has comment: http://stackoverflow.com/comment/38456917
tagged with: java
has answer: http://stackoverflow.com/a/24781143
has answer: http://stackoverflow.com/a/24781066
type: Question
has title: Long.decode and Long.parseLong
tagged with: long-integer
has body: In a test I see that Long.decode work similar to Long.parseLong for simple number format strings (i mean strings without '0x' ,...). System.out.println(Long.decode("123") + Long.decode("123")); // prints 246 System.out.println(Long.parseLong("123") + Long.parseLong("123")); // same as above can I use Long.decode instead of Long.parseLong anywhere? if not why?
score: 4
has comment: http://stackoverflow.com/comment/38456851
upvote count: 4
accepted answer: http://stackoverflow.com/a/24781143
has answer: http://stackoverflow.com/a/24781170
has comment: http://stackoverflow.com/comment/38456645
has answer: http://stackoverflow.com/a/24781148
downvote count: 0
favorite count: 0
tagged with: hex
possible better answer: http://stackoverflow.com/a/24781375
answer count: 5
has answer: http://stackoverflow.com/a/24781375
type: AnsweredQuestion

http://stackoverflow.com/q/24867734
has title: NanoHTTPD: upload a file using a html form (POST)
has answer: http://stackoverflow.com/a/29691082
has comment: http://stackoverflow.com/comment/47019151
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/47489514
downvote count: 0
favorite count: 0
tagged with: nanohttpd
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/52806589
has body: i'm using NanoHTTPD webserver 2.1.0 on a Java Desktop Env. (no Android) Everything is working fine...but not the file upload using the POST method (PUT is not supported with forms) Here is my HTML code: choose a file upload And here is my server methode: public Response serve(IHTTPSession session) { if (session.getMethod() == Method.POST) { Map<String, String> files = new HashMap<String, String>(); session.parseBody(files); //this prints {file=C:\path-to-java-tmp-files\NanoHTTPD-4635244586997909485} //the number is always different System.out.println(files.toString()); } else { //page containing the index.html including the form return page; } } And here is the Problem: The temp-file doesn't exist. There is another temp-file with a different "number" at the end existing and this seems to be the correct file, because the content is the same as the content of the uploaded file. So how to get the correct temp-filename? Another problem is: The temp-file contains the hole POST content: -----------------------------115801144322347 Content-Disposition: form-data; name="file"; filename="filename.txt" Content-Type: application/octet-stream -->content of the uploaded file -----------------------------115801144322347-- This is a problem if the content is a pic or a binary. It seems NanoHTTPD doesn't do any spezial with a POST request. it does always the same...saving the request to a tmp-file and serving a page. So: - How to get the correct temp-file? --> I think this is a bug. I'm getting a correct path and name, but the "number" is broken. idk...should i temporarily change the java tmp-path if an upload happens and then delete the file always. Then I only have one tmp-file independent of any naming? - how to kill the html request header out of the file Or i'm doing something wrong? Is this the correct way to upload files to nanohttpd? thx for your help!
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/28739744
upvote count: 7
type: Question
answer count: 2

http://stackoverflow.com/comment/38585216
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24849043
has text: @user2864740 I have tried searching, but I wasn't able to search with my keywors :)

http://stackoverflow.com/q/24762522
has answer: http://stackoverflow.com/a/55615500
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44372931
upvote count: 1
tagged with: war
score: 1
tagged with: java
tagged with: eclipse
has title: Eclipse error exporting war
has answer: http://stackoverflow.com/a/30682832
type: Question
answer count: 2
has body: I'm trying to export a Web Project as a WAR file, I get this error: org.eclipse.core.commands.ExecutionException: Error exportingC:/Users/jp/Desktop/beta.war at org.eclipse.jst.j2ee.internal.archive.operations.ComponentExportOperation.execute(ComponentExportOperation.java:150) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:385) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:410) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:360) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:247) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:219) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:207) at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1CatchThrowableRunnableWithProgress.run(DataModelWizard.java:220) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Caused by: org.eclipse.jst.jee.archive.ArchiveSaveFailureException: java.lang.NullPointerException at org.eclipse.jst.j2ee.internal.archive.operations.FlatComponentArchiver.saveArchive(FlatComponentArchiver.java:126) at org.eclipse.jst.j2ee.internal.archive.operations.ComponentExportOperation.export(ComponentExportOperation.java:193) at org.eclipse.jst.j2ee.internal.archive.operations.ComponentExportOperation.execute(ComponentExportO…
downvote count: 0
tagged with: nullpointerexception

http://stackoverflow.com/a/24895050
type: AcceptedAnswer
upvote count: 13
accepted answer of: http://stackoverflow.com/q/24894501
type: Answer
answers question: http://stackoverflow.com/q/24894501
downvote count: 0
score: 13
has body: You should pair java.util.Timer with java.util.TimerTask Timer t = new Timer( ); t.scheduleAtFixedRate(new TimerTask() { @Override public void run() { System.out.println("Hey"); } }, 1000,5000); 1000 means 1 second delay before get executed &amp; 5000 means will be repeated every 5 seconds. To stop it , simply call t.cancel()

http://stackoverflow.com/a/24830798
answers question: http://stackoverflow.com/q/24830728
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24830728
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
has body: the JRE System Library contains the basic classes, contained in rt.jar, the package java.lang., java.util., etc. and the Server Runtime contains the classes required for the Java EE framework, Servlets, JMS, etc

http://stackoverflow.com/comment/38439562
type: QuestionComment
comment on: http://stackoverflow.com/q/24771788
has text: Is this a joke or something...
score: 2
type: Comment

http://stackoverflow.com/q/24763690
has body: I am using a SimpleAsyncTaskExecutor inside of my DefaultMessageListenerContainer and I would like to monitor the active thread count using a JMX mbean. I have the mbean created and connected, but in monitoring on JConsole, the active thread count on the taskExecutor remains at the value it is created with. It doesn't fluctuate as the DMLC receives inbound messages. Shouldn't this number be fluctuating? Here is the writeup from Spring on the SimpleAsyncTaskExecutor: SimpleAsyncTaskExecutor: This implementation does not reuse any threads, rather it starts up a new thread for each invocation. However, it does support a concurrency limit which will block any invocations that are over the limit until a slot has been freed up. If you’re looking for true pooling, keep scrolling further down the page. Spring Framework Task Execution and Scheduling Here is my setup using Spring-jms 3.0.3.RELEASE: &lt;bean id="inboundMessageAdaptorMessageContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"&gt; &lt;property name="connectionFactory" ref="singleJMSConnectionFactory" /&gt; &lt;property name="destination" ref="eventReceiveQueue" /&gt; &lt;property name="sessionTransacted" value="true" /&gt; &lt;property name="messageListener" ref="inboundMessageRetryingListenerAdapter" /&gt; &lt;property name="concurrentConsumers" value="15" /&gt; &lt;/bean&gt; My Mbean exposes fields in the DMLC. It grabs the private field threadCount on the super class of the TaskExecutor: Field taskExecutorField = dmlc.getClass().getDeclaredField("taskExecutor"); taskExecutorField.setAccessible(true); taskExecutor = (SimpleAsyncTaskExecutor) taskExecutorField.get(dmlc); threadCountField = taskExecutor.getClass().getSuperclass().getDeclaredField("threadCount"); threadCountField.setAccessible(true); return (int) threadCountField.get(taskExecutor); I've tried tweaking with settings on the DMLC like IdleTaskExecutionLimit and CacheLevel, but they did not achieve my goal. I'd like to …
tagged with: spring
has answer: http://stackoverflow.com/a/24764643
tagged with: spring-integration
score: 0
tagged with: java
answer count: 1
has title: Spring - DefaultMessageListenerContainer TaskExecutor Thread monitoring
accepted answer: http://stackoverflow.com/a/24764643
tagged with: mbeans
type: AnsweredQuestion
type: Question
tagged with: multithreading

http://stackoverflow.com/q/24892707
upvote count: 1
has comment: http://stackoverflow.com/comment/38685356
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24893180
downvote count: 0
has body: Please teach me how can I solve a MediaPlayer error. I have Mediaplayer, MediaController and listview. When I touch the list, a song starts with MediaController, but when I touch keycode_home and restart my app, the error occurs. Here is my code and error. java.lang.RuntimeException: Unable to resume activity {}: java.lang.IllegalStateException Caused by: java.lang.IllegalStateException at android.media.MediaPlayer.getCurrentPosition(Native Method) int si[]={R.raw.sample1,R.raw.sample2,R.raw.sample3}; onCreate ItemBean IB1 = new ItemBean(); IB1.setName("sample1"); IB1.setUrl("http~"); ItemBean IB2 = new ItemBean(); IB2.setName("sample2"); IB2.setUrl("http~"); ItemBean IB3 = new ItemBean(); IB3.setName("sample3"); IB3.setUrl("http~"); List&lt;ItemBean&gt; list = new ArrayList&lt;ItemBean&gt;(); list.add(IB1); list.add(IB2); list.add(IB3); mp = new MediaPlayer(); controller = new MediaController(this); controller.setAnchorView(findViewById(R.id.mediaController)); controller.setMediaPlayer(this); list2 = (ListView) findViewById(R.id.song_list); SonglistAdapter_test adapter = new SonglistAdapter_test(getApplicationContext(),list); list2.setAdapter(adapter); list2.setOnItemClickListener(this); } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,long id) { try { mp.reset(); mp.release(); mp = MediaPlayer.create(SongsActivity.this,si[position]); } catch (Exception e) {} mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { handler.post(new Runnable() { @Override public void run() { controller.setEnabled(true); controller.show(mp.getDuration()); mp.start(); try { Method m = android.widget.MediaController.class.getDeclaredMethod("updatePausePlay"); m.setAccessible(true); m.invoke(controller); } catch (Exception e) { } } }); } }); } @Override public void start(){ mp.start(); } @Override public void pause(){ mp.pause(); } @Override public int getDuration(){ return mp.getD…
tagged with: media-player
accepted answer: http://stackoverflow.com/a/24893180
tagged with: android
answer count: 1
favorite count: 0
has title: MediaPlayer error-getCurrentPosition

http://stackoverflow.com/q/24786090
tagged with: jboss
score: 0
has title: NullPointerException during deployment of Spring application packaged as a JBoss service archive
has answer: http://stackoverflow.com/a/24897319
tagged with: spring
possible better answer: http://stackoverflow.com/a/29375177
has comment: http://stackoverflow.com/comment/38470024
has body: I have a JBoss service archive (SAR) that I'm deploying to JBoss 4.2.2.GA. This deploys correctly locally, but throws the following exception during deployment on another server also running JBoss 4.2.2.GA. Caused by: java.lang.NullPointerException at org.springframework.core.SerializableTypeWrapper$TypeProxyInvocationHandler.invoke(SerializableTypeWrapper.java:239) This is bubbling up from the following line of code in the application: ApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class); Where the Config class is a Java Config to instantiate a single bean. The libraries, e.g. Spring 4.0.2.RELEASE, are packaged with the SAR so I wouldn't think it's a library mismatch issue, but I may be wrong. What might be the issue here? Edit 1: Complete Stack trace org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.NullPointerException) at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:196) at org.jboss.system.ServiceController.install(ServiceController.java:226) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at com.sun.proxy.$Proxy4.install(Unknown Source) at org.jboss.deployment.SARDeployer.create(SARDeployer.java:249) at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818) at …
has answer: http://stackoverflow.com/a/29375177
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38470948
has comment: http://stackoverflow.com/comment/38470290
tagged with: java
has comment: http://stackoverflow.com/comment/38467876
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24897319

http://stackoverflow.com/a/24758227
answers question: http://stackoverflow.com/q/24757983
upvote count: 1
downvote count: 0
type: Answer
score: 1
has body: For onUpgrade to get called you must increase the database version that you supply to the SqliteOpenHelper implementation constructor. Use a field in your class to store the same and increment it when you change your database schema.

http://stackoverflow.com/q/24818609
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38527880
has title: java.net.SocketException: A system call received a parameter that is not valid
type: Question
has comment: http://stackoverflow.com/comment/38529375
tagged with: java
linked to: http://stackoverflow.com/q/8216713
upvote count: 2
has comment: http://stackoverflow.com/comment/38528565
has comment: http://stackoverflow.com/comment/38527973
has body: This exception shows in server logs when any I/O operation is performed. I searched but could not get the reason of its occurence. this is not affecting the code flow . logs : 'weblogic.kernel.Default (self-tuning)'> &lt;> &lt;> &lt;> &lt;1403635070779> ####&lt;Jun 25, 2014 12:07:50 AM IST&gt; &lt;Error&gt; &lt;Socket&gt; &lt;somemail.com&gt; &lt;AdminServer&gt; &lt;[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'&gt; &lt;&lt;WLS Kernel&gt;&gt; &lt;&gt; &lt;&gt; &lt;1403635070803&gt; &lt;BEA-000403&gt; &lt;IOException occurred on socket: Socket[addr=/ip,port=61142,localport=7001] java.net.SocketException: A system call received a parameter that is not valid.. java.net.SocketException: A system call received a parameter that is not valid. at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:163) at java.net.SocketInputStream.read(SocketInputStream.java:133) at weblogic.socket.SocketMuxer.readFromSocket(SocketMuxer.java:986) at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:920) at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:887) at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:343) at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
has comment: http://stackoverflow.com/comment/38529911
tagged with: exception
has comment: http://stackoverflow.com/comment/38527718
favorite count: 0
score: 2
answer count: 0
downvote count: 0

bukkit
tags question: http://stackoverflow.com/q/24899410
tag name: bukkit
tags question: http://stackoverflow.com/q/24838008
tags question: http://stackoverflow.com/q/24763246
tags question: http://stackoverflow.com/q/24784685
type: Tag
tags question: http://stackoverflow.com/q/24815028
tags question: http://stackoverflow.com/q/24896577

http://stackoverflow.com/a/24814631
score: 11
downvote count: 0
upvote count: 11
has body: As long as you override equals() on each key and value contained in the map, then m1.equals(m2) should be reliable to check for maps equality. The same result can be obtained also by comparing toString() of each map as you suggested, but using equals() is a more intuitive approach. May not be your specific situation, but if you store arrays in the map, may be a little tricky, because they must be compared value by value, or using Arrays.equals(). More details about this see here.
type: Answer
answers question: http://stackoverflow.com/q/24814577

http://stackoverflow.com/q/24763246
accepted answer: http://stackoverflow.com/a/24763491
tagged with: bukkit
type: Question
has body: I'm having an issue with a bukkit plugin I'm updating. In what I'm doing, when a player uses a bed, it saves the following data to a file named beds.yml: ThePlayersUsername: X: (double) Y: (double) Z: (double) world: worldName When the plugin is initialized, I need to declare a few variables, because they are used later on in the code. Player p = (Player)sender; String dn = p.getDisplayName(); dn = ChatColor.stripColor(dn); double x = (Double) yml.get(dn + ".x"); double y = (Double) yml.get(dn + ".y"); double z = (Double) yml.get(dn + ".z"); World bw = Bukkit.getWorld((yml.get(dn + ".world").toString())); Location l = new Location(bw, x, y, z); I can't do this if they don't exist, but, I can't reset to any defaults because new items get added to the config each time someone enters a bed, and all data is user-specific. How would I go about checking if the player has some data in the config, if not, telling them to sleep in a bed, and when they do have data in the config, how to declare it so they can use a command to teleport using data from the config. Thanks.
answer count: 2
has comment: http://stackoverflow.com/comment/38423370
tagged with: yaml
downvote count: 0
tagged with: minecraft
possible better answer: http://stackoverflow.com/a/24765619
has answer: http://stackoverflow.com/a/24765619
has answer: http://stackoverflow.com/a/24763491
favorite count: 0
has title: Bukkit plugin - check if specific data from a file exists, and declare it
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/38691912
has text: @Pat You are somewhat correct. PMA seems to hide the milliseconds part, however, when i use a query to get the timestamp from the database. The miliseconds part is always 0, for example 2014-07-23 10:23:12.0.
comment on: http://stackoverflow.com/q/24904956
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24834731
tagged with: android
has answer: http://stackoverflow.com/a/24834767
score: 1
upvote count: 1
answer count: 1
has title: OnPrimaryClipChangedListener() works only for once
tagged with: java
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has body: I'm trying to make a application which toast the word you copied to the clipboard in a WebView for practice. The problem is, this code works for the first word(except somehow it toasts for three times. Sort of blink.); however, when I try to copy a word for the second time, it shows "Unfortunately, (my app's name) has stopped" and stop working. It still shows the website, but the toast function stops. I'm running this program on an emulator and using Eclipse. Following Mr/Ms.jgriffsta's advise, I added a try&amp;catch statement, then for the second time it toasts "Error occured" once, and then toasts the copied word for two times. Again sort of blink. //ItemDetailActivity.java public class ItemDetailActivity extends Activity { private WebView mWeb; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.item_detail); Intent intent = getIntent(); String link = intent.getStringExtra("LINK"); mWeb = (WebView)findViewById(R.id.web); mWeb.loadUrl(link); final ClipboardManager cm = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE); cm.addPrimaryClipChangedListener(new OnPrimaryClipChangedListener(){ @Override public void onPrimaryClipChanged(){ ClipData.Item item = cm.getPrimaryClip().getItemAt(0); String text = item.getText().toString(); Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show(); } }); } } ----LogCat-------- 07-18 18:15:07.530: E/chromium(837): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found. 07-18 18:15:07.540: E/chromium(837): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed. 07-18 18:15:07.540: E/chromium(837): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found. 07-18 18:15:07.540: E/chromium(837): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed. 07-18 18:15:07.540: E/chromium(837): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed 07-18 18:15:10.360: E/chromium(837): [ERROR:simple_…
type: Question

http://stackoverflow.com/q/24904821
has answer: http://stackoverflow.com/a/24905281
tagged with: java
has answer: http://stackoverflow.com/a/24904958
tagged with: automation
upvote count: 0
has answer: http://stackoverflow.com/a/24905243
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24905243
accepted answer: http://stackoverflow.com/a/24904958
favorite count: 0
score: -1
tagged with: selenium-webdriver
answer count: 3
tagged with: selenium
has body: While creating a code for reading data from excel, for the code HSSFWorkbook wb = new HSSFWorkbook(input); An error is shown for input in eclipse. The error shown is "Input cannot be resolved to a type." I have read that by this statement we are creating an instance of the excel. But what should we provide as input for this step?
downvote count: 1
has title: HSSFWorkbook error shown in code
tagged with: testing

http://stackoverflow.com/a/24834184
answers question: http://stackoverflow.com/q/24824103
score: 5
upvote count: 5
has body: Thanks for your answers @JamesB and @PetrMensik for letting me know about the phase element within the POM. It helped me solve my problem. I finally settled for this: org.apache.maven.plugins maven-pmd-plugin ${pmd.version} true UTF-8 100 1.7 compile check cpd-check I used the phase:compile, the reason being I have plenty of tests in my project which take up a lot of time to execute. And, its quite irritating to wait for those tests to finish and be notified about a PMD violation at the end of all the tests. I needed something just before the tests. Hence, I settled for compile. Further suggestions are welcome. :)
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/93188555
type: Answer
accepted answer of: http://stackoverflow.com/q/24824103

http://stackoverflow.com/comment/38693095
has text: Isn't there a way for java to type check in order to determine when one type of input ends and the other starts?
type: AnswerComment
comment on: http://stackoverflow.com/a/24906062
type: Comment
score: 0

http://stackoverflow.com/a/24893326
upvote count: 3
answers question: http://stackoverflow.com/q/24891990
has body: Based on @Mac70's answer and a few additions, private static Map&lt;String, String&gt; map; private static void makeMap(String[] args) { map = new HashMap&lt;&gt;(); for (String arg : args) { if (arg.contains("=")) { //works only if the key doesn't have any '=' map.put(arg.substring(0, arg.indexOf('=')), arg.substring(arg.indexOf('=') + 1)); } } } public static void main(String[] args) { makeMap(args); //.. String param3 = map.get("param3name"); String param1 = map.get("param1name"); } If you need anything extensive, you need to look at @Archangel33's answer.
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/q/24817936
has comment: http://stackoverflow.com/comment/38526642
has body: I am writing some classes in Eclipse in Java, and I would like to know how to generate auto generate code. For example, if I have abstract class and I expect to be use as extends class I would like to force override some classes. I see that same classes has this implemented, and if you extend from them eclipse auto generate empty methods for override.
has title: Create auto generated methods in your class in eclipse
tagged with: eclipse
answer count: 1
has answer: http://stackoverflow.com/a/24818081
tagged with: auto-generate
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24818081
type: Question

http://stackoverflow.com/a/24889680
has comment: http://stackoverflow.com/comment/38662645
type: Answer
accepted answer of: http://stackoverflow.com/q/24889564
answers question: http://stackoverflow.com/q/24889564
has comment: http://stackoverflow.com/comment/38662563
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38663292
has body: Try RMI. You may decouple server-side from the actual controls that you actually use locally, without the need for socket programming. And from a programmatic point of view, you're actually using and calling methods on objects as if they're your own and locally available.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38680645
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24899211
has text: http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html
score: 0

http://stackoverflow.com/comment/38494813
type: QuestionComment
comment on: http://stackoverflow.com/q/24801054
has text: Update the question with the exception
score: 0
type: Comment

http://stackoverflow.com/comment/38452487
type: Comment
has text: Thanks! :) I've added list.add("list"); and it prints whats within the "" but how do I get it show all my apps ? :( I've tested around abit now but still cant figure it out
comment on: http://stackoverflow.com/a/24776860
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38665638
score: 0
type: Comment
type: QuestionComment
has text: i am not sure, where this is going, but e.g. in `groovysh` you can access the context via `this`. so this works in `groovysh`: `m='n'; n='p'; "${this."$m"}"`
comment on: http://stackoverflow.com/q/24885385

http://stackoverflow.com/a/24856513
has body: You don't get that exception when writing. You get it when reading: typically when calling readUTF() when the next thing in the input isn't produced by writeUTF(). In other words, an application protocol error. In this case it isn't produced by what you've posted but by what you haven't posted. I don't see why you don't write the extended piece of data in separate writes and read it in separate reads, rather than giving yourself the trouble of concatenating and then splitting it up again. I also don't know what all the extra parentheses are supposed to be for. Don't write redundant syntax.
has comment: http://stackoverflow.com/comment/38600089
has comment: http://stackoverflow.com/comment/38599955
type: Answer
has comment: http://stackoverflow.com/comment/38716159
score: 1
has comment: http://stackoverflow.com/comment/38599999
upvote count: 1
has comment: http://stackoverflow.com/comment/38600040
answers question: http://stackoverflow.com/q/24856440
accepted answer of: http://stackoverflow.com/q/24856440
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24844183
has body: I want to set the text size of the action bar based on the screen size and resolution such as 4" 480 x 800 hdpi. I'm at the end of my app development so now I'm just making sure the app layout fits in all the multiple android screen sizes. The problem is that I can't set the title size per layout such as layout-normal-hdpi and layout-normal-ldpi so in some device layouts the text I place in the title text runs out of space since the text is too big when test it on an emulator. Here's the styles.xml code.
tagged with: android
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: How do you set the action bar and title window text size for multiple screen sizes?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24844492
type: Question
downvote count: 0

http://stackoverflow.com/comment/38656213
has text: @AtulSharma If you try with a `map` as I gave in the edits you will notice that it wont work.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24885013
type: Comment

http://stackoverflow.com/a/24824910
score: 2
upvote count: 2
has body: JGit provides a git-add ant task among other git related tasks (gitadd, gitcheckout, gitclone, gitinit). Either use that task => get the jarfile here or check the sources of gitadd task for inspiration. Beware - when running on Windows OS you need to patch the git-add task to make it work : // original line 149 //return new File(file).getCanonicalPath().substring(prefix.length() + 1); String result = new File(file).getCanonicalPath().substring(prefix.length() + 1); if (File.separatorChar != '/') { result = result.replace(File.separatorChar, '/'); } return result; means the fileseparator has to be unix style.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24824015
type: Answer
accepted answer of: http://stackoverflow.com/q/24824015

http://stackoverflow.com/a/24890479
accepted answer of: http://stackoverflow.com/q/24889972
answers question: http://stackoverflow.com/q/24889972
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It looks like that groovy uses ObjectRange. In the docs you can see that it inherits the add method from java.util.AbstractList which throws the UnsupportedOperation Exception.
score: 1
upvote count: 1

http://stackoverflow.com/comment/38669872
has text: Actually, CP437 has a one-byte encoding with exactly 256 characters and they are in common with Unicode. So, conversion between CP437 and Unicode is reversible and preserves all byte values.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24890697

http://stackoverflow.com/a/38705043
accepted answer of: http://stackoverflow.com/q/24893604
answers question: http://stackoverflow.com/q/24893604
type: Answer
score: 1
has body: I thought I anwer my own question, since the solution was hidden in a comment until now: Removing -ea from the default parameters, but keeping it in the run configuration solved the problem, for me.
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24796318
type: Question
score: 0
tagged with: google-cloud-datastore
accepted answer: http://stackoverflow.com/a/24809861
answer count: 1
has body: We are developing a library that manages the access to our Google Cloud Datastore project. Our datastore project consists out of multiple namespaces (one for development, one for testing, etc...). To access the stored data we use the Query builder provided by Google. We need a 'Kind Query' for a certain namespace but in their docs they explain Queries of this type are implicitly restricted to the current namespace. We tried changing the current namespace by using the NamespaceManager but since this isn't an Google App Engine application, that didn't work. Is it possible to change the current namespace?
has answer: http://stackoverflow.com/a/24809861
type: AnsweredQuestion
has title: How to programmatically change the namespace of a Google Cloud Datastore project?
tagged with: java

http://stackoverflow.com/comment/38512236
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24810028
score: 0
has text: @CullenJ add to your question the hexdump for your properties file pls

http://stackoverflow.com/comment/38639434
has text: why not create a base request, and then extend that request for each new request?
type: QuestionComment
comment on: http://stackoverflow.com/q/24877292
score: 2
type: Comment

http://stackoverflow.com/a/24785936
type: Answer
has body: Scheduling a Java EE 7 Batch job can be done in couple of ways: Using @Schedule annotation which supports cron-like syntax Using ManagedScheduledExecutorService More details at: http://blog.arungupta.me/2014/07/schedule-javaee7-batch-jobs-techtip36/ If you want to invoke using curl, then you can put the code in a REST endpoint using @GET annotation. Add a command to invoke this endpoint in crontab.
answers question: http://stackoverflow.com/q/24784171
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/24821476
tagged with: sorting
tagged with: jtable
tagged with: filter
has comment: http://stackoverflow.com/comment/38538520
has answer: http://stackoverflow.com/a/24827763
linked to: http://stackoverflow.com/q/24228243
favorite count: 0
has body: I am trying to filter my table by value in text field but whenever I write anything to my text field all rows in table all filtered (so there are no rows displayed) even if the table contains that word or number. public JTextField filterT = new JTextField(); private TableRowSorter&lt;TableModel&gt; sorter; sorter = new TableRowSorter&lt;TableModel&gt;(tm); //tm is my table model filterT.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { String text = filterT.getText(); filter(text); } @Override public void removeUpdate(DocumentEvent e) { String text = filterT.getText(); filter(text); } @Override public void changedUpdate(DocumentEvent e) { String text = filterT.getText(); filter(text); } }); private void filter(String text) { RowFilter&lt;TableModel, Object&gt; rf = null; try { rf = RowFilter.regexFilter(text, 0); } catch (java.util.regex.PatternSyntaxException ee) { return; } sorter.setRowFilter(rf); jTable1.setRowSorter(sorter); } What is wrong ?
has answer: http://stackoverflow.com/a/62962294
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38533327
has title: Filter jTable based on text field
has comment: http://stackoverflow.com/comment/38533308
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/38613829
type: QuestionComment
has text: @MarounMaroun Won't work for `(x AND y) OR z`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24864042

http://stackoverflow.com/comment/38526890
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24805951
has text: See [How to populate a TableView that is defined in an fxml file](http://stackoverflow.com/questions/11180884/how-to-populate-a-tableview-that-is-defined-in-an-fxml-file-that-is-designed-in) for the part "populate the table" of your question. "retrieve data" part is a core Java. Search for tutorials about it. But be a ware on updating JavaFX GUI with retrieved data. Namely the DB fetching must be in different thread other than JavaFX Main thread. For that purposes use JavaFX services and tasks. Again search for "JavaFX: background periodic sql quering", "JavaFX: GUI freeze on DB query" etc.GL.

http://stackoverflow.com/comment/38829519
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24883075
score: 1
has text: Why has this gotten so many upvotes? Don't use more abstraction than you need to!

http://stackoverflow.com/q/24800982
accepted answer: http://stackoverflow.com/a/24802601
type: Question
has comment: http://stackoverflow.com/comment/38494678
has comment: http://stackoverflow.com/comment/38494531
has comment: http://stackoverflow.com/comment/38494656
has comment: http://stackoverflow.com/comment/38494546
has comment: http://stackoverflow.com/comment/38494452
has title: I can not get result from AsyncTask?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/24802601
tagged with: multithreading
tagged with: android
has comment: http://stackoverflow.com/comment/38494740
type: AnsweredQuestion
has body: Is this code true .I am using from AsyncTask for get result but cant not see any result and i am using WampServer. I think that my error logical is in my getter/setter : public class NotesActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebPageTask task = new WebPageTask(); task.execute(new String[] { "http://192.168.5.170:8081/note-server/" }); } private class WebPageTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { String response = ""; for (String url : urls) { DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); try { HttpResponse execute = client.execute(httpGet); InputStream content = execute.getEntity().getContent(); BufferedReader buffer = new BufferedReader( new InputStreamReader(content)); String s = ""; while ((s = buffer.readLine()) != null) { response += s; } } catch (Exception e) { e.printStackTrace(); } } return response; } @Override protected void onPostExecute(String result) { ArrayList&lt;StructTask&gt; nettasks = new ArrayList&lt;StructTask&gt;(); JSONObject object = null; JSONArray tasks = null; StructTask task = new StructTask(); try { tasks = new JSONArray(result); for (int i = 0; i &lt; tasks.length(); i++) { object = tasks.getJSONObject(i); task.setid(object.getLong("task_id")); task.settitle(object.getString("task_title")); task.setdesc(object.getString("task_desc")); task.settone(object.getBoolean("task_done")); nettasks.add(task); } } catch (JSONException e) { e.printStackTrace(); } Log.i("LOG","dd"); for (StructTask taskesss : nettasks) { Log.i("LOG", "Taskes: " + taskesss.getid()+"|"+taskesss.gettitle()+"|"+taskesss.getdesc() + "-" + taskesss.getdone()); } } } } And this is Getter/Setter in StructTask.java. I think that i have logical error in my class getter/setter : public class StructTask { private long id; private String title; pri…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38494761
tagged with: mysql
upvote count: 1

http://stackoverflow.com/a/24923138
type: Answer
accepted answer of: http://stackoverflow.com/q/24906553
answers question: http://stackoverflow.com/q/24906553
score: 0
has body: Yes, you can delete a message type. If that message type is used as a field type in any other messages, change those fields to bytes instead, which is compatible. You may also want to rename the field to contain the word obsolete. I recommend this rather than deleting the field entirely so that no one accidentally reuses the field number for some new field.
type: AcceptedAnswer

http://stackoverflow.com/a/24845348
answers question: http://stackoverflow.com/q/24845281
has comment: http://stackoverflow.com/comment/38581022
upvote count: 8
has comment: http://stackoverflow.com/comment/38577962
has comment: http://stackoverflow.com/comment/38578220
type: Answer
has body: It uses the iterator of the Iterable collection, e.g. List. It is the duty of the implementer of the Iterator to write the hasnext() method to return false if there is no next item which will be the case if the collection is empty
score: 8
downvote count: 0

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

http://stackoverflow.com/a/24845311
answers question: http://stackoverflow.com/q/24838084
type: Answer
upvote count: 1
score: 1
has body: Neither the class Connection you get with connect(...), nor Document has a method to get the documents size. But possible you can use a workaround: int bytes = Jsoup.connect(...).get().toString().length(); With get you download the the full document, hence it's size is amount of bytes transferred. For POST you have to go the same way. Can I have one instance in my application and know how many bytes were transferred in total ? There are many ways: use a singleton or a method that downloads your website and counts the bytes. public class Example { private static long bytesTotal; private Example() { } public static Document loadDocument(String url) throws IOException { final Document doc = Jsoup.connect(url).get(); bytesTotal += doc.toString().length(); return doc; } } A far better solution: Checkout Jsoup git and write a counter yourself - and push it ;-) would be a nice extension.
accepted answer of: http://stackoverflow.com/q/24838084
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42771855
comment on: http://stackoverflow.com/a/24902520
type: AnswerComment
has text: Jackson version 2.4 added support for forward references, meaning that regardless of ordering of JSON input, all object id references can be succesfully resolved. So solution may be as simple as upgrade.
type: Comment
score: 1

http://stackoverflow.com/q/24860224
has answer: http://stackoverflow.com/a/24860315
has answer: http://stackoverflow.com/a/24860290
score: 0
has title: how to use Excel in android application
has comment: http://stackoverflow.com/comment/38607911
has answer: http://stackoverflow.com/a/24860939
has body: So, i building an application that doing that: when the user write a name in edittext and click a button, i want the application to give the user some information about this name, I have an Excel with that information, how can i add this Excel into my apk And how can i read it from there? for each name his specific information.. the Excel look like that: http://s18.postimg.org/ofcgudlk9/image.jpg So for example, when the user write "android" in the edittext and click the button, i want a toast that will show "number: 1234 , more: good" Any Idea?
type: UnansweredQuestion
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/24893564
tagged with: java
tagged with: excel
type: Question

http://stackoverflow.com/q/24817238
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24817298
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jsp
has answer: http://stackoverflow.com/a/24817298
has body: I have 2 links from jsp page which maps the same servlet (ViewEmployee.java) .I want to use the same doget method to fetch the employeee data but only the difference will be redirecting to different jsp pages jsp code which maps the servlet MODIFY EMPLOYEE VIEW EMPLOYEE The servlet code where i want to put an if condition protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { user=new UserDAO(); HttpSession session=request.getSession(true); int empid=(int)session.getAttribute("EMPID"); employeeBean=user.fetchEmployeeDetails(empid); request.setAttribute("employeebean", employeeBean); //I want to put the if condition and want to redirect to different jsp page according to the link clicked by the user request.getRequestDispatcher("com_viewuser.jsp").forward(request, response); } What should be my if condition to distinguish between the two
tagged with: servlets
has title: How to reuse the code in servlet when mapping servlet from the jsp page
answer count: 1

http://stackoverflow.com/comment/38689860
score: 0
type: Comment
type: QuestionComment
has text: @user2820823 Yo welcome!! mate..
comment on: http://stackoverflow.com/q/24903941

xpath
tags question: http://stackoverflow.com/q/24789792
tag name: xpath
tags question: http://stackoverflow.com/q/24906254
tags question: http://stackoverflow.com/q/24749788
type: Tag

http://stackoverflow.com/comment/38412318
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Making a OneToOne-relation lazy](http://stackoverflow.com/questions/1444227/making-a-onetoone-relation-lazy)
comment on: http://stackoverflow.com/q/24757555

http://stackoverflow.com/q/24895179
has answer: http://stackoverflow.com/a/24895221
has comment: http://stackoverflow.com/comment/38675678
has body: I'm trying to make a little game with java swing. For starters the welcome screen appears tot he user where he has to choose the number of players for the game. I'm trying to find a way so that when the user chooses 1 of the 4 buttons the window will close, the number he chooses will be available in main and then the next window will open (using the number the user chose). This is my code: Main.java package projtest1; public class Main { public static void main(String[] args) { WelcomeScreen ws = new WelcomeScreen(); ws.setVisible(true); int k = ws.returnChoise(); System.out.println(k); //MainScreen ms = new MainScreen(); //ms.setVisible(true); } } WelcomeScreen.java package projtest1; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class WelcomeScreen extends JFrame { public int choise=0; private JLabel firstLabel = new JLabel("Welcome fellas!", JLabel.CENTER); private JLabel secondLabel = new JLabel("Choose number of players", JLabel.CENTER); JPanel choisePanel = new JPanel(); private JButton button2 = new JButton("2"); private JButton button3 = new JButton("3"); private JButton button4 = new JButton("4"); private JButton button5 = new JButton("5"); public WelcomeScreen() { setTitle("Welcome screen"); setSize(400, 400); setMinimumSize(new Dimension(400,400)); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridLayout gl = new GridLayout(3, 1); gl.setHgap(1); gl.setVgap(2); setLayout(gl); add(firstLabel); add(secondLabel); choisePanel.setLayout(new FlowLayout()); choisePanel.add(button2); choisePanel.add(button3); choisePanel.add(button4); choisePanel.add(button5); add(choisePanel); ClickListener clickListener = new ClickListener(); button2.addActionListener(clickListener); button3.addActio…
tagged with: dispose
accepted answer: http://stackoverflow.com/a/24895221
answer count: 1
tagged with: jframe
has title: How to close window and open a new one on button press in Java Swing
tagged with: swing
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
tagged with: actionlistener

http://stackoverflow.com/a/24902155
answers question: http://stackoverflow.com/q/24901922
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24901922
has body: File imgFile = new File(“/sdcard/Images/test_image.jpg”); if(imgFile.exists()){ Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath()); ImageView myImage = (ImageView) findViewById(R.id.imageviewTest); myImage.setImageBitmap(myBitmap); }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24775535
has answer: http://stackoverflow.com/a/24776544
has answer: http://stackoverflow.com/a/24776192
accepted answer: http://stackoverflow.com/a/24776192
has body: The map shows up perfectly when I first select the tab fragment, however if I navigate to other tab and reselect the map fragment tab it will throws me this error - "Binary XML file line #9: Error inflating class fragment". I have look on other similar threads, some of them suggesting that my class should extend fragment activity instead and I don't want to do that. This is my MapActivity.java: public class MapActivity extends Fragment implements ActionBar.TabListener{ private Fragment mFragment; private GoogleMap map; private View view; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view != null) { ViewGroup parent = (ViewGroup) view.getParent(); if (parent != null) parent.removeView(view); } try { view = inflater.inflate(R.layout.activity_map, container, false); MapsInitializer.initialize(view.getContext()); } catch (InflateException exp) { exp.printStackTrace(); /* map is already there, just return view as it is */ } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); return view; } @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { mFragment = new MapActivity(); fragmentTransaction.replace(android.R.id.content, mFragment); } @Override public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { fragmentTransaction.remove(mFragment); if(httpAsyncTask!=null) httpAsyncTask.setCanceled(true); } @Override public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { } } This is my xml : &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="100" tools:context=".MapActivity" &gt; &lt;fragment android:id="@+id/m…
type: Question
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
possible better answer: http://stackoverflow.com/a/24776544
has title: Binary XML file line #9: Error inflating class fragment with Google Map Fragment
answer count: 2
score: 0
tagged with: android

http://stackoverflow.com/comment/38534776
has text: Are you sure that the same 2000 port should be used for communication in both directions? both to and from the wifi access point?
comment on: http://stackoverflow.com/q/24822389
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38580461
comment on: http://stackoverflow.com/q/24846610
score: 0
has text: I am able to define,drag and remove the objects in JApplet. Please help me how to find the the final coordinates(x and y) of the objects position in JApplet and writing them to a text file. Please help me with this. Thanks in advance.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38457596
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24781202
has text: Could you give an example ?

http://stackoverflow.com/q/24752111
tagged with: jsp
tagged with: javascript
tagged with: jquery
has comment: http://stackoverflow.com/comment/38402566
type: Question
has body: Getting error: missing ) after argument list when reading csv file but when i am using to alert in javascript or assigning it to any variable in javascript. OUTPUT: Name,Party,Province,Age,Gender "Mourani, Maria",BlocQuebecois,Quebec,43,Female "Sellah, Djaouida",NDP,Quebec,30,Female "St-Denis, Lise",NDP,Quebec,72,Female "Fry, Hedy",Liberal,BritishColumbia,71,Female "Turmel, Nycole",NDP,Quebec,70,Female "Sgro, Judy",Liberal,Ontario,68,Female "Raynault, Francine",NDP,Quebec,67,Female "Davidson, Patricia",Conservative,Ontario,66,Female Error: Page renders:
score: 0
has answer: http://stackoverflow.com/a/24752529
answer count: 1
tagged with: java
has title: SyntaxError: missing ) after argument list while reading csv file and alerting in js
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24752529

http://stackoverflow.com/comment/134083337
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/42420648
has text: The "Discussion" link doesn't work.

http://stackoverflow.com/comment/38498542
comment on: http://stackoverflow.com/q/24803148
score: 0
has text: Ans second number is supposed to be same month?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38456719
type: Comment
comment on: http://stackoverflow.com/a/24779663
score: 0
type: AnswerComment
has text: @Adam Nope. An Object created and the String literal (it's not an object) goes in to pool.

http://stackoverflow.com/a/24822471
has body: You need ObjectInputStream, not ObjectOutputStream. Also FileInputStream.
score: 0
answers question: http://stackoverflow.com/q/24822399
type: Answer

http://stackoverflow.com/q/24792353
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24792625
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: spannablestring
upvote count: 1
has body: I'm trying to store data in a ClickableSpan, like it can be done with setTag() with other type of elements. I've read this answer in stackoverflow: SpannableString - setTag And it clearly says: - Create your own subclass of ClickableSpan that holds the data you want, and apply it to your SpannableString. - When you create the ClickableSpan and attach a word to it via a data member, you will have access to that data in onClick() But I'm somewhat of a newbie and can't figure out how to code this. I am using a class that extends ClickableSpan to create my clickable spans: // CLASS BEING IMPORTED public abstract class TouchableSpan extends ClickableSpan { // IMPLEMENT SET TAG FUNCTION HERE?? } // CODE ON ACTIVITY TouchableSpan touchableSpan = new TouchableSpan() { @Override public void onClick(View widget) { this.setPressed(true); // GET TAG INFO HERE. BUT HOW? } // SET TAG HERE? BUT HOW? private boolean mIsPressed; public void setPressed(boolean isSelected) { mIsPressed = isSelected; } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLACK); ds.bgColor = mIsPressed ? selectedHlColor : 0xffeeeeee; ds.setUnderlineText(false); } } spannablesstringbuilder.setSpan(touchableSpan, index+2, index2, 0); comment: I know I should ideally ask clarification on the comments sections of the question I linked, but I don't have enough reputation to do so.
type: Question
linked to: http://stackoverflow.com/q/16005445
accepted answer: http://stackoverflow.com/a/24792727
tagged with: clickable
has answer: http://stackoverflow.com/a/24792625
answer count: 2
has answer: http://stackoverflow.com/a/24792727
downvote count: 0
has title: Add tag to ClickableSpan

http://stackoverflow.com/comment/38492073
comment on: http://stackoverflow.com/q/24799168
score: 0
type: Comment
type: QuestionComment
has text: Maybe the problem I have is hard to describe. Because I just don't see any problem with the javadocs as my colleague does. He sees that the "api contract" specified classes implementing BasicFileAttributeView.name() should return "basic" so classes imlementing subinterfaces of BasicFileAttributeView like PosixFileAttributeView also should returns "basic" and not "posix" as specified in the javadocs of PosixFileAttributeView.name().

http://stackoverflow.com/q/24784624
has comment: http://stackoverflow.com/comment/38511970
answer count: 1
accepted answer: http://stackoverflow.com/a/24811327
has comment: http://stackoverflow.com/comment/38511573
has title: Rended image not showing Java Libgdx
has comment: http://stackoverflow.com/comment/38511840
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38511739
tagged with: rendering
tagged with: java
has body: I am trying to render an image, however when i run the game as a a desktop launcher, the image can not be seen, however i believe the image is being rendered as it overlaps with another sprite to give an output. if (chicken.overlaps(farmer)){ System.out.print("GameOver"); gameOver(); I get no errors. Camera OrthographicCamera camera; camera = new OrthographicCamera(); camera.setToOrtho(false, 1920, 1080); camera.update(); inputUpdate(touch, camera); batch.setProjectionMatrix(camera.combined); The Code: public void render(float delta) { camera.update(); inputUpdate(touch, camera); batch.setProjectionMatrix(camera.combined); Iterator&lt;Rectangle&gt; iter = chickens.iterator(); while(iter.hasNext()){ Rectangle chicken = iter.next(); if(farmerX &lt; (chicken.x - 85/2)) chicken.x -= 2.5; if(farmerX &gt; (chicken.x - 85/2))chicken.x += 2.5; if (farmerY &lt; (chicken.y - 66/2))chicken.y -= 2.5; if(farmerY &gt; (chicken.y - 66/2))chicken.y += 2.5; float diffYchick; float diffXchick; float angleDegreeschick; diffYchick = (float) (farmerY - chicken.y); diffXchick = (float) (farmerX - chicken.x); angleDegreeschick = (float) Math.toDegrees(Math.atan2(diffYchick, diffXchick)); game.batch.begin(); game.batch.draw(chickenImage, (float)chicken.x, (float)chicken.y, (float)42.5, (float)33, (float)85, (float)66, (float)1, (float)1, (float)angleDegreeschick); game.batch.end(); int stop; stop = 0; switch(stop){ case 0: if (chicken.overlaps(farmer)){ System.out.print("GameOver"); gameOver(); stop +=1; break; } } } float diffY; float diffX; diffY = (float) (touch.y - farmerY); diffX = (float) (touch.x - farmerX); float angleDegrees; angleDegrees = (float) Math.toDegrees(Math.atan2(diffY, diffX)); if(TimeUtils.nanoTime() - lastSpawnTime &gt; 1000000000) spawnChicken(); Gdx.gl.glClearColor(0, 1, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); inputUpdate(touch, camera); batch.setProjectionMatrix(camera.combined); FarmerAsset.stateTime += Gdx.graphics.getDeltaTime(); Fa…
type: Question
has answer: http://stackoverflow.com/a/24811327
has comment: http://stackoverflow.com/comment/38512906
tagged with: libgdx
has comment: http://stackoverflow.com/comment/38511615
score: 0

http://stackoverflow.com/comment/38681272
score: 0
comment on: http://stackoverflow.com/q/24897634
type: Comment
type: QuestionComment
has text: Are you looking for user based authentication or a shared token that all the android clients would share? Does the authentication apply to all endpoints (resources/urls)? Reference this http://stackoverflow.com/questions/785973/what-is-the-most-appropriate-way-to-store-user-settings-in-android-application/6393502#6393502

http://stackoverflow.com/comment/38657922
comment on: http://stackoverflow.com/q/24887133
score: 0
type: Comment
type: QuestionComment
has text: you can use `putExtra` to set `enderecos` values for new activity which you will open using `Intend`

http://stackoverflow.com/q/24792753
tagged with: userdetailsservice
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/24794201
answer count: 1
linked to: http://stackoverflow.com/q/5338144
has body: I have done web developments using servlets few years ago without any frameworks, so I'm familiar with web services. Now my job requires me to modify 3 existing Spring MVC apps to combine 3 login screens into one. One app runs on Tomcat 5, two run on different versions of Tomcat 6. And the company decides to use .net to replace Java, so it hired a .net company to write an interface [ frame ] to have a single login screen, but the content inside the frame is still produced by the 3 old Java spring apps. This is their first step to replace the Java apps. So after the change, users will login from the front page which is in .net, and it uses user Id/password to get the roles and other info from the DB, different roles [ customer, employee, agent ] will be shown different menus and contents, then the .net app will call Java to pass the info it has [ user name, role, uid, GUID .. ], and the java program will call different existing Spring apps to display the content. So my question is : how to use the info [ user name, role, uid, GUID .. ] I got from the .net app to store into the Spring apps, so when they check for user role for instance, they can find it. In other word, in the old Spring apps, each will check with the DB to get this info and store it in some object, now the .net will do this step for them, so which objects should I generate to simulate the spring security steps ? See chart for details : I've checked out the following questions, but none of them answer my question : Spring Security 2.0.6 what calls the loadUserByName method of an UserDetailService Spring Security : Bypass login form But one word stands out : UserDetailsService ! Is that the object I should generate ? If so where should I store it so the Spring apps can find it ?
tagged with: spring-security
has title: How to modify existing Spring MVC app to bypass spring security?
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/3830571
has answer: http://stackoverflow.com/a/24794201
type: AnsweredQuestion

http://stackoverflow.com/a/57648669
answers question: http://stackoverflow.com/q/24864163
score: 0
has body: Unfortunately this can't be done in the same way in the Gradle Play Plugin, See: https://github.com/gradle/playframework/issues/85
type: Answer

hadoop
tags question: http://stackoverflow.com/q/24840254
tags question: http://stackoverflow.com/q/24789291
tags question: http://stackoverflow.com/q/24809433
tags question: http://stackoverflow.com/q/24901626
tags question: http://stackoverflow.com/q/24875999
tag name: hadoop
tags question: http://stackoverflow.com/q/24875577
tags question: http://stackoverflow.com/q/24823523
tags question: http://stackoverflow.com/q/24858657
tags question: http://stackoverflow.com/q/24886138
tags question: http://stackoverflow.com/q/24808681
tags question: http://stackoverflow.com/q/24860854
tags question: http://stackoverflow.com/q/24795097
tags question: http://stackoverflow.com/q/24909096
tags question: http://stackoverflow.com/q/24800467
type: Tag
tags question: http://stackoverflow.com/q/24763182
tags question: http://stackoverflow.com/q/24785927
tags question: http://stackoverflow.com/q/24890092
tags question: http://stackoverflow.com/q/24803757
tags question: http://stackoverflow.com/q/24781932
tags question: http://stackoverflow.com/q/24770801
tags question: http://stackoverflow.com/q/24751599
tags question: http://stackoverflow.com/q/24758944
tags question: http://stackoverflow.com/q/24767702
tags question: http://stackoverflow.com/q/24835763
tags question: http://stackoverflow.com/q/24890432
tags question: http://stackoverflow.com/q/24771239
tags question: http://stackoverflow.com/q/24887716
tags question: http://stackoverflow.com/q/24809048
tags question: http://stackoverflow.com/q/24795360
tags question: http://stackoverflow.com/q/24853379
tags question: http://stackoverflow.com/q/24855683
tags question: http://stackoverflow.com/q/24787616
tags question: http://stackoverflow.com/q/24815431
tags question: http://stackoverflow.com/q/24785893
tags question: http://stackoverflow.com/q/24832614
tags question: http://stackoverflow.com/q/24824770
tags question: http://stackoverflow.com/q/24834448

http://stackoverflow.com/comment/38427007
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24764889
type: AnswerComment
has text: @ Luiggi Mendoza - Yes, I tried that solution. But, I also wanted to replicate the example's folder structure and see if that works. Will update soon.

http://stackoverflow.com/q/24824695
has answer: http://stackoverflow.com/a/24824973
score: 0
has comment: http://stackoverflow.com/comment/38539071
answer count: 1
has comment: http://stackoverflow.com/comment/38539014
type: UnansweredQuestion
has body: I'm trying to make a JSON file using JSON.simple to fit requirements of a payload to a server. The requirements are: { "agent": { "name": "String", "version": 1 }, "username": "String", "password": "String", "clientToken": "String" } And also: { "accessToken": "valid accessToken", "clientToken": "client identifier" "selectedProfile": { "id": "profile identifier", "name": "String" } } I've looked at a few posts to try and figure out how to achieve this but I just can't. All help appreciated :)
has title: JSON in Java (With JSON.simple)
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/24755904
downvote count: 0
score: 2
answer count: 1
tagged with: testng
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Selenium tests not running in parallel in grid using testng
has body: NOTE: In the testng xml, if i change the parallel= to classes or methods then it runs the tests fine but it does it one by one not in parallel. If I keep parallel="tests" then it runs in parallel but it opens the same browser three times in the same VM, which is not correct. My setup: I have 11 virtual machines setup and Selenium Grid nodes have been initialised for each browser on each box. I have created my testng xml to run tests on each box. The tests are written in Java using Webdriver. My problem: When I execute the test, 3 instances of IE are opened and the tests are run in parallel in the same VM. I have different VMs setup with the correct nodes so from my testng xml below, I expected the tests to run correctly in IE, FF and IE9 in a different VM. TESTNG XML <parameter name="GridBrowser" value="iexplore11windows7"/> <class name="test.tes_connect.homepage.VerifyCarouselIsWorkingCorrectly" /> <parameter name="GridBrowser" value="firefox25win7"/> <class name="test.tes_connect.homepage.VerifyCarouselIsWorkingCorrectly" /> <parameter name="GridBrowser" value="iexplore9windows7"/> <class name="test.tes_connect.homepage.VerifyCarouselIsWorkingCorrectly" /> CONFIGURATION.JAVA package com.environments; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.openqa.selenium.remote.DesiredCapabilities; public class Configuration { public static DesiredCapabilities setCap; public static String SeleniumGridSetup(String gridBrowser) { String newGridBrowser = gridBrowser; switch (newGridBrowser) { // QA CLIENT 11 case "iexplore8windowsXP": System.out.println("Internet Explorer 8 on Windows XP"); setCap= DesiredCapabilities.internetExplorer(); setCap.setBrowserName("internet explorer"); setCap.setPlatform(org.openqa.selenium.Platform.XP); setCap.setVersion("8.0"); break; case "firefox23": System.out.println("Firefox 23 on Windows XP"); setCap= DesiredCapabilities.firefox(); setCap.setBrowserName("firef…
has answer: http://stackoverflow.com/a/24776982
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question

http://stackoverflow.com/comment/38517703
has text: I took DOTALL off and used this, which I think solves my problem better since there is a requirement that there be only one newline between from and sent - (?mi)(^from:)(.*?)\n(^sent:)
comment on: http://stackoverflow.com/a/24812900
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38442003
type: Comment
has text: simply use app variable to do it. If your serial number is sr_no do {app.sr_no}
comment on: http://stackoverflow.com/q/24773208
score: 0
type: QuestionComment

http://stackoverflow.com/q/24837939
has title: How to add a string into an array list in java
tagged with: arrays
tagged with: arraylist
answer count: 3
has body: I try to add a string "hello" into an array list, and convert the array list back into a string array, but I get weird output like this: [Ljava.lang.String;@1f26ecd2. What's the problem with that? String s="hello"; ArrayList&lt;String&gt; base = new ArrayList&lt;String&gt;(); int a=0; if(a==0) { base.add(s); } String[] get=base.toArray(new String[base.size()]); System.out.print(get);
favorite count: 0
type: UnansweredQuestion
downvote count: 2
duplicate of: http://stackoverflow.com/q/409784
has answer: http://stackoverflow.com/a/24837966
tagged with: java
linked to: http://stackoverflow.com/q/409784
type: Question
has answer: http://stackoverflow.com/a/24837995
has answer: http://stackoverflow.com/a/24838003
upvote count: 0
score: -2

http://stackoverflow.com/q/24858178
has answer: http://stackoverflow.com/a/24858234
has body: I was using Android download manager. Then, I saw wits buggy, so basically I went for an intent service to download a file, and from intent service I am updating a progress dialog with a handler. In the intent service, I am opeining an input stream and writing the output file in the download folder using an output stream. All is ok right now, but my question is how can I offer users the option to cancel the download in the middle? My code in onHandleIntent is the following. InputStream input = new BufferedInputStream(url.openStream()); OutputStream output = new FileOutputStream(footyDirectory.toString()+"/demo.mp4"); byte data[] = new byte[1024]; long total = 0; int count; while ((count = input.read(data)) != -1) { total += count; // publishing the progress.... Bundle resultData = new Bundle(); resultData.putInt("progress" ,(int) (total * 100 / fileLength)); receiver.send(UPDATE_PROGRESS, resultData); output.write(data, 0, count); } output.flush(); output.close(); input.close();
accepted answer: http://stackoverflow.com/a/24858289
type: Question
score: 0
answer count: 2
tagged with: download
tagged with: android
has title: Android download long file with options to cancel
has answer: http://stackoverflow.com/a/24858289
has comment: http://stackoverflow.com/comment/38603195
tagged with: java
tagged with: android-intent
possible better answer: http://stackoverflow.com/a/24858234
linked to: http://stackoverflow.com/q/16093919
type: AnsweredQuestion

http://stackoverflow.com/a/24769643
has comment: http://stackoverflow.com/comment/38459418
has comment: http://stackoverflow.com/comment/38443736
has comment: http://stackoverflow.com/comment/38435659
has body: JPA implementations tend to delay flushing to DB until commit. Are you sure that INSERTs are not done even at commit time? Can you try flush()ing at the end of your initialize() method? Because of that delaying, flush() is needed if you want to catch some JPA exception and deal with it inside the same transaction that executes the DML. UPDATE As zbigniewTomczak says in his comment, initialize()should be transactional. The problem with that is that I am not sure that Spring is going to honor a @Transactional annotation in a init-method. You can try that as it is the easier option, and if it does not work, then you can try programmatic transaction management in your initialize() (either completely manual or using TransactionTemplate): Read Spring documentation about programmatic transactions
has comment: http://stackoverflow.com/comment/38435756
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24769318
has comment: http://stackoverflow.com/comment/38466333

http://stackoverflow.com/a/24760461
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24760314
type: Answer
has body: It depends on your method's documented interface contract: If your method's documentation states that the name argument must correspond to the name of an existing user, then it's appropriate to throw IllegalArgumentException if the name isn't found, because it means the caller violated the method's requirements by passing a name that doesn't correspond to a user. If your method doesn't say that the name must correspond to an existing user, then passing an unknown name is not an error and you shouldn't throw an exception at all. Returning null would be appropriate in this situation. Note that your findUserByName method is basically reinventing the Map.get method, which returns null if the specified key isn't found.
score: 4

http://stackoverflow.com/q/24834064
has comment: http://stackoverflow.com/comment/38557221
answer count: 1
tagged with: exception
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38557274
has comment: http://stackoverflow.com/comment/38557382
tagged with: syntax
score: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/38557472
has comment: http://stackoverflow.com/comment/38557457
has title: There is a SQL syntax error while using JDBC to connect to MySQL which says the table doesn't exist. (But the Table Exists))
has comment: http://stackoverflow.com/comment/38557234
type: Question
has body: I am able to connect to the data base but face the exception while executing the preparedStatement to insert values. I can access the table using the MySQL table using the workbench and also insert values from there. The spelling for the table is correct. String insertTableSQL = "INSERT INTO source_domain_english_OY2_Jul2014(filename, seed, words, frequency, type, after_before) VALUES(?,?,?,?,?,?)"; . . . . preparedStatement.executeUpdate(); I have posted the stack trace below com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'm_r.source_domain_english_OY2_Jul2014' doesn't exist 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:525) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330) at edu.albany.ils.remnd.balancedcorpus.english.GramsSearch.readPatterns(GramsSearch.java:948) at edu.albany.ils.remnd.balancedcorpus.english.GramsSearch.main(GramsSearch.java:45)
has answer: http://stackoverflow.com/a/24834155
has comment: http://stackoverflow.com/comment/38557157

http://stackoverflow.com/a/24987118
upvote count: 4
answers question: http://stackoverflow.com/q/24848138
type: AcceptedAnswer
downvote count: 0
has body: The get is causing the reference time to be reset so the timeout is never happening. the map2 is borderline because the time is 2 seconds and the check interval is 1 second. so its could skew to almost 3 seconds and not timeout before its read again I think. try putting the sleep first and try lengthening it by 3 seconds each loop and see what happens. The following lines need to also be added before things will start expiring: map2.getExpirer().startExpiring(); map10.getExpirer().startExpiring(); map5.getExpirer().startExpiring(); with that the 2 second expires. the other two maps do not because the interval between references is never long enough with current code.
has comment: http://stackoverflow.com/comment/38861850
score: 4
accepted answer of: http://stackoverflow.com/q/24848138
has comment: http://stackoverflow.com/comment/38863302
has comment: http://stackoverflow.com/comment/38848329
has comment: http://stackoverflow.com/comment/38862877
type: Answer

http://stackoverflow.com/a/24751615
has body: The call to Scanner fileIn = new Scanner(hours); may fail if the file is not found. In such a case, a java.io.FileNotFoundException will be thrown. Java is strict in its exception handling - you cannot just ignore this potential exception, but must handle it somehow. One way of doing this is to add a throws clause to the main method: public static void main(String[] args) throws FileNotFoundException { In this case, the program will just crash if the file is not found. A better way, probably, to handle these kind of issues is to explicitly catch the exception: Scanner fileIn = null; try { File hours = new File("prog2.dat"); fileIn = new Scanner(hours); } catch (FileNotFoundException e) { System.out.println ("Can't find prog2.dat, quitting"); System.exit(1); }
type: Answer
answers question: http://stackoverflow.com/q/24751495
score: 0

http://stackoverflow.com/q/24884985
possible better answer: http://stackoverflow.com/a/34470348
type: Question
score: 9
has body: I am making a sample project following the steps of a website and is giving me a weird bug and I can not fix it, and I'm desperate :(. HelloController.java: package com.companyname.springapp.web; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class HelloController { protected final Log logger = LogFactory.getLog(getClass()); @RequestMapping(value="/hello.htm") public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.info("Returning hello view"); return new ModelAndView("hello.jsp"); } } HelloControllerTest.java package com.companyname.springapp.web; import static org.junit.Assert.*; import org.junit.Test; import org.springframework.web.servlet.ModelAndView; public class HelloControllerTest { @Test public void testHandleRequestView() throws Exception{ HelloController controller = new HelloController(); ModelAndView modelAndView = controller.handleRequest(null, null); assertEquals("hello.jsp", modelAndView.getViewName()); } } app-config.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" 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/schem…
accepted answer: http://stackoverflow.com/a/24885065
has title: Context initialization failed Spring
answer count: 2
has answer: http://stackoverflow.com/a/24885065
has answer: http://stackoverflow.com/a/34470348
favorite count: 0
upvote count: 9
tagged with: maven
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/38496193
score: 0
type: Comment
type: QuestionComment
has text: Have you though about different approach? For example, you could add image to a button to highlight it.
comment on: http://stackoverflow.com/q/24801909

http://stackoverflow.com/a/35917564
has comment: http://stackoverflow.com/comment/107494541
has comment: http://stackoverflow.com/comment/127116860
has comment: http://stackoverflow.com/comment/112426344
has comment: http://stackoverflow.com/comment/135230156
type: Answer
has comment: http://stackoverflow.com/comment/108712311
has comment: http://stackoverflow.com/comment/129808585
has comment: http://stackoverflow.com/comment/110962278
downvote count: 2
score: 135
has body: Why the RecyclerView has no onItemClickListener The RecyclerView is a toolbox, in contrast of the old ListView it has less build in features and more flexibility. The onItemClickListener is not the only feature being removed from ListView. But it has lot of listeners and method to extend it to your liking, it's far more powerful in the right hands ;). In my opinion the most complex feature removed in RecyclerView is the Fast Scroll. Most of the other features can be easily re-implemented. If you want to know what other cool features RecyclerView added read this answer to another question. Memory efficient - drop-in solution for onItemClickListener This solution has been proposed by Hugo Visser, an Android GDE, right after RecyclerView was released. He made a licence-free class available for you to just drop in your code and use it. It showcase some of the versatility introduced with RecyclerView by making use of RecyclerView.OnChildAttachStateChangeListener. Edit 2019: kotlin version by me, java one, from Hugo Visser, kept below Kotlin / Java Create a file values/ids.xml and put this in it: <?xml version="1.0" encoding="utf-8"?> <item name="item_click_support" type="id" /> then add the code below to your source Kotlin Usage: recyclerView.onItemClick { recyclerView, position, v -> // do it } (it also support long item click and see below for another feature I've added). implementation (my adaptation to Hugo Visser Java code): typealias OnRecyclerViewItemClickListener = (recyclerView: RecyclerView, position: Int, v: View) -> Unit typealias OnRecyclerViewItemLongClickListener = (recyclerView: RecyclerView, position: Int, v: View) -> Boolean class ItemClickSupport private constructor(private val recyclerView: RecyclerView) { private var onItemClickListener: OnRecyclerViewItemClickListener? = null private var onItemLongClickListener: OnRecyclerViewItemLongClickListener? = null private val attachListener: RecyclerView.OnChildAttachStateChangeListener = object : RecyclerVi…
has comment: http://stackoverflow.com/comment/106433400
has comment: http://stackoverflow.com/comment/110478313
has comment: http://stackoverflow.com/comment/108687926
upvote count: 137
has comment: http://stackoverflow.com/comment/135281639
answers question: http://stackoverflow.com/q/24885223
has comment: http://stackoverflow.com/comment/129812586

http://stackoverflow.com/a/24791151
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24790927
has comment: http://stackoverflow.com/comment/38476680
upvote count: 4
downvote count: 0
has body: When deciding on API level to target this website gives really good information about the breakdown of the current market. https://developer.android.com/about/dashboards/index.html As you can see API &lt; 10 accounts for very little of the current breakdown. I can tell you from experience that upgrading API levels is a pain. If I were creating a new app I would go no lower than API 14 as the minimum. Anything lower than that will be become further and further obsolete in a few months. You will not be losing too much business and will have access to a lot of the newer calls without having to use the support libraries.
has comment: http://stackoverflow.com/comment/38476941

http://stackoverflow.com/comment/38417421
score: 1
has text: No problem sir. I will find some other way. Thanks for your time :)
type: Comment
comment on: http://stackoverflow.com/q/24751897
type: QuestionComment

http://stackoverflow.com/a/24887484
has comment: http://stackoverflow.com/comment/38678128
upvote count: 1
has comment: http://stackoverflow.com/comment/38682815
type: Answer
answers question: http://stackoverflow.com/q/24887083
downvote count: 0
has body: When you finnish pulling the async data, provide the adapter with the new data and call .notifyDataSetChanged() on that adapter instance and the framework will update the pages and count by itself. If you wish a more detailed explanation post your FragmentPagerAdapter implementation.
score: 1

http://stackoverflow.com/q/24753219
has comment: http://stackoverflow.com/comment/38404495
has answer: http://stackoverflow.com/a/24753699
tagged with: android
has comment: http://stackoverflow.com/comment/38405931
has answer: http://stackoverflow.com/a/24753309
has comment: http://stackoverflow.com/comment/38406178
answer count: 5
type: UnansweredQuestion
has title: Parsing JSON Object in android, giving me blank page
has comment: http://stackoverflow.com/comment/38406080
has answer: http://stackoverflow.com/a/24754707
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38405637
type: Question
has comment: http://stackoverflow.com/comment/38405860
has answer: http://stackoverflow.com/a/24754027
has answer: http://stackoverflow.com/a/24753315
score: 0
has body: I need to parse JSONObject. Whenever it runs the application, it gave me a blank page. Why is that so? Did i code it wrongly? This is my JSON Object structure: { "UserID": "", "Gender": "", "Password": "", "Name": "", "AddressLineOne": "", "AddressLineTwo": "", "AddressLineThree": "", "PostalCode": "", "HomeTel": "", "Email": "" } And this is my code to parse the JSONObject protected Boolean doInBackground(String... urls) { try { //------------------&gt;&gt; HttpGet httppost = new HttpGet(urls[0]); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httppost); // StatusLine stat = response.getStatusLine(); int status = response.getStatusLine().getStatusCode(); if (status == 200) { HttpEntity entity = response.getEntity(); String data = EntityUtils.toString(entity); JSONObject jsono = new JSONObject(data); for (int i = 0; i &lt; jsono.length(); i++) { Profile profile = new Profile(); profile.setName(jsono.getString("Name")); profile.setAddressLineOne(jsono.getString("AddressLineOne")); profile.setAddressLineTwo(jsono.getString("AddressLineTwo")); profile.setAddressLineThree(jsono.getString("AddressLineThree")); profile.setPostalCode(jsono.getString("PostalCode")); profileList.add(profile); } return true; } //------------------&gt;&gt; } catch (ParseException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return false; }

http://stackoverflow.com/comment/38571495
type: Comment
has text: Hi Eran..Thanks for your response..But I have single jsp page..in which i retrieve some value through session in `data` value. I want to use same data value in given java code. I am using same value in `StringTokenizer st = new StringTokenizer(data, ",");` line. I haven't any idea how to use..Please help me on this...Your help is appreciated.
comment on: http://stackoverflow.com/a/24841847
score: 0
type: AnswerComment

http://stackoverflow.com/q/24775947
tagged with: imagemagick-convert
tagged with: java
has body: I want to run the following command on Windows command prompt: convert -density 50 -pointsize 70 -font Arial label:"Text with spaces" output.gif This command uses imagemagick and makes a gif file with the text "Text with spaces" and saves it to output.gif This works nicely straight from Windows 7 command prompt. Now, I want to run this command from a Java application of mine. Consider: private void runConvert() { try { ProcessBuilder pb = new ProcessBuilder("convert","-density","50","-pointsize","70" ,"font","Arial","label:","\"Text with spaces\"","output.gif"); pb.redirectErrorStream(true); Process process = pb.start(); BufferedReader inStreamReader = new BufferedReader(newInputStreamReader(process.getInputStream())); while(inStreamReader.readLine() != null){ System.out.println(inStreamer.readLine()); } } catch (Exception e){ e.printStackTrace(); } } Problem is, this makes convert echo: convert.exe: no decode delegate for this image format `' @ error/constitue.c/ReadImage/501 If I try to use runConvert function with a text parameter that has no spaces, like "BurgerKing" it works like a charm. How can I fix it for multi spaces parameters?
type: Question
has title: Running imagemagick convert with ProcessBuilder
answer count: 1
has comment: http://stackoverflow.com/comment/38451896
has comment: http://stackoverflow.com/comment/38448341
score: 0
tagged with: processbuilder
has comment: http://stackoverflow.com/comment/38447583
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24779038

layout
tags question: http://stackoverflow.com/q/24871473
tags question: http://stackoverflow.com/q/24839824
tags question: http://stackoverflow.com/q/24907914
tags question: http://stackoverflow.com/q/24853395
tags question: http://stackoverflow.com/q/24784054
tag name: layout
tags question: http://stackoverflow.com/q/24776601
tags question: http://stackoverflow.com/q/24865759
tags question: http://stackoverflow.com/q/24908697
tags question: http://stackoverflow.com/q/24867102
tags question: http://stackoverflow.com/q/24908569
type: Tag
tags question: http://stackoverflow.com/q/24909020
tags question: http://stackoverflow.com/q/24774047
tags question: http://stackoverflow.com/q/24888482
tags question: http://stackoverflow.com/q/24854212
tags question: http://stackoverflow.com/q/24842600
tags question: http://stackoverflow.com/q/24790117
tags question: http://stackoverflow.com/q/24770777

http://stackoverflow.com/comment/38542823
type: Comment
has text: verbose yes this trick is really helpful for me to achieve my result thats geart..
comment on: http://stackoverflow.com/a/24804323
type: AnswerComment
score: 1

http://stackoverflow.com/comment/38510979
has text: Thanks, It Works but Not working in 2.2 ! I have posted another question, http://stackoverflow.com/questions/24808837/error-no-such-table-in-api-2-2
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24809349

http://stackoverflow.com/q/24797814
score: 1
tagged with: java
type: Question
has title: XPAGES : how have two faces-config which inherited one by one and the second keeps his specificities?
has answer: http://stackoverflow.com/a/24865510
accepted answer: http://stackoverflow.com/a/24865510
has answer: http://stackoverflow.com/a/24822527
tagged with: faces-config
answer count: 3
upvote count: 1
has body: I have two bases : Model A.ntf Model B.ntf which inherited of A Base B1.nsf from B I have a faces-config in A and B, but i'd like change the faces-config of B. I can't do that because when i change it and update design, the faces-config became as it is at first... So, i'd like use a file in the ressources to include a piece of faces-config by this way. But what is the code to do that ? An idea ? or another thinks to do ? thanks
tagged with: xpages
possible better answer: http://stackoverflow.com/a/24824272
favorite count: 0
has answer: http://stackoverflow.com/a/24824272
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/38507649
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24807338
has text: (Sorry, can't get a newline, but) Yes, I generate `HTMLComponents` in another object that `implements Listener`: `HTMLComponent hc = new HTMLComponent(); addListener(SWT.MouseDown, hc); hc.setBounds(rect); hc.setHTML(parentObsVals.get(0).toString());'

http://stackoverflow.com/q/24831326
has comment: http://stackoverflow.com/comment/38552795
has title: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
tagged with: mobile
has answer: http://stackoverflow.com/a/24832078
has comment: http://stackoverflow.com/comment/38551910
has comment: http://stackoverflow.com/comment/38552650
answer count: 2
linked to: http://stackoverflow.com/q/30951608
has comment: http://stackoverflow.com/comment/38552124
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/49938514
favorite count: 0
has comment: http://stackoverflow.com/comment/38552199
tagged with: listadapter
type: UnansweredQuestion
has body: i am using a BaseExpandableListAdapter as follows. where instead of passing a list, i am directly passing a View to be a child data. and the child count is always returned as 1. as there is only one view per heading. public class TaxAdapter extends BaseExpandableListAdapter{ private Context _context; private ArrayList&lt;String&gt; _listDataHeader; private HashMap&lt;String, View&gt; _listDataChild; public TaxAdapter(Context context, ArrayList&lt;String&gt; taxListDataHeader, HashMap&lt;String, View&gt; taxListDataChild) { this._context = context; this._listDataHeader = taxListDataHeader; this._listDataChild = taxListDataChild; } @Override public int getGroupCount() { return this._listDataHeader.size(); } @Override public int getChildrenCount(int groupPosition) { return 1; } @Override public Object getGroup(int groupPosition) { return this._listDataHeader.get(groupPosition); } @Override public Object getChild(int groupPosition, int childPosition) { return this._listDataChild.get(this._listDataHeader.get(groupPosition)); } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public boolean hasStableIds() { return false; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { String headerTitle = (String) getGroup(groupPosition); if (convertView == null) { LinearLayout earningsContainer = new LinearLayout(_context); LayoutInflater inflator = ((Activity)_context).getLayoutInflater(); convertView = inflator.inflate(R.layout.row_tax_explv_title, earningsContainer, false); ((TextView) convertView.findViewById(R.id.explvTaxTitleText)).setText(headerTitle); } return convertView; } @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { return (View)getChild(groupPosition, childPosition); } @Override public boolea…
has comment: http://stackoverflow.com/comment/38552385
tagged with: classcastexception
tagged with: android
has comment: http://stackoverflow.com/comment/38552234
has comment: http://stackoverflow.com/comment/38552504
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/41767399

http://stackoverflow.com/comment/38585906
has text: Forgot to add this, Something like this will work? ----> statement.execute("CREATE PROCEDURE abdt (std INT)\nBEGIN\nSELECT att_begin, att_end FROM abdt WHERE student_id = std;\n\nEND;");
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24845357

http://stackoverflow.com/a/24758931
type: Answer
has body: Can confirm that on a 4.1.2 device the Gallery app shows 1970 for the jpg too. But a file explorer shows the file time which is correct. So probably the Gallery app extracts Exif info. On a KitKat 4.4.2 device the Gallery app shows the correct date. The file time as indicated by a file explorer is also coorrect. I was amazed that pictures got saved in ../DCIM/Camera. But anyhow the jpg always carries the file time as the file name IS the file time. Those pictures are saved as 1405427951171.jpg which translates a 15-07-2014 ...... and 1405427951171 is nummer of milli seconds after 1970.
answers question: http://stackoverflow.com/q/24758249
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/39308243
answers question: http://stackoverflow.com/q/24772179
type: Answer
has body: Well I am seeing a lot of things wrong here. First of all you are using multiplication of 2 highest 3 digit numbers and then decrementing it to find palindrome. What you need to do according to question is to use variables having highest 3 digit no.s and then decrement them to check there resultant product. Second for checking if the no. is palindrome you used an array to store it then used a loop to check it, I find it incorrect, as you could simply store the resultant no. in another integer variable by using the simple approach.(reverseNum * 10 + (num % 10) ) And I am seeing a correct code already posted by a user (ROMANIA)
score: 0

jsp
tags question: http://stackoverflow.com/q/24801071
tags question: http://stackoverflow.com/q/24763212
tags question: http://stackoverflow.com/q/24837414
tags question: http://stackoverflow.com/q/24816238
tags question: http://stackoverflow.com/q/24799871
tags question: http://stackoverflow.com/q/24823678
tags question: http://stackoverflow.com/q/24853071
tags question: http://stackoverflow.com/q/24883982
tags question: http://stackoverflow.com/q/24769035
tags question: http://stackoverflow.com/q/24827026
tags question: http://stackoverflow.com/q/24820383
tags question: http://stackoverflow.com/q/24807954
tags question: http://stackoverflow.com/q/24820060
tags question: http://stackoverflow.com/q/24822593
tags question: http://stackoverflow.com/q/24905865
tags question: http://stackoverflow.com/q/24768377
tags question: http://stackoverflow.com/q/24822426
tags question: http://stackoverflow.com/q/24859569
tags question: http://stackoverflow.com/q/24832470
tags question: http://stackoverflow.com/q/24779410
tags question: http://stackoverflow.com/q/24903392
tags question: http://stackoverflow.com/q/24781259
tags question: http://stackoverflow.com/q/24871661
tags question: http://stackoverflow.com/q/24821682
tags question: http://stackoverflow.com/q/24846134
tags question: http://stackoverflow.com/q/24837236
tags question: http://stackoverflow.com/q/24861686
tags question: http://stackoverflow.com/q/24904532
tags question: http://stackoverflow.com/q/24786738
tags question: http://stackoverflow.com/q/24777940
tags question: http://stackoverflow.com/q/24797095
tags question: http://stackoverflow.com/q/24768824
tags question: http://stackoverflow.com/q/24868174
tags question: http://stackoverflow.com/q/24904967
tags question: http://stackoverflow.com/q/24756321
tags question: http://stackoverflow.com/q/24846276
tags question: http://stackoverflow.com/q/24769740
tags question: http://stackoverflow.com/q/24768480
tags question: http://stackoverflow.com/q/24784508
tags question: http://stackoverflow.com/q/24788800
tags question: http://stackoverflow.com/q/24887761
tags question: http://stackoverflow.com/q/24878911
tags question: http://stackoverflow.com/q/24848167
tags question: http://stackoverflow.com/q/24757542
tags question: http://stackoverflow.com/q/24794098
tags question: http://stackoverflow.com/q/24865190
tags question: http://stackoverflow.com/q/24760439
tags question: http://stackoverflow.com/q/24817594
tags question: http://stackoverflow.com/q/24901603
type: Tag
tags question: http://stackoverflow.com/q/24783219
tags question: http://stackoverflow.com/q/24783246
tags question: http://stackoverflow.com/q/24785321
tags question: http://stackoverflow.com/q/24795060
tags question: http://stackoverflow.com/q/24812590
tags question: http://stackoverflow.com/q/24889141
tags question: http://stackoverflow.com/q/24811981
tags question: http://stackoverflow.com/q/24841801
tags question: http://stackoverflow.com/q/24772430
tags question: http://stackoverflow.com/q/24868058
tags question: http://stackoverflow.com/q/24861936
tags question: http://stackoverflow.com/q/24749973
tags question: http://stackoverflow.com/q/24756191
tags question: http://stackoverflow.com/q/24832946
tag name: jsp
tags question: http://stackoverflow.com/q/24750342
tags question: http://stackoverflow.com/q/24893490
tags question: http://stackoverflow.com/q/24757140
tags question: http://stackoverflow.com/q/24892866
tags question: http://stackoverflow.com/q/24859173
tags question: http://stackoverflow.com/q/24773556
tags question: http://stackoverflow.com/q/24822352
tags question: http://stackoverflow.com/q/24888830
tags question: http://stackoverflow.com/q/24830002
tags question: http://stackoverflow.com/q/24884568
tags question: http://stackoverflow.com/q/24841094
tags question: http://stackoverflow.com/q/24796900
tags question: http://stackoverflow.com/q/24844193
tags question: http://stackoverflow.com/q/24754435
tags question: http://stackoverflow.com/q/24884967

http://stackoverflow.com/q/24796115
has comment: http://stackoverflow.com/comment/38488617
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24797009
has comment: http://stackoverflow.com/comment/38486219
has answer: http://stackoverflow.com/a/50263368
has title: how to specify host using ip address instead of name to connect to postgres database using netbeans in a java project?
has comment: http://stackoverflow.com/comment/38485853
tagged with: postgresql
possible better answer: http://stackoverflow.com/a/50263368
has body: i want to add database to my netbeans java project using ip address. my question is that when i specify hostname by name that is "localhost" followed my correct details in the new connection wizard in netbeans connection establishes succesfully. this is as shown below. but when i specify host by specifying ip address of my own computer that is localhost connection doesn't get established. same is shown below well my motive is not to put ip of localhost but of another pc for remote database sharing over internet. but i think the problem lies in the method of specifying host using ip. if i get it right database sharing might work between different hosts as well. also any other methods of sharing postgres database over the internet are also welcome. i am a newbie in java as well as netbeans so any help is appreciated.
tagged with: localhost
accepted answer: http://stackoverflow.com/a/24797009
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/38486616
tagged with: java
has comment: http://stackoverflow.com/comment/38486260
type: Question
has comment: http://stackoverflow.com/comment/38488802
tagged with: network-programming

http://stackoverflow.com/q/24882151
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24883312
tagged with: xtend
has comment: http://stackoverflow.com/comment/38648700
has title: Identifying identical parts in xtend (based on xtext grammar)
tagged with: xtext
possible better answer: http://stackoverflow.com/a/24882323
has answer: http://stackoverflow.com/a/24882323
has answer: http://stackoverflow.com/a/24882479
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24883312
tagged with: java
has body: Part of my xText grammar is as follows: Transition: 'Transition' from=TransitionTerminal; TransitionTerminal: StateTerminal|SubStateTerminal; StateTerminal: 'st' state=[State|ID]; State: 'state' name=ID; Now, I want to identify Transitions with the same TransitionTerminal as in 'from'. So, in xtend I would write: var origin = transition.from //to check 'from' given some other Transition t, I use: if(origin==t.from) {} However, the above if statement is never entered. I suppose that additional nesting based on the provided grammar needs to be provided. Any help on how to achieve this is welcome.

http://stackoverflow.com/q/24864042
tagged with: regex
has answer: http://stackoverflow.com/a/24864717
has body: I am trying to create a regular expression for the following pattern...for example: osystems::win.2.vm#true AND osystems::win.2.vm#false AND (osystems::win.7.headless#false OR browsers::firefox.version#8) I wish to parse this using a regular expression and end up with the following: osystems::win.2.vm#true AND osystems::win.2.vm#false AND (osystems::win.7.headless#false OR browsers::firefox.version#8) Then I need to iterate through the list perform the necessary operations...starting from those in brackets in case there are any. Any help would be greatly appreciated.
has comment: http://stackoverflow.com/comment/38613884
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38613727
has comment: http://stackoverflow.com/comment/38613936
has comment: http://stackoverflow.com/comment/38613930
has comment: http://stackoverflow.com/comment/38613880
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38614859
has comment: http://stackoverflow.com/comment/38613829
favorite count: 0
has title: Regular expression for logical operators
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38614591

http://stackoverflow.com/q/24778393
has comment: http://stackoverflow.com/comment/38451754
has comment: http://stackoverflow.com/comment/38455014
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38452134
tagged with: java
linked to: http://stackoverflow.com/q/21382202
has title: How do i map xml attribute values to keys in properties file?
type: Question
has body: This my test.xml file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Class name="AirwayBill"&gt; &lt;Attribute name="billNo" primary="true" /&gt; &lt;Attribute name="date" primary="true" /&gt; &lt;Attribute name="person" class_name="Person" /&gt; &lt;/Class&gt; &lt;Class name="Person"&gt; &lt;Attribute name="perId" primary="true" /&gt; &lt;Attribute name="fname" primary="false" /&gt; &lt;Attribute name="lname" primary="false" /&gt; There is also a .properties file containing key value pairs like billNO=12345, date=16/07/2014. I want to map attributes between each corresponding key from properties and xml files. How do i do that? I am able to read both, attribute values and keys, and I am storing each one in a List.
tagged with: properties-file
has answer: http://stackoverflow.com/a/43822909
score: 0
answer count: 1

http://stackoverflow.com/comment/38572730
has text: @radai - May be in worst case there will be two splits always.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24842426

http://stackoverflow.com/a/24861719
score: -1
type: AcceptedAnswer
has body: The "change" here is actually totally valid. The extra space makes no difference to the meaning of the XML. (Or to put it another way, the JDom data structure does not encode the presence or otherwise of non-significant whitespace in the source tags. Therefore, JDom cannot reproduce the input XML's white-space when it formats the output XML.) The real problem is that your expectation is incorrect. You simply can't reliably compare XML documents as if they were character sequences. Read this Q&amp;A for various correct ways to compare XML in Java: Best way to compare 2 XML documents in Java
type: Answer
has comment: http://stackoverflow.com/comment/121033895
accepted answer of: http://stackoverflow.com/q/24861464
upvote count: 0
answers question: http://stackoverflow.com/q/24861464
downvote count: 1

http://stackoverflow.com/a/24807003
score: 2
has body: The SQLite JDBC implementation you're using doesn't implement getBinaryStream. You'll need to use the getBytes method instead.
accepted answer of: http://stackoverflow.com/q/24806919
answers question: http://stackoverflow.com/q/24806919
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/a/24893852
answers question: http://stackoverflow.com/q/24891937
has comment: http://stackoverflow.com/comment/38694287
has comment: http://stackoverflow.com/comment/38670889
has body: You can use a Lighting effect, here is a link to the Oracle tutorial on lighting. The effect cannot be applied via CSS in Java 8. You could apply it in code or via xml. You can add a listener on the hover property of a node to switch lighting off by setting the node effect to null and to switch it on by setting the node effect to you lighting. There is example code in the JavaFX javadoc on Lighting, which I've just reproduced here: Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0); Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(5.0); Text text = new Text(); text.setText("JavaFX!"); text.setFill(Color.STEELBLUE); text.setFont(Font.font(null, FontWeight.BOLD, 60)); text.setX(10.0); text.setY(10.0); text.setTextOrigin(VPos.TOP); text.setEffect(lighting); A drop shadow would also work and there are likely other ways to achieve what you want, all with slightly varying results.
score: 0
type: Answer

http://stackoverflow.com/q/24768496
type: Question
tagged with: tiff
has title: TIFF to BufferedImage - JAI on eclipse for Mac
has answer: http://stackoverflow.com/a/24768727
accepted answer: http://stackoverflow.com/a/24768727
tagged with: osx-mavericks
tagged with: eclipse
score: 0
tagged with: jai
answer count: 1
has body: I've searched everywhere and am thoroughly confused. Trying to read a TIFF file in as a BufferedImage. I've imported both: import javax.imageio.ImageIO; import javax.media.jai.*; However, my BufferedImage types are still reading as null when the file is passed through and they are created. Is there anything else I need to make sure is there? Through other posts I've seen that JAI might not be fully supported on macs? Running mavericks. Any direction here would be nice. A small example section of my code here: File f = new File(*file path posted here*); BufferedImage bi = ImageIO.read(f); Thanks!
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24813947
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24897932
tagged with: proxy
score: 0
has body: I have a Spring app using spring-ws for all my SOAP messages working just fine on my local development machine. When I deploy to a server that requires the use of a proxy for any traffic to reach the outside world I appear to be stuck. I was under the impression I can set some JVM arguments such as -Dhttp.proxyHost=proxyhostURL -Dhttp.proxyPort=proxyPortNumber -Dhttp.proxyUser=someUserName -Dhttp.proxyPassword=somePassword But the class files do not seem to be honoring the proxyUser and proxyPassword arguments. I even took a step further and implemented it within the java code itself: System.getProperties().put("http.proxyHost", "someProxyURL"); System.getProperties().put("http.proxyPort", "someProxyPort"); System.getProperties().put("http.proxyUser", "someUserName"); System.getProperties().put("http.proxyPassword", "somePassword"); But still no luck. I've then tried to use the java.net.Authenticator to set the username and password but that does not appear to work either: Authenticator.setDefault( new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(authUser, authPassword.toCharArray()); } } ); Does anyone have any suggestions how to route all traffic through a proxy using Java6, Tomcat 6 and Spring 3(with spring-ws)
answer count: 1
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
tagged with: spring-mvc
has title: Spring - Direct all outbound traffic via a proxy

http://stackoverflow.com/comment/38436050
type: Comment
has text: What about using `String.replaceFirst()` ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24769594

http://stackoverflow.com/a/24817040
has comment: http://stackoverflow.com/comment/38536358
score: 3
upvote count: 3
has body: A simple math formula will solve your problem int direction; int op = (direction + 2) % 4; So the opposite direction of the direction will be the op For example direction = 0 -> op = (0 + 2) % 4 = 2; direction = 1 -> op = (1 + 2) % 4 = 3; direction = 2 -> op = (2 + 2) % 4 = 0; direction = 3 -> op = (3 + 2) % 4 = 1;
downvote count: 0
answers question: http://stackoverflow.com/q/24817014
type: Answer

http://stackoverflow.com/q/24791691
possible better answer: http://stackoverflow.com/a/24791836
score: 1
tagged with: java
tagged with: dom
answer count: 2
upvote count: 1
tagged with: dom-events
favorite count: 0
has title: GWT FocusPanel clickHandler not working when created with a element
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24793410
downvote count: 0
accepted answer: http://stackoverflow.com/a/24793410
has answer: http://stackoverflow.com/a/24791836
type: Question
tagged with: gwt
has body: Hello fellow GWT folks. In my usage of GWT, I'm having an issue with a FocusPanel not handling the clickEvent that is added to it. I don't do GWT the standard way, ie building the GUI with UI binder or pure java code widgets. My host GWT HTML file is 1 large file that has div tags that represent the 'pages' of content. I use GWT to control the DOM. I have this HTML that I'm importing as the contents of the FocusPanel. Your card was successfully deleted/edit/added. ... Here's the Code... RootPanel editCardsSuccess = RootPanel.get("editCardsSuccess"); FocusPanel editCardsSuccessPanel = new FocusPanel(editCardsSuccess); editCardsSuccessPanel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hideWidget(editCardsSuccessPanel); } }); This didn't work until I did this... final HTMLPanel editCardsSuccess = view.getEditCardsSuccess(); editCardsSuccess.addDomHandler(new ClickHandler() { public void onClick(ClickEvent event) { hideWidget(editCardsSuccess); } }, ClickEvent.getType()); I even tried adding the FocusPanel to the parent DIV, thinking that the FocusPanel wasn't attached to the DOM, but that also didn't work. RootPanel.get("editCardsResponses").add(editCardsSuccessPanel); I would like to use the FocusPanel, as GWT wants to add a hidden input the DOM, in addtion to the element it wraps. I assume the hidden input handles some cross browser issue that I might lose if I just use the domHandler method. Can anyone help explain why the FocusPanel.ClickHandler wouldn't be taking effect, but an attached domHandler would? If DOM attachment is the problem, Is there a way to re-attach elements/widgets that were detached? If I go with the domHandler way... what compatibility do I loose by not getting the hidden input that the GWT FocusPanel widget provides?

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/24824481
type: Tag

opennlp
type: Tag
tags question: http://stackoverflow.com/q/24789646
tags question: http://stackoverflow.com/q/24897358
tags question: http://stackoverflow.com/q/24779758
tag name: opennlp

http://stackoverflow.com/q/24795197
has comment: http://stackoverflow.com/comment/38484145
has comment: http://stackoverflow.com/comment/38484181
upvote count: 0
answer count: 1
has body: My text editors (eclipse, sublime 2, notepad++) can't show Japanese letter. But I can read Japanese letter in web browser, file title and MS word. I was working on a Japanese project. I can view Japanese letter for the first month, but now I don't know why all my editors went wrong without reason.
favorite count: 0
accepted answer: http://stackoverflow.com/a/24795296
has title: Unable to view Japanese characters in Editor
linked to: http://stackoverflow.com/q/3951722
type: AnsweredQuestion
tagged with: editor
tagged with: sublimetext2
tagged with: java
has comment: http://stackoverflow.com/comment/38486780
tagged with: eclipse
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/217089
tagged with: notepad++
has answer: http://stackoverflow.com/a/24795296
score: -1

http://stackoverflow.com/comment/38450850
type: QuestionComment
comment on: http://stackoverflow.com/q/24754011
score: 0
has text: Suggest you use Intellij with sbt, much nicer than Eclipse.
type: Comment

http://stackoverflow.com/comment/38616102
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24825218
has text: Actually with SpEl I'm using the accessor methods, not the fields values directly. When I use "name" as SpEl expression, getName method is invoked. I don't know how Reflection can help me. I don't want to hardcode field names and with Reflection I don't think it will be possible to know which Validator to register without hardcoding the field name.
type: Comment

apk
tags question: http://stackoverflow.com/q/24888316
tag name: apk
tags question: http://stackoverflow.com/q/24795313
type: Tag

http://stackoverflow.com/q/24843611
favorite count: 0
tagged with: jlabel
has answer: http://stackoverflow.com/a/24843680
type: AnsweredQuestion
upvote count: 1
tagged with: swing
tagged with: jbutton
type: Question
accepted answer: http://stackoverflow.com/a/24843680
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24843653
answer count: 2
has body: I am creating a simple lottery as a practice, I am a beginner of Java. I have achieved almost everything that I want apart from one thing: Moving the different texts and buttons to the position that I'd like them to be. Here is a picture edited in Photoshop describing how I would like it to be: The Lottery currently looks like this after you press the Play button: (As you can see the buttons get shifted to the right in order to make space for the text that is squished in to the left of the buttons) What I'm looking to achieve is for the buttons position to never move, and to put the text under the buttons. I would also like to add a table that describes your potential winnings and what number will give you what winnings. The code consists of 2 Java Classes, and please remember that I am a beginner and if you see any simple room for improvement (I know there must be plenty) I would be glad if you gave me a tips or anything :) So this is the code: LotteryMain.Java public class LotteryMain { /** **@author Samy */ public static void main(String[] args) { TheLottery n = new TheLottery(); n.TheLottery(); } } TheLottery.java import java.awt.Color; import java.awt.FlowLayout; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.EtchedBorder; public class TheLottery extends JFrame implements ActionListener { /** **author Samy */ JFrame frame = new JFrame("The Lottery"); JPanel panel = new JPanel(new FlowLayout()); JButton play = new JButton("Play"); JButton exit = new JButton("Exit"); JLabel label = new JLabel(); private static final long serialVersionUID = 1L; public void TheLottery() { panel.add(label); int width = 720; int height = width/16*9; frame.setSize(width,height); frame.setResizable(false); frame.setLocationR…
has answer: http://stackoverflow.com/a/24843653
downvote count: 0
tagged with: layout-manager
has title: How to move JButtons and JLabels position in a JPanel, JFrame

http://stackoverflow.com/a/24807271
answers question: http://stackoverflow.com/q/24807123
has comment: http://stackoverflow.com/comment/38535188
type: Answer
has comment: http://stackoverflow.com/comment/38533594
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38506338
has comment: http://stackoverflow.com/comment/38529272
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24807123
has body: As exception stack says, length must be multiple of 8. So, length of 8, 16, 24,... are valid for key bytes. Try with length of 8 (12345678) byte key_bytes[] = "12345678".getBytes(); If error persists, you can follow this answer Updated If you want to use URLDecoder, try with this code in your decrypt method, String decryptd = URLDecoder.decode(value, "UTF-8"); byte[] dec = new Base64().decode(decryptd); byte[] utf8 = dcipher.doFinal(dec); return new String(utf8, "UTF-8");
has comment: http://stackoverflow.com/comment/38506487

http://stackoverflow.com/comment/38586809
type: Comment
type: QuestionComment
score: 0
has text: XtreemFS does not run on HDFS, but you can run MapReduce jobs on XtreemFS as a FileSystem. So your question is kinda obsolete I think...
comment on: http://stackoverflow.com/q/24847597

http://stackoverflow.com/comment/38568323
has text: In your code I can't see createstatment(). Also you must close statement and Db connection! You can see my answer in this post: http://stackoverflow.com/questions/24826029/what-simple-db-solution-do-i-use-to-extract-my-parsed-variables-from-eclipse-to/24826365#24826365 Good luck!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24840173

http://stackoverflow.com/q/24793655
has comment: http://stackoverflow.com/comment/38481303
has answer: http://stackoverflow.com/a/24794876
has comment: http://stackoverflow.com/comment/38482910
has body: I'm creating a program which will print a .txt receipt of the bought items from the store and it prints successfully, but I need to change the font of some specific part of the text is it possible? for example I wanted to print something like this THIS SHOULD BE BOLD and BIGGER this should be smaller than the first line This should be italicized would it be possible? UPDATE here is the code of the printing process public static void main(String[] args) throws PrintException, IOException { String defaultPrinter =PrintServiceLookup.lookupDefaultPrintService().getName(); System.out.println("Default printer: " + defaultPrinter); PrintService service = PrintServiceLookup.lookupDefaultPrintService(); FileInputStream in = new FileInputStream(new File("sample.txt")); PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet(); pras.add(new Copies(1)); DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE; Doc doc = new SimpleDoc(in, flavor, null); DocPrintJob job = service.createPrintJob(); PrintJobWatcher pjw = new PrintJobWatcher(job); job.print(doc, pras); pjw.waitForDone(); in.close(); // send FF to eject the page InputStream ff = new ByteArrayInputStream("\f".getBytes()); Doc docff = new SimpleDoc(ff, flavor, null); DocPrintJob jobff = service.createPrintJob(); pjw = new PrintJobWatcher(jobff); jobff.print(docff, null); pjw.waitForDone(); } } 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 (InterruptedExcept…
upvote count: 2
has comment: http://stackoverflow.com/comment/38482779
has comment: http://stackoverflow.com/comment/38483093
has title: Java receipt file from .txt
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38481412
has comment: http://stackoverflow.com/comment/38482502
tagged with: printing
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38481460
favorite count: 0
has comment: http://stackoverflow.com/comment/38481424
type: UnansweredQuestion

http://stackoverflow.com/comment/38960812
score: 0
type: AnswerComment
has text: Thanks, @David ! Actually, if I there is a match or dups, then I would like to remove this entry from both Lists, in that case, I was using iterator.remove() from lists (Until this Set worked)- what would you do ? Reason I want to do this is - at the end of this comparison, I would pass my test if the final Set comes out as Empty. Which means all dups are gone since I know my expected values. Basically, if all of expected values are in Actual values, just make it empty. Removing dups are still retaining expected. This would prevent the code to iterate Set again and probably make it faster !
type: Comment
comment on: http://stackoverflow.com/a/24854094

http://stackoverflow.com/comment/38592498
comment on: http://stackoverflow.com/q/24852734
score: 0
type: Comment
type: QuestionComment
has text: Probably use an IDE with a weblogic server plugin which handles all the auto deployment while developing for you. take a look at [eclipse + weblogic](https://www.google.de/search?q=eclipe+weblogic&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=sb&gfe_rd=cr&ei=lvfLU6WeNs7esgaCxoCwDA#channel=sb&q=eclipse+weblogic&rls=org.mozilla:en-US:official&spell=1)

javafx-8
tags question: http://stackoverflow.com/q/24874240
tags question: http://stackoverflow.com/q/24862594
tags question: http://stackoverflow.com/q/24807732
tags question: http://stackoverflow.com/q/24780785
tags question: http://stackoverflow.com/q/24782335
tags question: http://stackoverflow.com/q/24765549
tag name: javafx-8
tags question: http://stackoverflow.com/q/24847951
tags question: http://stackoverflow.com/q/24763873
tags question: http://stackoverflow.com/q/24851886
tags question: http://stackoverflow.com/q/24762821
tags question: http://stackoverflow.com/q/24786606
tags question: http://stackoverflow.com/q/24798120
tags question: http://stackoverflow.com/q/24841062
type: Tag
tags question: http://stackoverflow.com/q/24805951
tags question: http://stackoverflow.com/q/24890105
tags question: http://stackoverflow.com/q/24896498
tags question: http://stackoverflow.com/q/24840414
tags question: http://stackoverflow.com/q/24808243
tags question: http://stackoverflow.com/q/24850050
tags question: http://stackoverflow.com/q/24884527

http://stackoverflow.com/a/24845896
score: 1
has body: button.setOnClickListener is in the wrong place. Also, the onClickListener is a bit wring. Should be: import android.app.*; import android.os.*; import android.view.*; import android.widget.*; import android.content.Intent; import android.content.*; import android.net.Uri; import android.view.View.OnClickListener; public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button) findViewById(R.id.youButtonId); Button button1 = (Button) findViewById(R.id.youButtonId1); // add button listener button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { phoneCall(); } }); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { phoneCall1(); } }); } private void phoneCall() { String phoneCallUri = "tel:8889807091"; Intent phoneCallIntent = new Intent(Intent.ACTION_CALL); phoneCallIntent.setData(Uri.parse(phoneCallUri)); startActivity(phoneCallIntent); } private void phoneCall1() { String phoneCallUri = "tel:4078421430"; Intent phoneCallIntent = new Intent(Intent.ACTION_CALL); phoneCallIntent.setData(Uri.parse(phoneCallUri)); startActivity(phoneCallIntent); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/38579092
has comment: http://stackoverflow.com/comment/38579269
has comment: http://stackoverflow.com/comment/38579370
has comment: http://stackoverflow.com/comment/38579049
answers question: http://stackoverflow.com/q/24845851
type: Answer
has comment: http://stackoverflow.com/comment/38579182
downvote count: 0
has comment: http://stackoverflow.com/comment/38579130
has comment: http://stackoverflow.com/comment/38579204

http://stackoverflow.com/comment/38555757
score: 0
has text: If I use @ImportResource("camelSpring.xml"), how can I reference the camel context or route from my application?
comment on: http://stackoverflow.com/q/24763580
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38685316
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24901455
has text: The audio should be controlled from the `actionPerformed` method, so would state of the car. For the car's animation, you would probably need a `javax.swing.Timer`
type: AnswerComment

http://stackoverflow.com/a/24868397
answers question: http://stackoverflow.com/q/24868265
type: Answer
accepted answer of: http://stackoverflow.com/q/24868265
has comment: http://stackoverflow.com/comment/38622702
score: 1
has body: Set response.setContentType("application/json"), write JSON string to the response, then using request dispatcher forward your request back. A callback success function should handle the JSON object. Don't forget to flash response, because it's buffered and also useful to turn off cache with headers.
upvote count: 1
has comment: http://stackoverflow.com/comment/38622279
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24826961
has comment: http://stackoverflow.com/comment/38599227
tagged with: netbeans
type: UnansweredQuestion
tagged with: java-ee-7
tagged with: maven
has title: Java EE 7 FirstCup Tutorial - NetBeans - Compilation Error javax.ejb does not exist
has comment: http://stackoverflow.com/comment/38545290
has answer: http://stackoverflow.com/a/24887386
tagged with: java
has comment: http://stackoverflow.com/comment/38544870
has body: I've followed http://docs.oracle.com/javaee/7/firstcup/doc/firstcup.pdf religiously - and am hitting a problem on 3.2.1.1. I'm selecting "Build" to build the project using Maven but I get the issue.. firstcup/ejb/DukesBirthdayBean.java:[16,17] package javax.ejb does not exist as well as other related package does not exist errors. This is the first time I've used Netbeans (and Maven for that matter) - so am guessing it is something straightforward that I haven't configured correctly. Any help appreciated.
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38562957
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38652235

http://stackoverflow.com/comment/38586547
type: Comment
has text: This is a lot of unnecessary code. You don't ***need*** to close the Scanner.
type: AnswerComment
comment on: http://stackoverflow.com/a/24849069
score: 0

crawler4j
tags question: http://stackoverflow.com/q/24808565
tags question: http://stackoverflow.com/q/24807637
type: Tag
tag name: crawler4j

http://stackoverflow.com/comment/38575114
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24843680
has text: You can add a panel in the northern area, then add the buttons to that panel. It will default to a FlowLayout, which should work properly when you add multiple buttons to it.

cmd
tags question: http://stackoverflow.com/q/24839179
type: Tag
tags question: http://stackoverflow.com/q/24888009
tags question: http://stackoverflow.com/q/24819332
tags question: http://stackoverflow.com/q/24806928
tags question: http://stackoverflow.com/q/24775092
tags question: http://stackoverflow.com/q/24822566
tags question: http://stackoverflow.com/q/24833727
tags question: http://stackoverflow.com/q/24821980
tags question: http://stackoverflow.com/q/24835667
tags question: http://stackoverflow.com/q/24786992
tags question: http://stackoverflow.com/q/24829808
tag name: cmd

http://stackoverflow.com/a/24900774
score: 0
answers question: http://stackoverflow.com/q/24900456
has body: this is how your code may be looking for that part: import java.io.FileOutputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class Testing implements Serializable { private static final long serialVersionUID = 1L; public static void main(String args[]) { Testing t = new Testing(); String fileName = new String("copy.ser"); t.write(t, fileName); } public void write(Testing t, String fileName) { try { FileOutputStream fout = new FileOutputStream("copy.ser"); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(t); oos.close(); System.out.println("Done"); } catch (Exception ex) { System.out.println( "Error writing to file '" + fileName + "'"); } } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38684211
type: Answer
accepted answer of: http://stackoverflow.com/q/24900456
has comment: http://stackoverflow.com/comment/38683942

http://stackoverflow.com/q/24901085
possible better answer: http://stackoverflow.com/a/24901317
downvote count: 0
has answer: http://stackoverflow.com/a/24901317
tagged with: compiler-optimization
favorite count: 0
has comment: http://stackoverflow.com/comment/38684567
has comment: http://stackoverflow.com/comment/38684335
accepted answer: http://stackoverflow.com/a/24901135
has answer: http://stackoverflow.com/a/24901105
has body: I'm testing with this code: public class TestNull { public void leftComparison(String s) { if (s == null); } public void rightComparison(String s) { if (null == s); } } I compiled it with javac 1.8.0_05, and then inspected the bytecode: public class TestNull { .... public void leftComparison(java.lang.String); Code: 0: aload_1 1: ifnonnull 4 4: return public void rightComparison(java.lang.String); Code: 0: aconst_null 1: aload_1 2: if_acmpne 5 5: return } Apparently, leftComparison is compiled to push and pop 1 variable on the stack while rightComparison pushes and pops 2. I speculate that leftComparison is therefore slightly more efficient than rightComparison? I'm wondering why the compiler doesn't rewrite the code of rightComparison? In my opinion, the two comparisons should be semantically equivalent, right?
type: AnsweredQuestion
has title: why doesn't the java compiler rewrite this code?
upvote count: 5
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24901135
answer count: 3
score: 5

http://stackoverflow.com/q/24798568
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38490574
score: 9
type: Question
tagged with: android-layout
linked to: http://stackoverflow.com/q/12080995
answer count: 1
has answer: http://stackoverflow.com/a/24798840
accepted answer: http://stackoverflow.com/a/24798840
has body: So currently, I am trying to create a selected state for three textviews Currently, for each of the textviews ( H M S) the text is red: However, when tap the H M or S I want it to turn another color--white. So I tried to follow this: Android - Textview change color on changing of state and I did this (selected_text.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:state_selected="true" android:color="#ffd10011"/&gt; &lt;!-- selected --&gt; &lt;item android:color="@color/red_highlight"/&gt; &lt;!-- default --&gt; &lt;/selector&gt; and applied that: &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Hours" android:textSize="30sp" android:textColor="@color/selected_text" android:id="@+id/hourtext" android:layout_marginLeft="45dp" android:layout_alignTop="@+id/minutetext" android:layout_alignLeft="@+id/seekArc" android:layout_alignStart="@+id/seekArc" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Minutes" android:textSize="30dp" android:textColor="@color/selected_text" android:id="@+id/minutetext" android:layout_below="@+id/seekArc" android:layout_centerHorizontal="true" android:layout_marginTop="28dp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Second" android:textSize="30dp" android:textColor="@color/selected_text" android:id="@+id/secondtext" android:layout_alignTop="@+id/minutetext" android:layout_alignRight="@+id/seekArc" android:layout_alignEnd="@+id/seekArc" android:layout_marginRight="43dp" /&gt; However, the textviews do not change color after I click on them. How do I fix this? Also, I was wondering if it is better to implement this in java code since I need to perform a different function after each textview is clicked/highlighted. If so, how can that be implemented?
favorite count: 0
upvote count: 9
linked to: http://stackoverflow.com/q/4336218
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has title: Make a selected state for textview (highlighted)

http://stackoverflow.com/comment/38499919
comment on: http://stackoverflow.com/q/24784792
type: Comment
type: QuestionComment
has text: Well that was more or less a guess; I don't see anything in your code that looks like something that would cause that particular exception.
score: 0

http://stackoverflow.com/comment/38434601
has text: @Keppil: That looks fine now.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24754127
type: AnswerComment

http://stackoverflow.com/comment/38483051
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24790834
has text: Does the *project* also specify the right compiler compliance if it's specifying one?

http://stackoverflow.com/comment/38655719
score: 0
type: Comment
has text: @DavidWallace-Sorry for mentioning again SIR,but,I already mentioned in my previous comment that any result which comes out of an expression can be considered as an output. Also,I somewhat agree to your first part related to `++`.But,I don't believe he might not know that.Any book/tutorial before suggesting to code would surely tell him about `++`.Also,you're incorrect as you could see the first comment on `ug_`'s answer.You only commented below clarifying and I was the one who upvoted your comment and below,left my comment.I hope you agree,OR,else,I am afraid I'll have to include that too.
comment on: http://stackoverflow.com/a/24885576
type: AnswerComment

http://stackoverflow.com/q/24779881
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38454637
has comment: http://stackoverflow.com/comment/38454522
type: Question
accepted answer: http://stackoverflow.com/a/24780033
has comment: http://stackoverflow.com/comment/38454370
has body: WithClassesMainActivity: final Button b1= (Button) findViewById(R.id.button1); final Button b2= (Button) findViewById(R.id.button2); final Button b3= (Button) findViewById(R.id.button3); final StoringClas sc=new StoringClas(); b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String array1[]=new String[5]; array1[0]="a";array1[1]="b";array1[2]="y";array1[3]="g"; sc.writeToFile(array1); } }); b2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String[] ty =new String[5]; ty= sc.readFromFile(); b2.setText("ff"+ty[0]+ty[1]+ty[2]+ty[3]); } }); b3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String fs[]=new String[4]; try{ FileInputStream fIn = openFileInput("passd.txt"); InputStreamReader isr = new InputStreamReader(fIn); /* Prepare a char-Array that will * hold the chars we read back in. */ char[] inputBuffer = new char[6]; // Fill the Buffer with data from the file isr.read(inputBuffer); // Transform the chars to a String String str=new String(inputBuffer); fs[0]=str.substring(0,1); fs[1]=str.substring(1,2); fs[2]=str.substring(2,3); fs[3]=str.substring(3,4); b3.setText("g"+fs[0]+fs[1]+fs[2]+fs[3]); } catch (IOException ioe) {ioe.printStackTrace(); }} }); Storing Class: public class StoringClas extends Activity { @SuppressLint("WorldReadableFiles") @SuppressWarnings("deprecation") public void writeToFile(String[] args){ try { FileOutputStream fOut = openFileOutput("passd.txt",MODE_WORLD_READABLE); OutputStreamWriter osw = new OutputStreamWriter(fOut); // Write the string to the file for(int i=0;i&lt;=3;i++){ osw.write(args[i]); } //ensure that everything is // really written out and close osw.flush(); osw.close();} catch(Exception Ex){} } public String[] readFromFile(){ String fs[]=new String[4]; try{ FileInputStream fIn = openFileInpu…
has answer: http://stackoverflow.com/a/24780033
has title: Using non activity class to write to a file
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38454594
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/24897821
answers question: http://stackoverflow.com/q/24897753
downvote count: 0
has comment: http://stackoverflow.com/comment/38678066
has comment: http://stackoverflow.com/comment/38679551
type: Answer
has comment: http://stackoverflow.com/comment/38679357
has comment: http://stackoverflow.com/comment/38678080
has body: MySecondActivity mySecondActivity = new MySecondActivity(); getIntent returns the intent used to start the Activity, and it is never null, but when you try to instantiate the Activity with the new operator. You should never deal directly with Acitivity object, and you should always rely on the framework (take a look to the activity's lifecycle). Edit You could add a second parameter to the adapter constructor class myPagerAdapter extends FragmentPagerAdapter { private String mItem; public myPagerAdapter(FragmentManager fm, String item) { super(fm); mItem = item; } and inside getItem if("ride_height".equals(mItem)) { and inside onCreate new myPagerAdapter(getFragmentManager(), getIntent().getStringExtra("selectedItem")) Please be aware that making your adapter returning null will probably make your application crash
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24897753
score: 4

http://stackoverflow.com/a/24806416
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24805360
has body: The order of the jars on the classpath matters. Did you try adding the Xerces 2.11 jar at the beginning of the classpath so it gets loaded first?

http://stackoverflow.com/q/24771788
tagged with: javascript
has comment: http://stackoverflow.com/comment/38439595
downvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/38443343
has comment: http://stackoverflow.com/comment/38439562
upvote count: 0
has comment: http://stackoverflow.com/comment/38440568
tagged with: jquery
has title: How can a Java code could being used in a Jquery keeping it in a same form
favorite count: 0
has comment: http://stackoverflow.com/comment/38440586
possible better answer: http://stackoverflow.com/a/24771867
has answer: http://stackoverflow.com/a/24771867
has body: I have made a code in Java but wanted to use it in Jquery because my whole project works on jquery now how can I use this code in Jquery making sure that it fuctionality to take random number from an array doesn't changes.My code is as follows :- import java.util.Random; public class ARRAan { public static void main(String[] args) { int cards[]={1,2,3,6,1,25,24,2,62,85,65,}; int temp1; int temp; Random randIndex = new Random(); for (int i = 0; i &lt;cards.length; i++) { temp1 = randIndex.nextInt(i+2); temp = cards[i]; cards[i] = cards[temp1]; cards[temp1] = temp; System.out.println( cards[i] ); } } } Now where I wanted to use this program in Jquery is- function shuffle() { return 0.5 - Math.random(); }
has comment: http://stackoverflow.com/comment/38439467
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24771923
score: -4
has answer: http://stackoverflow.com/a/24771944
type: Question
accepted answer: http://stackoverflow.com/a/24771923
tagged with: java

http://stackoverflow.com/comment/38743305
comment on: http://stackoverflow.com/a/24882948
has text: Your code looks okay. If the MongoDBService does not appear, somehow your configuration is not working, which brings me back to my comment above about making sure that your configuration a) ends up in ConfigurationAdmin and b) is sent to the Amdatu Mongo bundle.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38698110
has text: WOW! I resolved the problem by adding some **custom settings** in admin console.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24821614
score: 0

http://stackoverflow.com/comment/68910761
comment on: http://stackoverflow.com/a/40847061
has text: Please post in english!
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/38482115
has text: What's your input and expected output?
comment on: http://stackoverflow.com/q/24794086
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38399211
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24750329
has text: Each invocation of `.replaceAll(",|;")` will create its own Pattern for `,|;` regex and Matcher which will try to find and remove this pattern from handled string.

http://stackoverflow.com/comment/38436823
comment on: http://stackoverflow.com/q/24770342
has text: This might be a third party library. What tutorials are you following?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25045284
type: Answer
answers question: http://stackoverflow.com/q/24776129
score: 1
upvote count: 1
downvote count: 0
has body: It's not clear exactly what you want. The PostgreSQL Documentation shows an example of how to write a PL/pgSQL function that does an update or insert depending on whether or not the primary key already exists. CREATE TABLE db (a INT PRIMARY KEY, b TEXT); CREATE FUNCTION merge_db(key INT, data TEXT) RETURNS VOID AS $$ BEGIN LOOP -- first try to update the key UPDATE db SET b = data WHERE a = key; IF found THEN RETURN; END IF; -- not there, so try to insert the key -- if someone else inserts the same key concurrently, -- we could get a unique-key failure BEGIN INSERT INTO db(a,b) VALUES (key, data); RETURN; EXCEPTION WHEN unique_violation THEN -- Do nothing, and loop to try the UPDATE again. END; END LOOP; END; $$ LANGUAGE plpgsql; SELECT merge_db(1, 'david'); SELECT merge_db(1, 'dennis'); So in your case you can use this function or modify it to suit your needs, then make batches of function calls. This is the most efficient way I can think of to do what you want in PostgreSQL. (Other databases have SQL extensions that handle this more directly.) If instead you wanted the insert to fail on duplicate keys and just wanted to know which succeeded and which failed, you could rewrite the function to return a success or failure boolean or maybe null on success and the key ID on failure.

classcastexception
tags question: http://stackoverflow.com/q/24831326
tags question: http://stackoverflow.com/q/24863281
type: Tag
tag name: classcastexception
tags question: http://stackoverflow.com/q/24836743
tags question: http://stackoverflow.com/q/24757933

http://stackoverflow.com/comment/38476696
has text: Why does it being static make a difference?
type: AnswerComment
comment on: http://stackoverflow.com/a/24771232
type: Comment
score: 0

http://stackoverflow.com/comment/38687367
type: Comment
type: QuestionComment
has text: I guess the above mentioned two lines are the culprit. It in fact might be closing the pipe or sending an exit command. The RETURN above is a string variable for \\h
comment on: http://stackoverflow.com/q/24902182
score: 0

http://stackoverflow.com/q/24817506
type: Question
has title: Deciding ThreadPool count in ExecutorService
has comment: http://stackoverflow.com/comment/38535066
upvote count: 1
has comment: http://stackoverflow.com/comment/38539660
has comment: http://stackoverflow.com/comment/38525824
tagged with: executorservice
favorite count: 0
has body: Other day, I had a requirement of concurrently accessing objects from my repository through Cache facade. For this, I decided to take use of Executor Framework from Java concurrency API. For this, examples across the web state to initialize ExecutorService using 10 threads i.e. Executors.newFixedThreadPool(10). But when I tried to benchmark this figure in my application, I could see a better performance at 25 threads and not above that. So, the question is that is 10 a recommended value for this implementation or I can choose a better value depending upon the load. What are the factors to keep in mind while deciding this. Also, when to choose Executors.newScheduledThreadPool(10) instead of FixedThreadPool impl.
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38548290
has comment: http://stackoverflow.com/comment/38548060
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/38543139
type: Comment
score: 0
has text: Do you know how I can run it in virtual machine? I think the program doesn't work in the host machine so I'm trying to test it in vm but I don't really know how.
type: AnswerComment
comment on: http://stackoverflow.com/a/24826372

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/24749742
type: Tag
tags question: http://stackoverflow.com/q/24859975
tags question: http://stackoverflow.com/q/24777698

http://stackoverflow.com/q/24901247
upvote count: 0
has title: How to pass a String-to-String mapping into a Drools session
tagged with: java
type: Question
tagged with: drools
score: -1
has comment: http://stackoverflow.com/comment/38699893
has comment: http://stackoverflow.com/comment/38700608
has answer: http://stackoverflow.com/a/24962270
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38685074
favorite count: 0
has body: I have Drools rules that insert values into a database. I want to give the session a mapping of String values I have to String values that should be written. So in my Java file, something like this: StatefulKnowledgeSession session = ... Map&lt;String, String&gt; stateToPostalCode = new HashMap&lt;&gt;(); stateToPostalCode.insert("Texas", "TX"); stateToPostalCode.insert("New Jersey", "NJ"); .... session.insert(stateToPostalCode); Then my rules could convert states to postal codes. But inserting it doesn't work. I get a stack trace and a complaint of java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean Inserts of Map&lt;String, Integer&gt; work, but not Map&lt;String, String&gt;. What am I doing wrong? Is there another way to accomplish what I want?
has comment: http://stackoverflow.com/comment/38745146
has comment: http://stackoverflow.com/comment/38773254
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38799429

http://stackoverflow.com/a/24853093
has body: I have no troubles in inserting the data into the database but I am unable to get the file name of the uploaded file. Is there a method for getting it? Since Servlet API 3.1, the Part interface provides the getSubmittedFileName() method which does what you need. Gets the file name specified by the client This class represents a part or form item that was received within a multipart/form-data POST request. Alternatively you can use Commons Fileupload library provided by Apache that makes it easy to add robust, high-performance, file upload capability to your servlets and web applications. Sample code: List&lt;FileItem&gt; multiparts = new ServletFileUpload( new DiskFileItemFactory()).parseRequest(request); for(FileItem item : multiparts){ if(!item.isFormField()){ String name = new File(item.getName()).getName(); } } Find complete code here and here
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24853071
upvote count: 1
type: Answer

http://stackoverflow.com/a/24773857
type: Answer
has body: It looks like you are using the old syntax for gradients (which was not valid css!) please use the new syntax as described at http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html The your gradient looks like: -dean-navygrad: linear-gradient(from 0% 0% to 100% 0%, -dean-lightnavy 0%, navy 100%) -fx-background-color: linear-gradient(from 0% 0% to 0% 50%, reflect, derive(deepskyblue, 80%) 0%, deepskyblue, 30%);
score: 0
answers question: http://stackoverflow.com/q/24768466
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24768466

http://stackoverflow.com/comment/38422880
type: AnswerComment
type: Comment
has text: Or write an actual loop.
comment on: http://stackoverflow.com/a/24762960
score: 0

http://stackoverflow.com/q/24846958
has comment: http://stackoverflow.com/comment/38610316
score: 0
upvote count: 1
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38606869
has comment: http://stackoverflow.com/comment/38603544
favorite count: 0
tagged with: digital-signature
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38609984
has answer: http://stackoverflow.com/a/24862923
tagged with: java
tagged with: itext
has comment: http://stackoverflow.com/comment/38591788
type: Question
has title: "The document has been altered or corrupted since the signature was applied" error comes after signature was applied to pdf using itext
has body: I get Error "The document has been altered or corrupted since the signature was applied" when signature was applied to pdf using itext. Digitally signed pdf is generated but the green check mark is not coming. What has to be done to get that green check mark. Right now it says signature is INVALID. I used following link for reference http://itextpdf.com/examples/iia.php?id=222 I use following code to apply signature using iText. String path = "resources/examplestore"; String keystore_password = "password"; String key_password = "password"; String alias = "signFiles"; KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(new FileInputStream(path), keystore_password.toCharArray()); PrivateKey pk = (PrivateKey) ks.getKey(alias, key_password.toCharArray()); Certificate[] chain = ks.getCertificateChain(alias); String path = "resources/examplestore"; String keystore_password = "password"; String key_password = "password"; String alias = "signFiles"; KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(new FileInputStream(path), keystore_password.toCharArray()); PrivateKey pk = (PrivateKey) ks.getKey(alias, key_password.toCharArray()); Certificate[] chain = ks.getCertificateChain(alias); PdfReader reader = new PdfReader(src); FileOutputStream os = new FileOutputStream(dest); PdfStamper stamper = PdfStamper.createSignature(reader, os, '\0', null, true); PdfSignatureAppearance appearance = stamper .getSignatureAppearance(); appearance.setReason("I'm approving this."); appearance.setLocation("Foobar"); appearance.setVisibleSignature(new Rectangle(160, 732, 232, 780), 1, "second"); ExternalSignature es = new PrivateKeySignature(pk, "SHA-256", "BC"); ExternalDigest digest = new BouncyCastleDigest(); MakeSignature.signDetached(appearance, digest, es, chain, null, null, null, 0, CryptoStandard.CMS); I also Verify the code after this.

http://stackoverflow.com/a/24842329
answers question: http://stackoverflow.com/q/24842268
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38573062
has body: You can use the ListView's setOnItemClickListener to get the info, and the external button to present the interface displaying the details. Let's just say: ListView list = (ListView) findViewById(R.id.listview); list.setOnItemClickListener(new AdapterView.onItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View view, int position, long arg) { Object listItem = list.getItemAtPosition(position); } }); Referenced from this post

http://stackoverflow.com/comment/39094064
type: AnswerComment
comment on: http://stackoverflow.com/a/24842603
type: Comment
has text: How can I get the last stable version of apache stanbol (the build about one month ago where all tests succeded in jenkins) ? I just see on the side older versions and the quick start where I just can execute the failing maven installation ...
score: 0

http://stackoverflow.com/q/24893049
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24893128
has answer: http://stackoverflow.com/a/47835081
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/24893131
has comment: http://stackoverflow.com/comment/38673188
type: Question
has answer: http://stackoverflow.com/a/45786195
has comment: http://stackoverflow.com/comment/38669122
possible better answer: http://stackoverflow.com/a/24893116
has title: Printing prime numbers in Java using recursion
has answer: http://stackoverflow.com/a/24893116
has comment: http://stackoverflow.com/comment/38674612
upvote count: 4
has answer: http://stackoverflow.com/a/30322753
has comment: http://stackoverflow.com/comment/38673608
has comment: http://stackoverflow.com/comment/38673677
has answer: http://stackoverflow.com/a/24893128
answer count: 7
favorite count: 0
has body: I wrote a similar function in C, and was able to achieve the required result unlike java. Below is the code, which checks if a number is prime recursively. Compilation says, i'm missing a return statement. The number to be checked if a prime is x. The variable i is the divisor.(ie) x/2, (x/2)-1,...0. public int primes(int x, int i) { if(i==0) return 1; if(x%i==0) return 0; else primes(x, i-1); } What is the complexity of this code if I had to print the first 1000 prime numbers.
has answer: http://stackoverflow.com/a/24893508
tagged with: primes
tagged with: recursion
score: 2

http://stackoverflow.com/comment/38484915
type: Comment
comment on: http://stackoverflow.com/q/24775128
type: QuestionComment
score: 0
has text: I'm using kepler and I'm not trying to debus smartgwt. I just want to test code which we have written. Gwt compile works fine. I'm able run the application in normal mode without any issues. even building war works fine.

http://stackoverflow.com/comment/38680095
has text: The advice is correct. Failure to heed it will lead to tears.
type: Comment
comment on: http://stackoverflow.com/q/24894477
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38443812
type: QuestionComment
comment on: http://stackoverflow.com/q/24773592
has text: Please post full signature for `public Object invokeService`
score: 0
type: Comment

http://stackoverflow.com/a/24857411
accepted answer of: http://stackoverflow.com/q/24857322
answers question: http://stackoverflow.com/q/24857322
score: 0
type: AcceptedAnswer
has body: You aren't actually calling the menu method anywhere in your code. The code below would be an example of the main code that runs your application. Note that it would probably be better to use an Enum than use "magic numbers" like this, but it's just an example. public static void main (String[] args) { Fishdata fishdata = new Fishdata(); int choice = menu(); switch (choice) { case 1: System.out.println(fishdata.getAllFish()); // or whatever you want to do with the list break; case 2: // etc. default: break; } }
type: Answer

http://stackoverflow.com/comment/50985487
type: Comment
comment on: http://stackoverflow.com/a/24837187
has text: Nope @VaibhavBhootna.
type: AnswerComment
score: 0

cucumber
tags question: http://stackoverflow.com/q/24798922
tags question: http://stackoverflow.com/q/24841335
tags question: http://stackoverflow.com/q/24895480
type: Tag
tag name: cucumber

http://stackoverflow.com/comment/38558346
has text: Possibly version specific?
score: 0
comment on: http://stackoverflow.com/q/24834702
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38639617
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24838658
type: AnswerComment
has text: Thanks for reply. So another observation is that if we run in master-master mode where node.master : true for both ES nodes it works meaning if one of node goes down then other will work. But if we run two ES nodes in master-slave mode where for slave node.master is false and master is down then it will not work. Is there any way we can make master-slave model working when master is down?

mapreduce
tags question: http://stackoverflow.com/q/24886138
tags question: http://stackoverflow.com/q/24808681
type: Tag
tags question: http://stackoverflow.com/q/24887716
tags question: http://stackoverflow.com/q/24855683
tags question: http://stackoverflow.com/q/24835763
tag name: mapreduce
tags question: http://stackoverflow.com/q/24873629
tags question: http://stackoverflow.com/q/24785893
tags question: http://stackoverflow.com/q/24858657
tags question: http://stackoverflow.com/q/24840254
tags question: http://stackoverflow.com/q/24789291
tags question: http://stackoverflow.com/q/24901626
tags question: http://stackoverflow.com/q/24803757
tags question: http://stackoverflow.com/q/24758944
tags question: http://stackoverflow.com/q/24760547

http://stackoverflow.com/comment/38622255
has text: There are lots of ways, depending on what you're trying to do (for example, how many things will be using it, do you want to store the response or just do something immediately with it and then forget it, and so on).
comment on: http://stackoverflow.com/q/24864487
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27616392
type: Answer
has body: I found that when I need to save time, this command saves me every time: rsync -razpv --delete /folder/name server_name:/folder/name you can also add: --exclude 'file/inside/folder' Use it cleanly, and wisely, but a process of copying files for some of my builds that took 20 minutes always, now take 10 seconds when there is no change, and less than 1 minute when there is a change. Also - did you think about a management tool (puppet/chef/ansible) to do some of the work?
score: 0
answers question: http://stackoverflow.com/q/24783453

instance-variables
tags question: http://stackoverflow.com/q/24905774
tags question: http://stackoverflow.com/q/24876660
tag name: instance-variables
type: Tag

http://stackoverflow.com/a/24885941
accepted answer of: http://stackoverflow.com/q/24885800
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38655049
has comment: http://stackoverflow.com/comment/38655291
has comment: http://stackoverflow.com/comment/38657715
has comment: http://stackoverflow.com/comment/38658562
type: Answer
answers question: http://stackoverflow.com/q/24885800
downvote count: 0
has body: I did not try that, but it looks like you need to close the cipherOutputStream: cipherOutputStream.close(); instead of the flush you have currently. The reason is that flush can be called several times so the decryption will not be finished until close is called.
score: 1

http://stackoverflow.com/comment/38581285
type: QuestionComment
comment on: http://stackoverflow.com/q/24827787
score: 0
has text: where do i replace space plzz elaborate????
type: Comment

http://stackoverflow.com/q/24884381
tagged with: list
possible better answer: http://stackoverflow.com/a/24886321
score: 1
has answer: http://stackoverflow.com/a/24886321
upvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24885940
has body: I've seen all the posts about keeping order in JSONArray, but I couldn't find a solution. In this post, they said : An array is an ordered collection of values. But when I create a JSONArray from my List I lost the order and I have to keep it. I've tried all the solutions, but none of them works for me. I'm using org.json as JSON lib to create JSONArray and then CDL to create a CSV. The List contains JSON so I could create a CSV file. Code : List&lt;LinkedHashMap&lt;String, Object&gt;&gt; stringObject=new ArrayList&lt;LinkedHashMap&lt;String,Object&gt;&gt;(); for(...; ...;...){ stringObject.add(map); } /** stringObject is a List containing ordered map */ /** Here I'm trying to create a JSONArray */ JSONARRay jsonArray=new JSONArray(stringObject); Here the ouput : The List : [{_id=1, name=Aurelia Menendez, scores.0.type=exam, scores.0.score=60.06045071030959, scores.1.type=quiz, scores.1.score=52.79790691903873, scores.2.type=homework, scores.2.score=71.76133439165544}, {_id=2, name=Corliss Zuk, scores.0.type=exam, scores.0.score=67.03077096065002, scores.1.type=quiz, scores.1.score=6.301851677835235, scores.2.type=homework, scores.2.score=66.28344683278382},{.....}] The JSONArray : [{"scores.1.type":"quiz","scores.1.score":52.79790691903873,"_id":1,"name":"Aurelia Menendez","scores.0.type":"exam","scores.2.type":"homework","scores.0.score":60.06045071030959,"scores.2.score":71.76133439165544},{"scores.1.type":"quiz","scores.1.score":6.301851677835235,"_id":2,"name":"Corlis ... As you can see, I lost the order. So How to keep the right order so I can create a good CSV ? The map order is respected, but the items order inside a map is not respected. Edits Maps I'm adding to the List : {_id=1, name=Aurelia Menendez, scores.0.type=exam, scores.0.score=60.06045071030959, scores.1.type=quiz, scores.1.score=52.79790691903873, scores.2.type=homework, scores.2.score=71.76133439165544} {_id=2, name=Corliss Zuk, scores.0.type=exam, scores.0.score=67.03077096065002, scores.1.typ…
type: Question
has title: Keep List<LinkedHashMap<String,Object>> order when converstion to JSONArray
has comment: http://stackoverflow.com/comment/38652450
has answer: http://stackoverflow.com/a/31755000
has comment: http://stackoverflow.com/comment/38679817
has comment: http://stackoverflow.com/comment/38652179
tagged with: arrays
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/7214293
accepted answer: http://stackoverflow.com/a/24885940
has answer: http://stackoverflow.com/a/24885013
answer count: 4

http://stackoverflow.com/comment/38600082
has text: What IOException? Stack trace?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24856192

jclouds
tags question: http://stackoverflow.com/q/24764306
tags question: http://stackoverflow.com/q/24836960
tags question: http://stackoverflow.com/q/24832175
tags question: http://stackoverflow.com/q/24840153
tags question: http://stackoverflow.com/q/24777085
tag name: jclouds
tags question: http://stackoverflow.com/q/24866057
tags question: http://stackoverflow.com/q/24867971
type: Tag

http://stackoverflow.com/a/24764109
downvote count: 0
has body: You need to learn about scope in object-oriented programming. The concept of scope allows or restricts access to variables based on where and how they are declared. See this article about declaring variables in Java. You should probably also familiarize yourself with the "Hello World" application that Oracle provides. Basically, a Java class will look something like: public class MyClass { ...public or private variables accessible from any of the code below go here... public static void main(String[] args) { ...declare variables only accessible by the main method here... ...do things here... } ...declare other methods here... ...private methods can only be called by code in this class... ...public methods can be used by external code that uses this class... public int Foo() { ...declare some variables only accessible by Foo() code here... ...do some stuff... } private boolean Bar() { ...declare some variables only accessible by Bar() code here... ...do some stuff... } } You can't just throw the while loop out in the netherlands like that. It needs to go in the main method or another method that you create, perhaps one called: public int CountScores(int numTimes) { ...do some stuff...not sure exactly what you're trying to do } I'd also probably use BufferedReader and InputStreamReader instead of Keyboard. See this example.
type: Answer
answers question: http://stackoverflow.com/q/24763836
has comment: http://stackoverflow.com/comment/38718463
score: 1
upvote count: 1

http://stackoverflow.com/q/24836648
accepted answer: http://stackoverflow.com/a/24836875
answer count: 1
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: java
type: Question
has body: Basically, I try to take a test and stuck with question about the garbage collector: How many objects available for System.gc() in the following code snippet: public class WorkGC { static class StaticNestedClass { private String name; public StaticNestedClass(String name) { this.name = name; } } public static void main(String[] args) { StaticNestedClass n1 = new StaticNestedClass("n1"); StaticNestedClass n2 = new StaticNestedClass("n2"); Collection list = new ArrayList(); list.add(n1); StaticNestedClass[] arr = new StaticNestedClass[2]; arr[0] = n2; n2 = n1; clear(arr); n1 = null; n2 = null; System.gc(); //the rest of the code } private static void clear(StaticNestedClass[] arr) { arr = null; } } I think 2 objects are available: 1)arr – after clear(arr) 2)n2 – after n2=null I don't sure that arr – is one object, may be arr is a series of objects. Also, I'm not sure about instances of StaticNestedClass, it is static and locates in a PermGen – not in the Heap as typical objects. Does GC works in PermGen as well as in the Heap?
has answer: http://stackoverflow.com/a/24836875
score: 0
has title: available objects for System.gc()

http://stackoverflow.com/comment/38649533
type: Comment
has text: Edited answer accordingly
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24882667

http://stackoverflow.com/comment/38548969
type: Comment
comment on: http://stackoverflow.com/a/24791431
has text: @GaryRussel: I did realize this and tried removing the `FileSystemPersistentAcceptOnceFileListFilter` filter leaving the `SftpPersistentAcceptOnceFileListFilter`. It looks that the Redis is having some issue starting. Is there some good example here? I see lot of dependencies one after another to get a very simple and straight-forward scenario to be running. Probably I hope these internal dependency satisfied rather than to keep wiring things constantly.
score: 0
type: AnswerComment

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/24803295
tags question: http://stackoverflow.com/q/24844295
tags question: http://stackoverflow.com/q/24850826
tags question: http://stackoverflow.com/q/24839072
type: Tag
tags question: http://stackoverflow.com/q/24851897

http://stackoverflow.com/comment/38583428
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24848143
has text: but why you want it in one activity? you mean when you click a button you want a different layout?

http://stackoverflow.com/q/24849950
linked to: http://stackoverflow.com/q/22116325
linked to: http://stackoverflow.com/q/4718190
tagged with: abstract
downvote count: 4
has comment: http://stackoverflow.com/comment/38591925
answer count: 1
linked to: http://stackoverflow.com/q/4709175
has body: Most people understand the innate benefits that enum brings into a program verses the use of int or String. See here and here if you don't know. Anyway, I came across a problem that I wanted to solve that kind of is on the same playing field as using int or String to represent a constant instead of using an enum. This deals specifically with String.format(...). With String.format, there seems to be a large opening for programmatic error that isn't found at compile-time. This can make fixing errors more complex and / or take longer. This was the issue for me that I set out to fix (or hack a solution). I came close, but I am not close enough. For this problem, this is more certainly over-engineered. I understand that, but I just want to find a good compile-time solution to this, that provides the least amount of boiler-plate code. I was writing some non-production code just to write code with the following rules. Abstraction was key. Readability was very important Yet the simplest way to the above was preferred. I am running on... Java 7 / JDK 1.7 Android Studio 0.8.2 These are unsatisfactory Is there a typesafe alternative to String.format(...) How to get string.format to complain at compile time My Solution My solution uses the same idea that enums do. You should use enum types any time you need to represent a fixed set of constants...data sets where you know all possible values at compile time(docs.oracle.com). The first argument in String.format seems to fit that bill. You know the whole string beforehand, and you can split it up into several parts (or just one), so it can be represented as a fixed set of "constants". By the way, my project is a simple calculator that you probably seen online already - 2 input numbers, 1 result, and 4 buttons (+, -, ×, and ÷). I also have a second duplicate calculator that has only 1 input number, but everything else is the same Enum - Expression.java &amp; DogeExpression.java public enum Expression implements IExpression { Number…
favorite count: 0
has comment: http://stackoverflow.com/comment/38589852
upvote count: 8
has comment: http://stackoverflow.com/comment/38586963
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25550050
has comment: http://stackoverflow.com/comment/38587167
has comment: http://stackoverflow.com/comment/38607567
tagged with: string.format
tagged with: java
has comment: http://stackoverflow.com/comment/38587272
has comment: http://stackoverflow.com/comment/38587684
has comment: http://stackoverflow.com/comment/39691924
type: Question
linked to: http://stackoverflow.com/q/9254637
has comment: http://stackoverflow.com/comment/38593371
tagged with: enums
has title: I am making a safe, compile-time String.format(...) equivalent. An issue still persist
score: 4
tagged with: abstraction
has comment: http://stackoverflow.com/comment/38587188
has comment: http://stackoverflow.com/comment/38586900
has comment: http://stackoverflow.com/comment/38587972

http://stackoverflow.com/q/24857193
tagged with: sqlite
tagged with: jdbc
has body: I am trying to integrate sqlite db into my tomcat spring based web application. I use JDBC driver to get the connection to db as follows in DAO class. Class.forName("org.sqlite.JDBC"); con = DriverManager.getConnection("jdbc:sqlite:mydb.db"); But I cannot connect to my database. Here is how I put my db and DAO classes. DAO CLASS = src->main->java->mypackage->DAO.java DB file = src->main->resources->mypackage->mydb.db when deployed both class file and .db file resides in same location in tomcat. But if I give absolute pathto mydb.db it works perfectly. What am I doing wrong here any help is really appreciated. Edit 1: I get the table not found exception. When I give the full path it updates the database java.sql.SQLException: no such table: product at org.sqlite.NativeDB.throwex(NativeDB.java:210) at org.sqlite.NativeDB._exec(Native Method) at org.sqlite.Stmt.executeUpdate(Stmt.java:152) at com.directfn.releasemanagementsystem.dataAccess.ProductDAO.persistProduct(ProductDAO.java:43) at com.directfn.releasemanagementsystem.controllers.ReleaseDataUploadController.processRegistration(ReleaseDataUploadController.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:439) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:427) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at o…
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24857774
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/38601154
tagged with: tomcat
has title: Accessing sqlite db from JDBC driver
score: 0

http://stackoverflow.com/comment/38406267
has text: 1:1 copy of [java.lang.NoClassDefFoundError: Could not initialize class org.com.hibernate.HibernateUtil](http://stackoverflow.com/questions/14951395/java-lang-noclassdeffounderror-could-not-initialize-class-org-com-hibernate-hib?rq=1)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24754029
score: 0

http://stackoverflow.com/comment/38586892
type: QuestionComment
has text: @DonBranson Now, i close command line and opened again and try again, now the result is this: `Exception in thread main: java.lang.NoClassDefFoundError: LoginFrame (wrong name: Project\LoginFrame)`
comment on: http://stackoverflow.com/q/24849826
score: 0
type: Comment

http://stackoverflow.com/comment/38497324
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24801426
has text: Well, I'm not sure your regex behaves as you expect... See https://www.debuggex.com/r/fwHFxx61R2U1ImbQ. Could you give me the like to your first question (which made you have your first regex)?

http://stackoverflow.com/comment/38511797
type: QuestionComment
comment on: http://stackoverflow.com/q/24810028
score: 2
has text: there's no "getString()" method in Properties
type: Comment

http://stackoverflow.com/a/29219928
type: Answer
answers question: http://stackoverflow.com/q/24895444
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/46653792
has body: Make sure you select the file in the "Package Explorer" view. Not the "Project Explorer" view, Not the "Navigator" view, Not the (insert whichever redundant file-view views I've omitted) view, but only, and for no compellingly good reason, the Package Explorer view. This will enable the disabled Refactor options.
downvote count: 0

http://stackoverflow.com/a/24757160
has comment: http://stackoverflow.com/comment/38412233
has comment: http://stackoverflow.com/comment/38411890
has comment: http://stackoverflow.com/comment/38412196
downvote count: 0
has body: Use this syntax to pass the password as a CLI parameter: String password = "your password" Runtime.getRuntime().exec(new String[]{"C:\\my\\abc.bat", password}); Or, if your program is interactive, use getOutputStream() to get an output stream to which write the password. Example: String password = "your password" PrintWriter writer = new PrintWriter(process.getOutputStream()); writer.println(password); writer.close(); Note that this is simplified example, you'll have to manage the exception appropriately.
has comment: http://stackoverflow.com/comment/38412181
type: Answer
has comment: http://stackoverflow.com/comment/38412234
answers question: http://stackoverflow.com/q/24757012
has comment: http://stackoverflow.com/comment/38412045
upvote count: 1
has comment: http://stackoverflow.com/comment/38411816
has comment: http://stackoverflow.com/comment/38411764
score: 1

http://stackoverflow.com/comment/38454413
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24779771
has text: Logging in Servlets : http://stackoverflow.com/a/3156709/2194456
score: 0

http://stackoverflow.com/comment/38659101
has text: If you know what Box2D is, then you should know whether it will be better for your purposes. Anyway, the first thing I noticed is that you're using == to compare Strings. This is a VERY bad idea. Use the equals() method instead. As for your actual problem, it's going to be pretty hard to test without an [MCVE](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/24887580
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/24767043
type: Answer
answers question: http://stackoverflow.com/q/24766665
score: 30
has body: At first glance it seems like your missing the bindings for the Db annotated dependency and the StatsdClient. You'll need to provide the missing bindings to your module like so bind(Db.class).annotatedWith(SystemDb.class).to(DbImplOfSomeSort.class); bind(StatsdClient.class).to(StatsdClientImplOfSomeSort.class); Guice is able to automatically inject Concrete Class with either a public no argument constructor or a constructor with @Inject without any specific defined binding in your module but when it comes to Interfaces you have to define the necessary bindings. Here Db.class and StatsdClient.class are interfaces which you need to bind to specific implementation.
has comment: http://stackoverflow.com/comment/38465293
has comment: http://stackoverflow.com/comment/56146069
type: AcceptedAnswer
downvote count: 0
upvote count: 30
accepted answer of: http://stackoverflow.com/q/24766665

http://stackoverflow.com/comment/38435631
comment on: http://stackoverflow.com/q/24769627
score: 0
has text: Btw, I recommend using an IDE (such as eclipse) for this sort of thing. In any good IDE you would have gotten warnings about this
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24781259
has comment: http://stackoverflow.com/comment/38631711
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38457974
has comment: http://stackoverflow.com/comment/38457231
score: 1
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24781876
has title: JSP not calling ajax function
tagged with: java
has body: I have written an ajax function which will be called when someone selects a year from a dropdown. On selecting the year, the ajax will call a servlet based on passed URL and that servlet will set a value in properties file. However, the problem is, on selecting the year, my ajax block is not called Year <html:options collection= "<%=GlobalValues.LIST_MODELYEAR%>" property="id" labelProperty="value" /> (Required)
linked to: http://stackoverflow.com/q/24103824
has comment: http://stackoverflow.com/comment/38457714
has answer: http://stackoverflow.com/a/24781684
answer count: 2
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: ajax

http://stackoverflow.com/a/24896544
has comment: http://stackoverflow.com/comment/38705129
has comment: http://stackoverflow.com/comment/38705164
has comment: http://stackoverflow.com/comment/38767952
upvote count: 2
has comment: http://stackoverflow.com/comment/38705088
has comment: http://stackoverflow.com/comment/38931580
answers question: http://stackoverflow.com/q/24883695
type: Answer
score: 2
has body: I'd recommend using XspOpenLogUtil.logEvent instead, if possible. If you want to get a handle on the OpenLogItem, use XspOpenLogUtil.getOpenLogItem(). See this blog post I wrote http://www.intec.co.uk/xpages-openlog-logger-and-openntf-domino-api-core-structure/ For removing the stack trace, there's an xsp property available called xsp.openlog.suppressEventStack=true. See http://www.intec.co.uk/xpages-openlog-logger-v4-0/. Personally I find the stack trace useful for identifying which phase something's occurring in. This may not yet be available in M4.5, but if you are using the version from GitHub, it is. The fourth parameter should be an org.openntf.domino.Document. You'll never need a lotus.domino object for an org.openntf.domino method. As soon as I make a change to anything in XPages OpenLog Logger project on OpenNTF, I'm also making the same amendments in OpenNTF Domino API.
has comment: http://stackoverflow.com/comment/38716790
downvote count: 0
has comment: http://stackoverflow.com/comment/38705116

http://stackoverflow.com/a/24755501
has comment: http://stackoverflow.com/comment/38414076
downvote count: 1
has comment: http://stackoverflow.com/comment/38409038
has comment: http://stackoverflow.com/comment/38413404
upvote count: 0
score: -1
has body: Correct me if i'm wrong, but i think older compiler changes this: Map&lt;String, String&gt; vars = request.getParameterMap(); into this (raw map): Map vars = request.getParameterMap(); So it should run fine. But it seems it has been changed in Java7. I can't find the exact link, but these may help: http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html
has comment: http://stackoverflow.com/comment/38409614
answers question: http://stackoverflow.com/q/24755146
type: Answer
has comment: http://stackoverflow.com/comment/38409831

http://stackoverflow.com/comment/38486416
has text: That's not a bad idea but I'd probably throw the counter into a Numeric.Sequence in the flow of data just to make the counter simpler. I'm also, generally, a fan of making job wide commits (only commit everything at the end) unless I specifically need otherwise because it makes error recovery far simpler if you don't have to worry about what you might have committed before the job failed.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24772685
type: AnswerComment

http://stackoverflow.com/q/24862777
has answer: http://stackoverflow.com/a/24863286
accepted answer: http://stackoverflow.com/a/24863286
type: AnsweredQuestion
has body: I got a noob question concerning Static vs. Non-Static Methods. In this example I parse Data out and want to write it to my DB. I was doing fine as long as I declared the method getData() static. But now when im invoking Database.insert(x,y,z) - the static-non static error comes into play. I just can't wrap my thoughts around the problem how to solve this issue. Can anyone explain to me, how I can write those variables into my DB? your help is highly valued and will help me advance in java. EDIT: Error message saying: Cannot make a static reference to the non-static method insert(String, String, String, String) from the type Database Code: package org.jsoup.examples; import java.io.*; import org.jsoup.*; import org.jsoup.nodes.*; import org.jsoup.select.Elements; import java.io.IOException; /** * Example program to list links from a URL. */ public class parseEasy { String companyName = "Platzhalter"; String jobTitle = "Platzhalter"; String location = "Platzhalter"; String timeAdded = "Platzhalter"; public static void main(String[] args) throws IOException { Database connect = new Database(); connect.OpenConnectionDB(); getData(); connect.closeConnectionDB(); } // FIRMENNAME public static void getData() throws IOException { int count = 0; Document document = Jsoup.parse(new File("C:/Talend/workspace/WEBCRAWLER/output/keywords_SOA.txt"), "utf-8"); Elements elements = document.select(".joblisting"); for (Element element : elements) { // Counter for Number of Elements returned count++; // Parse Data into Elements Elements jobTitleElement = element.select(".job_title span"); Elements companyNameElement = element.select(".company_name span[itemprop=name]"); Elements locationElement = element.select(".locality span[itemprop=addressLocality]"); Elements dateElement = element.select(".job_date_added [datetime]"); // Strip Data from unnecessary tags String companyName = companyNameElement.text(); String jobTitle = jobTitleElement.text(); String location = locationElement.text…
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/38611420
has comment: http://stackoverflow.com/comment/38611530
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38611370
tagged with: static
has comment: http://stackoverflow.com/comment/38611411
score: -3
downvote count: 4
tagged with: parsing
has title: Static - Non-Static methods in Java

http://stackoverflow.com/comment/38480654
type: QuestionComment
has text: If needed, consider using a CardLayout and a MouseListener...
comment on: http://stackoverflow.com/q/24792751
score: 0
type: Comment

http://stackoverflow.com/q/24774208
tagged with: database
has comment: http://stackoverflow.com/comment/38443955
answer count: 1
has title: java.net.ConnectException: Connection timed out: connect, using router
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: router
tagged with: processing
score: 1
tagged with: java
tagged with: mysql
has body: I am trying to connect one PC (with XAMPP) with another PC (with Processing). For this, I downloaded a MySQL library for Processing: import de.bezier.data.sql.*; It works when I use localhost as a server, it works with other computers when both have internet. However, I need this to work in a local network, so no internet and just the router's wireless connection. And here it fails. I have no idea why. Even when I use the LAN cable, I can access the 'server' via URL. But when I want to access it in Processing I get this: SQL.connect(): Could not connect to the database ( jdbc:mysql://192.168.0.103/event ). com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.net.ConnectException: Connection timed out: connect STACKTRACE: java.net.SocketException: java.net.ConnectException: Connection timed out: connect at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:284) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2569) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1485) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at de.bezier.data.sql.SQL.connect(Unknown Source) at MySQL_example1.setup(MySQL_example1.java:56) at processing.core.PApplet.handleDraw(PApplet.java:2103) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:190) at processing.core.PApplet.run(PApplet.java:2006) at java.lang.Thread.run(Thread.java:662) ** END NESTED EXCEPTION ** Last packet sent to the server was 26 ms ago. at com.mysql.jdbc.Connection.createNewIO(Connection.java:2643) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1485) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266) at java…
has answer: http://stackoverflow.com/a/24821952
type: Question
has comment: http://stackoverflow.com/comment/38534227
downvote count: 0

http://stackoverflow.com/comment/38676189
has text: @rmertins Just correct me if I am wrong but I should rather run my code in AsyncTask
type: QuestionComment
comment on: http://stackoverflow.com/q/24896353
score: 0
type: Comment

http://stackoverflow.com/comment/38398400
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24749728
has text: The warning is more like a general warning for future viewers: not all devices have more than 1GB, and not all apps can use all of them ;)
type: AnswerComment

http://stackoverflow.com/a/24872530
has body: but I do not know how many rows I need Then create a Vector for every row of data that you read. Then you can just use: model.addRow(...);
type: Answer
answers question: http://stackoverflow.com/q/24871828
score: 0

http://stackoverflow.com/q/24855307
tagged with: pojo
score: 0
has title: simplest possible POJO echo with netty
has comment: http://stackoverflow.com/comment/38636110
type: UnansweredQuestion
tagged with: netty
tagged with: io
has comment: http://stackoverflow.com/comment/38732695
linked to: http://stackoverflow.com/q/24926840
answer count: 0
tagged with: java
type: Question
has body: How do I initiate an infinite loop between the client and server, to send and receive POJO PingPong objects between the client and server? When a connection is established, which seems to be happening, the client should send a PingPong, and the server should reply with a PingPong POJO as well. The client should (preferably) respond with another PingPong, creating an infinite loop. the server receives an object: BUILD SUCCESSFUL Total time: 2 seconds Jul 20, 2014 2:43:17 PM io.netty.handler.logging.LoggingHandler channelRegistered INFO: [id: 0x2cd55a8d] REGISTERED Jul 20, 2014 2:43:17 PM io.netty.handler.logging.LoggingHandler bind INFO: [id: 0x2cd55a8d] BIND(0.0.0.0/0.0.0.0:4454) Jul 20, 2014 2:43:17 PM io.netty.handler.logging.LoggingHandler channelActive INFO: [id: 0x2cd55a8d, /0:0:0:0:0:0:0:0:4454] ACTIVE Jul 20, 2014 2:43:24 PM io.netty.handler.logging.LoggingHandler logMessage INFO: [id: 0x2cd55a8d, /0:0:0:0:0:0:0:0:4454] RECEIVED: [id: 0xe7c06459, /127.0.0.1:33182 =&gt; /127.0.0.1:4454] ^Cthufir@dur:~/NetBeansProjects/NettyServer$ thufir@dur:~/NetBeansProjects/NettyServer$ which was sent by the client: BUILD SUCCESSFUL Total time: 2 seconds Jul 20, 2014 2:43:24 PM io.netty.handler.logging.LoggingHandler channelRegistered INFO: [id: 0x0f1fc251] REGISTERED Jul 20, 2014 2:43:24 PM io.netty.handler.logging.LoggingHandler connect INFO: [id: 0x0f1fc251] CONNECT(localhost/127.0.0.1:4454, null) Jul 20, 2014 2:43:24 PM io.netty.handler.logging.LoggingHandler channelActive INFO: [id: 0x0f1fc251, /127.0.0.1:33182 =&gt; localhost/127.0.0.1:4454] ACTIVE ^Cthufir@dur:~/NetBeansProjects/NettyClient$ thufir@dur:~/NetBeansProjects/NettyClient$ server code: package net.bounceme.dur.netty; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import java.net.Socket; import java.util.logging.Logger; @Sharable public class PingPongServerHandler extends SimpleChannelInboundHandler&lt;Ping…
tagged with: client-server

http://stackoverflow.com/a/24846540
has comment: http://stackoverflow.com/comment/38580643
type: Answer
upvote count: 1
has body: problem: getActivity().setContentView(R.layout.game_fragment); You are trying to change the layout of your activty layout to game_fragment layout which by then wont found the .replace(R.id.rootLayout because the layout of your activity is changed. solution: remove the getActivity().setContentView(R.layout.game_fragment); so you still have the R.id.rootLayout view when you replace a the fragment. EDIT: change it to this. newGame = (Button) view.findViewById(R.id.newGameButton); newGame.setOnClickListener(this);
accepted answer of: http://stackoverflow.com/q/24846096
has comment: http://stackoverflow.com/comment/38580688
answers question: http://stackoverflow.com/q/24846096
score: 1
has comment: http://stackoverflow.com/comment/38580910
has comment: http://stackoverflow.com/comment/38580396
has comment: http://stackoverflow.com/comment/38580637
has comment: http://stackoverflow.com/comment/38580444
has comment: http://stackoverflow.com/comment/38580354
has comment: http://stackoverflow.com/comment/38580279
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38455668
type: Comment
comment on: http://stackoverflow.com/q/24763383
has text: Thank you. If you want to repost as an answer than I will accept it, otherwise I posted the code below as an answer...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38547485
comment on: http://stackoverflow.com/q/24788628
score: 0
has text: Your code is not complete enough for anyone to debug it. What is `FileInstance`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38527840
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24818108
has text: What is the memory usage in your windows task manager with culprit JVM running?
type: Comment

http://stackoverflow.com/comment/38673745
comment on: http://stackoverflow.com/a/24893759
score: 0
type: AnswerComment
type: Comment
has text: Hmm ... I guess I discovered a very special case where I need multiple values in a sorted collection, that might be equal according to the Comparator but not to hashCode/equals. I think the best way to solve this is to either 1) use the TreeSet and prevent a possible hash collision OR 2) write a red-black tree based List implementation. Still for most of the times your answer will be doing the job, so I accept it as the solution :)

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/24859158
tags question: http://stackoverflow.com/q/24848053
type: Tag

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/24866914

http://stackoverflow.com/q/24855588
has title: OpenShift: Wildfly takes most of the space in 1G, what to do?
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: wildfly
upvote count: 1
tagged with: openshift
score: 1
tagged with: java
has body: I signed up for OpenShift and created an WildFly, Java 7 based app, when I deploy I see remote: target/wildfly-8.1.0.Final/modules/system/layers/base/org/jboss/common-core/main/jboss-common-core-2.2.22.GA.jar remote: stderr: rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32) remote: rsync: write failed on "/var/lib/openshift/53cc3d974382ec1f72000304/app-deployments/2014-07-20_18-21-00.502/repo/target/wildfly-8.1.0.Final/modules/system/layers/base/org/jboss/common-core/main/jboss-common-core-2.2.22.GA.jar": Disk quota exceeded (122) remote: rsync error: error in file IO (code 11) at receiver.c(301) [receiver=3.0.6] remote: rsync: connection unexpectedly closed (17468 bytes received so far) [sender] remote: rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6] remote: remote: For more details about the problem, try running the command again with the '--trace' option Then I log into machine and see what's taking up so much space, I realized that wildfly itself is eating up all of it du -h * | sort -rh | head -50 592M wildfly 317M wildfly/usr/lib/jvm/jdk1.8.0_05 317M wildfly/usr/lib/jvm 317M wildfly/usr/lib 317M wildfly/usr 166M wildfly/usr/lib/jvm/jdk1.8.0_05/jre 165M wildfly/usr/lib/jvm/jdk1.8.0_05/jre/lib 147M app-root/runtime/repo/target 147M app-root/runtime/repo 147M app-root/runtime 147M app-root 136M wildfly/versions/8 136M wildfly/versions 135M app-root/runtime/repo/target/wildfly-8.1.0.Final 120M app-deployments/2014-07-20_18-21-00.502/repo/target 120M app-deployments/2014-07-20_18-21-00.502/repo 120M app-deployments/2014-07-20_18-21-00.502 120M app-deployments 118M wildfly/versions/8/modules 118M wildfly/usr/lib/jvm/jdk1.8.0_05/lib 118M wildfly/modules 116M wildfly/versions/8/modules/system/layers/base 116M wildfly/versions/8/modules/system/layers 116M wildfly/versions/8/modules/system 116M wildfly/modules/system/layers/base 116M wildfly/modules/system/layers 116M wildfly/modules/system 116M…
type: Question
has answer: http://stackoverflow.com/a/24897827
downvote count: 0
has comment: http://stackoverflow.com/comment/38598077

http://stackoverflow.com/comment/38479605
has text: Please add some commentary on how your code can be a solution to OP's question.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24792497
score: 0

http://stackoverflow.com/comment/38486423
score: 1
has text: use double-quotes `"path"` to enclose the path
comment on: http://stackoverflow.com/q/24796467
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24776599
upvote count: 2
has comment: http://stackoverflow.com/comment/38448820
score: 2
has body: replaceAll is using regexes, and is taking O(n) time and space (it builds a copy of the string) each time it runs. Therefore, s.replaceAll(a, b).replaceAll(c, d).replaceAll(e, f) would take 3x longer (both in time and in space) than a single scan. You really need to scan the string only once. Also, you are reading/writing chars 1 at a time. Buffering reads is much, much faster. Assuming plain ASCII, this will be a lot faster (it does not require extra space beyond the look-up table, and it does not require regex matching): boolean[] bad = new boolean[256]; bad[13] = bad[10] = bad[2] = true; // add more 'bad' values here; assuming &lt; 256 BufferedReader br = new BufferedReader(reader); BufferedWriter bw = new BufferedWriter(writer); char[] block = new char[1024*4]; // read in 4k at a time for (int len; (len = br.read(block, 0, block.length())) &gt; 0;) { for (int i=0; i&lt;len; i++) { if (block[i] &lt; 256 &amp;&amp; bad[(int)block[i]]) block[i] = '\n'; } bw.write(block, 0, len); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38448523
downvote count: 0
has comment: http://stackoverflow.com/comment/38448635
answers question: http://stackoverflow.com/q/24776507
has comment: http://stackoverflow.com/comment/38448645
type: Answer
accepted answer of: http://stackoverflow.com/q/24776507

http://stackoverflow.com/q/24810755
has comment: http://stackoverflow.com/comment/38513040
score: 0
has title: Searching xml file in java to see if an element exists not working?
accepted answer: http://stackoverflow.com/a/24810910
answer count: 2
has body: I have a directory with 3 files in it. This is supposed to loop through the files and process each xml file. It looks for the element "Booking" or "BookingOutputPlan" depending on which element it has in it, it is processed a different way. NodeList l = null; NodeList n = null; int counter = 0; for (counter = 0; counter &lt; files.size(); counter++) { Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(files.get(counter)); l = d.getElementsByTagName("Booking"); n = d.getElementsByTagName("BookTripPlanOutput"); } for (int i = 0; i &lt; l.getLength(); ++i) { GMFiles.add(files.get(i)); processGMXml(GMFiles, prop, log); } for (int a = 0; a &lt; n.getLength(); ++a) { ACFiles.add(files.get(a)); processACXml(ACFiles, prop, log); } } I get the arraylist for the files by doing this: Properties prop = new Properties(); InputStream in = null; in = new FileInputStream("config.properties"); // load a properties file prop.load(in); in.close(); // location of directory File directory = new File(prop.getProperty("directory")); // creates array list of files ArrayList&lt;File&gt; files = new ArrayList&lt;File&gt;(); // gets all the files in that directory and puts into array if (directory.isDirectory()) { File[] listFiles = directory.listFiles(); for (File file : listFiles) { if (file.isFile()) { files.add(file.getAbsoluteFile()); } }// end of for-loop listFiles
has answer: http://stackoverflow.com/a/24810902
tagged with: parsing
has comment: http://stackoverflow.com/comment/38513028
possible better answer: http://stackoverflow.com/a/24810902
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24810910

http://stackoverflow.com/comment/38416747
type: QuestionComment
comment on: http://stackoverflow.com/q/24752931
score: 0
has text: @Krumia I am a beggar because I cannot do methods outside of what java allows. If java does not allow me to do a one-liner like I asked, then I have no power over that. Therefore, in that sense, I am a beggar.
type: Comment

http://stackoverflow.com/a/24766127
downvote count: 0
upvote count: 117
type: Answer
has body: You are correct in that the TableView control does not have a String setter method that directly manipulates the text shown when the table is empty. What you will want to do instead is use the TableView's placeholder property which can be set to any object of type Node. For example... myTableView.setPlaceholder(new Label("My table is empty message"));
score: 117
accepted answer of: http://stackoverflow.com/q/24765549
answers question: http://stackoverflow.com/q/24765549
type: AcceptedAnswer

http://stackoverflow.com/comment/38580635
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24846738
has text: ok thank you i understand how to do that. But i need to write the position coordinates of all components at once after moving all component randomly by using a button. How to do that?. Thanks in advance
type: AnswerComment

http://stackoverflow.com/q/24759384
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24759553
linked to: http://stackoverflow.com/q/218384
tagged with: java
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/38416122
has answer: http://stackoverflow.com/a/24759630
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24759553
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/24759630
tagged with: nullpointerexception
has body: I have two type of users: admin and user. Here's what I am doing in Login servlet protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String user=request.getParameter("user"); String pass=request.getParameter("pass"); HttpSession session=request.getSession(); String name="user",type; try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection(url,user,pass); PreparedStatement ps=con.prepareStatement("select utype from users where email=? and pass=?"); ps.setString(1, user); ps.setString(2, pass); ResultSet rs=ps.executeQuery(); if(rs.next()) { type=rs.getString(1); if(type.equals("a")) { session.setAttribute("loggedIn", "admin"); RequestDispatcher rd=request.getRequestDispatcher("admin.jsp"); rd.forward(request, response); } else { session.setAttribute("loggedIn", "user"); RequestDispatcher rd=request.getRequestDispatcher("home.jsp"); rd.include(request, response); } } else { request.setAttribute("message","Username or password error!"); RequestDispatcher rd=request.getRequestDispatcher("login.jsp"); rd.include(request, response); } } catch(Exception e) { e.printStackTrace(); } } And on account.jsp page I am checking is user is logged in or not.Here's the code: &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ include file="headpl.jsp" %&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;script&gt; //have some code here &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;% if(session.getAttribute("loggedIn").equals("admin")) { response.sendRedirect("admin.jsp"); }else if(!session.getAttribute("loggedIn").equals("user")) { response.sendRedirect("index.jsp"); } %&gt; //some html code here &lt;/body&gt; &lt;/html…
type: Question
has comment: http://stackoverflow.com/comment/38416045
has title: Checking if user is logged in or not using sessions: java servlet
has answer: http://stackoverflow.com/a/34531759

interface
tags question: http://stackoverflow.com/q/24762888
tags question: http://stackoverflow.com/q/24808996
tag name: interface
tags question: http://stackoverflow.com/q/24802425
tags question: http://stackoverflow.com/q/24799168
tags question: http://stackoverflow.com/q/24861766
tags question: http://stackoverflow.com/q/24809513
tags question: http://stackoverflow.com/q/24878314
tags question: http://stackoverflow.com/q/24854315
tags question: http://stackoverflow.com/q/24836026
tags question: http://stackoverflow.com/q/24780000
tags question: http://stackoverflow.com/q/24899427
type: Tag
tags question: http://stackoverflow.com/q/24836365
tags question: http://stackoverflow.com/q/24803645

http://stackoverflow.com/comment/38514348
has text: Don't post a link to code as that will not help future visitors to this site. We need you to create and post a [Minimal, Complete, and Verifiable Example Program](http://stackoverflow.com/help/mcve) where you condense your code into the smallest bit that still compiles and runs, has no outside dependencies (such as need to link to a database or images), has no extra code that's not relevant to your problem, but still demonstrates your problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24811142

http://stackoverflow.com/a/24850344
score: 5
has body: Yes, interceptors have a lifecycle like any other cdi managed bean ... so they are dependent by default but you can annotate them with any any scope you need. In your example, all calls within the same Request share the interceptor. If what you need is "the same interceptor for every call", you should consider a broader scope like session or application. Update: check the comments: with cdi 1.1 interceptors have to be of dependent scope and Weld 2.2.6 treats other scopes as errors.
upvote count: 5
has comment: http://stackoverflow.com/comment/46298842
answers question: http://stackoverflow.com/q/24842538
has comment: http://stackoverflow.com/comment/38594461
accepted answer of: http://stackoverflow.com/q/24842538
has comment: http://stackoverflow.com/comment/72852449
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/72849545
has comment: http://stackoverflow.com/comment/46283759

http://stackoverflow.com/comment/38607026
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24860273
has text: The only solution I can come up with till now is to convert the array into a bit matrix, rotate it and convert it back, but I don't want to convert the array as it will reduce the performance. I was hoping there might be some bit based operations which can do the rotation without the requirement to convert the array.
score: 0

http://stackoverflow.com/q/24901347
tagged with: applet
favorite count: 0
has answer: http://stackoverflow.com/a/24901455
has comment: http://stackoverflow.com/comment/38684742
score: -2
has body: I am working on a Java applet that will have three buttons: Go Stop Slow The buttons will control a stoplight which in turn controls a car. At this point I am unable to get the stop light to change colors while keeping the switch statement mandated by the class. Here is my code so far: import java.awt.*; import java.applet.*; import javax.swing.*; import java.awt.event.*; public class lights extends JApplet implements ActionListener { JButton stop, go, slow; AudioClip ac; JPanel buttong; int x = 0; public void init() { } public void actionPerformed(ActionEvent ae) { Object obj = ae.getSource(); if (obj == go) { x = 1; } if (obj == stop) { x = 2; } else if (obj == slow) { x = 3; } } public void paint(Graphics g) { super.paint(g); stoplight(g, 50, 50); buttons(); switch (x) { case 1: g.setColor(Color.green); g.fillOval(50, 50, 10, 10); ac = getAudioClip(getDocumentBase(), "Hot rod start.wav"); ac.play(); break; case 2: x = 2; g.setColor(Color.red); g.fillOval(50, 70, 10, 10); break; case 3: g.setColor(Color.yellow); g.fillOval(x, 60, 10, 10); break; } } public void stoplight(Graphics grph, int x, int y) { Polygon box; box = new Polygon(); box.addPoint(x, y); box.addPoint(x + 10, y); box.addPoint(x + 10, y + 30); box.addPoint(x, y + 30); grph.drawPolygon(box); grph.drawOval(x, y, 10, 10); grph.drawOval(x, y + 10, 10, 10); grph.drawOval(x, y + 20, 10, 10); Polygon pole; pole = new Polygon(); pole.addPoint(x + 3, y + 30); pole.addPoint(x + 3, y + 70); pole.addPoint(x + 7, y + 70); pole.addPoint(x + 7, y + 30); grph.drawPolygon(pole); } public void buttons() { buttong = new JPanel(new FlowLayout()); stop = new JButton("Stop"); go = new JButton("Go"); slow = new JButton("Slow"); go.addActionListener(this); stop.addActionListener(this); slow.addActionListener(this); buttong.add(go); buttong.add(stop); buttong.add(slow); add(buttong); } }
type: UnansweredQuestion
downvote count: 2
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/38684712
has title: How to create applet that controls stop lights?
type: Question
has comment: http://stackoverflow.com/comment/38684661
upvote count: 0
answer count: 1

http://stackoverflow.com/a/24837205
score: 2
has body: What do you expect this code to do? String[] listOfSt = null; It creates a null variable, right? And then you use the null variable (without having initialized it first): listOfSt[i] = listOfEx[i].getName();
downvote count: 0
answers question: http://stackoverflow.com/q/24837189
type: AcceptedAnswer
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24837189

http://stackoverflow.com/q/24833696
tagged with: android
has title: How to implement AsyncTask connecting to a server and parsing JSON
tagged with: android-asynctask
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24834076
answer count: 2
has answer: http://stackoverflow.com/a/24834100
downvote count: 0
has body: my app does connect to a local server on my pc (xampp) and I would like to implement asynctask in order to avoid app crash or block when the server is not online or there are any other problems. Reading on the web I found that the best solution should be asynctask but I really can't understand very well how to implement it. I have a JSONParser class that connect to the server, then another userfunctions class with multiple functions that call JSONParser class...should I implement asynctask on JSONParser class or on the other one? This is my JSONParser class : public class JSONParser{ static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } public JSONObject getJSONFromUrl(String url, List&lt;NameValuePair&gt; params) { // Making HTTP request try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "n"); } is.close(); json = sb.toString(); Log.e("JSON", json); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } // try parse the string to a JSON object try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON String return jObj; } How should my class become with asynctask and overriding doinbackground method? Then how should I call it in order to e…
favorite count: 0

http://stackoverflow.com/a/25763753
answers question: http://stackoverflow.com/q/24902760
score: 0
has body: i thank to Steve Benettand Bhawna Raheja, sorry for the late reply, Simply i have solve this error by set Timeout via HttpRequest.TimeOut . i dont know how i forgot to set time out. One again thank to You both.
type: Answer

http://stackoverflow.com/comment/45406835
type: Comment
score: 1
comment on: http://stackoverflow.com/a/28416430
type: AnswerComment
has text: Baruch, Lets stick with the facts. E.g. the Android Maven Plugin is in jcenter even though it was ONLY deployed to the Central Repository. Try wget http://jcenter.bintray.com/com/simpligility/maven/plugins/android-maven-plugin/4.1.1/android-maven-plugin-4.1.1.jar for yourself. I therefore conclude that jcenter somehow "proxied", "copied" or whatever it from Central. And thats totally fine by me.

http://stackoverflow.com/a/24833320
upvote count: 3
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/24790805
has body: Gist Here Hopefully self-explanatory; it just prints the file name on the console, then deletes it.

http://stackoverflow.com/comment/38695786
comment on: http://stackoverflow.com/q/24906685
score: 0
has text: After you edited it, It was working. I just tried the way it's described in the link with the same results.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38653946
type: AnswerComment
type: Comment
has text: yes.. this *would* work but don't you think that it would be better in terms of extensibility, if he used a custom comparator?
comment on: http://stackoverflow.com/a/24885349
score: 0

http://stackoverflow.com/comment/38561182
score: 0
type: Comment
type: QuestionComment
has text: Both are valid assignments. The "right" one depends on what you want to achieve
comment on: http://stackoverflow.com/q/24836343

http://stackoverflow.com/q/24801447
tagged with: oracle-database
tagged with: sql
tagged with: jdbc
type: UnansweredQuestion
has body: I have developed java application using java swings and oracle XE database in "myecplise". I have also created executable jar file and it runs fine in my pc but it is showing jdbc.odbc ClassNotFound exception and NullPointer Exception in other pc my connection code is import java.sql.*; public class Connect { static Connection con=null; public static Connection ConnectDB(){ try{ // Class.forName("oracle.jdbc.driver.OracleDriver"); DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:system/system@localhost"); return con; }catch(Exception e){ JOptionPane.showMessageDialog(null, e.getMessage()); e.printStackTrace(); return null; } } }
tagged with: swing
has answer: http://stackoverflow.com/a/24801701
has title: how to embed oracle XE database in executable jar?
has comment: http://stackoverflow.com/comment/38499212
tagged with: java
type: Question
answer count: 1
score: 0

http://stackoverflow.com/a/24759441
answers question: http://stackoverflow.com/q/24759252
has body: You can use the split method of the String class String[] split(String regex) This will return an array of strings that you can handle directly of transform in to any other collection you might need. I suggest also to remove the suppresswarning unless you are sure what you are doing. In most cases is better to remove the cause of the warning than supress the warning.
score: 0
type: Answer

http://stackoverflow.com/comment/38427133
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24765118
type: AnswerComment
has text: i am not sure how to do it in eclipse, i use netbeans (but im sure if you right click the .EAR/.EJB/.WAR and chose properties you will find it, all 3 need to be unchecked in netbeans). and yes apache will know of it, it gets saved in the project.properties file

http://stackoverflow.com/comment/38577217
has text: Thanks for pointing out naming conventions issue. Speaking of problem, the code was working fine. I just moved `JPanel` in `JFrame` and it stopped fetching value. It sounds illogical but it's happening.
comment on: http://stackoverflow.com/a/24844930
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24816349
has body: I am attempting to send native MouseEvents and KeyEvents to a java application. I've figured out how to do it in AWT, like this: KeyEvent k = new KeyEvent(j, KeyEvent.KEY_TYPED, 1, 0, KeyEvent.VK_UNDEFINED, 'k'); j.requestFocus(); java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(k); Where j is your component. The thing is though, this only works on Java/AWT components. I'm attempting to emulate a mouse press or key press in DJ Native Browser, but it doesn't work here, possibly because this browser doesn't use AWT. Is there a way I can send a native windows event to the application without affecting my actual keyboard and mouse? Obviously awt.Robot is the obvious answer but it DOES affect the windows mouse and keyboard. If the way to do it is operating-system dependent, that is OK. As long as it works on windows 64 bit, there is no issue with that. Another possibility would be a java swing browser that runs on AWT, but I have yet to find a working, up-to-date browser besides DJNative, let alone one that runs on AWT. Suggestions?? Thanks
linked to: http://stackoverflow.com/q/14118734
type: Question
has comment: http://stackoverflow.com/comment/38544381
has comment: http://stackoverflow.com/comment/38524237
score: 3
has comment: http://stackoverflow.com/comment/38524295
has comment: http://stackoverflow.com/comment/38524394
downvote count: 0
tagged with: events
favorite count: 0
has title: Send native events
type: UnansweredQuestion
tagged with: windows
has comment: http://stackoverflow.com/comment/38524147
answer count: 0
upvote count: 3
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/38525693

http://stackoverflow.com/q/24828547
favorite count: 0
duplicate of: http://stackoverflow.com/q/5122913
has title: JAVA set key for each array index
has body: I'm a newbie in Java who used PHP before that. I want to define an array in Java with a key for each array entry like in PHP. For example, in PHP I would have this: $my_arr = array('one'=&gt;1, 'two'=&gt;2, 'three'=&gt;3); How would I define this array in Java?
answer count: 4
has answer: http://stackoverflow.com/a/24828650
has answer: http://stackoverflow.com/a/24828654
upvote count: 1
linked to: http://stackoverflow.com/q/5122913
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24828733
accepted answer: http://stackoverflow.com/a/24828733
has answer: http://stackoverflow.com/a/24828673
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38546626
type: Question
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/24828654

http://stackoverflow.com/a/24855687
type: Answer
has body: Google Cloud Endpoints does this (converts data classes from GAE languages to client languages) but Dart is not currently amongst the support languages. I guess GCE could be used to generate js, which could then be used in Dart app, but that is not ideal. So I think this is a possible solution but not an adequate one. The other problem with this is that the code conversion of is tightly bound to the GCE service - it can't be used independently of GCE and the only way to get GCE to convert your classes is to include them in a GCE interface. (If they added Dart support to GCE, made the code translator more independent of GCE, and added some features such as an @Ignore attribute, I think it would be very useful!)
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24855634

http://stackoverflow.com/comment/38475653
type: QuestionComment
has text: Your string looks like a correct regex, but it's redundant. `*` matches 0 or more of a token, and `?` matches 0 or 1. So you are matching 0 or 1 groups of 0 or more spaces. Basically, it would do the same thing if you took out the `?`.
comment on: http://stackoverflow.com/q/24790553
type: Comment
score: 1

http://stackoverflow.com/a/24854608
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38719873
has comment: http://stackoverflow.com/comment/38603313
has comment: http://stackoverflow.com/comment/38688475
answers question: http://stackoverflow.com/q/24854454
type: Answer
accepted answer of: http://stackoverflow.com/q/24854454
has body: Currently I am sending packets of size 1.4 kilobytes every 10ms. Are you sending audio or video. If you use 320 Kbit/s MPEG you need 40 KB/second or 400 bytes every 10 ms. 128 Kbut/sec would require 160 bytes per 10 ms. But this seems to be slow. Why? Now I have read that packet size of 1400 is advised because of MTU issues. The MTU is closer to 1500 and this applies to TCP not UDP. Perhaps i can increase my packet size, or reduce the pacing ? The larger the packet, the more you lose when one goes missing. I would try 0.5 KB packets as these have been a good size for me in the past.
has comment: http://stackoverflow.com/comment/38636348
has comment: http://stackoverflow.com/comment/38732111
score: 0

http://stackoverflow.com/comment/38685134
comment on: http://stackoverflow.com/q/24901424
score: 0
type: Comment
type: QuestionComment
has text: @user3684431 Then you're not resetting the state of the render between calls

http://stackoverflow.com/a/24773061
type: Answer
score: 11
downvote count: 1
upvote count: 12
has body: You are facing the problem as your number is wrapping around.In the first case it does not wrap around and hence it overflows the range of short. But in the second case it wraps around after the calculationa and hence it comes in the range of short and so you dont have the compile time error. A loss of precision means that you are losing information of the given value.(The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive).) In your first case the range of short is crossed(1073741824) and hence you are loosing the information. A narrowing conversion of a signed integer to an integral type T simply discards all but the n lowest order bits, where n is the number of bits used to represent type T. EDIT:- From JLS §3.10.1(very correctly mentioned in this similar question) It is a compile-time error if a decimal literal of type int is larger than 2147483648 (231), or if the decimal literal 2147483648 appears anywhere other than as the operand of the unary minus operator (§15.15.4).
answers question: http://stackoverflow.com/q/24772953

http://stackoverflow.com/comment/38460646
comment on: http://stackoverflow.com/a/24781011
type: AnswerComment
has text: (1) You should be able to use the FQDN of the VM, as long as the DNS where you run the jclouds program can resolve it. (2) Yes, client is a client that must exist in the Chef Server. Clients in Chef are "api consumers". (3) The validator is a "special client" in all Chef Server installations that is used by the knife-bootstrap to register nodes in the Chef Server during their very first run. jclouds-chef just does the same that knife-bootstrap does.
type: Comment
score: 1

http://stackoverflow.com/comment/69853656
has text: Guava has a [useful reference](https://github.com/google/guava/wiki/ConditionalFailuresExplained) comparing several different use-cases for runtime exceptions and `AssertionError`. I'd encourage anyone who is surprised by this pattern to read this page.
type: QuestionComment
comment on: http://stackoverflow.com/q/24863185
score: 2
type: Comment

http://stackoverflow.com/comment/38647074
has text: No need to escape forward slashes.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24881358
type: Comment

http://stackoverflow.com/comment/38644753
score: 0
type: Comment
type: QuestionComment
has text: The problem is that you pass `null` into the method - make sure to initialize `prices` before you pass it to the method.
comment on: http://stackoverflow.com/q/24880143

http://stackoverflow.com/q/24789902
tagged with: android
tagged with: garbage-collection
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25297913
tagged with: java
type: Question
has body: I had to create a custom component (I could not use gridview or dataTable), which is a table with 6 columns and X rows (no images). The image below shows it working: The problem occurs when I scroll up or down on that table. Sometimes it scrolls correctly, in others it takes a lag. In the logcat, I realized that the lag occurs when the GC kicks in. I was looking for a way to optimize my component, however I am new to Java. I read about optimizing Views, and reuse of objects width getView. Below is my current getView code: @Override public View getView(int position, View convertView, ViewGroup parent) { if (null == this.parent) this.parent = (ListViewOT) parent; if (this.parent.isInEditMode()) { super.getView(position, convertView, parent); } mActivity = (MainActivity) parent.getContext(); this.c = this.getCursor(); c.moveToPosition(position); if (null == convertView) { view = (LinearLayout) LinearLayout.inflate( this.context, R.layout.item_lvacoes, null); row = (LinearLayout) view.getChildAt(1); headerRow = (TableRow) this.parent.getHeader().getChildAt(0); for (int j = 0; j &lt; this.c.getColumnCount(); j++) { columnName = c.getColumnName(j); if (columnName.startsWith("Status")) { continue; } headerCell = (CelulasLV) headerRow.getChildAt(j); current_width = headerCell.getWidth(); headerCell.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); cell_width = AdapterLVAcoes.CalculateTextSize(headerCell.getPaint(), c.getColumnName(j)); column_width = this.parent.getColumnWidthAt(j); if (column_width == 0) headerCell.setWidth(0); else if (cell_width &lt;= column_width) { if (current_width != column_width) headerCell.setWidth(column_width); } else { this.changedWidth = true; this.parent.setColumnWidthAt(j, cell_width); } column = new CelulasLV(this.context,(ListViewOT) parent); if (columnName.equals("No")) column.setText("" + (position + 1)); else column.setText(c.getString(j)); column.setIndexColumn(j); column.setIndexRow(position); column.setEPC(c.getString(c.getCo…
answer count: 2
has comment: http://stackoverflow.com/comment/38474944
has answer: http://stackoverflow.com/a/24791358
score: 0
has answer: http://stackoverflow.com/a/25297913
possible better answer: http://stackoverflow.com/a/24791358
has title: GC Lagging app when scrolling my custom component

http://stackoverflow.com/comment/38603894
comment on: http://stackoverflow.com/q/24858468
type: Comment
has text: Please be more specific than "browse file dialogue". Which file dialog class are you using? java.awt.FileDialog, javax.swing.JFileChooser, or javafx.stage.FileChooser?
score: 0
type: QuestionComment

keystroke
type: Tag
tags question: http://stackoverflow.com/q/24785353
tag name: keystroke

http://stackoverflow.com/q/24768869
downvote count: 0
has title: ADT to Android Studio UNEXPECTED TOP-LEVEL EXCEPTION
tagged with: android
has comment: http://stackoverflow.com/comment/38434061
answer count: 1
linked to: http://stackoverflow.com/q/22851103
favorite count: 0
tagged with: android-studio
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18301764
has body: So, I'm trying to migrate my Eclipse ADT project into Android Studio. I am using the appcompat_v7 project as a library project in eclipse. I followed the instructions on the Android Development site, but I am still receiving this error: Error:Execution failed for task :PaWPal:dexDebug. com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/godswood/Desktop/adt-bundle-mac-x86_64-20140321/sdk/build-tools/19.1.0/dx --dex --num-threads=4 --output /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/dex/debug /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/classes/debug /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/dependency-cache/debug /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/android-support-v13-7e8441dbe126e0c6ef27b0769fe1a7b51230f497.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/android-support-v4-435683bcc81493f96c2a6911d0f2132f9185a3c8.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/android-support-v7-appcompat-ce23957a305e187b582a49f3d7389771481d29a0.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/classes-0df1e7b55f7a1cf804d7c324e4d8e5350156c424.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/commons-lang3-3.3.2-414f8e20d93f4cd78deef61257feb20e410dc32e.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/joda-time-2.3-e2f8ddd39c18a5b5f810a870e98c34e25539e6e9.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/joda-time-2.3-javadoc-2b8389d156c40d0540abb1e521b4be4ba90b89b7.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/joda-time-2.3-sources-ee3d5e4a6e2aceeeee41f9ab558b6a1430285670.jar /Users/godswood/Desktop/pawpal/PaWPal/build/intermediates/pre-dexed/debug/Parse-1.5.1-b7ce0ef98d2f79d618c5421f63a4845519bd4ced.jar Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.…
score: 2
tagged with: java
tagged with: adt
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24768935

http://stackoverflow.com/comment/38552495
score: 0
type: Comment
has text: hmmm yeah... you're right... let me make a class and test it
type: AnswerComment
comment on: http://stackoverflow.com/a/24831595

http://stackoverflow.com/a/24906542
answers question: http://stackoverflow.com/q/24859158
downvote count: 0
type: AcceptedAnswer
has body: To convert text elements to hyper links involves multiple operations: You have to apply text extraction with the twist of also extracting the text location, not merely the plain text. In that extracted text with locations you have to find all text parts which you want to make hyper links. Having found them, take their locations and add appropriate annotations to make them hyper linked. Extraction of text with location can be done in iText implementing a variant of the LocationTextExtractionStrategy (cf. this answer; even though it is written for iTextSharp, the same principles apply) and in PDFBox overriding PDFTextStripper.writeString(String, List&lt;TextPosition&gt;).
accepted answer of: http://stackoverflow.com/q/24859158
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/38689611
has text: @AshishSrivastava what is the _exact_ compiler error you are getting?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24903819
type: AnswerComment

http://stackoverflow.com/comment/38407858
has text: I upvoted you because you had a downvote although this is the answer to the question :)
comment on: http://stackoverflow.com/a/24754801
score: 0
type: Comment
type: AnswerComment

file
tags question: http://stackoverflow.com/q/24845276
tags question: http://stackoverflow.com/q/24900456
type: Tag
tags question: http://stackoverflow.com/q/24888836
tags question: http://stackoverflow.com/q/24791932
tags question: http://stackoverflow.com/q/24818124
tags question: http://stackoverflow.com/q/24812164
tags question: http://stackoverflow.com/q/24783160
tags question: http://stackoverflow.com/q/24807920
tags question: http://stackoverflow.com/q/24849230
tags question: http://stackoverflow.com/q/24879971
tags question: http://stackoverflow.com/q/24879765
tags question: http://stackoverflow.com/q/24834511
tags question: http://stackoverflow.com/q/24771092
tag name: file
tags question: http://stackoverflow.com/q/24832467
tags question: http://stackoverflow.com/q/24778902
tags question: http://stackoverflow.com/q/24896087
tags question: http://stackoverflow.com/q/24884746
tags question: http://stackoverflow.com/q/24854288
tags question: http://stackoverflow.com/q/24751197
tags question: http://stackoverflow.com/q/24876819
tags question: http://stackoverflow.com/q/24839141
tags question: http://stackoverflow.com/q/24814895
tags question: http://stackoverflow.com/q/24832657
tags question: http://stackoverflow.com/q/24804618
tags question: http://stackoverflow.com/q/24798745
tags question: http://stackoverflow.com/q/24873516
tags question: http://stackoverflow.com/q/24859507
tags question: http://stackoverflow.com/q/24841292
tags question: http://stackoverflow.com/q/24868436
tags question: http://stackoverflow.com/q/24827571
tags question: http://stackoverflow.com/q/24881941
tags question: http://stackoverflow.com/q/24860448
tags question: http://stackoverflow.com/q/24782512
tags question: http://stackoverflow.com/q/24858204
tags question: http://stackoverflow.com/q/24900981
tags question: http://stackoverflow.com/q/24837919
tags question: http://stackoverflow.com/q/24810517
tags question: http://stackoverflow.com/q/24871637
tags question: http://stackoverflow.com/q/24770500
tags question: http://stackoverflow.com/q/24856150
tags question: http://stackoverflow.com/q/24882515

http://stackoverflow.com/comment/38410157
comment on: http://stackoverflow.com/q/24751682
score: 0
has text: @EJP command `openssl req -out certificatecsr.csr -new -newkey rsa:2048 -keyout certificatekey.key` creates a new certificate request and a new private key based on documentation [here](https://www.openssl.org/docs/apps/req.html)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24780226
score: 2
tagged with: memory-management
upvote count: 2
tagged with: javafx
type: AnsweredQuestion
has title: Closing JavaFX Tab doesn't release memory
tagged with: java
tagged with: memory
linked to: http://stackoverflow.com/q/24762966
has answer: http://stackoverflow.com/a/24780417
type: Question
has body: I posted a similar question yesterday about releasing memory when removing a Label (JavaFX GUI doesn&#39;t release memory). It turned out I was holding on to a reference in an action listener. Today I've been trying to do a similar thing with the Tab control, this time there are no listeners I've added since they are built in to the JavaFX control. When closing a Tab the heap still contains the Tab instance along with some of it's inner classes. Is there anything I can do to release the memory or is it a bug in JavaFX? public class TabTest extends Application { @Override public void start(Stage primaryStage) { final TabPane tabPane = new TabPane(); tabPane.getTabs().add(new Tab()); tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB); //create scene and stage Scene scene = new Scene(tabPane); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
answer count: 1
downvote count: 0
favorite count: 0
tagged with: memory-leaks
accepted answer: http://stackoverflow.com/a/24780417

http://stackoverflow.com/q/24843181
answer count: 2
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38574280
favorite count: 0
has title: IP Webcam on OpenCV for Java
tagged with: ffmpeg
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24847914
has body: I am using IP Webcam APP for android and it is streaming MJPEG video through the local url : http://192.168.0.2:8080/video I was able to show the video using VLC player and this piece of code in C++. On the OpenCV 2.2 I opened the url using: VideoCapture cap; cap.open("http://192.168.0.2:8080/video?dummy=param.mjpg"); It worked in C++, but I want it to work in Java. I was able to run OpenCV2.4.9 using Java when taking pictures from my built in webcam. This is my code for taking the images from a url in Java. System.loadLibrary("opencv_java249"); VideoCapture capture = new VideoCapture(); capture.open("http://192.168.0.2:8080/video?dummy=param.mjpg"); But the capture.open does not open the streaming and I could not debug it properly. I know that it might be a issue with the ffmpeg, since it works on OpenCV2.2. I also know that my OpenCV2.2 is specific for MS 2010 and might be more complete. Would it help if I compile the OpenCV2.4.9 from sources? Is there a file that I could add to solve that problem? Is there another way of receiving the video from the IP camera and using on OpenCV?
has answer: http://stackoverflow.com/a/33711935
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/33709907
type: Question
tagged with: video-streaming
tagged with: opencv
tagged with: ip-camera
has comment: http://stackoverflow.com/comment/38576906

http://stackoverflow.com/comment/38494999
has text: Sure we can help you but before that you have to show your research and R&D!
comment on: http://stackoverflow.com/q/24801006
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38400808
score: 1
comment on: http://stackoverflow.com/a/24751242
type: AnswerComment
has text: As I said in the OP, I didn't come up with the equations, and I don't know what the numbers mean. It is an equation used in a video game to calculate the amount of experience to go to the next level defined [here](http://bulbapedia.bulbagarden.net/wiki/Experience)
type: Comment

http://stackoverflow.com/q/24863567
type: UnansweredQuestion
tagged with: android
has body: I create an app view maps using google maps api v2. This is my code: My Activity public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); } } My main_activity: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment" /&gt; &lt;/LinearLayout&gt; Android manifest: &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10" /&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-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;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyB96b4lWziSteDtMTqrDDurcTvOIwzKCRE" /&gt; And when I running, this is logcat: 07-21 17:53:33.734: E/AndroidRuntime(3558): FATAL EXCEPTION: main 07-21 17:53:33.734: E/AndroidRuntime(3558): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demogooglemap/com.example.demogooglemap.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment 07-21 17:53:33.734: E/AndroidRuntime(3558): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2246) 07-21 17:53:33.734: E/AndroidRuntime(3558): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2296) 07-21 17:53:33.734: E/AndroidRuntime(3558): at android.app.Activ…
tagged with: java
type: Question
answer count: 2
tagged with: google-maps
has title: Error with using google maps api v2 in Android
score: 0
has answer: http://stackoverflow.com/a/24864152
has answer: http://stackoverflow.com/a/24863619

http://stackoverflow.com/comment/38490580
score: 0
type: Comment
has text: I know that I'm asking for a lot but could you give me some hint how can I do that? I have to implement `boolean accept()`. I should pass `Message<?>` object to this method? and (if yes) how can I get access to it's pattern?
type: AnswerComment
comment on: http://stackoverflow.com/a/24798331

http://stackoverflow.com/q/24765630
tagged with: arrays
answer count: 1
tagged with: minecraft
tagged with: class
has title: Rendering block depending on block state/passing variable between classes
score: 0
tagged with: initialization
type: UnansweredQuestion
has body: I've created a wire block, custom rendered in Techne. What I want for happen is for parts of the wire to show/hide depending on whether or not another wire is connected. This is working in theory and worked when I manually inputted connectivity states. Now I'm actually trying to get the data the game crashes on loading the world due to an uninitialized boolean array containing the connectivity states. If anyone could help me with getting the data from the block class to the rendering class that would be great. Block class package foodTech.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import foodTech.tileEntities.TileEntityCable; public class BlockCable extends BlockContainer { /** * Contains 6 values for each face of a cable block * up, down, north, south, east, west */ public static boolean[] neighbourBlockWires; public BlockCable(Material material) { super(material); float pixel = 1F/16F; this.setBlockBounds(12*pixel/2, 12*pixel/2, 12*pixel/2, 1-12*pixel/2, 1-12*pixel/2, 1-12*pixel/2); this.useNeighborBrightness = true; } public int getRenderType() { return -1; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public TileEntity createNewTileEntity(World world, int var2) { return new TileEntityCable(); } private void getConnectedWires(int x, int y, int z, World world) { boolean[] neighbourBlockWires = {false, false, false, false, false, false}; if (world.getBlock(x, y+1, z).equals(this)) neighbourBlockWires[0] = true; if (world.getBlock(x, y-1, z).equals(this)) neighbourBlockWires[1] = true; if (world.getBlock(x+1, y, z).equals(this)) neighbourBlockWires[2] = true; if (world.getBlock(x-1, y, z).equals(this)) neighbourBlockWires[3] = true; if (world.getBlock(x, y, z+1).equals(this)) neighbourBlockWires[4] = true; if (world.getB…
has answer: http://stackoverflow.com/a/24768183
tagged with: java
type: Question

http://stackoverflow.com/a/36985139
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24799647
has body: How to use a css code to setContent method(); for example: String css=" body {background-repeat: no-repeat;}"; MimeBodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setContent(css, "text/html"); //this css code is not affect the message body.
has comment: http://stackoverflow.com/comment/61525413

http://stackoverflow.com/comment/38625728
has text: Do you have any modules supplied with this?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24868910

http://stackoverflow.com/comment/38614329
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24864051
score: 0
has text: So i guess that list is empty when you starting new thread.

http://stackoverflow.com/comment/38622702
comment on: http://stackoverflow.com/a/24868397
type: Comment
score: 1
has text: Here the [example](http://www.programming-free.com/2012/09/ajax-with-servlets-using-jquery-and-json.html) and [this](http://www.mysamplecode.com/2011/12/jquery-autocomplete-ajax-json-example.html).
type: AnswerComment

http://stackoverflow.com/comment/38622812
has text: When you say all unwanted versions, are you referring to the dependency in question (Jackson), or the transitive dependencies?
comment on: http://stackoverflow.com/a/24827704
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38614186
score: 0
comment on: http://stackoverflow.com/q/24864291
has text: Your question is neither clear nor make sense. What you are going to achieve with second option?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24889575
has comment: http://stackoverflow.com/comment/38667239
type: Question
has comment: http://stackoverflow.com/comment/38668666
tagged with: broadcastreceiver
has comment: http://stackoverflow.com/comment/38667702
has comment: http://stackoverflow.com/comment/38668364
has answer: http://stackoverflow.com/a/24889683
accepted answer: http://stackoverflow.com/a/24889683
score: 0
has comment: http://stackoverflow.com/comment/38669005
has comment: http://stackoverflow.com/comment/38667853
answer count: 1
tagged with: baseadapter
has comment: http://stackoverflow.com/comment/38667669
tagged with: android
has body: I want to update a textview into a listView when i get my current position (GPS). So i send a broadcast in my activity when i had my position. In my listViewAdapter, i have a receiver who set text. But i don't know where i can registrer and unregistrer my broadcast. May be there is an other solution to send parameter to my listViewAdapter when my current position is available. MainActivity : private ArrayList<Establishment> listEstablishment; private ListViewEstablishmentsAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_layout); pr = new PositionReceiver(); //Get the list view ListView l = (ListView) findViewById(R.id.listviewEstablishments); //Create WebService to retrieve establishments datas EstablishmentInfosWebService ews = new EstablishmentInfosWebService("select * from establishment"); listEstablishment = ews.getData(); //Create a new adapter View adapter = new ListViewEstablishmentsAdapter(this, listEstablishment); l.setAdapter(adapter); public class PositionReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Location l = (Location) intent.getExtras().get("LOCATION"); int i = 0; for(Establishment e : listEstablishment) { double d = distance(e.getLatitude(), e.getLongitude(), l.getLatitude(), l.getLongitude(), 'K'); e.setDistance(d+""); Log.d(TAG,"onreceive "+i); i++; } } } @Override public void onResume() { super.onResume(); registerReceiver(pr, new IntentFilter("com.example.smartoo.POSITION_INTENT")); } /* * Called when the Activity is going into the background. * Parts of the UI may be visible, but the Activity is inactive. */ @Override public void onPause() { unregisterReceiver(pr); super.onPause(); } ListViewAdapter : public class ListViewEstablishmentsAdapter extends BaseAdapter { private static final String TAG = "com.example.smartoo.ListViewEstablishmentAdapter"; //Un mécanisme pour gérer l'affichage graphi…
has title: Broadcast receiver in BaseAdaper
has comment: http://stackoverflow.com/comment/38667934
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38668568
tagged with: java
has comment: http://stackoverflow.com/comment/38668468

http://stackoverflow.com/comment/38694239
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24906500
has text: You should give this a try. What you call "quoted" is just a signal to your shell, that this set of characters should be treated as one argument.
type: AnswerComment

bitmap
tags question: http://stackoverflow.com/q/24842550
tags question: http://stackoverflow.com/q/24758927
tags question: http://stackoverflow.com/q/24897418
type: Tag
tags question: http://stackoverflow.com/q/24785842
tags question: http://stackoverflow.com/q/24762263
tags question: http://stackoverflow.com/q/24894830
tag name: bitmap
tags question: http://stackoverflow.com/q/24781559
tags question: http://stackoverflow.com/q/24791101
tags question: http://stackoverflow.com/q/24758249
tags question: http://stackoverflow.com/q/24849380
tags question: http://stackoverflow.com/q/24826559
tags question: http://stackoverflow.com/q/24828833

http://stackoverflow.com/comment/38671427
has text: but I don't want to remove my thanks. You comments are valid and there is no need to remove it because as I mentioned in my last comment that I have edited it.
comment on: http://stackoverflow.com/a/24894266
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38657404
comment on: http://stackoverflow.com/q/24885134
score: 0
type: QuestionComment
type: Comment
has text: I agree, the name of the class will not determine the access level of a method. This is why I'm asking this question. Please see my comments below. The error is: The method getPasswordAuthentication() from the type Authenticator is not visible

http://stackoverflow.com/q/24904006
has body: I want the string to have different width so that I set the stroke of Graphics2D and the code is here: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JFrame; import javax.swing.JPanel; public class StrokeTest { public static void main(String[] args) { StrokeTest test = new StrokeTest(); test.createUI(); } public void createUI(){ JFrame frame = new JFrame(); frame.add(new MainPanel()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } @SuppressWarnings("serial") class MainPanel extends JPanel{ public MainPanel(){ setPreferredSize(new Dimension(400, 300)); } protected void paintComponent(Graphics g){ Graphics2D g2d = (Graphics2D)g; g2d.setColor(Color.red); g2d.setStroke(new BasicStroke(10)); g2d.drawString("I am a string", 100, 100); } } } However, it doesn't work when I use g2d.setStroke(new BasicStroke(10)); Thanks in advance for your help.
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38689932
tagged with: awt
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24904246
has comment: http://stackoverflow.com/comment/38689635
linked to: http://stackoverflow.com/q/10016001
has title: Why doesn't Graphics2D.setStoke() work for Graphics2D.drawString?
tagged with: fonts
upvote count: 1
tagged with: swing
answer count: 1
tagged with: stroke
accepted answer: http://stackoverflow.com/a/24904246
tagged with: java
has comment: http://stackoverflow.com/comment/38689576

http://stackoverflow.com/comment/51863713
type: AnswerComment
has text: @peeskillet how can the prepare renderer method be modified to change the column instead of the row's background colour?
type: Comment
comment on: http://stackoverflow.com/a/24849600
score: 0

jasper-reports
tags question: http://stackoverflow.com/q/24755336
tags question: http://stackoverflow.com/q/24859341
tags question: http://stackoverflow.com/q/24908988
tags question: http://stackoverflow.com/q/24861936
tags question: http://stackoverflow.com/q/24822257
tags question: http://stackoverflow.com/q/24823743
tags question: http://stackoverflow.com/q/24791298
tags question: http://stackoverflow.com/q/24852341
tags question: http://stackoverflow.com/q/24908755
tag name: jasper-reports
tags question: http://stackoverflow.com/q/24860917
tags question: http://stackoverflow.com/q/24796460
type: Tag
tags question: http://stackoverflow.com/q/24858274
tags question: http://stackoverflow.com/q/24810517
tags question: http://stackoverflow.com/q/24806288
tags question: http://stackoverflow.com/q/24759299

http://stackoverflow.com/comment/119931867
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27262962
has text: Thanks. Turned out to be my problem as well. Eclipse was using the embedded version 3.6.3. Switched it to 3.0.5 and it worked. Terrible error message. Wasted hours digging through authorization issues.
type: AnswerComment

http://stackoverflow.com/comment/38522598
type: AnswerComment
has text: yea..what u read is absolutely correct...but it has that one undefined method doesn;t it !! how about god creating a human with only half a heart !!
comment on: http://stackoverflow.com/a/24807237
score: 0
type: Comment

http://stackoverflow.com/q/24814415
tagged with: mysql
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24834558
type: Question
has comment: http://stackoverflow.com/comment/38557430
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38520387
tagged with: sql
has answer: http://stackoverflow.com/a/24815234
has comment: http://stackoverflow.com/comment/38557220
has title: Hibernate save SQL exception
has body: Hi guys I am trying to save an object to a MySQL data base via Hibernate. if I execute following code User user = new User(); user.setData_1("my data 5"); user.setFirstname("Freddy"); user.setLastname("Bob"); user.setId(5); session.save(user); session.getTransaction().commit(); I get a 'com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'xxx.my_table_1' doesn't exist' exception. However, querying from the same table using the same config works just fine. What could be the issue?
type: UnansweredQuestion

http://stackoverflow.com/comment/38739790
type: Comment
comment on: http://stackoverflow.com/a/24828356
has text: i have not a struts.xml.... maybe i found the problem, it was my mistake. i mapped actions path in web.xml as `it.aicof.projects.openMED.aps.internalservlet.actions` but the action not working was in path `it.aicof.projects.openMED.aps.internalservlet` so it was not recognized as action by struts. I'll try to move it in the right path
type: AnswerComment
score: 0

http://stackoverflow.com/q/24864800
has body: In my Application, I have a requirement where user inputs a time string in this format: HH:MM:SS, which I need to format, parse and then show the difference (in seconds) between these entered string. static long MyTimeStamp(String str) is a static method which returns a long value. String TimeString1="10:30:15"; String TimeString2="10:30:45"; long t1 = MyTimeStamp(TimeString1); long t2 = MyTimeStamp(TimeString2); long t3 = t1 - t2; System.out.println(t3); O/P Should be 30 sec.
answer count: 3
has title: String to TimeStamp in Java
has answer: http://stackoverflow.com/a/24865028
score: -7
favorite count: 0
has answer: http://stackoverflow.com/a/24864977
downvote count: 8
type: UnansweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/38615206
has comment: http://stackoverflow.com/comment/38615480
has answer: http://stackoverflow.com/a/24864896
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38615283
tagged with: date-formatting

http://stackoverflow.com/q/24771626
has comment: http://stackoverflow.com/comment/38439508
tagged with: swing
has answer: http://stackoverflow.com/a/24772238
accepted answer: http://stackoverflow.com/a/24772238
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38439373
has comment: http://stackoverflow.com/comment/38439351
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38439754
has body: I have here a code and I am quite confused on how to make this thing work. the purpose of the program is to show the current inventory list that we have. I want it to be automatically added to my table. how can I do that? my erroneous line is String[] itemize = { s1,s2,s3,s4,s5,s6,s7,s8,s9,s0 }; //invTable.addRow(itemize); I also included my code just in case someone needs to test it. thanks! invTable.setAutoCreateRowSorter(true); invTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] {{null, null, null, null, null, null, null, null, null, null}}, new String [] { "Item", "Code", "Weight", "Doctor", "Supplier", "Department", "Cost", "Price", "Quantity", "Threshold" } )); I think the problem lies in the code above. I finally made it work thanks to the help of people in this site. i just removed the code above. private void insertRows() throws SQLException, Exception{ modelx = new DefaultTableModel(); modelx.addColumn("Name"); modelx.addColumn("ID"); modelx.addColumn("Weight"); modelx.addColumn("Doctor"); modelx.addColumn("Supplier"); modelx.addColumn("Department"); modelx.addColumn("Cost"); modelx.addColumn("Price"); modelx.addColumn("Quantity"); modelx.addColumn("Threshold"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\\floresClinic.accdb;"; conn = DriverManager.getConnection(database, "", ""); s = conn.createStatement(); rs = s.executeQuery("SELECT * FROM medItem "); int cou = 0; while(rs.next()) { s1 = rs.getString("productName"); s2 = rs.getString("productID"); s3 = rs.getString("productWeight"); s4 = rs.getString("doctor"); s5 = rs.getString("sName"); s6 = rs.getString("department"); s7 = rs.getString("unitCost"); s8 = rs.getString("unitPrice"); s9 = rs.getString("quantity"); s0 = rs.getString("threshold"); if(!s2.equals("Select?")){ modelx.insertRow(0, new Object [] {s1, s2, s3, s4, s5, s6, s7, s8, s9, s0}); //String[] itemize ={s1,s2,s3,s4,s5,s5,s7,s8,s9,s0}; /…
tagged with: jtable
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38439430
possible better answer: http://stackoverflow.com/a/24771738
has answer: http://stackoverflow.com/a/24771738
has title: adding blank rows to a blank java table?

http://stackoverflow.com/comment/38424255
score: 0
type: AnswerComment
has text: So the losing transaction just becomes blocked on "update" method and waits until the winning commits, correct ?
comment on: http://stackoverflow.com/a/24763757
type: Comment

http://stackoverflow.com/comment/38415378
type: Comment
comment on: http://stackoverflow.com/a/24757740
score: 0
type: AnswerComment
has text: Thanks for your answer. What should I put in readResolve/writeReplace methods? Just simple cast?

http://stackoverflow.com/q/24814420
favorite count: 0
has answer: http://stackoverflow.com/a/24814565
has title: Gson - Non static variable cannot be referenced from a static context
duplicate of: http://stackoverflow.com/q/2559527
has comment: http://stackoverflow.com/comment/38520619
has comment: http://stackoverflow.com/comment/38520269
upvote count: 1
has body: Following this question on SO I've run into a problem. This is the JSON I'm trying to parse: { "origin": "XX.XX.XXX.XXX" } Here are the important parts of my three main classes: DDNS.java public static void main(String[] args) throws Exception { Net.returnIp(); System.out.println(Data.origin); } Net.java static void returnIp() throws UnsupportedEncodingException, MalformedURLException, IOException { //Ommited code, all it does is do a GET request to get response String responseString = new Scanner(response,"UTF-8").useDelimiter("\\A").next(); Data data = new Gson().fromJson(responseString, Data.class); } Data.java public class Data { public String origin; @Override public String toString() { return String.format("ip:%s", origin); } } Unless I overlooked something in the answer, I'm not completely sure what I'm doing wrong, although I have a rough idea. Could someone please explain why this is happening? Thanks.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38520319
has comment: http://stackoverflow.com/comment/38520620
score: 1
tagged with: java
tagged with: gson
linked to: http://stackoverflow.com/q/1688099
accepted answer: http://stackoverflow.com/a/24814565
type: Question
has comment: http://stackoverflow.com/comment/38520391
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38520365
linked to: http://stackoverflow.com/q/2559527

http://stackoverflow.com/q/24900849
score: 0
tagged with: java
tagged with: hibernate
has body: I am using JPA through Hibernate in Spring. I need to process a lot of data in a @Transactional method. The process may take quite some time, so I want to query and display the progress on my front-end. "50 of 1000 items have been processed", etc. But how can I commit the process status into DB during data is being processed within a @Transactional annotated method? It may work by making a remote call, any other better ways? Thanks in advance.
type: Question
tagged with: jpa
accepted answer: http://stackoverflow.com/a/24901657
answer count: 3
linked to: http://stackoverflow.com/q/11461554
has answer: http://stackoverflow.com/a/24901271
tagged with: spring
possible better answer: http://stackoverflow.com/a/24900869
has answer: http://stackoverflow.com/a/24901657
has title: How to commit status to DB within @Transactional annotated method?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24900869
tagged with: transactions

http://stackoverflow.com/comment/38698553
has text: Exactly what problem are you trying to solve by 'simplifying' this code?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24908736
type: Comment

http://stackoverflow.com/q/24769318
linked to: http://stackoverflow.com/q/17346679
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 1
type: Question
tagged with: jpa
has title: How do I initialize database tables (insert rows into) using JPA and Hibernate?
has body: I have a Spring/JPA/Hibernate application that maintains state data in a mysql table. The application is dependent on that state data being initialized properly. That is, when the application initializes, I want to ensure that a known table includes two rows-- one each with two known primary key values. The table is "JPA managed" (sorry if that term is not correct)-- I have an @Entity class that maps each row in the table to an instance of that class and a corresponding DAO class that manipulates (persists, retrieves) instances of that @Entity. My (unsuccessful) attempt to solve this problem used an initialize() method on the DAO annotated with @PostConstruct (as well as @Transactional(read-only = false)). That method instantiates two instances of the @Entity and has calls the EntityManager to persist them (I use persist instead of merge to avoid overwriting existing state and catch the EntityExistsException that's expected if the row(s) already exist). I've confirmed that the initialize() method is being invoked and is calling the persist(...) method on the EntityManager but the database rows are not being inserted-- I've examined the mysql statement log and the expected INSERT statements are not present. I can't be the first person who wants to initialize data in a JPA-managed table, right? Is there a "best-practice" for doing this sort of initialization? Thanks! PS: Although the table is "JPA-managed" it is not created by Hibernate. The table is assumed (by the application) to already exist.
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24769643
type: UnansweredQuestion

http://stackoverflow.com/q/24899683
tagged with: linux
tagged with: exception
type: UnansweredQuestion
tagged with: multithreading
has title: killing multi-threaded operations with database read and writes
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38681684
has body: I have a multi threaded java process running with the 2 db transactions as follows: . . dbop1(); . . . dbop2(); . . when I kill the process(using kill on linux), database might loss integrity because the program might terminate in between dbop1() and dbop2(). if there a way to catch the kill signal and then terminate gracefully? for example, if the kill is in between, I would like to still finish dbop2() and then terminate. I'm hesitant to make the 2 db transactions in a single transaction because of performance concerns. and I'm assuming that if the kill happens during a db transaction the data would not be corrupt, is this true? further more dbop1() and dbop2() are hibernate wrappers like the following: try{ beginTransaction(); getSession().save(obj); //sessionFactory.openSession().save(obj); commitTransaction(); } catch(Exception e){ e.printStackTrace(); rollbackTransaction(); throw e; }finally{ closeSession(); }
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24899757

http://stackoverflow.com/comment/60398965
comment on: http://stackoverflow.com/a/28638882
type: AnswerComment
has text: I don't know any way to do it.
score: 0
type: Comment

http://stackoverflow.com/comment/38654751
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24885718
type: Comment
has text: I am not surprised, I feel the same :)

http://stackoverflow.com/q/24814637
type: Question
has answer: http://stackoverflow.com/a/27502836
has answer: http://stackoverflow.com/a/24814725
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38522662
linked to: http://stackoverflow.com/q/1815390
has body: When I run code inside NetBeans it is very slow. However, when I convert the code to a standalone application it runs 5 times faster. That is awkward because it won't let me test it as it will truly run on a mac. I'm using netbeans 8. The application involves heavy memory usage. I think maybe, just maybe, netbeans is limiting the size of the heap. Anyway passed the -Xmx2048m flag to the program. clue: when I build the software to an .app file, then go inside that app package and edit the .plist file, I manually add the line2: VMOptions -Xmx1024m and that's the only way to make it run fast as I would like. And that is only as standalone, outside netbeans.
tagged with: netbeans
type: UnansweredQuestion
tagged with: performance
tagged with: java
has title: java app run much faster outside netbeans
has answer: http://stackoverflow.com/a/24874857

swagger
tags question: http://stackoverflow.com/q/24866028
tags question: http://stackoverflow.com/q/24835007
tag name: swagger
type: Tag

http://stackoverflow.com/q/24867835
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: Im using DefaultConsumer instead of QueueingConsumer becouse in this consumer i will connect to database and run procedures and after that i will send back ACK. My question is very silly and i think easy...how to receive messages though class which extends DefaultConsumer? When you use QueueingConsumer, you receive messages via QueueingConsumer.Delivery delivery = consumer.nextDelivery();
has answer: http://stackoverflow.com/a/24868042
answer count: 1
downvote count: 0
favorite count: 0
has title: RabbitMq: How to receive message through DefaultConsumer?
tagged with: rabbitmq
accepted answer: http://stackoverflow.com/a/24868042
upvote count: 1

memoization
type: Tag
tags question: http://stackoverflow.com/q/24867140
tag name: memoization

http://stackoverflow.com/a/24853795
upvote count: 5
has body: In case anyone else runs into this issue: The problem stemmed from utilizing a file from part of the support library itself. All I needed to modify in that file was the following: import android.support.v7.appcompat.R; to import my.package.R;
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24842927
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42833448
accepted answer of: http://stackoverflow.com/q/24842927

http://stackoverflow.com/a/24859202
type: Answer
accepted answer of: http://stackoverflow.com/q/24850165
answers question: http://stackoverflow.com/q/24850165
has body: @HotLicks good point ... there is two zombies because of using this statement to add one zombie for(int i = 0; i &lt; zombieNumber+1; i++){ zombieHolder.add(new Zombie()); } where the value of zombieNumber is 1 and according to implementation of Zombie class they are with same parameters (why you instantiate them like this?) and move as one so they hit you twice ... try to increase the zombieNumber to see if this problem is really here.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38620199
score: 0

http://stackoverflow.com/comment/38611562
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24862713
has text: yes your `dataAdapter` is not `null` its `spinner` that is `null`.
score: 0

http://stackoverflow.com/comment/38620702
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24826062
has text: Have you tried running it with `run-app`? Does that yield the same results?

io
tags question: http://stackoverflow.com/q/24824161
tags question: http://stackoverflow.com/q/24771178
tag name: io
tags question: http://stackoverflow.com/q/24827272
tags question: http://stackoverflow.com/q/24791360
tags question: http://stackoverflow.com/q/24858204
tags question: http://stackoverflow.com/q/24855307
tags question: http://stackoverflow.com/q/24825958
tags question: http://stackoverflow.com/q/24810517
tags question: http://stackoverflow.com/q/24873516
type: Tag
tags question: http://stackoverflow.com/q/24768902
tags question: http://stackoverflow.com/q/24817450
tags question: http://stackoverflow.com/q/24811004
tags question: http://stackoverflow.com/q/24797331
tags question: http://stackoverflow.com/q/24860120
tags question: http://stackoverflow.com/q/24764158
tags question: http://stackoverflow.com/q/24820624

http://stackoverflow.com/q/24782489
has answer: http://stackoverflow.com/a/24924749
tagged with: java
score: 4
upvote count: 4
tagged with: android-fileprovider
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-sharing
tagged with: android
has body: I have read all the answer about this argument but I receive always an error of the application that receive my photo. The only way that worked for me, for all application, was this (It works because sd card files are public to all applications): final File tmpFile = new File(context.getExternalCacheDir(), "exported.jpg"); Uri tmpFileUri = Uri.fromFile(tmpFile); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setDataAndType(tmpFileUri, "image/jpeg"); shareIntent.putExtra(Intent.EXTRA_STREAM, tmpFileUri); context.startActivity(Intent.createChooser(shareIntent, context.getString(R.string.share_image))); Now, I'm stuck on how to share a file that is located in a private folder. I used the code provided by the google documentation: &lt;provider android:name="android.support.v4.content.FileProvider" android:authorities="com.test.myapp.fileprovider" android:exported="false" android:grantUriPermissions="true" &gt; &lt;meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /&gt; &lt;/provider&gt; ... ... &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;files-path name="internal_files" path="/"/&gt; &lt;cache-path name="internal_cache" path="/" /&gt; &lt;/paths&gt; This is the code to share files using the FileProvider but doesn't work with any application except whats up: final File tmpFile = new File(context.getCacheDir(), "exported.jpg"); Uri tmpFileUri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", tmpFile); //Remove the uri permission because we overwrite the file context.revokeUriPermission(tmpFileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); saveBitmapToPath(bitmap, tmpFile); bitmap.recycle(); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setDataAndType(tmpFileUri, "image/jpeg"); shareIntent.putExtra(Intent.EXTRA_STREAM, tmpFileUri); //Grant a…
has title: Android photo sharing with FileProvider
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24924749
type: Question

http://stackoverflow.com/q/24847613
tagged with: factorization
has body: this is part of a calculator program that I'm currently making, this part determines if b is a factor of a. Also I am new to Java this makes my third day learning it's syntax. Anyway, I was wondering which way is more efficient to determine if b is a factor of a. Is it to us the modulus operator (%) or my second method ??? also if there's a more efficient way than the two methods I came up with please show. // for now I want the result to print out in the console public class factornot { public static void main(String args[]) { int a = 56, b = 3; // just for testing purposes! if((a != 0) &amp;&amp; (a % b) == 0) System.out.println(b + " is a factor of " + a); else System.out.println(b + " is not a factor of " + a); // short-circuit and prevents a divide by zero error! // is this better or worse, faster or slower ??? int d = (a / b), e = (d * b); if((a - e) == 0) System.out.println(b + " is a factor of " + a); else System.out.println(b + " is not a factor of " + a); } }
has comment: http://stackoverflow.com/comment/38582387
has answer: http://stackoverflow.com/a/24847733
tagged with: java
has comment: http://stackoverflow.com/comment/38582617
type: Question
has title: Efficient way to determine if b is a factor of a?
possible better answer: http://stackoverflow.com/a/24847718
has comment: http://stackoverflow.com/comment/38582710
has comment: http://stackoverflow.com/comment/38582542
score: 0
has comment: http://stackoverflow.com/comment/38582495
answer count: 2
accepted answer: http://stackoverflow.com/a/24847733
has comment: http://stackoverflow.com/comment/38582363
has answer: http://stackoverflow.com/a/24847718
type: AnsweredQuestion

http://stackoverflow.com/comment/38410807
has text: The public key exponent for RSA is not fixed at 65537, this is simply the most common value for it. Because the private key exponent is dependent on the public key exponent, this solution will not work for all situations.
type: AnswerComment
score: 4
comment on: http://stackoverflow.com/a/24756421
type: Comment

http://stackoverflow.com/comment/56274828
score: 0
comment on: http://stackoverflow.com/a/24897932
has text: I suspect this only worked through a plain Proxy Server, NOT an authenticated one. 'https.proxyUser' and 'https.proxyPassword' are not JVM args AFAIK...
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24863448
answers question: http://stackoverflow.com/q/24863281
type: Answer
accepted answer of: http://stackoverflow.com/q/24863281
has body: HashSet's iterator is actually of type: HashMap$KeyIterator which extends HashMap$HashIterator which implements Iterator As you can see, the guava AbstractIterator is clearly not in that inheritance chain. Thus you can't cast to it.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38587228
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24850082
type: Comment
has text: @DonBranson I remove import statements here to be short.

http://stackoverflow.com/q/24895843
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/38676387
has comment: http://stackoverflow.com/comment/38720793
has comment: http://stackoverflow.com/comment/38674515
score: 0
has comment: http://stackoverflow.com/comment/38675777
tagged with: abstract
has comment: http://stackoverflow.com/comment/38701548
answer count: 1
has body: It is a well established fact that abstract classes may or may not have abstract methods in it. But, once i was going through a website. Link: http://www.indiabix.com/technical/dotnet/object-oriented-programming/6 I could find out the following- Just have a look at the highlighted part. My question is, whether the highlighted part is false, as i am thinking. Or, it has some other meaning that is true and i have mistaken ?
has answer: http://stackoverflow.com/a/24910403
accepted answer: http://stackoverflow.com/a/24910403
has title: Abstract class having no abstract methods
has comment: http://stackoverflow.com/comment/38675737
tagged with: vb.net
type: AnsweredQuestion
tagged with: oop
tagged with: java

http://stackoverflow.com/comment/38468289
type: AnswerComment
has text: You can manually print out your own XML declaration, then print a newline directly, then the document that's generated with `OMIT_XML_DECLARATION`. :-)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24786875

http://stackoverflow.com/comment/110517982
has text: @MLProgrammer-CiM The only problem of the original post is the click listener will not know for which list item the callback is for. What it will receive is the UI component that was clicked, but it's not helpful for finding the item. Actually in the onBindViewHolder() you can save the position in the holder object and let the holder be the first click listener of the contained UI components, and then let it propagate the click event to wherever needed, and when passing on the click event, the position can be carried on.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24933117
type: Comment

http://stackoverflow.com/comment/38450437
type: Comment
comment on: http://stackoverflow.com/q/24777689
score: 0
has text: Why don't you just to two selects and apply the condition yourself?
type: QuestionComment

http://stackoverflow.com/a/24849057
score: 1
upvote count: 1
downvote count: 0
has body: As @Serge pointed out, caching works greatly with read-only data. I never experienced a project requirement with 10k concurrent writes. If your requirement is to store session data in a way to recover from a node done, you can have a look at Apache Zookeeper. But since your question was more about database access reduction your best hint is to have a look at ehcache. It can be used as redundant storage node as well. Since you are usibg Spring have a look at the onboard @cachable features. Maybe yor solution is to cache the whole request. Another option is to use Maria db in master/slave(s) mode.
type: Answer
answers question: http://stackoverflow.com/q/24848463

jpa
tags question: http://stackoverflow.com/q/24877814
tags question: http://stackoverflow.com/q/24853094
tags question: http://stackoverflow.com/q/24799727
tags question: http://stackoverflow.com/q/24857003
tags question: http://stackoverflow.com/q/24903434
tags question: http://stackoverflow.com/q/24844680
tags question: http://stackoverflow.com/q/24827052
tags question: http://stackoverflow.com/q/24865294
tags question: http://stackoverflow.com/q/24782872
tags question: http://stackoverflow.com/q/24847023
tags question: http://stackoverflow.com/q/24797688
tags question: http://stackoverflow.com/q/24853374
tags question: http://stackoverflow.com/q/24758888
tags question: http://stackoverflow.com/q/24824052
tags question: http://stackoverflow.com/q/24804586
tags question: http://stackoverflow.com/q/24840600
tags question: http://stackoverflow.com/q/24821013
tags question: http://stackoverflow.com/q/24759664
tags question: http://stackoverflow.com/q/24862058
tags question: http://stackoverflow.com/q/24812730
tags question: http://stackoverflow.com/q/24815492
tags question: http://stackoverflow.com/q/24761770
type: Tag
tags question: http://stackoverflow.com/q/24871676
tags question: http://stackoverflow.com/q/24830932
tags question: http://stackoverflow.com/q/24900849
tags question: http://stackoverflow.com/q/24870004
tags question: http://stackoverflow.com/q/24784788
tags question: http://stackoverflow.com/q/24769318
tags question: http://stackoverflow.com/q/24861892
tags question: http://stackoverflow.com/q/24897183
tags question: http://stackoverflow.com/q/24881121
tags question: http://stackoverflow.com/q/24797675
tags question: http://stackoverflow.com/q/24795020
tags question: http://stackoverflow.com/q/24778346
tags question: http://stackoverflow.com/q/24809429
tags question: http://stackoverflow.com/q/24906251
tags question: http://stackoverflow.com/q/24755600
tags question: http://stackoverflow.com/q/24848686
tags question: http://stackoverflow.com/q/24786391
tags question: http://stackoverflow.com/q/24782810
tags question: http://stackoverflow.com/q/24875442
tags question: http://stackoverflow.com/q/24806909
tags question: http://stackoverflow.com/q/24852252
tags question: http://stackoverflow.com/q/24757857
tags question: http://stackoverflow.com/q/24752555
tags question: http://stackoverflow.com/q/24810826
tag name: jpa
tags question: http://stackoverflow.com/q/24806926
tags question: http://stackoverflow.com/q/24872852
tags question: http://stackoverflow.com/q/24751695
tags question: http://stackoverflow.com/q/24755303
tags question: http://stackoverflow.com/q/24768597
tags question: http://stackoverflow.com/q/24896892
tags question: http://stackoverflow.com/q/24894701
tags question: http://stackoverflow.com/q/24818764
tags question: http://stackoverflow.com/q/24822396
tags question: http://stackoverflow.com/q/24901118
tags question: http://stackoverflow.com/q/24758459
tags question: http://stackoverflow.com/q/24857078
tags question: http://stackoverflow.com/q/24885697
tags question: http://stackoverflow.com/q/24806390
tags question: http://stackoverflow.com/q/24820969
tags question: http://stackoverflow.com/q/24878579
tags question: http://stackoverflow.com/q/24776294
tags question: http://stackoverflow.com/q/24860436
tags question: http://stackoverflow.com/q/24892012
tags question: http://stackoverflow.com/q/24800944

http://stackoverflow.com/comment/38567457
comment on: http://stackoverflow.com/a/24839776
type: Comment
has text: @LưuVĩnhPhúc: I am Dutch, and I am sure many of my countrymen may know the concept of a remainder or modulus, but do perhaps not know the English terms "remainder" or "modulus". In Dutch, it is generally called "rest", and in some other languages too.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38615283
has text: And `long t3 = t1 - t2` will produce a compiler error. Additionally: What is your question?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24864800
score: 3

http://stackoverflow.com/a/24826076
downvote count: 0
has body: I finally resolve the problem. Like mromer said, the solution was to use both OkClient and OkHttp. After adding these two libraries I set the client on Retrofit to OkHttp like that: RestAdapter restAdapter = new RestAdapter.Builder() .setErrorHandler(new ErrorRetrofitHandlerException()) .setEndpoint(urlBase) .setLogLevel(RestAdapter.LogLevel.FULL) .setClient(new OkClient(new OkHttpClient())) .build();
has comment: http://stackoverflow.com/comment/43272319
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24806797
type: Answer
answers question: http://stackoverflow.com/q/24806797
has comment: http://stackoverflow.com/comment/64480722
score: 3

http://stackoverflow.com/q/24818242
answer count: 1
tagged with: netsuite
favorite count: 0
has answer: http://stackoverflow.com/a/24881694
has body: i'm doing java app integration with ns.sometimes i'm getting Unknown host exception.i want to handle this exception how to do this one....while i'm getting this exception ,restarting my server again.below is the stack trace... 09:46:10,927 ERROR [STDERR] AxisFault 09:46:10,928 ERROR [STDERR] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException 09:46:10,928 ERROR [STDERR] faultSubcode: 09:46:10,928 ERROR [STDERR] faultString: java.net.UnknownHostException: webservices.netsuite.com 09:46:10,932 ERROR [STDERR] faultActor: 09:46:10,932 ERROR [STDERR] faultNode: 09:46:10,933 ERROR [STDERR] faultDetail: 09:46:10,933 ERROR [STDERR] {http://xml.apache.org/axis/}stackTrace:java.net.UnknownHostException: webservices.netsuite.com
type: UnansweredQuestion
score: 0
upvote count: 1
has title: how to handle unknownhost exception in netsuite
downvote count: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/38494311
type: AnswerComment
has text: Which version of Windows do you have?
score: 0
comment on: http://stackoverflow.com/a/24800841
type: Comment

http://stackoverflow.com/comment/38581517
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24846909
score: 0
has text: do you have a libmaliinstr.so in your libs folder?Can you tell me which methods are using that library ?

http://stackoverflow.com/q/24761631
has answer: http://stackoverflow.com/a/24778864
type: UnansweredQuestion
tagged with: multithreading
tagged with: jmx
linked to: http://stackoverflow.com/q/5258603
type: Question
linked to: http://stackoverflow.com/q/180158
tagged with: java
tagged with: mbeans
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24762354
has body: I would like to know how is it possible to measure the time of function execution in Java. Being more precise, I have a Class with a method getData(). This function is used to get the data from the external serivice and is used in multiuser application. I would like to monitor of time execution of this function by the MBeanServer. How to deal with it ? As far as I know, I have to create MBean and register it on the MBeanServer.
has title: Registering time of execution of the function in the mbeanserver

http://stackoverflow.com/comment/38734974
comment on: http://stackoverflow.com/a/24904859
type: AnswerComment
score: 0
type: Comment
has text: Thank you for the Information about the plug-in spy! That helps a lot. Never the less, i don't find a list of commands (for example create getter/setter action) to execute without the use of its own gui..

http://stackoverflow.com/q/24902031
has comment: http://stackoverflow.com/comment/38686069
type: Question
has comment: http://stackoverflow.com/comment/38686130
has comment: http://stackoverflow.com/comment/38686191
has comment: http://stackoverflow.com/comment/38689698
has comment: http://stackoverflow.com/comment/38689449
has answer: http://stackoverflow.com/a/31795093
score: 0
has comment: http://stackoverflow.com/comment/38687753
answer count: 1
has body: I am new to android development. Here is my XML code for one of an activity. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.example.*****.*****.DisplayMessageActivity"&gt; &lt;TextView android:id="@+id/view_text" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/RelativeLayout&gt; As seen above, I want the TextView to have id view_text. But as soon as I write android:id="@+id/view_text", it gives an error saying 'class' or 'interface' expected. There are no errors in any of the other files. As soon as I remove android:id="@+id/view_text", everything works perfectly fine. Also I am using the latest version of android studio. Just this problem. DisplayMessageActivity: public class DisplayMessageActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE); TextView textView = (TextView)findViewById(R.id.view_text); textView.setText(message); setContentView(R.layout.activity_display_message); } @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); } Please help. Thanks
tagged with: textview
tagged with: http://stackoverflow.com/tag/xml
has title: android xml error: 'class' or 'interface' required
favorite count: 0
has comment: http://stackoverflow.com/comment/38686146
upvote count: 2
accepted answer: http://stackoverflow.com/a/31795093
tagged with: android
downvote count: 2
has comment: http://stackoverflow.com/comment/38686159
has comment: http://stackoverflow.com/comment/38687781
tagged with: android-studio
has comment: http://stackoverflow.com/comment/38689497
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38686060
has comment: http://stackoverflow.com/comment/38686814
tagged with: java
has comment: http://stackoverflow.com/comment/38687094

http://stackoverflow.com/comment/38411402
score: 0
type: Comment
has text: If you go to /, you should see a list of the registered contexts. If this is empty, include that information in the question - if it's there (and maybe under another name than Solr, click it). Are you running `java -jar start.jar` from the examples directory directly?
type: QuestionComment
comment on: http://stackoverflow.com/q/24750300

http://stackoverflow.com/comment/38642935
has text: Who down vote your answer I dont know, but want to say please add comment for what reason you are down voting.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24859219
type: Comment

http://stackoverflow.com/a/24895518
score: 2
downvote count: 0
has body: scale proportionally upon resizing rather than just the center resizing up and down. I suggest you to use GridBagLayout where you can set the width and height of the components in percentage defining different constraints of GridBagConstraints See Swing Tutorial on How to Use GridBagLayout
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24895467
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24895467
type: Answer

http://stackoverflow.com/q/24824253
has comment: http://stackoverflow.com/comment/38538284
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38538468
tagged with: junit
favorite count: 0
answer count: 0
tagged with: powermock
type: UnansweredQuestion
has body: I have a Util class having 20+ static methods. I want to mock those static methods with PowerMockito and want to return my own Answer for 3 methods and for the rest of methods want to invoke real/actual methods. How to achieve that? If do this way PowerMockito.mockStatic(RuntimeDocumentFactory.class, Answers.CALLS_REAL_METHODS.get()); PowerMockito.when(RuntimeDocumentFactory.createRow(Mockito.any(Zone.class), Mockito.anyString())).thenAnswer(new CustomAnswer()); Here before invoking my CustomAnswer it's invoking real method, which results in a NullPointerException due to real logic. So, please suggest how to go about mocking few static methods to use CustomAnswer and rest to invoke real methods.
upvote count: 1
has comment: http://stackoverflow.com/comment/38540648
has comment: http://stackoverflow.com/comment/38539327
has title: Not able to understand how to go with PowerMockito in my scenario
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/24675412
has comment: http://stackoverflow.com/comment/38540956
has comment: http://stackoverflow.com/comment/38538283

http://stackoverflow.com/a/24786155
has comment: http://stackoverflow.com/comment/38466963
has body: The cause is clear: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: ch.tupperware.tuppergestion.entity.AbstractEmployeEntity, at table: PERSONNE, for columns: [org.hibernate.mapping.Column(ID_REFERENT)] Your class ch.tupperware.tuppergestion.entity.AbstractEmployeEntity is not finding column ID_REFERENT in your table PERSONNE. How did you map your AbstractEmployeEntity class. If it's an abstract class, why not map it with @MappedSuperclass?
answers question: http://stackoverflow.com/q/24785920
has comment: http://stackoverflow.com/comment/38475043
score: 0
has comment: http://stackoverflow.com/comment/38467229
type: Answer

http://stackoverflow.com/a/24773693
has comment: http://stackoverflow.com/comment/38466518
answers question: http://stackoverflow.com/q/24773574
type: Answer
has comment: http://stackoverflow.com/comment/38445003
has body: You should have to make interface and in that interface add one method that has argument type that you want to return from AsyncTask. and in a constructor of AsyncTask pass interface reference from your activity. and set data in interface method from onPostExecute(). so you will be notifyed in activity class when data set from onPostExecute method. follow this nice answer https://stackoverflow.com/a/9963705/942224
score: 0
has comment: http://stackoverflow.com/comment/38443657

http://stackoverflow.com/q/24801382
has comment: http://stackoverflow.com/comment/38495203
has comment: http://stackoverflow.com/comment/38495375
has comment: http://stackoverflow.com/comment/38495184
possible better answer: http://stackoverflow.com/a/24801527
has title: What does this method return?
has answer: http://stackoverflow.com/a/24801527
has answer: http://stackoverflow.com/a/24801471
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24801424
type: Question
has comment: http://stackoverflow.com/comment/38495300
has body: I have just started learning to program. I was wondering what this method returns: public int doSomething(int size) { int[] b = new int [size]; int c = 0; for (int d : b) { c = c + d; } return c; }
downvote count: 9
has answer: http://stackoverflow.com/a/24801542
has comment: http://stackoverflow.com/comment/38495202
accepted answer: http://stackoverflow.com/a/24801424
score: -6
answer count: 4
favorite count: 0

http://stackoverflow.com/q/24868340
tagged with: apache-commons-exec
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38634098
downvote count: 1
type: Question
has body: How can I achieve the following in Apache Commons Exec? (There doesn't seem to be any documentation for this use case). Launch a child process. Pass the child process a string on its stdin. Wait for the child process to terminate. Collect the stdout from the child process as a string.
has answer: http://stackoverflow.com/a/24874445
score: 0
has title: Commons exec: Launch, send to child process, and read back on stdin/stdout
answer count: 1
tagged with: child-process
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38668073
type: Comment
has text: Since you have currently working code, and you want to try and improve it, you might have better luck over at [codereview.stackexchange.com](http://codereview.stackexchange.com/).
type: QuestionComment
comment on: http://stackoverflow.com/q/24892524
score: 4

http://stackoverflow.com/q/24900478
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/24900524
answer count: 1
tagged with: android
tagged with: android-alertdialog
tagged with: http://stackoverflow.com/tag/xml
has title: How to make a dialog but with the ability to set its content with a custom xml?
has body: In my android app, I want to make a dialog box, the kind of one you get from alertbuilders, where you get access to set positive/neutral/negative button click, but I also want to use the .setcustomview() to load the content with my xml file. Does android have a way to do this? I want to avoid making those buttons... Thanks
has answer: http://stackoverflow.com/a/24900524
type: AnsweredQuestion

http://stackoverflow.com/a/24827763
type: Answer
answers question: http://stackoverflow.com/q/24821476
has comment: http://stackoverflow.com/comment/38555723
has comment: http://stackoverflow.com/comment/38555272
has body: Read the section from the Swing tutorial on Sorting and Filtering for a working example that does this.
score: 0

http://stackoverflow.com/q/24749303
has comment: http://stackoverflow.com/comment/38397916
has comment: http://stackoverflow.com/comment/38397879
has comment: http://stackoverflow.com/comment/38397609
tagged with: android
possible better answer: http://stackoverflow.com/a/24750670
tagged with: cryptography
tagged with: php
has title: Android AES with no padding decryption, unknown characters 'NUL' at the end of string
type: AnsweredQuestion
tagged with: java
tagged with: encryption
type: Question
has answer: http://stackoverflow.com/a/24749728
accepted answer: http://stackoverflow.com/a/24749728
has comment: http://stackoverflow.com/comment/38397687
has answer: http://stackoverflow.com/a/24750670
has body: I've following code to decrypt the files in Java which are encrypted via PHP mcrypt function. private String iv = "MYKEYHERE";//Dummy iv (CHANGE IT!) private String SecretKey = "MYKEYHERE";//Dummy secretKey (CHANGE IT!) private byte[] decrypt(String code) { byte[] decrypted = null; try { Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes()); SecretKeySpec keyspec = new SecretKeySpec(SecretKey.getBytes(), "AES"); if(code == null || code.length() == 0) throw new Exception("Empty string"); cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec); decrypted = cipher.doFinal(hexToBytes(code)); } catch (Exception e) { e.printStackTrace(); } return decrypted; } private static byte[] hexToBytes(String str) { if (str==null) { return null; } else if (str.length() &lt; 2) { return null; } else { int len = str.length() / 2; byte[] buffer = new byte[len]; for (int i=0; i&lt;len; i++) { try { buffer[i] = (byte) Integer.parseInt(str.substring(i*2,i*2+2),16); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return buffer; } } and I'm reading and writing the files from SDCARD as String encyptedData = readFileFromSDCard(params[0]); byte[] decryptedByteArray = decrypt(encyptedData); File rootFile = new File(Constants.folioTempLocation+params[1]); rootFile.mkdirs(); File outFile = new File(rootFile, new File(params[0]).getName()); FileOutputStream out = new FileOutputStream(outFile); //IOUtils.write(decryptedByteArray, out); out.write(decryptedByteArray); out.flush(); out.close(); There is no problem with decryption and writing files back to SD_CARD. But I'm getting unknown characters at the end of each file which is restricting the whole decrypted file to work properly. I'm attaching screenshot of unknown characters concatenated to end of string. I'm also attaching an encrypted_html_file for anyone want to test the code using this file. Screenshot
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38397663
linked to: http://stackoverflow.com/q/7314901

http://stackoverflow.com/comment/38522819
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24815708
has text: Once again emphasizing that 500 rows is not large, I would suggest setting the fetch size to match the number of rows you expect to retrieve to limit the roundtrips to the database. YMMV, but my experience is that the optimal fetch size is often somewhere between 500 and 1000 rows.

http://stackoverflow.com/comment/86238543
type: AnswerComment
has text: @apangin Both of you are right. Have a look at this. http://mail.openjdk.java.net/pipermail/hotspot-dev/2016-September/024464.html
type: Comment
comment on: http://stackoverflow.com/a/24876078
score: 0

http://stackoverflow.com/comment/38627938
has text: make sure hoteldetails1 and hotelfacilities1 has hotelid field.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24848756

http://stackoverflow.com/comment/39279605
type: AnswerComment
has text: Is there no a way of removing the button element completely and having timer activate when activity opens?
comment on: http://stackoverflow.com/a/25106164
score: 0
type: Comment

http://stackoverflow.com/comment/38601211
comment on: http://stackoverflow.com/q/24857171
type: Comment
type: QuestionComment
has text: See Elliots answer. Don't parameterize your fillArray method, refer to the class's field 'array' directly.
score: 2

http://stackoverflow.com/comment/38521141
type: Comment
type: QuestionComment
has text: Not without knowing the length of the list beforehand. Then again, `O(2n)` is still linear time.
score: 2
comment on: http://stackoverflow.com/q/24814852

http://stackoverflow.com/a/65231855
has body: Faced same issue. In my case the reason was pretty stupid - github token I used for authorization was issued for the organization that doesn't own the repo I tried to publish into. So check repo title and ownership.
type: Answer
answers question: http://stackoverflow.com/q/24830610
score: 0

http://stackoverflow.com/comment/38607804
has text: I haven't take that personally. Just saying. Feel free to give any suggestion when I am wrong.
type: Comment
comment on: http://stackoverflow.com/a/24859219
score: 0
type: AnswerComment

http://stackoverflow.com/q/24899112
has comment: http://stackoverflow.com/comment/38680522
has comment: http://stackoverflow.com/comment/38680445
answer count: 1
has comment: http://stackoverflow.com/comment/38680533
tagged with: parsing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38680402
has answer: http://stackoverflow.com/a/24899157
tagged with: java
tagged with: eclipse
type: Question
has body: System.out.println("xmlns = " + attributes.getValue("xmlns")); I know my approach is wrong, yet what should I use instead of attributes.getValue(...) xmls is a link for example: https://fkfdkfkf.com
score: 0
has title: What should I do to parse an URL?

http://stackoverflow.com/comment/38697767
score: 0
type: QuestionComment
has text: @JoppeD If you post complete code then I can find where is your mistake and try to provide solutions..
comment on: http://stackoverflow.com/q/24907914
type: Comment

http://stackoverflow.com/q/24868552
type: AnsweredQuestion
has body: I'm trying to generate a code coverage report for a simple Maven plugin I've developed. Cobertura generates the report with the three classes in my project correctly, but it reports 0% code coverage even though the tests execute successfully. I've run it in debug mode and there are no errors or stack traces reported by Cobertura. My configuration in the POM file is quite simple: <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.apache.maven maven-artifact 3.0.5 org.apache.maven maven-compat 3.0.5 org.apache.maven maven-plugin-api 3.0.5 org.apache.maven.plugins maven-resources-plugin 2.6 org.apache.maven maven-core 3.0.5 org.apache.maven.plugin-tools maven-plugin-annotations 3.1 org.apache.maven.plugin-testing maven-plugin-testing-harness test 2.1 junit junit 4.11 test org.twdata.maven mojo-executor-maven-plugin 2.1.0 org.apache.maven.plugins maven-assembly-plugin 2.4 maven-plugin maven-surefire-plugin 2.16 test-custom-plugin test test never 0 true org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 org.apache.maven.plugins maven-plugin-plugin 3.2 MyCustomPlugin default-descriptor descriptor process-classes help-descriptor helpmojo process-classes org.codehaus.mojo cobertura-maven-plugin 2.5.2 Cobertura works on all of my other projects (so far), is there any reason that it would failing to report coverage for a Maven plugin project?
tagged with: maven-cobertura-plugin
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24874873
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38623905
accepted answer: http://stackoverflow.com/a/24874873
has comment: http://stackoverflow.com/comment/38624573
answer count: 1
downvote count: 0
tagged with: maven-plugin
favorite count: 0
has title: Cobertura code coverage test on Maven plugin
tagged with: cobertura
has comment: http://stackoverflow.com/comment/38622843
has comment: http://stackoverflow.com/comment/38625440
tagged with: maven

http://stackoverflow.com/comment/38521200
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24814625
has text: No, that's not the bug I was referring to. A LinearLayout with a RelativeLayout should be fine. Honestly, the fact you are having two different rootviews for your ListView means you should be creating a custom view that extends BaseAdapter. Sadly, since there doesn't seem to be an easy fix, you're going to have to do that. Well, frankly, for what you are doing you should be doing that anyway.
score: 1

http://stackoverflow.com/comment/38513177
score: 1
type: Comment
type: QuestionComment
has text: It isn't. [This article](http://www.javaworld.com/article/2073352/core-java/simply-singleton.html) gives a detailed treatment of Singletons in Java; the double-checked locking scenario is discussed in [page two](http://www.javaworld.com/article/2073352/core-java/simply-singleton.html?page=2) of the article.
comment on: http://stackoverflow.com/q/24810802

http://stackoverflow.com/q/24777940
tagged with: struts-1
has answer: http://stackoverflow.com/a/24778139
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/43238591
type: Question
answer count: 2
tagged with: jsp
has body: I search for long time to this issue.But still i didn't get the solution.Kindly help me to this problem. I have one JSP file and using struts for my application.When i try to load the page in browser it throws this error. javax.servlet.jsp.JspException: No getter method for property reqKickOffMeet of bean org.apache.struts.taglib.html.BEAN. Everything is fine.There is no case sensitive issue also .But this code is not working.Kindly help me to fix this. JSP: Requirements Kick-off meeting: Equal to Greater than Less than Between and my class file private String reqKickOffMeet; public String getReqKickOffMeet() { return reqKickOffMeet; } public void setReqKickOffMeet(String reqKickOffMeet) { this.reqKickOffMeet = reqKickOffMeet; }
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/38451591
has title: javax.servlet.jsp.JspException: No getter method for property xxx of bean org.apache.struts.taglib.html.BEAN
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/24802909
score: 3
downvote count: 0
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/24802680
accepted answer of: http://stackoverflow.com/q/24802680
type: Answer
has body: toArray() returns an array of Object. What you need is an array of Criterion. So the correct method is: Criterion[] array = criterions.toArray(new Criterion[criterions.size()]); See the different return type between toArray() and toArray(T[]) Note that, in this case, it would be much easier to simply use a disjunction: Disjunction disjunction = Restrictions.disjunction(); for (XYZ xyz : xyzs) { ... disjunction.add(Restrictions.between("dob", maxAge, minAge)); } criteria.add(disjunction);

http://stackoverflow.com/q/24898547
type: AnsweredQuestion
upvote count: 35
tagged with: spring-4
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7482666
has title: Spring async method called from another async method
has body: I'm using Spring 4 and I've noticed an odd behaviour... if I'm calling an async method multiple times from a normal instance method then they are all called in different threads and finish at random times. But if I call multiple times an async method from another async method then they finish in order. I have something like this: @Async public void nonAsyncMethod() { for (int i = 0; i &lt; 30; i++) { asyncMethod(); } } @Async public void asyncMethod() { ... something here } I'm using the default async executor. Should I use a different one? However this executor do not reuse any threads and starts another one every time so it should be fine... Can it be just a coincidence? But I've tried like more than 10 times and if I revert back to non-async for the first method then they finish randomly
score: 35
accepted answer: http://stackoverflow.com/a/24902434
answer count: 1
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/38680494
favorite count: 0
has answer: http://stackoverflow.com/a/24902434
tagged with: multithreading
tagged with: spring

http://stackoverflow.com/a/24825478
accepted answer of: http://stackoverflow.com/q/24822939
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24822939
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39161114
downvote count: 0
has body: I got it working by using the default constructor for the AssetsBundle() class. With the default constructor your resources will gets looked up in a directory on the java classpath e.g. /src/main/resources/assets/ and your have to name your applicationContextPath only /application Point your browser to the folling location for static content localhost:8080/application/assets/index.htm
score: 4
has comment: http://stackoverflow.com/comment/38540470

http://stackoverflow.com/comment/38640421
comment on: http://stackoverflow.com/a/24876078
score: 0
type: Comment
has text: Wrong. Calling Java from C++ is still JNI.
type: AnswerComment

http://stackoverflow.com/a/24775561
upvote count: 1
answers question: http://stackoverflow.com/q/24775493
downvote count: 0
type: Answer
score: 1
has body: If your main class extends Activity you can also use findViewById... like that (But be sure that before you must setContentView' (activity_main.xml) ) drawerGrid = (GridView) findViewById(R.id.content);

http://stackoverflow.com/q/24812200
has comment: http://stackoverflow.com/comment/38516342
has answer: http://stackoverflow.com/a/24813050
answer count: 3
has answer: http://stackoverflow.com/a/24812681
accepted answer: http://stackoverflow.com/a/24812681
favorite count: 0
tagged with: ftp
upvote count: 2
has comment: http://stackoverflow.com/comment/38516239
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/24813050
tagged with: apache-commons
has answer: http://stackoverflow.com/a/24812284
has body: Iam trying to get a list of FTP files by using FTPFile[] ftpFiles = ftp.listFiles(READ_DIRECTORY); There are more than 27553 files in this directory and i expect the number to grow. Now i need to retrieve one file from this huge list. I am doing the following for (FTPFile ftpFile : ftpFiles) { if(fileName.equalsIgnoreCase(ftpFile.getName()) { print(ftpFile); } } But lets say the file i want to print is the last file in the 27553 files.. it takes about a minute to go through the whole list checking if its the file im looking for.. not only that.. it also gives me a "org.apache.commons.net.ftp.FTPConnectionClosedException: FTP response 421 received. Server closed connection." after about 900 seconds. How can i tune this program to find the file faster? I dont want it to run for 900 seconds. Below is the actual method that takes so long. Please suggest how i can reduce the time taken. In debug mode, the method runs hundreds of seconds. On a production server, it takes more than a minute or two which is still not acceptable. private boolean PDFReport(ActionForm form, HttpServletResponse response, String fileName, String READ_DIRECTORY) throws Exception { boolean test = false; FTPClient ftp = new FTPClient(); DataSourceReader dsr = new DataSourceReader(); dsr.getFtpLinks(); String ftppassword = dsr.getFtppassword(); String ftpserver = dsr.getFtpserver(); String ftpusername = dsr.getFtpusername(); ftp.connect(ftpserver); ftp.login(ftpusername, ftppassword); InputStream is = null; BufferedInputStream bis = null; try { int reply; reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); System.out.println("FTP server refused connection."); } else { ftp.enterLocalPassiveMode(); FTPFile[] ftpFiles = ftp.listFiles(READ_DIRECTORY); for (FTPFile ftpFile : ftpFiles) { String FilePdf = ftpFile.getName(); ftp.setFileType(FTP.BINARY_FILE_TYPE); if (FilePdf.equalsIgnoreCase(fileName)) { String strFile = READ_DIRECTORY + "/" + FilePdf; boolean fileForm…
tagged with: java
has comment: http://stackoverflow.com/comment/38516306
type: Question
has title: retrieve file from FTP when the directory has too many files
has comment: http://stackoverflow.com/comment/38516174
downvote count: 0

http://stackoverflow.com/comment/38534371
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24820298
has text: I answered "How can i pass value to build.xml from Jenkins ?". Jenkins adds all of the build parameters of the job to the ant build : `$ ant -file build_jenkins.xml -Dversion=7.1 -DsendFtp=true`. These parameters values are in the ant properties `${version}` and `${sendFtp}`

http://stackoverflow.com/a/24906460
answers question: http://stackoverflow.com/q/24906073
has comment: http://stackoverflow.com/comment/45231954
has body: I got the reason, I've tried both java-rdfa version 0.4 and 0.5 snapshot but both of them refer to com.hp.hpl.jena.iri.IRIFactory, however in the current packaging IRIFactory is moved to package org.apache.jena.iri.IRIFactory.
has comment: http://stackoverflow.com/comment/38702154
upvote count: 2
has comment: http://stackoverflow.com/comment/44827358
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24906073
has comment: http://stackoverflow.com/comment/44903709
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38511013
has text: After Giru bhai answer it still not works in 2.2, i have posted another question http://stackoverflow.com/questions/24808837/error-no-such-table-in-api-2-2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24799182
score: 0

unit-testing
tags question: http://stackoverflow.com/q/24907478
tags question: http://stackoverflow.com/q/24771629
tags question: http://stackoverflow.com/q/24854527
tags question: http://stackoverflow.com/q/24753650
tags question: http://stackoverflow.com/q/24783093
tags question: http://stackoverflow.com/q/24851886
tags question: http://stackoverflow.com/q/24901978
tags question: http://stackoverflow.com/q/24847716
tags question: http://stackoverflow.com/q/24789362
tags question: http://stackoverflow.com/q/24856904
tags question: http://stackoverflow.com/q/24801824
tags question: http://stackoverflow.com/q/24878875
tags question: http://stackoverflow.com/q/24756172
tags question: http://stackoverflow.com/q/24870042
tags question: http://stackoverflow.com/q/24770237
tags question: http://stackoverflow.com/q/24807138
tags question: http://stackoverflow.com/q/24862298
tags question: http://stackoverflow.com/q/24774645
tags question: http://stackoverflow.com/q/24762325
tags question: http://stackoverflow.com/q/24872404
tags question: http://stackoverflow.com/q/24823972
tags question: http://stackoverflow.com/q/24765027
type: Tag
tags question: http://stackoverflow.com/q/24768076
tags question: http://stackoverflow.com/q/24887693
tag name: unit-testing
tags question: http://stackoverflow.com/q/24817450
tags question: http://stackoverflow.com/q/24822923
tags question: http://stackoverflow.com/q/24790562
tags question: http://stackoverflow.com/q/24772520
tags question: http://stackoverflow.com/q/24884555
tags question: http://stackoverflow.com/q/24756615
tags question: http://stackoverflow.com/q/24892696
tags question: http://stackoverflow.com/q/24896636
tags question: http://stackoverflow.com/q/24771657
tags question: http://stackoverflow.com/q/24789854
tags question: http://stackoverflow.com/q/24867650
tags question: http://stackoverflow.com/q/24906646

http://stackoverflow.com/q/24768694
tagged with: java
has comment: http://stackoverflow.com/comment/38461285
answer count: 1
has title: How can I create a HashMap that dynamically calls other Java classes?
accepted answer: http://stackoverflow.com/a/24768712
has comment: http://stackoverflow.com/comment/38433969
has body: I am attempting to create a HashMap&lt;Integer, Class&gt;, and am not being successful. Essentially, all I want to do is have the ability to dynamically load the classes into the Map. My managed Bean looks like this: package Demo; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.enterprise.context.Dependent; import javax.inject.Named; /** * * @author kbarnett */ @Named(value = "facePalmBean") @Dependent public class FacePalmBean { private HashMap&lt;Integer, Class&gt; chimpanzee; private NewClass0 NewClass0; private NewClass1 NewClass1; private NewClass2 NewClass2; /** * Creates a new instance of FacePalmBean */ public FacePalmBean() { chimpanzee = new HashMap&lt;&gt;(); NewClass0 = new NewClass0(0); NewClass1 = new NewClass1(1); NewClass2 = new NewClass2(2); } public HashMap&lt;Integer, Class&gt; getChimpanzee() { for (int i = 0; i &lt; 3; i++) { try { String tmpstring = "NewClass"+i; System.out.println(tmpstring); Class tmpclass = Class.forName(tmpstring); System.out.println(tmpclass); chimpanzee.put(i, tmpclass); } catch (ClassNotFoundException ex) { Logger.getLogger(FacePalmBean.class.getName()).log(Level.SEVERE, null, ex); } } System.out.println(chimpanzee.toString()); return chimpanzee; } public void setChimpanzee(HashMap&lt;Integer,Class&gt; chimpanzee) { this.chimpanzee=chimpanzee; } } and the NewClasses look like this: package Demo; public class NewClass0 { Integer MyNumber; NewClass0(int num){ MyNumber=num; } public Integer getMyNumber() { return MyNumber; } } All of the NewClasses are identical except for the number (i.e. 0, 1, and 2).
score: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24768712

http://stackoverflow.com/comment/38562454
has text: why are you use while(){} loop ??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24836695
type: Comment

http://stackoverflow.com/q/24755080
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Simplest way to send two ints over a TCP connection
score: -1
tagged with: tcp
tagged with: java
downvote count: 1
type: Question
tagged with: struct
has answer: http://stackoverflow.com/a/24755980
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/38408750
has body: I want to be able to send two ints over a tcp connection. the client is an android application which gets the coordinates of the user input and then sends them to a c server program. I've managed to achieve the desired result but it is not very efficient. What i've done is turn the two ints into a single string separated by a comma and then send the single string over tcp. e.g int x = 12; and int y = 34; turns into String to_send = "12,34";. The server receives this string and then separates out the coordinates using strtok() and converts them back to ints using atoi(). This gives me what i want but i'm aware that it uses alot more memory then needed as each string character represents one byte. Could i send a struct over tcp which contained two shorts x and y? If so could you give me a little bit of sample code and some explanation that would be fantastic. Tom
upvote count: 0

http://stackoverflow.com/q/24755952
answer count: 1
has answer: http://stackoverflow.com/a/24757010
favorite count: 0
tagged with: apache-poi
upvote count: 3
type: UnansweredQuestion
score: 3
tagged with: java
type: Question
tagged with: docx4j
has title: How to read word document and get parts of it with all styles using docx4j
has body: I am using docx4j to deal with word document formatting. I have one word document which is divided in number of tables. I want to read all the tables and if I find some keywords then I want to take those contents to another word document with all the formatting. My word document is as follow. Like from above I want to take content which is below Some Title. Here my keyword is Sample Text. So whenever Sample Text gets repeated, content needs to be fetched to new word document. I am using following code. MainDocumentPart mainDocumentPart = null; WordprocessingMLPackage docxFile = WordprocessingMLPackage.load(new File(fileName)); mainDocumentPart = docxFile.getMainDocumentPart(); WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); ClassFinder finder = new ClassFinder(Tbl.class); new TraversalUtil(mainDocumentPart.getContent(), finder); Tbl tbl = null; int noTbls = 0; int noRows = 0; int noCells = 0; int noParas = 0; int noTexts = 0; for (Object table : finder.results) { noTbls++; tbl = (Tbl) table; // Get all the Rows in the table List&lt;Object&gt; allRows = DocxUtility.getDocxUtility() .getAllElementFromObject(tbl, Tr.class); for (Object row : allRows) { Tr tr = (Tr) row; noRows++; // Get all the Cells in the Row List&lt;Object&gt; allCells = DocxUtility.getDocxUtility() .getAllElementFromObject(tr, Tc.class); toCell: for (Object cell : allCells) { Tc tc = (Tc) cell; noCells++; // Get all the Paragraph's in the Cell List&lt;Object&gt; allParas = DocxUtility.getDocxUtility() .getAllElementFromObject(tc, P.class); for (Object para : allParas) { P p = (P) para; noParas++; // Get all the Run's in the Paragraph List&lt;Object&gt; allRuns = DocxUtility.getDocxUtility() .getAllElementFromObject(p, R.class); for (Object run : allRuns) { R r = (R) run; // Get the Text in the Run List&lt;Object&gt; allText = DocxUtility.getDocxUtility() .getAllElementFromObject(r, Text.class); for (Object text : allText) { noTexts++; Text txt = (Text) text; } Syste…
tagged with: arrays
downvote count: 0
tagged with: javascript

http://stackoverflow.com/comment/38619051
score: 0
type: Comment
has text: I changed the id back to enforce-java but it still doesn't get run during the validate phase.
type: AnswerComment
comment on: http://stackoverflow.com/a/24827613

http://stackoverflow.com/comment/38579269
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24845896
has text: nope. You copied an old version of the code (shame on me...)
type: AnswerComment

http://stackoverflow.com/comment/77040035
type: AnswerComment
has text: I don't suggest using <sql> tax with a native sql statement. It causes portability problems
score: 0
type: Comment
comment on: http://stackoverflow.com/a/33628154

http://stackoverflow.com/a/24908926
has body: Nothing goes wrong. If you can see in the source code of java.util.Poperties all tabs are replaced with \t private String saveConvert(String theString, boolean escapeSpace, boolean escapeUnicode) { int len = theString.length(); int bufLen = len * 2; if (bufLen &lt; 0) { bufLen = Integer.MAX_VALUE; } StringBuffer outBuffer = new StringBuffer(bufLen); for(int x=0; x&lt;len; x++) { char aChar = theString.charAt(x); // Handle common case first, selecting largest block that // avoids the specials below if ((aChar &gt; 61) &amp;&amp; (aChar &lt; 127)) { if (aChar == '\\') { outBuffer.append('\\'); outBuffer.append('\\'); continue; } outBuffer.append(aChar); continue; } switch(aChar) { case ' ': if (x == 0 || escapeSpace) outBuffer.append('\\'); outBuffer.append(' '); break; case '\t':outBuffer.append('\\'); outBuffer.append('t'); break; case '\n':outBuffer.append('\\'); outBuffer.append('n'); break; case '\r':outBuffer.append('\\'); outBuffer.append('r'); break; case '\f':outBuffer.append('\\'); outBuffer.append('f'); break; case '=': // Fall through case ':': // Fall through case '#': // Fall through case '!': outBuffer.append('\\'); outBuffer.append(aChar); break; default: if (((aChar &lt; 0x0020) || (aChar &gt; 0x007e)) &amp; escapeUnicode ) { outBuffer.append('\\'); outBuffer.append('u'); outBuffer.append(toHex((aChar &gt;&gt; 12) &amp; 0xF)); outBuffer.append(toHex((aChar &gt;&gt; 8) &amp; 0xF)); outBuffer.append(toHex((aChar &gt;&gt; 4) &amp; 0xF)); outBuffer.append(toHex( aChar &amp; 0xF)); } else { outBuffer.append(aChar); } } } return outBuffer.toString(); }
score: 2
answers question: http://stackoverflow.com/q/24908731
has comment: http://stackoverflow.com/comment/38704536
has comment: http://stackoverflow.com/comment/38731349
has comment: http://stackoverflow.com/comment/38730891
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38704734
type: Answer

http://stackoverflow.com/comment/38554040
has text: Unfortunately I had already read your message.. When I look at it.. its 3 lines of code, i seriously need to spend more time thinking about the logic of it.. now I understand it, its so simple but somehow i didnt get it. I appreciate this!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24831586
type: Comment

http://stackoverflow.com/comment/38579089
type: AnswerComment
has text: That's what I was just about to do.
type: Comment
comment on: http://stackoverflow.com/a/24845938
score: 0

http://stackoverflow.com/q/24785559
type: Question
score: 0
upvote count: 1
downvote count: 1
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/38466408
answer count: 0
has comment: http://stackoverflow.com/comment/38490671
type: UnansweredQuestion
has body: I have a Java Applet Project. I have a problem about my Java version. I've tried a lot of way for fix this problem but i can't. And my Java version updated. I will sign my code but first i must fix this problem. When I've entered and click to run, this is first message; I click 'don't block' and; I click 'OK' and; I click 'Details' and; And if you want to see this problem, you can enter my website to see applet; http://www.armabilgisayar.net/demoebys How can I fix this problem? Thank you.
tagged with: java
has title: How can I fix this issue about “Java Version” in my Java Applet Project?
has comment: http://stackoverflow.com/comment/38468315
has comment: http://stackoverflow.com/comment/38466184
has comment: http://stackoverflow.com/comment/38465765

http://stackoverflow.com/comment/38462249
comment on: http://stackoverflow.com/q/24783690
score: 0
has text: @Varun i'm trying to trace this pre-written code. I can't change it... so I'm trying to understand what it's doing
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38601941
score: 0
type: Comment
type: AnswerComment
has text: `al.get(index).setX(new_value);` Or `al.get(index).setY(new_value);`, depending on the value you want to modify.
comment on: http://stackoverflow.com/a/24857586

http://stackoverflow.com/comment/41149254
score: 1
type: AnswerComment
has text: If this solved your problem, then make it the answer
comment on: http://stackoverflow.com/a/24815823
type: Comment

http://stackoverflow.com/a/24856478
has body: You need to define your own ContextListener and add it in a listener tag of your web.xml. Implement javax.servlet.ServletContextListener and override the contextDestroyed method. See this tutorial for details: http://www.mkyong.com/servlet/what-is-listener-servletcontextlistener-example/ public class CleanupContextListener implements ServletContextListener{ @Override public void contextDestroyed(ServletContextEvent arg0) { // TODO: Your cleanup code here } @Override public void contextInitialized(ServletContextEvent arg0) { // Intentionally Empty } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24856453
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24856453

http://stackoverflow.com/comment/38527584
has text: JunitTestSuiteRunner is obsolete and not used. Your tests are started by IntelliJ's JUnit4IdeaTestRunner. How to you start your test?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24802434
score: 0

http://stackoverflow.com/comment/38583681
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57620/discussion-between-user3154663-and-amit).
score: 0
comment on: http://stackoverflow.com/a/24838825
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24849838
tagged with: java
has comment: http://stackoverflow.com/comment/38586872
has title: Heap Sort. What's wrong in this code?
type: Question
tagged with: heapsort
has comment: http://stackoverflow.com/comment/38590931
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38586680
has answer: http://stackoverflow.com/a/24857228
has answer: http://stackoverflow.com/a/24854104
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38588541
has body: I am able to create a Max Heap using a function heapify() but when i try to call it again(to delete max and create a sorted array) the program gets stuck/doesn't stop taking input. What's wrong? Is this a memory problem?If I increase the number of calls by increasing the frequency of for loop it still works fine. public class HeapSort { int[] heap; public void sort(int length) { int temp; for(int i=length;i&gt;=1;i--) { heapify(i,length); } //if I try to call heapify again(even once) after this,the program gets stuck } public void heapify(int i,int l) { int lchild=2*i,rchild,max; int temp; while(lchild&lt;=l) { rchild=(2*i)+1; if(rchild&lt;=l) max=(heap[lchild]&gt;heap[rchild])? lchild:rchild; else max=lchild; if(heap[i]&lt;heap[max]) { temp=heap[i]; heap[i]=heap[max]; heap[max]=temp; i=max; } lchild=2*i; } } public static void main(String args[]) throws IOException { BufferedReader r= new BufferedReader(new InputStreamReader(System.in)); int length=Integer.parseInt(r.readLine()); HeapSort Heap=new HeapSort(); Heap.heap=new int[length+1]; for(int i=1;i&lt;=length;i++) Heap.heap[i]=Integer.parseInt(r.readLine()); Heap.sort(length); for(int i=1;i&lt;=length;i++) System.out.print(Heap.heap[i]+" "); } }

http://stackoverflow.com/a/24823276
type: Answer
has body: Tagsoup is intended as an HTML parser and to clean up poor HTML. For tag names that are defined by HTML tagsoup knows which elements are allowed inside which other elements and will try and correct any that are wrongly nested. Also remember that in HTML, unlike XML, tag names are not case sensitive. In this case it seems to have decided that it knows what object and title should mean in HTML (respectively an embedded object of some kind, and the title of the page), and it knows that title is not allowed inside object. But ObjectID and Status are not known HTML element names, so it gives the benefit of the doubt and leaves them alone.
accepted answer of: http://stackoverflow.com/q/24823073
answers question: http://stackoverflow.com/q/24823073
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/38856516
has text: Nice explanation @Vlad. Can you explain a bit more on "this only applies to FK column values not to whole rows". Do you mean only a column is locked rather than row. How is this lock translated to database. AFAIK, the granularity of a lock is row and not column OR this locking of relation is only in-memory.
comment on: http://stackoverflow.com/a/24878652
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38669556
score: 0
type: Comment
has text: If I could add another question here... My main reason for using html file was to have control over the UI. If I use Struts 2 tags to generate HTML, will I be able to integrate it with front end frameworks like Foundation 5? Could you also provide any links where I can read up more on this? PS: I don't have in depth knowledge in Struts 2 and started with the book Struts 2 in Action today. Hoping it helps me out.
type: AnswerComment
comment on: http://stackoverflow.com/a/24887314

http://stackoverflow.com/comment/38529580
has text: Why wouldn't you be able to use the default anonymous user for that?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24816920

http://stackoverflow.com/q/24844399
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38885220
tagged with: java
has title: Eclipse AutoValue class fails to build
has comment: http://stackoverflow.com/comment/38642014
tagged with: eclipse
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/38887029
downvote count: 0
has answer: http://stackoverflow.com/a/25665610
score: 4
tagged with: auto-value
has comment: http://stackoverflow.com/comment/38786363
tagged with: velocity
has body: I'm running Eclipse Kepler SR2, with Maven 3.1.1 attached with the m2e and m2e-apt plugins, and I'm getting an error I don't know how to resolve. I managed to find all the dependencies needed to get @AutoValue working into my pom.xml, but now I'm in a state where it only works if the methods which need to be defined all have primitive return types. If I provide an abstract getter which returns an Object or more specific, I get this error: @AutoValue processor threw an exception: java.lang.IllegalArgumentException: Failed to invoke com.google.auto.value.processor.AutoValueProcessor$Property.nullable() on getObject... I've tried the basics - cleared the maven cache, restarted Eclipse, rebuilt the project... no dice. So I dug down into the source code and I found a discrepancy which I'm not sure how it's intended to be resolved. In the Velocity template for the generated AutoValue class, there is some basic logic for rendering primitives differently than objects, for instance on line 37, p.nullable is checked. The p variable is an instance of AutoValueProcessor$Property class, which, as can be seen on line 205 of the preceeding link, has an isNullable() method, but no nullable method or property. How is the Velocity rendering phase intended to work then? Does Velocity auto-expand p.nullable to p.isNullable some how, but not for me because reasons? Is this a bug? I'm not sure what to do from here. Example class that doesn't compile: @AutoValue public abstract class Point { public static Point of(double x, double y) { return new AutoValue_Point(x, y); } public abstract Double x(); public abstract Double y(); } Eclipse highlights the described error under Point at the head of the class declaration.
has comment: http://stackoverflow.com/comment/38639545
has answer: http://stackoverflow.com/a/48046613
favorite count: 0
accepted answer: http://stackoverflow.com/a/25665610
tagged with: maven
possible better answer: http://stackoverflow.com/a/48046613

http://stackoverflow.com/q/24780236
upvote count: 1
tagged with: android
accepted answer: http://stackoverflow.com/a/24780291
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/24780291
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38455126
type: Question
has body: I have a problem http://prntscr.com/437w8p I have java jre8 installed I tried with version jre7 and same. Can someone please help me? I've tried everything...
has title: The import javax.sound cannot be resolved
answer count: 1
score: 0

http://stackoverflow.com/q/24845556
answer count: 1
has comment: http://stackoverflow.com/comment/38578488
favorite count: 0
has comment: http://stackoverflow.com/comment/38578593
downvote count: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38578607
has answer: http://stackoverflow.com/a/24845674
type: Question
has title: How to add type Object of numbers in JAVA
upvote count: 0
score: -2
has body: Object a = 1;// or "1" Object b = 2;// or "2" What should i do to get a + b = 3? Using Integer.parseInt may not work for my function, since I am doing a recursion based on them. Basically, I am writing a static method for Fibonacci number by suing binary tree. myNode = new TreeNode(fibTreeHelper(n-1).myItem + fibTreeHelper(n-2).myItem, fibTreeHelper(n-1), fibTreeHelper(n-2)); Constructor of TreeNode is TreeNode(myItem, leftBranch, rightBranch) myItem is an Object. I keep calling my helper function until n = 0 or 1, so I have the first two number in the Fibonacci sequence. What shoold I do? Thanks
has comment: http://stackoverflow.com/comment/38580578
accepted answer: http://stackoverflow.com/a/24845674
has comment: http://stackoverflow.com/comment/38578567

http://stackoverflow.com/comment/38658153
has text: An almost-duplicate of http://stackoverflow.com//questions/574809/load-a-resource-contained-in-a-jar
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24874541
score: 0

http://stackoverflow.com/a/24773122
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Try This : class Calc { public static void main (String[] args) { String s="123ab3"; char[] d=s.toCharArray(); int total=0; for(int i=0;i&lt;d.length;i++) { try { total=total+Integer.parseInt(""+d[i]); System.out.println(""+total); } catch(Exception e) { System.out.print("not no"); } } System.out.print("total="+total); } } Ouput Show : total=9
answers question: http://stackoverflow.com/q/24772894

http://stackoverflow.com/comment/38500881
score: 0
type: AnswerComment
type: Comment
has text: Is it always the same files that fail? If yes: whats the difference to the successful ones?
comment on: http://stackoverflow.com/a/24799372

http://stackoverflow.com/a/24905778
upvote count: 1
has body: You are already in a windowClosing event, which isn't cancelled. So the window will be closed. It's been a while, but you can probably cancel the event using the windowEvent.
answers question: http://stackoverflow.com/q/24905662
score: 1
has comment: http://stackoverflow.com/comment/38693112
downvote count: 0
has comment: http://stackoverflow.com/comment/38692757
type: Answer

http://stackoverflow.com/comment/38486762
type: Comment
comment on: http://stackoverflow.com/a/24788719
score: 0
type: AnswerComment
has text: Try this one as well, `command = cmd.exe /C start ffmpeg -i D:\\test%d.jpg -vcodec mpeg4 outfile.avi;`. I had a working `ffmpeg` command, I tried it and it worked. When you say `cmd.exe /C start`, java opens a `cmd` and runs your command in `command window`

http://stackoverflow.com/a/24899674
has comment: http://stackoverflow.com/comment/38696045
score: 0
has comment: http://stackoverflow.com/comment/38703823
answers question: http://stackoverflow.com/q/24883045
type: Answer
has comment: http://stackoverflow.com/comment/38703515
has body: Try initializing the Addresses as an ArrayList. Also define as a List, not Collection. private List&lt;Address&gt; addresses = new ArrayList&lt;Address&gt;(); We do something very similar without problem
has comment: http://stackoverflow.com/comment/38703945
has comment: http://stackoverflow.com/comment/38703806

http://stackoverflow.com/q/24814852
has comment: http://stackoverflow.com/comment/38521107
has answer: http://stackoverflow.com/a/24815318
score: 0
has comment: http://stackoverflow.com/comment/38521141
has answer: http://stackoverflow.com/a/24814976
answer count: 4
tagged with: linked-list
type: UnansweredQuestion
has body: Is there a linear way to find the middle element of a singly linked list? (Linear - Meaning you can only iterate through the list once AKA the number of iterations you do total cannot exceed the length of the list) Thanks! Edit: The question specifies that you cannot know the length of the list beforehand. Edit 2: The question is written for Java, but using some linked list definition that does not have a length() method
has title: Iterating through Linked List
has answer: http://stackoverflow.com/a/24815052
tagged with: java
has answer: http://stackoverflow.com/a/24815046
has comment: http://stackoverflow.com/comment/38521123
type: Question

openal
type: Tag
tags question: http://stackoverflow.com/q/24902682
tag name: openal
tags question: http://stackoverflow.com/q/24852955
tags question: http://stackoverflow.com/q/24853671

http://stackoverflow.com/q/24773037
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38442225
has comment: http://stackoverflow.com/comment/38441840
has body: I am doing project on efficiency of sorting algorithm. Lets say I performed 50 iterations of bubble sorts and find the average time taken for n numbers. But I realize that the first few iterations are always slower than subsequent iterations e.g. 1394ms, 1381ms, 1001ms, 1008ms, 1008ms ,1011ms... long lStartTime = System.currentTimeMillis(); bubbleSort(R); // R is the array of int long lEndTime = System.currentTimeMillis(); long difference = lEndTime - lStartTime; What could be the reason behind it? It is because cpu able to tell which set of data to be stored into cache? If so, should I not use the subsequent computing time for analysis as it is not realistic? Thanks! edit: im doing other sorting algorithms too, bubble sort as an example but the thing is it happens to all of the sorts i did except for insertion public static int[] bubbleSort(int[] S) { int counter = 0; boolean isUnsort = true; while (isUnsort) { isUnsort = false; for (int i = 0; i &lt; S.length - 1 - counter; i++) { if (S[i] &gt; S[i + 1]) { int temp = S[i]; S[i] = S[i + 1]; S[i + 1] = temp; isUnsort = true; } } counter++; } return S; }
has title: Computing time reduced after iterations
type: Question
has comment: http://stackoverflow.com/comment/38442006
tagged with: cpu-speed
has comment: http://stackoverflow.com/comment/38441757
has answer: http://stackoverflow.com/a/24773083
accepted answer: http://stackoverflow.com/a/24773083
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/24844302
has comment: http://stackoverflow.com/comment/38576005
accepted answer of: http://stackoverflow.com/q/24844261
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24844261
has body: Yes, but you need to install your first project locally: mvn install:install-file \ -Dfile=&lt;path-to-file&gt; \ -DgroupId=&lt;group-id&gt; \ -DartifactId=&lt;artifact-id&gt; \ -Dversion=&lt;version&gt; \ -Dpackaging=jar Setting up NetBeans to use a project as a dependency isn't the same thing as having a Maven artifact you can use in other Maven projects; for Maven, you need to have it in a Maven repo.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38632255
type: QuestionComment
comment on: http://stackoverflow.com/q/24867666
has text: I tried as you mentioned,now sometimes it loads the image and sometime not, i do not understand why
score: 0
type: Comment

http://stackoverflow.com/q/24857236
has comment: http://stackoverflow.com/comment/38601239
has comment: http://stackoverflow.com/comment/38601227
has comment: http://stackoverflow.com/comment/38601322
has answer: http://stackoverflow.com/a/24857317
has comment: http://stackoverflow.com/comment/38601326
has body: I am trying to draw some rectangles in java using eclipse and calling the draw() method gives me an error. Is there something I am missing here? import java.awt.Rectangle; public class UsingRectangle { public static void main(String[] args) { Rectangle box1 = new Rectangle(0, 0, 20, 30); //error "The method draw() is undefined for the type Rectangle" box1.draw(); } } Any help would be more than appreciated. Thank you.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24857277
has answer: http://stackoverflow.com/a/24857321
type: Question
has comment: http://stackoverflow.com/comment/38601253
has title: Do we have to import something to use draw()?
tagged with: java
linked to: http://stackoverflow.com/q/15103553
tagged with: draw
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38601531

http://stackoverflow.com/a/24854969
score: 5
type: Answer
has body: Say you have a file, you can write to it and not close the resource and eventually it will be closed by the GC. The problem is that while the file is open you can't delete it in windows, and in Linux you can delete it but it doesn't free any space. If you want to delete a file you don't want to be waiting until the GC feels like running perhaps hours later.
upvote count: 5
answers question: http://stackoverflow.com/q/24854927
downvote count: 0

http://stackoverflow.com/comment/38587789
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24850110
type: AnswerComment
has text: Ok, I've copied the code to onUpdate. Now, if I leave app by home button - i return to activity and checkbox still in place. But when I go back and to settings again - checkbox disappears.

wireshark
tags question: http://stackoverflow.com/q/24842412
type: Tag
tag name: wireshark

http://stackoverflow.com/q/24760488
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/24760980
tagged with: jsp
has body: I have 2 set of data in my jsp page , one is a array list and another is json data . Now i want to parse both the data set and create my own drop downs . Here is the sample Array List named json_obj data ["ABC-1","ABC-2","ABC-3","ABC-4","ABC-5","ABC-6"] I tried this piece of code but not working All <c:forEach var="strategy" items="${json_obj}" varStatus="strategyLoop"> <c:out value="${strategyLoop[index]}"/> </c:forEach> Getting blank options All Also I do have this piece of json data named json_obj_m {"a":"1050","b":"1079","c":"1073","d":"1074"} And I a=have tried this : <c:forEach items="${json_obj_m}" var="met"> ${met.value} </c:forEach> But not working again getting error , that spring does not support key . Can anybody guide me where I am doing mistake, very new to Java/Spring . Thanks in advance.
has comment: http://stackoverflow.com/comment/38418367
score: 0
linked to: http://stackoverflow.com/q/20756970
has title: how to parse array list data and json data in jsp
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38418468
has comment: http://stackoverflow.com/comment/38418599
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/1688099
has comment: http://stackoverflow.com/comment/38418558
type: Question
has answer: http://stackoverflow.com/a/24762022

http://stackoverflow.com/comment/38638061
has text: hem , no one , in fact i don't know what are you talking about , i have searched and i ound that it has something to do with maven but i couldn't understund , please explain to me .
type: QuestionComment
comment on: http://stackoverflow.com/q/24876560
score: 0
type: Comment

http://stackoverflow.com/comment/38748668
type: Comment
type: QuestionComment
has text: Basically because the jobs that are executed on the nodes need to read from files. The data segments I mentioned are basically just different files and it's better if a node reads from the same file again and again since the contents will get cached. The only processing that is done is filtering so a node will read a file and throw out lines that don't match the filter criteria but send others through a socket to the aggregator. We don't want intermediate results being written to files with added latency. I hope this makes sense.
comment on: http://stackoverflow.com/q/24892962
score: 0

http://stackoverflow.com/q/24895362
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38673420
favorite count: 0
has answer: http://stackoverflow.com/a/24895565
tagged with: linux
has comment: http://stackoverflow.com/comment/38673467
type: AnsweredQuestion
tagged with: netbeans
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38673847
has comment: http://stackoverflow.com/comment/38673645
upvote count: 1
has comment: http://stackoverflow.com/comment/38674063
accepted answer: http://stackoverflow.com/a/24895565
type: Question
has body: I have a JAVA GUI project in netbeans (with palette) ... The main folder is "ImageBrowser". It has these foldrers "build", "dist", "nbproject", "src", and these files "build.xml", "manifest.mf". Into the folder "src" there are the foldrers "Icons", "ImageBrowser" Into the "Icons" I have a picture, and in "ImageBrowser" are the sources. FIRST PROBLEM Inside the source code I use : ImageIcon icon = new ImageIcon("src/Icons/my_photo_name.jpg"); labelImage.setIcon(icon); Take a good look at the directory "src/Icons/my_photo_name.jpg" I ensure you that when I run the project from netbeans, the program shows the "my_photo_name.jpg", whith no problems. When I make the jar (I made it in netbeans in Linux) and run it in windows7, the program DO NOT SHOW the "my_photo_name.jpg", obviouly it cannot find it ! Can you tell me why ? SECOND PROBLEM When I run the jar in Linux terminal it sais: Exception in thread "main" java.lang.UnsupportedClassVersionError: ImageBrowser/Main : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) Could not find the main class: ImageBrowser.Main. Program will exit. I will ensure you that from project proprties i have defined the main class.... Anyone who help me, he will save me !! Thanks in advance !
linked to: http://stackoverflow.com/q/9290848
has comment: http://stackoverflow.com/comment/38673854
has title: Some Problems in Java & Netbeans
has comment: http://stackoverflow.com/comment/38692440
has comment: http://stackoverflow.com/comment/38673824

http://stackoverflow.com/q/24783402
score: 0
tagged with: android-relativelayout
answer count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/38462939
has body: So I am programmatically adding buttons to an already existing RelativeLayout. I get a fatal error where running this code without any error message. My android app doesn't even open. Though when I take out the if/else below it works fine. Am I not allowed to use an if statement to populate a layout or am I implementing this the wrong way? *Note that below code is only pseudo code. Everything works as expected when the if/else is commented out **edit adding full code and logcat protected void onCreate(Bundle savedInstanceState) { //load main screen super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RelativeLayout relativeLayoutTop = (RelativeLayout)findViewById(R.id.RelativeLayout1); boolean bool = getBool(); if(bool) { //some parameters for the sign in button RelativeLayout.LayoutParams button1Param = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); //make the new button and set attributes Button button1 = new Button(this); button1.setText("b1"); button1.setLayoutParams(button1Param); button1.setId(1); //create an on click listener to start the activity button1.setOnClickListener(new OnClickListener() { //on click execute activity @Override public void onClick(View v) { startActivity(new Intent(v.getContext(), FirstActivity.class)); } }); } else { //some parameters for the status button RelativeLayout.LayoutParams statusParam = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); ToggleButton buttonStatus = new ToggleButton(this); buttonStatus.setText("Status"); buttonStatus.setLayoutParams(statusParam); buttonStatus.setId(2); relativeLayoutTop.addView(buttonStatus); } } Log is here: 07-16 10:33:52.900: E/AndroidRuntime(1648): FATAL EXCEPTION: main 07-16 10:33:52.900: E/AndroidRuntime(1648): Process: shout.locate, PID: 1648 07-16 10:33:52.900: E/AndroidRuntime(1648): java.lang.RuntimeException: Unable to star…
has title: Programmatically adding different buttons to RelativeLayout using if()
has comment: http://stackoverflow.com/comment/38462087
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24783487
tagged with: java
has comment: http://stackoverflow.com/comment/38461466
tagged with: programmatically-created
type: Question
has comment: http://stackoverflow.com/comment/38461414
has comment: http://stackoverflow.com/comment/38461408

http://stackoverflow.com/q/24829706
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24830277
has comment: http://stackoverflow.com/comment/38549414
has comment: http://stackoverflow.com/comment/38548922
type: Question
has title: maven multi module dependency version
has answer: http://stackoverflow.com/a/24830277
has comment: http://stackoverflow.com/comment/38548770
has comment: http://stackoverflow.com/comment/38548887
upvote count: 2
has comment: http://stackoverflow.com/comment/38549357
answer count: 1
tagged with: jar
has body: I have a multi-module maven project: Module A depends on Module B. When Module B is built it is named ModuleB.jar and copied to target directory. Now in Module A's pom I have to put com.mycompany.app <artificatId>ModuleB 1.0 I have to put the version number, but then now I have two same Module B jars: ModuleB.jar (no version in name) and ModuleB-1.0.jar along with ModuleA.jar in the target directory. I prefer to keep the version number out from the jar's final names since we have other legacy apps depending on these jars Is there anyway to add Module B as a dependency in Module A's pom without the version number? Any clean solutions at all or am I just making life difficult for myself? EDIT: To clarify: These modules are built from a parent pom as jars and are copied, along with their dependencies, to a target directory outside of the project's parent directory. Hence the reason why there are two ModuleB jars: one when Module B is compiled and packaged with the finalname set as ModuleB.jar and one when Module A is compiled and packaged along with its dependencies, which includes Module B but with the name ModuleB-1.0.jar Thanks! The copy-dependency execution (I could strip out the version during the copy but then I would lose versions on 3rd party jars such as Spring jars =/ ): org.apache.maven.plugins maven-dependency-plugin 2.8 copy-dependencies package copy-dependencies ${build.dir}/lib true false
tagged with: maven-3
favorite count: 0
has comment: http://stackoverflow.com/comment/38549088
tagged with: maven

http://stackoverflow.com/q/24750619
has body: I'm using Hibernate search first time. When I'm trying to add Analyzer, I get the compile time error - incompatible types: java.lang.Class<org.apache.lucene.analysis.core.WhitespaceTokenizerFactory> cannot be converted to java.lang.Class<? extends org.apache.solr.analysis.TokenizerFactory> As the error shows, I tried adding solr-core jar too as below, but seems it also doesn't contain the specified class: org.apache.solr solr-core 4.8.0 Here is my entity class: import org.apache.lucene.analysis.core.LowerCaseFilterFactory; import org.apache.lucene.analysis.core.WhitespaceTokenizerFactory; import org.apache.lucene.analysis.ngram.NGramFilterFactory; import org.hibernate.search.annotations.Analyzer; import org.hibernate.search.annotations.AnalyzerDef; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Indexed; import org.hibernate.search.annotations.Parameter; import org.hibernate.search.annotations.TokenFilterDef; import org.hibernate.search.annotations.TokenizerDef; @Entity @Table(name = "hk_system_message_info") @Indexed @AnalyzerDef(name = "myanalyzer", tokenizer = @TokenizerDef(factory = WhitespaceTokenizerFactory.class), filters = {@TokenFilterDef(factory = LowerCaseFilterFactory.class), @TokenFilterDef(factory = NGramFilterFactory.class, params = { @Parameter(name = "maxGramSize", value = "1024") })}) public class HkMessageEntity implements Serializable { ... } The dependency which I've added for hibernate-search (Note: Other hibernate dependencies are added as per requirement, this is for search only): org.hibernate hibernate-search-orm 4.5.1.Final Hibernate-Analyzer was added automatically with this so I didn't add it separately. I've no idea why the FilterFactory classes are not found in hibernate search jar. Also, I know at the back end, Hibernate uses Apache Lucene search. I saw in the source code too and WhitespaceTokenFactory extends TokenFactory class and still this error is shown. Is there any other dependency that ne…
score: 1
tagged with: java
tagged with: hibernate
type: Question
tagged with: hibernate-search
answer count: 1
tagged with: lucene
has title: compile time Error in Analyzer in hibernate search
favorite count: 0
has answer: http://stackoverflow.com/a/24800185
upvote count: 2
type: UnansweredQuestion
tagged with: solr
has comment: http://stackoverflow.com/comment/38410088
downvote count: 1

http://stackoverflow.com/comment/38637614
score: 0
has text: OK I got it your point. Let me update it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24876323

http://stackoverflow.com/q/24766216
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/45680495
tagged with: java
tagged with: database
type: Question
has comment: http://stackoverflow.com/comment/38428899
has comment: http://stackoverflow.com/comment/38428978
has title: Checking Database Server Status with Java
accepted answer: http://stackoverflow.com/a/24766261
downvote count: 0
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38428932
upvote count: 2
tagged with: sockets
has body: I want to check the online/offline status about a Database Server with Java. Can I check this with a Socket connection over the port? I want to do this wihtout a Database connection with jdbc because the login and Database system info is unknown.
tagged with: status
possible better answer: http://stackoverflow.com/a/24766421
has answer: http://stackoverflow.com/a/24766261
has answer: http://stackoverflow.com/a/24766421

http://stackoverflow.com/q/24752840
tagged with: hashcode
has comment: http://stackoverflow.com/comment/38403804
has answer: http://stackoverflow.com/a/24752897
tagged with: equality
has comment: http://stackoverflow.com/comment/38403857
possible better answer: http://stackoverflow.com/a/24752903
score: 0
has answer: http://stackoverflow.com/a/24752903
has comment: http://stackoverflow.com/comment/38403813
has comment: http://stackoverflow.com/comment/38403894
has comment: http://stackoverflow.com/comment/38403978
has body: I am studying Overriding hashCode() and equals(Object obj) methods of Object class. body of equals(Object obj) method in Object class is : public boolean equals(Object obj) { return (this == obj); } and hashCode() is native : public native int hashCode(); I have a class Test with overrided equals(Object obj) and hashCoe() : public class Test { public static void main(String[] args){ Test t1 = new Test(); Test t2 = new Test(); System.out.println("t1 toString() : " + t1.toString()); System.out.println("t1, Hex value of hashcode : " + Integer.toHexString(t1.hashCode())); System.out.println("t2 toString() : " + t2.toString()); System.out.println("t2, Hex value of hashcode : " + Integer.toHexString(t2.hashCode())); System.out.println(t1.equals(t2)); } @Override public int hashCode() { return 999; //hard coded value is just for testing } @Override public boolean equals(Object obj) { return (this == obj); } } Output of my Code is : t1 toString() : demo.Test@3e7 t1, Hex value of hashcode : 3e7 t2 toString() : demo.Test@3e7 t2, Hex value of hashcode : 3e7 false //why it is false why equals(Object obj) returns false in this case if both objects toString() returns the same reference ID (hashcode) [I am not sure if it compares hashcode or not]. What does == operator actually compare in case of objects? in this answer, answerer said that == that is, it returns true if and only if both variables refer to the same object, if their references are one and the same. How does it know that the variables refer to the same object???
accepted answer: http://stackoverflow.com/a/24752897
answer count: 4
has title: what does obj1 == obj2 actually compare
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38403791
tagged with: equals
tagged with: java
has answer: http://stackoverflow.com/a/36564373
has comment: http://stackoverflow.com/comment/38404149
type: Question
linked to: http://stackoverflow.com/q/7520432
tagged with: object
has comment: http://stackoverflow.com/comment/38403750
has answer: http://stackoverflow.com/a/24752907

http://stackoverflow.com/comment/38481286
has text: I think you're confusing the delta-time with FPS. The intention of the delta-time is to average out the time between updates so as to maintain the FPS at a steady rate. That is, the delta-time is variable and will constantly change between updates, but the FPS should be (as much as possible) constant. Don't see a single update a indication of the frame rate. Until you've done a complete second worth of updates, you won't know the frame rate...
score: 0
comment on: http://stackoverflow.com/q/24792667
type: Comment
type: QuestionComment

object
tags question: http://stackoverflow.com/q/24855928
tag name: object
tags question: http://stackoverflow.com/q/24814928
tags question: http://stackoverflow.com/q/24803595
tags question: http://stackoverflow.com/q/24780111
tags question: http://stackoverflow.com/q/24845255
tags question: http://stackoverflow.com/q/24788435
tags question: http://stackoverflow.com/q/24836988
tags question: http://stackoverflow.com/q/24750959
tags question: http://stackoverflow.com/q/24836854
tags question: http://stackoverflow.com/q/24815162
tags question: http://stackoverflow.com/q/24864964
tags question: http://stackoverflow.com/q/24807029
tags question: http://stackoverflow.com/q/24850675
tags question: http://stackoverflow.com/q/24897670
tags question: http://stackoverflow.com/q/24752840
tags question: http://stackoverflow.com/q/24773074
tags question: http://stackoverflow.com/q/24812684
tags question: http://stackoverflow.com/q/24855818
tags question: http://stackoverflow.com/q/24847569
tags question: http://stackoverflow.com/q/24769135
tags question: http://stackoverflow.com/q/24770160
tags question: http://stackoverflow.com/q/24817541
tags question: http://stackoverflow.com/q/24895111
tags question: http://stackoverflow.com/q/24902305
type: Tag
tags question: http://stackoverflow.com/q/24836402
tags question: http://stackoverflow.com/q/24853023

http://stackoverflow.com/comment/38461612
type: QuestionComment
has text: Is it a requirement to build a stand alone application? Why not a web based system?
score: 0
comment on: http://stackoverflow.com/q/24783001
type: Comment

http://stackoverflow.com/comment/38475643
comment on: http://stackoverflow.com/q/24790557
type: Comment
type: QuestionComment
has text: the easiest solution I can imagine is 2 nested loops
score: 0

http://stackoverflow.com/a/56483242
answers question: http://stackoverflow.com/q/24811229
has body: As was mentioned in other answers, the comparison needs to be against some property of a Person (age?). Assuming you make the comparison fix, a stream version of the for loop might look like the following: people.stream() .filter(p -&gt; p.getAge() &gt; 60.0) .forEach(p -&gt; System.out.println(p.toString());
type: Answer
score: 0

http://stackoverflow.com/comment/38666463
comment on: http://stackoverflow.com/a/24891530
score: 0
type: AnswerComment
type: Comment
has text: do you think using `SRC_ATOP` as Mode could i solve? now i try

http://stackoverflow.com/comment/38681603
has text: I've came up to this tutorial, quite easy to do my task. http://www.tech-recipes.com/rx/39256/add-dependencies-to-maven-pom-xml-file/
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24898805

http://stackoverflow.com/comment/38697035
score: 0
comment on: http://stackoverflow.com/q/24908020
type: QuestionComment
type: Comment
has text: Do you mean that I can't split number in such way? Should I use another approach?

http://stackoverflow.com/a/24888438
type: Answer
has body: "Operation is not permitted" That's pretty much explaining it. Applets are not allowed to change anything on the Client PC. Also they are not allowed to connect to other Hosts except the one they are started from.
downvote count: 1
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/24859507
has comment: http://stackoverflow.com/comment/38687072

http://stackoverflow.com/comment/38488867
has text: Yes, I have build.xml where I put my targets. I can provide examples if you need. Each target is one or two shell commands, calling external tool. Actually I needed this to be a NetBeans project because we (team I'm working in) want to run this tool with just one button, like other code. Also not all team-members feel comfortable with CLI, and the tool doesn't have any GUI.
type: QuestionComment
comment on: http://stackoverflow.com/q/24783127
score: 0
type: Comment

http://stackoverflow.com/comment/38417429
has text: @ChristopherWirt yup the sprite is 60 pixels wide and the arrows center is at 30 exactly at the center.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24759463

http://stackoverflow.com/comment/38520452
comment on: http://stackoverflow.com/q/24814474
type: Comment
type: QuestionComment
score: 1
has text: Consuming an event will only effect possible listeners that re yet to be called, so if first listener consumes the event, then no more registered listeners will be notified. This assumes that the processing of the event/listeners supports this functionality

http://stackoverflow.com/comment/38551986
type: Comment
type: QuestionComment
has text: how do i get the full stack trace sir ? because thats the only msg of exception i get on console
comment on: http://stackoverflow.com/q/24811004
score: 0

http://stackoverflow.com/q/24807998
downvote count: 1
accepted answer: http://stackoverflow.com/a/24809375
has body: I am using code: JSONArray jsonArray = new JSONArray(); jsonArray.put(1, "ADMIN"); jsonArray.put(2, "DATA"); JSONObject jsonObj = new JSONObject(); jsonObj.put("slice_roles", jsonArray); jsonObj.put("admin_slice", "10.143.229.238"); jsonObj.put("slice_address", "10.143.229.238"); String requestJson = jsonObj.toString(); The output requestJson I am getting is: [{"slice_roles":[\"ADMIN\",\"UI\"],"admin_slice":"10.143.229.238","slice_address":"10.143.229.238"}] I want to get: [{"slice_roles":["ADMIN","UI"],"admin_slice":"10.143.229.238","slice_address":"10.143.229.238"}] How can I achieve this?
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/38537583
possible better answer: http://stackoverflow.com/a/24808034
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38508823
has comment: http://stackoverflow.com/comment/38527827
type: Question
has answer: http://stackoverflow.com/a/24808034
score: 0
answer count: 2
upvote count: 1
has title: JSONArray putting the data with extra escape
has answer: http://stackoverflow.com/a/24809375

http://stackoverflow.com/comment/38625340
comment on: http://stackoverflow.com/q/24869679
has text: scp has -f and -t options, but they're not intended for end-user use. IIRC, scp the client application requests ssh-server-side invocations of scp with these options to send and receive individual files. (Note, I've made no attempt to verify my recollection.)
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/38700099
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24907854
type: Comment
has text: What kind of file are you trying to transfer?

http://stackoverflow.com/a/25043952
score: 0
has body: @user2057006 why do you want to run the tc file from a different workspace into this one? Even if you were to successfully loaf the Tc, running the transformation would still fail because none of the model projects referred in the Tc would be available in your new workspace. There are other ways of running multiple tcs like a composite tc or an ant build or the Transformrunner application. If you provide little more info about what you are trying to achieve, I will be able to help you
type: Answer
has comment: http://stackoverflow.com/comment/39589182
has comment: http://stackoverflow.com/comment/39716720
answers question: http://stackoverflow.com/q/24779127
has comment: http://stackoverflow.com/comment/39851346

google-app-engine
tags question: http://stackoverflow.com/q/24843521
tag name: google-app-engine
type: Tag
tags question: http://stackoverflow.com/q/24750600
tags question: http://stackoverflow.com/q/24781246
tags question: http://stackoverflow.com/q/24900129
tags question: http://stackoverflow.com/q/24816761
tags question: http://stackoverflow.com/q/24779092
tags question: http://stackoverflow.com/q/24873691
tags question: http://stackoverflow.com/q/24793380
tags question: http://stackoverflow.com/q/24832947
tags question: http://stackoverflow.com/q/24871543
tags question: http://stackoverflow.com/q/24861997
tags question: http://stackoverflow.com/q/24817697
tags question: http://stackoverflow.com/q/24877200
tags question: http://stackoverflow.com/q/24833297
tags question: http://stackoverflow.com/q/24848711
tags question: http://stackoverflow.com/q/24851520
tags question: http://stackoverflow.com/q/24845051

http://stackoverflow.com/comment/38555238
type: Comment
has text: and you run it while beeing logged in as Arios?
type: AnswerComment
comment on: http://stackoverflow.com/a/24832986
score: 0

http://stackoverflow.com/comment/38599239
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24854365
type: Comment
has text: yes i see it now. if the source of my event is one of thoes buttons, then it will turn text into an Integer, have converttoC method called on it, which will be placed back into the var num, yes? ^^ thank you Ryan J. also if you dont mind could you look at my methods. it seem that the logic there is also mixed up. it only turns my string into an int and give it back to me with a C of F attached to it. it is never actually ran through the formula.

http://stackoverflow.com/q/24826639
type: Question
has comment: http://stackoverflow.com/comment/38552489
has comment: http://stackoverflow.com/comment/38552565
tagged with: google-maps
has comment: http://stackoverflow.com/comment/38543194
has comment: http://stackoverflow.com/comment/38546995
has body: So I have my GoogleMap drawing one line, but no matter how I put it the following code just doesn't work at all. I feel like there is something I'm missing in the documentation or something, because this has been driving me crazy. Here is the code in question. store = new LocationStore(); store.readFromFile(getResources()); Iterator&lt;Path&gt; it = store.getPaths().iterator(); Map&lt;Long, LatLng&gt; points = store.getPositions(); while (it.hasNext()) { PolylineOptions line = new PolylineOptions().width(5).color(Color.RED).visible(true); List&lt;Long&gt; pointIds = it.next().getPoints(); for (Long id : pointIds) { line.add(points.get(id)); } map.addPolyline(line); } PolylineOptions line = new PolylineOptions(); line.add(new LatLng(33.3406000, -84.6105000)); line.add(new LatLng(33.4469000, -84.5103000)); map.addPolyline(line); From this I get only one line, the one at the bottom where I specifically define the LatLng. What am I missing? Path is just a holder for the id's for that path, as well as an id for the path. The following are the only things in it, along with some getters and setters: Long id; ArrayList&lt;Long&gt; points;
tagged with: google-maps-android-api-2
type: UnansweredQuestion
tagged with: android
has title: PolylineOptions not drawing in mass, Android GoogleMap
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38543146

http://stackoverflow.com/a/24780867
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24779092
type: Answer
accepted answer of: http://stackoverflow.com/q/24779092
downvote count: 0
score: 1
has body: I think you might have a serialization/deserialization problem for the key. To serialize a key into a websafe String, use KeyFactory.keyToString(key): Key key = entity.getKey(); String serializedKey = KeyFactory.keyToString(key); Later on, when you want to deserialize the key on the other servlet, you can use KeyFactory.stringToKey(string): Key deserializedKey = KeyFactory.stringToKey(serializedKey); Entity en = datastore.get(deserializedKey);

http://stackoverflow.com/a/24792727
has comment: http://stackoverflow.com/comment/38479680
has body: I think that the solution is use custom functions inside your custom class somthing like this could work // CLASS BEING IMPORTED public abstract class TouchableSpan extends ClickableSpan { // IMPLEMENT SET TAG FUNCTION HERE?? //COMMENT: YES, LIKE THIS: CAN BE ANY FUNCTION U LIKE private String myCustomVar; public String getMyVar(){ return this.myCustomVar; } public void setMyVar(String myVari){ this.myCustomVar = myVari; return; } } // CODE ON ACTIVITY TouchableSpan touchableSpan = new TouchableSpan() { @Override public void onClick(View widget) { this.setPressed(true); // GET TAG INFO HERE. BUT HOW? //COMMENT: LIKE THIS: String extravar = touchableSpan.getMyVar(); Log.d("TEST", extravar); } // SET TAG HERE? BUT HOW? COMMENT: NOT HERE. SEE BELOW private boolean mIsPressed; public void setPressed(boolean isSelected) { mIsPressed = isSelected; } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLACK); ds.bgColor = mIsPressed ? selectedHlColor : 0xffeeeeee; ds.setUnderlineText(false); } } //COMMENT: SET YOUR VARIABLE/TAG HERE: touchableSpan.setMyVar("HOLALA"); spannablesstringbuilder.setSpan(touchableSpan, index+2, index2, 0);
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24792353
type: Answer
answers question: http://stackoverflow.com/q/24792353
score: 2
downvote count: 0

http://stackoverflow.com/q/24908145
has title: Picocontainer 2.14.3 and AOP
has body: I'm trying to use AOP with picocontainer. so far I found in the documentation: http://picocontainer.codehaus.org/interception.html pico = new DefaultPicoContainer(); pico.as(INTERCEPT).addComponent(Apple.class, BraeburnApple.class); and then create the interceptor, but looking through the code, I cannot find the INTERCEPT property anywhere. as receives a Properties value, which pico implements in Characteristics class. anyone has a clue, or has implemented it before and knows how to keep with it? Thanks
tagged with: picocontainer
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24936885
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/30885957
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/38663153
type: Comment
type: QuestionComment
has text: @Braj No, I don't have. This is just a example, I'll have more rows. Do you have another suggestion of widget? I'm searching some examples in SmartGWT showcase. Thanks for attention.
comment on: http://stackoverflow.com/q/24889412
score: 0

http://stackoverflow.com/comment/65320574
comment on: http://stackoverflow.com/a/35254940
type: Comment
score: 0
has text: I do not see a definition for this "searchMenuItem"
type: AnswerComment

http://stackoverflow.com/comment/38456395
comment on: http://stackoverflow.com/q/24779771
type: QuestionComment
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57407/discussion-between-adi-and-nobalg).
type: Comment

http://stackoverflow.com/q/24806400
has body: 07-17 19:00:53.681: E/AndroidRuntime(7912): FATAL EXCEPTION: main 07-17 19:00:53.681: E/AndroidRuntime(7912): java.lang.NullPointerException 07-17 19:00:53.681: E/AndroidRuntime(7912): at java.io.StringReader.&lt;init&gt;(StringReader.java:47) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.text.HtmlToSpannedConverter.convert(Html.java:435) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.text.Html.fromHtml(Html.java:138) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.text.Html.fromHtml(Html.java:101) 07-17 19:00:53.681: E/AndroidRuntime(7912): at al.instantiateItem(HomeScreen.java:533) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:832) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.support.v4.view.ViewPager.populate(ViewPager.java:982) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.support.v4.view.ViewPager.populate(ViewPager.java:914) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:442) 07-17 19:00:53.681: E/AndroidRuntime(7912): at com.vserv.kasakusuk.HomeScreen.a(HomeScreen.java:444) 07-17 19:00:53.681: E/AndroidRuntime(7912): at ai.run(HomeScreen.java:401) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.os.Handler.handleCallback(Handler.java:615) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.os.Handler.dispatchMessage(Handler.java:92) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.os.Looper.loop(Looper.java:137) 07-17 19:00:53.681: E/AndroidRuntime(7912): at android.app.ActivityThread.main(ActivityThread.java:4921) 07-17 19:00:53.681: E/AndroidRuntime(7912): at java.lang.reflect.Method.invokeNative(Native Method) 07-17 19:00:53.681: E/AndroidRuntime(7912): at java.lang.reflect.Method.invoke(Method.java:511) 07-17 19:00:53.681: E/AndroidRuntime(7912): at com.andro…
has comment: http://stackoverflow.com/comment/38505059
tagged with: android
has comment: http://stackoverflow.com/comment/38505035
tagged with: proguard
downvote count: 2
accepted answer: http://stackoverflow.com/a/24855855
upvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38504787
type: Question
has title: Nullpointerexception due to proguard for java.io.StringReader
answer count: 1
has answer: http://stackoverflow.com/a/24855855
favorite count: 0

http://stackoverflow.com/comment/90767029
type: AnswerComment
has text: Where are you getting mClickConsumer on second line, if you please explain a little bit. rxAdapter.getPositionClicks().subscribe(mClickConsumer);
type: Comment
comment on: http://stackoverflow.com/a/44037121
score: 0

http://stackoverflow.com/q/24780480
has answer: http://stackoverflow.com/a/24780689
downvote count: 0
has answer: http://stackoverflow.com/a/24782373
tagged with: awt
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38460278
has title: GridBagLayout: How to set fixed column width?
has body: I've been trying to set fixed column width in the following code for ages...The thing is that when I add a label to the panel on the left, then the width is incremented automatically...and i Would like the column width to be fixed... Could anyone help me please?? This is the code: import java.awt.AWTException; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Panel; import java.awt.Point; import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; import java.util.Timer; import java.util.TimerTask; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.TargetDataLine; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.border.Border; import java.io.IOException; public class CurrentItem extends JPanel{ private static JFrame currentScreen; public CurrentItem(JFrame p) { Grid…
tagged with: swing
type: Question
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/38460566
score: 9
tagged with: gridbaglayout
answer count: 2

http://stackoverflow.com/comment/38697098
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24907829
type: AnswerComment
has text: debug your code, and you will see that your if condition does not work properly. The code I provided works properly and you get byte[] array of md5 hash.

http://stackoverflow.com/comment/38483567
type: QuestionComment
comment on: http://stackoverflow.com/q/24772651
has text: I don't understand. Your question says that you "want to shuffle only the unlocked elements and fix the locked elements." If you want to shuffle so "that no item remains in its original position", use `Collections.shuffle()` on the whole list.
score: 0
type: Comment

http://stackoverflow.com/comment/38578980
type: QuestionComment
comment on: http://stackoverflow.com/q/24845767
score: 0
has text: Yes. Seems the current consensus is that 4094 is not a big deal I'm happy with that... This is in the constructor of a class that is created pretty frequently so I'm trying to avoid bottlenecks
type: Comment

http://stackoverflow.com/q/24889564
has answer: http://stackoverflow.com/a/24889680
has comment: http://stackoverflow.com/comment/38662410
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38662310
possible better answer: http://stackoverflow.com/a/24889817
has body: I made a monitoring application using JAVA , it takes a udp stream carrying tv channels and displays them in one frame. The application has a lot of buttons and controls , like : disabling channels , mute , choose speaker , snapshots ... Now the problem is the customer wants to install it on a server but control it from a different computer (security purposes). what i mean is the application has to start and be processed on the server but the display and input has to be on the computer, the GUI needs to be shown on the other computer. I'm trying to stay away from having to do this manually through socket programming (if possible because) as i said there are so much controls in this . what would be the best or maybe easiest approach to this ? thank you
has comment: http://stackoverflow.com/comment/38662556
has title: Remotely controlling a java pplication
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24889817
accepted answer: http://stackoverflow.com/a/24889680
has comment: http://stackoverflow.com/comment/38662496

http://stackoverflow.com/comment/38694028
score: 0
type: Comment
has text: @亚历山大 This is not even a question he has no defined DTD schema so my answer is perfectly fine. I gave him my opinion and two possible approaches to his problem
comment on: http://stackoverflow.com/a/24905611
type: AnswerComment

http://stackoverflow.com/comment/51887110
type: Comment
has text: The above line should be add to proguard.txt. It has nothing to do with gradle builds
type: AnswerComment
comment on: http://stackoverflow.com/a/27644579
score: 0

http://stackoverflow.com/q/24903976
downvote count: 3
accepted answer: http://stackoverflow.com/a/24904769
upvote count: 1
has title: Spring classes hierarchy
type: Question
has comment: http://stackoverflow.com/comment/38690946
score: -2
has body: Spring architecture is self-explanatory, but I digging into depth of spring and trying to find spring class’s hierarchy like java collection hierarchy, all information like which is parent class which interfaces its implementing, up to child classes but I haven't found any suitable diagram or call hierarchy from which I can understand.
answer count: 1
has comment: http://stackoverflow.com/comment/38689907
has answer: http://stackoverflow.com/a/24904769
favorite count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/38689540
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38479595
type: AnswerComment
type: Comment
has text: If you want to go functional all the way, you can do predicates.values().stream.filter(predicate -> !predicate.test(t)) to get a stream of failed predicates.
score: 2
comment on: http://stackoverflow.com/a/24789095

http://stackoverflow.com/comment/38557168
score: 0
comment on: http://stackoverflow.com/q/24834050
type: Comment
type: QuestionComment
has text: just to clarify, A B and C are 1 dimensional points correct?

http://stackoverflow.com/comment/38581970
score: 0
comment on: http://stackoverflow.com/a/24847228
type: Comment
has text: When I typed variable that was different code in a different project
type: AnswerComment

http://stackoverflow.com/comment/42021141
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26641388
has text: What do you mean by "changing the app flow"? Remove the ActionBar?
type: AnswerComment

http://stackoverflow.com/comment/38446107
has text: still not correct, you should change it to `numRoot(n, sum)`
score: 1
comment on: http://stackoverflow.com/a/24775230
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24897717
score: 0
answer count: 1
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/38688643
has title: Spring controller returns text on ajax call?
tagged with: spring-mvc
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38684161
tagged with: java
has comment: http://stackoverflow.com/comment/38710642
type: Question
has body: I implement my first ajax call with jQuery. I typed such code: $('#hostelSearchFormButton').click( function(e) { $.ajax({ headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, url : '${hostelSearchAjaxUrl}', context: document.body, dataType: "json", data : $form.serialize(), type : "POST", cache: false, async: true, success : function(response) { if (response.status == 'FAIL') { for ( var val in errMessages) { var $errorLabel = $.find('#' + val + 'ErrorLabel'); $errorLabel.html(errMessages[val]); } } }, error : function(data) { console.log("data on fail " + data); } }); e.preventDefault(); return false; }); It successfully posts to my @Controller method but as a resonse I have HostelAjaxResponse returned as json string in browser. I only see string in browser! My method that handles ajax post. It's running ok but returns string: @RequestMapping(value = "/search", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") public @ResponseBody HostelAjaxResponse doSearch(@Valid @RequestBody HostelSearch hostelSearch, BindingResult bindingResult, Model model, HttpServletRequest request) { Now I get nothing when ajax call is running. In chrome's javascript console I see error Bad Request : POST http://localhost:8080/HostMe/hostel/search 400 (Bad Request)
has comment: http://stackoverflow.com/comment/38688676
has answer: http://stackoverflow.com/a/24901913
has comment: http://stackoverflow.com/comment/38687545
has comment: http://stackoverflow.com/comment/38687566

http://stackoverflow.com/comment/38618848
has text: Thanks for the reply Samik. I tried using invokeJExpression. I splitted my string with :: as delimiter and stored it in an array arr1. So I had `arr1[0]=concat(S1,S2),T1 arr1[1]=substr(S3,1,3),T2 arr1[2]=substr(S3,3,1),T3` Now I ran this trhough loop and again split this using , as my delimiter and stored into arr2. So my arr2 for arr1[0] was like this: `arr2[0]=concat(S1,S2) arr2[1]=T1` Now if I use InvokeJExpression, to what I shall assign the result to? I want my expression concat(S1,S2) to be processed and mapped to T1 which is in arr2[1] now. This is where I am stuck.
comment on: http://stackoverflow.com/a/24826214
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25044490
accepted answer of: http://stackoverflow.com/q/24896675
score: 0
type: AcceptedAnswer
type: Answer
has body: Turns out it had nothing to do with sorting, as adjusting the sorting only fixed the issue for some but not all. The problem was that I had overriden the hashCode method of the StudentCourses object and it was causing collisions when the Set was being populated from the StudentUser object. I fixed this and everything is good now.
answers question: http://stackoverflow.com/q/24896675

http://stackoverflow.com/comment/38698364
type: QuestionComment
has text: Darn!! I was not aware! Works like a charm now after using replaceAll();
type: Comment
comment on: http://stackoverflow.com/q/24908793
score: 0

http://stackoverflow.com/a/24827916
accepted answer of: http://stackoverflow.com/q/24786218
upvote count: 9
score: 9
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24786218
has body: I have found the answer: I have use two different socket, One for sending data through the port and another one to receive data from the same port. (two different Thread) but the first one should connect to that port and second one should bind to that port. and everything works well.
type: Answer

http://stackoverflow.com/comment/38422136
has text: Maybe you're storing a non `Serializable` object in your map.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24762397
type: QuestionComment

http://stackoverflow.com/a/27386784
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43365544
answers question: http://stackoverflow.com/q/24861983
upvote count: 1
has body: If you want to remove the component at index x: myPanel.remove(x); If you want to add a component instead of the one you've removed: myPanel.add(component c , x); Then you should repaint: myPanel.validate(); myPanel.repaint();

http://stackoverflow.com/q/24872982
has answer: http://stackoverflow.com/a/24878801
tagged with: intellij-idea
downvote count: 0
favorite count: 0
has body: m following The Nerd ranch guide to android development using Intellij and everything was smooth sailing until I came to the code challenge which required to use DateFormat instead of outputting a timestamp. I'm made my changes when I tried to compile I found my app crashed so I undo whatever changes I did to it to my last successful build but still my app crashed so I rebuilt the project and now I get this: Error:Internal error: (java.lang.NoSuchMethodError) com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V java.lang.NoSuchMethodError: com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V at com.android.sdklib.internal.project.ProjectProperties.parsePropertyStream(ProjectProperties.java:541) at com.android.sdklib.repository.local.LocalPlatformPkgInfo.createAndroidTarget(LocalPlatformPkgInfo.java:158) at com.android.sdklib.repository.local.LocalPlatformPkgInfo.getAndroidTarget(LocalPlatformPkgInfo.java:95) at com.android.sdklib.repository.local.LocalSdk.getTargets(LocalSdk.java:702) at com.android.sdklib.repository.local.LocalSdk.getTargetFromHashString(LocalSdk.java:722) at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidTarget(AndroidJpsUtil.java:375) at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidPlatform(AndroidJpsUtil.java:448) at org.jetbrains.jps.android.builder.AndroidPreDexBuildTarget.computeRootDescriptors(AndroidPreDexBuildTarget.java:110) at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.addRoots(BuildRootIndexImpl.java:72) at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.&lt;init&gt;(BuildRootIndexImpl.java:62) at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:76) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:198) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:113) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:133) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41) at java.util.concu…
has comment: http://stackoverflow.com/comment/38631307
has answer: http://stackoverflow.com/a/24897303
has comment: http://stackoverflow.com/comment/38631731
tagged with: android
accepted answer: http://stackoverflow.com/a/24873742
possible better answer: http://stackoverflow.com/a/24877703
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/24877703
type: AnsweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/38631479
type: Question
has title: Error:Internal error: (java.lang.NoSuchMethodError) affecting all my projects
tagged with: java
has answer: http://stackoverflow.com/a/24873742

http://stackoverflow.com/comment/38480678
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24793318
score: 0
has text: What have you actually tried? What type of input are you working with?

http://stackoverflow.com/a/24751182
accepted answer of: http://stackoverflow.com/q/24749593
type: Answer
answers question: http://stackoverflow.com/q/24749593
has comment: http://stackoverflow.com/comment/38404519
upvote count: 4
score: 4
type: AcceptedAnswer
has body: For a long time, Gradle Idea plugin allows you to expose the project language level to Idea via the idea/project element: apply plugin: 'idea' idea { project { languageLevel = '1.7' } } At the moment configuring per-module language level in a multi-module gradle project is difficult but seems to be possible if you care to write and debug gradle logic that will modify the generated XML file similar to this gradle forum topic. I think that GRADLE-2198 is the most relevant issue that will allow Idea (and other IDEs and tools) to easily determine the per-module language level. Please, vote for it.
downvote count: 0
has comment: http://stackoverflow.com/comment/63536266

http://stackoverflow.com/a/24800427
downvote count: 0
has comment: http://stackoverflow.com/comment/38495252
type: Answer
has body: As you can see in the Javadoc of ObservableSet, there is no such method. In fact, the method ObservableList::setAll is just a convenient "shortcut": Clears the ObservableList and add all elements from the collection. The common implementation ModifiableObservableListBase in JavaFX does a clear then an addAll: @Override public boolean setAll(Collection&lt;? extends E&gt; col) { beginChange(); try { clear(); addAll(col); } finally { endChange(); } return true; } The main advantage of having a setAll shortcut is that only one "big" change event (ListChangeListener.Change) is sent to the listeners. Better performance. In fact, you might want to extend com.sun.javafx.collections.ObservableSetWrapper with your own setAll but there will be no performance benefit since the event SetChangeListener.Change is an elementary change: m removed events, and n added events will be sent. So you have no other choice than: set.clear(); set.addAll(otherSet); or copy in a new set and assign: set = FXCollections.observableSet(otherSet);
accepted answer of: http://stackoverflow.com/q/24799125
upvote count: 4
answers question: http://stackoverflow.com/q/24799125
score: 4
type: AcceptedAnswer

http://stackoverflow.com/q/24753650
has answer: http://stackoverflow.com/a/25006868
score: 0
answer count: 1
tagged with: junit
type: UnansweredQuestion
tagged with: java
has title: Mocking javax.mail.message with jMock
tagged with: unit-testing
type: Question
has body: Following is the code that I am trying to use for mocking the javax.mail.Message. The message instance is passed to another method call getContent(Message message) which returns String instance. The code for this method is also given below. Calendar cal = Calendar.getInstance(); mockery.setImposteriser(ClassImposteriser.INSTANCE); final Message[] messages; List&lt;Message&gt; ms = new ArrayList&lt;Message&gt;(); ms.add(mockery.mock(Message.class, "m1")); ms.add(mockery.mock(Message.class, "m3")); messages = ms.toArray(new Message[10]); mockery.checking(new Expectations() { { allowing(messages[0]).getContentType(); will(returnValue("text/plain")); allowing(messages[1]).getContentType(); will(returnValue("html")); } }); String contentM1 = getPasswordResetJob().getContent(messages[0]); assertEquals("text/plain", contentM1); getContent() method code : log.info("Message content type::" + message.getContentType()); if (message.getContentType().contains("text/plain;") &amp;&amp; message.getContent() != null) { content = message.getContent().toString(); } else { content = getMultipartContent(message); } return content; The test case fails with this message. unexpected invocation: m1.getContent() expectations: allowed, already invoked 2 times: m1.getContentType(); returns "text/plain" allowed, never invoked: m3.getContentType(); returns "html" at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56) at org.jmock.Mockery.dispatch(Mockery.java:204) at org.jmock.Mockery.access$000(Mockery.java:37) at org.jmock.Mockery$MockObject.invoke(Mockery.java:246) at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27) at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36) at org.jmock.lib.legacy.ClassImposteriser$4.invoke(ClassImposteriser.java:137) at $javax.mail.Message$$EnhancerByCGLIB$$8abdf7fe.getContent(&lt;generated&gt;) at com.abc.scheduler.AbstractSchedulerJob.getMultipartContent(AbstractSchedulerJob.java:22…
tagged with: jmock

http://stackoverflow.com/q/24832229
tagged with: java
possible better answer: http://stackoverflow.com/a/65376899
upvote count: 9
has answer: http://stackoverflow.com/a/65376899
has answer: http://stackoverflow.com/a/24832279
tagged with: servlets
answer count: 3
type: AnsweredQuestion
downvote count: 0
favorite count: 0
score: 9
type: Question
accepted answer: http://stackoverflow.com/a/24832279
has body: I have some of the following imports defined like the following as shown in the image below. I am wondering, how can I eliminate "package javax.servlet.annotation does not exist" error. I am currently working on "Java Web" type of project in Netbeans 7.4. . Secondly, I believe , the above error is the reason behind my second error related to "WebServlet" which is shown in the image above (line #44). Please let me know how to fix this problem. Read some other posts like this one, but I believe they are not using Netbeans and not sure if I should update tomcat as mentioned in the post. The location of the servlet api jar file is as shown in the image below:
has answer: http://stackoverflow.com/a/71269092
has title: package javax.servlet.annotation does not exist

http://stackoverflow.com/a/24757664
type: Answer
answers question: http://stackoverflow.com/q/24757542
has body: Your attribute names don't match. The attribute you set is called turving. The one you are requesting is called turvingen.
score: 0

http://stackoverflow.com/comment/38457914
type: AnswerComment
has text: No, unless you program the whole flow yourself with controllers etc. but nothing in spring that can help you.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24775801

http://stackoverflow.com/comment/38654936
type: AnswerComment
score: 0
type: Comment
has text: Yes your are right.Probably it gets executed , but it does's recognize --seqs option than
comment on: http://stackoverflow.com/a/24884421

http://stackoverflow.com/comment/38639375
type: Comment
comment on: http://stackoverflow.com/a/24876108
has text: all new functions from java 8. if u r interested in, I would be more than happy to share you what I have figured out so far :)
type: AnswerComment
score: 0

http://stackoverflow.com/q/24795488
has comment: http://stackoverflow.com/comment/38510524
score: 3
duplicate of: http://stackoverflow.com/q/25650678
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/99183018
linked to: http://stackoverflow.com/q/25650678
type: Question
has body: I am writing a mixin to deserialize a string into javax.servlet.http.Cookie Mixin.java package a; import org.codehaus.jackson.annotate.JsonProperty; public abstract class MixIn { MixIn(@JsonProperty("name") String name, @JsonProperty("value") String value) { } } HelloWorld.java package b; import a.MixIn; ObjectMapper mapper = new ObjectMapper(); mapper.getDeserializationConfig().addMixInAnnotations(Cookie.class, MixIn.class); Cookie aCookie = mapper.readValue("{"name":"abc","value":"xyz"}", Cookie.class); It seems to provide "JsonMappingException: No suitable constructor found for type [simple type, class javax.servlet.http.Cookie]" error. Please do note that - Mixin is (has to be) defined as a separate class (NOT an inner class, not static) - Mixin and the class where its used are (have to be) in 2 different packages. I am using jackson 1.9.9
has answer: http://stackoverflow.com/a/40296622
tagged with: jackson
has title: Jackson Mixin not working for deserializing non-default constructor object
upvote count: 3
answer count: 2
tagged with: mixins
tagged with: deserialization
favorite count: 0
has answer: http://stackoverflow.com/a/25651130
type: UnansweredQuestion

http://stackoverflow.com/comment/38489017
score: 0
type: Comment
type: QuestionComment
has text: @AdrianShum I got to know that the jdbc connection is not getting closed and its going to wait. I need to know how to close the connection.
comment on: http://stackoverflow.com/q/24794570

http://stackoverflow.com/comment/38585520
comment on: http://stackoverflow.com/a/24849181
score: 0
type: AnswerComment
type: Comment
has text: @user2809564 , i updated code without LinearLayout and With place holde (android.hint).

http://stackoverflow.com/a/24872936
accepted answer of: http://stackoverflow.com/q/24872531
score: 40
answers question: http://stackoverflow.com/q/24872531
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/105975835
type: Answer
upvote count: 40
has body: As mentioned in the other answer: Methods will always be kept for backward compatibility, even if there are new, more "powerful" methods introduced. Concerning the use case for computeIfPresent: It may be hard to find an example that is small enough to not look contrived and still be convincing. In general, the intention of this method is to update an existing value in any form. One example could be a (constrained) word count: For a given set of words, one stores an initial count of 0 in the map. Then, a sequence of words is processed: Whenever one finds a word from the initial set, its count is increased by 1: import java.util.LinkedHashMap; import java.util.Map; public class ComputeIfPresentExample { public static void main(String[] args) { Map&lt;String, Integer&gt; wordCounts = new LinkedHashMap&lt;String, Integer&gt;(); String s = "Lorem ipsum dolor sit amet consetetur iam nonumy sadipscing " + "elitr, sed diam nonumy eirmod tempor invidunt ut erat sed " + "labore et dolore magna dolor sit amet aliquyam erat sed diam"; wordCounts.put("sed", 0); wordCounts.put("erat", 0); for (String t : s.split(" ")) { wordCounts.computeIfPresent(t, (k,v) -&gt; v+1); } System.out.println(wordCounts); } } (Of course, things like this could be solved differently, but this is a rather frequent task in one or the other form, and the new method allows a rather concise and elegant solution)

http://stackoverflow.com/q/24895096
type: Question
answer count: 2
score: 5
possible better answer: http://stackoverflow.com/a/24896643
tagged with: arrays
has answer: http://stackoverflow.com/a/24895206
has answer: http://stackoverflow.com/a/24896643
has comment: http://stackoverflow.com/comment/38672917
tagged with: string
has title: Algorithm to compare one array of strings to many array of strings
favorite count: 0
accepted answer: http://stackoverflow.com/a/24895206
has body: I am a bit stuck on this one problem in the current project I am working on: I want to take one ArrayList&lt;String&gt; (call it A) and compare it to many ArrayList&lt;String&gt;, making note of how many strings match in these array comparisons. Then, I want to order the multiple string arrays in order from most similar to least similar to A. Does anyone know any fast algorithms to do this? Not looking for code so much as algorithms, but I am working in Java. Thanks!
upvote count: 6
has comment: http://stackoverflow.com/comment/38673432
has comment: http://stackoverflow.com/comment/38674383
downvote count: 1
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/38673562

http://stackoverflow.com/a/24824077
score: 0
answers question: http://stackoverflow.com/q/24810675
type: Answer
has body: An Array with 2^31 Objects would consume about 17 GB memory... You schould store the data a Database.

http://stackoverflow.com/comment/38726895
type: Comment
has text: I don't care about two passwords that are equal having the same hash in the database. I can live with that. Therefore I am using PBKDF2.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24819215

http://stackoverflow.com/comment/38569248
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24840801
has text: It's simply that there are two "is-a" relationships in Java; `extends` and `implements`.
type: QuestionComment

http://stackoverflow.com/q/24758138
has body: I have a class called XxxPredicateFactory which return a single predicate or predicate combination. Something like this: Public class XxxPredicateFactory { public Predicate&lt;Abc&gt; create() { if (this) { return new HelloPredicate&lt;Abc&gt;(); } else if (that) { return new WorldPredicate&lt;Abc&gt;(); } else { return Predicates.or(new HelloPredicate&lt;Abc&gt;(), new WorldPredicate&lt;Abc&gt;()); } } } For the if and else if, it seems easy to test, but for the else part I am not quite sure how can I test this? How can I capture this situation?
has title: How to test a Google Guava Predicate factory kind of class
has comment: http://stackoverflow.com/comment/38415202
tagged with: guava
type: UnansweredQuestion
tagged with: predicate
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24763657
score: 0
tagged with: functional-programming
answer count: 1

http://stackoverflow.com/q/24767137
has body: I'm trying to run this on my tomcat with Jolokia installed. http://myserver/jolokia/read/Catalina:type=ThreadPool,name=*/ What I get is this {"error_type":"javax.management.RuntimeOperationsException","error":"javax.management.RuntimeOperationsException : Exception invoking method readBufSize","status":500,"stacktrace":"javax.management.RuntimeOperationsException: Exception invoking method readBufSize\n\tat org.apache.tomcat.util.modeler.BaseModelMBean.getAttribute(BaseModelMBean.java:197)\n\tat com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)\n\tat com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)\n\tat org.jolokia.handler.ReadHandler.getAttribute(ReadHandler.java:208)\n\tat org.jolokia.handler.ReadHandler.fetchAttributes(ReadHandler.java:158)\n\tat org.jolokia.handler.ReadHandler.fetchAttributesForMBeanPattern(ReadHandler.java:97)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:82)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:34)\n\tat org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:150)\n\tat org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:91)\n\tat org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:81)\n\tat org.jolokia.backend.BackendManager.callRequestDispatcher(BackendManager.java:196)\n\tat org.jolokia.backend.BackendManager.handleRequest(BackendManager.java:175)\n\tat org.jolokia.http.HttpRequestHandler.executeRequest(HttpRequestHandler.java:150)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:79)\n\tat org.jolokia.http.AgentServlet$3.handleRequest(AgentServlet.java:239)\n\tat org.jolokia.http.AgentServlet.handle(AgentServlet.java:200)\n\tat org.jolokia.http.AgentServlet.doGet(AgentServlet.java:183)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:621)\n\tat javax.servlet.http.HttpSer…
score: 0
answer count: 1
tagged with: jolokia
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/24811746
type: AnsweredQuestion
tagged with: jmx
has title: Jolokia crashes when response too big
type: Question
has answer: http://stackoverflow.com/a/24811746
tagged with: java

http://stackoverflow.com/comment/38566520
comment on: http://stackoverflow.com/q/24837703
score: 0
has text: What is `formData`? Is it valid JSON?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24880143
type: Question
has answer: http://stackoverflow.com/a/24880311
has comment: http://stackoverflow.com/comment/38644751
has body: Here is the problem: "Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit." Here is my solution. public class Solution { public int maxProfit(int[] prices) { int[] sell = new int[prices.length]; for(int i = 0; i&lt;prices.length; i++){ for(int j = 0; j&lt;i; j++){ sell[i] = Math.max(prices[i] - prices[j], sell[i]); } } int sellPrice = prices[0]; int day = 0; for(int i = 0; i&lt;prices.length; i++){ if(sellPrice &lt; prices[i]){ sellPrice = prices[i]; day = i; } } int buyPrice = prices[0]; for(int i = 0; i&lt;day; i++){ buyPrice = Math.min(buyPrice, prices[i]); } return sellPrice - buyPrice; } } I'm not sure if it work, which is not a problem now. The problem is, it always shows Runtime Error at Line 9: (int sellPrice = prices[0];) and Line 18: (int buyPrice = prices[0];) as "java.lang.ArrayIndexOutOfBoundsException: 0". So what's wrong with it? How to fix it? Thank you so much.
has answer: http://stackoverflow.com/a/24880291
answer count: 6
has comment: http://stackoverflow.com/comment/38644641
accepted answer: http://stackoverflow.com/a/24880212
linked to: http://stackoverflow.com/q/7086464
has answer: http://stackoverflow.com/a/24880248
possible better answer: http://stackoverflow.com/a/24880291
score: 1
has title: How to Fix the Runtime Error : java.lang.ArrayIndexOutOfBoundsException: 0
has comment: http://stackoverflow.com/comment/38645154
favorite count: 0
has answer: http://stackoverflow.com/a/24880512
has answer: http://stackoverflow.com/a/24949231
has comment: http://stackoverflow.com/comment/38644764
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38644753
has answer: http://stackoverflow.com/a/24880212
upvote count: 2
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/39529564
type: Comment
has text: To get the las stable version you have to checkout the commit that which is use generate the stable version in Jenkins. If you look in the jenkins build you can get information about the subversion commit that generate each run.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24842603

http://stackoverflow.com/q/24785927
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24787036
tagged with: java
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/24787036
tagged with: hadoop2
has title: Global variable or property in MapReduce?
score: 0
has body: I want to be able to set some sort of variable or flag in the map phase of my MR job that I can check after the job has completed. I think the best way to demonstrate what I want with some code: p.s I am using Hadoop 2.2.0 public class MRJob { public static class MapperTest extends Mapper&lt;Object, Text, Text, IntWritable&gt;{ public void map(Object key, Text value, Context context ) throws IOException, InterruptedException { //Do some computation to get new value and key ... //Check if new value equal to some condition e.g if(value &lt; 1) set global variable to true context.write(newKey, newValue); } } public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); Job job = Job.getInstance(new Configuration(), "word_count"); //set job configs job.waitForCompletion(true); //Here I want to be able to check if my global variable has been set to true by any one of the mappers } }
answer count: 1

http://stackoverflow.com/q/24886798
linked to: http://stackoverflow.com/q/1999437
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38656855
has comment: http://stackoverflow.com/comment/38657057
answer count: 2
has title: Hide a file using java
has answer: http://stackoverflow.com/a/24886963
linked to: http://stackoverflow.com/q/1294989
favorite count: 0
has comment: http://stackoverflow.com/comment/38665577
has comment: http://stackoverflow.com/comment/38697849
tagged with: swing
has answer: http://stackoverflow.com/a/24887002
has comment: http://stackoverflow.com/comment/38662080
has comment: http://stackoverflow.com/comment/38663936
has body: I created a file using File() in java in my swing application. How can i make it hidden in my directory.i heard of changing of some attributes but not clear in my beginner perspective. Please help. Thanks in advance. Hiding is done Thanks for the help. But the read &amp; write on a hidden file is having issue. Please Help. Can the hidden file be treated like that of ordinary file in write/read?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38656729
accepted answer: http://stackoverflow.com/a/24886963
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24887002
downvote count: 3

http://stackoverflow.com/q/24810479
tagged with: database
type: Question
answer count: 1
tagged with: push
score: 0
has answer: http://stackoverflow.com/a/26851755
has comment: http://stackoverflow.com/comment/38516772
tagged with: android
has title: Receive push notifications sent out within a certain range Parse
has comment: http://stackoverflow.com/comment/38513825
has body: I'm building a parse app and I want the user to be able to set the range in which they receive notifications from other users in. I know you can choose how far you want to send the notification with something like this // Find users near a given location ParseQuery userQuery = ParseUser.getQuery(); userQuery.whereWithinMiles("location", stadiumLocation, 1.0) // Find devices associated with these users ParseQuery pushQuery = ParseInstallation.getQuery(); pushQuery.whereMatchesQuery("user", userQuery); // Send push notification to query ParsePush push = new ParsePush(); push.setQuery(pushQuery); // Set our Installation query push.setMessage("Free hotdogs at the Parse concession stand!"); push.sendInBackground(); But if the user receiving these notifications has their receiving range set as .5 miles or something like that I dont wan't them to receive it. Is there anyway to make this happen? Ex: User A has a radius set to 1 mile and user B sends the message to everyone within 2 miles and User A is 1.5 miles away from User B so I don't want him to receive it. Ex: User A has a radius set to 1 mile and user B sends message to everyone within 2 miles and User A is .5 miles away from User B he will receive that message and notification. The second example is easy to implement its the first one that I'm not sure how to do.
has comment: http://stackoverflow.com/comment/38514320
tagged with: parse-platform
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/24893600
tagged with: serialization
has body: I am working on a lab for school and am stuck... my instructions tell me to do the following: In class LabSerialization: Add a method called serialize. It has no return value and two parameters: demo of type ListVsSetDemo and filename of type String Use a try with resource statement when you serialize the ListVsSetDemo instance Save the result in the file name specified In case of an exception print the message provided by the exception object What I am having an issue with is the second part how do you serialize the instance of ListVsSetDemo? here is my code package labSerialization; import java.awt.Color; public class LabSerialization{ public static void main(String[] args) { ListVsSetDemo demo = new ListVsSetDemo( new ColoredSquare(4, Color.RED), new ColoredSquare(6, Color.BLUE), new ColoredSquare(4, Color.RED), new ColoredSquare(8, Color.YELLOW)); //testDemo(demo); serialize(demo, Demo.ser); }; private static void testDemo(ListVsSetDemo demo) { System.out.println("List:"); System.out.println(demo.getListElements()); System.out.println("Set:"); System.out.println(demo.getSetElements()); } private static void serialize(ListVsSetDemo demo, String fileName){ } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38670085
answer count: 0
tagged with: java
type: Question
score: 0
has title: Serialization of an instance in a method
has comment: http://stackoverflow.com/comment/38670141

http://stackoverflow.com/q/24802841
has answer: http://stackoverflow.com/a/33607732
has body: I'm trying to develop a program in which I want to put a text-to-speech in french! I looked for FreeTTS but it doesn't work in French. Also I can't use a web service as Google Tranlate because my application does not access the Internet. Thanks
has comment: http://stackoverflow.com/comment/38499335
type: UnansweredQuestion
tagged with: text-to-speech
has comment: http://stackoverflow.com/comment/38497898
tagged with: java
upvote count: 1
downvote count: 1
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38498598
has comment: http://stackoverflow.com/comment/38498203
answer count: 1
has title: Is there a java library to synthetize a french voice (TTS)?
favorite count: 0

http://stackoverflow.com/q/24838931
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: boxlayout
type: Question
linked to: http://stackoverflow.com/q/7229226
has title: GUI, BoxLayout adding a panel
upvote count: 1
answer count: 1
has body: Studying BoxLayout and GUI in general. I want to place a panel on a frame. Later I'll add an identical panel and will test BoxLaoyout. But I can't understand why this code produces not a panel sized 200x400 but just a red point in the middle of the left side of the frame (with coordinates about (300,0)). public class View extends JFrame { public View(){ this.setPreferredSize(new Dimension(600, 600)); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.pack(); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); Border border = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.RED, Color.BLACK); JPanel p1 = new JPanel(); p1.setSize(200, 400); p1.setBorder(border); p1.setLayout(new BoxLayout(p1, BoxLayout.Y_AXIS)); panel.add(p1); this.add(panel); this.setVisible(true); } }
tagged with: layout-manager
favorite count: 0
has answer: http://stackoverflow.com/a/24838972
accepted answer: http://stackoverflow.com/a/24838972
tagged with: swing
has comment: http://stackoverflow.com/comment/38565866

gmail
type: Tag
tags question: http://stackoverflow.com/q/24849807
tags question: http://stackoverflow.com/q/24904888
tags question: http://stackoverflow.com/q/24894784
tag name: gmail

http://stackoverflow.com/comment/39276338
has text: I am sorry fot having forgotten to accept the answer.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24853780

http://stackoverflow.com/comment/38582123
score: 0
has text: @khmarbaise: note these are working test cases few weeks back. I added few dependencies (from other internal projects) in the pom files. Do you see any reason why that may be causing this problem?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24835576

http://stackoverflow.com/comment/38664000
type: Comment
has text: I understand what you are saying about the UI. But still doesn't managae to add the code without getting errors. runOnUiThread is unrecognized as well as runnable(). Is it possible that i'm missing something?
comment on: http://stackoverflow.com/a/24888055
type: AnswerComment
score: 0

http://stackoverflow.com/q/24904728
type: AnsweredQuestion
upvote count: 3
tagged with: swing
has comment: http://stackoverflow.com/comment/38691535
has answer: http://stackoverflow.com/a/24904902
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/24905312
tagged with: java
tagged with: jpanel
has body: enter code hereI am having the following problem. I am adding a two JPanels to one panel and add this finally to my TabbedPane. However, I want to make it scrollable, therefore I just make the Panel scrollable which just adds my scroller in the middle of the bar. Here is my example: public class Test extends JFrame { private static final long serialVersionUID = -4682396888922360841L; private JMenuBar menuBar; private JMenu mAbout; private JMenu mMain; private JTabbedPane tabbedPane; public SettingsTab settings = new SettingsTab(); private void addMenuBar() { menuBar = new JMenuBar(); mMain = new JMenu("Main"); mAbout = new JMenu("About"); menuBar.add(mMain); menuBar.add(mAbout); setJMenuBar(menuBar); } public void createTabBar() { tabbedPane = new JTabbedPane(JTabbedPane.TOP); JComponent panel2 = new JPanel(); tabbedPane.addTab("Test1", null, panel2, "Displays the results"); tabbedPane.addTab("Settings", settings.createLayout()); add(tabbedPane); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } private void makeLayout() { setTitle("Test"); setLayout(new BorderLayout()); setPreferredSize(new Dimension(1000, 500)); addMenuBar(); createTabBar(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } public void start() { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { makeLayout(); } }); } public static void main(String[] args) { Test gui = new Test(); gui.start(); } public class SettingsTab extends JPanel { public JPanel createLayout() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(table1()); panel.add(Box.createRigidArea(new Dimension(0,10))); panel.add(table2()); panel.add(Box.createRigidArea(new Dimension(0,10))); panel.add(new JScrollBar()); return panel; } public JPanel table1() { JPanel panel1 = new JPanel(); String[] columnNames = {"First Name", "Last Name"}; Object[][] data = {{"Kathy", "Smith"}, {"John", "Doe"}, {"Sue", "Black"}, {"Jane", "White"…
tagged with: jscrollbar
tagged with: jtable
possible better answer: http://stackoverflow.com/a/24904783
answer count: 3
has answer: http://stackoverflow.com/a/24904783
has comment: http://stackoverflow.com/comment/38691213
downvote count: 0
has comment: http://stackoverflow.com/comment/38691399
favorite count: 0
has answer: http://stackoverflow.com/a/24905312
has comment: http://stackoverflow.com/comment/38691725
has title: JPanel in JTabBar is not scrollable

http://stackoverflow.com/comment/38922875
comment on: http://stackoverflow.com/a/24787531
type: AnswerComment
score: 0
type: Comment
has text: I tried this and it worked flawlessly. Should be marked as correct.

http://stackoverflow.com/q/24845012
answer count: 1
has comment: http://stackoverflow.com/comment/38577453
tagged with: string
has comment: http://stackoverflow.com/comment/38580428
tagged with: infix-notation
has comment: http://stackoverflow.com/comment/38577343
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24845057
tagged with: postfix-notation
has comment: http://stackoverflow.com/comment/38577373
has comment: http://stackoverflow.com/comment/38577331
has comment: http://stackoverflow.com/comment/38579755
has comment: http://stackoverflow.com/comment/38577283
type: Question
has comment: http://stackoverflow.com/comment/38577384
tagged with: java
has body: i am trying to evaluating a postfix expression, i can do it for characters, but tried to do it this time with numbers and not just single digits. here is my code, package test; import java.util.Stack; public class EvaluatePostfix { public static int solution(String postfix){ Stack&lt;Integer&gt; stack = new Stack&lt;Integer&gt;(); int sum = 0; int val1 = 0; int val2 = 0; String[] str = postfix.split(" "); for(int i =0; i&lt;str.length; i++){ if(Character.isDigit(postfix.charAt(i))){ stack.push(Integer.parseInt(str[i])); System.out.println(stack.peek()); } else{ //System.out.println(stack.peek()); val1 = stack.pop(); val2 = stack.pop(); switch(str[i].charAt(0)){ case '+': stack.push(val1 + val2); sum += val2; break; case '-': stack.push(val1 - val2) ; sum -= val2; break; case '/': stack.push(val1 / val2) ; sum /= val2; break; case '*': stack.push(val1 * val2) ; sum *= val2; break; } //System.out.println(sum); } //System.out.println(stack.pop()); } return stack.pop(); } public static void main(String[]args){ String test = "10 20 30 * +"; //solution(test); System.out.println(solution(test)); } } i have 10, 20 as output it doesnt outputs 30 * + i also have an error which says the following, Exception in thread "main" java.lang.NumberFormatException: For input string: "*" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:449) at java.lang.Integer.parseInt(Integer.java:499) at test.EvaluatePostfix.solution(EvaluatePostfix.java:18) at test.EvaluatePostfix.main(EvaluatePostfix.java:60) i dont know why i have that error, i clearly check that str[i] is a digit, * is not a digit so why does it try to convert to a digit; Thanks
has comment: http://stackoverflow.com/comment/38577479
score: 0
has title: evaluating a postfix expression eg
tagged with: arrays

http://stackoverflow.com/q/24797274
accepted answer: http://stackoverflow.com/a/24949889
score: -2
possible better answer: http://stackoverflow.com/a/24950407
tagged with: http://stackoverflow.com/tag/r
has comment: http://stackoverflow.com/comment/38487885
answer count: 2
downvote count: 3
upvote count: 1
linked to: http://stackoverflow.com/q/7451716
favorite count: 0
has title: Operation on RList
has answer: http://stackoverflow.com/a/24950407
has body: I have the following code. public void rFun() { Rsession instance = RConnect.getInstance(); instance.eval("load(\".RData\")"); REXP x = instance.eval("xyz &lt;- c(10,20,30)"); try { System.out.println("xyz -&gt; "+x.asString()); } catch (REXPMismatchException e) { // TODO Auto-generated catch block e.printStackTrace(); } } I am creating an RList, but when I try to get the list in java it is displaying only the first value i.e. 10. How to get all the values of the list?
type: AnsweredQuestion
tagged with: list
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24949889

xml-dsig
tags question: http://stackoverflow.com/q/24833710
type: Tag
tag name: xml-dsig

http://stackoverflow.com/a/24783899
type: Answer
has comment: http://stackoverflow.com/comment/38586556
downvote count: 0
has comment: http://stackoverflow.com/comment/38497661
has comment: http://stackoverflow.com/comment/38505614
has comment: http://stackoverflow.com/comment/38555653
answers question: http://stackoverflow.com/q/24782699
score: 1
has body: I think @Schedule is used only for fixed cron-like timers, where the EJB container deploys a timer at EJB startup. You obviously need more dynamic scheduling connected with a JSF page. If you are running on a full Java EE 6 profile, why not use the TimerService with a Stateless Session EJB like this: @Stateless public class JobSchedulerBean { @Resource private TimerService timerService; // @PostConstruct public void initTimer() { // set initial timer ScheduleExpression sch = new ScheduleExpression(); // set cron expression into sch timerService.createCalendarTimer(sch, new TimerConfig("myTimer", false)); } public void rescheduleTimer(int interval) { // get timer from timer service for (Timer timer : timerService.getTimers()) { if (timer != null &amp;&amp; timer.getInfo().equals("myTimer")) { timer.cancel(); } } // schedule new timer, like in initTimer() method } @Timeout public void timeout(Timer timer) { // do the job } } EDIT: @ManagedBean(eager=true) @ApplicationScoped public class JobRunner { private ScheduledExecutorService scheduler; private static final int POOL_SIZE = 1; ScheduledFuture&lt;?&gt; runHandle; @PostConstruct public void init() { scheduler = Executors.newScheduledThreadPool(POOL_SIZE); // set initial expiry to 5 minutes after 5 minutes delay runHandle = scheduler.scheduleAtFixedRate(new MyJob(), 5, 5, TimeUnit.MINUTES); } @PreDestroy public void destroy() { scheduler.shutdownNow(); } public void reschedule(int newDelay) { // cancel old timer, but do not interrupt it runHandle.cancel(false); runHandle = scheduler.scheduleAtFixedRate(new MyJob(), newDelay, newDelay, TimeUnit.MINUTES); } } public class MyJob implements Runnable { public void run() { // do the job } }
has comment: http://stackoverflow.com/comment/38586538
has comment: http://stackoverflow.com/comment/38506017
accepted answer of: http://stackoverflow.com/q/24782699
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38505566
has comment: http://stackoverflow.com/comment/38486223
has comment: http://stackoverflow.com/comment/38502108
upvote count: 1

http://stackoverflow.com/comment/38523882
type: QuestionComment
comment on: http://stackoverflow.com/q/24796587
score: 0
has text: Hi everyone..The original code is posted . worldportsource.com/countries.php this link has 196 countries and also has link for each country(i am passing all the 196 links as String array to that method)Each link has port names of the corresponding country.. My goal is to print all the port names(il save in Database later) of all the 196 countries.
type: Comment

http://stackoverflow.com/comment/38409533
score: 0
comment on: http://stackoverflow.com/q/24750449
type: Comment
type: QuestionComment
has text: So kindly try to think about the different possibilities when someone asks for a help. There are many beginers like me who get stuck at times.They just need some insight to understand the concept.

http://stackoverflow.com/a/24807229
has body: try this expression ^GktAb_+[0-9A-Z]+.txt$
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24806421

http://stackoverflow.com/q/24830728
has body: I am curious about the differences between the JRE System Library and the Server Runtime. I am using Eclipse. I can see that both of these are added to the build path and that they are both pointed at the same location. JRE System Library [WebSphere Application Server V8.5 JRE] WebSphere Application Server v8.5 [WebSphere Application Server v8.5] When I expand these libraries, I see none of the same JAR's. And I can see that the first entry is loading most if it's JAR's from C:\Program Files\IBM\WebSphere\AppServer\java\jre\lib. I can see that the second is loading most if it's JAR's from C:\Program Files\IBM\WebSphere\AppServer\plugins. At first glance I would have assumed they would both be loading the same JAR's. What is the purpose of each of these libraries, and why are they loading different JAR's?
tagged with: buildpath
downvote count: 0
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24830798
accepted answer: http://stackoverflow.com/a/24830798
has title: JRE System Library vs Server Runtime
favorite count: 0

http://stackoverflow.com/comment/38581700
type: QuestionComment
comment on: http://stackoverflow.com/q/24817306
has text: Also, as a side note the particular section you reference in JLS 8 doesn't exist. Doesn't really seem to matter too much, though, as the bug remains.
score: 0
type: Comment

http://stackoverflow.com/a/24983159
has body: I am not JAAS proficient, but have a good understanding of the krb5 protocol, there is no way to retrieve the password from the kerberos ticket (TGT) as the internally the libraries does string2key() of the password, before verifying the user credentials and caching it. Also if your password is retrievable from the krb5 ticket, its not longer safe on the wire.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24786984

http://stackoverflow.com/a/24884828
score: 2
has body: interface Stuff { int getStuff(); } class B extends A implements Stuff { ... } class C2 extends C1 implements Stuff { ... } This should achieve what I think you want?! You may use a reference of the "common type" Stuff to accomodate references to B or C2: Stuff myA; if (...) myA = new B(); else myA = new C2(); myA.getStuff(); Or you can use A, but you'll have to cast in order to call getStuff: A myA; if (...) myA = new B(); else myA = new C2(); ((Stuff)myA).getStuff();
upvote count: 2
has comment: http://stackoverflow.com/comment/38653439
answers question: http://stackoverflow.com/q/24884733
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24884733
downvote count: 0
has comment: http://stackoverflow.com/comment/38653637
has comment: http://stackoverflow.com/comment/38657393
type: Answer

http://stackoverflow.com/comment/38673212
type: QuestionComment
has text: what is printed in the console?
score: 0
comment on: http://stackoverflow.com/q/24895040
type: Comment

http://stackoverflow.com/q/24892211
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24893699
tagged with: java
has body: I have some code I want to initialize in my web application. Before I used it as a @PostConstruct in one of my beans, but it didn't feel quite right to me. The place to initialize code in the life cycle, is in my opinion, after the servletcontext has initialized. That's why I wrote a listener class like this: public class MyServletContextListener implements ServletContextListener { @Autowired UserService userService; @Autowired RepairService repairService; @Override public void contextInitialized(ServletContextEvent sce) { // Maak een gewone gebruiker Address address1 = new Address("Bruul", "5", "2800", "Mechelen"); Person person1 = new Person("Jan", "Peeters", address1); Client client1 = new Client(person1, "jan.peeters@student.kdg.be", "jan"); // Maak een gewone gebruiker Address address2 = new Address("Zandstraat", "23", "3000", "Leuven"); Person person2 = new Person("Michel", "Van den Bergh", address2); Client client2 = new Client(person2, "michel.vandenbergh@gmail.com", "michel"); // Maak een repairer Address address3 = new Address("Nationalestraat", "5", "2000", "Antwerpen"); Person person3 = new Person("Wouter", "Deketelaere", address3); Repairer repairGuy1 = new Repairer(person3, "wouter.deketelaere@kdg.be", "jef", "Master"); repairGuy1.rate(4); // Maak een repairer Address address4 = new Address("Kleuterstraat", "1", "2500", "Lier"); Person person4 = new Person("Handy", "Man", address4); Repairer repairGuy2 = new Repairer(person4, "handy.man@handyman.com", "moeilijk", "Bachelor"); repairGuy2.rate(3); // add users and update een gebruiker met een nieuw wachtwoord try { userService.addUser(client1); userService.addUser(client2); userService.addUser(repairGuy1); userService.addUser(repairGuy2); userService.updatePassword(repairGuy1, "jef", "wouter"); userService.checkLogin(repairGuy1.getUsername(), "wouter"); } // ommitted code Now, this doesn't work, and I presume it's because I can't autowire my services so early in the lifecycle. I can't manually construct …
has answer: http://stackoverflow.com/a/24938355
accepted answer: http://stackoverflow.com/a/24938355
tagged with: autowired
type: Question
tagged with: servletcontextlistener
tagged with: servlets
score: 0
answer count: 2
has title: Using a service during context initaliatizon
tagged with: spring
possible better answer: http://stackoverflow.com/a/24893699

http://stackoverflow.com/a/35206928
has body: I tried the two other solutions mentioned here, but none of them worked for me. What worked for me was Java &gt; Editor &gt; Content Assist &gt; Advanced and checking Java Non-Type Proposals in the upper box. On a different installation, this also had to be checked in the lower area, but it worked in both eclipse installations.
upvote count: 8
has comment: http://stackoverflow.com/comment/79680819
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24841572
score: 8

http://stackoverflow.com/comment/38557304
score: 0
has text: If someone may be interested, this is how I converted my encrypted byte arrays to String and then back to bytes. `String encodedString = new String(Base64.encodeBase64(encryptData)); byte[] decodedBytes = Base64.decodeBase64(encodedString);`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24833607

image-processing
tags question: http://stackoverflow.com/q/24793318
tags question: http://stackoverflow.com/q/24801978
tags question: http://stackoverflow.com/q/24848073
type: Tag
tag name: image-processing

http://stackoverflow.com/comment/38499352
comment on: http://stackoverflow.com/q/24803148
score: 0
type: QuestionComment
has text: And what is the year? Current one? Also for a inter-year date interval, how to know the starting year? Is it previous one or current one (for example dec 31-jan 2)?
type: Comment

http://stackoverflow.com/comment/38555825
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24833106
has text: The cause is `java.lang.ClassNotFoundException`. Missing a jar from your deployment?
score: 0

http://stackoverflow.com/q/24862846
has comment: http://stackoverflow.com/comment/38617274
downvote count: 0
has body: I'm trying to connect to a MySql database from a test-app in Java. I have just followed a plain tutorial I found online. The code works (and compiles OK), but I cant log in to the db and fetch anything. Getting the error: 1: Error connecting to DB: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user '******'@'%' to database '*****_javaapp' java.lang.NullPointerException Why does Java add the '@', and the '%' symbols in the console? Is that why I cant log in? I am not able to modify priveliges on the db user. It's just set to "default" I guess by the ISP provider... I have discussed this '@' &amp; '%' issue with my friend, and I understand that these symbols are MySql syntax for "accept anything", but I still dont know what do to fix it as my MySql knowlede is limited.. If I modify some details in the db connection I sometimes get: 2: Error connecting to DB: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. java.lang.NullPointerException My code My Main class: package test; import java.awt.EventQueue; public class Main { private JFrame frame; /** * Launch the application. */ public static void main(String[] args) { // DB CONNECT DBConnect connect = new DBConnect(); connect.getData(); EventQueue.invokeLater(new Runnable() { public void run() { try { Main window = new Main(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Main() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 300, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } My connect class: package test; import java.sql.*; public class DBConnect { private Connection con; private Statement st; private ResultSet rs; public DBConnect() { try …
has comment: http://stackoverflow.com/comment/38617031
favorite count: 0
has answer: http://stackoverflow.com/a/26565238
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/26565238
has title: Java & MySql : Console adds '@'%' to db username
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24865881
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
linked to: http://stackoverflow.com/q/5016505
type: Question
has answer: http://stackoverflow.com/a/24865881
answer count: 2
has comment: http://stackoverflow.com/comment/38620276

http://stackoverflow.com/q/24762006
score: 0
tagged with: java
answer count: 3
tagged with: inputstream
tagged with: fileinputstream
has answer: http://stackoverflow.com/a/24762269
has title: print the binary data from a file in 16 bytes in each line using java?
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24762232
has body: I'm copying the code and the output as well I want to know why is it taking so much time to execute the program when provide larger data file as input. Please see through out the code and give me suggestions and try to execute. java Program: FileInputStream fis = new FileInputStream("rose.jpg"); //use your own binary file name DataInputStream dis = new DataInputStream(fis); try { byte buffer[] = new byte[16]; while((line = dis.read(buffer)) != -1) { for(int i = 0; i &lt; line; i++) { value = Integer.toHexString(0xFF &amp; buffer[i] | 0x100).substring(1); nextvalue = nextvalue+""+value; } if(a == 0) { incValue = nextvalue.substring(0, 32); System.out.println(incValue); } else { counter = counter + 32; incValue = nextvalue.substring(counter, counter + 32); System.out.println(incValue); } a++; output: ffd8ffe000104a464946000101020025 00250000ffdb00430002010101010102 01010102020202020403020202020504 04030406050606060506060607090806 0709070606080b08090a0a0a0a0a0608 0b0c0b0a0c090a0a0affdb0043010202 02020202050303050a0706070a0a0a0a 0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a each line of the output will have 16 bytes of values. Please, help me with this program what I have to modify and change so that program executes quickly.
has answer: http://stackoverflow.com/a/24762267
linked to: http://stackoverflow.com/q/4679746
has comment: http://stackoverflow.com/comment/38421430

http://stackoverflow.com/comment/104294685
has text: @Baker, believe me, that RxJava part shouldn't be there, the original post is the way to go
comment on: http://stackoverflow.com/a/24933117
type: AnswerComment
score: 2
type: Comment

http://stackoverflow.com/comment/38507268
has text: was it because its BufferedImage?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24807725

android-intent
tags question: http://stackoverflow.com/q/24757415
tags question: http://stackoverflow.com/q/24881262
tags question: http://stackoverflow.com/q/24775940
tags question: http://stackoverflow.com/q/24839030
tags question: http://stackoverflow.com/q/24758195
tags question: http://stackoverflow.com/q/24818649
tags question: http://stackoverflow.com/q/24897753
tags question: http://stackoverflow.com/q/24769228
tags question: http://stackoverflow.com/q/24856864
tags question: http://stackoverflow.com/q/24828472
tags question: http://stackoverflow.com/q/24813368
tags question: http://stackoverflow.com/q/24770151
tags question: http://stackoverflow.com/q/24804536
tags question: http://stackoverflow.com/q/24858178
type: Tag
tags question: http://stackoverflow.com/q/24783163
tags question: http://stackoverflow.com/q/24797587
tag name: android-intent
tags question: http://stackoverflow.com/q/24787958
tags question: http://stackoverflow.com/q/24863762
tags question: http://stackoverflow.com/q/24884669
tags question: http://stackoverflow.com/q/24822608
tags question: http://stackoverflow.com/q/24758584
tags question: http://stackoverflow.com/q/24886506

http://stackoverflow.com/comment/38494306
score: 1
comment on: http://stackoverflow.com/q/24800417
type: Comment
type: QuestionComment
has text: Look at [that](http://www.coderanch.com/t/482913/GUI/java/Tab-Key-Binding-JTextField) topic(advice of Rob Camick with `setFocusTraversalKeys(...)` works).

http://stackoverflow.com/q/24785315
has answer: http://stackoverflow.com/a/24802705
has comment: http://stackoverflow.com/comment/38466569
has comment: http://stackoverflow.com/comment/38465471
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24785512
has title: Why does this regex capture the excluded character?
type: Question
has answer: http://stackoverflow.com/a/24785528
has answer: http://stackoverflow.com/a/24785512
score: 0
has comment: http://stackoverflow.com/comment/38465525
tagged with: regex
answer count: 4
has body: I have a regex like this: (?:(\\s| |\\A|^))(?:@)[A-Za-z0-9]{2,} What I am trying to do is find a pattern that starts with an @ and has two or more characters after, however it can't start in the middle of a word. I'm new to regex but was under the impression ?: matches but then excludes the character however my regex seems to match but include the characters. Ideally I'd like for "@test" to return "test" and "test@test" to not match at all. Can anyone tell me what I've done wrong? Thanks.
has answer: http://stackoverflow.com/a/24785564
possible better answer: http://stackoverflow.com/a/24785528

http://stackoverflow.com/comment/38612239
has text: If you're setting them properly they'll still be there. Check for HTTP vs. HTTPS, some app servers use different sessions by default, but are configurable to share. If it's intermittent then I'd look for session replication-based timing issues if you're in a clustered environment. Without further information it's impossible to help; it's very unlikely there's an issue with session management itself if you're able to retrieve values intermittently--it's more likely there's a development, conceptual, or server-based issue.
comment on: http://stackoverflow.com/q/24859569
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38420552
has text: There's nothing that should prevent you from using a `List` like a stack. You'll need to post code to find the error.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24761716

http://stackoverflow.com/a/24771902
has body: Here's an example where a public field can make its class completely unreliable. An alternative private version can guarantee that its information is always valid, and is untouchable by undesirable actors. Public field class (insecure): class VeryImportantCounterPublic { public int currentCount; public VeryImportantCounterPublic(int initial_count) { currentCount = initial_count; } public void incrementCount() { currentCount++; } public int getCurrentCount() { return currentCount; } } Private field class (secure): class VeryImportantCounterPrivate { private int currentCount; public VeryImportantCounterPrivate(int initial_count) { currentCount = initial_count; } public void incrementCount() { currentCount++; } public int getCurrentCount() { return currentCount; } } Main: public class CounterTest { public static final void main(String[] ignored) { VeryImportantCounterPublic counter = new VeryImportantCounterPublic(3); counter.incrementCount(); counter.incrementCount(); counter.incrementCount(); //Should not be able to do this!! //But it's a public field, so you can :( counter.currentCount = -203847382; System.out.println("[PUBLIC] Current count is " + counter.getCurrentCount()); VeryImportantCounterPrivate counter2 = new VeryImportantCounterPrivate(3); counter2.incrementCount(); counter2.incrementCount(); counter2.incrementCount(); //Can't do this. Compiler error: //counter2.currentCount = -203847382; System.out.println("[PRIVATE] Current count is " + counter2.getCurrentCount()); } } Output: [PUBLIC] Current count is -203847382 [PRIVATE] Current count is 6 Full source: public class CounterTest { public static final void main(String[] ignored) { VeryImportantCounterPublic counter = new VeryImportantCounterPublic(3); counter.incrementCount(); counter.incrementCount(); counter.incrementCount(); counter.currentCount = -203847382; System.out.println("[PUBLIC] Current count is " + counter.getCurrentCount()); VeryImportantCounterPrivate counter2 = new VeryImportantCounterPriv…
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38439758
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24771825
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24771825
has comment: http://stackoverflow.com/comment/38439907
type: Answer

http://stackoverflow.com/q/24872633
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: jmx
has comment: http://stackoverflow.com/comment/39133508
tagged with: tomcat7
score: 2
answer count: 0
tagged with: java
type: Question
has title: jmx connection timeout exception tomcat 7
has body: My tomcat in production stopped all of a sudden, exception in console.out is java.net.SocketTimeoutException: Accept timed out jmxlisterner is enabled for tomcat, not sure what might have caused this , appreciate any advice on this. Here full stack trace. Jun 01, 2014 6:17:15 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 49114 ms Jul 21, 2014 11:19:17 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop WARNING: RMI TCP Accept-10001: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=10001] throws java.net.SocketTimeoutException: Accept timed out at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) at java.net.ServerSocket.implAccept(ServerSocket.java:530) at java.net.ServerSocket.accept(ServerSocket.java:498) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:388) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:360) at java.lang.Thread.run(Thread.java:744) Jul 21, 2014 11:19:58 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop WARNING: RMI TCP Accept-1099: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=1099] throws java.net.SocketTimeoutException: Accept timed out at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) at java.net.ServerSocket.implAccept(ServerSocket.java:530) at java.net.ServerSocket.accept(ServerSocket.java:498) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:388) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:360) at java.lang.Thread.run(Thread.java:744) Jul 21, 2014 11:20:02 AM org.apache.tomcat.util.net.JIoEndpoint$Acceptor run SEVERE: Socket accept failed java.net.SocketTimeoutException: Accept timed out at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.ac…

http://stackoverflow.com/comment/38561642
has text: @nihal - That is the syntax of Java. Like *stephen* says, internally, the Java Runtime and the compiler *understand* that you want to specify a group of integers when you do `int[]`. Internally all reference types are `Type extends <Object>`. So, they all get the properties of Object.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24836439

http://stackoverflow.com/a/24833761
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24833746
has body: You've got your assignments backwards! n = name; puts the value of name to n, not the other way around.
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24833746

http://stackoverflow.com/comment/38437435
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24770308
type: AnswerComment
has text: @OscarJunker Please edit your question to show both your layout files.

webm
tags question: http://stackoverflow.com/q/24801805
tag name: webm
type: Tag

http://stackoverflow.com/a/24889561
answers question: http://stackoverflow.com/q/24889469
upvote count: 3
has comment: http://stackoverflow.com/comment/38662646
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/38662784
has body: In order to use a key to search multiple categories, pass a vector as the key. java.util.Vector key = new Vector&lt;String&gt;() //could be Object key.add("myCo"); key.add("user@myCo.com"); key.add("2012"); key.add("04"); key.add("1"); vw.getAllDocumentsByKey(key, false);
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38662344
has comment: http://stackoverflow.com/comment/38662955
accepted answer of: http://stackoverflow.com/q/24889469

http://stackoverflow.com/a/24871540
score: 0
type: Answer
has body: When you declare your array with a size of 3, the array is created with null for each slot. Then, you try to call a method on null. This will return a Null Pointer Exception. You need to add objects (in this case SlotMachine) in the array that can have setPayoutRate() called on them. For example, you can declare your array as follow:
answers question: http://stackoverflow.com/q/24871492

http://stackoverflow.com/comment/38524811
type: QuestionComment
type: Comment
has text: Go to [google code](https://code.google.com/apis/console) and then revert to the old interface when they prompt you with the option. Then edit allowed IPs and include your ipv6 address.
comment on: http://stackoverflow.com/q/24816761
score: 0

http://stackoverflow.com/q/24801426
has comment: http://stackoverflow.com/comment/38497324
has body: I have a regex like this (which is thanks to you guys in a big way): (?&lt;=( |\\s|\\A|^))@(!)[\\w]{3,}+ ?[\\w]* Which works great however I now need to match one more case and I can't work out how to do it. I need to have a minimum of 3 chars after the @ which I've done but I also need toallow for a minimum of 3 chars, at least two before a space and one after however a space is optional. So I need to match these patterns: @tst @tst test @ts t How can I enforce a minimum of three chars if there's no space or a minimum of two chars, a space and then at least one more char? I can do it as two seperate expressions but I'm hoping it's possible to do it with one? Can anyone point me in the right direction.. Thanks. EDIT: Ok I think I've kind of achieved what I want with: (?&lt;=( |\\s|\\A|^))@{1}(([\\w]{3,}+ ?[\\w]*)|([\\w]{2,} {1}[\\w]{1,})) Is there a more efficient way or is this how it should be done?
has comment: http://stackoverflow.com/comment/38495561
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38495388
has comment: http://stackoverflow.com/comment/38497957
has answer: http://stackoverflow.com/a/24802809
favorite count: 0
accepted answer: http://stackoverflow.com/a/24801794
tagged with: regex
possible better answer: http://stackoverflow.com/a/24802809
has answer: http://stackoverflow.com/a/24801794
has title: Minimum amount of chars excluding space
type: AnsweredQuestion
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/24815176
has comment: http://stackoverflow.com/comment/38497794
score: 1
tagged with: java

http://stackoverflow.com/q/24803315
downvote count: 0
favorite count: 0
tagged with: xssf
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: apache-poi
possible better answer: http://stackoverflow.com/a/24804323
upvote count: 3
tagged with: excel
type: Question
score: 3
has body: I am reading an Excel sheet using POI's XSSF . The Excel sheet has thousands of rows of user information like user name, address, age, department etc. I can read and write the Excel sheet successfully but i want to locate empty/null cell's address and want to print it as result in another sheet example result what i want is: Empty cell : C5 Empty cell : E7 Empty cell : H8 Thanks and appreciate for discussions and replies.
has title: Results address of empty cell in Excel sheet using XSSF
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24807737
accepted answer: http://stackoverflow.com/a/24807737
has answer: http://stackoverflow.com/a/24804323

soa
type: Tag
tag name: soa
tags question: http://stackoverflow.com/q/24758598

http://stackoverflow.com/comment/38967173
has text: I am posting my DatabaseHelper class which load database from my asset folder may be that helps you.
comment on: http://stackoverflow.com/q/24751897
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24795817
type: Question
answer count: 1
downvote count: 0
has title: Mask some part of String
accepted answer: http://stackoverflow.com/a/24795956
has comment: http://stackoverflow.com/comment/38485295
score: 8
favorite count: 0
upvote count: 8
has body: I have phone no and email address. I dont want to show full information. So I am thinking mask some character using Regex or MaskFormatter. Input and desired result 1) 9843444556 - 98*******6 2) test@mint.com - t***@****.com I have achieved this with String loop. But exactly I want to this by using regex or mask. Would you please kindly inform it?
tagged with: regex
has comment: http://stackoverflow.com/comment/38485229
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24795956
tagged with: java
has comment: http://stackoverflow.com/comment/38485415
tagged with: mask

http://stackoverflow.com/q/24846636
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24853631
accepted answer: http://stackoverflow.com/a/24853631
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38588835
has body: I'm trying to set a default schema in my Hibernate mapping, like so: org.hibernate.ejb.HibernatePersistence store-data-0.0.4-SNAPSHOT.jar However, when I run a simple test query: @PersistenceContext private EntityManager manager; @Transactional public List<Person> listPeople() { return manager.createQuery("SELECT p FROM Person p", Person.class).getResultList(); } I get this: Invalid object name 'Person'. When I run a native query: manager.createNativeQuery("SELECT * FROM Store.Person", Person.class).getResultList(); Everything works fine. I'm running a SE application, using Spring. I have used the hibernate.default_schema in a Web App before, and it worked just fine. This is how I declare the entities mapping: Any thoughts?
has comment: http://stackoverflow.com/comment/38590957
score: 2
downvote count: 0
has title: Hibernate Default Schema not working
tagged with: spring
has comment: http://stackoverflow.com/comment/38588939
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/38829479
comment on: http://stackoverflow.com/q/24898684
score: 0
type: Comment
type: QuestionComment
has text: Read the system requirements at developer.android.com

http://stackoverflow.com/comment/39086028
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24846284
has text: @Omar Its upto you, in my specific case, I needed to specify the mime type at runtime, and I didn't want to have to run this filter last. So my solution worked for me, but for others, another solution may be better.

http://stackoverflow.com/q/24767693
has title: Regex matches with multiple patterns
has comment: http://stackoverflow.com/comment/38431766
tagged with: java
type: Question
has body: I'm trying to compile one Java Regex pattern but have that pattern look for 3 different matches. I've learned that I can do that using the pipe (|) but I'm having trouble with the actual syntax of the regex. I'm looking through XML data and trying to pull out 3 matches. The XML will look something like this: &lt;Element createdOn="1405358703367" updatedOn="1405358718804" url="http://www.someurl.com" /&gt; The regex I'm trying looks like this so far: ((?&lt;="url": ").*(?=")) | (createdOn="(\d)") | (updatedOn="(\d)") In the end I Need to get everything between the quotes in the XML (i.e. 1405358703367, 1405358718804, and http://www.someurl.com. I had the URL regex working on its own earlier, but there seems to be no matches being made. Thanks.
has comment: http://stackoverflow.com/comment/38431768
upvote count: 0
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38431748
has answer: http://stackoverflow.com/a/24767773
has comment: http://stackoverflow.com/comment/38431776
score: -2
tagged with: regex
has comment: http://stackoverflow.com/comment/38431951
accepted answer: http://stackoverflow.com/a/24767773
has comment: http://stackoverflow.com/comment/38431857
downvote count: 2
possible better answer: http://stackoverflow.com/a/24767812
has answer: http://stackoverflow.com/a/24767812
has answer: http://stackoverflow.com/a/24768313
type: AnsweredQuestion

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/24849042
type: Tag
tags question: http://stackoverflow.com/q/24866814
tags question: http://stackoverflow.com/q/24858744

http://stackoverflow.com/comment/38650191
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24881121
has text: @kamil I have used hsqldb DB, but switched to H2 so your solution works.

http://stackoverflow.com/q/24755207
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/54013314
has comment: http://stackoverflow.com/comment/38408873
score: 2
has body: I'm using Apache CXF 3.0.0 and Spring 4.0.3.RELEASE with jaxws:client tags in spring xmls to create clients. I occasionally encounter the deadlock pasted below when I'm initializing lazy "service" beans on different threads. The only information I could find was here and it stated that: The spring launcher and jaxws endpoint are both trying to access the spring beans map at same time. I have not found a solution so far. Any ideas? Found one Java-level deadlock: ============================= "Thread-14": waiting to lock monitor 0x000000001fb0c218 (object 0x0000000704f9f558, a java.util.concurrent.ConcurrentHashMap), which is held by "Thread-12" "Thread-12": waiting to lock monitor 0x00000000240d6d38 (object 0x00000007052ad1b0, a org.apache.cxf.bus.extension.Extension), which is held by "Thread-14" Java stack information for the threads listed above: =================================================== "Thread-14": at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingletonNames(DefaultSingletonBeanRegistry.java:286) - waiting to lock &lt;0x0000000704f9f558&gt; (a java.util.concurrent.ConcurrentHashMap) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:422) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:354) at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1057) at org.apache.cxf.bus.spring.SpringBeanLocator.getBeansOfType(SpringBeanLocator.java:145) at org.apache.cxf.bus.extension.ExtensionManagerBus.getExtension(ExtensionManagerBus.java:206) at org.apache.cxf.ws.policy.attachment.AbstractPolicyProvider.setBus(AbstractPolicyProvider.java:60) at org.apache.cxf.ws.policy.attachment.AbstractPolicyProvider.&lt;init&gt;(AbstractPolicyProvider.java:54) at org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider.&lt;init&gt;…
answer count: 0
tagged with: cxf
tagged with: java
tagged with: jaxb
type: Question
tagged with: deadlock
has comment: http://stackoverflow.com/comment/53992808
downvote count: 0
favorite count: 0
has title: CXF and Spring threads deadlock
has comment: http://stackoverflow.com/comment/38463936
upvote count: 2

http://stackoverflow.com/a/24759703
has comment: http://stackoverflow.com/comment/38416754
has comment: http://stackoverflow.com/comment/38416664
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: This smells like homework, but alright. Importing a large list of words and I need to create code that will recognize each word in the file. What do I need to do to get the program to read this file and to separate each word within that file? You need to... Read the file Separate the words from what you've read in ... I don't know what you want to do with them after that. I'll just dump them into a big list. The contents of my main method would be... BufferedReader File = new BufferedReader(new FileReader(LOC));//LOC is defined as class variable //Create an ArrayList to store the words List&lt;String&gt; words = new ArrayList&lt;String&gt;(); String line; String delimiter = "\t"; while ((line = File.readLine()) != null)//read the file { String[] wordsInLine = line.split(delimiter);//separate the words //delimiter could be a regex here, gotta watch out for that for(int i=0, isize = wordsInLine.length(); i &lt; isize; i++){ words.add(wordsInLine[i]);//put them in a list } }
answers question: http://stackoverflow.com/q/24759252
accepted answer of: http://stackoverflow.com/q/24759252
type: Answer
score: 1

http://stackoverflow.com/q/24806855
tagged with: log4j
possible better answer: http://stackoverflow.com/a/24896246
has title: Redirect Log4j to specific file
tagged with: logging
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24896246
has answer: http://stackoverflow.com/a/24909338
accepted answer: http://stackoverflow.com/a/24909338
has body: In a batch application that read and parse multiple files, the specifications ask me to output logs for each file separately. How can I do this? Example: for(File f : allFiles) { //TODO after this line all log should be output to "&lt;f.getName()&gt;.log" LOGGER.debug('Start processing '+f.getName()); // process the file by calling librairies (JPA, spring, whatever ...) LOGGER.debug('End processing '+f.getName()); } So that, if I have 3 files to process, in the end, I want to have 3 log files. What I have done so far is the following class. import org.apache.log4j.ConsoleAppender; import org.apache.log4j.FileAppender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; public final class LoggerHelper { /** * Functional logger */ private static final Logger LOGGER = Logger.getLogger("BATCH_LOGGER"); /** * Pattern for the layout of the logger */ private static final String PATTERN_LAYOUT = "%d{yyyy-MM-dd [HH:mm:ss]} %m%n"; /** * Constructor */ private LoggerHelper() { } /** * Initialize the loggers * * @param filename * the name of the file where the logs will be written * @throws IOException * if a problem occur when instantiate a file appender */ public static void initLoggers(String filename) throws IOException { // change functional appender LOGGER.removeAllAppenders(); LOGGER.addAppender(new FileAppender(new PatternLayout(PATTERN_LAYOUT), filename)); LOGGER.setLevel(Level.DEBUG); } /** * Get the batch logger * * @return the batch Logger */ public static Logger getLogger() { return LOGGER; } } But I have to replace all LOGGER calls with LoggerHelper.getLogger().debug(...). And with this solution, I can't log frameworks logs. for(File f : allFiles) { //TODO after this line all log should be output to "&lt;f.getName()&gt;.log" LoggerHelper.initLoggers(f.getName()); LoggerHelper.getLogger().debug('Start processing '+f.getName()); // process the file by calling librairies (JPA, spring, whatever ...) LoggerHelper.getLog…
tagged with: slf4j
score: 0
answer count: 2

http://stackoverflow.com/q/24836632
has answer: http://stackoverflow.com/a/24836657
score: 4
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
upvote count: 4
type: UnansweredQuestion
has title: Disable formatter in JSP Eclipse
downvote count: 0
tagged with: java
tagged with: eclipse
has body: How can I disable the eclipse formatter for JSP temporally, I know in java is somehing like: // @formatter:off // @formatter:on But &lt;!-- @formatter:off --&gt; Does not work.
type: Question
tagged with: jsp

http://stackoverflow.com/a/24847696
score: 0
has body: When I analysis the logs that ClassLoader.getResourceAsStream is returning null in the Windows 2008 server bot not in the Windows 7 machine. That is the documented behaviour in the case when a named resource cannot be found. I checked the windows file permission the tomcat webapp folder full control has given to the user which runs the tomcat server. What could be the reason for this. This is a tricky one. Here are some things to check: Is the path that you are using with "getResourceAsStream" correct? Does the resource pathname contain non-ASCII (or special) characters than might cause Windows pathname lookup to behave strangely? Has the webapp been successfully redeployed (i.e. has it been stopped and started) since you last changed the WAR file? Have you configured Tomcat to not expand the WAR file? If so, then the problem could be that the resource is no longer in the WAR file ... despite appearing in the (previously expanded) webapp directory. Is this a problem with "homoglyphs"; i.e. Unicode characters that are different but that look the same when you display them. Is it possible that a virus checker (or similar) is locking or removing the file?
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24847353
answers question: http://stackoverflow.com/q/24847353

http://stackoverflow.com/comment/39952576
type: QuestionComment
has text: You could check out [JavaCPP - Creating Callbacks Functions](https://github.com/bytedeco/javacpp#creating-callback-functions) for that. It would save you a lot of trouble.
score: 0
comment on: http://stackoverflow.com/q/24882809
type: Comment

http://stackoverflow.com/comment/38498486
type: Comment
has text: thanku so much , but in Karbon A21+ Dual Sim Phone, master slot is CDMA(Without Sim) and Slave slot is GSM (With Sim) though slave sim is active, it is returning as UNKNOWN.
comment on: http://stackoverflow.com/a/24802232
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38732943
type: Comment
has text: @Areks : i face same issue but as per your logic we have to implement load balancing on server side .
type: AnswerComment
comment on: http://stackoverflow.com/a/24827809
score: 0

http://stackoverflow.com/q/24805191
has comment: http://stackoverflow.com/comment/38502930
has title: setting a JFrame background, why this doesn't work?
linked to: http://stackoverflow.com/q/22744920
has comment: http://stackoverflow.com/comment/38502619
has comment: http://stackoverflow.com/comment/38502515
has comment: http://stackoverflow.com/comment/38502484
downvote count: 0
answer count: 1
has body: I want to set a background to my jFrame, and I'm using this code: import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JPanel; public class DemoBackgroundSwing extends JPanel { private Image img; public DemoBackgroundSwing() { System.out.println("done"); img = Toolkit.getDefaultToolkit().createImage("red.png"); System.out.println("done"); loadImage(img); System.out.println("done"); } private void loadImage(Image img) { try { MediaTracker track = new MediaTracker(this); track.addImage(img, 0); track.waitForID(0); } catch (InterruptedException e) { e.printStackTrace(); } } protected void paintComponent(Graphics g) { setOpaque(false); System.out.println("done"); g.drawImage(img, 0, 0, null); super.paintComponent(g); } public static void main(String... argv) { JFrame frame = new JFrame("Demo Background Image"); DemoBackgroundSwing back = new DemoBackgroundSwing(); System.out.println("done"); frame.getContentPane().add(back); frame.setSize(400, 287); frame.setVisible(true); } } when I execute it, in system out I have 5 "done". so this means that all tasks are executed. I don't understand where's the error. Please Help me!
linked to: http://stackoverflow.com/q/15302085
favorite count: 0
has comment: http://stackoverflow.com/comment/38502435
has answer: http://stackoverflow.com/a/24805279
upvote count: 2
has comment: http://stackoverflow.com/comment/38502408
has comment: http://stackoverflow.com/comment/38502395
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38502584
has comment: http://stackoverflow.com/comment/38502355
tagged with: java
tagged with: swing
accepted answer: http://stackoverflow.com/a/24805279
type: Question
linked to: http://stackoverflow.com/q/7196889
linked to: http://stackoverflow.com/q/3541373

http://stackoverflow.com/comment/38469835
type: Comment
type: QuestionComment
has text: That's strange, did you try adding -X -e to see more details?
score: 0
comment on: http://stackoverflow.com/q/24783044

http://stackoverflow.com/a/24751630
type: Answer
answers question: http://stackoverflow.com/q/24751495
score: 0
has body: Scanner fileIn = new Scanner(hours);//assign hours to array This line of code throws an expection FileNotFoundException. You have two option to solve this problem : 1) Catch the Exception Scanner fileIn = null; try { fileIn = new Scanner(hours); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }//assign hours to array 2) Throw the Exception: public static void main(String[] args) throws FileNotFoundException {

http://stackoverflow.com/q/24815197
downvote count: 0
has comment: http://stackoverflow.com/comment/38522098
has comment: http://stackoverflow.com/comment/38522143
favorite count: 0
has comment: http://stackoverflow.com/comment/38521776
upvote count: 2
type: UnansweredQuestion
tagged with: maven
tagged with: spring
score: 2
answer count: 0
tagged with: java
has title: Maven: dependency does not work as expected, is ignored in runtime
type: Question
has comment: http://stackoverflow.com/comment/38521733
has body: I am working with Maven and Spring Framework. I am creating many projects how modules, such as: domain services definitions (interfaces) services implementations repositories definitions (interfaces) repositories implementations factories More…... I have the ProductRepository interface within the package com.manuel.jordan.model.repository, it to be referenced from other module/project and therefore to be able to write the implementation, for example one based on Hibernate The pom.xml file for that project/module named 01CentralRepositoryCommonBasic has the following: com.manuel.jordan.centralrepository central-repository-common-basic jar 01CentralRepositoryCommonBasic 01 I have other project/module for Spring Data, it is named 01CentralRepositoryDataJpaBasic, there the project has the same interface definition (package and name), but according with Spring Data JPA, it has other content, such as: public interface ProductRepository extends JpaRepository<Product,Integer> { } The pom.xml file has the following: com.manuel.jordan.centralrepository central-repository-data-jpa-basic jar 01CentralRepositoryDataJpaBasic 01 Until here: two projects same package same interfaces names (i.e: ProductRepository) but different content. I have a third module/project named 01CentralServiceImplBasic, it implements services definitions (interfaces) and it mandatorily needs a repository interface. For example: @Transactional @Scope("prototype") @Service("productService") public class ProductServiceImpl implements ProductService { private ProductRepository productRepository; @Autowired public ProductServiceImpl(ProductRepository productRepository){ this.productRepository = productRepository; } Now my pom.xml com.manuel.jordan.centralservice central-service-basic 01 com.manuel.jordan.centralrepository central-repository-common-basic 01 Observe I use the central-repository-common-basic and not central-repository-data-jpa-basic, both has the same package and interface. In other module/proje…
has comment: http://stackoverflow.com/comment/38540244

http://stackoverflow.com/q/24862878
has comment: http://stackoverflow.com/comment/38611579
tagged with: integer
upvote count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/38611729
tagged with: java
score: -1
has title: Integer Arraylist to JTextArea
type: Question
has answer: http://stackoverflow.com/a/24863112
has body: How would I add an integer ArrayList to a JTextArea. I've tried using .append but it won't work because my ArrayList isn't a String ArrayList. What I'm trying to do is display the user inputted numbers that go into the arraylist into a textarea. private void btnAddActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: //mark string to int converstion String m = this.txtStudentMark.getText(); int mark = Integer.parseInt(m); //add new mark to list Collections.addAll(marks); marks.add(mark); // display marks StringBuilder sb = new StringBuilder(); for (int elem : marks){ sb.append(marks !=null ? marks.toString() : " "); } txtASort.setText(sb.toString());
answer count: 1
downvote count: 1
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38611600

http://stackoverflow.com/a/24863884
has comment: http://stackoverflow.com/comment/38613947
answers question: http://stackoverflow.com/q/24863864
has body: Yes, you need to escape the character with \ for Java to understand it: String quote = "\"";
has comment: http://stackoverflow.com/comment/38613875
type: AcceptedAnswer
score: 8
type: Answer
downvote count: 0
upvote count: 8
accepted answer of: http://stackoverflow.com/q/24863864

http://stackoverflow.com/q/24753355
answer count: 1
has body: I am trying to connect my Android device to MySQL DB which is running on MySQL Server. But I keep getting the error stated below. Can anyone please point me in the right direction here? LOGCAT 07-15 09:17:21.708: E/AndroidRuntime(19677): FATAL EXCEPTION: AsyncTask #1 07-15 09:17:21.708: E/AndroidRuntime(19677): java.lang.RuntimeException: An error occured while executing doInBackground() 07-15 09:17:21.708: E/AndroidRuntime(19677): at android.os.AsyncTask$3.done(AsyncTask.java:299) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 07-15 09:17:21.708: E/AndroidRuntime(19677): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.lang.Thread.run(Thread.java:841) 07-15 09:17:21.708: E/AndroidRuntime(19677): Caused by: java.lang.VerifyError: net/sourceforge/jtds/jdbc/TdsCore 07-15 09:17:21.708: E/AndroidRuntime(19677): at net.sourceforge.jtds.jdbc.JtdsConnection.&lt;init&gt;(JtdsConnection.java:359) 07-15 09:17:21.708: E/AndroidRuntime(19677): at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.sql.DriverManager.getConnection(DriverManager.java:179) 07-15 09:17:21.708: E/AndroidRuntime(19677): at java.sql.DriverManager.getConnection(DriverManager.java:213) 07-15 09:17:21.708: E/AndroidRuntime(19677): at com.example.rf.MainActivity.runSQL(MainActivity.java:110) 07-15 09:17:21.708: E/AndroidRuntime(19677): at com.ex…
has comment: http://stackoverflow.com/comment/38404788
tagged with: android
has title: Fatal exception: AsyncTask #1?
has comment: http://stackoverflow.com/comment/38404931
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38404970
type: Question
has answer: http://stackoverflow.com/a/24753520
has comment: http://stackoverflow.com/comment/38404856
score: 0
tagged with: sql

http://stackoverflow.com/comment/38453187
has text: Note that LinkedHashMap does not guarantee that 1 comes before 2 -- this will only happen if 1 is actually inserted *before* 2.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24774948

http://stackoverflow.com/comment/38544052
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24827205
type: QuestionComment
has text: you mean like whatsapp?

http://stackoverflow.com/comment/38450839
score: 2
has text: That isn't a legal Java source file. It doesn't contain a class, so it can't produce a .class file.
comment on: http://stackoverflow.com/q/24777867
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24803242
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can get the href attribute and use it. for (Element link : links) { String url = link.attr("href"); String result = url.split("-")[1].replace("/",""); System.out.println(result); }
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24802724
answers question: http://stackoverflow.com/q/24802724

http://stackoverflow.com/q/24822939
has answer: http://stackoverflow.com/a/38124009
has title: DropWizard Serving Assets help needed
possible better answer: http://stackoverflow.com/a/25156603
has answer: http://stackoverflow.com/a/24825478
tagged with: pom.xml
answer count: 4
type: AnsweredQuestion
has body: Help! I've been trying for hours, googling anything I could think of. I have a problem, that I would like to show my static content instead of my application on my site. I modified a simple hello-world application: public static void main(String[] args) throws Exception { Class.forName("org.sqlite.JDBC"); new HelloWorldApplication().run(args); } @Override public String getName() { return "hello-world"; } @Override public void initialize(Bootstrap&lt;HelloWorldConfiguration&gt; bootstrap) { bootstrap.addBundle(new AssetsBundle("/assets/*", "/")); } @Override public void run(HelloWorldConfiguration configuration, Environment environment) { final HelloWorldResource resource = new HelloWorldResource( configuration.getTemplate(), configuration.getDefaultName() ); final AddResource addResource = new AddResource(); final DeleteResource deleteResource = new DeleteResource(); final TemplateHealthCheck healthCheck = new TemplateHealthCheck(configuration.getTemplate()); environment.healthChecks().register("template", healthCheck); environment.jersey().register(resource); environment.jersey().register(addResource); environment.jersey().register(deleteResource); } Here's my hello-world.yml: server: type: simple applicationContextPath: /application/hello-world template: Hello, %s! defaultName: Stranger I applied everything, what the DropWizard docs (http://dropwizard.readthedocs.org/en/latest/manual/core.html#serving-assets) said. But I just cannot manage to reach the index.html
type: Question
accepted answer: http://stackoverflow.com/a/24825478
has answer: http://stackoverflow.com/a/46068636
upvote count: 5
tagged with: java
score: 5
tagged with: dropwizard
tagged with: yaml
has answer: http://stackoverflow.com/a/25156603
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/38402835
score: 1
has text: which version of spring are you using, and post your spring config
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24752088

http://stackoverflow.com/q/24855056
type: Question
has answer: http://stackoverflow.com/a/63311722
has answer: http://stackoverflow.com/a/24855109
tagged with: java
tagged with: overriding
has answer: http://stackoverflow.com/a/24855324
has answer: http://stackoverflow.com/a/24855425
has comment: http://stackoverflow.com/comment/111953354
linked to: http://stackoverflow.com/q/370962
linked to: http://stackoverflow.com/q/610458
has comment: http://stackoverflow.com/comment/38597324
has comment: http://stackoverflow.com/comment/38597464
downvote count: 0
tagged with: polymorphism
favorite count: 0
tagged with: static-methods
has comment: http://stackoverflow.com/comment/38597285
score: 3
answer count: 4
upvote count: 3
type: UnansweredQuestion
has title: Reason for not supporting dynamic polymorphism for static methods in Java
has body: Why does not Java support dynamic polymorphism for static methods? If the answer is "static methods are not supposed to be called on instances and hence method call is not needed to be resolved at runtime", then further question is 'Why does Java allow me to call static methods on instances?'. Why doesn't it simply block the user from calling the method on instances directly by giving some compile time error. Otherway round, What would have gone wrong if Java would have supported Runtime Polymorphism for static methods?

http://stackoverflow.com/q/24892262
has body: I have to create Activity with ListView, when I click on item on ListView item and if this item has more items, new List sliding from left side to half of screen and so on... It should be kind of this http://a1.mzstatic.com/us/r30/Purple6/v4/d5/92/2a/d5922a96-fccf-508a-52fb-c3a21a8d8d4c/screen480x480.jpeg Does somebody have some idea? I don't need code just show me direction, but if you provide some simple example I will be glad to see it:) Thank you
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: How create Activity with a few ListView?
type: Question
tagged with: listview
score: 0
has answer: http://stackoverflow.com/a/24894257
tagged with: android-listview
answer count: 1

http://stackoverflow.com/comment/38677322
comment on: http://stackoverflow.com/q/24897068
has text: I am trying to sort by DateTime.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24791901
tagged with: eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/38478485
upvote count: 0
type: Question
type: AnsweredQuestion
tagged with: android
tagged with: sqlite
has title: Creating 3 spinners that are populated by sqlite database
favorite count: 0
score: -1
has body: I am trying to implement an activity, that has 3 spinners (drop down lists) each of which are populated by a different table from an sqlite database. I managed to create one spinner that is populated correctly, but i am having trouble creating the other two and populating them correctly. this is my main activity so far: public class MainActivity extends Activity implements OnClickListener, OnItemSelectedListener { private DBManager data; private SQLiteDatabase db; private final String DB_NAME = "hanakolfein.s3db"; private Spinner spinner; List&lt;String&gt; list; ArrayAdapter&lt;String&gt; adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /*Spinner sp1, sp2, sp3; sp1 = (Spinner) findViewById(R.id.spinner1); sp2 = (Spinner) findViewById(R.id.spinner2); sp3 = (Spinner) findViewById(R.id.spinner3); sp1.setOnItemSelectedListener(null); sp2.setOnItemSelectedListener(null); sp3.setOnItemSelectedListener(null); */ data = new DBManager(this, DB_NAME); db = data.openDataBase(); spinner = (Spinner) findViewById(R.id.spinner1); spinner.setOnItemSelectedListener(this); loadSpinner(); } private void loadSpinner() { Set&lt;String&gt; set = data.getAllData(); List&lt;String&gt; list = new ArrayList&lt;String&gt;(set); adapter = new ArrayAdapter&lt;String&gt;(MainActivity.this, android.R.layout.simple_spinner_item, list); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setWillNotDraw(false); } @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { // TODO Auto-generated method stub } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent) { // TODO Auto-generated method stub } @Override public void onClick(View v) { // TODO Auto-generated method stub } } and this is my database manager: public class DBManager extends SQLiteOpenHelper { //Path to the device folde…
has answer: http://stackoverflow.com/a/24824375
answer count: 2
has comment: http://stackoverflow.com/comment/38478103
accepted answer: http://stackoverflow.com/a/24824375
has answer: http://stackoverflow.com/a/24792381
tagged with: java
possible better answer: http://stackoverflow.com/a/24792381

http://stackoverflow.com/comment/38692119
score: 0
comment on: http://stackoverflow.com/q/24886557
type: QuestionComment
type: Comment
has text: @andreas, new project is giving all options like "java build path" etc... But still i dont know why it is not showing up in current project. I know people who are working on this project and for them it is working fine

http://stackoverflow.com/q/24770061
has comment: http://stackoverflow.com/comment/38456784
tagged with: g1gc
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38436924
has title: Java G1 garbage collector generates Java inconsistencies?
has comment: http://stackoverflow.com/comment/38456661
has answer: http://stackoverflow.com/a/24789800
type: UnansweredQuestion
has body: I recently tried to activate the garbage-first garbage collector and evaluate it. As a start I wrote this code, trying to produce an java.lang.OutOfMemoryError: import java.util.ArrayList; import java.util.Date; import java.util.List; public class G1Test { public static void floodMemory() { int i = 0; try { // allocate an array where we will just store a lot of java objects List&lt;Date&gt; l = new ArrayList&lt;Date&gt;(); for (; i &lt; 1051366050; i++) { l.add(new Date()); } } catch (Throwable t) { System.err.println("Throwable in floodMemory!"); System.out.println("i=" + i); t.printStackTrace(); } } public static void main(String[] args) { try { System.out.println("Started memory flooding."); floodMemory(); System.out.println("Sleeping."); Thread.sleep(Long.MAX_VALUE); } catch (Throwable t) { System.err.println("Throwable in main!"); t.printStackTrace(); } } } ... and I ran the code using two scenarios: Case 1. With these flags: -Xmx4096M -XX:+UseG1GC, I get this output: Started memory flooding. Throwable in main! java.lang.OutOfMemoryError: Java heap space at com.siemens.scr.usi.experimental.G1Test.floodMemory(G1Test.java:14) at com.siemens.scr.usi.experimental.G1Test.main(G1Test.java:26) ... which means that an the infamous OutOfMemoryError is thrown somewhere BUT captured in the main method. Case 2. With this flag: -Xmx4096M, I get this output: Started memory flooding. Throwable in floodMemory! i=105136605 java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2245) at java.util.Arrays.copyOf(Arrays.java:2219) at java.util.ArrayList.grow(ArrayList.java:242) at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:216) at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:208) at java.util.ArrayList.add(ArrayList.java:440) at com.siemens.scr.usi.experimental.G1Test.floodMemory(G1Test.java:14) at com.siemens.scr.usi.experimental.G1Test.main(G1Test.java:26) Sleeping. ... which means that the exception is caught where I was ex…
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/38437045
upvote count: 4
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38436469
score: 4
has comment: http://stackoverflow.com/comment/38456760

http://stackoverflow.com/q/24771092
accepted answer: http://stackoverflow.com/a/24771796
has comment: http://stackoverflow.com/comment/38438255
has title: Java- Synchronization/Locking across multiple files
type: Question
has body: In my program, I will be storing each "block" of data in a separate file. Multiple threads will both read from and write to various files, and I want to avoid possible problems from not synchronizing this properly. Essentially, I want a setup where each file behaves as if it has its own ReadWriteLock (Two threads can write to two different files concurrently, but not to the same file). I could do just this (And do some optimizations where ReadWriteLocks are only instantiated when they are needed and destroyed when not), but I'm not sure that this is the "proper" thing to do. Is there a better way to do this? I've read that using a FileLock would not be the right thing to do in this situation, because it only matters between different processes, and would not do anything in this case because all of my threads are in the same process. To summarize: What I want to avoid is having one thread reading from one file locking out every other thread from doing anything with the many other files.
score: 0
has comment: http://stackoverflow.com/comment/38438159
tagged with: multithreading
tagged with: file
answer count: 1
has answer: http://stackoverflow.com/a/24771796
tagged with: java
type: AnsweredQuestion

http://stackoverflow.com/comment/38631150
has text: ..and yet another example of why text should always be in text tags. Bare text nodes are very hard to select,
type: Comment
comment on: http://stackoverflow.com/q/24872855
score: 1
type: QuestionComment

http://stackoverflow.com/a/24832580
has comment: http://stackoverflow.com/comment/38555559
has comment: http://stackoverflow.com/comment/38590412
has comment: http://stackoverflow.com/comment/43586351
has comment: http://stackoverflow.com/comment/38571501
has comment: http://stackoverflow.com/comment/43598026
has comment: http://stackoverflow.com/comment/38556251
score: -1
has comment: http://stackoverflow.com/comment/38556730
has body: This happens to me all the time! The actual path to the resource depends on the class loader meaning it depends on whether you are running in pure java, or a web container. I usually nail it by playing with the path to find it...things to try: (1) /resoures/support/... (2) / main/resources/support/... (3) the above without a leading / I think the requirement for the leading / depends on whether you are calling getResourceAsStream from a static or non-static method and whether the resources are packaged in an archive (zip/jar/war) or whether the app is unarchived into files in the deployment environment. To avoid deployment issues, I write some code to 'discover' the path by trying getResourceAsStream until a non-null inputStream is returned.
has comment: http://stackoverflow.com/comment/38555032
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/38557617
has comment: http://stackoverflow.com/comment/38556952
answers question: http://stackoverflow.com/q/24832398
type: Answer
accepted answer of: http://stackoverflow.com/q/24832398
upvote count: 0

http://stackoverflow.com/q/24887961
downvote count: 0
has answer: http://stackoverflow.com/a/24978637
has answer: http://stackoverflow.com/a/26804323
favorite count: 0
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/40341252
has answer: http://stackoverflow.com/a/66319825
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/56534157
tagged with: adobe
has comment: http://stackoverflow.com/comment/40353791
tagged with: zebra-printers
tagged with: java
has body: Is it possible to direct print a stored pdf via a zebra printer in Java? I can't find any mention of them being compatible with direct printing and I can't get it to print. Would I need to communicate directly via zpl? The zebra printer works fine when printed through Acrobat Reader, does Adobe Reader translate the PDF into zpl?
has title: Can you direct pdf print to a zebra printer
type: Question
has answer: http://stackoverflow.com/a/35071534
has comment: http://stackoverflow.com/comment/38674597
answer count: 6
has answer: http://stackoverflow.com/a/72812695
tagged with: http://stackoverflow.com/tag/pdf

http://stackoverflow.com/comment/38484846
has text: Have you checked the libraries that you use in order and export?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24795534

http://stackoverflow.com/q/24864922
has body: I am developing an app for android using eclipse, what i'm basically trying to do is: send an notification form my device(1) to another device(2). I am using user log in with is already configured with a database. When I press down on user(when i press down on a button that sends the notification). I want device 1 to send an notification that shows on device 2. Both devices are logged in with different users, but I can't make the notification part to work. edit: when I push the button the notification displays on device 1, but iI want it to display on device 2... This is the code of receiving a notification: public void NmRecv(String username, String message) { FriendInfo friend = FriendController.getFriendInfo(username); MessageInfo msg = MessageController.checkMessage(username); if ( msg != null) { Intent i = new Intent(TAKE_MESSAGE); i.putExtra(MessageInfo.USERID, msg.userid); i.putExtra(MessageInfo.MESSAGETEXT, msg.messagetext); sendBroadcast(i); String activeFriend = FriendController.getActiveFriend(); if (activeFriend == null || activeFriend.equals(username) == false) { localstoragehandler.insert(username,this.getUsername(), message.toString()); showNotification(username, message); } } } any ideas?
tagged with: notifications
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38615703
favorite count: 0
has comment: http://stackoverflow.com/comment/38615571
tagged with: android
has answer: http://stackoverflow.com/a/24865431
has title: Android notification from device 1 to 2
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38615721
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/24865431
tagged with: eclipse
type: Question

ireport
tags question: http://stackoverflow.com/q/24908988
type: Tag
tags question: http://stackoverflow.com/q/24755336
tag name: ireport
tags question: http://stackoverflow.com/q/24759299

http://stackoverflow.com/q/24825347
has comment: http://stackoverflow.com/comment/38540474
possible better answer: http://stackoverflow.com/a/24826364
has comment: http://stackoverflow.com/comment/38541314
score: 0
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/38540330
downvote count: 1
has body: Below is a view of the package explorer of my project. I get this error on the project root and i am not able to find which is the problem. The project runs correctly without any error in the stack trace.
has answer: http://stackoverflow.com/a/24825506
favorite count: 0
has answer: http://stackoverflow.com/a/24826364
has comment: http://stackoverflow.com/comment/38540606
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/24825938
has comment: http://stackoverflow.com/comment/38541004
accepted answer: http://stackoverflow.com/a/24825938
has comment: http://stackoverflow.com/comment/38541551
has title: How to detect error in spring mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38540782
tagged with: java
has comment: http://stackoverflow.com/comment/38540351
type: Question

http://stackoverflow.com/q/24759446
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24963556
type: Question
tagged with: messaging
upvote count: 5
tagged with: java
has title: How mature is the Spring websocket and messaging support?
answer count: 2
score: 5
has body: Is the Spring Websocket/Messaging support mature or are things still evolving awaiting some definite real cases? I've looked at the documentation and the sample application on github and I see good and rapid feedback on posted issues there, with user suggestions and requests being incorporated back in the framework. For me this is an indication that things are stil evolving and taking shape. Anyone using these capabilities in a production application? EDIT: My question is related to the maturity of the new Spring modules. I'm not asking about maturity and support in browsers for web sockets. Assume I can control the browsers and they all supports websockets.
tagged with: websocket
downvote count: 0
has comment: http://stackoverflow.com/comment/38860438
favorite count: 0
has answer: http://stackoverflow.com/a/24977183

http://stackoverflow.com/comment/38643039
type: QuestionComment
has text: Yes, there are tons of problems, because your thread will do nothing for 30 minutes. `Thread.sleep(1000 * 60 * 30);` , and wrap it in a try-catch
comment on: http://stackoverflow.com/q/24879303
score: 1
type: Comment

http://stackoverflow.com/q/24856346
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: android
has body: Following my android code: string.matches("[a-zA-Z ]+") How to allow letters of all languages (and spaces)? How to do it with also with PHP function preg_match()?
tagged with: regex
accepted answer: http://stackoverflow.com/a/24856363
linked to: http://stackoverflow.com/q/17085738
tagged with: php
has answer: http://stackoverflow.com/a/24856363
type: AnsweredQuestion
has title: Android - PHP - regex with letters of all languages

http://stackoverflow.com/q/24865923
linked to: http://stackoverflow.com/q/8404966
favorite count: 0
has answer: http://stackoverflow.com/a/54244637
has answer: http://stackoverflow.com/a/24866702
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24866395
tagged with: merge
has answer: http://stackoverflow.com/a/62715969
has title: How to merge two complex objects in java
type: Question
has comment: http://stackoverflow.com/comment/38617633
has comment: http://stackoverflow.com/comment/38617814
linked to: http://stackoverflow.com/q/19737626
tagged with: java
has answer: http://stackoverflow.com/a/63181110
has body: I have two java objects and I want to merge them into single object. Problem is the two objects does not contain plain primitive type properties(fields) they contain complex type properties(like object of other type and list of objects of other type). Object 1: Returns by setting up some properties (fields) and Objects 2: returns by setting up some properties (fields) or it may return new objects of the type which it holds but not returned by object 1. Both object 1 and object 2 are of same type. Result Object 3 = obj1 properties + update the properties from obj 2 if same type as obj1 + new updated object from obj2
score: 15
upvote count: 15
downvote count: 0

http://stackoverflow.com/comment/38545316
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24827720
has text: Please paste the output here so we can take a look at it ...

http://stackoverflow.com/a/24997775
type: Answer
answers question: http://stackoverflow.com/q/24808075
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38877931
type: AcceptedAnswer
upvote count: 1
has body: You have Android Application Project. What exactly do you think Android Project is? You are trying to create an applicaiton, correct? Then Android Application Project is what you want. There is no "Android Project" option. In fact, I've never seen it. Basically, you have the following: Android Activity - you just want to create an activity Android Application Project - This creates a complete android application project to create an application that you can install and launch on an android device. Android Project from Existing Code - import existing code into an Android Project There are many more as you found out. But, most of the time, you would use Android Application Project. You don't really specify what it is you are looking at creating specifically, so I'm going to assume this is what you want. If you could give more information as to exactly what you think "Android Project" is for and what you are trying to accomplish with it, that would help. Per the ADT tutorial site, they have the instructions on creating an Android Project, which is generic. There are numerous types of Android Project, with the Android Application Project being one of them. Not sure if this is where you are getting the name "Android Project" from or not. Here is the link: http://developer.android.com/training/basics/firstapp/creating-project.html Everything you state at this point shows you have installed ADT correctly and it's integrated properly with Eclipse.
accepted answer of: http://stackoverflow.com/q/24808075

http://stackoverflow.com/q/24832420
has title: Java pigServer relative path
tagged with: apache-pig
answer count: 0
type: UnansweredQuestion
tagged with: path
upvote count: 1
score: 1
tagged with: java
type: Question
has body: I want to use relative paths in a java program working with pigServer. I would like to know if this code is correct: String filePathDirectory="/consultaBicing1"; Path path=new Path(filePathDirectory); hdfs.delete(path); pigServer.store("source",path.toString()); The program fails in the instruction: pigServer.store("source",path.toString()); How can I use relative path in this code?
downvote count: 0
tagged with: relative-path
favorite count: 0

http://stackoverflow.com/q/24755750
has comment: http://stackoverflow.com/comment/38409809
type: UnansweredQuestion
has title: Error in JFreechart creating NumberAxis with large values
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: jfreechart
type: Question
tagged with: charts
has body: I get below error when creating a chart using JFreechart. The chart appears correctly if the frame size is increased manually or in the code. I have multiple plots in the panel so size is a constraint. JFreechart: 1.0.18 Java 1.8.0_05 on Windows 7 Enterprise. Any help would be greatly appreciated. Thanks in advance. Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Must be finite. at org.jfree.chart.axis.NumberTickUnitSource.getCeilingTickUnit(NumberTickUnitSource.java:114) at org.jfree.chart.axis.NumberAxis.selectHorizontalAutoTickUnit(NumberAxis.java:855) at org.jfree.chart.axis.NumberAxis.selectAutoTickUnit(NumberAxis.java:824) at org.jfree.chart.axis.NumberAxis.refreshTicksHorizontal(NumberAxis.java:949) at org.jfree.chart.axis.NumberAxis.refreshTicks(NumberAxis.java:921) at org.jfree.chart.axis.ValueAxis.reserveSpace(ValueAxis.java:820) at org.jfree.chart.plot.XYPlot.calculateDomainAxisSpace(XYPlot.java:3029) at org.jfree.chart.plot.XYPlot.calculateAxisSpace(XYPlot.java:2988) at org.jfree.chart.plot.XYPlot.draw(XYPlot.java:3130) at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1230) at org.jfree.chart.ChartPanel.paintComponent(ChartPanel.java:1629) at javax.swing.JComponent.paint(JComponent.java:1053) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax.swing.JLayeredPane.paint(JLayeredPane.java:586) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5224) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1532) at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1455) at javax.swing.RepaintManager.paint(RepaintManager.java:1252) at javax.swing.JComponent.paint(JComponent.java:1039) at java.awt.GraphicsCallback$PaintCallback.run(Graphic…
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24805042
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/104814855
has body: I'm working with worldwind and I'm trying to find the cordinates upper left, upper right, lower left, lower right of the current worldwind view. When I say cordinates i'm looking for the +/- 90 degrees latitude and +/- 180 degrees longitude. Whats the easiest way to do this.
downvote count: 0
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/55555654
has answer: http://stackoverflow.com/a/25782070
tagged with: worldwind
type: UnansweredQuestion
has title: How to find bounding box lat longs of worldwind current view?
score: 3
tagged with: java

http://stackoverflow.com/comment/38643097
score: 0
type: Comment
type: QuestionComment
has text: @Eu.Dr.-can u pls send me sample code like this?
comment on: http://stackoverflow.com/q/24865127

http://stackoverflow.com/comment/38525439
score: 0
type: AnswerComment
type: Comment
has text: +1 maybe add some code like `request.getParameter ("whereToGo");`
comment on: http://stackoverflow.com/a/24817298

http://stackoverflow.com/q/24862058
answer count: 2
score: 5
tagged with: jpa
favorite count: 0
has title: Jpa namedquery with left join fetch
upvote count: 5
has answer: http://stackoverflow.com/a/24940184
has body: this is my namedquery: @NamedQuery( name = "User.findOneWithLists", query = "SELECT u FROM User u " + "LEFT JOIN FETCH u.aTemplates " + "LEFT JOIN FETCH u.bTemplates " + "LEFT JOIN FETCH u.bp " + "LEFT JOIN FETCH u.aCredentials " + "LEFT JOIN FETCH u.st WHERE (st.deleted = false) " + "LEFT JOIN FETCH u.bCredentials " + "LEFT JOIN FETCH u.cl " + "WHERE u.id= :id") My problem is that I get an error when the application starting: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: LEFT .... On the st side there is an annotation @ManyToOne @JoinColumn(name = "st_user") private User user; Any idea how can I handle this where clause?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24862123
accepted answer: http://stackoverflow.com/a/24862123
downvote count: 0
possible better answer: http://stackoverflow.com/a/24940184
tagged with: annotations
type: Question
tagged with: named-query
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/24865670
type: Question
has body: I have a JTable (searchListTable) and a want to delete a row from the table without using table Model. Also, I am fetching data in the searchlist from an XML. Here is my code: int selIndex[] = searchListTable.getSelectedRows(); if (selIndex != null) { searchListTable.removeRow(selIndex); keyValueTableModel.removeRows(selIndex); SwingUtilities.updateComponentTreeUI(searchListTable); searchListTable.clearSelection(); Please help.. How can I delete row from table?
answer count: 2
has answer: http://stackoverflow.com/a/24865853
has comment: http://stackoverflow.com/comment/38617560
has comment: http://stackoverflow.com/comment/38617134
tagged with: jtable
has answer: http://stackoverflow.com/a/24865833
has comment: http://stackoverflow.com/comment/38617249
has comment: http://stackoverflow.com/comment/38617501
has title: How to delete a row from JTable?
type: UnansweredQuestion
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/38617663
has comment: http://stackoverflow.com/comment/38617189
tagged with: java

http://stackoverflow.com/a/24787531
has comment: http://stackoverflow.com/comment/38922875
type: Answer
has comment: http://stackoverflow.com/comment/140074255
has comment: http://stackoverflow.com/comment/39015798
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24787530
has body: The OSX version is stored in /System/Library/CoreServices/SystemVersion.plist We can temporary change the OSX version before installing de package. Change OSX version 10.10 to 10.9: sudo sed -i '' 's/&gt;10.10&lt;/&gt;10.9&lt;/' /System/Library/CoreServices/SystemVersion.plist Install Java and don't forget to change your JAVA_HOME to /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk Restore OSX version sudo sed -i '' 's/&gt;10.9&lt;/&gt;10.10&lt;/' /System/Library/CoreServices/SystemVersion.plist
type: AcceptedAnswer
score: 18
answers question: http://stackoverflow.com/q/24787530
upvote count: 18

http://stackoverflow.com/a/24856278
answers question: http://stackoverflow.com/q/24856190
has comment: http://stackoverflow.com/comment/38600270
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38599611
has comment: http://stackoverflow.com/comment/38599578
type: Answer
has comment: http://stackoverflow.com/comment/38599994
downvote count: 1
has comment: http://stackoverflow.com/comment/38600027
score: 9
accepted answer of: http://stackoverflow.com/q/24856190
has comment: http://stackoverflow.com/comment/38599474
has comment: http://stackoverflow.com/comment/38599585
has body: My guess is you are getting null pointer exceptions? See the first line I added within the for loop (assuming Complex has a default constructor). Complex[] time1Dummy = new Complex[time1.size()]; Complex[] freq1 = new Complex[time1.size()]; System.out.println("Size of time1:" +time1.size()); for(int i = 0; i &lt; time1.size(); i++) { time1Dummy[i] = new Complex(); time1Dummy[i].setRe(time1.get(i)); time1Dummy[i].setIm(0.00); } The first two lines of your code create arrays of Complex objects, but each element does not yet have an object created within it. You need to explicitly create an object first. Also the attributes should not be static: private Double re; // the real part private Double im; // the imaginary part`
upvote count: 10

http://stackoverflow.com/comment/38400604
comment on: http://stackoverflow.com/a/24751037
type: AnswerComment
type: Comment
score: 1
has text: it is never good to keep **static** references to views. They prevent activity from being released when he's done with it

http://stackoverflow.com/a/24776420
has comment: http://stackoverflow.com/comment/38485562
type: Answer
has comment: http://stackoverflow.com/comment/38454966
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38452602
has comment: http://stackoverflow.com/comment/38450680
answers question: http://stackoverflow.com/q/24775931
has comment: http://stackoverflow.com/comment/38452156
has comment: http://stackoverflow.com/comment/38448274
has body: What I am asking here is, when I call a method on this object, is it the CLIENT executing the server's code? No. Or is it the server that sequentially calls methods on that object? It is the server, but sequentiality isn't defined. Do they call it sequentially It isn't defined. OR concurrently: It isn't defined. To put that more strongly, the RMI specification states specifically that there are no guarantees about associations between client threads and server threads. All you can deduce from that is that you cannot assume it is single-threaded.

http://stackoverflow.com/q/24838730
has body: Well i am trying to define a date and see the difference with recent date in seconds. Below is the code i did inside onCreate method of activity: txtNowTime = (TextView)findViewById(R.id.textViewNow); SimpleDateFormat formata = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); String currentDateandTime = formata.format(new Date()); @SuppressWarnings("deprecation") Date oldd = new Date("07/18/2014 11:12:13"); String olddt_frmt = formata.format(oldd); long diff =0; try { Date d_recent = formata.parse("currentDateandTime"); diff = d_recent.getTime() - oldd.getTime(); } catch (ParseException ex) { ex.printStackTrace(); } txtNowTime.setText(String.valueOf(diff)); But its not showing any result. :-(
tagged with: android
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/15134927
has answer: http://stackoverflow.com/a/24842378
accepted answer: http://stackoverflow.com/a/24838859
type: Question
possible better answer: http://stackoverflow.com/a/24838917
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24838917
has answer: http://stackoverflow.com/a/24838859
has title: How can i calculate difference in seocnds between a predefined date time and recent date time

http://stackoverflow.com/q/24753435
tagged with: apache-httpclient-4.x
has body: I have to connect to a secured https url and I followed these steps: Create the HttpClient : client = new DefaultHttpClient(); HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER; SchemeRegistry registry = new SchemeRegistry(); SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory(); socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier); registry.register(new Scheme("https", socketFactory, 443)); registry.register(new Scheme("http", socketFactory, 80)); SingleClientConnManager mgr = new SingleClientConnManager(client.getParams(), registry); DefaultHttpClient httpClient = new DefaultHttpClient(mgr, client.getParams()); HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier); 2. I create a HttpPost: HttpPost post = new HttpPost(""); post.setHeader("Content-Type", "application/json"); post.setHeader("TOKEN", token); post.setHeader("Accept", "*/*"); HttpEntity e = new StringEntity(json.toString()); post.setEntity(e); 3. I executed the request: HttpResponse response = httpClient.execute(post); The response shows that access is denied. Can somebody help me to understand what I'm doing wrong?
type: UnansweredQuestion
tagged with: httpsurlconnection
answer count: 0
tagged with: java
type: Question
has title: DefaultHttpClient, Certificates, Https: Access diened
tagged with: httpclient
has comment: http://stackoverflow.com/comment/38406905
tagged with: sslsocketfactory
has comment: http://stackoverflow.com/comment/38454863
score: 0

http://stackoverflow.com/comment/38465163
type: Comment
comment on: http://stackoverflow.com/a/24772803
score: 0
type: AnswerComment
has text: @Chad Yeah sorry about that, it's been a while since I've coded in Java. I've edited my answer. If you feel that it is now satisfactory, I would appreciate it if you would mark it as accepted.

http://stackoverflow.com/comment/38607567
type: QuestionComment
comment on: http://stackoverflow.com/q/24849950
has text: By the end of it, it was just one `StringBuilder` instance variable and a bunch of wrappers around `append`. I tried generics, but since you can't take a variable number of type arguments, that ended up with types that looked like `Builder<Integer, Builder<String, Builder<Integer, Builder<Integer, String>>>>` and an awkward need to build the `Builder` from the end of the string to the front. [Here's what that looked like when I realized I could only add types at the front of the chain.](http://pastebin.com/BUUpBFwj)
score: 0
type: Comment

http://stackoverflow.com/a/26398038
type: Answer
has body: I have found the answer of this and since when I was making the application that was a starting thing for me so my code is jumbled too. So I am posting both the part i.e servlet and android clearly. Hope it will help someone to understand the working perfectly.... This is code for servlet: import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import connection.MySqlConnection; public class MyServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Objects used............... Connection con; String uname=null; String pwd=null; Statement st=null; PrintWriter pw=response.getWriter(); String query; ResultSet rs; ResultSetMetaData rsmd; int columncount=0; PreparedStatement pst=null; System.out.println("in the servlet"); Enumeration en; String temp; en=request.getParameterNames(); while(en.hasMoreElements()) { temp=en.nextElement().toString(); System.out.println(temp+"--&gt;"+request.getParameter(temp)); } // This is used because my one servlet class is interacting with more than one activity and for each activity i have different connection: if(request.getParameter("username")!=null&amp;&amp;request.getParameter("password")!=null) { uname=request.getParameter("username"); pwd=request.getParameter("password"); System.out.println(uname+""+pwd); try { c…
answers question: http://stackoverflow.com/q/24779771
score: 0

http://stackoverflow.com/a/79467279
has body: The section in the book discusses visibility related to volatile variable. Just before this sentence in question, there is a paragraph which says "locking can guarantee both visibility and atomicity; volatile can guarantee only visibility". So if the reason you are going to use locking is just 'visibility' then you can use volatile. Now read the complete statement : You can use volatile variables only when locking is not required for any other reason.
answers question: http://stackoverflow.com/q/24813091
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/140280794

http://stackoverflow.com/comment/38454705
comment on: http://stackoverflow.com/q/24780016
type: Comment
type: QuestionComment
has text: no, it doesn't work in my case, obviously I have replace 'foo' with 'language'
score: 0

http://stackoverflow.com/q/24850767
tagged with: java
linked to: http://stackoverflow.com/q/4397107
has body: I have a set of words in String format. Some of them is in plural forma, some of the others is in verb(ing form). I am going to achieve; detecting and converting plural word into its singular forma and at the same time, if word is in the ing form, convert verb into its noun form or mostly relevant noun form. I have installed JWNL &amp; wordnet, I have tried to read material in the web. On the contrary, I have not get it whether it is capable of doing this convertion. By the way, actually, I have not found a good document about how to use WordNet and JWNl. So, my reading is totaly done on the third web sites. My question is that WordNet and JWNL are capable of doing these wish? If yes and you know a good start point/tutorial, please share them, too. Thanks
answer count: 1
has answer: http://stackoverflow.com/a/24851525
score: 0
has title: Are WordNet and JWNL capable of converting plural-to-singular and ver(ing)-to-noun form?
has comment: http://stackoverflow.com/comment/38588438
accepted answer: http://stackoverflow.com/a/24851525
tagged with: wordnet
type: Question
has comment: http://stackoverflow.com/comment/38588432
type: AnsweredQuestion

http://stackoverflow.com/q/24844453
has body: i am new on Play Framework and i am trying to develop sample java application i have created new html page test.html in controllers it is working if we simply return result in the form of string i.e. return ok("hello world") but it simply format all the styling/text and just shows "hello world" on the UI. public static Result test() { return ok("hello world"); } // working fine but it gives errors when i try this public static Result test(){ return ok(test.render()); } // giving error it gives following errors [error] /opt/ahsen/play-2.2.3/testapp/app/controllers/Application.java:15: render(java.lang.String,play.api.templates.Html) in views.html.test cannot be applied to () [error] return ok(test.render()); [error] (compile:compile) javac returned nonzero exit code here is my test.html file @(title: String)(content: Html) @title @content help please
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24849676
favorite count: 0
has title: eclipse is showing error on render() in play2
type: AnsweredQuestion
tagged with: playframework-2.0
accepted answer: http://stackoverflow.com/a/24849676
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: eclipse

aopalliance
type: Tag
tag name: aopalliance
tags question: http://stackoverflow.com/q/24789581

http://stackoverflow.com/q/24771392
has title: Communications Link Failure, MySQL database on localhost not connecting
type: Question
accepted answer: http://stackoverflow.com/a/24793481
tagged with: network-programming
has body: I am attempting to setup a MySQL 5.6 database to work with my application. While working with it however, I cannot seem to get any sort of connection happening. This is the error message I am getting... com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 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:408) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1137) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:356) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2504) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2541) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2323) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:832) 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.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at ServerDatabase.&lt;init&gt;(ServerDatabase.java:25) at Server.main(Server.java:60) Caused by: java.net.ConnectException: Connection refused: con…
possible better answer: http://stackoverflow.com/a/24771506
has answer: http://stackoverflow.com/a/24771506
answer count: 2
has answer: http://stackoverflow.com/a/24793481
upvote count: 1
has comment: http://stackoverflow.com/comment/38438912
has comment: http://stackoverflow.com/comment/38454365
favorite count: 0
has comment: http://stackoverflow.com/comment/38440751
tagged with: jdbc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38438827
tagged with: mysql
linked to: http://stackoverflow.com/q/2839321

http://stackoverflow.com/comment/38575219
has text: It means you are accessing it `/index.htm` or `/`? As per welcome file in `web.xml` it will redirect to `redirect.jsp`. So many jsps that confusing me.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24843596

http://stackoverflow.com/q/24765288
tagged with: java
tagged with: hibernate
type: Question
tagged with: criteria
has comment: http://stackoverflow.com/comment/38442203
has body: please see the relation below: Person { long idPerson; String name; @OneToMany( mappedBy="owner", cascade=CascadeType.ALL, fetch=FetchType.EAGER ) List&lt;Pet&gt; pets; } @Inheritance( strategy=InheritanceType.JOINED ) Pet { long idPet; @ManyToOne @JoinColumn( name="ID_PERSON", nullable=false ) Person owner; String name; } Cat extends Pet { } Dog extends Pet { } Dragon extends Pet { } this is not the full code, but you get the idea ... As you can see, the Strategy for InheritanceType is JOINED., so if I wanted to retrieve all the Person which has a Cat for example, my SQL would be like: SELECT * FROM PERSON, PET, CAT WHERE PERSON.ID_PERSON=PET.ID_PERSON AND PET.ID_PET=CAT.ID_PET How can I do it using Criterias? one "workaround" would be like this..: Criteria criteria = session.createCriteria( Cat.class ).list(); // then manually create a List&lt;Person&gt; and add all the Cat.owner to that list this would work fine for me if I didn't need to apply some Restrictions.. using criteria.createAlias("Pet", "pet") doesn't work, as it will retrieve all the Person regardless of it having a Cat or not. and .. criteria.createAlias("Cat", "cat") won't even compile as Person doesn't have Cat as a property. In short, what I want to reach, is something equivalent to: SELECT * FROM PERSON, PET, CAT WHERE PERSON.ID_PERSON=PET.ID_PERSON AND PET.ID_PET=CAT.ID_PET AND PERSON.something=... AND PET.something=... AND CAT.something=... ( and a lot more... ) well, this could have been a lot more easier if I used a TABLE_PER_CLASS Strategy, but in my real project, the JOINED one is the one which fits the best... If possible, I would like to avoid using HQL for some .."complicated" reasons.. Thanks in advance!
score: 0
has answer: http://stackoverflow.com/a/24766196
answer count: 1
has title: Hibernate - Fetching data from joined table
accepted answer: http://stackoverflow.com/a/24766196
type: AnsweredQuestion

http://stackoverflow.com/comment/38458405
type: Comment
comment on: http://stackoverflow.com/q/24776340
has text: Ehh... I did `that = function(){this};` and then `testfun(that)`, it printed `[{}]` :< Temporarly I created variable `var globalVar = {}` to which I assigned `globalVar = this` in constructor. I can use my object like `JavaScript.getCurrent().execute("globalVar.someMethod()")` in my server code. It's not very pretty but it works for now...
score: 0
type: QuestionComment

http://stackoverflow.com/a/24809489
has comment: http://stackoverflow.com/comment/39149173
has comment: http://stackoverflow.com/comment/39200725
has comment: http://stackoverflow.com/comment/38523285
has body: Excel Datasource As much of a fan as I am of OneDrive, it is really about storing file information not relational data. It sounds like your problem would be best solved with a connected Excel data source as seen below in this example. This will require that you setup an accessible datasource (Setting up a DB, API, or file backed source). Using the following menu should allow you to creation the relationship with the excel presentation. Straight-forwards APIs Assuming that you don't have the time/control needed to architect a completely new way of using this content I can give you some basic pointers around the following scenarios, 1 getting an up-to-date file from OneDrive, 2 interacting with the excel data and 3 then naturally doing what you need to do with that information. 1) Working with OneDrive If you can interact with the file inside of your OneDrive using your machine, install the sync client for OneDrive. This will work on a Mac, Windows 7, 8, and 8.1 machine and might just get you up and syncing with ease. If you can't use your personal account/deploy to a controlled machine you will want to use and SDK like the LiveSDK. However, I would actually recommend the Live-SDK-for-Windows, while it is not java, C# is pretty close in a lot of ways as long as you can depend on running on a windows machine. Lastly, if you need to be able to run in a non-windows environment or have to run using the Java stack then I'd say that you should look at porting the LiveSDK-for-Android into a java only version, this is a large amount of work as you'll need to remove all the android dependencies, but you should be able to target your specific scenario around getting/updating files. You could technically look at reverse engineering how the service interactions work with a program like Fiddler. 2) Interacting with Excel files Look around the Excel SDKs these are your best functionality bets to dig into your spreadsheets and getting the data that you'll need. There is a high likel…
answers question: http://stackoverflow.com/q/24798665
has comment: http://stackoverflow.com/comment/39200827
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/38523311

http://stackoverflow.com/comment/38691277
comment on: http://stackoverflow.com/q/24904786
type: QuestionComment
has text: Try this one http://stackoverflow.com/a/6236420/893574
score: 0
type: Comment

http://stackoverflow.com/comment/38598098
type: Comment
comment on: http://stackoverflow.com/q/24855322
type: QuestionComment
score: 0
has text: But the standard button is edgy with a 3D effect, I can't get that away with a background. And How would I change the look of a radiobutton, or checkbox, with a image? all I can change there is the space next to it, the checkbox itself will allways look the same.

http://stackoverflow.com/comment/38610959
score: 0
type: Comment
has text: in this HQL is used. Relborg dont want that
type: AnswerComment
comment on: http://stackoverflow.com/a/24862550

http://stackoverflow.com/a/24885349
score: 0
has comment: http://stackoverflow.com/comment/38653946
type: Answer
answers question: http://stackoverflow.com/q/24885170
has comment: http://stackoverflow.com/comment/38654231
has comment: http://stackoverflow.com/comment/38654319
has comment: http://stackoverflow.com/comment/38654088
has comment: http://stackoverflow.com/comment/38653996
has comment: http://stackoverflow.com/comment/38653824
has comment: http://stackoverflow.com/comment/38654151
has body: private Map&lt;String,Object&gt; customProperties = new TreeMap&lt;&gt;(); And the entries can be retrieved in the sort order of the key (String values). A more dynamic approach is possible using implementations of Comparator: public class Bean { private String id; private int value; //... } public class GenComp&lt;B, C extends Comparator&lt;B&gt;&gt; { public void sort( B[] beans, C comp ){ Arrays.sort( beans, comp ); } public void sort( List&lt;B&gt; list, C comp ){ Collections.sort( list, comp ); } } class CompById implements Comparator&lt;Bean&gt; { public int compare(Bean b1, Bean b2){ return b1.getId().compareTo( b2.getId() ); } } You can, just as well, access a property stored in a Map within the Bean: public int compare(Bean b1, Bean b2){ return b1.getProperty( "id" ).compareTo( b2.getProperty( "id" ) ); } And to call: Bean[] beans = new Bean[]{ ... }; GenComp&lt;Bean,CompById&gt; gc = new GenComp&lt;&gt;(); gc.sort( beans, new CompById() ); Actually, class GenComp is just a placeholder in case you'd like to have a different API, as it is, you might call Arrays.sort or Collections.sort without an additional layer.

http://stackoverflow.com/q/24906845
type: Question
has answer: http://stackoverflow.com/a/24910264
score: 1
tagged with: java
tagged with: adt
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38702197
has comment: http://stackoverflow.com/comment/38694777
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38694656
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38704248
has comment: http://stackoverflow.com/comment/38695445
has body: I did an update of ADT yesterday and since yesterday I can't create new project under Eclipse. My old projects are working fine but the new ones don't work at all. I think the problem is coming from the fact that the file appcompat_v7 is not created when I create a new project and I don't know why this file is not created. I tried several solution like uninstalling ADT and installing ADT several time, check if android build tool and Android support library were installed. I'm running out of solution. Does anyone had this problem before? Thank you for your help.
has comment: http://stackoverflow.com/comment/38694784
has comment: http://stackoverflow.com/comment/38695917
type: UnansweredQuestion
has title: Appcompat_v7 not created when I create a new project
upvote count: 1

http://stackoverflow.com/comment/108637233
score: 0
type: Comment
comment on: http://stackoverflow.com/a/61411604
type: AnswerComment
has text: Okay, so I just noticed this question is 6 years old. My bad :-). Anyway, I stand by my answer anyway.

http://stackoverflow.com/comment/38477058
type: Comment
type: QuestionComment
has text: @Engineer Dollery,Yes,they are in the location which is defined in the tiles.xml
comment on: http://stackoverflow.com/q/24791307
score: 0

http://stackoverflow.com/a/24805239
type: Answer
has body: Since you are programming in Java, I think it would be better to use an Object-oriented design. A good pattern to use, when transforming a large switch-case or long if-else-if structure, is to encapsulate the behavior in a class-structure. In your case, a naive approach would be to have classes Dive1, Dive2, Dive3, ... A more fitting design would have a Dive class with a distance field. These would be UserCommand classes. They would probably have an execute(Fish f) method, that would apply the desired behavior to the fish. Now we can also isolate the logic to create the appropriate UserCommand for each input that the user types. This could be done by the UserCommandFactory. It would have a create(String input) method, that would parse the input and create the correct object. This design seems more complex at first, but it is much more flexible and less error prone.
answers question: http://stackoverflow.com/q/24789562
score: 0
has comment: http://stackoverflow.com/comment/38543611

http://stackoverflow.com/a/24802643
downvote count: 0
has comment: http://stackoverflow.com/comment/38498241
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24802425
has body: Your interface is pretty similar to Comparable, (Are you sure Comparable isn't what your looking for?) so maybe you should add a generic to it: public interface Relatable&lt;T extends Relatable&gt; { public int isLargerThan(T t); } And then your class will start as: public class RectanglePlus implements Relatable&lt;RectanglePlus&gt; {... So your RectanglePlus instance will be compared with other RectanglesPlus elements only. If this does not suit what you need, then you have to choose what will happen when you are comparing two different classes: public class RectanglePlus implements Relatable { public int width = 0; public int height = 0; public Point origin; public int getArea() { return width * height; } public int isLargerThan(Relatable other) { if (!(other instanceof RectanglePlus)) { return 1; // I'm bigger than any other class! } RectanglePlus otherRect =(RectanglePlus)other; return this.getArea() - otherRect.getArea(); } } Or, a third option, you can add another method to your interface to obtain the measureable, realatable value of an object. Then you could add a default implementation to isLargerThan, if you are using Java 8: public interface Relatable&lt;T extends Relatable&gt; { public default int isLargerThan(T t) { return this.getRelatableValue - t.getRelatableValue(); } public int getRelatableValue(); }
score: 1

http://stackoverflow.com/q/24858636
has title: Check for valid links if a dead URL redirects to a costum error page
has comment: http://stackoverflow.com/comment/38608372
has answer: http://stackoverflow.com/a/24870369
accepted answer: http://stackoverflow.com/a/24870369
tagged with: http-status-code-404
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38608194
tagged with: selenium
has comment: http://stackoverflow.com/comment/38643714
has comment: http://stackoverflow.com/comment/38604109
type: Question
tagged with: testing
linked to: http://stackoverflow.com/q/24257802
tagged with: java
tagged with: url-validation
score: 0
has body: I need to test(Selenium) if the links in a given page is valid or not. I found a good post about it here http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/ But the problem is, what if a error page redirects to a custom error page? Then i would get a 200 or a 302 instead of a 404. How should I go about checking the validity of URLs for webpages that redirect their 404s.
answer count: 1

http://stackoverflow.com/comment/38630144
score: 0
type: QuestionComment
has text: No, I don't have any modules. Why I get this error? What may be due?
type: Comment
comment on: http://stackoverflow.com/q/24868910

http://stackoverflow.com/a/24782021
downvote count: 0
answers question: http://stackoverflow.com/q/24781960
has body: int i = (byte) + (char) - (int) + (long) - 1; ^-------^--------^-------^ Type casting + - + - are assigning the sign (Unary Operators) to the number, so - then + then - and finally + gives you 1. If we just ignore the type casts we have (+(-(+(-(1)))))=1 Equivalent code: long a = (long) - 1; int b = (int) + a; char c = (char) - b; int finalAns = (byte) + c; System.out.println(finalAns); // gives 1
score: 20
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24781960
upvote count: 20

http://stackoverflow.com/comment/38566021
has text: thanks :-) and i need to divide the difference by 1000 - to make it in seconds. ri8?
comment on: http://stackoverflow.com/a/24838859
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24891466
has body: After updating java to 7u65 (from 7u60) one of our java web start applications will not launch. The error I get is 'Could not find main-class ... in jar' I read through the release notes and bug fixes for 7u65 in addition to searching on SO to find any information. I have not found any documentation that would explain why this worked fine in 7u60 but not 7u65
downvote count: 0
tagged with: java-web-start
has title: Java webstart issues with Java 7u65 "Could not find main-class..."
favorite count: 0
has answer: http://stackoverflow.com/a/24946153
answer count: 3
tagged with: deployment
has answer: http://stackoverflow.com/a/24924062
upvote count: 2
possible better answer: http://stackoverflow.com/a/24894252
has answer: http://stackoverflow.com/a/24894252
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24924062
type: Question

http://stackoverflow.com/comment/38695305
comment on: http://stackoverflow.com/q/24906834
has text: 20 min are long-lived-sessions ;D. 5 seconds are short-lived-sessions.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/104939244
type: QuestionComment
has text: Possible duplicate of [Accessing files with spaces in filename from Java](https://stackoverflow.com/q/5358850/608639), [Read file with whitespace in its path using Java](https://stackoverflow.com/q/9128288/608639), and friends.
comment on: http://stackoverflow.com/q/24784610
score: 0
type: Comment

http://stackoverflow.com/q/24778346
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38451652
has answer: http://stackoverflow.com/a/24781798
type: Question
has body: We're working with a really old database where dates are stored as numeric values in the database as YYYYMMDD, for example, for today (July 16th 2014) it would be stored as 20140716. We're currently solving this by implementing our own AttributeConverter&lt;Date, Long&gt; which converts Date objects to Long and vice versa. However, there's also a constraint on the database that does not allow NULL values in the column. The column itself is optional, but if the date is not existing, the date should be persisted as zero (0) in stead of NULL. So, what we did in our AttributeConverter is the following: @Override public Long convertToDatabaseColumn(Date input) { Long out = 0L; if (input != null) { Calendar cal = GregorianCalendar.getInstance(); cal.setTime(input); out += (cal.get(Calendar.YEAR) * 10000); out += (cal.get(Calendar.MONTH) + 1) * 100; out += cal.get(Calendar.DAY_OF_MONTH); } return out; } But while debugging we noticed that our converter is not executed when the date is null, so it's never converted to zero. Is there a way we can still force Hibernate (4.3.5.Final) to use our converter, even if the value is null?
tagged with: jpa
has title: JPA/Hibernate map null
has comment: http://stackoverflow.com/comment/38451711
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38451531
accepted answer: http://stackoverflow.com/a/24781798
favorite count: 0
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/38523775
has text: I would be fine without using a JDialog, just need to know what type of swing component can emulate the same look.
score: 0
comment on: http://stackoverflow.com/q/24815892
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24893445
has comment: http://stackoverflow.com/comment/38669913
tagged with: android
has comment: http://stackoverflow.com/comment/38672547
has comment: http://stackoverflow.com/comment/38670560
has comment: http://stackoverflow.com/comment/38670568
favorite count: 0
tagged with: android-studio
type: UnansweredQuestion
has title: Android Studio new project shows Runtime exception error
duplicate of: http://stackoverflow.com/q/24501374
has comment: http://stackoverflow.com/comment/38670271
answer count: 0
linked to: http://stackoverflow.com/q/24501374
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38670335
upvote count: 1
has body: I just downloaded the Android Studio v0.8.0. I have installed Android 4.4 APIs . When i create a new project and run it on emulator, It shows Unfortunately has been stopped. Any help will be very much remembered as I'm new to Android Studio with little experience from ADT eclipse. P.S I have configured the SDK path and JDK paths. I have attached the screenshots of error log, emulator, logcat as requested.
has comment: http://stackoverflow.com/comment/38669750
type: Question
downvote count: 0

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/24779806

http://stackoverflow.com/comment/97976337
has text: much better :) i figured it out shortly after posting but i think it makes your answer a bit better.
type: AnswerComment
comment on: http://stackoverflow.com/a/40044899
type: Comment
score: 1

http://stackoverflow.com/comment/38404788
type: Comment
has text: Caused by: java.lang.VerifyError: net/sourceforge/jtds/jdbc/TdsCore....there is some authentication you fail to provide.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24753355

http://stackoverflow.com/comment/38436046
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24769869
has text: Sorry but i don't get it.
score: 0

http://stackoverflow.com/q/24830170
has comment: http://stackoverflow.com/comment/38551094
tagged with: java
has title: Get generated ID from cursor after inserting a row
score: 0
has answer: http://stackoverflow.com/a/24832119
accepted answer: http://stackoverflow.com/a/24832119
tagged with: sql
has comment: http://stackoverflow.com/comment/38550840
answer count: 1
has comment: http://stackoverflow.com/comment/38550465
linked to: http://stackoverflow.com/q/4483568
has body: I've seen this(and similar) questions explaining how to insert and get the generated ID. Unfortunately, none of the solutions that I've found so far work in my current setting. My code is currently like the following: rs.moveToInsertRow(); rs.updateObject(...) rs.updateObject(...) rs.updateObject(...) ... rs.insertRow(); None of the inserted fields contains the ID. The ID is generated by the database. After rs.insertRow(); I want to get the ID of that row. using rs.getObject("ID"); after inserting gives me com.microsoft.sqlserver.jdbc.SQLServerException: The result set has no current row. Is there any way to make this work as is, or do I have to redo this to drop the cursors and use an INSERT statement with returnkeys?
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38550690
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38550364
tagged with: mssql-jdbc
has comment: http://stackoverflow.com/comment/38550355
has comment: http://stackoverflow.com/comment/38553624
type: Question
has comment: http://stackoverflow.com/comment/38550504
linked to: http://stackoverflow.com/q/241003

http://stackoverflow.com/comment/38656150
type: QuestionComment
has text: setContentView(textview) ?
score: 0
comment on: http://stackoverflow.com/q/24886506
type: Comment

http://stackoverflow.com/q/24822323
has comment: http://stackoverflow.com/comment/38539158
has title: java.time.DateTimeFormatter cannot parse without separator chars
favorite count: 0
tagged with: parsing
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38538345
has comment: http://stackoverflow.com/comment/80139194
tagged with: java-8
has body: java.time.LocalDateTime success = java.time.LocalDateTime.parse("20 01 2014 15 36 21 234",java.time.format.DateTimeFormatter.ofPattern("dd MM yyyy HH mm ss SSS")); java.time.LocalDateTime fails = java.time.LocalDateTime.parse("20012014153621234",java.time.format.DateTimeFormatter.ofPattern("ddMMyyyyHHmmssSSS")); reference: http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html Question: The formatter/parser seems to not distinguisch between fixed and variable items. eg. d="day-of-month" used as "dd" could be one or two digits (eg. 8 or 18). Therefore the parser does not use "fixed" lengths as it tries to parse the next "item". But the "items" are not separated and the parsing fails. Am i right? Is there a fix for this? Edit: Interestingly this works: java.time.LocalDate date1 = java.time.LocalDate.parse("20140120", java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd")); java.time.LocalTime time1 = java.time.LocalTime.parse("153621234", java.time.format.DateTimeFormatter.ofPattern("HHmmssSSS")); but why not for Date+Time ?
answer count: 0
downvote count: 0
tagged with: java
tagged with: formatter
type: Question
linked to: http://stackoverflow.com/q/22588051
score: 5
tagged with: datetime-format
has comment: http://stackoverflow.com/comment/38538667

http://stackoverflow.com/comment/38539907
has text: Do you actually _have_ Java installed in `C:\Program Files (x86)\Java\jre7` ?
comment on: http://stackoverflow.com/q/24823321
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38592001
score: 0
type: Comment
type: QuestionComment
has text: post your web-inf.xml, applicationContext.xml and the logfile
comment on: http://stackoverflow.com/q/24852617

http://stackoverflow.com/comment/38689663
type: QuestionComment
has text: it is not well understandable que.
score: 0
comment on: http://stackoverflow.com/q/24903726
type: Comment

http://stackoverflow.com/a/24834076
has comment: http://stackoverflow.com/comment/38557522
has comment: http://stackoverflow.com/comment/38557937
score: 0
answers question: http://stackoverflow.com/q/24833696
type: Answer
has body: AsyncTask is, in fact, multithreading.. It allows you to pass a task for background processing without blocking your ui thread. Furthermore, it also allows you to easily update your ui where needed (in Android ui can only be accessed by the ui thread). Leaving some complexities aside, AsyncTask usage can look like this: new AsyncTask&lt;Void, Void, Void&gt;() { @Override protected Void doInBackground(Void... params) { // perform your background processing here; it will run on a worker thread jsonParser = new JSONParser(); JSONObject json = jsonParser.getJSONFromUrl(URL, params); parseYourJson(); return null; } @Override protected void onPostExecute(Void result) { // update you ui after background processing is completed } }.execute(); Note that doInBackground() must not propagate exceptions. This will result in your program crashing. As for the Json parsing, you can do it as part of the doInBackground() i.e. in the background. Consider using Gson for the task. I've used it for years with zero complains.

http://stackoverflow.com/a/24754707
has comment: http://stackoverflow.com/comment/38408463
score: 0
has comment: http://stackoverflow.com/comment/38407958
type: Answer
has body: Try following: if (status == 200) { HttpEntity entity = response.getEntity(); String data = EntityUtils.toString(entity); if (TextUtils.isEmpty(data)) { Log.e(LOG_TAG, "Server response data is empty!"); } else { // JSON parsing routine } }
answers question: http://stackoverflow.com/q/24753219

http://stackoverflow.com/q/24783453
tagged with: java
type: Question
tagged with: project-management
answer count: 2
tagged with: svn
downvote count: 0
has answer: http://stackoverflow.com/a/24786741
has answer: http://stackoverflow.com/a/27616392
favorite count: 0
tagged with: jenkins
type: UnansweredQuestion
score: 6
has title: Managing many clients with the same java projects with small changes
upvote count: 6
has body: I have several java projects with small differences between them for each client, those differences are: differences in jrxml reports differences in properties files Changes in static classes When I go to update the clients, I committed to SVN and generating the WAR for each project (approx 90mb) using Jenkins, upload to FTP and install it on each server. The problem I'm having is the time it takes me to do it this way, which is between 3 and 4 hours for 6 projects every week. It is possible that all clients are handled by a single project (single WAR) and separate the differences outside the war? What would be the best way to do this? This is recommended or is there a better way to handle this?

http://stackoverflow.com/comment/38893421
has text: @chrisapotek - I'm not sure what you mean, but it seems that you want to omit the salt or make it constant for all passwords. This would not only result in equal hashes for equal passwords, this would allow to make a single rainbow-table to get all the passwords of your database. This is really a security issue! There is nothing PBKDF2 can do, which BCrpyt cannot do as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/24819215
score: 0
type: Comment

http://stackoverflow.com/comment/38455845
comment on: http://stackoverflow.com/q/24780240
type: Comment
has text: Maybe http://nodejs.org is an interesting option.
score: 0
type: QuestionComment

http://stackoverflow.com/a/24885268
downvote count: 0
has body: Sample driver class: package de.scrum_master.app; public class Application { private final static String[] NAMES = { "Name1", "Name2", "Name3" }; public static void main(String[] args) { for (String name : NAMES) System.out.println(name); } } Aspect: package de.scrum_master.aspect; import de.scrum_master.app.Application; public aspect ConstantChanger { Object around() : get(* Application.NAMES) { System.out.println(thisJoinPointStaticPart); return new String[] { "Hack1", "Hack2", "Hack3", "Hack4", "Hack5" }; } } Output: get(String[] de.scrum_master.app.Application.NAMES) Hack1 Hack2 Hack3 Hack4 Hack5 This way you change the array size as well as its content. Is that what you need?
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/24880054
score: 4
accepted answer of: http://stackoverflow.com/q/24880054
type: AcceptedAnswer

http://stackoverflow.com/comment/38594191
has text: working on this again and I notice when I am running the program that the output is continuous so something is wrong with my loop.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24831006
type: AnswerComment

deserialization
type: Tag
tags question: http://stackoverflow.com/q/24765039
tags question: http://stackoverflow.com/q/24874331
tag name: deserialization
tags question: http://stackoverflow.com/q/24803595
tags question: http://stackoverflow.com/q/24856436
tags question: http://stackoverflow.com/q/24795488
tags question: http://stackoverflow.com/q/24877806
tags question: http://stackoverflow.com/q/24836515
tags question: http://stackoverflow.com/q/24906553

http://stackoverflow.com/comment/38586591
type: QuestionComment
comment on: http://stackoverflow.com/q/24849718
has text: @vandus added the xml for the fragment
score: 0
type: Comment

http://stackoverflow.com/q/24845064
tagged with: jogl
type: Question
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38586774
answer count: 0
has comment: http://stackoverflow.com/comment/38578406
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
has title: Is there a basic sample DLL build for a jagamp:gluegen dll out there?
has body: I am working on a system where I am using part of the JOGL OpenGL bindings to Java. I find the basic idea behing the "gluegen" C to Java binding generator good but the docs are thin and I havn't been able to locate a simple sample of gluegen usage consisting of: A C module the does something like modify a string or print a string to stdout (ie: easily tested from java code) an expanded version one with multiple methods that handle each data type handled by gluegen. the appropriate "cfg", ".h" files needed to power gluegen for the sample source. A build script - ideally simple not factored out too much into an endless chain to follow generic makefile or shell script :) the result of running the build script gives you the generated and sample code for a complete native side DLL with DLL main, export tables, and whatever else is needed to load into java on a windows box (.lib for unix) A C compile of the code with MSVC and/or GCC to compile and link the code and generated code to produce the DLL. The generated java class or classes that mate with the DLL including initialization. In a sense sort of a "hello world" in C to be called from Java as a place to start. PK
has comment: http://stackoverflow.com/comment/38578054

http://stackoverflow.com/a/24811746
answers question: http://stackoverflow.com/q/24767137
type: Answer
has body: That's probably not the full stack trace. It's not about that Jolokia can't handle large objects (well, if there is an issue, it's something of you sercer container), since you get a complete response. The reason (hidden in the "38 more") is that the method 'getReadBufSize' throws an exception. You have two options, though: Use the query parameter ignoreErrors=true which is quite useful if you do bulk requests like this. You can indeed choose multiple attributes: For a GET request simply concatanate them with ',', for POST requests use an JSON Array. All is explained in the reference manual. For your request:http://myserver/jolokia/read/Catalina:type=ThreadPool,name=*/attr1,attr2 You need a post 1.0.0 Jolokia agent, though.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38557000
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24767137

http://stackoverflow.com/comment/38577788
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24845208
score: 0
has text: not working. I tried . same error again @ryan

http://stackoverflow.com/q/24771938
has answer: http://stackoverflow.com/a/24772158
has title: How can I parse from a line of text in Java?
accepted answer: http://stackoverflow.com/a/24772158
answer count: 3
has comment: http://stackoverflow.com/comment/38439800
tagged with: parsing
has answer: http://stackoverflow.com/a/24772133
has comment: http://stackoverflow.com/comment/38439787
has comment: http://stackoverflow.com/comment/38439807
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24772133
has body: I have a Java program in which a line of text is received which is similar to the following clid=1 cid=2 client_database_id=1 client_nickname=Alessandro client_type=0|clid=2 cid=2 client_database_id=10 client_nickname=Braden client_type=1 The text is received from a Teamspeak query, and always has the same number of arguments. I need to parse it in a way with which I can receive the value of clid by knowing the value of client_nickname, for example, with something like clid.get("Alessandro") to receive 1, and clid.get("Braden") to receive 2, possibly with a HashMap&lt;String, Integer&gt;. Is there a simple way to parse data in that format?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38439818
type: Question
has answer: http://stackoverflow.com/a/24772256
has comment: http://stackoverflow.com/comment/38439877

bufferedreader
tags question: http://stackoverflow.com/q/24819547
tags question: http://stackoverflow.com/q/24759252
tags question: http://stackoverflow.com/q/24771556
tags question: http://stackoverflow.com/q/24793951
tags question: http://stackoverflow.com/q/24794832
tags question: http://stackoverflow.com/q/24885364
tag name: bufferedreader
tags question: http://stackoverflow.com/q/24838495
type: Tag

http://stackoverflow.com/comment/38535456
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24822860
has text: try closing your ecllipse and restart I get classcast exception after I edit my xml sometimes

http://stackoverflow.com/q/24828418
has answer: http://stackoverflow.com/a/24894978
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24829403
accepted answer: http://stackoverflow.com/a/24829403
has answer: http://stackoverflow.com/a/24944069
has comment: http://stackoverflow.com/comment/38546972
tagged with: java
has comment: http://stackoverflow.com/comment/38547204
tagged with: google-cardboard
tagged with: eclipse
type: Question
has body: You can find the project here: https://github.com/googlesamples/cardboard The last time I worked with android was about a year ago and I'm trying to use this VR project to get back into it. All I want to do is mess around with the app to get a feel for it. However, I haven't been able to get it running. I installed a fresh copy of Eclipse (juno) with the JDK and android SDK and got the android 4.4W stuff from the SDK manager. I also made a Nexus 5 AVD. My problem is that I've tried choosing multiple 'root' folders to 'import as existing android project' and none of them have been runnable. Each time the eclipse terminal gives an 'Installation error: Unknown failure' error after installing 'MainActivity.apk'. I figured the 'main' folder would be most likely to work since it has the manifest and all the other folders associated with android projects. How do I get it running?
score: 0
possible better answer: http://stackoverflow.com/a/24894978
has title: Trouble importing and running the Google Cardboard sample project
tagged with: android
has answer: http://stackoverflow.com/a/32632837

http://stackoverflow.com/comment/38636570
score: 0
type: Comment
type: QuestionComment
has text: Thanks Gabe for your answer. Like you said the given link is really interesting. But I so not see where it use a reference format to take back a View object maybe I miss it.
comment on: http://stackoverflow.com/q/24875434

http://stackoverflow.com/comment/38496475
has text: thanks for reply, Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","system"); like this, right?? I tried that too but still its not working...
type: Comment
comment on: http://stackoverflow.com/a/24801701
score: 0
type: AnswerComment

http://stackoverflow.com/q/24810805
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24811779
tagged with: java
type: Question
tagged with: pgp
has answer: http://stackoverflow.com/a/24871060
has comment: http://stackoverflow.com/comment/38516208
has answer: http://stackoverflow.com/a/41873146
downvote count: 0
possible better answer: http://stackoverflow.com/a/41873146
answer count: 3
score: 1
accepted answer: http://stackoverflow.com/a/24871060
favorite count: 0
tagged with: linux
tagged with: bouncycastle
has title: InvalidKeyException: Key Spec Not Recognised
has body: I'm getting a InvalidKeyException: Illegal key size or default parameters when trying to run a web app that is was a deployed WAR. I am hosting it on Tomcat in a Linux environment. I have already put the two UnlimitedJCEPolicy files into the destination /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/lib/security, and it seems that the error is still occuring. NOTE that this only is thrown when I am running in the linux environment. Locally, it works fine. Here is my code: public static final void decryptFile(File inputFile, File outputFile) throws IOException, PGPException { // Add Bouncy Castle provider Security.addProvider(new BouncyCastleProvider()); // Grab secret key that's in folder with AE classes Resource resource = new ClassPathResource(Env.getSecretKeyAE()); log.debug("Resource: " + Env.getSecretKeyAE()); File keyFileName = resource.getFile(); log.debug("Key File Name: " + keyFileName); // Decryption password String pass = "pass"; char[] passwd = pass.toCharArray(); // Read files into streams log.info("Reading files into streams"); InputStream keyIn = new BufferedInputStream(new FileInputStream(keyFileName)); InputStream in = PGPUtil.getDecoderStream(new BufferedInputStream(new FileInputStream(inputFile))); // I don't even know what these do PGPObjectFactory pgpObjFactory = new PGPObjectFactory(in); PGPEncryptedDataList pgpEncryptedDataList = null; Object o = pgpObjFactory.nextObject(); log.info("Checking instance of PGPEncryptedDataList"); if (o instanceof PGPEncryptedDataList) { pgpEncryptedDataList = (PGPEncryptedDataList)o; } else { pgpEncryptedDataList = (PGPEncryptedDataList)pgpObjFactory.nextObject(); } // This will be the PGPPrivateKey we use to decrypt log.info("Initializing secret key"); PGPPrivateKey secretKey = null; PGPPublicKeyEncryptedData publicKeyEncryptedData = null; PGPSecretKeyRingCollection pgpSecretKeyRingCollection = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyIn)); // This iterates the key file as if it has many …

http://stackoverflow.com/a/24797005
score: 2
answers question: http://stackoverflow.com/q/24796959
downvote count: 0
upvote count: 2
has body: The bad of this option, from my opinion, is that it will be a bit harder to get some kind of properties due to keys mistakes. That's one of the problems with doing that, yes. Another is that using a property that doesn't exist becomes a runtime error instead of a compile-time error. And that unless all of the property values are the same type, you either have to use an untyped collection and cast everything all over the place (f = (int)obj.get("foo");), or use several typed collections and always use the correct one (f = obj.getInt("foo");). What best practices could be applied for this topic? Use proper properties, not a collection of name-value pairs. :-)
type: Answer

http://stackoverflow.com/a/24752676
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24752580
has comment: http://stackoverflow.com/comment/38403821
has body: There's nothing wrong in general with calling superclass methods and getting return values from them. There might be a problem with the particular method you're calling, or the way you're calling it, or what you're doing with the result, but merely calling a superclass method and assigning its result to a variable is not an error.

http://stackoverflow.com/a/24819267
type: Answer
score: 14
downvote count: 0
has body: One more way is - String output = String.format("boolean variable is %b",true); System.out.print(output);
upvote count: 14
answers question: http://stackoverflow.com/q/24818989

http://stackoverflow.com/comment/38511175
comment on: http://stackoverflow.com/a/24804303
score: 0
type: AnswerComment
has text: Okay so I got it by using imp2.setRoi(roi1). I'm not using beanshell code, so thats why I wasn't getting it. I tried overlay but it doesn't seem to work on mine. Also can you do this for two or more images?
type: Comment

http://stackoverflow.com/comment/38553506
has text: Can you generate all pairs integers that sum up to another integer? For example, given `sum = 5`, can you come up with a loop that churns out (0, 5), (1, 4), (2, 3), (3, 2), (4, 1), (5, 0)?
comment on: http://stackoverflow.com/q/24832046
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38610065
comment on: http://stackoverflow.com/q/24861976
type: Comment
type: QuestionComment
score: 0
has text: @ItzikSamara I need in that format that mostly time work and fail rarely in some devices of customers

http://stackoverflow.com/comment/38398793
comment on: http://stackoverflow.com/a/24749892
type: AnswerComment
has text: @MadProgrammer Edited. I was trying to based it on OP's existing code, and I was a bit lazy with it. That should address everything but point 1, and while I agree in general I think JApplet is certainly better then Applet.
score: 0
type: Comment

http://stackoverflow.com/comment/135921870
type: Comment
has text: @NickHumrich i see you work in devops, i am trying to learn devops, just started with jenkins, can you guide me, what other tools & skills i should learn?
comment on: http://stackoverflow.com/a/24812763
score: 0
type: AnswerComment

http://stackoverflow.com/q/24780409
tagged with: tomcat
linked to: http://stackoverflow.com/q/671049
type: Question
has comment: http://stackoverflow.com/comment/38455606
has answer: http://stackoverflow.com/a/24780458
has comment: http://stackoverflow.com/comment/38456161
favorite count: 0
score: -1
tagged with: multithreading
answer count: 2
has comment: http://stackoverflow.com/comment/38456284
downvote count: 1
has comment: http://stackoverflow.com/comment/38455374
tagged with: java
has answer: http://stackoverflow.com/a/24780433
has body: I have jsp page which starts a thread whenever user logins on that page .But what I want is that only a single instance of thread must run i.e. even if user logins for n times on that page only one thread should run.currently whenever user logins a new thread get created which I don't want.For this Either I have to check that one thread is already running or not and if already running then I won't start another, or I can kill the thread which is already running and start a new one.Now ,the problem is How can I do this?I am new to java programming so I don't know my options?
has title: How to kill a thread in java?
upvote count: 0
tagged with: jsp
type: UnansweredQuestion

http://stackoverflow.com/a/24783885
downvote count: 0
has comment: http://stackoverflow.com/comment/38587834
type: Answer
has comment: http://stackoverflow.com/comment/38491171
has comment: http://stackoverflow.com/comment/38490451
upvote count: 1
has body: You have got the reference to your first class wrong in the manifest hence a classnotfoundexception is created. Make sure that you reference the right path totally accurately.
has comment: http://stackoverflow.com/comment/38506219
score: 1
has comment: http://stackoverflow.com/comment/38587677
has comment: http://stackoverflow.com/comment/38490150
answers question: http://stackoverflow.com/q/24783743

nullpointerexception
tags question: http://stackoverflow.com/q/24765499
tags question: http://stackoverflow.com/q/24850489
tags question: http://stackoverflow.com/q/24779806
tags question: http://stackoverflow.com/q/24851719
tags question: http://stackoverflow.com/q/24906226
tags question: http://stackoverflow.com/q/24766008
tags question: http://stackoverflow.com/q/24834511
tags question: http://stackoverflow.com/q/24764367
tags question: http://stackoverflow.com/q/24809768
tags question: http://stackoverflow.com/q/24751071
tags question: http://stackoverflow.com/q/24884541
tags question: http://stackoverflow.com/q/24793951
tags question: http://stackoverflow.com/q/24757415
tags question: http://stackoverflow.com/q/24897753
tags question: http://stackoverflow.com/q/24902248
tags question: http://stackoverflow.com/q/24903941
type: Tag
tags question: http://stackoverflow.com/q/24780726
tags question: http://stackoverflow.com/q/24789354
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/24860517
tags question: http://stackoverflow.com/q/24837189
tags question: http://stackoverflow.com/q/24759316
tags question: http://stackoverflow.com/q/24894946
tags question: http://stackoverflow.com/q/24792867
tags question: http://stackoverflow.com/q/24842765
tags question: http://stackoverflow.com/q/24791657
tags question: http://stackoverflow.com/q/24783840
tags question: http://stackoverflow.com/q/24828722
tags question: http://stackoverflow.com/q/24900868
tags question: http://stackoverflow.com/q/24874203
tags question: http://stackoverflow.com/q/24877665
tags question: http://stackoverflow.com/q/24759384
tags question: http://stackoverflow.com/q/24791453
tags question: http://stackoverflow.com/q/24844721
tags question: http://stackoverflow.com/q/24751846
tags question: http://stackoverflow.com/q/24784008
tags question: http://stackoverflow.com/q/24792975
tags question: http://stackoverflow.com/q/24865190
tags question: http://stackoverflow.com/q/24845071
tags question: http://stackoverflow.com/q/24765018
tags question: http://stackoverflow.com/q/24864480
tags question: http://stackoverflow.com/q/24762522
tags question: http://stackoverflow.com/q/24784811

http://stackoverflow.com/q/24759373
has comment: http://stackoverflow.com/comment/38893100
has comment: http://stackoverflow.com/comment/38895864
has comment: http://stackoverflow.com/comment/38928292
downvote count: 1
has comment: http://stackoverflow.com/comment/38901113
has comment: http://stackoverflow.com/comment/38895044
has comment: http://stackoverflow.com/comment/38903960
type: Question
has comment: http://stackoverflow.com/comment/38889501
has comment: http://stackoverflow.com/comment/38895594
has answer: http://stackoverflow.com/a/24924571
has comment: http://stackoverflow.com/comment/38424560
has comment: http://stackoverflow.com/comment/38895487
has comment: http://stackoverflow.com/comment/38431941
linked to: http://stackoverflow.com/q/1827212
has comment: http://stackoverflow.com/comment/38891561
has comment: http://stackoverflow.com/comment/38895370
has comment: http://stackoverflow.com/comment/38711885
has comment: http://stackoverflow.com/comment/38892985
has comment: http://stackoverflow.com/comment/38895318
score: 12
has body: When I shut down Tomcat, I observe a correct shutdown and cleanup of the Spring WebApplicationContext. However, when I redeploy my Spring-based WAR (by copying the new WAR to webapps), normal shutdown does not occur. This is a problem for me due to all the ensuing resource leaks: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [] appears to have started a thread named [hz.hazelcast-swipe-instance.scheduled] but has failed to stop it. This is very likely to create a memory leak. org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [] appears to have started a thread named [hz.hazelcast-swipe-instance.operation.thread-0] but has failed to stop it. This is very likely to create a memory leak. ... and many more. I am using XML-less configuration, this is my WebApplicationInitializer: public class WebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class<?>[] getRootConfigClasses() { return new Class[] { WebSecurityConfig.class, WebMvcConfig.class }; } @Override protected Class<?>[] getServletConfigClasses() { return null; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } @Override public void onStartup(ServletContext ctx) throws ServletException { ctx.setInitParameter("spring.profiles.active", "production"); super.onStartup(ctx); } } There is no configuration specific to controlling the behavior upon servlet context reload, and I assume this should have worked out of the box. Is there a way to make the WebApplicationContext close properly before continuing the servlet context reloading procedure? I am on Spring 4.0.5, Tomcat 7.0.54, Hazelcast 3.2.1, Hibernate 4.3.4.Final. Update I have added a Spring application listener for the ContextClosedEvent and printed the stack trace of its invocation: at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplication…
has comment: http://stackoverflow.com/comment/38895221
accepted answer: http://stackoverflow.com/a/25035744
has comment: http://stackoverflow.com/comment/38931832
has comment: http://stackoverflow.com/comment/38906481
has comment: http://stackoverflow.com/comment/38895331
has comment: http://stackoverflow.com/comment/38889412
has comment: http://stackoverflow.com/comment/38900896
has answer: http://stackoverflow.com/a/24924461
has comment: http://stackoverflow.com/comment/38889534
has answer: http://stackoverflow.com/a/25024770
has comment: http://stackoverflow.com/comment/38893335
has comment: http://stackoverflow.com/comment/38936635
favorite count: 0
has title: WebApplicationContext not being shut down on Servlet Context reload
has comment: http://stackoverflow.com/comment/38895175
has comment: http://stackoverflow.com/comment/38936671
has answer: http://stackoverflow.com/a/25035744
has comment: http://stackoverflow.com/comment/38899764
has comment: http://stackoverflow.com/comment/38935278
has comment: http://stackoverflow.com/comment/38889280
tagged with: tomcat7
tagged with: spring
has comment: http://stackoverflow.com/comment/38932614
has comment: http://stackoverflow.com/comment/38896284
answer count: 4
upvote count: 13
has comment: http://stackoverflow.com/comment/38895171
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38900565
has comment: http://stackoverflow.com/comment/38712071
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38931498
has comment: http://stackoverflow.com/comment/38903126
has comment: http://stackoverflow.com/comment/38896185
has comment: http://stackoverflow.com/comment/38895907
has comment: http://stackoverflow.com/comment/38930722
linked to: http://stackoverflow.com/q/5292349
tagged with: java
has comment: http://stackoverflow.com/comment/38901046
possible better answer: http://stackoverflow.com/a/25024770

http://stackoverflow.com/comment/38463389
has text: Not sure what you're asking. Please properly format and provide code for review.
score: 4
comment on: http://stackoverflow.com/q/24784391
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24807732
upvote count: 2
tagged with: java
type: Question
has title: Zoom out of a TableView?
tagged with: javafx-8
downvote count: 0
favorite count: 0
has body: If you look at the bottom right of Excel you will see a zoom slider. This enables you to zoom out of the grid you are looking at adding more rows and columns to the view. I would like to be able to do the same in JavaFX using a TableView. I thought it could just be a case of using the scale methods on the TableView (as the code below tries) but this doesn't work. The TableView is made smaller but it doesn't expand to show more rows and columns. import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.Priority; import javafx.scene.layout.RowConstraints; import javafx.stage.Stage; public class TableViewZoomTest extends Application { private double scale = 0.8; @Override public void start(Stage stage) throws Exception { GridPane pane = new GridPane(); Scene scene = new Scene(pane, 500, 500); stage.setScene(scene); TableView&lt;String&gt; tableView = new TableView&lt;&gt;(); TableColumn&lt;String, String&gt; tableColumn1 = new TableColumn&lt;&gt;("Column 1"); tableColumn1.setCellValueFactory(stringStringCellDataFeatures -&gt; new SimpleStringProperty("Hello")); tableView.getColumns().addAll(tableColumn1); tableView.setItems(FXCollections.observableArrayList("Hello", "Hello", "Hello", "Hello")); Button zoomButton = new Button("Zoom"); zoomButton.setOnAction(actionEvent -&gt; { tableView.setScaleX(scale); tableView.setScaleY(scale); scale -= 0.2; if (scale &lt; 0.2) { scale = 1.0; } }); pane.add(tableView, 0, 0, 1, 1); pane.add(zoomButton, 0, 1, 1, 1); ColumnConstraints columnConstraints = new ColumnConstraints(); columnConstraints.setHgrow(Priority.ALWAYS); pane.getColumnConstraints().add(columnConstraints); RowConstraints row1Constraints = new RowCo…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/45930459
tagged with: javafx-2
score: 2
answer count: 0

http://stackoverflow.com/comment/43383337
score: 1
comment on: http://stackoverflow.com/q/24763403
has text: Wear 5.0.1 has some ability! the SDK sample Watchface has a way to detect it. Look for WatchFaceService.INTERRUPTION_FILTER_NONE
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25009830
type: Answer
answers question: http://stackoverflow.com/q/24829831
score: 2
upvote count: 2
has body: Check the permission of the jenkins folder. make sure the user run the jenkins server have the permission to access the folder.
downvote count: 0

http://stackoverflow.com/comment/38675761
type: Comment
has text: Its returning a length of 0
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24895611

http://stackoverflow.com/comment/38687587
type: QuestionComment
comment on: http://stackoverflow.com/q/24902745
has text: @M D Above suggestion resolved my error but it will fetch the value of `sessionid` from `doInBackground()` to `sendMessage()`?
score: 0
type: Comment

http://stackoverflow.com/comment/38442699
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24773569
has text: The comma separated string does not contain both id and name for each company, the value is used for both fields when constructing a Company object.

http://stackoverflow.com/comment/38525717
score: 0
has text: @Bruno I try to contact with cert admin and I have an answer that I should use only VeriSign Primary and Secondary intermediate file to be root cetificate and myApp certificate. But I got new problem like `keytool error: java.lang.Exception: Public keys in reply and keystore don't match` I think it's happen because of cryptographic padding or algorithm between X.509 and PKCS7 I have to find the answer
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24808789

http://stackoverflow.com/comment/38454980
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24780096
has text: @assylias no, consider this: `class X implements Runnable { private static Object o; public void run() { o = new Object(); }}`. In this case it matters if the variable is static or not.
score: 0

http://stackoverflow.com/q/24784508
accepted answer: http://stackoverflow.com/a/24787615
type: Question
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/38463800
has comment: http://stackoverflow.com/comment/38464801
has body: What I want is to start a thread every time the tomcat server starts.For this I need to catch the event of shutting down of tomcat.How can I do this?I tried to do it using sessions but sometimes the session even persists after shutting down and restating tomcat?what are my options?
upvote count: 6
has answer: http://stackoverflow.com/a/24787615
has comment: http://stackoverflow.com/comment/38463723
score: 6
has title: how to catch the event of shutting down of tomcat?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38463849
tagged with: java
has comment: http://stackoverflow.com/comment/38463937

http://stackoverflow.com/a/24784682
has body: From my work/research with accessibility, Android automatically adds "button' to the end of talk back for buttons. I could not find any documentation breaking now accessibility to the coding level, but from what i gather they probably add this in the case the developer forgets to indicate in the content description that the the user has clicked a button. There is nothing you can do to remove android's addition of the word button. What you can do is remove it from you custom description so that is only says "Custom". Hope this helps.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24783555
score: 1

http://stackoverflow.com/a/24853730
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38594264
score: 2
has comment: http://stackoverflow.com/comment/39651455
answers question: http://stackoverflow.com/q/24853688
has comment: http://stackoverflow.com/comment/38820507
has comment: http://stackoverflow.com/comment/39647141
has body: This might help you. replace all xxxxx with empty string. split based on space. sample code: String s="a\nxxxxx\nb xxxxx c xxxxx d xxxxx"; List<String> list=Arrays.asList(s.replaceAll("xxxxx", "").split("\\s+")); System.out.println(list); String[] array=list.toArray(new String[list.size()]); output: [a, b, c, d] EDIT As per @Pshemo you can combine both in single step. List<String> list=Arrays.asList(s.split("\\s*\\bxxxxx\\b\\s*"));
accepted answer of: http://stackoverflow.com/q/24853688
has comment: http://stackoverflow.com/comment/38816934
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39836371

http://stackoverflow.com/a/37847245
answers question: http://stackoverflow.com/q/24898684
downvote count: 0
score: 1
has body: Had the same problem after upgrading my machine from 7 to 10 had to reinstall the JDK all overgain and took me only a few seconds. Here are the steps I followed. Go to this link http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Agree to oracle contact agreement.Then pick your windows version in my case is 64 bit after that its ..Next..Next,,once compete you can relaunch your Android studio without any problem. Hope this helps
upvote count: 1
type: Answer

google-analytics
tags question: http://stackoverflow.com/q/24866161
tag name: google-analytics
tags question: http://stackoverflow.com/q/24884548
type: Tag

http://stackoverflow.com/q/24861855
answer count: 2
has comment: http://stackoverflow.com/comment/38609838
upvote count: 0
has comment: http://stackoverflow.com/comment/38609740
has comment: http://stackoverflow.com/comment/38611332
has answer: http://stackoverflow.com/a/24861905
has comment: http://stackoverflow.com/comment/38609867
favorite count: 0
accepted answer: http://stackoverflow.com/a/24862100
has title: break label statement inwhile loops java
downvote count: 1
possible better answer: http://stackoverflow.com/a/24861905
type: Question
has answer: http://stackoverflow.com/a/24862100
type: AnsweredQuestion
has body: Hi guys the following program output is not understanding can any body explain I am break with label statement .here i am using 3 while loops with label break statements. public static void main(String[] args) { int i=10,j=10,k=10; //Loop: while(i!=0) { System.out.println("i : "+i); iLoop: while(j!=0) { System.out.println(" j : "+j); j--; //iLoop: while(k!=0) { System.out.println(" k : "+k); k--; i--; break iLoop; //break jLoop; //break Loop; } } } } and output is this i : 10 j : 10 k : 10 i : 9 j : 9 k : 9 i : 8 j : 8 k : 8
tagged with: java
score: -1

http://stackoverflow.com/comment/38563107
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24837418
has text: you should automatically enable melodramatically the gps then start activity
score: 0

http://stackoverflow.com/comment/38690738
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24904327
has text: `Comparator<E> != Comparator<Entry<E>>`. Once you have a E once you have a Entry<E>.

http://stackoverflow.com/comment/38695128
score: 0
has text: Problem 1- even tough I am able to retrieve the US FTP timestamp, I am unable to assign to any variable. 2- unable to calc the difference
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24907002

http://stackoverflow.com/comment/38409419
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24755472
has text: No I have not. Sorry, Im new to all this and I did this program by myself with just the book and the little I know about java.

http://stackoverflow.com/a/25863493
type: Answer
answers question: http://stackoverflow.com/q/24778058
score: 2
downvote count: 0
has body: Converting JSON to XLS/CSV in Java has what you are looking for. Basically, you need to use org.json.CDL to convert from JSON to CSV format
upvote count: 2

http://stackoverflow.com/q/24799935
type: Question
has comment: http://stackoverflow.com/comment/38983389
has comment: http://stackoverflow.com/comment/38984425
has comment: http://stackoverflow.com/comment/38983502
has comment: http://stackoverflow.com/comment/38983571
has answer: http://stackoverflow.com/a/25848060
answer count: 3
has comment: http://stackoverflow.com/comment/42050746
upvote count: 1
has comment: http://stackoverflow.com/comment/38984390
has title: StackOverflowError when keybord is dismissed
has comment: http://stackoverflow.com/comment/39014229
has comment: http://stackoverflow.com/comment/38984773
has body: I have an custom view that is extended from MultiAutoCompleteTextView to create chiped view like contacts in gmail. when i a contact to this view and the keyborad is dismissed it casuse stack overflow. it happens only in my nexus 4 this is the logcat. java.lang.StackOverflowError at android.text.DynamicLayout.reflow(DynamicLayout.java:284) at android.text.DynamicLayout.&lt;init&gt;(DynamicLayout.java:170) at android.widget.TextView.makeSingleLayout(TextView.java:6134) at android.widget.TextView.makeNewLayout(TextView.java:6032) at android.widget.TextView.checkForRelayout(TextView.java:6571) at android.widget.TextView.onRtlPropertiesChanged(TextView.java:8672) at android.view.View.resolvePadding(View.java:12407) at android.view.View.getPaddingLeft(View.java:15603) at com.tokenautocomplete.TokenCompleteTextView.maxTextWidth(TokenCompleteTextView.java:260) at com.tokenautocomplete.TokenCompleteTextView.access$1000(TokenCompleteTextView.java:54) at com.tokenautocomplete.TokenCompleteTextView$ViewSpan.prepView(TokenCompleteTextView.java:822) at com.tokenautocomplete.TokenCompleteTextView$ViewSpan.getSize(TokenCompleteTextView.java:841) at com.tokenautocomplete.TokenCompleteTextView$TokenImageSpan.getSize(TokenCompleteTextView.java:885) this is my prep view code private void prepView() { int widthSpec = MeasureSpec.makeMeasureSpec((int)maxTextWidth(), MeasureSpec.AT_MOST); int heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); view.measure(widthSpec, heightSpec); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); } this is line 260 of tokenCompleteTextView private float maxTextWidth() { return getWidth() - getPaddingLeft() - getPaddingRight(); } is use TokenAutoComplete libray for the token view. this is my layout &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/gra…
favorite count: 0
has comment: http://stackoverflow.com/comment/38985167
has comment: http://stackoverflow.com/comment/42035849
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39014420
has comment: http://stackoverflow.com/comment/38984103
has comment: http://stackoverflow.com/comment/38985545
has comment: http://stackoverflow.com/comment/38985777
downvote count: 0
has answer: http://stackoverflow.com/a/25076592
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25114976

http://stackoverflow.com/comment/38669826
type: AnswerComment
has text: i've checked OOM in system logs. Nothing has been updated. Even i tried by setting -17 for my process.
comment on: http://stackoverflow.com/a/24891490
score: 0
type: Comment

http://stackoverflow.com/q/24906885
has comment: http://stackoverflow.com/comment/38694823
favorite count: 0
has comment: http://stackoverflow.com/comment/38694862
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24907098
tagged with: html-parsing
has comment: http://stackoverflow.com/comment/38694781
type: Question
has body: I am trying to get some values from a web site. and want to use a method to check if one rule is available get the value from that rule or else the second one. for example Document d=Jsoup.connect("some site name") .userAgent("Mozilla/5.0 (X11; CrOS i686 3912.101.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36").timeout(100000).get(); This is sample i have done but not working if(d.getAllElements().hasAttr("bld lrg red")) { System.out.println("insidee IF"); Elements e = d.select("span[class=bld lrg red]"); String TEXT=e.text(); System.out.println(TEXT); } else { System.out.println("inside ELSE "); Elements e=d.select("td[class~=(?i)(toeNewPrice|toeUsedPrice)]"); String TEXT=e.text(); System.out.println(TEXT); } if bld lrg red is available then take from if and if not available take value from else
tagged with: jsoup
has title: using Jsoup how we know whether a tag name exist in HTML page or not
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/38603147
score: 0
type: AnswerComment
has text: it's imported already
type: Comment
comment on: http://stackoverflow.com/a/24857852

http://stackoverflow.com/a/24772158
answers question: http://stackoverflow.com/q/24771938
type: AcceptedAnswer
downvote count: 0
has body: You could also do it like this. static HashMap&lt;String, HashMap&lt;String, String&gt;&gt; extractData(String str) { HashMap&lt;String, HashMap&lt;String, String&gt;&gt; data = new HashMap&lt;&gt;(); for(String s: str.split("\\|")) { HashMap&lt;String, String&gt; entries = new HashMap&lt;&gt;(); for(String s2: s.split(" ")) { String[] entry = s2.split("="); entries.put(entry[0], entry[1]); } data.put(entries.get("client_nickname"), entries); } return data; } public static void main(String[] args) { String str = "clid=1 cid=2 client_database_id=1 client_nickname=Alessandro client_type=0|clid=2 cid=2 client_database_id=10 client_nickname=Braden client_type=1"; HashMap&lt;String, HashMap&lt;String, String&gt;&gt; data = extractData(str); System.out.println(data.get("Alessandro").get("clid")); }
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24771938

http://stackoverflow.com/comment/38678537
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24895799
has text: Both are running as the local user and at the same privileges. Could JACOB latch onto the existing Outlook singleton and perform any operations there? I have been looking for something like that online and coming up empty handed.

http://stackoverflow.com/q/24861056
answer count: 0
type: UnansweredQuestion
score: 1
has body: I want to draw a line with this code but on the image view I can't see a picture. If I call only paintComponent() it works very well. I can see two lines but if I call startDrawing(), I get the error below. At first, I tried without new Canvas() and setImageView() but theres nothing to do. LogCat: 07-21 04:41:43.489: W/System.err(1770): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 07-21 04:41:43.529: W/System.err(1770): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6094) 07-21 04:41:43.529: W/System.err(1770): at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:857) 07-21 04:41:43.529: W/System.err(1770): at android.view.ViewGroup.invalidateChild(ViewGroup.java:4320) 07-21 04:41:43.549: W/System.err(1770): at android.view.View.invalidate(View.java:10935) 07-21 04:41:43.569: W/System.err(1770): at android.view.View.invalidate(View.java:10890) 07-21 04:41:43.569: W/System.err(1770): at android.widget.ImageView.setImageDrawable(ImageView.java:426) 07-21 04:41:43.569: W/System.err(1770): at android.widget.ImageView.setImageBitmap(ImageView.java:439) 07-21 04:41:43.569: W/System.err(1770): at graphing.GraphPanel.run(GraphPanel.java:577) 07-21 04:41:43.569: W/System.err(1770): at java.lang.Thread.run(Thread.java:841)* There is code: public class GraphPanel implements Runnable { private static final long serialVersionUID = -8880798842884968375L; private double minX = -10; private double maxX = 10; private double minY = -10; private double maxY = 10; private double xInterval; private double yInterval; private int xAxis = 0; private int yAxis = 0; private int panelHeight = 0; private int panelWidth = 0; private boolean firstResize = true; private static Vector&lt;Equation&gt; equations = new Vector&lt;Equation&gt;(); private static Vector&lt;Path&gt; polylines = new Vector&lt;Path&gt;(); private Vector&lt;Thread&gt; threads = new Vector&lt;Thread&gt;(); pr…
tagged with: android
favorite count: 0
has title: Thread troubles and drawing line on view
type: Question
upvote count: 2
tagged with: multithreading
downvote count: 1
tagged with: java

http://stackoverflow.com/comment/38441757
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24773037
has text: how does your implementation of bubble sort look like? Bubble sort can give efficiency between O(R) to O(R2)

http://stackoverflow.com/q/24822593
has body: I have the following dropdown box created for the user to select a specific year: <springform:select id="firstYear" path="member.attributes[firstYear].value" value=" " tabindex="3"> Select year: <springform:options id="years" items="${years}"/> </springform:select> However, I want to set so that if a user checks a particular checkbox, this dropdown is cleared and a blank value is saved to the DB. Currently it is saving the first value in the array that is ${years} which is not desirable. Here is the javascript I have tried using to clear it: $("#firstYear option:selected").prop("selected", false); $("#firstYear").selectedIndex=-1; I have also tried setting the value of firstYear to " " but this didn't work either. Any help would be very much appreciated!
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: jsp
tagged with: javascript
has answer: http://stackoverflow.com/a/24822804
tagged with: http://stackoverflow.com/tag/html
has title: How to reset a select dropdown using springform:options and save null value
answer count: 1
favorite count: 0
upvote count: 1
tagged with: spring
accepted answer: http://stackoverflow.com/a/24822804
type: AnsweredQuestion

http://stackoverflow.com/q/24850748
tagged with: generics
has title: Creating a generic predicate in Java 8
tagged with: predicate
score: 5
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
upvote count: 5
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24850857
has body: I'm fairly new to Java 8 and wanted to know if its possible to pass instance methods to another method which in turn calls it on a lambda parameter: Consider this class: import java.util.function.Predicate; public class PredicateTest { private class SomeType { public boolean bar() { return true; } public boolean foo() { return true; } } public void someMethod() { Predicate&lt;SomeType&gt; firstPredicate = someType -&gt; someType.bar(); Predicate&lt;SomeType&gt; secondPredicate = someType -&gt; someType.foo(); //... } public Predicate&lt;SomeType&gt; getGenericPredicate(/* ?? what goes here ?? */) { Predicate&lt;SomeType&gt; predicate = someType -&gt; someType./* ?? how to call passed instance method foo or bar? */ return predicate; } } In someMethod() two predicates of SomeType are created. If SomeType would have 20 methods it might happen that we need to write 20 similar predicates. I'm wondering if it is possible with Java 8 to avoid code duplication with a method like getGenericPredicate which could take bar() or foo() as parameter and returns the correct predicate. The goal would be to refactor someMethod to something like this: public void someMethodRefactored() { Predicate&lt;SomeType&gt; firstPredicate = getGenericPredicate(SomeType::bar()); Predicate&lt;SomeType&gt; secondPredicate = getGenericPredicate(SomeType::foo()); //... }
favorite count: 0
accepted answer: http://stackoverflow.com/a/24850857

http://stackoverflow.com/q/24794061
type: Question
has answer: http://stackoverflow.com/a/32734627
has answer: http://stackoverflow.com/a/31222586
has body: So I'm trying to fetch data from OpenWeatherMap, and I keep seeing the "isDataSchedulerEnabled():false" message in my logcat under the "DataScheduler" tag. Is this something I should be concerned about? I can't find anything on it.
tagged with: openweathermap
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25722892
favorite count: 0
has title: Error "isDataSchedulerEnabled():false" in logcat
type: UnansweredQuestion
tagged with: android
tagged with: logging
score: 1
tagged with: java
tagged with: error-handling
upvote count: 1

http://stackoverflow.com/q/24789322
has answer: http://stackoverflow.com/a/24789488
tagged with: abstract-class
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/24789488
favorite count: 0
linked to: http://stackoverflow.com/q/260666
has answer: http://stackoverflow.com/a/24789556
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: Accessing fields/methods/constructors of an abstract class in its subclass
type: Question
has answer: http://stackoverflow.com/a/24789444
tagged with: inheritance
has body: I was trying to work out how to access/use fields/methods of an abstract class in any subclass and I came across this example on the web. abstract class Instrument { protected String name; abstract public void play(); } abstract class StringedInstrument extends Instrument { protected int numberOfStrings; } with the concrete example subclass given as public class ElectricGuitar extends StringedInstrument { public ElectricGuitar() { super(); this.name = "Guitar"; this.numberOfStrings = 6; } public ElectricGuitar(int numberOfStrings) { super(); this.name = "Guitar"; this.numberOfStrings = numberOfStrings; } @Override public void play() { System.out.println("An electric " + numberOfStrings + "-string " + name + " is rocking!"); } } I have 5 questions pertaining to this - sorry for asking more than one question but they are highly related. Is the super() call needed or even valid?. There is no constructor given in the abstract super classes Can an abstract class even have a constructor given that it can't be instantiated? Is the keyword "this" necessary in this example concerning this.name? What is the play() overriding here? When an abstract method is specified in the abstract class doesnt that just tell the compiler the method must be specified by any subclass? If the Instrument class, StringedInstrument class, and ElectricGuitar class all specified fields called "name" and each had specified constructors (if allowed) how would each name or constructor be accessed in the ElectricGuitar class definition.
possible better answer: http://stackoverflow.com/a/24789444

http://stackoverflow.com/comment/38426796
comment on: http://stackoverflow.com/q/24764765
type: Comment
type: QuestionComment
has text: If anyone likes this question please give me +1. Thanks.
score: 0

http://stackoverflow.com/comment/38683404
has text: `//entity[@id='1']` or `//entity` if you want all the entities regardless of id value
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24900679

http://stackoverflow.com/a/24806609
score: 0
type: Answer
has body: If you could refactor you code to be test friendly: static final long millisIn24Hours = 1000 * 60 * 60 * 24; public static boolean dateGreaterThan24Hours(Date dateToCheck){ return dateGreaterThan(dateToCheck, Calendar.getInstance().getTime(), - millisIn24Hours); } public static boolean dateGreaterThan(Date date, Date than, long msDiff) { if(date == null){ throw new IllegalArgumentException("date is null"); } if(than == null){ throw new IllegalArgumentException("than is null"); } return date.before(new Date(than.getTime() + msDiff)); } You could have somethign like this: public void testDateGreaterTrue() { Date now = new Date(); assertFalse(dateGreaterThan(now, new Date(now.getTime()-millisIn24Hours), millisIn24Hours)); } public void testDateGreaterFalse() { Date now = new Date(); assertFalse(dateGreaterThan(now, new Date(now.getTime()-millisIn24Hours-1), millisIn24Hours)); } Instead of: public void testDateGreaterThan24HoursTrue() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 25); assertTrue(dateGreaterThan24Hours(cal.getTime())); } public void testDateGreaterThan24HoursFalse() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 23); cal.set(Calendar.MINUTE, cal.get(Calendar.MINUTE) + 59); cal.set(Calendar.SECOND, cal.get(Calendar.SECOND) + 59); assertFalse(dateGreaterThan24Hours(cal.getTime())); }
answers question: http://stackoverflow.com/q/24805149

http://stackoverflow.com/q/24825390
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24893602
favorite count: 0
score: 3
has answer: http://stackoverflow.com/a/24834645
upvote count: 3
type: UnansweredQuestion
has body: I'm trying to use camel-quartz2 component in a cluster mode with JDBCJobStore. quartz.properties file: org.quartz.scheduler.instanceId=AUTO org.quartz.scheduler.instanceName=JobCluster org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate org.quartz.jobStore.dataSource=dsQuartzTest org.quartz.jobStore.isClustered=true org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount=5 org.quartz.dataSource.dsQuartzTest.driver = oracle.jdbc.driver.OracleDriver org.quartz.dataSource.dsQuartzTest.URL = jdbc:oracle:thin:pmuser@//10.13.13.10:1521/PDB1 org.quartz.dataSource.dsQuartzTest.user = pmuser org.quartz.dataSource.dsQuartzTest.password = oracle org.quartz.dataSource.dsQuartzTest.maxConnections = 10 camel-context.xml file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!-- Configures the Camel Context--&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"&gt; &lt;bean id="quartz2" class="org.apache.camel.component.quartz2.QuartzComponent"&gt; &lt;property name="propertiesFile" value="quartz.properties"/&gt; &lt;/bean&gt; &lt;bean id="quartzBean" class="com.ubs.rbs.integration.QuartzBean"/&gt; &lt;camel:camelContext xmlns="http://camel.apache.org/schema/spring"&gt; &lt;camel:route id="quartzRoute"&gt; &lt;camel:from uri="quartz2://tictac?cron=0+0/5+*+1/1+*+?+*"/&gt; &lt;camel:setBody&gt; &lt;camel:simple&gt; ${header.triggerName} - ${header.fireTime} &lt;/camel:simple&gt; &lt;/camel:setBody&gt; &lt;camel:to uri="log:hello"/&gt; &lt;/camel:route&gt; &lt;!-- &lt;camel:route&gt; &lt;camel:from uri="timer…
tagged with: java
has title: Apache Camel quartz2 doesn't apply changed cron expression
tagged with: apache-camel
type: Question

http://stackoverflow.com/comment/41923670
comment on: http://stackoverflow.com/a/26641388
score: 0
type: AnswerComment
has text: +1 to you. Obviously not ideal, but it works. I'm implementing a similar solution until a permanent fix is in place (not holding my breath).
type: Comment

http://stackoverflow.com/a/24879275
downvote count: 0
has comment: http://stackoverflow.com/comment/38643035
score: 1
has body: If I understand what you want to do, you need to pass a second argument (the Class of T) to your method like so, public static &lt;T&gt; T[] listToArray(List&lt;T&gt; items, Class&lt;T&gt; cls) { T[] names = (T[]) Array.newInstance(cls, items.size()); for (int i = 0; i &lt; items.size(); i += 1) { names[i] = items.get(i); } return names; } So that you can use Array.newInstance(), from the tutorial - Just as in non-reflective code, reflection supports the ability to dynamically create arrays of arbitrary type and dimensions via java.lang.reflect.Array.newInstance(). This is required because the type T is erased at run-time. By passing in the Class you can work around this restriction.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24879051

http://stackoverflow.com/a/24872045
score: 4
answers question: http://stackoverflow.com/q/24870004
type: Answer
upvote count: 4
downvote count: 0
has body: Try doing something like this in hibernate configuration: &lt;property name="connection.autoReconnect"&gt; true &lt;/ property&gt; &lt;property name="connection.autoReconnectForPools"&gt; true &lt;/ property&gt; &lt;property name="connection.is-connection-validation-required"&gt; true &lt;/ property&gt;

http://stackoverflow.com/a/24814864
answers question: http://stackoverflow.com/q/24814747
type: Answer
has comment: http://stackoverflow.com/comment/38534072
downvote count: 0
has body: I guess you don't need '@echo off' nor '@title' nor 'pause', so your shell script would be reduced to this: export CLASSPATH=.:dist/TiredStory.jar:dist/mina-core.jar:dist/slf4j-api.jar:dist/slf4j-jdk14.jar:dist/mysql-connector-java-bin.jar java -Xmx100m -Dwzpath=wz \ -Djavax.net.ssl.keyStore=filename.keystore \ -Djavax.net.ssl.keyStorePassword=keoki \ -Djavax.net.ssl.trustStore=filename.keystore \ -Djavax.net.ssl.trustStorePassword=passwd \ -Drecvops=recvops.properties \ -Dsendops=sendops.properties \ net.world.WorldServer '@echo off' is just to deactivate the echo, no functional effect in your case '@title' is just to set the title in the window of your command line in windows, no use in a shell in the classpath replace ';' with ':' instead of "set": "export" (although export is in case you have subshells, it doesn't harm anyway if you have it) when you break a line, use \ every time you do it pause is just to (obviously) make a pause, no functional inpact in your case
score: 1
has comment: http://stackoverflow.com/comment/38533253
has comment: http://stackoverflow.com/comment/38533418
has comment: http://stackoverflow.com/comment/38531229
upvote count: 1

http://stackoverflow.com/a/24898939
type: Answer
score: 2
has body: You can put the @JsonFormatannotation with the shape = Shape.NUMBER parameter on the existing getter method. Here is an example: public class JacksonJsonFormat { public static class Bean { @JsonFormat(shape = JsonFormat.Shape.NUMBER) public Date getTime() { return new Date(); } } public static void main(String[] args) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.writeValueAsString(new Bean())); } } Output: {"time":1406068019124}
upvote count: 2
answers question: http://stackoverflow.com/q/24867344
accepted answer of: http://stackoverflow.com/q/24867344
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38596147
comment on: http://stackoverflow.com/a/24854674
has text: sry, edited the question, main point is, that the jar is already running
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24878693
tagged with: sql
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24878742
tagged with: jdbc
has title: Parametrized Query Using JDBC
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38642010
accepted answer: http://stackoverflow.com/a/24878742
tagged with: prepared-statement
type: Question
has comment: http://stackoverflow.com/comment/38642188
has body: Is it possible to create a standard method to execute parametrized queries from Java to SQL Server using JDBC? Here's how i create a pool of connections to the db: static ConnectionPool pool; public static void crearPool(){ try { Class c = Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Driver driver = (Driver) c.newInstance(); DriverManager.registerDriver(driver); String url = "jdbc:sqlserver://localhost:1433;database=STAZIONE;"; pool = new ConnectionPool("local",5, 20, 40, 180, url, "b_lightyear", "BeyondInfinity"); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException ex) {/*Error Message*/} } And here's how i think a standard method for every DML Query would be: public static int QueryDML(String consulta,Object []data){ int result = 0; PreparedStatement prpdStm = null; try{ Connection cnx = pool.getConnection(clsConexion.espera); if(conexion!=null){ prpdStm = conexion.prepareStatement(consulta,,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); for(int position =1; position&lt;data.length;position++){ prpdStm.setObject(position, data[position-1]); }result = prpdStm.executeUpdate(); } else{/*Message*/} } catch (SQLException ex) {/*Error Message*/} return result; } What i want to know is if prpdStm.setObject(position, data[position-1]); will function for any type of data ->(String, Integer, Double, etc...)?
tagged with: sql-server

opencsv
tags question: http://stackoverflow.com/q/24799871
type: Tag
tag name: opencsv

http://stackoverflow.com/comment/38627278
comment on: http://stackoverflow.com/a/24870885
score: 1
type: AnswerComment
has text: I only provided method bodies because it makes the code *compilable*. Of course those aren't the real thing (getKey isn't static orinally, nor does it belong to the same class), nor are they relevant. They're there to make the inference problem the *only* error. You break down your interpretation of the type inference process, but that doesn't explain why this compiles in eclipse or javac 7, unless that it compiling *was* a (still existing in java7) bug.
type: Comment

http://stackoverflow.com/q/24853688
upvote count: 0
has comment: http://stackoverflow.com/comment/38816607
has comment: http://stackoverflow.com/comment/38594103
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/38594144
accepted answer: http://stackoverflow.com/a/24853730
has comment: http://stackoverflow.com/comment/38594074
type: AnsweredQuestion
tagged with: list
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/38594201
possible better answer: http://stackoverflow.com/a/24853713
type: Question
has answer: http://stackoverflow.com/a/24853713
has comment: http://stackoverflow.com/comment/38594219
has answer: http://stackoverflow.com/a/24853730
has title: Parse through a string and add entries to a list
has body: I have a string with content in it between separators. The string would look this for example: a xxxxx b xxxxx c xxxxx d xxxxx So I want to parse it to extract a, b, c, d, etc. and add each of them to a list so I can access each one separately later. How can I go about doing this? Thank you
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/25415921

http://stackoverflow.com/q/24860255
tagged with: android
upvote count: 4
downvote count: 0
type: UnansweredQuestion
type: Question
has title: Gson property order in android
has comment: http://stackoverflow.com/comment/47646490
tagged with: java
tagged with: gson
has answer: http://stackoverflow.com/a/29732830
answer count: 1
score: 4
has body: I have integrated Gson to create the json used in a request for an android application. Here is my model class public class TwitterUser { @Expose public String gid; public String icon_url; public Boolean is_app_user; @Expose public String displayName; public TwitterUser(String l, String i, String url, Boolean app_user) { gid = i; displayName = l; icon_url = url; is_app_user = app_user; } public TwitterUser(String l, String i) { gid = i; displayName = l; } public String getGid() { return gid; } public void setGid(String gid) { this.gid = gid; } public String getIcon_url() { return icon_url; } public void setIcon_url(String icon_url) { this.icon_url = icon_url; } public Boolean getIs_app_user() { return is_app_user; } public void setIs_app_user(Boolean is_app_user) { this.is_app_user = is_app_user; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } Here is how i create the json request Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); gson.toJson(twitterUser)); But when I send the request to the server - the order will be rejected. I have to change the request's field order to stay: gid displayName but gson creates other way around, is there any way to achieve this.
favorite count: 0
has comment: http://stackoverflow.com/comment/50724014

http://stackoverflow.com/comment/38467333
has text: Btw, your `main()` isn't static and thus is no real main method.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24786284
score: 0

http://stackoverflow.com/comment/38611532
type: QuestionComment
comment on: http://stackoverflow.com/q/24862713
has text: @Alexandre Santos checked by ` System.out.println(dataAdapter.getItem(5).toString());` It prints the value
score: 0
type: Comment

http://stackoverflow.com/comment/38516096
score: 0
type: Comment
has text: Check [this](http://stackoverflow.com/questions/1372223/reading-from-comma-or-tab-delimited-text-file) answer out, it may get you on the right track.
type: QuestionComment
comment on: http://stackoverflow.com/q/24812110

http://stackoverflow.com/q/24854315
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38595407
tagged with: compareto
tagged with: java
has answer: http://stackoverflow.com/a/24854354
accepted answer: http://stackoverflow.com/a/24854354
type: Question
has comment: http://stackoverflow.com/comment/38595381
answer count: 1
has body: I am trying to understand the compareTo method. I wrote this class AboutcompareTo, but i am stuck in why/how i get this error?- the code is nearly finished. anyone can explain in details what i am doing wrong. Thanks the code: public class AboutCompareTo { public static void main(String[] args) { Fruit[] fruits = { new Fruit(2), new Fruit(3), new Fruit(1) }; java.util.Arrays.sort(fruits); } } class Fruit implements Comparable&lt;Fruit&gt; { private double weight; public Fruit(double weight) { this.weight = weight; } @Override public int compareTo(Fruit o) { Fruit f = (Fruit) o; if (Fruit &gt; o.Fruit) // &lt;-- the error return 1; else if ((Fruit &lt; o.Fruit)) // &lt;-- the error return -1; else return 0; } }
score: 0
upvote count: 1
tagged with: interface
downvote count: 1
has title: Why am I getting this error about the compareTo method?
has comment: http://stackoverflow.com/comment/38595380

http://stackoverflow.com/comment/38597159
comment on: http://stackoverflow.com/a/24855109
type: Comment
score: 1
type: AnswerComment
has text: I don't any actual object of the class. It's a `null` reference.

http://stackoverflow.com/q/24809048
answer count: 1
score: 0
tagged with: mahout
has answer: http://stackoverflow.com/a/24810184
type: UnansweredQuestion
tagged with: maven
has body: I can execute java program by build it with maven on hadoop-cluster. source-code of my program package com.ait.summer.clusterermapreduce; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.mahout.clustering.canopy.CanopyDriver; import org.apache.mahout.clustering.kmeans.KMeansDriver; import org.apache.mahout.common.HadoopUtil; import org.apache.mahout.common.distance.EuclideanDistanceMeasure; public class ClustererMapReduce { public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException { Configuration conf = new Configuration(); FileSystem hdfs = FileSystem.get(conf); Path ProjectFolder = new Path (args[0]); Path InputDir = new Path(args[0], "in"); Path OutputDir = new Path(args[0], "out"); Path canopyCentroids = new Path(args[0], "canopyCentroids"); HadoopUtil.delete(conf, OutputDir); double clusterClassificationThreshold = 0.5; double t1 = 20; double t2 = 30; // how to set up correctly param? CanopyDriver.run(conf, InputDir, canopyCentroids, new EuclideanDistanceMeasure(), t1, t2, false, clusterClassificationThreshold, false); KMeansDriver.run(conf, InputDir, new Path(canopyCentroids, "clusters-0"), OutputDir, new EuclideanDistanceMeasure(), 0.5 , 5, true, 0.5 , false); } } my pom.xml file <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.ait.summer ClustererMapReduce 1.0-SNAPSHOT jar apache.snapshots Apache Snapshot Repository http://repository.apache.org/snapshots false cdh.repo https://repository.cloudera.com/artifactory/cloudera-repos Cloudera Repositories false cdh.snapshots.repo https://repository.cloudera.com/artifactory/libs-snapshot-local Cloudera Snapshots Repository true false org.apache.hadoop hadoop-common 2.0.0-cdh4.7.0 jar org.apache.mahout mahout-core 0.7-cdh4.7.0 jar jfree jfreechart 1.0.8a <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.comp…
tagged with: java
linked to: http://stackoverflow.com/q/574594
type: Question
tagged with: hadoop
has title: Running of java program on hadoop-cluster with maven

http://stackoverflow.com/comment/38491659
has text: Check your Support.V4.jar properly configure or not...
comment on: http://stackoverflow.com/q/24799329
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38658030
comment on: http://stackoverflow.com/q/24885385
type: QuestionComment
has text: You have a variable whose name is determined at runtime and it is in the binding. But there could be a lot of stuff in the binding. How do you know which is the variable you want to print? Or i got everything wrong...
score: 0
type: Comment

http://stackoverflow.com/a/24783654
score: 0
has comment: http://stackoverflow.com/comment/38491796
type: Answer
has body: I believe this technique is what you are looking for. The "ternary" operator is a clean way to display the higher of two values in a single column: <c:forEach var="healthp" items="${healthparam}" > <c:out value="${healthp.name}"/> <c:out value="${healthp.current_Reading > healthp.target ? healthp.current_Reading : healthp.target}"/> <c:out value="${healthp.measurementunit}"/> <c:out value="${healthp.target}"/> <c:out value="${healthp.recorddate}"/> </c:forEach> Side note: Most modern JSP implementations don't require c:out anymore, so you can make your code more readable by doing this: <c:forEach var="healthp" items="${healthparam}"> ${healthp.name} ${healthp.current_Reading > healthp.target ? healthp.current_Reading : healthp.target} ${healthp.measurementunit} ${healthp.target} ${healthp.recorddate} </c:forEach>
answers question: http://stackoverflow.com/q/24773732

http://stackoverflow.com/q/24843174
has comment: http://stackoverflow.com/comment/38573844
accepted answer: http://stackoverflow.com/a/24843270
tagged with: quicksort
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
tagged with: recursion
has body: New to Java. I'm following a book and an example is given on quicksort which works just fine. I understand the algorithm but wanted to print the array before each recursion to really see what was going on with the lower and higher arrays. I thought I'd just declare a separate list and populate it with the lower, pivot, and higher values but it seems to throw off all of the functionality. The recursion seems to remain intact but it doesn't actually sort. Therefore, it overflows and quits. I'm almost certain there's a fundamental Java concept I'm missing here. Everything but the lines wrapped in comments was taken from the book. The lines between the commented lines are my own. package quicksort; import java.util.ArrayList; import java.util.List; public class App { public static List&lt;Integer&gt; quicksort(List&lt;Integer&gt; numbers){ if (numbers.size() &lt; 2){ return numbers; } final Integer pivot = numbers.get(0); final List&lt;Integer&gt; lower = new ArrayList&lt;&gt;(); final List&lt;Integer&gt; higher = new ArrayList&lt;&gt;(); for (int i = 1; i &lt; numbers.size(); i++){ if (numbers.get(i) &lt; pivot){ lower.add(numbers.get(i)); } else{ higher.add(numbers.get(i)); } } // Makes things go all squirrrrrrrrely final List&lt;Integer&gt; notYetSorted = lower; notYetSorted.add(pivot); notYetSorted.addAll(higher); System.out.println("During: " + notYetSorted); // ------------- final List&lt;Integer&gt; sorted = quicksort(lower); sorted.add(pivot); sorted.addAll(quicksort(higher)); return sorted; } public static void main(String[] args) { List&lt;Integer&gt; intList = new ArrayList&lt;&gt;(); intList.add(5); intList.add(8); intList.add(2); intList.add(9); intList.add(10); intList.add(3); intList.add(4); intList.add(7); intList.add(1); intList.add(6); System.out.println("Before: " + intList); System.out.println("After: " + quicksort(intList).toString()); } }
has answer: http://stackoverflow.com/a/24843270
has comment: http://stackoverflow.com/comment/38573936
has title: Java List/Recursion bug
has comment: http://stackoverflow.com/comment/38575754
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24841238
has comment: http://stackoverflow.com/comment/38570303
has comment: http://stackoverflow.com/comment/38570216
type: Answer
has comment: http://stackoverflow.com/comment/38570217
has comment: http://stackoverflow.com/comment/38570187
has comment: http://stackoverflow.com/comment/38570598
score: 10
answers question: http://stackoverflow.com/q/24841172
upvote count: 11
has comment: http://stackoverflow.com/comment/38571211
has comment: http://stackoverflow.com/comment/75866578
has comment: http://stackoverflow.com/comment/38570573
has comment: http://stackoverflow.com/comment/38570817
has body: A quote by Dijkstra, from Why numbering should start at zero (1982): When dealing with a sequence of length N, the elements of which we wish to distinguish by subscript, the next vexing question is what subscript value to assign to its starting element. Adhering to convention a) yields, when starting with subscript 1, the subscript range 1 ≤ i &lt; N+1; starting with 0, however, gives the nicer range 0 ≤ i &lt; N. So let us let our ordinals start at zero: an element's ordinal (subscript) equals the number of elements preceding it in the sequence. And the moral of the story is that we had better regard —after all those centuries!— zero as a most natural number. A discussion about this article can be found in Lambda the Ultimate - Why numbering should start at 0.
downvote count: 1
has comment: http://stackoverflow.com/comment/38570582

http://stackoverflow.com/a/24950407
score: 1
downvote count: 0
type: Answer
upvote count: 1
has body: You can also use x.asDoubleMatrix()[][] for data frames or matrices containing numeric or integer values.
answers question: http://stackoverflow.com/q/24797274

http://stackoverflow.com/q/24832336
has answer: http://stackoverflow.com/a/25979655
has comment: http://stackoverflow.com/comment/38556107
has comment: http://stackoverflow.com/comment/38622428
tagged with: hateoas
tagged with: api
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: annotations
has body: I am working on a rather large API (390+ functions) and I am trying to pull together all the information that the documentation team would need in order to create docs for the project. I have decided to use JSON Hyperschema to represent this. I created an annotation processor to look for all of the javax.ws.rs.Path annotation from my code and grab the Javadoc, http method (from annotation) and other parameter information but I am running into a problem. Hyper schema recommends, and my project spec requires, that the objects sent across an API are to be included as schema in the hyper schema. Typically I would use Jackson to accomplish this. However, as I am in an annotation processor that is not in the main API project, I cannot use class references (ex. User.class where user is an object in my API project and not in my processor) without generating errors. (This is explained here). My question is, what is the best way around this limitation? I have come up with one way, explained below, but I want this to be pluggable into any other service (of the same format) to document them as well. As a solution to this, I have thought to break my generator across compile time and runtime. At compile time I would generate JSON hyperschema with placeholders to reference the object schemas. It would also generate a resource file with full names of all of the objects. At runtime I was planning on generating the schemas for the returned objects then inserting the links to them into the JSON. IMHO this solution doesn't seem very "elegant". Does anyone have any insight into other ways to accomplish this?
linked to: http://stackoverflow.com/q/9204110
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Design for service discovery of an API
upvote count: 1
has comment: http://stackoverflow.com/comment/38618887
type: Question

http://stackoverflow.com/comment/38682805
has text: Have you built and deployed `MyLibMaven`?
type: AnswerComment
comment on: http://stackoverflow.com/a/24900260
score: 0
type: Comment

vaadin
tags question: http://stackoverflow.com/q/24899421
tags question: http://stackoverflow.com/q/24888657
tags question: http://stackoverflow.com/q/24750273
tag name: vaadin
tags question: http://stackoverflow.com/q/24776340
tags question: http://stackoverflow.com/q/24843957
tags question: http://stackoverflow.com/q/24873307
tags question: http://stackoverflow.com/q/24821680
type: Tag
tags question: http://stackoverflow.com/q/24791086
tags question: http://stackoverflow.com/q/24785243
tags question: http://stackoverflow.com/q/24839824
tags question: http://stackoverflow.com/q/24799080

http://stackoverflow.com/comment/38456661
type: Comment
type: QuestionComment
has text: @JigarJoshi - yes, the behavior can be repeated. The reason I placed here all the code is because I hope somebody else can run it and confirm.
comment on: http://stackoverflow.com/q/24770061
score: 0

http://stackoverflow.com/q/24776601
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38448681
has title: creating a number of activity in android based the user input?
linked to: http://stackoverflow.com/q/14392906
tagged with: java
has comment: http://stackoverflow.com/comment/38448626
has comment: http://stackoverflow.com/comment/38449378
type: Question
has body: I am working with a basic game application where I need to create x no of activity based on the users input x. Each activity should have an edit text and the final activity should display all values in a text view. Is it possible?
tagged with: layout
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38448564
tagged with: android-activity

http://stackoverflow.com/q/24750517
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24750654
accepted answer: http://stackoverflow.com/a/24750654
downvote count: 0
possible better answer: http://stackoverflow.com/a/24750615
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
has title: Spring redirect in controller shows error
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38399586
has answer: http://stackoverflow.com/a/24750615
has body: The redirect not working in spring, Any special annotation needed for this? Whats wrong in the below code. please help !! @RequestMapping(value = "/logout") public String logout() throws IOException { setLoggedInUser(null); return "redirect:/index"; } When i logout i have to redirect it to another url and i have given the function as shown above. Still it is not redirecting to that action. What will be the reason? please help..

http://stackoverflow.com/a/24898404
has body: It looks like that this are JSONObjects line by line (no arrays). Read the file line by line and create a JSONObject with that line. BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { JSONObject json = new JSONObject(line); //json.getString("Slaves"); //json.getStrng("Job Reader"); //and so on.. //if you want to get all avilable keys.. use Iterator&lt;?&gt; keys = json.keys(); while( keys.hasNext() ){ String key = (String)keys.next(); if( json.get(key) instanceof JSONObject ){ //key = the key and json.get(key) the value. } } } br.close();
answers question: http://stackoverflow.com/q/24898375
downvote count: 1
has comment: http://stackoverflow.com/comment/38679167
type: Answer
has comment: http://stackoverflow.com/comment/38711910
score: 1
upvote count: 2

http://stackoverflow.com/a/24826014
has body: You're not closing the input stream. My guess is you're not closing the output stream, and it's getting truncated. Use "try-with-resource". try { FileOutputStream e = new FileOutputStream("students.ser"); ObjectOutputStream outputStream = new ObjectOutputStream(e); becomes try ( FileOutputStream e = new FileOutputStream("students.ser") ObjectOutputStream outputStream = new ObjectOutputStream(e); ) { (Edited to flush the wrapper stream (you don't have to go all the way and close it, but it's probably best rather than risk making a common programming error).) That or you haven't written the terminating null.
has comment: http://stackoverflow.com/comment/79626812
has comment: http://stackoverflow.com/comment/79715322
has comment: http://stackoverflow.com/comment/68691206
answers question: http://stackoverflow.com/q/24825958
has comment: http://stackoverflow.com/comment/68699054
has comment: http://stackoverflow.com/comment/73295785
has comment: http://stackoverflow.com/comment/128049438
score: 0
upvote count: 1
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/73294803

http://stackoverflow.com/comment/38650411
has text: I don't know of a way to get rid of the unchecked warning. Just a note - I recommend using `isInstance` instead of `==` and `getClass()` in case you have a further subclass; for example, `Gravenstein extends Apple` - if you want a list of the `Apple`s, you probably want to include any `Gravenstein`s. Using `isInstance` will include them - using `==` and `getClass()` will exclude them.
comment on: http://stackoverflow.com/a/24882924
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24833653
has comment: http://stackoverflow.com/comment/38557095
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38567430
has body: The answer exists in the PrintWriter source code (of which System.out is an instance). Start with the fact that the uninitialized arrays, as reference variables, are given the default of null. The println(char[]) (eventually) attempts to call .length on the passed in array. It's null, resulting in the NullPointerException. println(char[]) (eventually) calls write(char[]): public void write(char buf[]) { write(buf, 0, buf.length); } There is no overload of println matching int[], but there is a println(Object). There it (eventually) attempts String.valueOf, passing the null reference, so String.valueOf takes the null and returns the String "null". println(Object) calls print(Object): public void print(Object obj) { write(String.valueOf(obj)); }
answers question: http://stackoverflow.com/q/24833562
upvote count: 15
has comment: http://stackoverflow.com/comment/38561119
score: 15

http://stackoverflow.com/comment/38602350
comment on: http://stackoverflow.com/a/24857774
has text: Yes empty database should be created. But it is not available in the tomcat extraction location of the project. Is there any specific location where the file is created or is it created in the memory? Basically I need to access the mydb.db in side my code and it should be bundled with the war file (I cant access it directly from the file system)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38641457
type: QuestionComment
type: Comment
has text: thank you for your help. I apologize for my confusion, but I suppose I do not understand how to instantiate the count object int count [] = new int[max]; public void add(int numbers) { for (int index = 0; index < max; index++) { count[index]++; } } }
score: 0
comment on: http://stackoverflow.com/q/24878312

http://stackoverflow.com/comment/38676404
score: 0
type: Comment
type: QuestionComment
has text: Which are you going to believe, your own eyes or the officially blessed spec?
comment on: http://stackoverflow.com/q/24896831

http://stackoverflow.com/a/24981362
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24875132
downvote count: 0
answers question: http://stackoverflow.com/q/24875132
upvote count: 2
has body: In a Dozer converter, convertFrom and convertTo are called solely based on their parameter type. The order of class-a and class-b in the mapping configuration are not considered. Thus as you noted, only convertFrom is called. The issue here is that Dozer is doing class instance conversion, while you really require string conversion. Thus you will need to identify the format of the source string and do the conversion manually. Alternatively, if you can use JSON, then a JSON parsing library will do this for you. E.g. in Jackson: jsonMapper = new ObjectMapper(); A a = jsonMapper.readValue(new StringReader(source), A.class); B b = dozerMapper.map(a, B.class); StringWriter sw = new StringWriter(); jsonMapper.writeValue(sw, b); target = sw.toString();
type: AcceptedAnswer

http://stackoverflow.com/comment/38690670
comment on: http://stackoverflow.com/q/24904060
has text: Provide ASCII art or a simple drawing of how the GUI should appear at default size and (if resizable) with extra width/height.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38529520
comment on: http://stackoverflow.com/q/24818649
type: Comment
type: QuestionComment
has text: searchView.setSearchableInfo(searchManager
score: 0

http://stackoverflow.com/q/24893490
tagged with: java
type: Question
answer count: 1
tagged with: jsp
score: 0
tagged with: http://stackoverflow.com/tag/pdf
tagged with: flying-saucer
has body: I have a jsp file which I like to convert it to PDF using flying saucer. Here is the jsp file: <%@page contentType="text/html" pageEncoding="UTF-8" isELIgnored="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="display" uri="http://displaytag.sf.net/el" %> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> JSP Page <form name="testDBForm" action="<%=basePath%>/TestDatabase" method="post" onsubmit="return true"> <c:if test="${not empty message}"> ${message} </c:if> <c:if test="${not empty insert}"> Insert: ${message} </c:if> <c:if test="${not empty select}"> Select: ${message} </c:if> <c:if test="${not empty update}"> Update: ${message} </c:if> <c:if test="${not empty delete}"> Delete: ${message} </c:if> Here is the servlet code that I am using for parsing html to pdf: protected void processRequest(HttpServletRequest request, HttpServletResponse response) { response.setContentType("application/pdf"); String inputFile = "D:\\03072014\\src\\main\\webapp\\includes\\testDatabase.jsp"; String url=""; try { url = new File(inputFile).toURI().toURL().toString(); } catch (MalformedURLException ex) { Logger.getLogger(HtmlToPdfTaxCardConvertor.class.getName()).log(Level.SEVERE, null, ex); } OutputStream os=null; try { os = response.getOutputStream(); } catch (IOException ex) { Logger.getLogger(HtmlToPdfTaxCardConvertor.class.getName()).log(Level.SEVERE, null, ex); } ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(url); renderer.layout(); try { renderer.createPDF(os); os.close(); } catch (DocumentException ex) { Logger.getLogger(HtmlToPdfTaxCardConvertor.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(HtmlToPdfTaxCardConvertor.class.getName()).log(Level.SEVERE, null, ex); } } } I got exception that javax.xml.transform.TransformerException: org.xml.sax.SAXParseExcept…
type: UnansweredQuestion
tagged with: itext
has title: Convert jsp to PDF using flying saucer
has answer: http://stackoverflow.com/a/24893802

http://stackoverflow.com/q/24820354
has answer: http://stackoverflow.com/a/24820455
type: AnsweredQuestion
score: 1
has body: In this tutorial it is given that StringBuffer is synchronized and StringBuilder is not Can a class be synchonized ? I know that synchronized methods are locked for particular thread and non synchronized are not.But how does a performance of the programe is increased with non-syncronized method? Code from here public class Main { public static void main(String[] args) { int N = 77777777; long t; { StringBuffer sb = new StringBuffer(); t = System.currentTimeMillis(); for (int i = N; i --&gt; 0 ;) { sb.append(""); } System.out.println(System.currentTimeMillis() - t); } { StringBuilder sb = new StringBuilder(); t = System.currentTimeMillis(); for (int i = N; i --&gt; 0 ;) { sb.append(""); } System.out.println(System.currentTimeMillis() - t); } } } gives the numbers of 2241 ms for StringBuffer vs 753 ms for StringBuilder. and accoding to this the extracode is the synchronised keyword in StringBuffer.Does this synchronised keyword cost the extra 1488ms and if so then should we always prefer StringBuilder instead of StringBuffer? Thanks in advance.
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/24820455
has answer: http://stackoverflow.com/a/24820476
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24820453
has comment: http://stackoverflow.com/comment/38533507
answer count: 3
linked to: http://stackoverflow.com/q/355089
has comment: http://stackoverflow.com/comment/38533727
favorite count: 0
has title: How performance is increased on using non-synchronised class as compared to synchronized class?
duplicate of: http://stackoverflow.com/q/355089
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24820453

http://stackoverflow.com/a/24843684
upvote count: 3
type: Answer
has body: When program calls start() method a new Thread is created and code inside run() method is executed in new Thread while if you call run() method directly no new Thread is created and code inside run() will execute on current Thread. Each thread starts in a separate call stack. Invoking the run() method from main thread, the run() method goes onto the current call stack rather than at the beginning of a new call stack. Please refer What if we call run() method directly instead start() method? also read Difference between start and run method in Thread
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/24843040

http://stackoverflow.com/a/24799600
answers question: http://stackoverflow.com/q/24799067
score: 0
has body: For string operations(like concatenation) it is always better to use StringBuilder or StringBuffer. String str = "1234567890"; if (str.matches("\\d{10}")) { StringBuilder strBuilder = new StringBuilder(str); strBuilder.insert(3, "."); strBuilder.insert(7, "."); System.out.println(strBuilder.toString()); } else { System.out.println( str + " is not a phone number"); }
type: Answer

http://stackoverflow.com/comment/38594949
type: AnswerComment
score: 0
type: Comment
has text: Made changes as u have suggested no luck !! :(
comment on: http://stackoverflow.com/a/24853948

http://stackoverflow.com/a/24826194
has comment: http://stackoverflow.com/comment/38636534
has comment: http://stackoverflow.com/comment/38543342
has comment: http://stackoverflow.com/comment/38638811
has body: If you get this error then your JSON must be too large to be buffered into memory. The problem is org.json is too basic to handle that. You need an advanced library to stream responses instead such as GSON or Jackson. GSON - Streaming Jackson - Processing model: Streaming API
has comment: http://stackoverflow.com/comment/38637308
has comment: http://stackoverflow.com/comment/38543230
has comment: http://stackoverflow.com/comment/38542791
answers question: http://stackoverflow.com/q/24826051
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38638508
has comment: http://stackoverflow.com/comment/38770764
has comment: http://stackoverflow.com/comment/38551617
downvote count: 0
has comment: http://stackoverflow.com/comment/38542353

http://stackoverflow.com/comment/38454143
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24773459
has text: I have checked my code.I am not getting zero when diving operation.
score: 0

http://stackoverflow.com/a/24816442
answers question: http://stackoverflow.com/q/24806120
has body: The application was basically pulling tweets using twitter streaming API. Once a tweet comes in, I was producing a message using camel's producerTemplate. There was a consumer which was picking up this message. In this consumer, there was a component which was making an http call to another service. But on my production environment, I was able to communicate with the external world only through an http proxy. The library which was making http call was using apache commons httpClient. Since the proxy was not added to this httpClient, the consumer was getting stuck at processing just one tweet. I was inititally using seda. I changed it to direct and saw that my process was stuck after processing just one tweet. The main problem was it was not timing out or throwing any errors because of which it was a little hard to narrow down the issue.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24806120
type: AcceptedAnswer

http://stackoverflow.com/comment/38621910
comment on: http://stackoverflow.com/a/24867944
type: AnswerComment
score: 0
type: Comment
has text: Ok I will try to provide you an example but now I'm a bit busy. Start with that example and try to figure it out. As soon as I have some time I will try to implement a solution that suits your needs :). Check out this link: http://adanware.blogspot.de/2012/11/android-creating-custom-view-circle.html

http://stackoverflow.com/q/24826195
type: Question
tagged with: libgdx
score: 0
answer count: 1
tagged with: serialization
tagged with: android
has answer: http://stackoverflow.com/a/24833860
accepted answer: http://stackoverflow.com/a/24833860
type: AnsweredQuestion
tagged with: java
has body: I have a Player class which records a players position and several other variables. Additionally in order to remember these states after the game is closed I attempted to serialize and deserialize my player object. This process works fine for the desktop version of my libGdx project however when I run it with my android device it fails (my coordinates are not saved). Furthermore when I check the "desktop" folder I can see the "player.dat" file however in my android folder its not there... At first I was thinking that maybe its something with the way I was debugging and saved the actual game on my phone and ran it, but even so the coordinates did not save. Player class: public class Player implements Serializable { private static final transient String defaultTexture = "data/libgdx.png"; private static final long serialVersionUID = 1L; transient Texture texture; Vector2 position; String textureLoc; transient Sprite sprite; public Player (Vector2 position, String textureLoc){ this.position = position; this.textureLoc = textureLoc; } public void loadContent() { if (Gdx.files.internal(textureLoc).exists()) texture = new Texture(Gdx.files.internal(textureLoc)); else texture = new Texture(Gdx.files.internal(defaultTexture)); sprite = new Sprite(texture); } public void update(OrthographicCamera camera) { if(Gdx.input.isTouched()){ Vector3 tp = new Vector3(); tp.set(Gdx.input.getX(), Gdx.input.getY(), 0); camera.unproject(tp); if(tp.y &gt; sprite.getY()){ position.y += 4f; }else{ position.y -= 4f; } } } public void draw(SpriteBatch batch) { batch.draw(texture, position.x, position.y); } public static void savePlayer(Player player) throws IOException { FileHandle file = Gdx.files.local("player.dat"); try { file.writeBytes(serialize(player), false); } catch (Exception e) { e.printStackTrace(); } } public static Player readPlayer() throws IOException, ClassNotFoundException { Player player = null; FileHandle file = Gdx.files.local("player.dat"); player = (Player) deserialize(f…
has title: android- Libgdx serialization and deserialization

http://stackoverflow.com/comment/38630829
score: 0
has text: @thriller ohh i know it has to be backward compatability. my question is it the only reason? and also usecase of computeIfPresent.
type: Comment
comment on: http://stackoverflow.com/a/24872599
type: AnswerComment

http://stackoverflow.com/comment/38501617
score: 0
has text: I've added the Shader snippet. Should be sufficient for an answer.
type: Comment
comment on: http://stackoverflow.com/a/24801125
type: AnswerComment

http://stackoverflow.com/comment/38653026
type: QuestionComment
score: 1
type: Comment
has text: Is `data` in the JS code what you expect? Is `saveContact` called when your `$.post` to `saveContact`?
comment on: http://stackoverflow.com/q/24884847

http://stackoverflow.com/a/24935519
downvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/91898083
accepted answer of: http://stackoverflow.com/q/24902301
has body: A good place to start would be the sample shell scripts shipped with Kafka. In the /bin directory of the distribution there's some shell scripts you can use, one of which is ./kafka-topic-list.sh If you run that without specifying a topic, it will return all topics with their metadata. See: https://github.com/apache/kafka/blob/0.8/bin/kafka-list-topic.sh That shell script in turn runs: https://github.com/apache/kafka/blob/0.8/core/src/main/scala/kafka/admin/ListTopicCommand.scala The above are both references to the 0.8 Kafka version, so if you're using a different version (even a point difference), be sure to use the appropriate branch/tag on github
upvote count: 4
answers question: http://stackoverflow.com/q/24902301
type: AcceptedAnswer

http://stackoverflow.com/a/24770223
answers question: http://stackoverflow.com/q/24770160
score: 0
has body: There are quite a few errors here. Here is the corrected class A with comments: class A { int x= 5; //x and y must be declared here, as instance variables (not local variables in main) int y = 8; public static void main(String args[]) { //you don't need a main method here } public int Sum() { //you need to return an int here return(x+y); } } And here is the corrected class B: class B { public static void main(String[] args) { A obj = new A(); //these two statements must be inside main() //if you want them to execute System.out.println("Result= " + obj.Sum()); //use the object you created //to call Sum() } }
type: Answer

http://stackoverflow.com/q/24757492
tagged with: java
has comment: http://stackoverflow.com/comment/38413266
has title: How to call @POST RESTful service from Angular JS create function using $resource
tagged with: post
type: Question
score: 0
has answer: http://stackoverflow.com/a/24757613
answer count: 1
tagged with: rest
tagged with: angularjs
has body: I'm trying to call REST service at Java backend from Angular-JS page. I can fetch GET data successfully but could not call @POST resource. For example at the Java backend here is my RESTful service method - @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public User create(User user) { User usr1 = new User(); usr1.setId(3); usr1.setFirstName("John"); usr1.setLastName("Paul"); return usr1; } At the AngularJS part here is the Service factory : var app = angular.module('app', ['ngResource']); app.factory('UsersFactory', function ($resource) { return $resource('http://localhost:8080/demoApp/service/users', {}, { query: { method: 'GET', isArray: true }, create: { method: 'POST'} }) }); Here is the AngularJS controller : app.controller('userCreationCtrl', ['$scope', 'UsersFactory', '$location', function ($scope, UsersFactory, $location) { $scope.createNewUser = function () { UsersFactory.create($scope.user); } }]); The error is showing in Javascript Console of the Chrome Browser - XMLHttpRequest cannot load http://localhost:8080/demoApp/service/users. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63342' is therefore not allowed access.
type: UnansweredQuestion

http://stackoverflow.com/comment/38516891
score: 0
comment on: http://stackoverflow.com/a/24812284
type: AnswerComment
has text: I might have interpreted your question a little too literal. You did say "But lets say the file i want to print is the last file in the 27553 files"
type: Comment

http://stackoverflow.com/comment/38690041
has text: Right, I'm not sure how that's relevant. The code you posted is invalid, correct the compiler error and it will work.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24903819

http://stackoverflow.com/q/24793565
has answer: http://stackoverflow.com/a/24805107
has answer: http://stackoverflow.com/a/24794365
has comment: http://stackoverflow.com/comment/38481149
favorite count: 0
has comment: http://stackoverflow.com/comment/38481151
has comment: http://stackoverflow.com/comment/38674428
has comment: http://stackoverflow.com/comment/38481248
has answer: http://stackoverflow.com/a/24794092
has comment: http://stackoverflow.com/comment/38481631
has body: Considering that I have a matrix (mXn) like this: 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 0 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 0 | 1 | 4 | 9 | 4 | 1 | 0 | 0 | 0 1 | 2 | 9 | # | 9 | 2 | 1 | 0 | 0 0 | 1 | 4 | 9 | 4 | 1 | 0 | 0 | 0 0 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 Where there is a spot # randomly set. The values near that, are affected in a form of wave. The closer to that spot, closer the value gets to 10. Which algorithm would work well on finding #, assuming it will be used on larger scales? EDIT: I am more interested on how to find the the first non-zero number, than find # itself, which is the purpose, but not the real problem. Imagine a huge matrix full of zero and somewhere that # is hiding. The exhaustive part of the algorithm is to find the first non-zero.
type: AnsweredQuestion
answer count: 12
has comment: http://stackoverflow.com/comment/38481765
has answer: http://stackoverflow.com/a/24804335
has answer: http://stackoverflow.com/a/24793790
has title: What is the best algorithm to find the center of a wave on a matrix?
has answer: http://stackoverflow.com/a/24800956
score: 23
possible better answer: http://stackoverflow.com/a/24805107
has answer: http://stackoverflow.com/a/24793722
has comment: http://stackoverflow.com/comment/38501370
type: Question
has answer: http://stackoverflow.com/a/24793980
has comment: http://stackoverflow.com/comment/38481710
has answer: http://stackoverflow.com/a/24796611
has answer: http://stackoverflow.com/a/24794245
accepted answer: http://stackoverflow.com/a/24796611
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/24803109
has answer: http://stackoverflow.com/a/24794155
has comment: http://stackoverflow.com/comment/38481320
has comment: http://stackoverflow.com/comment/38481169
downvote count: 1
upvote count: 24

http://stackoverflow.com/comment/38494293
score: 1
type: AnswerComment
has text: Not really what was asked. It can be assumed that the numbers are all within byte range. The problem deals with array casting.
type: Comment
comment on: http://stackoverflow.com/a/24800853

http://stackoverflow.com/comment/38602310
comment on: http://stackoverflow.com/q/24857790
score: 0
type: Comment
has text: Further, you write `SELECT w FROM Workplaces w WHERE w.spId = :spId` but later on `@Column(name = "sp_id")` which one is the column name in the DB: spId or sp_id ?
type: QuestionComment

http://stackoverflow.com/q/24772069
tagged with: ftp
has comment: http://stackoverflow.com/comment/38441684
score: 0
tagged with: sockets
accepted answer: http://stackoverflow.com/a/24774340
has title: Runtime error in FTP java program: Type top is not assignable to 'java/net/socket'
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: runtime
answer count: 1
has body: import java.io.*; import java.util.*; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import java.sql.Timestamp; public class PrintOutConvosFtp2 { public static void main(String[] args) throws IOException { //Read in the conversation log BufferedReader reader = new BufferedReader(new FileReader("C:/Documents and Settings/Cuckoo/Desktop/Syss-convos.LOG")); FileWriter output = new FileWriter("C:/Documents and Settings/Cuckoo/Desktop/Conversations.html"); List<String> lines = new ArrayList<String>(); String line = null; while ((line = reader.readLine()) != null) //remove some unnecessary clutter from the log { if (!(line.contains("just hung up!!!") || line.contains("just left the Realm.") || line.contains("Hurry, I've many esoteric secrets to divulge, and welcome to BaDbOy's realm.") || line.contains("For custom MegaMud paths and additional information, check out the website:") || line.contains("Syss gossips: Discuss new ideas/issues & see the most up to date information on Facebook!") || line.contains("Syss gossips: http://www.facebook.com/groups/EsotericEdits/") || line.contains("Syss gossips: MME Dats, Megamud path files and quest walkthroughs are available at my site") || line.contains("Syss gossips: www.esoteric-edits.fhero.net") || line.contains("telepaths: @") || line.contains("I'm a bot. Try telepathing me with @commands.") || line.contains("Syss gossips: Remember, you can telepath me @commands for useful things like adding lives.") || line.contains("Syss gossips: Bring a friend, help keep mud alive!") || line.contains("You say \"http://esoteric-edits.fhero.net/\"") || line.contains("For a list of available commands, you can telepath me with @commands."))) { //make the dates american style String day = line.substring(0,2); String month = line.substring(3,5); lines.add(month + "/" + day + line.substring(5)); } } //initialize the output file with HTML header output.write(" "); output.write(System.getProperty("line.separator") +…
has answer: http://stackoverflow.com/a/24774340
has comment: http://stackoverflow.com/comment/38440371

jquery
tags question: http://stackoverflow.com/q/24807068
tags question: http://stackoverflow.com/q/24771278
tags question: http://stackoverflow.com/q/24767172
tags question: http://stackoverflow.com/q/24813594
tags question: http://stackoverflow.com/q/24879094
type: Tag
tags question: http://stackoverflow.com/q/24889381
tags question: http://stackoverflow.com/q/24771788
tags question: http://stackoverflow.com/q/24893158
tags question: http://stackoverflow.com/q/24778208
tags question: http://stackoverflow.com/q/24859083
tags question: http://stackoverflow.com/q/24800567
tags question: http://stackoverflow.com/q/24843179
tag name: jquery
tags question: http://stackoverflow.com/q/24868265
tags question: http://stackoverflow.com/q/24786584
tags question: http://stackoverflow.com/q/24822964
tags question: http://stackoverflow.com/q/24842754
tags question: http://stackoverflow.com/q/24884847
tags question: http://stackoverflow.com/q/24850783
tags question: http://stackoverflow.com/q/24803636
tags question: http://stackoverflow.com/q/24865961
tags question: http://stackoverflow.com/q/24773077
tags question: http://stackoverflow.com/q/24797911
tags question: http://stackoverflow.com/q/24897717
tags question: http://stackoverflow.com/q/24776340
tags question: http://stackoverflow.com/q/24752111
tags question: http://stackoverflow.com/q/24839530
tags question: http://stackoverflow.com/q/24812758
tags question: http://stackoverflow.com/q/24827753
tags question: http://stackoverflow.com/q/24831348

http://stackoverflow.com/comment/38478134
comment on: http://stackoverflow.com/q/24791657
type: Comment
type: QuestionComment
has text: By the way, the `for (i = 0; i == 1499; i++)` loop is broken. It will run zero times. The for condition is *while*, not *until*. You want to say `i < 1500`.
score: 1

http://stackoverflow.com/q/24807910
has body: I've got a simple activity with FragmentPagerAdapter displaying some charts in Fragments. I can navigate through them by clicking the tab in ActionBar or swiping on one or the other side. That's how a Fragment looks like: public static class ChartFragment extends Fragment { private static final String ARG_SECTION_NUMBER = "section_number"; private int section; /** * Returns a new instance of this fragment for the given section number. */ public static ChartFragment newInstance(int sectionNumber) { ChartFragment fragment = new ChartFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public ChartFragment() { // enable menu for fragment setHasOptionsMenu(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { int arg = getArguments().getInt(ARG_SECTION_NUMBER); section = arg; return generateChart(arg); } private View generateChart() { // generate the chart } @Override public boolean onOptionsItemSelected(MenuItem item) { // handle item selection switch (item.getItemId()) { case R.id.action_button: Log.e(TAG, "Section: " + section); return true; default: return super.onOptionsItemSelected(item); } } } (for your information: the code sample is based on this one built in ADT) I've enabled the menu in ActionBar for each fragment and the click gets handled in onOptionsItemSelected hook. When selecting a tab manually in ActionBar everything works fine, but when swiping through the fragments and clicking on the ActionBar button action_button shortly after navigating to the Fragment, the sectionnumber of the previously displayed Fragment is shown! What can I do to make this behave "normally" also when swiping?
has title: onOptionsItemSelected hook called for wrong fragment
type: Question
has answer: http://stackoverflow.com/a/24916251
tagged with: android-fragments
upvote count: 2
answer count: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24916251
score: 2
type: AnsweredQuestion
tagged with: tabs
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/38562805
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24837160
has text: just adding some information that might be obvious... the Key class will have an ID and it will have its own table in the DB. The Value class will have an ID of its own, of course, but also a pointer to the Key (like a 'fk_key_id' foreign key) so that hibernate will be able to tell "how to get all Value objects for a determined key.

http://stackoverflow.com/q/24842077
favorite count: 0
has answer: http://stackoverflow.com/a/24842194
accepted answer: http://stackoverflow.com/a/24842194
upvote count: 2
tagged with: swing
has body: I'm trying to implement ComponentListener in my swing app in way that each time my main JFrame window will be resized listener should respond to that action. The problem is that in: window.addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent e) { System.out.println(window.getWidth()); System.out.println(window.getHeight()); } I clearly see that method is called each time window is resized just by just small difference. I want to call componentResized method just once, at the end of resizing. How can I do that? Do i need muse listener to do that?
score: 2
type: AnsweredQuestion
has title: How to call componentResized method just once (when user stops holding mouse button)?
tagged with: java
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/38418308
has text: Can you please post the full class (not only the method call) of `FacadeImpl`? I think we are missing something important.
comment on: http://stackoverflow.com/q/24757933
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24821532
has comment: http://stackoverflow.com/comment/38608621
has body: I have to transfert some files from my computer to a phone programmatically, but I don't know how to do that. I've search on the web, and I saw that I could use ADB to push files to an Android phone, but on my computer, no devices are founds (with command adb devices). So I search an other way to transfert files via USB. Maybe there is something like USB key (send files with the USB letter). I tried to create a .link file that point to the device, and I read it. Here is a line of it : Provider\Microsoft.Base.DeviceDisplayObjects//DDO:{2E2538BA-D737-5194-8FA4-771241BD6E8E} Is there any way to transfert a file programmatically with Java (or mayby another language) with that line (I think registery key)? What is DDO ?
favorite count: 0
has comment: http://stackoverflow.com/comment/38534116
tagged with: android
has comment: http://stackoverflow.com/comment/38533892
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: adb
type: Question
score: 1
tagged with: java
tagged with: usb
has title: Transfert file(s) from Windows computer to a phone via USB with a Java application
upvote count: 1

http://stackoverflow.com/comment/38658199
type: QuestionComment
comment on: http://stackoverflow.com/q/24887133
has text: @Vishrant ok I'll try
score: 0
type: Comment

http://stackoverflow.com/comment/38578039
score: 3
comment on: http://stackoverflow.com/q/24845357
has text: @Leo: In MySQL you need to change the delimiter. Otherwise the DB thinks your trigger definition ends at the first `;` which would be incomplete.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38493372
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24800316
has text: Eclipse is in your development environment. Why do you need this in the production environment ?

http://stackoverflow.com/q/24777495
has answer: http://stackoverflow.com/a/24777634
downvote count: 1
tagged with: gwt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24777634
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38450449
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/38452477
score: 0
has comment: http://stackoverflow.com/comment/38450617
has body: Compiling module com.example.myPackage.GWT.HelloGWT [INFO] Validating newly compiled units [INFO] Ignored 1 unit with compilation errors in first pass. [INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors. [INFO] Finding entry point classes [INFO] [ERROR] Errors in 'file:/home/ilsurih/Projects/maven%20hibernate/src/main/java/com/example/myPackage/GWT/client/HelloGWT.java' [INFO] [ERROR] Line 31: No source code is available for type com.example.myPackage.HibernateUtil; did you forget to inherit a required module? [INFO] [ERROR] Unable to find type 'com.example.myPackage.GWT.client.HelloGWT' [INFO] [ERROR] Hint: Previous compiler errors may have made this type unavailable [INFO] [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly [ERROR] Exception in thread "UnitWriteThread" java.lang.IndexOutOfBoundsException [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ This is the HibernateUtil class: public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void shutdown() { // Close caches and connection pools getSessionFactory().close(); } public static List getUsers(){ Session session = HibernateUtil.getSessionFactory().openSession(); return session.createCriteria(User.class).list(); } } When I call…
has title: Maven compilation error
favorite count: 0
tagged with: maven
upvote count: 1

http://stackoverflow.com/comment/38495337
comment on: http://stackoverflow.com/q/24800304
has text: What would you want the behaviour to be if V isn't Comparable?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38407207
type: Comment
has text: But I already have a login and registration function properly without this problem.
comment on: http://stackoverflow.com/a/24754487
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38475808
comment on: http://stackoverflow.com/q/24790507
has text: feel code looks cleaner
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24775707
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24775958
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/38448244
tagged with: countdowntimer
has answer: http://stackoverflow.com/a/24775958
has title: when restart CountDownTimer, it finish work
type: AnsweredQuestion
has body: I want to stop CountDownTimer and to restart it, with time when it stopped. I have this code in class CountDownTimer public class MyDownTimer extends CountDownTimer{ long mills; public MyDownTimer(long millisInFuture, long countDownInterval) { super(millisInFuture, countDownInterval); this.mills=millisInFuture; } @Override public void onFinish() { GameScreen.showWindow("Time is over","Sorry, time is Over, you lose"); } @Override public void onTick(long millisUntilFinished) { mills=millisUntilFinished/1000; GameManager.time= millisUntilFinished/1000; } } and Dialog class, he must to showing, when user click in button 'pause'. Dialog code, as you can see, i start new CountDownTimer in this code public static void showWindowPause(final MyDownTimer dTime){ final Dialog wdialog= new Dialog(context); wdialog.setContentView(R.layout.dialog_window); wdialog.setTitle("title"); TextView text=(TextView)wdialog.findViewById(R.id.txtFirstWord); text.setText("mainText"); Button dialogButton=(Button)wdialog.findViewById(R.id.button1); dialogButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { wdialog.dismiss(); dTime.start(); } }); wdialog.show(); } and method, where I stoping CountDownTimer and show Dialog window. long stime =dTime.mills; dTime.cancel(); dTime=null; dTime= new MyDownTimer(stime,1000); GameScreen.showWindowPause(dTime); when i click button in Dialog window, i see new Dialog, which created in method MyDownTimer.onFinish() But if I change line long stime =dTime.mills; on long stime =5000; CountDownTimer restarts,and all normal. where i made mistake?

http://stackoverflow.com/q/24862669
tagged with: list
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38611312
type: Question
has title: Remove duplicates from java list without using sets
has comment: http://stackoverflow.com/comment/38611981
possible better answer: http://stackoverflow.com/a/24862954
has body: Java beginner, so please bear with possibly silly questions. I have a list of Strings which contains multiple duplicates and I want to detect and remove these duplicates. I know there's an easy way to do this with HashSet, and I've actually got it to work like that. But originally I was trying to do it in another way, also quite simple, in which there's something wrong and I don't understand what it is. Given an array of strings with one duplicate, say {"A", "B", "C", "A"}, I can detect and replace the duplicate ("A" here). But if I have an array of strings with multiple duplicates, say {"A", "B", "C", "A", "E", "A"}, something goes wrong in the loop inside my method "replaceDuplicate()". I need help to understand where the problem is in the following code: public class TryTask_B2_Vector { public static void main(String[] args) { // Create array of strings for all the 'Gars': String[] garList = new String[] {"A", "B", "C", "A", "E", "A"}; // Display the original "ArrayList" of 'Gars': System.out.println("Original list of Gars: " + garList); System.out.println(); bruteForce(garList); System.out.println(bruteForce(garList)); System.out.println(); replaceDuplicate(garList); System.out.println(); bruteForce(garList); System.out.println(bruteForce(garList)); System.out.println(); System.out.println("New list of Gars: " + garList); } public static boolean bruteForce(String[] input){ for(int i=0; i &lt; input.length; i++){ for(int j=0; j &lt; input.length; j++){ if(input[i].equals(input[j]) &amp;&amp; i != j){ return true; } } } return false; } public static String[] replaceDuplicate(String[] input){ for(int i=0; i &lt; input.length; i++){ for(int j=0; j &lt; input.length; j++){ if(input[i].equals(input[j]) &amp;&amp; i != j){ input[j] = input[j].replace(input[j], "null"); System.out.println(input[j]); } } } return input; } }
has answer: http://stackoverflow.com/a/24862954
has answer: http://stackoverflow.com/a/34148053
has comment: http://stackoverflow.com/comment/38611435
tagged with: duplicates
accepted answer: http://stackoverflow.com/a/24863413
linked to: http://stackoverflow.com/q/2435156
has comment: http://stackoverflow.com/comment/38611830
has comment: http://stackoverflow.com/comment/38611396
has answer: http://stackoverflow.com/a/24863003
answer count: 4
has answer: http://stackoverflow.com/a/24863413
has comment: http://stackoverflow.com/comment/38611214
type: AnsweredQuestion

http://stackoverflow.com/a/26100110
has comment: http://stackoverflow.com/comment/41257076
has comment: http://stackoverflow.com/comment/43890297
type: Answer
has comment: http://stackoverflow.com/comment/50232818
upvote count: 4
has comment: http://stackoverflow.com/comment/48430146
has comment: http://stackoverflow.com/comment/41561417
has comment: http://stackoverflow.com/comment/49508735
has comment: http://stackoverflow.com/comment/48381876
downvote count: 0
has comment: http://stackoverflow.com/comment/48264398
answers question: http://stackoverflow.com/q/24907159
has body: Updated: To send any command to the device we first need to install the MDM Profile into the device profiles which will contain a server-url which will be used by the device to poll for commands whenever the device receives push notification. Refer http://media.blackhat.com/bh-us-11/Schuetz/BH_US_11_Schuetz_InsideAppleMDM_WP.pdf for in detail enrollment also refer "Sending Push Notifications" section and sections following it from the above link for detailed device commands. To send push notification we need to have an apns push certificate which we can create from apple's identity portal refer: http://www.softhinker.com/in-the-news/iosmdmvendorcsrsigning For mdm, we send push notification payload to APNs as {mdm : "PushMagicToken-of-device"} When push notification is received by the device it will contact mdm server's server-url for command to be executed. Answering your questions: (P.S Used Java for communication) Q1. "Can you suggest me how server is interacting with the device and device with the server in the form of request" Answer: Device will interact to the server when it receives push notification from APNs. It will contact to the url of key ServerUrl which you provide in the mdm payload. This is PUT request method type, device sends an Idle status to server in the plist format. <?xml version="1.0" encoding="UTF-8"?> Status Idle UDID [ redacted ] All the communication with the device is done using the Plist (Property list format), device understands this format easily. Q2: "It means in what form you send command from server and how you check that the command is done and send the feedback to the device" Server too sends command to the device in form of plist. For Example: Below is the plist sent for DeviceLock command from my mdm server when the device sends an Idle status response. <?xml version="1.0" encoding="UTF-8"?> Command RequestType DeviceLock CommandUUID ph_mdm_command_uuid Please Note: each command has a CommandUUID field which we can use to check…
has comment: http://stackoverflow.com/comment/48479733
has comment: http://stackoverflow.com/comment/48426805
has comment: http://stackoverflow.com/comment/48516744
has comment: http://stackoverflow.com/comment/49462096
score: 4
has comment: http://stackoverflow.com/comment/49464368
has comment: http://stackoverflow.com/comment/41265956
has comment: http://stackoverflow.com/comment/50110648
has comment: http://stackoverflow.com/comment/49398718

http://stackoverflow.com/q/24771072
has answer: http://stackoverflow.com/a/46534100
has answer: http://stackoverflow.com/a/46526509
has comment: http://stackoverflow.com/comment/38438694
has comment: http://stackoverflow.com/comment/38438492
downvote count: 1
upvote count: 17
has comment: http://stackoverflow.com/comment/38438291
tagged with: java
has answer: http://stackoverflow.com/a/46416904
has comment: http://stackoverflow.com/comment/38441976
type: Question
answer count: 7
has answer: http://stackoverflow.com/a/24771232
has comment: http://stackoverflow.com/comment/38458742
favorite count: 0
has body: I want to know how to use synchronized blocks across classes. What I mean is, I want to have synchronized blocks in more than one class but they're all synchronizing on the same object. The only way that I've thought of how to do this is like this: //class 1 public static Object obj = new Object(); someMethod(){ synchronized(obj){ //code } } //class 2 someMethod(){ synchronized(firstClass.obj){ //code } } In this example I created an arbitrary Object to synchronize on in the first class, and in the second class also synchronized on it by statically referring to it. However, this seems like bad coding to me. Is there a better way to achieve this?
has comment: http://stackoverflow.com/comment/38438716
has answer: http://stackoverflow.com/a/46402637
has answer: http://stackoverflow.com/a/46508699
has comment: http://stackoverflow.com/comment/38440849
has comment: http://stackoverflow.com/comment/38438185
has title: How to use synchronized blocks across classes?
has answer: http://stackoverflow.com/a/46465313
tagged with: synchronization
has comment: http://stackoverflow.com/comment/38438397
has comment: http://stackoverflow.com/comment/38448350
has comment: http://stackoverflow.com/comment/38438067
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38476701
score: 16

http://stackoverflow.com/q/24900868
downvote count: 1
type: Question
score: -1
has title: Android BroadcastReceiver get data from other Activity [ Different File ]
tagged with: nullpointerexception
answer count: 1
has comment: http://stackoverflow.com/comment/38683950
favorite count: 0
has body: Sorry first, i've create Android Project that based on IOIO, my application is like logging application, here i have 2 java file the first file is MainActivity.java and the second one is AlarmReceiver.java the problem is, when MainActivity executing AlarmReceiver.java using AlarmManager method [ _AlarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 10000, _PendingIntent) ] the AlarmReceiver.java automatically will execute onReceive(Context context, Intent intent) which in there will execute _CsvFileExporter.Export(_File, new MainActivity().getData()); and Error appear caused by NullPointerException on method called from AlarmReceiver > onReceive > new MainActivity().getData() and here the code in getData() try{ TextView tvwBattery = (TextView) findViewById(R.id.tvwBatteryLevel); TextView tvwIOIO = (TextView) findViewById(R.id.tvwWaterLevel); String asd = (String) tvwBatteryLevel.getText(); return asd; }catch(Exception e){ Log.e(TAG_LOG, "ERROR " + e.getMessage()); } error actually at findViewById... why ?? is there another way to get data from MainActivity.java [ data from MainActivity to AlarmReceiver ] ? Sorry for bad english
tagged with: android-broadcast
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24905022
upvote count: 0
tagged with: java

http://stackoverflow.com/q/24801966
has comment: http://stackoverflow.com/comment/38496273
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38496412
has comment: http://stackoverflow.com/comment/38496589
upvote count: 0
has comment: http://stackoverflow.com/comment/38496336
has comment: http://stackoverflow.com/comment/38497063
tagged with: java
has title: How to loop json in android?
type: Question
has comment: http://stackoverflow.com/comment/38496367
score: -1
has answer: http://stackoverflow.com/a/24802053
has comment: http://stackoverflow.com/comment/38496221
has comment: http://stackoverflow.com/comment/38496898
answer count: 1
downvote count: 1
has body: { "contacts":[ { "state":"active", "name":"xxxx", "email":"xxxx@gmail.com", "address":"xx-xx-xxxx,x - street, x - country", "gender":"male" }, { "state":"inactive", "name":"Jyyyy", "email":"johnny_depp@gmail.com", "address":"xx-xx-xxxx,x - street, x - country", "gender":"male" } ] } Here is an example json. I have created different xml layout for my list adapter with respect to the state of the person like if he is active or inactive etc. Each layout consist different information's. When i run my code all the data are shown in the layout of last state in json. For example if i run the above json "state:active" also comes in the inactive layout. How can i show them in different layouts? should i use different adapters for each state? if (state.equals("active")) { ListAdapter adapter = new SimpleAdapter(SecondActivity.this, oslist, R.layout.list_sec, new String[]{TAG_NAME, TAG_COUN, TAG_API, TAG_TEAM1, TAG_TEAM2, BAT_NAME, BAT_DESC, BOWL_NAME, BOWL_DESC, TAG_MATCHID}, new int[]{R.id.name, R.id.coun, R.id.api, R.id.team1, R.id.team2, R.id.batteam, R.id.batdesc, R.id.bowlteam, R.id.bowldesc, R.id.full}); list.setAdapter(adapter); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // Object obj = parent.getItemAtPosition(position); String selected = ((TextView) view.findViewById(R.id.full)).getText().toString(); // Log.v("url", "Creating view..." + name); // Launching new Activity on selecting single List Item Intent i = new Intent(getApplicationContext(), Four.class); // sending data to new activity i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra("id3", selected); startActivity(i); } }); } else if (state.equals("hold")) { ListAdapter adapter = new SimpleAdapter(SecondActivity.this, oslist, R.layout.list_preview, new String[]{TAG_NAME, TAG_COUN, TAG_API, TAG_TEAM1, TAG_TEAM2}, new int[]{R.id.name, R.id.coun,…
favorite count: 0

http://stackoverflow.com/comment/38556915
score: 0
comment on: http://stackoverflow.com/q/24830515
type: Comment
type: QuestionComment
has text: It doesn't work for me? I was assuming yours worked because you were using a List[Stream] ...

http://stackoverflow.com/a/24792412
has comment: http://stackoverflow.com/comment/38479330
has comment: http://stackoverflow.com/comment/38479063
score: 4
upvote count: 4
has body: The while loop condition represents a logical error, not any kind of runtime error thrown by the JVM. The sum will always be "not 4" or "not 5" or "not any other number". You want a logical "and". Try while(sum!=4 &amp;&amp; sum!=5 &amp;&amp; sum!=6 &amp;&amp; sum!=8 &amp;&amp; sum!=9 &amp;&amp; sum!=10){ You could also condense the list a little with: while((sum &lt; 4 || sum &gt; 6) &amp;&amp; (sum &lt; 8 || sum &gt; 10)){ Or: List&lt;Integer&gt; exitValues = Arrays.asList(4, 5, 6, 8, 9, 10); while(!exitValues.contains(sum)){
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24792397
type: Answer
accepted answer of: http://stackoverflow.com/q/24792397

http://stackoverflow.com/q/24805827
has comment: http://stackoverflow.com/comment/38503518
duplicate of: http://stackoverflow.com/q/3802370
tagged with: java
score: 0
upvote count: 1
answer count: 1
downvote count: 1
tagged with: algorithm
has comment: http://stackoverflow.com/comment/38504126
has answer: http://stackoverflow.com/a/24807067
has comment: http://stackoverflow.com/comment/38504493
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38524371
favorite count: 0
has comment: http://stackoverflow.com/comment/38505302
has body: I have a defined a class to manage the game room. When a user creates a new room, I generate a new room with unique room number and add it to the hashset. Now ,I hope to remove that Room object from the hashset and recycle the Room object for perfarmance issue, say 24 hours , or the abandoned Room object will spend most of my mememory How can I achieve this? Also, any suggestion to improve the performance will be highly appreciated. My class is as follows: public class RoomService { private RoomService(){ super(); } private HashSet&lt;Room&gt; roomSet =new HashSet&lt;Room&gt;(); private static RoomService instance =new RoomService(); public static RoomService getServiceInstance(){ return instance; } private static Integer generateRandom(int length) { Random random = new Random(); char[] digits = new char[length]; digits[0] = (char) (random.nextInt(9) + '1'); for (int i = 1; i &lt; length; i++) { digits[i] = (char) (random.nextInt(10) + '0'); } return Integer.decode(new String(digits)); } /** * Generate new Room with an unique Room number * @return */ public Room newRoom(){ Room newRoom; do{ newRoom =new Room(generateRandom(4)); } while(!roomSet.add(newRoom)); return newRoom; }} public class Room { private Integer roomNum; private Date createTime=new Date(); private String creatorId; /* * constructor */ public Room(Integer roomNum) { super(); this.roomNum = roomNum; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((roomNum == null) ? 0 : roomNum.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Room other = (Room) obj; if (roomNum == null) { if (other.roomNum != null) return false; } else if (!roomNum.equals(other.roomNum)) return false; return true; } //getter and setter // // public String getCreatorId() { return creatorId; } public void setcreatorId(String creatorId) { this.creato…
type: Question
has title: How can I schedule to recycle the object after several minutes
accepted answer: http://stackoverflow.com/a/24807067
linked to: http://stackoverflow.com/q/3802370

http://stackoverflow.com/q/24836365
type: Question
tagged with: jtextarea
accepted answer: http://stackoverflow.com/a/24836472
has comment: http://stackoverflow.com/comment/38561295
has comment: http://stackoverflow.com/comment/38561231
has body: I was told by an experienced developer that it's a bad idea to pass around an instance of a GUI. Basically I have a class that builds and displays a GUI. In an actionListener I create an object that does some time intensive tasks and I wanted to display a status as certain milestones of the task are completed. Here is a very simplified version of the class: public class MyGui extends JFrame { private static final long serialVersionUID = 1L; private JPanel mainPanel; private JPanel selectionPanel; private JPanel activityPanel; private JPanel executePanel; private JButton connectButton; private JButton disconnectButton; private JButton abortButton; private JList aList; private JComboBox comboBox; private JRadioButton primaryButton; private JRadioButton secondaryButton; private static JTextArea activityTextArea; MyGui() { this.setTitle("My Tool"); mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(3, 1)); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); mainPanel.setBackground(Color.darkGray); this.add(mainPanel); createMainSelectionArea(); createNodeSelectionArea(); createStatusArea(); createExecuteArea(); mainPanel.add(selectionPanel); mainPanel.add(activityPanel); mainPanel.add(executePanel); this.add(mainPanel); this.setResizable(false); addActivity("test1"); addActivity("test2"); addActivity("test3"); addActivity("test4"); addActivity("test5"); addActivity("test6"); this.setSize(600, 400); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private void createMainSelectionArea() { RadioButtonListener radioButtonListener = new RadioButtonListener(); primaryButton = new JRadioButton("Primary"); primaryButton.setBackground(Color.darkGray); primaryButton.setForeground(Color.white); primaryButton.addActionListener(radioButtonListener); secondaryButton = new JRadioButton("Secondary"); secondaryButton.setBackground(Color.darkGray); secondaryButton.setForeground(Color.white); secondaryButton.addActionListener(radioB…
score: 0
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/38561284
tagged with: interface
has answer: http://stackoverflow.com/a/24836472
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38561462
tagged with: java
has comment: http://stackoverflow.com/comment/38561254
has title: Using an interface to update a GUI
has comment: http://stackoverflow.com/comment/38561323

http://stackoverflow.com/q/24775329
answer count: 2
has body: I was developing a game using the Libgdx game library. I came up with this problem while trying to animate from one corner point to touch point using libgdx. Used this tutorial for understanding basics of Libgdx animation basics Link. I am not able to find how animations in libgdx works,Normal movement of frames takes place but how to start single time normal animation upon touch on screen. Thanks in advance for help. Edit: My class implements Screen This is what i tried In class default constructor animation=new Animation(1/15f, atlas1.getRegions()); In Render method :- To check touch public void touched() { if(Gdx.input.isTouched()) { touched = true; x = Gdx.input.getX(); y = Gdx.input.getY(); velocityX = (x - animationX) / 100; velocityY = (y - animationY) / 100; } } After calling touch method For animation public void anim() { if (touched) { elapsedTime += Gdx.graphics.getDeltaTime(); //animationX += velocityX; // animationY += velocityY; batch.draw(animation.getKeyFrame(elapsedTime, false), x, y); animfinished=animation.isAnimationFinished(elapsedTime); } if(touched) { batch.draw(bullettouch, x, y, bullettouch.getRegionWidth(), bullettouch.getRegionHeight()); } }
has comment: http://stackoverflow.com/comment/38447062
has answer: http://stackoverflow.com/a/25526084
tagged with: android
has answer: http://stackoverflow.com/a/24775617
tagged with: opengl-es
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38446962
has title: How to animate a sprite sheet/texture regions from 1 corner to touch point in libgdx?
downvote count: 1
has comment: http://stackoverflow.com/comment/38487661
tagged with: libgdx
score: 1
tagged with: android-animation
tagged with: java
has comment: http://stackoverflow.com/comment/38446809
has comment: http://stackoverflow.com/comment/38446900
type: Question

http://stackoverflow.com/a/24786181
answers question: http://stackoverflow.com/q/24786047
downvote count: 0
upvote count: 2
type: Answer
has body: In your actionPerformed, all you have to do is: getContentPane().removeAll(); repaint();
score: 2

http://stackoverflow.com/a/24775809
score: 0
answers question: http://stackoverflow.com/q/24775557
type: Answer
has body: As correctly pointed out the problem is in this line -: mainpri.put(1,pristatus); You are always putting the value against the key 1, instead replace it with -: mainpri.put(count,pristatus);

http://stackoverflow.com/comment/38652284
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24884266
type: AnswerComment
has text: As written above this is exactly what I have and which does not work in combination with additional applicationContext.xml on a tomcat.

http://stackoverflow.com/q/24766922
has title: Gradle Android Maven Plugin doesn't create the pom file automatically
downvote count: 0
type: UnansweredQuestion
tagged with: gradle
has answer: http://stackoverflow.com/a/24829910
type: Question
tagged with: java
has body: I would like to know how to create a pom file with "Gradle Android Maven Plugin". I followed the steps on http://www.gradle.org/docs/current/userguide/maven_plugin.html (chapter "Convention Methods"). I also created the directory "buildDir" and get no errors. The App was build successfully but nevertheless the pom file doesn't exist. I am using Android Studio IDE. Is it possible that the newpom.xml file exists on runtime only and does not exist in my project folder buildDir after runtime? Maybe I am looking for something which can't be found. My app/build.gradle looks like this: apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { minSdkVersion 16 targetSdkVersion 19 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } apply plugin: 'maven' task writeNewPom &lt;&lt; { pom { project { inceptionYear '2008' licenses { license { name 'The Apache Software License, Version 2.0' url 'http://www.apache.org/licenses/LICENSE-2.0.txt' distribution 'repo' } } } }.writeTo("$buildDir/newpom.xml") } dependencies { compile 'com.android.support:support-v4:+' compile 'com.google.code.gson:gson:2.2.4' compile 'com.android.support:appcompat-v7:+' compile files('libs/retrofit-1.5.1.jar') } Can someone tell me if I missed something? :) Best Regards, Philip
score: 5
answer count: 1
favorite count: 0
upvote count: 5
tagged with: android
tagged with: pom.xml
tagged with: maven-plugin

http://stackoverflow.com/comment/38443033
type: Comment
type: QuestionComment
has text: Can you show us how this array is defined?
score: 0
comment on: http://stackoverflow.com/q/24773739

http://stackoverflow.com/comment/38667618
type: AnswerComment
type: Comment
has text: Also I think I found a bug, OObjectLazySet.contains(null) or OBjectLazySet.remove(null) are giving null pointer exception (it seems OrientDb is trying to serialize the nulls). Since they implement Set those methods calls should work.
score: 0
comment on: http://stackoverflow.com/a/24875673

http://stackoverflow.com/q/24766591
has comment: http://stackoverflow.com/comment/38430725
has answer: http://stackoverflow.com/a/53029322
has comment: http://stackoverflow.com/comment/38429945
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30329717
possible better answer: http://stackoverflow.com/a/29811355
score: 91
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/38459120
has answer: http://stackoverflow.com/a/32190543
type: Question
has answer: http://stackoverflow.com/a/32597398
has answer: http://stackoverflow.com/a/53572753
has answer: http://stackoverflow.com/a/37424885
has answer: http://stackoverflow.com/a/28340789
has answer: http://stackoverflow.com/a/35341651
answer count: 16
has answer: http://stackoverflow.com/a/69756759
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/38430398
has answer: http://stackoverflow.com/a/24767013
accepted answer: http://stackoverflow.com/a/24767013
has answer: http://stackoverflow.com/a/29811355
has answer: http://stackoverflow.com/a/52296474
downvote count: 1
has title: javac: invalid target release: 1.8
favorite count: 0
has answer: http://stackoverflow.com/a/47871682
has answer: http://stackoverflow.com/a/40559441
tagged with: netbeans
has body: I recently downloaded JDK 1.8.0.0_06 that comes bundled with NetBeans. I then got to find out that my JavaFx project, that I have been developing in Java 1.7 won't compile in Java 1.8, and so I stepped down my JDK to 1.7. Still I can't get it to work/ compile. I get this error: javac: invalid target release: 1.8 Usage: javac &lt;options&gt; &lt;source files&gt; I'm really stuck and would greatly appreciate any help.
upvote count: 92
has answer: http://stackoverflow.com/a/27834080
has comment: http://stackoverflow.com/comment/38430696
has comment: http://stackoverflow.com/comment/38430351

http://stackoverflow.com/comment/38589722
has text: How do you save the txt to user.home ? Your code does not include the saving part.
comment on: http://stackoverflow.com/q/24851461
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24799497
answer count: 1
has body: I am using below code running it as a thread from another File. ProgressBar is added to the frame in ProgressBarInit function which I am calling before starting thread frame is displayed from application but progressBar and progressLabel is not displaying. any help will be appreciated. import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; public class ProgressBar extends JPanel implements Runnable { /** * */ private static ProgressBar progressBar = new ProgressBar(); private static final long serialVersionUID = -7461782745560910276L; private static final int MINIMUM_VALUE = 0; private static final int MAXIMUM_VALUE = 100; static public JProgressBar pbar; private static int totalProgress; private static int completedProgress; static JLabel progressLabel; JLabel spacer; static public JFrame frame = new JFrame("Progress...."); static public JPanel panel = new JPanel(); public static int getCompletedProgress() { return completedProgress; } public static void setCompletedProgress(int completedProgress) { ProgressBar.completedProgress = completedProgress; } public static int getTotalProgress() { return totalProgress; } public static void setTotalProgress(int totalProgress) { ProgressBar.totalProgress = totalProgress; } private ProgressBar() { //Empty Constructor } public static ProgressBar getInstance() { return progressBar; } public void ProgressBarInit() { // initialize Progress Bar pbar = new JProgressBar(); progressLabel = new JLabel("In Progress.."); pbar.setMinimum(MINIMUM_VALUE); pbar.setMaximum(MAXIMUM_VALUE); pbar.setName("Progress"); //pbar.setSize(10000, 1000); panel.setSize(300, 80); panel.add(pbar); //panel.add(); panel.add(progressLabel); panel.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(200, 200, 300, 80); frame.add(panel); //frame.add(progressLabel); frame.setResizable(false); } @Override public void run() { frame.setVisible(true); while(getCompletedProg…
accepted answer: http://stackoverflow.com/a/24799670
tagged with: multithreading
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24799670
tagged with: java
type: Question
has title: Jpanel is not showing while running as a thread
score: 0

http://stackoverflow.com/a/24903317
accepted answer of: http://stackoverflow.com/q/24903259
score: 36
upvote count: 36
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The Java Doc (http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) says: For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created. For example, using a pattern of "MM/dd/yy" and a SimpleDateFormat instance created on Jan 1, 1997, the string "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" would be interpreted as May 4, 1964. The method SimpleDateFormat.set2DigitYearStart(Date) can be used to fix the year.
answers question: http://stackoverflow.com/q/24903259

http://stackoverflow.com/comment/38521541
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24809032
has text: Installed android studio and it worked, don`t know what kind of sorcery it have done but anyway, thanks for your help.
score: 0

http://stackoverflow.com/q/24841423
has body: Previously in my machine, for javac -version I was getting javac 1.6.0_65 I needed JDK 8 so I downloaded it from here and installed it. But still I am getting the same version. But when I am running `/usr/libexec/java_home -v 1.8 --exec javac -version` I am getting `javac 1.8.0_11`. What I am doing wrong?
downvote count: 0
has title: JDK is updated but previous version is still getting shown as current version
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: java-8
score: 3
tagged with: installation
tagged with: configuration
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24841429
has comment: http://stackoverflow.com/comment/38570584

http://stackoverflow.com/a/27242048
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/24870297
upvote count: 0
has body: There are a bunch of options available to you, Spring Boot gives you some nice ones which give you that override chain you were looking for (using Profiles). I wrote a blog piece about some of that. If you want distributed configuration management you may want to explore Spring Cloud which looks quite promising however I have yet to try it.
type: Answer

http://stackoverflow.com/comment/38484090
comment on: http://stackoverflow.com/q/24793247
score: 0
type: Comment
type: QuestionComment
has text: Why do you think that its the WebSphere deployment that is causing problems? Where is that exception thrown?

http://stackoverflow.com/comment/38420706
has text: Well, why are you instantiating CreepIDs? If you're not (and you don't have a constructor), make it a static class.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24761460
type: Comment

http://stackoverflow.com/comment/38515398
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24811400
has text: Typically you either hold settings in a singleton class or a shared preference, depending on if you want them to be sticky between runs of the application or not. In addition, using shared preferences lets you use PreferenceActivity which will do most of the work of a settings screen for you
score: 0

http://stackoverflow.com/q/24778109
type: Question
tagged with: eclipse
tagged with: google-maps
upvote count: 0
answer count: 1
has body: I am creating an android app having google maps.I want to show the current location as the default blue dot with the current location button.The blue dot and the button is shown fine on a newer version of android.But on a older device ,it is not shown on the first running of the app but is fine from the second attempt.I have tried using android support library but to no avail. The code i have used is shown below: public void getcurrentlocation() { locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // Creating a criteria object to retrieve provider Criteria criteria = new Criteria(); // Getting the name of the best provider String provider = locationManager.getBestProvider(criteria, true); Location location = locationManager.getLastKnownLocation(provider); if(location!=null) { current_latitude = location.getLatitude(); current_longitude = location.getLongitude(); initialiseMap(); } locationManager.requestLocationUpdates(provider, 20000, 0, this); } public void initialiseMap() { if (googleMap == null) { googleMap = ( (SupportMapFragment) getSupportFragmentManager().findFragmentById( R.id.map)).getMap(); } // check if map is created successfully or not if (googleMap == null) { Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); } else { googleMap.setMyLocationEnabled(true); googleMap.getUiSettings().setMyLocationButtonEnabled(true); googleMap.getUiSettings().setCompassEnabled(true); // UiSettings uiSettings = googleMap.getUiSettings(); // uiSettings.setMyLocationButtonEnabled(true); } //locationManager.requestLocationUpdates(provider, 20000, 0, this); LatLng latLng = new LatLng(current_latitude, current_longitude); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Zoom in the Google Map //googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12f)); new RetrieveStoreDetails().execute(); } Is there a workaround to show t…
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24778178
has title: Blue bubble of current location in google maps not showing during first attempt in android
score: -1
tagged with: java
downvote count: 1

http://stackoverflow.com/a/24841795
score: 0
answers question: http://stackoverflow.com/q/24839323
type: Answer
has body: Unfortunately I don't have access to a Windows machine to test this on right now but here is what I think should be interoperable. public static byte[] encrypt(String passphrase, byte[] data) throws Exception { // Hash the ASCII-encoded passphrase with md5 byte[] keyData = passphrase.getBytes(Charset.forName("US-ASCII")); MessageDigest md = MessageDigest.getInstance("MD5"); byte [] md5HashOfKey = md.digest(keyData); // Need to use bouncycastle (spongycastle on Android) to get RC2 Security.addProvider(new BouncyCastleProvider()); Cipher rc2 = Cipher.getInstance("RC2/CBC/PKCS5PADDING"); // Create an RC2 40-bit key from the 1st 5 bytes of the hash. SecretKeySpec rc2KeySpec = new SecretKeySpec(md5HashOfKey, 0, 5, "RC2"); rc2.init(Cipher.ENCRYPT_MODE, rc2KeySpec); byte [] cipher = rc2.doFinal(data); return cipher; }

http://stackoverflow.com/comment/38611109
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24861983
has text: Is this a single column grid layout? Consider using a `JList` instead (either way).

typeconverter
type: Tag
tag name: typeconverter
tags question: http://stackoverflow.com/q/24769415

http://stackoverflow.com/comment/86854608
has text: Possible duplicate of [eclipse > java > open linked resources sources (.java instead of .class )?](https://stackoverflow.com/questions/8603292/eclipse-java-open-linked-resources-sources-java-instead-of-class)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24760561

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/24784945
tag name: google-oauth

http://stackoverflow.com/q/24816954
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24817186
has body: I know subSequence returns a charSequence which is a read-only. Also, String class implements CharSequence. subString returns a String. But, amongst subsequence and substring, when and which one to prefer
type: Question
tagged with: charsequence
tagged with: substring
answer count: 3
score: 3
tagged with: subsequence
downvote count: 0
tagged with: string
favorite count: 0
type: UnansweredQuestion
has title: When to use String.subSequence method over String.subString?
has answer: http://stackoverflow.com/a/24817091
has answer: http://stackoverflow.com/a/24817008

http://stackoverflow.com/a/24775324
has body: It's part of the dark side of spring ... If you do not register any conversion service, it automatically does it and chooses a very nice, with a lot of default converters. As soon as you register your own, it assumes you know why and does not add anything to your config ... and you have lost all the default converters ! So you should : first register what is spring default : a FormattingConversionServiceFactoryBean (I found it through debugging ...) => fine you have all defaults converters ! add all your converters to this one In full XML config, it could look like : java.lang.String package.to.IMRM If you do no like MethodInvokingFactoryBean, you can use a Configuration bean to do some java config, or make you converter an IntializingBean and register it in a afterPropertiesSet.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24772329
downvote count: 0
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24772329
has comment: http://stackoverflow.com/comment/46998061

http://stackoverflow.com/q/24763212
linked to: http://stackoverflow.com/q/3177733
has comment: http://stackoverflow.com/comment/38423253
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38423093
has comment: http://stackoverflow.com/comment/38423525
has comment: http://stackoverflow.com/comment/38423110
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38423319
tagged with: jsp
has body: When I try to instantiate an class inside my JSP page, I Get the following error: An error occurred at line: 5 in the jsp file: /ProcessSale.jsp UniversalPlugin cannot be resolved to a type 2: &lt;%@ page import="java.util.*" %&gt; 3: &lt;%@ page import="com.aciworldwide.commerce.gateway.plugins.*, com.sun.org.apache.xalan.internal.xsltc.compiler.Parser" %&gt; 4: &lt;% 5: UniversalPlugin o = new UniversalPlugin(); 6: %&gt; Follow my code: &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ page import="java.util.*" %&gt; &lt;%@ page import="com.aciworldwide.commerce.gateway.plugins.*, com.sun.org.apache.xalan.internal.xsltc.compiler.Parser" %&gt; &lt;% UniversalPlugin o = new UniversalPlugin(); %&gt; How I can to do it inside a JSP page?
score: 0
has comment: http://stackoverflow.com/comment/38423064
has title: JSP Error - Eclipse
has comment: http://stackoverflow.com/comment/38423948

spring-data
tags question: http://stackoverflow.com/q/24768849
tags question: http://stackoverflow.com/q/24834545
tags question: http://stackoverflow.com/q/24857499
tags question: http://stackoverflow.com/q/24759163
tags question: http://stackoverflow.com/q/24827456
tags question: http://stackoverflow.com/q/24849916
type: Tag
tags question: http://stackoverflow.com/q/24878980
tags question: http://stackoverflow.com/q/24808446
tag name: spring-data

apache-kafka
tags question: http://stackoverflow.com/q/24829689
tags question: http://stackoverflow.com/q/24811905
tags question: http://stackoverflow.com/q/24902301
tags question: http://stackoverflow.com/q/24883455
tags question: http://stackoverflow.com/q/24859145
type: Tag
tags question: http://stackoverflow.com/q/24863598
tag name: apache-kafka

http://stackoverflow.com/a/24905162
downvote count: 0
has comment: http://stackoverflow.com/comment/38691961
type: Answer
answers question: http://stackoverflow.com/q/24904956
has comment: http://stackoverflow.com/comment/38698272
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24904956
has body: It is different because you create two Timestamps a few seconds apart. You should create one timestamp and write to both places. Untested: Timestamp stamp = new Timestamp(new Date().getTime()); preparedStatement.setTimestamp(2, stamp); bufferedWriter.write(stamp) To store fractional seconds in MySQL see 11.3.7 Fractional Seconds in Time Values: MySQL 5.7 has fractional seconds support for TIME, DATETIME, and TIMESTAMP values, with up to microseconds (6 digits) precision: To define a column that includes a fractional seconds part, use the syntax type_name(fsp), where type_name is TIME, DATETIME, or TIMESTAMP, and fsp is the fractional seconds precision. For example: CREATE TABLE t1 (t TIME(3), dt DATETIME(6)); The fsp value, if given, must be in the range 0 to 6. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. (This differs from the standard SQL default of 6, for compatibility with previous MySQL versions.)
has comment: http://stackoverflow.com/comment/38693082
type: AcceptedAnswer

http://stackoverflow.com/q/24903986
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24906143
accepted answer: http://stackoverflow.com/a/24906143
has comment: http://stackoverflow.com/comment/38690835
has body: The Below Code is the apache poi code for create excel cell with text value want the text value as currency. Code : row1= sheetNormal.createRow((short)2); row1.setHeight((short)(256 *1.5)); header = row1.createCell((short)1); header.setCellValue(Integer.parseInt(500000)); desired output in excel:-5,00,000 the output is shown in the form of the text.
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/38691033
has title: Formatting cellvalue in apache poi as accounting or currency for numbers
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 2
tagged with: apache

printers
tag name: printers
type: Tag
tags question: http://stackoverflow.com/q/24905203

http://stackoverflow.com/q/24887984
has answer: http://stackoverflow.com/a/24888662
has answer: http://stackoverflow.com/a/24888840
duplicate of: http://stackoverflow.com/q/3526485
type: UnansweredQuestion
tagged with: java
score: -4
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38659362
has comment: http://stackoverflow.com/comment/38659176
downvote count: 5
has title: Subtracting two dates gives error "The operator - is undefined for the argument type(s) java.util.Date, java.util.Date"
tagged with: date
linked to: http://stackoverflow.com/q/3526485
answer count: 2
linked to: http://stackoverflow.com/q/7103064
has body: In below code on subtracting date from a date giving this error "The operator - is undefined for the argument type(s) java.util.Date, java.util.Date" variable currentDate is a String; why I couldn't save it in Date variable like this Date currentDate = ddmmyy.format(new Date()); , does .format function returns String? public class AgeCalculator { public static SimpleDateFormat ddmmyy=new SimpleDateFormat("dd/mm/yyyy"); public static void main(String[] args) throws Exception { String dob = "05/01/1993"; Date mod_date = ddmmyy.parse(dob); String currentDate = ddmmyy.format(new Date()); Date mod_currentDate = ddmmyy.parse(currentDate); int days = mod_currentDate-mod_date; } }
favorite count: 0

http://stackoverflow.com/comment/38658065
has text: I'm not positive what texture_Ocean is, but if you can save off in a static or member variable, and get the width and height, you save some good processing each iteration right there.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24887402

http://stackoverflow.com/comment/38435210
type: Comment
comment on: http://stackoverflow.com/q/24769413
type: QuestionComment
score: 0
has text: First things first: C++ is not Java. Most Java idioms are atrocious anti-patterns in C++. Anyway, OO-dogmatic style faux-encapsulation is bad in either camp.

http://stackoverflow.com/a/24851753
score: 2
answers question: http://stackoverflow.com/q/24851719
downvote count: 0
upvote count: 2
has body: you have to initilaze cataloge Cataloge catalog= new Cataloge();
type: Answer

http://stackoverflow.com/q/24900614
favorite count: 0
has comment: http://stackoverflow.com/comment/38683605
score: -3
accepted answer: http://stackoverflow.com/a/24901004
possible better answer: http://stackoverflow.com/a/24900645
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24900645
upvote count: 2
has body: I have seen something that explains the reason why the HashMap is unsafed in multiple thread. It said, when do the resize, the entire sequence of objects in linked list gets reversed, and it shows the example: For example, lets assume there are 3 keys with same hashcode and hence stored in linked list inside a bucket [below format is in object_value(current_address, next_address) ] Initial structure: 1(100, 200) --> 2(200, 300) --> 3(300, null) After resizing by thread-1: 3(300, 200) --> 2(200, 100) --> 1(100, null) When thread-2 starts resizing, its again starts with 1st element by placing it at the head: 1(100, 300) --> 3(300, 200) --> 2(200, 100) ==> which becomes a infinite loop for next insertion and thread hangs here. I was so confused about the example, Initial Structure: 1 -> 2 -> 3 Thread1: 3->2->1 Thread2: 1 -> 3 ->2 why? Could anyone help me to analyse the example or show a more detail exmpale? Thanks.
tagged with: multithreading
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/38684073
tagged with: java
downvote count: 5
has answer: http://stackoverflow.com/a/24901004
has comment: http://stackoverflow.com/comment/38683707
answer count: 3
has answer: http://stackoverflow.com/a/24902765
has title: Why the HashMap is unsafed in multiple threads?

http://stackoverflow.com/q/24750092
possible better answer: http://stackoverflow.com/a/24750274
tagged with: heap-pollution
answer count: 2
downvote count: 0
tagged with: generics
tagged with: variadic-functions
favorite count: 0
accepted answer: http://stackoverflow.com/a/24756348
upvote count: 8
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24750274
has comment: http://stackoverflow.com/comment/38398991
has body: I have a constructor like below public MyConstructor(MyObject&lt;T&gt; ... objects) { // ... } Eclipse warns me with the following message: Type safety: Potential heap pollution via varargs parameter objects I change the constructor like this: public MyConstructor(MyObject&lt;T&gt;[] objects) { // ... } Now, the warning disappears. However, I think the potential danger is not solved. Is this workaround valid ?
type: Question
has title: Is this a heap pollution work around?
score: 8
has answer: http://stackoverflow.com/a/24756348

http://stackoverflow.com/comment/38421496
score: 0
type: Comment
type: QuestionComment
has text: Oh, I don't know, I didnt pay attention to names, I just did the steps above, what does that mean?
comment on: http://stackoverflow.com/q/24762274

http://stackoverflow.com/comment/38462274
score: 0
type: AnswerComment
type: Comment
has text: I like your solution can you help me with the other one? @Arclight
comment on: http://stackoverflow.com/a/24782784

http://stackoverflow.com/a/24808474
has comment: http://stackoverflow.com/comment/125597156
score: 99
upvote count: 101
answers question: http://stackoverflow.com/q/24806183
has comment: http://stackoverflow.com/comment/118441274
type: Answer
has comment: http://stackoverflow.com/comment/118607165
downvote count: 2
has body: tl;dr Use the modern java.time classes. ZonedDateTime.now( // Capture the current moment in the wall-clock time used by the people of a certain region (a time zone). ZoneId.systemDefault() // Get the JVM’s current default time zone. Can change at any moment during runtime. If important, confirm with the user. ) // Renders a `ZonedDateTime` object. To see the same moment in UTC, extract a `Instant` object by calling `ZonedDateTime::getInstant`. You may omit the explicit call to ZoneId.systemDefault. (But I do not recommend this.) ZonedDateTime.now() // Capture the current moment in the JVM’s current default time zone. Parse your string as a LocalDateTime, and adjust into desired time zone. LocalDateTime.parse( "2014-02-14T06:04:00:00" ) // Parse a string lacking any indicator of time zone or offset-from-UTC. *Not* a specific point on the timeline. .atOffset( ZoneOffset.UTC ) // Apply UTC as we are certain that offset-from-UTC of zero was intended by the supplier of that input string. Returns a `OffsetDateTime` object. .atZoneSameInstant( // Adjust into another time zone. The `sameInstant` part means the same moment, different wall-clock time. ZoneId.of( "Africa/Tunis" ) // Specify the particular zone of interest to you. ) // Returns a `ZonedDateTime` object. Avoid java.util.Date & .Calendar These legacy classes are notoriously troublesome. Sun/Oracle added the java.time package in Java 8 to supplant them. That package was inspired by Joda-Time. Amongst the legacy classes’ problems is this confusing behavior: While a java.util.Date has no time zone information, it's toString implementation applies the JVM’s current default time zone when generating a String. So it misleads you by seeming to have a time zone when it does not. java.time I am trying to convert this string "2014-02-14T06:04:00:00", … Your input string lacks any indicator of time zone or offset-from-UTC. So we parse as a LocalDateTime, which lacks any concept of zone/offset. A LocalDateTime does not repres…

http://stackoverflow.com/a/24832303
answers question: http://stackoverflow.com/q/24823802
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/24823802
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: We know that if we create a method as synchronized, then only one thread is able to execute the task at a time. Not True! Two or more threads can enter the same synchronized block at the same time. And, that's not just in theory: It often happens in well-designed programs. Here's what two or more threads can not do: Two or more threads can not synchronize on the same object at the same time. If you want to insure that only one thread at a time can enter a particular method (but why?†) then you need to write the method so that all calls to it will synchronize on the same object. That's easy to do if it's a static method because this: class Foobar { synchronized MyType baz() { ... } } means the same as this: class Foobar { MyType baz () { synchronized (Foobar.class) { ... } } } All calls to a static synchronized method synchronize on the class object that owns the method. [what prevents two threads from synchronizing on the same object at the same time]? The operating system. Any JVM that you would want to use for real work uses native threads to implement Java threads. A native thread is a thread that is created and managed by calls to the operating system. In particular, it's a part of the operating system known as the scheduler. I am not going to go into the details of how an operating system scheduler works---there's whole books written about that topic---but its job is to decide which threads get to run, when, and on what processor. A typical scheduler uses queues to keep track of all of the threads that are not actually running. One special queue, the run queue, holds threads that are ready to run, but waiting for a CPU to run on. A thread on the run queue is called runnable. A thread on any other queue is blocked (i.e., not allowed to run) until something happens that causes the scheduler to put it back on the run queue. The operating system object corresponding to a Java monitor (See @TheLostMind's answer) often is called a mutex or a lock. For each mutex, the…

http://stackoverflow.com/comment/38533960
type: Comment
comment on: http://stackoverflow.com/q/24821983
score: 2
has text: Based solely on readability I would go for assertEquals().
type: QuestionComment

http://stackoverflow.com/a/24860582
type: Answer
accepted answer of: http://stackoverflow.com/q/24859145
score: 0
has body: 1) Getting list of topic from the Kafka cluster could be a tricky job as there are no such direct api available for this .. the best bet is to query zookeeper as Kafka use it to maintain all of its states, this links explains about the zookeeper data structure. You can read this link for a similar discussion 2) the example assumes that you will use it to fetch data from a given topic, you might try to create a list of topics and loop through them to see how it goes, some thing like for(String topic : topicList) { new ConsumerGroupExample(zooKeeper, groupId, topic).run(threads); } but not sure about the exact outcome of this, would be great if you could share your finding 3) Depends how much control you want over the topics based on your use cases. The high level does a lot of lot of bookkeeping and error handling but does not allow fine grain access over topic such as reading same message multiple times, consuming particular subset of messages etc where as all these functionality is provided by the simple consumer but in that case you need to handle cases like topic offset management, broker and leader detection etc. You should take a detail look in their consmer documentation for a much in-dept understanding of the same.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24859145

http://stackoverflow.com/comment/38498790
has text: if (name.equals("nana") && pwd.equals("12345")) { Intent i=new Intent(this, Qrcodescreen.class); startActivity(i); Toast.makeText(getBaseContext(), "Success!", Toast.LENGTH_SHORT).show(); } else Toast.makeText(getBaseContext(), "Invalid Login Details", Toast.LENGTH_SHORT).show(); break; } displayNextAlert(); } **Unreachable code**
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24803337

relative-path
type: Tag
tags question: http://stackoverflow.com/q/24832420
tag name: relative-path

http://stackoverflow.com/comment/38687804
comment on: http://stackoverflow.com/q/24902975
has text: possible duplicate of [synchronized block vs synchronized method?](http://stackoverflow.com/questions/574240/synchronized-block-vs-synchronized-method)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38486766
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24796341
has text: `07-17 11:49:40.802: E/AndroidRuntime(2219): FATAL EXCEPTION: main` `07-17 11:49:40.802: E/AndroidRuntime(2219): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abrosoft.trycommand/com.abrosoft.trycommand.MainActivity}: java.lang.NullPointerException` these are the exceptions i guess

http://stackoverflow.com/q/24830706
accepted answer: http://stackoverflow.com/a/24830993
type: Question
score: 0
answer count: 1
has title: How to add text inside an SWT window: Java, Eclipse
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24830993
tagged with: widget
tagged with: java
tagged with: swt
has body: I am extremely new to programming, as a matter of fact I began yesterday and have done both of the coding exercises included in Eclipse (Hello World and Hello World SWT) and would like to know how to add text inside this handy-dandy SWT window and possibly how to make choices? Or even a spot to input text? Pardon me if I'm a tad ambitious but after seeing how easy it was to make a text window, I thought it would be fairly easy to make a text adventure game. I would love any and all help, thank you.

http://stackoverflow.com/q/24860075
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/26329902
score: 5
upvote count: 5
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/39115538
tagged with: rest
has title: JAX-RS FileUpload with Apache CXF
has answer: http://stackoverflow.com/a/26329902
has body: I'm trying to upload a file with JAX-RS and TomEE's Apache CXF implementation (2.6.14), but the uploaded file is always null. Here is the code: @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile(@Multipart(value = "file") @NotNull Attachment attachment) throws UnsupportedEncodingException { try { System.out.println(attachment); return Response.ok("file uploaded").build(); } catch (Exception ex) { logger.error("uploadFile.error():", ex); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } and a very easy HTML-file for the upload: File: The request header looks fine: ------WebKitFormBoundaryOCleIjB2JgeySK0w Content-Disposition: form-data; name="file"; filename="git.txt" Content-Type: text/plain But the attachment is always null. Any suggestions? Thanks in advance.
has answer: http://stackoverflow.com/a/39115538
tagged with: web-services
type: AnsweredQuestion
tagged with: cxf
tagged with: java
type: Question

http://stackoverflow.com/q/24904532
score: 0
answer count: 2
has title: No getter method for property value of bean error with nested logic iterate tags
tagged with: java
tagged with: struts
possible better answer: http://stackoverflow.com/a/24904686
has answer: http://stackoverflow.com/a/24904686
tagged with: jsp
has body: I am trying to iterate an ArrayList "sampleBeanList" in my jsp using logic:iterate. Each SampleBean object contains a variable ArrayList "subBeanList" in it. I am using another logic:iterate tag inside the first tag to iterate such that once the form is submitted, I can retrieve the data in the form of ArrayList "sampleBeanList" and also ArrayList "subBeanList" variable for each SampleBean. I added setters and getters accordingly as shown below. But, I am not able to understand the problem because when I am running, I am getting the below error: "No getter method for property value of bean subBeanElement" Source Code: JSP: <logic:iterate id="toFamilyElement" name="myRolloverForm" property="sampleBeanList" indexId="toFamilyIndex" type="MYRolloverFamilyBean"> <%=sno%> <td align="center" rowspan="<bean:write name="toFamilyElement" property="toFamilyListSize"/>"> <bean:write name="toFamilyElement" property="fromFamily"/> <td align="center" rowspan="<bean:write name="toFamilyElement" property="toFamilyListSize"/>"> <%int toFamilyListCount = 0; %> <logic:iterate id="subBeanElement" name="toFamilyElement" property="toFamilyList" indexId="toFamilyListIndex" type="String"> <html:hidden styleId='<%="toFamilyCode[" + toFamilyCount+"]["+toFamilyListCount+"]"%>' indexed="true" name="subBeanElement" property="value"/> <bean:write name="subBeanElement" property="value"/> <%toFamilyListCount++; %> </logic:iterate> <%toFamilyCount++; sno++;%> </logic:iterate> MYRolloverForm (form bean which contains SampleBeanList variable): public class MYRolloverForm extends ActionForm { private ArrayList<SampleBean> sampleBeanList= new ArrayList<SampleBean>(); public ArrayList<SampleBean> getSampleBeanList() { return sampleBeanList; } public void setSampleBean(ArrayList<SampleBean> sampleBeanList) { this.sampleBeanList = sampleBeanList; } public void setToFamilyElement(int index, SampleBean value) { this.sampleBeanList.add(value); } public SampleBean getToFamilyElement(int index) { int size = sam…
has answer: http://stackoverflow.com/a/24930968
tagged with: arraylist
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24930968
type: Question

http://stackoverflow.com/comment/38398064
score: 0
has text: I would not use `fin.nextInt()` to read the data. The problem is that `Scanner` doesn't care about newlines when you're using `nextInt`, so it looks like just one big sequence of numbers. But you care about the newlines since you are treating the input as a 2D array. Consider using `nextLine()` to read each line, then for each line, you can create a new `Scanner` to scan the line as a `String`. (Yes, you can create a `Scanner` from a `String`. See the [javadoc](http://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#Scanner-java.lang.String-)).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24749388

http://stackoverflow.com/q/24875452
tagged with: servlets
tagged with: tomcat
has answer: http://stackoverflow.com/a/24877463
type: Question
has body: I have a small tomcat servlet using Jaxb/Jersey. The post handler returns an object that contains other objects. When the result gets back to the caller, the contained objects are mosly null - even though they weren't null in the servlet. -- servlet -- @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response postPlan( JAXBElement<String> mxml) throws IOException { iMetrix metrix_MIS = Metrix_MIS_Implementation.getInstance(); iMetrix_GeneratePlan_Response result = metrix_MIS.generatePlan(mxml.getValue()); PlanData data = new PlanData(); data.setJunk("Testing Junk"); data.setGuid(result.getProjectID()); data.setLog((Metrix_Log_Implementation) result.getLog()); InputStream planStream = result.getPlanZipStream(); if (planStream != null) { data.setPlanXML(IOUtils.readFully(planStream, -1, true)); } result.getLog().dump(System.out); return Response.ok(data).build(); } --Calling app-- Client client = ClientBuilder.newClient(); WebTarget web = client.target(url); Entity<String> entity = Entity.entity(mxmlProjectString, MediaType.APPLICATION_XML_TYPE); Response resp = web.request(MediaType.APPLICATION_XML_TYPE).post(entity); int status = resp.getStatus(); System.out.println(status + "-" + resp.getStatusInfo().toString()); System.out.println(resp.toString()); System.out.println(resp.readEntity(String.class)); The servlet prints out a bunch of data from getLog().dump() line. The caller just gets an empty log object: 200-OK InboundJaxrsResponse{ClientResponse{method=POST, uri=http://192.168.187.128:8080/MetrixServer/rest/Plan/v1, status=200, reason=OK}} <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Testing Junk <log/> So, what am I missing? PlanData is: @XmlRootElement public class PlanData { private String guid; private byte[] planXML; private Metrix_Log_Implementation log; private String junk; ... getters/setters left out... Metrix_Log_Implementation: @XmlRootElement(name = "MetrixLog") public class Metrix_Log_Implementation im…
has comment: http://stackoverflow.com/comment/38639693
score: 0
tagged with: java
tagged with: jaxb
has title: Jaxb/Jersey servlet data isn't being returned correctly
answer count: 1
has comment: http://stackoverflow.com/comment/38636425
tagged with: jersey
type: UnansweredQuestion

http://stackoverflow.com/comment/38413773
type: QuestionComment
has text: @user2590541 do you network operation using a thread asynctask or volley or use retrofit. cannot do network peration on the ui thread
comment on: http://stackoverflow.com/q/24758195
score: 0
type: Comment

http://stackoverflow.com/q/24784749
linked to: http://stackoverflow.com/q/24771467
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24786896
favorite count: 0
has comment: http://stackoverflow.com/comment/38465004
linked to: http://stackoverflow.com/q/24793800
has body: See followup question: Followup part 2 -- Using Maven to only sign and deploy jars to Maven Central. Build and compilation is done entirely with Ant This is a follow up to this question: How to use Maven to only sign three jars and push them to Maven Central? My goal here is to have Maven sign and push the already created jars to Maven Central. The three jars xbnjava-0.1.2.jar xbnjava-0.1.2-sources.jar xbnjava-0.1.2-javadoc.jar are located in R:\jeffy\programming\build\xbnjava-0.1.1\download These jars are created independently, by my Ant build process. Maven is not used for building or compiling my project in any way--I'm only using it to put the jars on Maven Central. (With some help in my previous question, it seems the signing portion of my POM is at least a lot closer to what it needs to be.) When executing mvn deploy, I'm getting the error Return code is: 401, ReasonPhrase: Unauthorized. Maven is not asking me for my key-passphrase, which I expect it should, and I don't see where this information (the location of my saved key?) is configured. (Signing files is new to me, so please forgive any incorrect terminology). (Also, the project's groupId is com.github.xbn, but there is no xbn directory in https://oss.sonatype.org/content/repositories/snapshots/com/github/ I've opened a support ticket on sonatype regarding this, although I don't know if it's part of the problem or not.) Diagnostic information is below. If anyone can provide guidance, I really need it. Thank you. Here is my pom.xml, which is located in R:\jeffy\programming\sandbox\xbnjava\pom.xml (Notice the jars are in a the build directory, not the sandbox.) 4.0.0 com.github.xbn xbnjava pom 0.1.2-SNAPSHOT XBN-Java https://github.com/aliteralmind/xbnjava 2014 Jeff Epstein XBN-Java is a collection of generically-useful backend (server side, non-GUI) programming utilities, featuring RegexReplacer and FilteredLineIterator. XBN-Java is the foundation of Codelet (http://codelet.aliteralmind.com). org.sonatype…
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: maven
has title: Followup questions: Using Maven to only sign and deploy jars to Maven Central. Build and compilation is done entirely with Ant
has answer: http://stackoverflow.com/a/24786896
type: Question
has comment: http://stackoverflow.com/comment/38487902
tagged with: ant
tagged with: java

http://stackoverflow.com/comment/119617648
has text: I think @Vigneshwaran's point is a good one, and should be addressed by the answer (i.e. it does not warrant its own question as suggested). There's nothing in the question that should lead one to believe that the "language" query parameter could never be the first of multiple. This answer's regex mangles that use case, resulting in a wrong result.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24780150
type: AnswerComment

http://stackoverflow.com/a/24901455
upvote count: 2
has comment: http://stackoverflow.com/comment/38685917
has comment: http://stackoverflow.com/comment/38686537
has body: Problem #1 You are, repeatedly, adding your buttons whenever paint is called. paint may be called for any number of reasons, may of which you don't control. Never modify the state of any UI component in the paint method. Instead, call buttons in the init method. Problem #2 You are not telling the UI to update itself when you change the state of the lights. In your actionPerformed method, add repaint(); as the last statement, this will schedule a repaint of your component and paint will (eventually) be called Better solution Start by moving your custom painting to the paintComponent method of a JPanel. This will allow you to isolate the painting and add the additional benefit of double buffering (stop the flickering updates) Have a look at Performing Custom Painting for more details Add your buttons to the BorderLayout.NORTH position of the applet and your lights panel to the BorderLayout.CENTER, this will prevent the buttons from interacting with your lights panel (overlapping it). add(buttong, BorderLayout.NORTH); add(lightsPane); This will require you to supply methods to control the lights panel from the applet, but it will make your life much easier in the long run
has comment: http://stackoverflow.com/comment/38685928
answers question: http://stackoverflow.com/q/24901347
has comment: http://stackoverflow.com/comment/38685149
has comment: http://stackoverflow.com/comment/38686267
has comment: http://stackoverflow.com/comment/38685895
has comment: http://stackoverflow.com/comment/38686333
has comment: http://stackoverflow.com/comment/38685040
has comment: http://stackoverflow.com/comment/38686041
has comment: http://stackoverflow.com/comment/38686413
has comment: http://stackoverflow.com/comment/38727508
has comment: http://stackoverflow.com/comment/38685289
downvote count: 0
has comment: http://stackoverflow.com/comment/38685659
has comment: http://stackoverflow.com/comment/38686466
has comment: http://stackoverflow.com/comment/38685704
has comment: http://stackoverflow.com/comment/38685316
has comment: http://stackoverflow.com/comment/38727364
has comment: http://stackoverflow.com/comment/38685971
type: Answer
has comment: http://stackoverflow.com/comment/38687066
has comment: http://stackoverflow.com/comment/38727495
has comment: http://stackoverflow.com/comment/38686641
has comment: http://stackoverflow.com/comment/38686145
has comment: http://stackoverflow.com/comment/38727624
score: 2
has comment: http://stackoverflow.com/comment/38727377

http://stackoverflow.com/comment/38655479
has text: Yes , I did't .If my syntax is like : String s="ls -l"+/home/abhijeet and than I use Runtime.getRuntime().exec("su - "+username+" -c "+s); How to quote command in it? How to quote s in it? if i Do 's' .It will take as string right? It will not take its quoted value
type: AnswerComment
comment on: http://stackoverflow.com/a/24884421
score: 0
type: Comment

http://stackoverflow.com/q/24876201
score: 0
has answer: http://stackoverflow.com/a/24876304
has body: I have two arrays of predefined length, let us say 8, which contains related data. I can arrange them in such a way that array1[0] has corresonding mapping at array2[0]. That is key value pairs are at the same index in both arrays. In such a case, for iterating the array, I can either use a for loop like below for(int i=0;i&lt;array1.length;i++){ int array1Val = array1[i]; String array2Val = array2[i]; //some code } Is this approach gud? Or is it better to use linked hashmap instead and loop using map.entrySet() Complexity wise and efficiency wise which is a better approach?
type: UnansweredQuestion
tagged with: linkedhashmap
has comment: http://stackoverflow.com/comment/38637383
has answer: http://stackoverflow.com/a/24876261
tagged with: java
has title: LinkedHashMap or two separate arrays in java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38637319

http://stackoverflow.com/comment/38398597
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24749757
has text: No. In order for the single-byte characters to get properly converted to UTF-16 (the internal Java representation) you have to tell the system the original encoding for each file individually when you open it.
type: AnswerComment

http://stackoverflow.com/comment/38442948
comment on: http://stackoverflow.com/a/24761091
has text: Of course its caused by different version of some library (stop working after update from java-client 1.1.0 to 1.5.0) but how can I fix it if I want to use newest version of it?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38538474
has text: @vivek_ganesan i'm sending it to acces point, then the acces point send it to the hardware, anyway I will try what you are saying. Just finished working this week so I will try it in 2 days cause I not have the code here. If it works I will put your answer as valid. Thank you very much :) Thank Fildor too :)
comment on: http://stackoverflow.com/a/24822706
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/39226228
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24790834
upvote count: 2
downvote count: 0
has body: I Encounter similar issue while doing development on Android Studio 2.2. My Machine Configuration - JDK version 1.7.0_79 installed JDK version 1.8.0_101 installed Environment variable contains : JAVA_HOME = 1.7.0_79 JDK path and same is added to path variable Project SDK Location = C:\Program Files\Java\jdk1.8.0_101 I then made below changes - 1. Uninstall JDK 1.7.0_79 2. Updated JAVA_HOME = 1.8.0_101 JDK path (Similar to SDK Location) Now i am able to compile and run my application successfully , no more Unsupported major.minor version 52.0 Error

http://stackoverflow.com/comment/38637023
score: 1
has text: This algorithm is not correct if the array happens to contain 666 already. To fix this, test the compareKey for being 666 and set a flag to true if you find it, and then loop for (int j = i+1; j < nElems; j++). Then, when you remove the "666" entries, skip the first if the flag is true. Of course kruemel's solution is algorithmically faster and is probably the desired solution.
type: Comment
comment on: http://stackoverflow.com/q/24875923
type: QuestionComment

http://stackoverflow.com/a/24857586
has body: al.set(index, new_value); Easy ;)
upvote count: 2
has comment: http://stackoverflow.com/comment/38601930
has comment: http://stackoverflow.com/comment/38602232
has comment: http://stackoverflow.com/comment/38601941
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38601949
has comment: http://stackoverflow.com/comment/38601968
has comment: http://stackoverflow.com/comment/38601852
has comment: http://stackoverflow.com/comment/38602244
answers question: http://stackoverflow.com/q/24857570

http://stackoverflow.com/q/24843834
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38577011
tagged with: android
has comment: http://stackoverflow.com/comment/38575553
has comment: http://stackoverflow.com/comment/38575111
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: java.lang.RuntimeException: Unable to instantiate activity
type: Question
has comment: http://stackoverflow.com/comment/38575674
downvote count: 0
has comment: http://stackoverflow.com/comment/38575081
favorite count: 0
has body: I've published an app http://goo.gl/1cs2NO it's works fine the majority of devices, but i'm getting this error,and i don't know how to solve it : java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{aladin888.dessin/aladin888.dessin.Splash}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306) 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.ActivityThread.main(ActivityThread.java:5602) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at android.app.Activity.setRequestedOrientation(Activity.java:4512) at aladin888.dessin.Splash.<init>(Splash.java:49) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1208) at android.app.Instrumentation.newActivity(Instrumentation.java:1067) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2297) My manifest is like this : <?xml version="1.0" encoding="utf-8"?> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" /> <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.android.launcher.permission.IN…

http://stackoverflow.com/a/24804205
score: 1
has comment: http://stackoverflow.com/comment/38500474
has comment: http://stackoverflow.com/comment/38500530
upvote count: 1
answers question: http://stackoverflow.com/q/24804185
has body: I believe simply list.toString() will do what you want.
type: Answer
downvote count: 0

http://stackoverflow.com/a/24754456
has comment: http://stackoverflow.com/comment/38407318
downvote count: 0
has body: It's not that &lt; might overflow, it's that t2 might overflow. Examples in hexadecimal, because overflow is obvious in hexadecimal. Say you call System.nanoTime() and the result is 0x7FFFFFFF00000000. This is very close to the maximum value of a long. This is t1. A few seconds later you call it again, and get 0x8000000011111111. This is very close to the minimum value of a long - which means it's much smaller than the first value you got! This is t2. If you checked t2 &lt; t1, you'd get false, because t2 is indeed less than t1. If you calculate the difference t2 - t1, this also overflows, but it happens that this always cancels out the first overflow (if there was one). The result is 0x0000000111111111 which is the correct time difference. This is greater than 0, so t2 - t1 &gt; 0 returns true.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24754299
answers question: http://stackoverflow.com/q/24754299
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/24785528
score: 2
has comment: http://stackoverflow.com/comment/38471838
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24785315
has comment: http://stackoverflow.com/comment/38466532
has body: Your understanding is incorrect. The difference between (...) and (?:...) is only that the former also creates a numbered match group which can be referred to with a backreference from within the regex, or as a captured match group from code following the match. You could change the code to use lookbehinds, but the simple and straightforward fix is to put ([A-Za-z0-9]{2,}) inside regular parentheses, like I have done here, and retrieve the first matched group. (The @ doesn't need any parentheses around it in this scenario, but the ones you have are harmless.)

http://stackoverflow.com/a/24797761
type: Answer
has comment: http://stackoverflow.com/comment/38490973
upvote count: 3
answers question: http://stackoverflow.com/q/24797675
score: 3
has comment: http://stackoverflow.com/comment/38489284
has body: You can use lifecycle listeners. You can define listener callback methods inside your entity or in an own class. In your case I would create a listener class, since it seems that you will be needing the filtering in multiple entities. Since you want to filter data coming from the DB, you can use the PostLoad callback. public class StringFilter { @PostLoad public void filter(Object obj) { // filterString } } Then assign your listener class to the entity: @EntityListeners({StringFilter.class}) public class SomeEntity { ...
downvote count: 0

http://stackoverflow.com/comment/38499709
has text: current year. @m0skit0
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24803148

http://stackoverflow.com/q/24841970
has body: I am currently trying to receive data on my android smartphone (version 4.4.4) send from my RFduino (some kind of arduino) via Bluetooth. Therefore i made a small android application. Now everything works fine, until i try to connect my BluetoothSocket. First i got the an IOException: read failed -1 which i tried to solve like this: IOException: read failed, socket might closed - Bluetooth on Android 4.3 Which worked. But now my application just freezes after i call connect(). I know that this is because the method blocks until it has found a connection, but why does this not connect? My RFduino uses BluetoothBLE (low energy): Do i have to use the BluetoothGatt classes as counter-part? Here is my code: public BluetoothConnection(Activity parentActivity) { this.mActivity = parentActivity; findBluetooth(); openBluetooth(); } private void findBluetooth() { this.mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (this.mBluetoothAdapter == null) { } if (!this.mBluetoothAdapter.isEnabled()) { Intent enableBluetooth = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); this.mActivity.startActivityForResult(enableBluetooth, 0); } Set&lt;BluetoothDevice&gt; pairedDevices = this.mBluetoothAdapter.getBondedDevices(); if (pairedDevices.size() &gt; 0) { for (BluetoothDevice device : pairedDevices) { if (device.getName().equals("RFduino")) { this.mBluetoothDevice = device; break; } } } } private void openBluetooth() { UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); try { BluetoothSocket tmp = this.mBluetoothDevice.createRfcommSocketToServiceRecord(uuid); this.mBluetoothSocket = new NativeBluetoothSocket(tmp); this.mBluetoothSocket.connect(); } catch (IOException e) { // try the fallback Log.w("BT", "Had to use fallback method!"); try { this.mBluetoothSocket = new FallbackBluetoothSocket(this.mBluetoothSocket.getUnderlyingSocket()); Thread.sleep(500); this.mBluetoothSocket.connect(); } catch (FallbackException e1) { Log.w("BT", "Could not initialize …
tagged with: java
has comment: http://stackoverflow.com/comment/38574995
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38571829
tagged with: bluetooth
tagged with: rfduino
has comment: http://stackoverflow.com/comment/38571630
type: Question
linked to: http://stackoverflow.com/q/18657427
has comment: http://stackoverflow.com/comment/38571633
tagged with: android
has title: Unable to connect BluetoothSocket to Arduino
score: 0
tagged with: arduino

http://stackoverflow.com/comment/38567771
type: Comment
has text: @Andrew_CS thank you again, you are a good man =]]
type: AnswerComment
comment on: http://stackoverflow.com/a/24839776
score: 0

http://stackoverflow.com/q/24882946
tagged with: performance
possible better answer: http://stackoverflow.com/a/24889553
has comment: http://stackoverflow.com/comment/38666050
tagged with: java
has comment: http://stackoverflow.com/comment/38658221
has answer: http://stackoverflow.com/a/24889553
has comment: http://stackoverflow.com/comment/38655512
has comment: http://stackoverflow.com/comment/38658175
has comment: http://stackoverflow.com/comment/38655745
type: Question
has answer: http://stackoverflow.com/a/24889503
tagged with: jit
tagged with: benchmarking
has body: So I wanted to benchmark some basic java functionality to add some imformation to this question: What is the gain from declaring a method as static. I know writing benchmarks is sometimes not easy but what happens here I cannot explain. Please note that I'm not interessted in how to fix this but on why this happens* The Test class: public class TestPerformanceOfStaticVsDynamicCalls { private static final long RUNS = 1_000_000_000L; public static void main( String [] args ){ new TestPerformanceOfStaticVsDynamicCalls().run(); } private void run(){ long r=0; long start, end; for( int loop = 0; loop&lt;10; loop++ ){ // Benchmark start = System.currentTimeMillis(); for( long i = 0; i &lt; RUNS; i++ ) { r += addStatic( 1, i ); } end = System.currentTimeMillis(); System.out.println( "Static: " + ( end - start ) + " ms" ); start = System.currentTimeMillis(); for( long i = 0; i &lt; RUNS; i++ ) { r += addDynamic( 1, i ); } end = System.currentTimeMillis(); System.out.println( "Dynamic: " + ( end - start ) + " ms" ); // Do something with r to keep compiler happy System.out.println( r ); } } private long addDynamic( long a, long b ){ return a+b; } private static long addStatic( long a, long b ){ return a+b; } } I was expecting the first loop to be warmup and the following loops to be faster. Running this in Eclipse gave those strange results: Static: 621 ms Dynamic: 631 ms 1000000001000000000 Static: 2257 ms Dynamic: 2501 ms 2000000002000000000 Static: 2258 ms Dynamic: 2469 ms 3000000003000000000 Static: 2231 ms Dynamic: 2464 ms 4000000004000000000 So wtf? It got slower. To crosscheck I run the same code with java/c 7: Static: 620 ms Dynamic: 627 ms 1000000001000000000 Static: 897 ms Dynamic: 617 ms 2000000002000000000 Static: 901 ms Dynamic: 615 ms 3000000003000000000 Static: 888 ms Dynamic: 616 ms 4000000004000000000 So here only the static calls got slower for the following loops. Even more strange if I rearange the code to only print r after the final loop I get this in Ec…
has comment: http://stackoverflow.com/comment/38656029
linked to: http://stackoverflow.com/q/11240178
has comment: http://stackoverflow.com/comment/38666573
has comment: http://stackoverflow.com/comment/38657377
has title: Java loop gets slower after some runs / JIT's fault?
answer count: 3
has answer: http://stackoverflow.com/a/24891928
has comment: http://stackoverflow.com/comment/38659277
has comment: http://stackoverflow.com/comment/38657200
downvote count: 0
linked to: http://stackoverflow.com/q/504103
accepted answer: http://stackoverflow.com/a/24889503
favorite count: 0
has comment: http://stackoverflow.com/comment/38656307
has comment: http://stackoverflow.com/comment/38656363
has comment: http://stackoverflow.com/comment/38655500
score: 11
has comment: http://stackoverflow.com/comment/38654992
has comment: http://stackoverflow.com/comment/38658237
upvote count: 11
type: AnsweredQuestion

http://stackoverflow.com/comment/38423009
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24763178
has text: ok thank you, but im getting "package does not exist" error... not sure why
type: AnswerComment

http://stackoverflow.com/comment/38483474
has text: Did you tried with regex?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/24794832

http://stackoverflow.com/comment/52569320
score: 6
type: Comment
comment on: http://stackoverflow.com/a/24840520
type: AnswerComment
has text: Or just use the copying constructor: `new java.util.HashSet(scalaSet)`

http://stackoverflow.com/comment/38459837
score: 0
type: AnswerComment
type: Comment
has text: @OlegEstekhin Okay, but in this particular case the padding isn't `PKCS5` or `PKCS7`, it's `ISO10126`.
comment on: http://stackoverflow.com/a/24781758

http://stackoverflow.com/comment/38508284
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24808196
has text: applicationContext.xml has to be in the WEB-INF folder. Are you sure is not there?
score: 0

http://stackoverflow.com/a/24773933
score: 0
has comment: http://stackoverflow.com/comment/38454975
answers question: http://stackoverflow.com/q/24773565
has comment: http://stackoverflow.com/comment/38446045
type: Answer
has body: First, check what process is using the 7054 port with "netstat -anb" in cmd. Secondly, you can change the WebDriver port for Firefox by using a custom profile : FirefoxProfile profile = new FirefoxProfile(); profile.setPreference(FirefoxProfile.PORT_PREFERENCE, 9876); WebDriver driver = new FirefoxDriver(profile);

http://stackoverflow.com/comment/38526607
score: 0
type: Comment
type: QuestionComment
has text: ok it says error in parse android.os.networkonmainthreadexception
comment on: http://stackoverflow.com/q/24817637

http://stackoverflow.com/a/24819239
downvote count: 1
score: -1
has body: WebContent should be the right place without defining a path works on tomcat
answers question: http://stackoverflow.com/q/24817021
upvote count: 0
type: Answer

http://stackoverflow.com/q/24785800
has answer: http://stackoverflow.com/a/24918954
tagged with: java
has answer: http://stackoverflow.com/a/24802597
upvote count: 4
has body: I'm running a Java 7 Dropwizard app on a CentOS 6.4 server that basically serves as a layer on top of a data store (Cassandra) and does some additional processing. It also has an interface to Zookeeper using the Curator framework for some other stuff. This all works well and good most of the time, CPU and RAM load is never above 50% and usually about 10% and our response times are good. My problem is that recently we've discovered that occasionally we get blips of about 1-2 seconds where seemingly all tasks scheduled via thread pools get delayed. We noticed this because of connection timeouts to Cassandra and session timeouts with Zookeeper. What we've done to narrow it down: Used Wireshark and Boundary to make sure all network activity from our app was getting stalled, not just a single component. All network activity was stalling at the same time. Wrote a quick little Python script to send timestamp strings to netcat on one of the servers we were seeing timeouts connecting to to make sure it's not an overall network issue between the boxes. We saw all timestamps come through smoothly during periods where our app had timeouts. Disabled hyperthreading on the server. Checked garbage collection timing logs for the timeout periods. They were consistent and well under 1ms through the timeout periods. Checked our CPU and RAM resources during the timeout periods. Again, consistent, and well under significant load. Added an additional Dropwizard resource to our app for diagnostics that would send timestamp strings to netcat on another server, just like the Python script. In this case, we did see delays in the timestamps when we saw timeouts in our app. With half-second pings, we would generally see a whole second missing entirely, and then four pings in the next second, the extra two being the delayed pings from the previous second. To remove the network from the equation, we changed the above to just write to the console and a local file instead of to the network. We saw …
answer count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: executorservice
has title: ExecutorService task execution intermittently delayed
tagged with: multithreading
downvote count: 1
type: Question
score: 3

http://stackoverflow.com/q/24803733
has answer: http://stackoverflow.com/a/24841904
tagged with: utf-8
has comment: http://stackoverflow.com/comment/38501101
score: 10
has comment: http://stackoverflow.com/comment/38501478
answer count: 1
has body: How does Java determine the encoding used for System.out? Given the following class: import java.io.File; import java.io.PrintWriter; public class Foo { public static void main(String[] args) throws Exception { String s = "xxäñxx"; System.out.println(s); PrintWriter out = new PrintWriter(new File("test.txt"), "UTF-8"); out.println(s); out.close(); } } It is saved as UTF-8 and compiled with javac -encoding UTF-8 Foo.java on a Windows system. Afterwards on a git-bash console (using UTF-8 charset) I do: $ java Foo xxõ±xx $ java -Dfile.encoding=UTF-8 Foo xx├ñ├▒xx $ cat test.txt xxäñxx $ java Foo | cat xxäñxx $ java -Dfile.encoding=UTF-8 Foo | cat xxäñxx What is going on here? Obviously java checks if it is connected to a terminal and is changing its encoding in that case. Is there a way to force Java to simply output plain UTF-8? I tried the same with the cmd console, too. Redirecting STDOUT does not seem to make any difference there. Without the file.encoding parameter it outputs ansi encoding with the parameter it outputs utf8 encoding.
accepted answer: http://stackoverflow.com/a/24841904
tagged with: java
tagged with: character-encoding
upvote count: 10
has comment: http://stackoverflow.com/comment/38571584
type: AnsweredQuestion
downvote count: 0
has title: Default character encoding for java console output
tagged with: console
favorite count: 0
type: Question
tagged with: windows

http://stackoverflow.com/q/24837200
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38562751
tagged with: java
has comment: http://stackoverflow.com/comment/38562804
has answer: http://stackoverflow.com/a/62176165
type: Question
upvote count: 12
has body: I have to convert one of my code segment from C to java. Code is given below. union commandString{ char commndStr[20]; struct{ char commnd[4]; char separator1; char agr1[5]; char separator2; char arg2[3]; char separator3; char additionalArg[5]; }; }; I don't want to use any explicit parser or I do not want to use System.arraycopy method. Is there any way to do that in my preferred way?
has answer: http://stackoverflow.com/a/24837252
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/24837761
score: 12
answer count: 3
possible better answer: http://stackoverflow.com/a/24837252
downvote count: 0
has comment: http://stackoverflow.com/comment/38563197
favorite count: 0
has title: How to create C style union in java?
accepted answer: http://stackoverflow.com/a/24837761

http://stackoverflow.com/a/24889872
type: Answer
answers question: http://stackoverflow.com/q/24889381
has body: For forms the standard way is to catch the submit event instead of the click event of the button: $("#emailForm").submit(function(e){ e.preventDefault(); var postData = $(this).serializeArray(); // or: $(this).serialize(); $.ajax({ type: "POST", url : "HomeController", data : postData, success: function(data) { $("#emailResult").html(" Thank your for submitting ); }, error: function(jqXHR, textStatus, errorThrown) { $("#emailResult").html(" ss"+errorThrown+textStatus+jqXHR+" "); } }); });
score: 0

http://stackoverflow.com/q/24772446
has comment: http://stackoverflow.com/comment/38441889
tagged with: android-fragments
tagged with: java
type: Question
has body: My STACK_TRACE when I came back to FragmentActivity from another activity. I searched lot for how to solve this, and I found a clue that I need to save state of fragment. But in that clue article said, when I use FragmentPagerAdapter, I do not need to save state. So, I confussed. Am I use FragmentPagerAdapter correctly? Please Help me... java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test20140320/com.example.test20140320.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362) at android.app.ActivityThread.access$700(ActivityThread.java:168) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5493) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.example.test20140320.MainActivity_Fragment_Tab_02.&lt;init&gt;(MainActivity_Fragment_Tab_02.java:98) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1130) at android.support.v4.app.Fragment.instantiate(Fragment.java:402) at android.support.v4.app.FragmentState.instantiate(Fragment.java:97) at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1801) at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:213) at com.example.test20140320.MainActivity.onCreate(MainActivity.java:47) at android.app.Activity.performCreate(Activity.java:5372) at android.app.Instrumentation.callActivityOnCreate(Instr…
score: 0
has comment: http://stackoverflow.com/comment/38441861
answer count: 2
has comment: http://stackoverflow.com/comment/38441420
has answer: http://stackoverflow.com/a/24774775
has comment: http://stackoverflow.com/comment/38440894
favorite count: 0
has answer: http://stackoverflow.com/a/24773871
has comment: http://stackoverflow.com/comment/38441114
has comment: http://stackoverflow.com/comment/38440864
has comment: http://stackoverflow.com/comment/38441783
has comment: http://stackoverflow.com/comment/38444615
tagged with: android
has comment: http://stackoverflow.com/comment/38442348
has title: How to avoid NullPointerException when re-back to FragmentActivity?
type: UnansweredQuestion
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/38667934
type: QuestionComment
comment on: http://stackoverflow.com/q/24889575
score: 0
has text: The code you posted for `Establishment` seems broken, could you update it in your question? I think you made a mistake when copying it.
type: Comment

http://stackoverflow.com/a/24755113
downvote count: 0
score: 1
has body: Maybe you're overloading the UI thread. Try using AsyncTask to execute the received commands.
has comment: http://stackoverflow.com/comment/38408837
answers question: http://stackoverflow.com/q/24754338
upvote count: 1
has comment: http://stackoverflow.com/comment/38408638
type: Answer
has comment: http://stackoverflow.com/comment/38408736

http://stackoverflow.com/q/24793318
has title: Image analysis function to calculate middle gray level (max(z)+min(z)/2 in Java
tagged with: java
tagged with: image-processing
has body: How do I calculate the middle gray level (max(z)+min(z)/2 over the points where the structuring element is 1 and sets the output pixel to that value? I just know a little about how to get the RGB value each pixel by using image.getRGB(x,y). I have no idea how to get gray level value each pixel of the image and what is z in the formula and all that? Please help me with this. Thanks in advance.
type: Question
has answer: http://stackoverflow.com/a/24794039
has comment: http://stackoverflow.com/comment/38480678
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/38480704
downvote count: 1
favorite count: 0
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24771501
score: 2
has body: I used the Z3 Java API of expr.Substitute(Expr[] oldArgs, Expr[] newArgs), and got stuck. Wondering if there's a bug in the substitution process. Here's some declarations: (declare-const addr_of_s (_ BitVec 16)) (declare-const m_10 (Array (_ BitVec 16) (_ BitVec 16))) (declare-const size_10 (Array (_ BitVec 16) (_ BitVec 16))) (declare-const pre_disjoint_10 Bool) (declare-fun disjoint_10 ((_ BitVec 16) (_ BitVec 16)) Bool) (declare-const label (_ BitVec 16)) (declare-const label_0 (_ BitVec 16)) This is the expression to be substituted: (= (select m_10 (bvadd addr_of_s (bvmul #x0003 #x0001))) #x0000) oldArgs: {m_10, size_10, pre_disjoint_10} newArgs: {(store (store (store (store m_10 addr_of_s #x0031) (bvadd #x0001 addr_of_s) #x0032) (bvadd #x0002 addr_of_s) #x0033) addr_of_s #x0032), size_10, (and pre_disjoint_10 (disjoint_10 label label_0) (bvuge (bvadd label label_0) label) (not (= label #x0000)))}
tagged with: java
type: Question
tagged with: substitution
downvote count: 0
tagged with: smt
has comment: http://stackoverflow.com/comment/38868383
has comment: http://stackoverflow.com/comment/38438891
has comment: http://stackoverflow.com/comment/38954270
has title: Z3 bug in substitution
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: z3

http://stackoverflow.com/q/24897264
has body: I have a spring batch project exported as a runable Jar file, it has 4 main methods, only one main is working, the other main needs referenced jar jai-codec-1.1.3.jar, but when I put the jar in the classpath, the first main also could not working and it gives error message "An unexpected error occurred while trying to open jar" here is my mainfest file: Manifest-Version: 1.0 Class-Path: JARS/spring-jdbc-3.1.1.RELEASE.jar JARS/spring-context-3.2.3.RELEASE.jar JARS/log4j-1.2.14.jar JARS/spring-tx-3.2.3.RELEASE.jar JARS/spring-core-3.2.3.RELEASE.jar JARS/spring-beans-3.2.3.RELEASE.jar JARS/commons-logging-1.1.1.jar JARS/spring-aop-3.2.3.RELEASE.jar JARS/aopalliance-1.0.jar JARS/spring-expression-3.2.3.RELEASE.jar JARS/commons-dbcp-1.4.jar JARS/commons-pool-1.5.4.jar JARS/ojdbc6-11.2.0.3.jar JARS/commons-lang3-3.0.jar JARS/itextpdf-5.5.1.jar JARS/jdom2-2.0.5.jar JARS/jai-codec-1.1.3.jar I found out that it is not because the specific jar file, it is because the length of the classpath is exceeded the limit, is there a way to put more jars in the MAINFEST file classpath? also I have defined all @autowired service and component classes but it still not working in jar, it only works when I defined those as bean in spring-config. Anyone can Help me to figure out why?
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/94096055
possible better answer: http://stackoverflow.com/a/53617675
tagged with: java
has answer: http://stackoverflow.com/a/53617675
tagged with: eclipse
tagged with: classpath
type: Question
tagged with: jar
has answer: http://stackoverflow.com/a/24911116
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/54526154
accepted answer: http://stackoverflow.com/a/24911116
has title: An unexpected error occurred while trying to open jar
linked to: http://stackoverflow.com/q/3057841

http://stackoverflow.com/q/24812646
downvote count: 0
tagged with: applet
favorite count: 0
has body: So I've written up an applet and am testing it on a locally hosted Glassfish server.I've deployed my jar but when I launch the applet it blocks it saying. "There is a problem with the website's security certificate" When I tell it to go forward with it anyway, it loads up java and runs for a while before asking me weather I want to continue. "Do you want to Continue?" "Website: 660-5nxcvn1:8181" But the certificate it's looking for is "localhost" since that is where the domain is running. It will tell me I do not have the permissions to run the applet and that I should change the settings in the Java Control panel. The setting is unalterable on my work computer and the option is unavailable. I have tried adding a self signed certificate to the keystore created by glassfish, but without any change. I've read through the documentation at http://docs.oracle.com/cd/E19159-01/819-3671/ablnk/index.html, as it was given in response to a similar question but I do not understand the application to the problem. Has anyone done something like this before and could perhaps outline the process?
accepted answer: http://stackoverflow.com/a/24866314
has comment: http://stackoverflow.com/comment/38517279
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38516944
has title: Launching Applet on Glassfish 4
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38516765
type: Question
has comment: http://stackoverflow.com/comment/38517553
has answer: http://stackoverflow.com/a/24866314
tagged with: ssl
tagged with: glassfish
has comment: http://stackoverflow.com/comment/38517230
answer count: 1

arraylist
tags question: http://stackoverflow.com/q/24851749
tags question: http://stackoverflow.com/q/24796273
tags question: http://stackoverflow.com/q/24836937
tags question: http://stackoverflow.com/q/24869657
tags question: http://stackoverflow.com/q/24882549
tags question: http://stackoverflow.com/q/24826566
tags question: http://stackoverflow.com/q/24839702
tags question: http://stackoverflow.com/q/24863295
tags question: http://stackoverflow.com/q/24891855
tags question: http://stackoverflow.com/q/24854649
tags question: http://stackoverflow.com/q/24830205
tags question: http://stackoverflow.com/q/24821938
tags question: http://stackoverflow.com/q/24764302
tags question: http://stackoverflow.com/q/24830945
tags question: http://stackoverflow.com/q/24802205
tags question: http://stackoverflow.com/q/24890314
tags question: http://stackoverflow.com/q/24806391
tags question: http://stackoverflow.com/q/24790406
tags question: http://stackoverflow.com/q/24755235
tags question: http://stackoverflow.com/q/24891269
tags question: http://stackoverflow.com/q/24856355
tags question: http://stackoverflow.com/q/24827319
tags question: http://stackoverflow.com/q/24822668
tags question: http://stackoverflow.com/q/24819573
tags question: http://stackoverflow.com/q/24769988
tags question: http://stackoverflow.com/q/24864964
tags question: http://stackoverflow.com/q/24774676
tags question: http://stackoverflow.com/q/24857570
tags question: http://stackoverflow.com/q/24803741
tags question: http://stackoverflow.com/q/24851549
tags question: http://stackoverflow.com/q/24817251
tags question: http://stackoverflow.com/q/24850707
tags question: http://stackoverflow.com/q/24787047
tags question: http://stackoverflow.com/q/24894528
tags question: http://stackoverflow.com/q/24836655
tags question: http://stackoverflow.com/q/24796248
tags question: http://stackoverflow.com/q/24843162
tags question: http://stackoverflow.com/q/24771909
tags question: http://stackoverflow.com/q/24795914
tags question: http://stackoverflow.com/q/24862878
tags question: http://stackoverflow.com/q/24764328
tags question: http://stackoverflow.com/q/24845926
tags question: http://stackoverflow.com/q/24908979
tags question: http://stackoverflow.com/q/24904532
tags question: http://stackoverflow.com/q/24795259
tags question: http://stackoverflow.com/q/24837939
tags question: http://stackoverflow.com/q/24891390
tags question: http://stackoverflow.com/q/24808610
tags question: http://stackoverflow.com/q/24851012
tags question: http://stackoverflow.com/q/24814189
tags question: http://stackoverflow.com/q/24813117
tags question: http://stackoverflow.com/q/24773977
tags question: http://stackoverflow.com/q/24776970
tags question: http://stackoverflow.com/q/24904382
tags question: http://stackoverflow.com/q/24808681
tags question: http://stackoverflow.com/q/24813336
type: Tag
tags question: http://stackoverflow.com/q/24815875
tags question: http://stackoverflow.com/q/24877673
tag name: arraylist
tags question: http://stackoverflow.com/q/24841484
tags question: http://stackoverflow.com/q/24822003
tags question: http://stackoverflow.com/q/24860857
tags question: http://stackoverflow.com/q/24749282
tags question: http://stackoverflow.com/q/24810494
tags question: http://stackoverflow.com/q/24759252

http://stackoverflow.com/comment/38440113
comment on: http://stackoverflow.com/a/24772006
score: 0
type: Comment
has text: @user3806226 - Right. But it's better to say you **do not need** to know.
type: AnswerComment

http://stackoverflow.com/a/24782789
has comment: http://stackoverflow.com/comment/38460537
type: Answer
has body: Here is my try. I tested it a bit and it seems to work. If it doesn't, then sorry. I've got much to learn. So, my try is based on how Strings are treated in Java, i.e. they are immutable. Any String you create goes into a "Constant String Pool". When you make a new reference to a String that is already in the pool, the JVM makes that reference indicate to the String object that already exists in the pool. So I think it is clear that 2 identical String references are pointing to the exact same String object, even if they have been created separately. Based on this, my method returns 0 if the references are equal and does something else otherwise. Please excuse the return at the end, I know it's ugly, the program won't compile without. I also know(hope) it is unreachable. Here is the function(6 lines): public int compare(String s1, String s2) { if (s1 == s2) return 0; else { for (int i = 0; i &lt; Math.min(s1.length(), s2.length()); i++) { if (s1.charAt(i) &gt; s2.charAt(i)) return 1; else return -1; } } return -2; }
answers question: http://stackoverflow.com/q/24781254
has comment: http://stackoverflow.com/comment/38461072
has comment: http://stackoverflow.com/comment/38461216
has comment: http://stackoverflow.com/comment/38460890
has comment: http://stackoverflow.com/comment/38460226
score: 0
has comment: http://stackoverflow.com/comment/38460691
has comment: http://stackoverflow.com/comment/38460416

http://stackoverflow.com/q/24814966
score: 4
has title: Java Execute a bash script using Java process builder
upvote count: 4
tagged with: bash
answer count: 1
downvote count: 0
tagged with: shell
accepted answer: http://stackoverflow.com/a/24815002
favorite count: 0
tagged with: linux
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24815002
type: Question
has body: I'm trying to execute a bash script from Java and it returns error /bin/bash: '/home/nika/NetBeansProjects/Parallel Framework/process-executor.sh': No such file or directory, I'm working on ubuntu 14.04 with netbeans8 &amp; jdk8. Here is my code: public class Process { public static void main(String[] args) { try { ProcessBuilder pb = null; Process p; String cmd2 = ""; String workingDir = System.getProperty("user.dir"); System.out.println(""+workingDir); String scriptloc="'"+workingDir+"/process-executor.sh'"; String cmd[] = {"/bin/bash",scriptloc , "workspace/ForDemo.java", "ForDemo.java", "ForDemo"}; for (int i = 0; i &lt;= cmd.length-1; i++) { cmd2 += " "+cmd[i]; } System.out.println("" + cmd2); pb = new ProcessBuilder(cmd); pb.directory(new File(workingDir)); p = null; try { p = pb.start(); } catch (IOException ex) { Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex); } BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output from the command System.out.println("Here is the standard output of the command:\n"); String s = null; String output = ""; while ((s = stdInput.readLine()) != null) { System.out.println(s); } output = ""; // read any errors from the attempted command System.out.println("Here is the standard error of the command (if any):\n"); while ((s = stdError.readLine()) != null) { System.out.println(s); } } catch (IOException ex) { Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex); } } } But when I execute this command from terminal it executes the script bin/bash '/home/nika/NetBeansProjects/Parallel Framework/process-executor.sh' workspace/ForDemo.java ForDemo.java ForDemo I have another problem with my script it doesn't execute the cd command and says '/home/nika/NetBeansProjects/Parallel Framework/workspace/ForDemo.java/': No such file or directory Contents of my script ar…

http://stackoverflow.com/a/24794153
has comment: http://stackoverflow.com/comment/38482375
has comment: http://stackoverflow.com/comment/38482718
score: 6
type: Answer
answers question: http://stackoverflow.com/q/24793567
has comment: http://stackoverflow.com/comment/38483129
has comment: http://stackoverflow.com/comment/38482909
accepted answer of: http://stackoverflow.com/q/24793567
downvote count: 0
has comment: http://stackoverflow.com/comment/38483542
has comment: http://stackoverflow.com/comment/38482457
upvote count: 6
has comment: http://stackoverflow.com/comment/38482804
has body: We can do this by traverse the tree two times. First, we need three array int []left which stored the sum of the distance of the left sub tree. int []right which stored the sum of the distance of the right sub tree. int []up which stored the sum of the distance of the parent tree (without the current sub tree). So, first traversal, for each node, we calculate the left and the right distance. If the node is a leaf, simply return 0, if not, we can have this formula: int cal(Node node){ int left = cal(node.left); int right = cal(node.right); left[node.index] = left; right[node.index] = right; //Depend on the current node have left or right node, we add 0,1 or 2 to the final result int add = (node.left != null &amp;&amp; node.right != null)? 2 : node.left != null ? 1 : node.right != null ? 1 : 0; return left + right + add; } Then for the second traversal, we need to add to each node, the total distance from his parent. 1 / \ 2 3 / \ 4 5 For example, for node 1 (root), the total distance is left[1] + right[1] + 2, up[1] = 0; (we add 2 as the root has both left and right sub tree, the exact formula for it is: int add = 0; if (node.left != null) add++; if(node.right != null) add++; For node 2 , the total distance is left[2] + right[2] + add + up[1] + right[1] + 1 + addRight, up[2] = up[1] + right[1] + addRight. The reason there is a 1 at the end of the formula is because there is an edge from the current node to his parent, so we need to add 1. Now, I denote the additional distance for the current node is add, additional distance if there is a left subtree in parent node is addLeft and similarly addRight for right subtree. For node 3, the total distance is up[1] + left[1] + 1 + addLeft, up[3] = up[1] + left[1] + addLeft; For node 4, the total distance is up[2] + right[2] + 1 + addRight, up[4] = up[2] + right[2] + addRight; So depend on the current node is a left or right node, we update the up accordingly. The time complexity is O(n)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38482650

http://stackoverflow.com/q/24783254
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38461342
has comment: http://stackoverflow.com/comment/38461525
has comment: http://stackoverflow.com/comment/38461472
tagged with: java
type: Question
tagged with: fullscreen
has comment: http://stackoverflow.com/comment/38470315
has title: When Java fullscreen exclusive mode isn't?
has body: I am working on an application in fullscreen exclusive mode; in general, this works just fine. On some computers, however, the window is not actually going fullscreen. All computers are running identical code on Java 6, u45 with Windows 7, 32-bit. On two of them, the app goes fullscreen with no titlebar, no taskbar, etc. and gains keyboard focus. On two other machines, the window, with decorations, enlarges to the size of the screen, does not get keyboard focus, and sometimes minimizes and then maximizes again repeatedly. There are no other processes stealing focus (that I can see), and the computers all have the same processes and services running on them. Also, isFullScreenSupported() is returning true on all machines. Any help on this would be helpful; if there are any mysterious processes that might be stealing focus or preventing fullscreen mode, I would love to know what they are.
has comment: http://stackoverflow.com/comment/38461148
downvote count: 0
tagged with: user-interface
score: 1
has comment: http://stackoverflow.com/comment/38749921
favorite count: 0
answer count: 0

http://stackoverflow.com/q/24782599
tagged with: web-applications
type: Question
has title: rolling over fails for log4j after reloading Web App
has comment: http://stackoverflow.com/comment/38489421
score: 0
has body: I'm facing a problem with log4j 1.2. I'm using a RollingFileAppender and it works perfectly until I reload the web app. then with max size allowed is exceeded, the log files start to get deleted. and the more logs written, more log files will be deleted until no backup files remained. and what bothers me more, that the rolling strategy stops and no new backup files are created (just appending to the same original file). It's like it just becomes a File appender after reloading instead of Rolling File Appender with a fixed-max-size. Here is how the log4j.properties look: #Properties file used to configure a Log4J logger log4j.rootLogger=DEBUG #A custom logger log4j.logger.app.log=DEBUG, console, app log4j.additivity.app=false #Definition of appenders used by loggers above log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.target=System.out log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=[%d{MMM dd HH\:mm\:ss,SSS}] %-5p - %m%n #################################################################### # logger for application #################################################################### #Default Config file for CompositeRollingAppender log4j.appender.app=org.apache.log4j.CompositeRollingAppender log4j.appender.app.layout.ConversionPattern=[%d{MMM dd HH\:mm\:ss.SSS}] %-5p %m%n #How to perform rolling -- Composite is the default log4j.appender.app.RollingStyle=3 #Use same file name for all inprocess logging? log4j.appender.app.staticLogFileName=true log4j.appender.app.File=C:/Path/app.log #Size Rolling params log4j.appender.app.CountDirection=-1 #10M log4j.appender.app.MaxFileSize=10485760 log4j.appender.app.MaxSizeRollBackups=10 #Date Rolling params log4j.appender.app.datePattern='.'yyyy-MM-dd-HH #layout options log4j.appender.app.layout=org.apache.log4j.PatternLayout
tagged with: log4j
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38461203
answer count: 0
tagged with: java

http://stackoverflow.com/a/24781044
has comment: http://stackoverflow.com/comment/38457238
has comment: http://stackoverflow.com/comment/38457853
has body: add the following permissions in the android manifest file just above the application tag
has comment: http://stackoverflow.com/comment/38484369
has comment: http://stackoverflow.com/comment/38458040
score: 0
has comment: http://stackoverflow.com/comment/41446209
answers question: http://stackoverflow.com/q/24779771
has comment: http://stackoverflow.com/comment/38457092
type: Answer
has comment: http://stackoverflow.com/comment/41446220

http://stackoverflow.com/q/24768570
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38713613
has body: My homework is called "relational algebra", and its asking me to perform the operations Union, Difference, Intersection, Join, Cartesian Product and Project on two tables in .txt files that read: a 1 a 1 b 2 and z 26 c 3 c 3 My initial question was basically how do i approach this project? Below is my finished project, if there are any mistakes please let me know. Suggestions and critiques also welcome. import javax.swing.JOptionPane; import java.util.*; import java.io.*; /** * ---------------------------------------------------------------------------- * ------------------------- Purpose : This class is used to create a row for a * two dimensional data * * @since 06/17/2014 * @author abass.alamnehe * -------------------------------------------------------- * --------------------------------------------- */ class Table { //Class Table public String getID() { //getters and setters return ID; } public void setID(String iD) { this.ID = iD; } public String getName() { return name; } public void setName(String name) { this.name = name; } String ID = ""; String name = ""; Table(String ID, String name) { //Table constructor this.ID = ID; this.name = name; } } public class RelationalAlgebra { /** * It reads a two columns table into a two dimensional array * * @return ArrayList * &lt;Table&gt; * @throws IOException */ ArrayList&lt;Table&gt; getTable(String fileName) throws IOException { ArrayList&lt;Table&gt; T1 = new ArrayList&lt;Table&gt;(); // creates an array list File inFile = new File(fileName); // creates a file object Scanner scanner = new Scanner(inFile); // Scanner is a reader class int repetition = 1; // used to skip the 1st line from input file while (scanner.hasNext()) { // reads until not data if (repetition == 1) { // if 1st line, skips scanner.next(); scanner.next(); repetition = 2; } else { // else reads each column String ID = scanner.next(); String name = scanner.next(); T1.add(new Table(ID, name)); } } scanner.close(); // close input stream return T1; // …
has comment: http://stackoverflow.com/comment/38434365
has comment: http://stackoverflow.com/comment/38480387
tagged with: relational-algebra
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/38434193
has comment: http://stackoverflow.com/comment/38689770
score: -2
has comment: http://stackoverflow.com/comment/38436377
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38683353
has title: Relational Algebra Homework (Arrays/Collection?)
has answer: http://stackoverflow.com/a/24769151
favorite count: 0
has comment: http://stackoverflow.com/comment/38434510
has comment: http://stackoverflow.com/comment/38651410

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/24800402
tags question: http://stackoverflow.com/q/24832442
tags question: http://stackoverflow.com/q/24891347
type: Tag

http://stackoverflow.com/comment/38404935
type: Comment
comment on: http://stackoverflow.com/a/24753115
has text: yes, but what about my own code? If I want for example to write a simple random_number_generator, what are the mandatory classes which must be in my code to run this in yarn? I cannot understand if I have to write by my own the Client and ApplicationMaster... Why this is not implemented by the yarn framework itself?
type: AnswerComment
score: 0

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/24768496
tag name: osx-mavericks

http://stackoverflow.com/comment/38709507
comment on: http://stackoverflow.com/a/24899731
score: 0
type: AnswerComment
has text: Thank you very much for your reply but my problem is bigger than this I have updated my original post to explain the problem in more detail thank you again
type: Comment

http://stackoverflow.com/a/24814787
has comment: http://stackoverflow.com/comment/38521070
has body: The functional programmer purist in me might suggest: public int calc(int a, int b) { return (a &gt;= b) ? calcSum(a, b) + calcDiff(a, b) : calc(b, a); } At a cost of one recurse you have eliminated all temporary variables and succinctly stated your intent. An efficient compiler may even recognize the tail recursion and substitute the correct tail-recursion-avoidance mechanism.
has comment: http://stackoverflow.com/comment/38521176
score: 0
answers question: http://stackoverflow.com/q/24814152
type: Answer

http://stackoverflow.com/comment/38572968
score: 2
has text: No - Even if there was the hardware is not physically capable of being that precise. (Specifying 1ms won't even be 1ms.)
comment on: http://stackoverflow.com/q/24842727
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24819125
has body: System.out is a PrintStream and the documentation for PrintStream.printf links to the format stream syntax which has a table of all of the conversions. The first entry in that table: 'b', 'B' - If the argument arg is null, then the result is "false". If arg is a boolean or Boolean, then the result is the string returned by String.valueOf(arg). Otherwise, the result is "true".
score: 5
answers question: http://stackoverflow.com/q/24818989
downvote count: 0
upvote count: 5
type: Answer

http://stackoverflow.com/comment/38592765
has text: can i use this to accomplish my free draw path? actually i'm not intended to make a straight line but mostly like path that would draw my finger's track while i'm moving my finger.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24851261
type: AnswerComment

http://stackoverflow.com/comment/38456200
type: Comment
type: QuestionComment
has text: This question does not show the level self solution attempts expected on SE.
comment on: http://stackoverflow.com/q/24778123
score: 0

http://stackoverflow.com/comment/38496779
comment on: http://stackoverflow.com/q/24802205
score: 0
type: Comment
type: QuestionComment
has text: Print your error stack..

http://stackoverflow.com/comment/38602258
score: 6
type: Comment
comment on: http://stackoverflow.com/q/24857681
has text: "at the end all the classes are loaded by the Bootstrap" isn't true. If it was true there would be no point in having other class loaders at all, let alone a delegation model.
type: QuestionComment

http://stackoverflow.com/comment/38468120
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24786793
type: QuestionComment
has text: So there is a linebreak in the source file?

http://stackoverflow.com/comment/38482400
type: Comment
has text: It works but could you make it generic so it is not dependent on the currency sign? Something like "get number from a string and the number could start at any position"?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24794163

http://stackoverflow.com/comment/38542213
type: Comment
has text: @manishpayasi I really don't get what you are trying to do. What is a _directory_? Do you mean a database or maybe a path? I am unsure. However, it is probably best to simply ask a new question as it seems to be quite different from this question.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24798061

http://stackoverflow.com/a/24827238
has body: I have a JTable for various istances and I want to separate every instance with an horizontal line. As I understand your question, and given your code, by instance you mean an object (row) in your table model. Since you set showGrid property to false then no line is drawn in your table: public class InstanceTable extends JTable { public InstanceTable() { setShowGrid(false); ... } } You need to set showHorizontalLines property to true and showVerticalLines to false (if needed, actually): public class InstanceTable extends JTable { public InstanceTable() { setShowHorizontalLines(true); setShowVerticalLines(false); ... } } See javadoc: JTable.setShowGrid(boolean showGrid) JTable.setShowHorizontalLines(boolean showHorizontalLines) JTable.setShowVerticalLines(boolean showVerticalLines) public void setShowHorizontalLines(boolean showHorizontalLines) Sets whether the table draws horizontal lines between cells. If showHorizontalLines is true it does; if it is false it doesn't. public void setShowVerticalLines(boolean showVerticalLines) Sets whether the table draws vertical lines between cells. If showVerticalLines is true it does; if it is false it doesn't.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24825675
score: 2
has comment: http://stackoverflow.com/comment/38544595
answers question: http://stackoverflow.com/q/24825675

http://stackoverflow.com/q/24849916
downvote count: 0
possible better answer: http://stackoverflow.com/a/28314507
has body: I have the following jpa repository: @Query("UPDATE PlayerAccount pa SET pa.password = ?3 WHERE pa.id = ?1 AND pa.password = ?2") @Modifying public int updatePasswordWithValidation(Long playerAccountId, String oldPasswordDB, String encodePassword); Now, i would like to implement a similar update query for a mongoDB repository: @Query("update( { _id: ObjectId(' $1 ') }, { $set: { messageStatus: $2} })") But it doesn't work. any references to how a customized mongo repository update looks like? Thanks
favorite count: 0
has answer: http://stackoverflow.com/a/24851112
tagged with: spring-data-mongodb
has title: Spring Data and MongoDB repository - how to create an update query?
accepted answer: http://stackoverflow.com/a/24851112
score: 5
tagged with: spring-data
tagged with: spring
type: Question
type: AnsweredQuestion
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/28314507
tagged with: mongodb
answer count: 2

http://stackoverflow.com/q/24874541
answer count: 2
has comment: http://stackoverflow.com/comment/38635355
tagged with: jar
has comment: http://stackoverflow.com/comment/38658153
has comment: http://stackoverflow.com/comment/38671589
has answer: http://stackoverflow.com/a/24875980
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38634590
possible better answer: http://stackoverflow.com/a/24875252
has comment: http://stackoverflow.com/comment/38671626
tagged with: path
has answer: http://stackoverflow.com/a/24875252
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24875980
has title: Paths for images and executables in a jar
score: 1
tagged with: java
has body: I have created a java program in eclipse and I am now ready to export it as a jar. My program uses an image file and an executable file. When testing my program in eclipse I referred to these file with a full path, which I obviously cannot do for the jar. Therefore, I changed them like this: public static final String DRIVERLOC = "./resources/IEDriverServer.exe"; //some other code File file = new File(DRIVERLOC); System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); and File pic = new File("./images/Open16.gif"); openButton = new JButton("Select the Text File", createImageIcon(pic.getAbsolutePath())); I put the images and the resources and images directory in the same directory with the jar. Now for some reason when I run the jar the IEDriverServer works fine but the image does not work and the error is that it cannot find the image. I am confused since I cannot seems to tell the difference. I also used "images/Open16.gif" which did not work either. Why would one work but the other does not? What is the easiest way to fix this?
tagged with: eclipse
type: Question

http://stackoverflow.com/a/44648854
has body: This is a bit late, but after reading through the answers I did find one way to work around this problem. Instead of building your document factory with the normal DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); you could use the parameters in newInstance to specifically choose. This way you don't have to add JVM parameters like Svarog's answer above, and you don't have to add or remove libraries. My solution is as follows: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", this.getClass().getClassLoader()); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new FileInputStream("path/to/file.xml"));
downvote count: 0
answers question: http://stackoverflow.com/q/24805360
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/38404018
type: Comment
comment on: http://stackoverflow.com/a/24752897
score: 1
type: AnswerComment
has text: @user3560140 It is all because he posted this answer 10 minutes before OP had finished his question.:) http://meta.stackexchange.com/questions/9134/jon-skeet-facts

http://stackoverflow.com/comment/38697091
has text: http://stackoverflow.com/questions/17887093/beginner-java-class-interface-or-enum-expected
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24908157
type: QuestionComment

http://stackoverflow.com/q/24901922
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24902155
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24902056
type: Question
possible better answer: http://stackoverflow.com/a/24902055
accepted answer: http://stackoverflow.com/a/24902155
has answer: http://stackoverflow.com/a/24902055
linked to: http://stackoverflow.com/q/3870638
has answer: http://stackoverflow.com/a/24902062
downvote count: 0
has title: Issue with setImageResource() - how can I implement file path?
has body: I am not able to find out how to set a picture as setImageResource(). Currently I can easily add from res/drawable like this: In ListViewAdapter: imageView = (ImageView) rowView.findViewById(R.id.listImageView); imageView.setImageResource((int) getItemId(position)); In ViewAdapter: public class ViewAdapter extends BaseAdapter { class Item { public long id; public String name; public Item(long id, String name) { this.id = id; this.name = name; } } public ViewAdapter(Context c) { mContext = c; mItems = new ArrayList&lt;Item&gt;(); mItems.add(new Item(R.drawable.mercury,"Mercury")); mItems.add(new Item(R.drawable.mercury,"Mercury")); mItems.add(new Item(R.drawable.mercury,"Mercury")); ... So, how can I add a picture from a path? For example, say "/storage/emulated/Photos/Italy.jpg"? Again, I can store them in res/drawable and add them, but need a way to add it from file. Tried different ways, but still can't find out how to do it. Thanks a lot!
answer count: 4
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/38426363
has text: And the reason you think removing entry from recents makes sense is...?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24764378

http://stackoverflow.com/q/24817499
has title: Null-checker in Java
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/14578703
score: 0
answer count: 1
tagged with: null-check
has body: I saw the following line of code in a project : if (null != policyProDO.getSelected()). I have never seen null on the left of assignment operator. I would rather write the above line of code as : if (policyProDO.getSelected() != null). What's really the difference between the two statements if any?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38525714
has answer: http://stackoverflow.com/a/24817513
linked to: http://stackoverflow.com/q/14578703

http://stackoverflow.com/comment/38599034
comment on: http://stackoverflow.com/a/24855855
type: Comment
score: 2
has text: Well done @Eric ! A very solid answer to an extremely incomplete question.
type: AnswerComment

http://stackoverflow.com/comment/38533241
score: 0
comment on: http://stackoverflow.com/q/24820406
type: Comment
type: QuestionComment
has text: Which means your user list is empty, and your query is presumably wrong.

http://stackoverflow.com/q/24876188
tagged with: uuid
tagged with: java
downvote count: 2
has title: How big is the chance to get a Java UUID.randomUUID collision?
has answer: http://stackoverflow.com/a/24876263
type: Question
has comment: http://stackoverflow.com/comment/38637364
linked to: http://stackoverflow.com/q/2513573
has comment: http://stackoverflow.com/comment/123616177
score: 164
has comment: http://stackoverflow.com/comment/100717757
has comment: http://stackoverflow.com/comment/38637372
answer count: 1
favorite count: 0
has body: I need to create some uniques files in Java and i plan to use UUID.randomUUID to generate their names. Is there any chance to get a collision for this? Should i do something like bellow os I shouldn't worry about this? Integer attemptsToGenerateUUID = 1; while (true) { UUID fileUUID = UUID.randomUUID(); if (fileDoesNotExistwith this UUID name) { save file; break; } attemptsToGenerateUUID += 1; if (attemptsToGenerateUUID &gt; 64) { return false; } }
duplicate of: http://stackoverflow.com/q/2513573
upvote count: 166
accepted answer: http://stackoverflow.com/a/24876263
type: AnsweredQuestion

http://stackoverflow.com/q/24835076
has title: Youtube gdata API returning limited results
tagged with: java
type: Question
has body: I'm trying to retrieve the videos returned by the following youtube url using gdata API. https://gdata.youtube.com/feeds/api/users/lyndapodcast/uploads?v=2&amp;max-results=50&amp;start-index=1&amp;q=autodesk If I use the above url, I'm only getting first 4 results, whereas I can see this query produces more results. https://www.youtube.com/user/lyndapodcast/search?query=autodesk Is there a different way of constructing this url? I'm using standard gdata java API. String feedUrl = "https://gdata.youtube.com/feeds/api/users/lyndapodcast/uploads?v=2&max-results=50&start-index=1&q=autodesk"; YouTubeService service = new YouTubeService("Test_App"); Query query = new Query(new URL(feedUrl)); VideoFeed videoFeed = service.getFeed(query, VideoFeed.class); for(VideoEntry videoEntry : videoFeed.getEntries() ) { .... } Any pointers will be appreciated. -Thanks
accepted answer: http://stackoverflow.com/a/27557989
tagged with: gdata
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27557989
tagged with: youtube-api
tagged with: youtube
type: AnsweredQuestion

http://stackoverflow.com/comment/38590292
type: Comment
type: QuestionComment
score: 0
has text: Another thing to mention is classpath:* will search from all dependencies jar. classpath: will search from your project only but not dependencies jar.
comment on: http://stackoverflow.com/q/24850252

http://stackoverflow.com/comment/38479489
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24790057
type: Comment
has text: You can always assume a happens-before relationship *within the same thread*.

http://stackoverflow.com/comment/38629800
type: Comment
score: 0
has text: @JonSkeet added the code adn I'm running java version 1.7.0_55
type: QuestionComment
comment on: http://stackoverflow.com/q/24871892

http://stackoverflow.com/comment/38461822
type: Comment
type: AnswerComment
has text: @JoaoEvangelista Besides this, I also have tried add this line: `jsp_dispatcher.setMultipartConfig(new MultipartConfigElement("/tmp", 1024*1024*5, 1024*1024*5*5, 1024*1024));` to my WebAppInitializer, but still got the same error when I redeploy the application.
score: 0
comment on: http://stackoverflow.com/a/24780173

http://stackoverflow.com/comment/38636979
score: 0
comment on: http://stackoverflow.com/a/24875906
type: AnswerComment
has text: @rgettman ok that was helpful. That explains why they are not the same thing. But I still don't get why `<? extends List<? extends PersonModel>>` fixes the problem.
type: Comment

http://stackoverflow.com/q/24903778
tagged with: java
downvote count: 2
type: Question
has title: How to reproduce JSF web.xml vulnerability
tagged with: jsf-2
has answer: http://stackoverflow.com/a/24904308
upvote count: 0
answer count: 1
has body: There is a known web.xml vulnerability exist in javax.faces 2.1 jar. Please consider below URL to reproduce this issue and that was given by client side to reproduce this issue. https://example.com/javax.faces.resource.../WEB-INF/web.xml.jsf (dummy URL) but we are unable to reproduce this issue at our end. We tried using below URLs to reproduce this issue at our end. https://&lt;external IP&gt;:8181/javax.faces.resource.../WEB-INF/web.xml.jsf https://&lt;Localhost&gt;:8181/javax.faces.resource.../WEB-INF/web.xml.jsf https://&lt;Localhost&gt;:8181/ABC/javax.faces.resource.../WEB-INF/web.xml.jsf Please note that deployed application structure are same at both ends. So please any early help to reproduce this issue would be highly appreciated as this issue high priority issue. Thanks in advance
favorite count: 0
type: UnansweredQuestion
score: -2
tagged with: glassfish-3
tagged with: jsf

http://stackoverflow.com/q/24768488
type: Question
has title: TomEE OpenEJBException caused by ClassNotFoundException for class of name 'empty string'
tagged with: apache-tomee
tagged with: servlets
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0
has body: When attempting to launch TomEE with Java Server Faces web app running Mojarra 2.2.0, I get a ClassNotFoundException caused by a Servlet with a class name of ""(empty string). I've trapped the error with the debugger in hopes of figuring out where the empty string is coming from. Don't all of the servlet class names get specified in the web.xml file? Has anyone run into this? Is the web.xml file corrupted somehow? The exception stack trace: SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/CopSync] org.apache.openejb.OpenEJBException: Unable to load servlet class: : <-- Class name goes here at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:2061) at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1824) at org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:355) at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:396) at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:938) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1179) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1054) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:127) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) a…
type: AnsweredQuestion
tagged with: jsf
has answer: http://stackoverflow.com/a/24768521
accepted answer: http://stackoverflow.com/a/24768521
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/24875429
has comment: http://stackoverflow.com/comment/38635908
has comment: http://stackoverflow.com/comment/38635890
has body: There shouldn't be a difference. That notation arose due to many people using the assignment operator instead of the comparison operator, which lead to many hard to find bugs. For example: if(null = object) { //compiler throws error that you can't assign null } edit: As Jon pointed out, this is possible in other languages. My guess is that the habit carried over to Java land.
answers question: http://stackoverflow.com/q/24875362
score: 0
type: Answer

http://stackoverflow.com/comment/38577011
type: Comment
comment on: http://stackoverflow.com/q/24843834
score: 0
type: QuestionComment
has text: i tried,it's should be with package name.. I guess the problem is because i inserted an interestitial banner in splash activity, and it's switchs to another activity while a banner is loading.. do you have an S5? because i'm getting a lot of errors with this device, but it's works fine on others.

http://stackoverflow.com/comment/38697166
score: 0
comment on: http://stackoverflow.com/q/24908157
type: Comment
type: QuestionComment
has text: have you declared your variables and methods inside a class and not in the outer space!!!

http://stackoverflow.com/comment/38402182
comment on: http://stackoverflow.com/q/24751897
score: 0
type: QuestionComment
has text: try to put there and try..
type: Comment

http://stackoverflow.com/comment/38550602
type: Comment
type: QuestionComment
has text: Or wait, you can actually just add any open project as a dependency. In the dialog of the "add dependency", just select a project from the "open projects" tab
score: 0
comment on: http://stackoverflow.com/q/24830439

http://stackoverflow.com/a/24881434
has body: Please, check startActivities() method. As following documentation snippet states: Note that unlike that approach, generally none of the activities except the last in the array will be created at this point, but rather will be created when the user first visits them (due to pressing back from the activity on top). That is, multiple apps can be started via intents but each next Activity overlays the previous one. Update Try following code: public void launchActivities(View v) { AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent startChrome = getPackageManager().getLaunchIntentForPackage("com.android.chrome"); PendingIntent pi1 = PendingIntent.getActivity(getApplicationContext(), 666, startChrome, 0); alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + 500, pi1); Intent startSettings = getPackageManager().getLaunchIntentForPackage("com.android.settings"); PendingIntent pi2 = PendingIntent.getActivity(getApplicationContext(), 667, startSettings, 0); alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, pi2); finish(); } Change System.currentTimeMillis() + N parameter to set the appropriate time between launches.
answers question: http://stackoverflow.com/q/24881262
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38652651
accepted answer of: http://stackoverflow.com/q/24881262
type: Answer

http://stackoverflow.com/comment/38485204
type: AnswerComment
score: 0
type: Comment
has text: @TAsk it won't exit on valid input (unless it's 5 which is meant for exit). As for invalid input - see my comment above.
comment on: http://stackoverflow.com/a/24795499

http://stackoverflow.com/comment/38522913
type: Comment
score: 0
type: AnswerComment
has text: its runs automatically
comment on: http://stackoverflow.com/a/24815852

http://stackoverflow.com/a/36302742
has body: The issue is still reproducing on STS 3.7.3.RELEASE. See also the issue on eclipse community forum and the related bugs on eclipse bugzilla...
type: Answer
answers question: http://stackoverflow.com/q/24768715
score: 0

http://stackoverflow.com/q/24789562
linked to: http://stackoverflow.com/q/15001651
favorite count: 0
has title: How to shorten an if else statement in java?
has comment: http://stackoverflow.com/comment/38473632
has answer: http://stackoverflow.com/a/24789601
accepted answer: http://stackoverflow.com/a/24789601
has answer: http://stackoverflow.com/a/24805239
answer count: 4
score: 2
has comment: http://stackoverflow.com/comment/38473634
downvote count: 0
has comment: http://stackoverflow.com/comment/38473624
has answer: http://stackoverflow.com/a/24789618
linked to: http://stackoverflow.com/q/2338790
has comment: http://stackoverflow.com/comment/38473701
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24789618
tagged with: if-statement
has answer: http://stackoverflow.com/a/24790155
tagged with: java
has comment: http://stackoverflow.com/comment/38473852
has body: Note:Keep in mind that im a newbie both at java and stackoverflow and this is my first question. Okay, so I was making a basic console based game in java and I had a problem. I had a long list of if else statements. How I can shorten them? I have tried looking at Is there anyway to shorten if else statements instead of going in circles but i didn't get the answer I needed. Here's some sample code from my program: import java.util.Scanner; public class FishMain { public static void main(String[] args) { FishClass myFish = new FishClass(); //Makes a scanner for user input/commands Scanner userComSc = new Scanner(System.in); //scans for what the user types String userCom = userComSc.nextLine(); //checks if the userCommand isn't /end or exit (when it is it will terminate) while(!userCom.equals("/end") &amp;&amp; !userCom.equals("/exit")) { if(userCom.equals("/dive 1")){ myFish.dive(1); } else if(userCom.equals("/dive 2")){ myFish.dive(2); } else if(userCom.equals("/dive 3")){ myFish.dive(3); } else if //so on till 99... } I have tried something like this: if(userCom.startsWith("/dive")){ int howDeep = Integer.parseInt(userCom); myFish.dive(howDeep); } but it ends up in an error. Here's the error message: //user types /dive 6 Exception in thread "main" java.lang.NumberFormatException: For input string: "/dive 6" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at FishMaster.main(FishMaster.java:40) Please help me figure out what I am doing wrong. Edit 1 : Sorry for the confusion of the "/dive 1" (ft) making myFish dive 3ft, that was a typo it is now fixed...
has comment: http://stackoverflow.com/comment/38478670
type: Question
upvote count: 2

http://stackoverflow.com/a/24766421
has body: Yes, you can just open a Socket to the address and port of your databse server, if you get an IOException the server is down. (tested with postgress) public boolean isDatabaseOnline(String address, int port) { boolean result; try { Socket socket = new Socket(address, port); socket.close(); result = true; } catch (IOException e) { result = false; } return result; }
answers question: http://stackoverflow.com/q/24766216
type: Answer
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/38624978
comment on: http://stackoverflow.com/a/24867278
type: AnswerComment
type: Comment
has text: Thumps Up ...for my friend PedroHawk....The code really worked...Thanks a ton...
score: 1

http://stackoverflow.com/comment/126550140
comment on: http://stackoverflow.com/a/24767481
type: Comment
has text: Think, the original post makes clear, that the trigger "until an element becomes available" is not followed. When an element becomes available, the thread waiting in "take()" should become unblocked. Insofar "Because it's how take() works." is not an answer.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24863407
has comment: http://stackoverflow.com/comment/38615557
accepted answer of: http://stackoverflow.com/q/24855565
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38622214
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24855565
downvote count: 0
has body: The loader needs to know where to inject the instances to - without the field anchorPaneOne can't be instantiated and remains null. That's done by the controller property which must be set before actually loading the ui: // create a loader FXMLLoader loader = new FXMLLoader(getClass().getResource(resource)); // set this instance as its controller loader.setController(this); // load the ui Parent root = loader.load(); Scene scene = new Scene(root, 600, 400); primaryStage.setScene(scene); primaryStage.setTitle("Stack Overflow Example"); primaryStage.show(); Rectangle r = new Rectangle(100, 100); // now the field is instantiated and can be accessed without NPE anchorPaneOne.getChildren().add(r);

http://stackoverflow.com/q/24819528
tagged with: javascript
has title: Alternative for checking module before using `>>`?
has body: In- Java , C# , Javascript : AFAIU - the &gt;&gt; is a shift right operand which can deal also with signed numbers : There is no problem with : 12&gt;&gt;2 --&gt; 3 And also for signed number : -12&gt;&gt;2 --&gt; -3 But when the decimal result is not an integer , the result are differnt: 10&gt;&gt;2 --&gt; 2 Whereas -10&gt;&gt;2 --&gt; -3 I'm fully aware why it is happening (via Two's complement ) , but : Question : Does it mean that when I use the fastest division ever &gt;&gt; - I must check that : 10%4 is not zero ? Am I missing something here ?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24819774
score: 0
has comment: http://stackoverflow.com/comment/38550383
type: Question
tagged with: c#
tagged with: java
tagged with: bitwise-operators
has comment: http://stackoverflow.com/comment/38531627
linked to: http://stackoverflow.com/q/6357038
has answer: http://stackoverflow.com/a/24819774
answer count: 1

http://stackoverflow.com/a/24814517
has comment: http://stackoverflow.com/comment/38520914
type: Answer
answers question: http://stackoverflow.com/q/24814422
has comment: http://stackoverflow.com/comment/38520796
upvote count: 2
has comment: http://stackoverflow.com/comment/38520881
has comment: http://stackoverflow.com/comment/38520533
has comment: http://stackoverflow.com/comment/38520888
score: 2
has body: Try using the method onPostExecute in your AsyncTask class rather than your Fragment class. The AsyncTask class looks like this: private class MyTask extends AsyncTask&lt;String, Void, String[]&gt; { @Override protected String[] doInBackground(String... params) { } @Override protected void onPostExecute(String result[]) { } @Override protected void onPreExecute() { } @Override protected void onProgressUpdate(Void... values) { } } For your case, you will want to put the onPostExecute method inside your FetchWeatherTask class as such: class FetchWeatherTask extends AsyncTask&lt;String, Void, String[]&gt; { .... @Override protected void onPostExecute(String result[]) { if (result != null) { Log.v("msg", result[0]); mForeCastAdapter.clear(); //forecastArray = result; for (String dayForecastStr : result) { mForeCastAdapter.add(dayForecastStr); //mForeCastAdapter.notifyDataSetChanged(); } } mForeCastAdapter.notifyDataSetChanged(); } .... }
downvote count: 0

http://stackoverflow.com/a/24788272
answers question: http://stackoverflow.com/q/24787517
has comment: http://stackoverflow.com/comment/38471783
has body: You can use a BaseAdapter and modify the information and after call the notifyDataSetChanged to refresh the ListView. class MyAdapter extends BaseAdapter { private LayoutInflater inflater; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; dates; public MyAdapter(LayoutInflater inflater, ArrayList&lt;HashMap&lt;String, String&gt;&gt; dates){ this.inflater = inflater; this.dates = dates; } public void setDates(ArrayList&lt;HashMap&lt;String, String&gt;&gt; dates) { this.dates = dates; } @Override public int getCount() { return dates.size(); } @Override public HashMap&lt;String, String&gt; getItem(int i) { return dates.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int i, View view, ViewGroup viewGroup) { //Definition of your views to use. TextView monthTextView = null; TextView yearTextView = null; if(view == null) { //Inflate the item. view = inflater.inflate(R.layout.exp_item_entry, null); //Your findViewById to link the views monthTextView = (TextView)view.findViewById(R.id.monthTextView); yearTextView = (TextView)view.findViewById(R.id.yearTextView); } //What you wanna do with the views linked up. HashMap&lt;String, String&gt; item = getItem(i); monthTextView.setText(item.get("month")); yearTextView.setText(item.get("year")); return view; } To use the adapter in our ListView: MyAdapter myAdapter = new MyAdapter(getLayoutInflater(), dates); ... listView.setAdapter(myAdapter); And to update the information, you can perform a rawQuery using WHERE to filter the information and you only need put the filtered dates in the adapter and call notifyDataSetChanged. myAdapter.setDates(filteredDates); myAdapter.notifyDataSetChanged();
score: 0
type: Answer

http://stackoverflow.com/a/24902167
downvote count: 0
type: Answer
has body: How about serving these images from the server as well? You can host the images(key values for the package name?) for these apps somewhere and list them inside a listview on your app? This is the exact thing you want to implement but using a different method to achieve it then what you are trying to do.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38686966
answers question: http://stackoverflow.com/q/24901324
has comment: http://stackoverflow.com/comment/38686562

http://stackoverflow.com/comment/38438513
comment on: http://stackoverflow.com/a/24771232
score: 0
type: Comment
has text: @MiserableVariable In the question `firstClass.obj` is static. So it is bound to one thread.
type: AnswerComment

http://stackoverflow.com/q/24843514
accepted answer: http://stackoverflow.com/a/24882917
has title: How to get initial context from GlassFish server in Java SE?
linked to: http://stackoverflow.com/q/15779510
has comment: http://stackoverflow.com/comment/38574603
tagged with: initial-context
linked to: http://stackoverflow.com/q/12002948
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38575689
tagged with: java
has comment: http://stackoverflow.com/comment/38888384
upvote count: 4
possible better answer: http://stackoverflow.com/a/26910606
answer count: 2
has answer: http://stackoverflow.com/a/26910606
downvote count: 0
score: 4
has body: I have a class like below: public class Poligon { public static void main(String[] args) { try { Context ctx = new InitialContext(); ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("jms/javaee7/ConnectionFactory"); Destination destination = (Destination) ctx.lookup("jms/javaee7/Topic"); JMSContext context = connectionFactory.createContext(); OrderDTO order = context.createConsumer(destination).receiveBody(OrderDTO.class); System.out.println("Order received: " + order); } catch (NamingException ex) { Logger.getLogger(Poligon.class.getName()).log(Level.SEVERE, null, ex); } } } I would like to get the InitialContext() form the server (glassfish) running on localhost, but I get the below error: SEVERE: null javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:344) at javax.naming.InitialContext.lookup(InitialContext.java:411) at poligon.Poligon.main(Poligon.java:29) I know I have to create ldap realm on glassfish and add the below code (? - dont know the exact values) to my class: Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "?"); env.put(Context.PROVIDER_URL, "?"); env.put(Context.SECURITY_PRINCIPAL, "?"); env.put(Context.SECURITY_CREDENTIALS, "?"); Context ctx = new InitialContext(env); My problem is that I dont know what values should be at: Context.INITIAL_CONTEXT_FACTORY Context.PROVIDER_URL (I want it on localhost) Context.SECURITY_PRINCIPAL Context.SECURITY_CREDENTIALS And I dont know how I should configure glassfish server? maven dependencies org.glassfish.main.extras glassfish-embedded-all 4.0 provided org.glassfish.main.appclient.client gf-client 3.1.2.2
tagged with: glassfish
favorite count: 0
has answer: http://stackoverflow.com/a/24882917
has comment: http://stackoverflow.com/comment/38896048

http://stackoverflow.com/comment/133915558
type: AnswerComment
type: Comment
has text: @unknown_11: Please don't provide any details *here* - instead, ask a new question.
comment on: http://stackoverflow.com/a/24902789
score: 0

http://stackoverflow.com/comment/38605833
has text: Never mind the second comment, I had accidentally closed the class before the @Override section, not getting those two errors now.
type: Comment
comment on: http://stackoverflow.com/a/24858916
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38402950
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24751332
has text: No, this won't work. See case `";"`: It shouldn't match (in the original regex), but it did.
type: AnswerComment

http://stackoverflow.com/a/53380493
answers question: http://stackoverflow.com/q/24797212
score: 0
type: Answer
has body: If you want the DB to do this through JPA/Hibernate you could create a sort expression based on a simple case statement, assuming your entity is called Case: Expression exp = criteriaBuilder.selectCase(root.get(Case_.priority)).when("High", 1).when("Medium", 2).otherwise(3); queryBuilder.orderBy(orderDir.isAscending() ? criteriaBuilder.asc(exp) : criteriaBuilder.desc(exp)); Using case statements in an order by clause isn't great for performance, but solves it. Works with Oracle.

http://stackoverflow.com/comment/38670280
type: Comment
type: QuestionComment
score: 2
has text: The phrases `display the id in my jsp file` and `write to my jsp file` indicate some fundamental misunderstanding about what a jsp file is. It is not something you "write to". It is a template for rendering HTML output.
comment on: http://stackoverflow.com/q/24893734

http://stackoverflow.com/a/28638882
has body: tl;dr Use evicted command, exclude and force() in the build with very helpful reports under target/resolution-cache/reports/. Don't forget about sbt-dependency-graph. As said in Exclude specific transitive deps: Sometimes it takes a bit of detective work to figure out which transitive deps to exclude. I've experienced the very similar issue and the solution was to use proper dependency of Netty library (or rather exclude one to let assembly pass). [microservice]&gt; evicted [info] Updating {file:/Users/jacek/work/.../}microservice... [info] Resolving jline#jline;2.12 ... [info] Done updating. [warn] There may be incompatibilities among your library dependencies. [warn] Here are some of the libraries that were evicted: [warn] * xml-apis:xml-apis:1.0.b2 -&gt; 1.4.01 (caller: xerces:xercesImpl:2.11.0, dom4j:dom4j:1.6.1) [warn] * io.netty:netty:(3.6.6.Final, 3.6.3.Final) -&gt; 3.9.3.Final (caller: com.typesafe.netty:netty-http-pipelining:1.1.2, com.typesafe.play:play_2.11:2.3.7, org.apache.cassandra:cassandra-all:2.0.8, com.netflix.astyanax:astyanax-cassandra:1.56.48) [warn] * joda-time:joda-time:1.6.2 -&gt; 2.3 (caller: com.typesafe.play:play-json_2.11:2.3.7, com.netflix.astyanax:astyanax-core:1.56.48, com.typesafe.play:play_2.11:2.3.7, com.netflix.astyanax:astyanax-cassandra:1.56.48, com.netflix.astyanax:astyanax-recipes:1.56.48, com.netflix.astyanax:astyanax-thrift:1.56.48) [warn] * jline:jline:1.0 -&gt; 2.11 (caller: com.tinkerpop:gremlin-groovy:3.0.0.M6, org.apache.cassandra:cassandra-all:2.0.8) [success] Total time: 5 s, completed Feb 20, 2015 6:42:14 PM As you may have noticed in the above snippet, I was facing dependency version mismatch between three different versions of Netty - 3.6.6.Final, 3.6.3.Final and 3.9.3.Final. I needed 3.6.6.Final to be chosen so I used force() for the version that I explicitly added to the build (using build.sbt): libraryDependencies += "io.netty" % "netty" % "3.6.3.Final" force() With the above line in the build, executing evicted …
answers question: http://stackoverflow.com/q/24762525
has comment: http://stackoverflow.com/comment/60398965
accepted answer of: http://stackoverflow.com/q/24762525
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/60141131
score: 3
upvote count: 3

http://stackoverflow.com/comment/38608142
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24859083
has text: App History is getting manages with places getting mapped with PlaceHistoryMapper and it is getting binded. The main problem is to create history with Pagination as it doesn't have valuechanger rather it is working on nextPage, previousPage, lastpage, etc....

http://stackoverflow.com/q/24878211
answer count: 3
has answer: http://stackoverflow.com/a/24878246
upvote count: 1
has body: My instructor wants us to populate an array with 25,000 random variables so we can sort them. This is the first part of his questions: Randomly generate a data set of at least 25,000 integers (keys) [integer values within the range 1-99,000] and store the data set in an integer array called unsorted_Array of size=25,000, and save another copy to another array called sorted_Array of size=25,000 [Note: fill the two arrays in one step]. This is what i have for code: Random rand1 = new Random (); int [] unsorted_Array = new int [25000]; int [] sorted_Array = new int [25000]; for (int i = 0; i &lt; 25000; i++) { unsorted_Array[i] = rand1.nextInt(max); sorted_Array[i] = rand1.nextInt(max); } The problem is that it is taking forever to populate the arrays. I was wondering if there was a way that I can generate the 25,000 integers quickly because there are more parts to this homework. EDIT: Since I cant really explain I am just going to post what all needs to be done (Leaving out the first one cause got that figured out): Use Quick-Sort [we discussed in class – check the code from slides] to sort the data (keys) and save the result in the sorted_Array [include in your code the sorting algorithm] At this point you should have 2 integer arrays, original-not sorted and the sorted array. Randomly pick 100 elements (keys) from the unsorted_Array and store them in a new integer array called keys_Array. [ doing this we make sure all keys are mostly found, and our binary search function will probably return the index] For each element (key) in the key_Array you need to do the following: [Use arrays to store the statistical information you gather] Use the sequential search algorithm to search for the element in the unsorted_Array and record the following: Record the index where the element (key) was found. The time it takes to locate the element in the unsorted_Array [use the time function to calculate the time] Use the binary search algorithm to search for the element in the unsort…
downvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/38641150
has comment: http://stackoverflow.com/comment/38641121
favorite count: 0
has comment: http://stackoverflow.com/comment/38641171
has comment: http://stackoverflow.com/comment/38641202
has title: Fill arrays with random ints quickly
has answer: http://stackoverflow.com/a/24878393
has comment: http://stackoverflow.com/comment/38641087
has comment: http://stackoverflow.com/comment/38641085
has comment: http://stackoverflow.com/comment/38641185
has comment: http://stackoverflow.com/comment/38641187
has comment: http://stackoverflow.com/comment/38641099
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38641168
type: Question
has comment: http://stackoverflow.com/comment/38641127
has answer: http://stackoverflow.com/a/24878365
has comment: http://stackoverflow.com/comment/38641139
has comment: http://stackoverflow.com/comment/38641108
has comment: http://stackoverflow.com/comment/38641114
score: 0
has comment: http://stackoverflow.com/comment/38641076

http://stackoverflow.com/q/24792360
has title: Issues with Java 7u65
tagged with: signed-applet
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39140826
tagged with: java
possible better answer: http://stackoverflow.com/a/24804487
type: Question
has answer: http://stackoverflow.com/a/24962601
has comment: http://stackoverflow.com/comment/38479475
has comment: http://stackoverflow.com/comment/38479963
has answer: http://stackoverflow.com/a/25191131
tagged with: applet
upvote count: 13
has answer: http://stackoverflow.com/a/24793819
has answer: http://stackoverflow.com/a/24815238
answer count: 7
has body: Last night a new Java 7 update has been released: 7u65. I have a web application where a service applet is loaded, and after the update, my tests on different PCs did not show issues nor wrong behaviors. Later, I started to receive issue reports related to my product's Java service applet. All the reports came from users who updated Java JRE to 7u65 (from 7u60): The applet was not loading at all. I display a "Loading" screen when the application starts, and this was not being displayed. Also, all the services provided by my Java applet were unavailable. After changing the Java Control Panel's advanced configuration to always show the console (in one of the PCs where this issue happened), I discovered that the applet was not even launching the Java console. Using the same station where the error happens, trying to access java.com to check the current java version, the Java applet is loaded and the console is displayed without errors. All tests were performed after clearing Browser and Java Cache, and even after removing the installed certificates (mine is a valid signed applet). I checked the Java 7u65 release notes and none of the mentioned changes seem to affect my applet. Also, there were no issues while using Java 7u60. I don't have any clues about what is going on, perhaps because the java update was released hours ago. As the Java console can not be displayed even if I configure Java Control Panel to do so, I can not tell if there is any exception. I can not reproduce the issue in my PCs (Windows 8, nor Windows 7, both at 64 bits), but the issue has been reported on Windows 7 PCs. One of my friends told me that this seems to be happening on machines where Java 7u60 was in use, and then it was updated to Java 7u65 with no deinstallations. Also, this tends to happen in older OS (ie: WinXP) which is more natural. I write this question because it seems very odd that some PCs have this issue, and some others not. I'd like to know if any one else is having this issue…
has answer: http://stackoverflow.com/a/24804487
favorite count: 0
has comment: http://stackoverflow.com/comment/38479438
has answer: http://stackoverflow.com/a/24818834
has comment: http://stackoverflow.com/comment/38480596
has comment: http://stackoverflow.com/comment/38486529
has answer: http://stackoverflow.com/a/24795038
accepted answer: http://stackoverflow.com/a/24795038
score: 13

http://stackoverflow.com/q/24889808
tagged with: java
has body: I have implemented a JFace Wizard with 2 WizardPages. By default, the first WizardPage has these 4 Buttons: Back (disabled) Next (focused) Cancel Finish (disabled) Now I want to set the default focus on the Cancel Button. How do I do that? Removing the focus and setting it to some Control of the page's content would also be ok. I tried setting the focus to a Button in the content layout of the WizardPage, but this only sets me a second focus on the immediateButton. The focus on the Next button is still there, and the Next button reacts to pressing enter, which is what I want to avoid. @Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { immediateButton.setFocus(); } } How can I access the Dialog buttons and change their focus?
accepted answer: http://stackoverflow.com/a/24890177
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
tagged with: focus
type: Question
tagged with: jface
has comment: http://stackoverflow.com/comment/38662989
upvote count: 2
has answer: http://stackoverflow.com/a/24890177
has title: How do I change the focus on buttons of JFace WizardPage?
has comment: http://stackoverflow.com/comment/38662873
answer count: 1

lambda
tags question: http://stackoverflow.com/q/24855746
tags question: http://stackoverflow.com/q/24874256
tags question: http://stackoverflow.com/q/24850748
tags question: http://stackoverflow.com/q/24821445
tags question: http://stackoverflow.com/q/24814794
tags question: http://stackoverflow.com/q/24801925
tags question: http://stackoverflow.com/q/24764118
tag name: lambda
tags question: http://stackoverflow.com/q/24893597
tags question: http://stackoverflow.com/q/24770637
tags question: http://stackoverflow.com/q/24799650
tags question: http://stackoverflow.com/q/24887196
tags question: http://stackoverflow.com/q/24816190
tags question: http://stackoverflow.com/q/24765179
tags question: http://stackoverflow.com/q/24750576
tags question: http://stackoverflow.com/q/24852922
type: Tag
tags question: http://stackoverflow.com/q/24819556
tags question: http://stackoverflow.com/q/24786424
tags question: http://stackoverflow.com/q/24779806
tags question: http://stackoverflow.com/q/24792312

http://stackoverflow.com/a/24809363
answers question: http://stackoverflow.com/q/24809250
has comment: http://stackoverflow.com/comment/38510553
has body: because you don't set str with new value. the function replace return a String. public class main { public static void main(String[] args) { System.out.println(frontBack("java")); } public static String frontBack(String str) { if (str.length() &lt; 1) { return str; } else if (str.length() &gt;= 2) { char a = str.charAt(0); char b = str.charAt(str.length() - 1); str = str.replace(a, b); //str = str.replace(b, a); maybe you need it } return str; } }
has comment: http://stackoverflow.com/comment/38510355
score: 0
upvote count: 1
downvote count: 1
type: Answer

http://stackoverflow.com/comment/38550385
score: 0
has text: I believe when you build a maven project in netbeans it automatically installs to the local repo. You should be able to right click on the dependencies node in the project explorer and select add dependency. Then type the group and artifact id and it should come up. Have you tried?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24830439

http://stackoverflow.com/q/24832175
tagged with: rackspace-cloud
has answer: http://stackoverflow.com/a/24833782
score: 0
has title: installing chef client using jclouds-chef on rackspace
answer count: 1
tagged with: chef-infra
tagged with: jclouds
type: UnansweredQuestion
has body: I am running into a problem trying to automate everything. I was trying to create few brand new servers on rackspace Node 1 - Chef Server installed. Node 2 - Chef Client Node 3 - Chef Client and was able to install chef-server on node 1 and was trying to install chef client on other nodes using jclouds-chef api. I am running the code from my local machine and connecting to rackspace. Q1 . How do I get knife tool configured on Node 1 remotely with out interactive our with interactive. Is there any way to do it using the jclouds ? Q2 . How do I get the client.pem file and validation. pem file which are not available on my local machine when i try to use the above example to configure the nodes with chef client. Q3 . How do I get client.pem created using a script or do it remotely ? Any help will be appreciated.
linked to: http://stackoverflow.com/q/24777085
tagged with: java
type: Question

http://stackoverflow.com/q/24847679
has comment: http://stackoverflow.com/comment/38582705
score: 0
has body: i want to add mouselistener to card panel but it is not working....i want to code that when mouse enters card panel ,images change automatically, and they stop moving when mouse exits card panel....three images are added to card panel cp1 public class entry extends JFrame implements MouseListener { CardLayout clayout1; Panel p4,p5,p6,cp1; String s2[]={"fourth","fifth","sixth"}; boolean x; entry() { setLayout(null); cp1=new Panel(); clayout1=new CardLayout(); cp1.setLayout(clayout1); cp1.setBounds(0,0,1920,500); cp1.addMouseListener(this); //here iam adding mouselistener to cardpanel p4=new Panel(); img4=new ImageIcon("a.jpg"); l4=new JLabel(img4); p4.add(l4); p5=new Panel(); img5=new ImageIcon("b.jpg"); l5=new JLabel(img5); p5.add(l5); p6=new Panel(); img6=new ImageIcon("3.jpg"); l6=new JLabel(img6); p6.add(l6); add(cp1); cp1.add(p4,"fourth"); cp1.add(p5,"fifth"); cp1.add(p6,"sixth"); } public void mouseExited(MouseEvent e) { x=true; } public void mouseEntered(MouseEvent e) { for(int i=0; i&lt;=2;i++){ clayout1.show(cp1,s2[i]); try { Thread.sleep(2000); } catch (InterruptedException E) { E.printStackTrace(); } if(i==2){ i=-1;} System.out.println("entered"); //this "entered" is not being printed in console if(x) { break; } } }
has answer: http://stackoverflow.com/a/24847944
has title: mouse listener not working in card panel
has comment: http://stackoverflow.com/comment/38582908
tagged with: mouselistener
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/38583957
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/24847807
has comment: http://stackoverflow.com/comment/38582652
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38582941

http://stackoverflow.com/q/24899115
type: AnsweredQuestion
score: 3
downvote count: 0
has body: I try to plot 14 data sets but I have problem with colors in the LineChart. I correctly defined 14 colors in .css file like that: .default-color0.chart-series-line { -fx-stroke: red; } .... .default-color13.chart-series-line { -fx-stroke: goldenrod; } Everything's working fine, the lines have different colors until 7 data. Then the colors of lines are reapeted again from color0 to color7. I have no idea what is happening. Also when I don't add any .css style, linechart generated colors automatically but again it repeats colors after 7 data.
accepted answer: http://stackoverflow.com/a/24899494
favorite count: 0
tagged with: colors
type: Question
tagged with: css
linked to: http://stackoverflow.com/q/11153370
upvote count: 3
tagged with: java
tagged with: javafx
answer count: 1
has answer: http://stackoverflow.com/a/24899494
has title: JavaFX - Why LineChart repeats colors after few plots?
tagged with: linechart

http://stackoverflow.com/comment/38470315
comment on: http://stackoverflow.com/q/24783254
has text: I am cautiously optimistic that setting sun.java2d.opengl to false and sun.java2d.d3d to false, plus setting undecorated to true, has corrected the issue.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39779990
type: Comment
comment on: http://stackoverflow.com/a/24805442
has text: @user2837260: this question http://stackoverflow.com/q/25474721/217324 is very similar, you might see if my answer there helps.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38670141
comment on: http://stackoverflow.com/q/24893600
score: 0
has text: ... never the less, here is a good example http://www.javacodegeeks.com/2013/03/serialization-in-java.html
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38667223
has text: I tried using that, but in one of the readme files it said to download something and the download did not exist.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24876007
type: Comment

http://stackoverflow.com/comment/38695730
comment on: http://stackoverflow.com/a/24875594
type: AnswerComment
has text: Out Of Memory means the heap is too low. What kind of operations are you executing to give that error?
score: 0
type: Comment

http://stackoverflow.com/comment/99763059
comment on: http://stackoverflow.com/a/56591900
has text: please write _real_ English - ur or u aren't existing words ;) And no, using a stackpane here is not a good option, actually a stackpane rarely is the appropriate layout
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24777778
has comment: http://stackoverflow.com/comment/38450559
has title: Send large file in Android fast
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26099954
type: Question
has comment: http://stackoverflow.com/comment/38450518
answer count: 2
has comment: http://stackoverflow.com/comment/38450816
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/26099954
has body: I want to send 18 mb Data. It is working. But I have to wait too long that I get Email. Code: public void sendEmail() { emailSendReceiver = new EmailSendBroadcastReceiver(); EmailSend emailSend = new EmailSend(); emailSend.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public class EmailSend extends AsyncTask&lt;Void, Void, Boolean&gt; { @Override protected Boolean doInBackground(Void... params) { boolean bResult = false; String sDeviceID = configReader.getXmlValue(KEY_ID); Mail m = new Mail("test@gmail.com", "testpass"); String[] toArr = {"toEmail@gmail.com"}; m.setTo(toArr); m.setFrom("noreply@something.com"); m.setSubject("device number : "+sDeviceID ); m.setBody("device number : "+sDeviceID); try { String sTxtFileName = sDeviceID+"_"+".txt"; String sFileUrl = Environment.getExternalStorageDirectory().getAbsolutePath()+"/data_source/"+sTxtFileName; m.addAttachment(sFileUrl); if(m.send()) { bResult = true; } else { // something } } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); if(result == true) { // something } } } } The Question is. How can I make it faster? I have 6 AsyncTask. And I don't like to make it with activity.
has comment: http://stackoverflow.com/comment/38450589
tagged with: android
possible better answer: http://stackoverflow.com/a/24778332
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24778332

http://stackoverflow.com/comment/38624607
comment on: http://stackoverflow.com/q/24759710
score: 0
type: Comment
type: QuestionComment
has text: It wasn't clear to me that it was for one specific test element. In particular, you've found the number of test elements, but there can be different numbers of elements under each. It's hard to tell what you want the code to look like at the moment... What would a suitable method signature be, for example?

http://stackoverflow.com/comment/38480670
type: AnswerComment
comment on: http://stackoverflow.com/a/24793144
type: Comment
has text: because i don't know what is at that line no. Try other option or read the tutorial for better understanding.
score: 0

http://stackoverflow.com/comment/38521238
comment on: http://stackoverflow.com/a/24793466
type: AnswerComment
has text: Optimize? What part needs optimizing?
score: 0
type: Comment

http://stackoverflow.com/q/24885894
upvote count: 1
has title: How to run a Maven enforcer rule before the Maven release prepare changes the pom.xml?
tagged with: maven-release-plugin
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
tagged with: maven-enforcer-plugin
has body: I've created a custom Maven enforcer rule. This rule will check the content of the <scm><connection> value to ensure that it points to the trunk or branches/* (i.e. not a tag). This enforcer is configured in the pom.xml like that: org.apache.maven.plugins maven-enforcer-plugin 1.3.1 my.company maven-release-enforcer 1.0.0 enforce-release-check enforce validate <releaseCheck implementation="my.company.maven.release.enforcer.MavenReleaseEnforcer"/> Unfortunately, when we use it with the Maven Release plugin, the latter plugin changes the content of the <scm><connection> value during its [enter link description here]prepare2 goal, so before the enforcer is effectively called. This results in a failure of my custom rule, as the <scm><connection> points to a tag at this time. So my question: is there a way to force the enforcer to be called before the Maven Release plugin start to modify the pom.xml? ps: the Jenkins job is divided into 2 steps: mvn clean release:prepare and mvn release:perform.
answer count: 1
has answer: http://stackoverflow.com/a/24886050
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/comment/38522199
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24815413
type: Comment
has text: Vector is not obsolete nor deprecated here's the documentation: http://docs.oracle.com/javase/8/docs/api/deprecated-list.html

http://stackoverflow.com/comment/38526282
score: 0
type: Comment
type: QuestionComment
has text: I guess, there is something wrong on line final EditTextPreference editPreference = (EditTextPreference)findPreference("device_name");
comment on: http://stackoverflow.com/q/24817721

http://stackoverflow.com/q/24762263
tagged with: http-post
upvote count: 1
favorite count: 0
has title: Send picture from Android app to server http post
tagged with: android
downvote count: 0
linked to: http://stackoverflow.com/q/4989182
has body: I'm trying to figure out the best way to send a bitmap to a webserver to store into a database. Right now, I am sending a string placeName to the server like this: HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("mywebserver"); List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("placeName",placeName)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); This is successful. Now, basically what I want to do is something like this Bitmap photo = (Bitmap) data.getExtras().get("data"); nameValuePairs.add(new BasicNameValuePair("placePhoto",photo)); //obviously pseudocode Is there a way I can do this? Thanks.
tagged with: bitmap
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24764711
tagged with: java
has answer: http://stackoverflow.com/a/24762599
accepted answer: http://stackoverflow.com/a/24762599
linked to: http://stackoverflow.com/q/7359173
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24764711

http://stackoverflow.com/a/27106101
has body: Interestingly, after giving encryption another shot today, it just worked without any exceptions. Not sure what could have caused this, maybe something cached in Intellij, or even a maven/nexus version.
accepted answer of: http://stackoverflow.com/q/24813357
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24813357
type: Answer
score: 0

http://stackoverflow.com/a/24881119
has comment: http://stackoverflow.com/comment/38646598
has comment: http://stackoverflow.com/comment/38648106
type: Answer
upvote count: 2
has body: These lines need to put in manifest.xml file where your activity is define not in layout file.
answers question: http://stackoverflow.com/q/24881057
score: 2
accepted answer of: http://stackoverflow.com/q/24881057
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24828593
score: 4
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24828266
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24828266
downvote count: 0
has body: This is a common practice for internationalizing content. You create one property file per language (or locale) and use a dynamic way off resolving which one to load depending on the context. (e.g. Language HTTP header the browser sends). It is arguably more flexible than providing 1 jsp file per language, and can still deal with complex cases where plurals or stylistic differences might change the way you write localized text. This is a standard JDK feature, lookup resource bundles. You do not have to build 1 file per jsp (maybe your framework works this way?), although doing so can help the person writing the translation.

http://stackoverflow.com/q/24836561
has comment: http://stackoverflow.com/comment/38561579
tagged with: element
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38561661
answer count: 0
tagged with: java
tagged with: set
has body: I am making a poker game and to generate a hand that contains non-duplicated I decided to use a HashSet and for-loop to give the player 5 cards. public class CardDriver { public static void main(String[] args) { Set&lt;Card&gt; hands = new HashSet&lt;Card&gt;(); while(hands.size()!= 5) { hands.add(new Card()); } System.out.println("Player 1: " + hands); } } The Card constructor: public Card() { Random nb = new Random(); int switchNb = nb.nextInt(13) + 1; switch(switchNb) { case 1: value = Value.Ace; break; case 2: value = Value.Two; break; .... case 11: value = Value.Jack; break; case 12: value = Value.Queen; break; case 13: value = Value.King; break; } switchNb = nb.nextInt(4) + 1; switch(switchNb) { case 1: suite = Suite.Hearts; break; case 2: suite = Suite.Diamonds; break; case 3: suite = Suite.Clubs; break; case 4: suite = Suite.Spades; break; } } I am faced with three problems and I believe that both can be solved once I figure out how to isolate certain elements (if it is even possible) from the player's hand. First off I need to use the same HashSet to give 5 more cards to the second player and so on. For example I would have elements 1-5 of the Set go to player 1 and 6-10 go to player 2. Also, by being able to isolate a card from the set, it would also enable me to replace a card (video poker). Lastly, I figured that by being able to isolate each card in the user's hand, it would make it easier for me to analyze the value of the hand each player has. I am not very experience when it comes to using sets so perhaps it would be better to use an array? Edit: Example of an output: Player 1: [Three of Hearts, King of Clubs, Ten of Clubs, Two of Spades, Ace of Hearts]
has comment: http://stackoverflow.com/comment/38561604
has comment: http://stackoverflow.com/comment/38561608
type: Question
has comment: http://stackoverflow.com/comment/38561612
tagged with: poker
has title: Isoltating a certain element in a HashSet in Java
score: 0
has comment: http://stackoverflow.com/comment/38562567

http://stackoverflow.com/comment/38626251
comment on: http://stackoverflow.com/q/24870004
type: QuestionComment
score: 0
has text: could you provide us with what exactly you are doing in your code that causes the exception??
type: Comment

http://stackoverflow.com/comment/38576112
comment on: http://stackoverflow.com/a/24844162
type: Comment
score: 1
type: AnswerComment
has text: This is Netty 5 since it the version currently being developed

http://stackoverflow.com/comment/38626246
has text: ahh good to know. I read up some more and found that the added input is for key access: https://gwt.googlesource.com/gwt/+/master/user/src/com/google/gwt/user/client/ui/impl/FocusImplStandard.java My use case doesn't need it so I'll stick with addDomHandler for now. Cheers!
type: AnswerComment
comment on: http://stackoverflow.com/a/24793410
score: 0
type: Comment

http://stackoverflow.com/a/24868096
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24867896
answers question: http://stackoverflow.com/q/24867896
downvote count: 0
has body: Thanks to the comment of Hank Lapidez, adding the following statement fixes the problem: @Configuration @PropertySource("classpath:appdefault.properties") public CommonConfig { @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } }
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/24796961
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24797241
has comment: http://stackoverflow.com/comment/38487372
type: UnansweredQuestion
tagged with: android
has body: I'm instantiating a View at runtime, and 99,99% of the times works, but some users have reported that it crashes throwing a NoSuchMethodError. I'm instantiating the View like this, and that's where the Error is thrown: AddAPostView addAPostView = new AddAPostView(getContext()); And that's the code for the View: public class AddAPostView extends LinearLayout { public AddAPostView(Context context) { super(context); init(); } public AddAPostView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public AddAPostView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init() { ... } } I've got the report through Google Analyics, so I only have the line in which the error is generated. How is it possible that sometimes a code simple like that throws such a drastic Error? How to avoid that?
has answer: http://stackoverflow.com/a/24797221
score: 1
has title: NoSuchMethodError on VIew constructor
upvote count: 1
has comment: http://stackoverflow.com/comment/38487453
type: Question
has comment: http://stackoverflow.com/comment/38487676
tagged with: java
answer count: 2

http://stackoverflow.com/comment/38555648
has text: my Suggestion to you is use : Client Side : AsyncTask which sends Data to the Server and Close the Connection by its own and lets you write code to the UI Thread if needed. i need to see the Logcat on either sides to see what is your null Exception and correct the problem
comment on: http://stackoverflow.com/q/24832887
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38506785
type: Comment
has text: @TimPietzcker try `System.out.println("1.2foo".matches(regex));` return `false`
comment on: http://stackoverflow.com/a/24807272
score: 0
type: AnswerComment

http://stackoverflow.com/a/24837522
type: Answer
answers question: http://stackoverflow.com/q/24835316
score: 4
has body: This question is too broad because it doesn't specify what exactly doesn't work. I'll try to provide a couple of observations You might want to try running the jnlp file "locally" with "javaws" that should reside in the jdk, maybe the jnlp syntax is just wrong. More details can be found Here Alternatively, maybe its some network issue. Next possible reason that jnlp as you wrote it just not supported by the particular version of jdk. I remember in jdk 1.6.10 jnlp just didn't work, so an upgrade to a newer version has effectively solved the problem. Hope this helps
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/70129378

http://stackoverflow.com/comment/73446361
has text: @IgorDonin say that to Java community who loves sniffing and crawling semantics from variable/class/function names... all the time, everywhere.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/40759204

http://stackoverflow.com/comment/69368689
has text: @JonathanLeffler it all depends upon the user. How they want to have an interpretation of the json. Well for the JSON I here goes another sample ::
type: Comment
comment on: http://stackoverflow.com/a/41080726
score: 0
type: AnswerComment

http://stackoverflow.com/q/24815431
has title: Spark integrated with Hadoop InputFormat confusion
has body: I am currently trying to use custom InputSplit and RecordReader with Apache Spark's SparkContext hadoopRDD() function. My question is the following: Does the value returned by InpuSplit.getLenght() and/or RecordReader.getProgress() affect the execution of a map() function in the Spark Runtime? I am asking because I have used these two custom classes on Apache Hadoop and they work as intended. However, in Spark, I see that new InputSplit objects are generated during Runtime, which is something I do not want my code to do. To be more precise: In the beginning of the execution, I see in my log files that the correct number of InputSplit objects are generated (let us say only 1 for this example). In turn, a RecordReader object associated to that split, is generated and starts fetching records. At some point, I get a message that the Job that is handling the previous InputSplit stops, and a new Job is spawned with a new InputSplit. I do not understand why this is happening? Does it have to do with the value returned by RecordReader.getProgress() method or InputSplit.getLength() method? Also, I define the InputSplit's length to be some arbitrary large number of bytes (i.e. 1GB). Does this value affect the number of Spark Jobs that are spawned during Runtime? Any help and/or advice is welcome? Thank you, Nick P.S.-1 : I apologize for posting so many questions, but Apache Spark is a new Tool with little documentation on the Hadoop-Spark integration through HadoopRDDs. P.S.-2: I can provide more technical details if they are needed.
accepted answer: http://stackoverflow.com/a/28756431
type: AnsweredQuestion
score: 0
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/28756431
tagged with: hadoop
tagged with: apache-spark
answer count: 1

http://stackoverflow.com/q/24796273
favorite count: 0
has answer: http://stackoverflow.com/a/24796340
score: 52
has answer: http://stackoverflow.com/a/24796365
has title: Incompatible types List of List and ArrayList of ArrayList
possible better answer: http://stackoverflow.com/a/24855404
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/71366817
tagged with: java
tagged with: incomplete-type
type: Question
has answer: http://stackoverflow.com/a/24796474
downvote count: 0
has answer: http://stackoverflow.com/a/24796410
accepted answer: http://stackoverflow.com/a/24796340
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38486078
has answer: http://stackoverflow.com/a/24855404
has body: The below line gives me error : Incompatible Types. List&lt;List&lt;Integer&gt;&gt; output = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); What is the reason? EDIT I understand if I change my second ArrayList to List, it does not give me error. I want to know the reason of error though. Thanks
upvote count: 52
has answer: http://stackoverflow.com/a/51200844
answer count: 7

http://stackoverflow.com/comment/38689102
type: Comment
has text: If you think you can write a better sorting algorithm than the Java developers, you are probably mistaken. If your timing measurements suggest you have done so, your timing measurements are probably wrong.
score: 0
comment on: http://stackoverflow.com/q/24900629
type: QuestionComment

http://stackoverflow.com/comment/38697772
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24908020
type: QuestionComment
has text: Your fix is very complicated, even your C solution is very complicated for a simple task.

http://stackoverflow.com/comment/38525981
score: 5
type: Comment
has text: What error you are getting? Have you added internet permission in your manifest file?
type: QuestionComment
comment on: http://stackoverflow.com/q/24817637

http://stackoverflow.com/q/24797911
type: Question
accepted answer: http://stackoverflow.com/a/24806253
has comment: http://stackoverflow.com/comment/38492200
tagged with: jqgrid
tagged with: jquery
tagged with: struts2
answer count: 1
downvote count: 0
tagged with: jsp
has title: Get selected value in the formatter of select in Struts 2 jQuery grid
favorite count: 0
has answer: http://stackoverflow.com/a/24806253
has body: This is my Struts 2 grid column: <sjg:gridColumn name="interview_notif" index="interview_notif" title="Interview Notification" editable="true" sortable="false" formatter="IntrvNot"/> And this is the formatter I have used: function IntrvNot(value, options, rowObject){ var radioHtml = ' Yes No '; return radioHtml; The formatter creates a select with two options but it does not select the one which is in the array. How do set the selected value to that in the database(array) when the grid populates?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38495079

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/24844982
tag name: dayofweek

http://stackoverflow.com/q/24822228
tagged with: java
has comment: http://stackoverflow.com/comment/38551774
has title: Error deploying EAR in JBoss AS 7.1build using ANT
upvote count: 1
has body: I am having a problem with deploying my application on JBoss AS 7.1 . We are now migrating from JBoss AS 4 to JBoss AS 7.1 but facing trouble due to different module structure of JBoss AS 7.1 . While deploying our EAR in standalone mode of JBoss AS 7.1 we get below error log. Please suggest what we are doing wrong.. I am copying server log below. 15:12:24,868 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.subunit."Shrisurance.ear"."Shrisurance.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Shrisurance.ear"."Shrisurance.war".POST_MODULE: Failed to process phase POST_MODULE of subdeployment "Shrisurance.war" of deployment "Shrisurance.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25] Caused by: java.lang.RuntimeException: Error getting reflective information for class com.shrisure.server.OnlinePolicyRedirectURL with ClassLoader ModuleClassLoader for Module "deployment.Shrisurance.ear.Shrisurance.jar:main" from Service Module Loader at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58) at org.jboss.as.ee.component.…
type: Question
tagged with: ant
tagged with: jboss
downvote count: 0
tagged with: jboss7.x
favorite count: 0
has comment: http://stackoverflow.com/comment/38598790
type: UnansweredQuestion
tagged with: deployment
has comment: http://stackoverflow.com/comment/38562030
answer count: 0
score: 1

regex
tags question: http://stackoverflow.com/q/24875762
tags question: http://stackoverflow.com/q/24750240
tags question: http://stackoverflow.com/q/24767693
tags question: http://stackoverflow.com/q/24766605
tags question: http://stackoverflow.com/q/24807294
tags question: http://stackoverflow.com/q/24790553
tags question: http://stackoverflow.com/q/24785315
tags question: http://stackoverflow.com/q/24894123
tags question: http://stackoverflow.com/q/24894828
tags question: http://stackoverflow.com/q/24887691
tags question: http://stackoverflow.com/q/24908793
tags question: http://stackoverflow.com/q/24864042
tag name: regex
tags question: http://stackoverflow.com/q/24833727
tags question: http://stackoverflow.com/q/24822849
tags question: http://stackoverflow.com/q/24812381
tags question: http://stackoverflow.com/q/24870939
tags question: http://stackoverflow.com/q/24761031
tags question: http://stackoverflow.com/q/24763357
tags question: http://stackoverflow.com/q/24860120
tags question: http://stackoverflow.com/q/24829018
tags question: http://stackoverflow.com/q/24759421
tags question: http://stackoverflow.com/q/24815130
tags question: http://stackoverflow.com/q/24812590
tags question: http://stackoverflow.com/q/24752917
tags question: http://stackoverflow.com/q/24760057
tags question: http://stackoverflow.com/q/24833364
tags question: http://stackoverflow.com/q/24812770
tags question: http://stackoverflow.com/q/24752681
tags question: http://stackoverflow.com/q/24854977
tags question: http://stackoverflow.com/q/24811531
tags question: http://stackoverflow.com/q/24801426
tags question: http://stackoverflow.com/q/24865347
tags question: http://stackoverflow.com/q/24794086
tags question: http://stackoverflow.com/q/24772860
tags question: http://stackoverflow.com/q/24845141
tags question: http://stackoverflow.com/q/24820538
tags question: http://stackoverflow.com/q/24881240
tags question: http://stackoverflow.com/q/24899825
tags question: http://stackoverflow.com/q/24840667
tags question: http://stackoverflow.com/q/24759351
tags question: http://stackoverflow.com/q/24787808
tags question: http://stackoverflow.com/q/24831140
tags question: http://stackoverflow.com/q/24790856
tags question: http://stackoverflow.com/q/24868130
tags question: http://stackoverflow.com/q/24790433
tags question: http://stackoverflow.com/q/24783686
tags question: http://stackoverflow.com/q/24807234
tags question: http://stackoverflow.com/q/24774757
tags question: http://stackoverflow.com/q/24781885
tags question: http://stackoverflow.com/q/24828083
tags question: http://stackoverflow.com/q/24813430
tags question: http://stackoverflow.com/q/24813941
tags question: http://stackoverflow.com/q/24755622
tags question: http://stackoverflow.com/q/24836588
tags question: http://stackoverflow.com/q/24815523
tags question: http://stackoverflow.com/q/24874404
tags question: http://stackoverflow.com/q/24783844
tags question: http://stackoverflow.com/q/24768152
tags question: http://stackoverflow.com/q/24795817
tags question: http://stackoverflow.com/q/24899788
tags question: http://stackoverflow.com/q/24780016
tags question: http://stackoverflow.com/q/24784391
tags question: http://stackoverflow.com/q/24838842
tags question: http://stackoverflow.com/q/24873663
tags question: http://stackoverflow.com/q/24840309
tags question: http://stackoverflow.com/q/24863261
tags question: http://stackoverflow.com/q/24894458
tags question: http://stackoverflow.com/q/24797857
tags question: http://stackoverflow.com/q/24856346
tags question: http://stackoverflow.com/q/24784707
tags question: http://stackoverflow.com/q/24836671
tags question: http://stackoverflow.com/q/24890116
tags question: http://stackoverflow.com/q/24808793
tags question: http://stackoverflow.com/q/24873879
type: Tag
tags question: http://stackoverflow.com/q/24839570
tags question: http://stackoverflow.com/q/24839057

http://stackoverflow.com/q/24902931
has title: Unable to read Unix server path for resource property Spring Batch
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24915123
tagged with: unix
tagged with: java
type: Question
has body: Please help on configuring the resource path for unix location path in SPRING batch. Its working fine when tried in Windows machine. Property configured in properties file. location=//home/dir/file.txt XML Configuration: Error: Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode): class path resource [//home/dir/file.txt] at org.springframework.batch.item.file.FlatFileItemReader.doOpen(FlatFileItemReader.java:250) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:134) ... 15 more
has comment: http://stackoverflow.com/comment/38691001
score: 0
answer count: 1
tagged with: spring-batch

http://stackoverflow.com/a/24817647
has comment: http://stackoverflow.com/comment/38526159
answers question: http://stackoverflow.com/q/24817541
score: 0
has comment: http://stackoverflow.com/comment/38526259
type: Answer
has body: You could create a field and a setter in your GUI class for Inventory. Then, in your main after instantiating your inventory, you can just call mainGUI.setInv(inv) and your GUI Class has access to the inventory.

http://stackoverflow.com/q/24837405
linked to: http://stackoverflow.com/q/1050991
tagged with: global-state
type: Question
accepted answer: http://stackoverflow.com/a/24838390
score: 0
tagged with: singleton
has comment: http://stackoverflow.com/comment/38583515
answer count: 1
has comment: http://stackoverflow.com/comment/38563109
has title: Alternative To Singleton Util Class
has body: So I have a class like so: public class HBaseUtil { private final String fileName = "hbase.properties"; private Configuration config; private HBaseUtil() { try { config = new PropertiesConfiguration(fileName); } catch (ConfigurationException e) { // some exception handling logging } } // now some getters pulling data out of the config object public static String getProperty(String fieldKeyName) {...} public static String getColumnFamily(String fieldName) {...} // ... some more getters // NO setters (thus making this a read-only class) } Thus, basically I have for myself a Singleton class, that the very first time that it is put to use, sets up a configuration object, and then simply keeps listening for get calls. There are a number of problems with this class: Unit testing the static methods within class HBaseUtil becomes difficult because of a tight-knit coupling between the Singleton and the configurations file. What I really want is me being able to supply the filename/filename+path to the class so that it can go in there, read the configuration properties from that file and offer them to incoming read requests. One important note here though: I need this flexibility in specifying the properties file ONLY ONCE per JVM launch. So I certainly don't need to maintain state. Here is what I was able to come up with: Instead of a Singleton, I have a normal class with all static methods and no explicit constructor defined. public class HBaseUtil { // directly start with getters public static String getProperty(Configuration config, String fieldKeyName) {...} public static String getColumnFamily(Configuration config, String fieldKeyName) {...} // ...and so on } And then, instead of using the class in my other code like such: HBaseUtil.getProperty(String fieldKeyName) I'd use it like so: Configuration externalConfig = new PropertiesConfiguration("my-custom-hbase.properties"); HbaseUtil.getProperty(externalConfig, fieldKeyName) My questions: Am I even thinking in the right …
has answer: http://stackoverflow.com/a/24838390
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/38582524
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38563292
tagged with: java

http://stackoverflow.com/a/24864357
type: Answer
score: 3
has body: Having a string literal on left-hand side of expression will not generate the NullPointerException. if(a !=null &amp;&amp; a.equals("value")) you can replace with if("value".equals(a)). PS Having the constant on the left-hand side is cleaner approach as prevent from making errors. It is can be called as yoda condition.
has comment: http://stackoverflow.com/comment/38614538
has comment: http://stackoverflow.com/comment/38614301
upvote count: 3
answers question: http://stackoverflow.com/q/24864291
downvote count: 0

http://stackoverflow.com/comment/38528253
type: Comment
has text: Try `?` instead of `?1`. That is almost the only change w.r.t. your mysql manual test. Though I had my doubt on `as count` reusing a function name.
comment on: http://stackoverflow.com/q/24818764
score: 0
type: QuestionComment

http://stackoverflow.com/q/24840414
type: Question
has answer: http://stackoverflow.com/a/25919395
answer count: 6
tagged with: eclipse
has answer: http://stackoverflow.com/a/33161116
tagged with: javafx-8
has answer: http://stackoverflow.com/a/51341069
has body: I created an app with JavaFx for windows, which is really cool. I can run it from e(fx)clipse, everthing works fine, but I can't make a jar file from the project. I can export it (Right click->Export->Runnable Jar File). However, if I run the jar on MAC OS X , in the menu bar I get "java" menuitem instead of my application name ,which i really don't like. I searched for how to hide that menuitem, or just rename it, and I found that I have to rename the "Application title*" in the build.fxbuild file. Now I can't build it. So this is what I really want: to remove/hide/rename the "java" menuitem in Mac OS X. If you have any experience, please share it with me. I will be really grateful :) . I get the following error when I try to run the build.xml file: [javac] Compiling 22 source files to C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build\classes [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7 [javac] Note: C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build\src\application\SajátKészlet.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 1 warning [copy] Copying 12 files to C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build\classesinit -fx-tasks: [taskdef] Could not load definitions from resource com/sun/javafx/tools/ant/antlib.xml. It could not be found. do-deploy: [copy] Copying 20 files to C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\dist\libs BUILD FAILED C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build.xml:217: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:resources Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any &lt;presetdef&gt;/&lt;macrodef&gt; declarations have taken place. No types or tasks have been defined in this namespace yet Total time: 22 seconds ** I use…
has answer: http://stackoverflow.com/a/53045007
downvote count: 0
tagged with: macos
has answer: http://stackoverflow.com/a/35123518
has title: JAVAFx Build Failed
favorite count: 0
has answer: http://stackoverflow.com/a/28645609
type: UnansweredQuestion
tagged with: build
score: 7
tagged with: java
upvote count: 7

http://stackoverflow.com/comment/38648651
comment on: http://stackoverflow.com/q/24882250
has text: Which line is `ListViewAdapter.java:151`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38647495
has text: possible duplicate of [How to rerun the failed scenarios using Cucumber?](http://stackoverflow.com/questions/11719898/how-to-rerun-the-failed-scenarios-using-cucumber)
comment on: http://stackoverflow.com/q/24841335
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38695757
has text: as he need to check on auditAccount which is the child object of AuditRecordEntity as he mentioned in his question auditRecord.auditAccount.accountId
comment on: http://stackoverflow.com/a/24907270
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38663308
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24885976
has text: I can't remove it from deparments list since this property it is not initialized (FetchType is set to LAZY and I didn't fetched deparments collection manually).

executorservice
type: Tag
tags question: http://stackoverflow.com/q/24785800
tag name: executorservice
tags question: http://stackoverflow.com/q/24854811
tags question: http://stackoverflow.com/q/24817506

http://stackoverflow.com/a/51411523
answers question: http://stackoverflow.com/q/24762657
has body: You have two possebilities how to serve static webcontent From the classpath (per default src/main/resources/static or src/main/resources/public or META-INF/resources/) From the file system (per default src/main/webapp) If you pick solution 1) - you can safely copy the jar around as the static web content is within that jar. If you want that the server picks up changes, you need to do (auto)hotswapping. If you pick solution 2) - everything will work out of the box, every change will be automatically picked up. HOWEVER - if you copy the final jar to a different location - things will stop working. That is unless you specify an absolute path in application.properties. For example: spring.resources.static-locations=file:///C:/myspringbootapp/src/main/webapp So solution 2) is easier but less portable. Solution 1) is portable but more difficult to use(ide config).
type: Answer
score: 0

http://stackoverflow.com/comment/38564120
type: QuestionComment
has text: Can't you reduce this mass of code to the essentials? Is your question "How can I read a text file?" or "How can I use the data I've read from a text file?" In the latter case, I'm afraid that *you* are the one that has to call the shot!
score: 2
comment on: http://stackoverflow.com/q/24837919
type: Comment

http://stackoverflow.com/q/24799067
has comment: http://stackoverflow.com/comment/38491296
has answer: http://stackoverflow.com/a/24799285
possible better answer: http://stackoverflow.com/a/24799208
has comment: http://stackoverflow.com/comment/38492570
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38491391
downvote count: 0
score: 1
tagged with: string
tagged with: android-activity
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/24799421
has body: I tried this code but it splits based on country code. String phone ="1234567891"; String formattedNumber = PhoneNumberUtils.formatNumber(phone); but this displays as 123-456-7891 I want to displayed like this: 123.456.7891 How can I do this?
accepted answer: http://stackoverflow.com/a/24799285
tagged with: java
has comment: http://stackoverflow.com/comment/38491459
upvote count: 1
answer count: 4
has title: How to display a number with dot at third and next third and next fourth digit for a 10 digit number?
has answer: http://stackoverflow.com/a/24799600
has answer: http://stackoverflow.com/a/24799208

http://stackoverflow.com/q/24803595
favorite count: 0
has comment: http://stackoverflow.com/comment/38505341
tagged with: serialization
has comment: http://stackoverflow.com/comment/38564601
has answer: http://stackoverflow.com/a/24837911
has comment: http://stackoverflow.com/comment/38503857
upvote count: 2
accepted answer: http://stackoverflow.com/a/24837911
type: Question
tagged with: object
score: 2
type: AnsweredQuestion
has body: It seems a little bit strange to me. I have two classes communicating via RMI. If I transfer an object graph with RMI on the producing system, then at the destination some data is missing. To analyse this deeper I serialized the object graph to the disc before returning this over RMI to the caller. On the caller side I wrote the returned object to the disc too. Both files differ in size. Transferring them back to an object graph with a small helper I recognize that some objects are missing after the data was transmitted to the caller on the caller's side. Honestly I find this quite strange and I do not have a clue what is going on. Since the same thing is working on my developer machine. I expected a SerializationException, but none was thrown. I am lost ;-(. I expected if a object serialization to disc works it works for RMI too. Does anyone knows a first step to debug this behaviour?
tagged with: rmi
tagged with: java
answer count: 1
downvote count: 0
tagged with: deserialization
has comment: http://stackoverflow.com/comment/38504945
has title: Is there are difference between RMI and plain object serialization?

http://stackoverflow.com/q/24883761
type: Question
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/24883855
favorite count: 0
has answer: http://stackoverflow.com/a/24883855
answer count: 3
accepted answer: http://stackoverflow.com/a/24883925
tagged with: reference
upvote count: 1
has answer: http://stackoverflow.com/a/24883862
type: AnsweredQuestion
has body: public class ReferenceTest { public static void main(String[] args) { String[][] names = {{"George","Hampton"},{"Marc", "Empten"},{"Levin", "Lian"}}; Object oneperson; //Reference to one object of the 2D Array oneperson = names[1]; //Output should be Marc Empten System.out.println(oneperson.toString()); //[Ljava.lang.String;@11890d } } Is it possible to create such a reference in java? So I can save an array-element( {"Marc","Empten"} ) from the array? So I can use only the oneperson variable to give out the "Marc Empten"? I have no Idea how to realise this. Is it even possible?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24883925
has title: Reference on an 2D-Array-Element

http://stackoverflow.com/q/24771153
has answer: http://stackoverflow.com/a/24794294
has comment: http://stackoverflow.com/comment/38440451
tagged with: android
tagged with: opengl-es
has title: Rendering a triangle using OpenGL ES 3.0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38440083
tagged with: java
has answer: http://stackoverflow.com/a/24773434
type: Question
has body: I'm having trouble getting a triangle to render on an Android device using OpenGL ES 3.0. I'm using Google Nexus 5 for testing. Below is my code - but all it renders is a blue screen (which is the clear color I have specified). I expect to see a red triangle but it isn't appearing. Can someone please point out the flaw in my code? The shaders compile and link successfully. public class MainActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(new TestSurfaceView(this)); } public boolean onCreateOptionsMenu(Menu menu) { return false; } public boolean onOptionsItemSelected(MenuItem item) { return false; } private class TestSurfaceView extends GLSurfaceView implements Renderer { private final String vertexShaderCode = "#version 300 es\n\n"+ "in vec3 inPosition;\n" + "void main()\n" + "{\n" + " gl_Position = vec4(inPosition.xyz, 1.0);\n" + "} \n"; private final String fragmentShaderCode = "#version 300 es\n\n"+ "out vec4 outColor;\n"+ "void main()\n" + "{\n" + " outColor = vec4(1.0, 0.0, 0.0, 1.0); \n" + "} \n"; public TestSurfaceView(Context context) { super(context); super.setEGLConfigChooser(8, 8, 8, 8, 16, 0); setEGLContextClientVersion(3); setRenderer(this); setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); } public void onDrawFrame(GL10 gl) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glDrawArraysInstanced(GL_TRIANGLES, 0, 3, 1); } public void onSurfaceChanged(GL10 gl, int width, int height) { glViewport(0, 0, width, height); } public void onSurfaceCreated(GL10 gl, EGLConfig config) { // States glClearColor(0f, 0f, 1f, 0f); // Set background to blue glEnable(GL_DEPTH_TEST); // Enable Depth Testing glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do //TODO check glEnable(GL_BLEND); // Enable Blending glBlendFunc(GL_S…
score: 0
answer count: 2

http://stackoverflow.com/q/24900472
tagged with: apk-expansion-files
has comment: http://stackoverflow.com/comment/38683198
has body: i am working on a Wikipedia app in which users will download the database .zim file as apk expansion. first i created a sample of apkexpansiontest apk and i uploaded to the google play and its start working by opening the app the download will start and will complete then. now i came accross the problem that when i apply these expansion codes to my orignal app(Wikipedia) app and when i launched my app and now launching there is no download but the download page show me pause download message and no download or other message come.. when i select database download from menu option of my app and then nothing happens no download or no other validation or finding resources message.
type: UnansweredQuestion
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/38683224
score: 1
favorite count: 0
has title: download is not starting for apk expansion file
has comment: http://stackoverflow.com/comment/38683140
type: Question
tagged with: android
tagged with: java
upvote count: 1
tagged with: eclipse

http://stackoverflow.com/a/24894681
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24885551
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24885551
has body: Using Guava: public static final void main(final String... args) { final Map&lt;String, Integer&gt; map1 = ImmutableMap.of("key0", 2, "key1", 3); final Map&lt;String, Integer&gt; map2 = ImmutableMap.of("key0", 2, "key1", 3, "key2", 3); final Map&lt;String, Integer&gt; transformed = Maps.transformEntries(map1, new EntryTransformer&lt;String, Integer, Integer&gt;() { @Override public Integer transformEntry(final String key, final Integer value) { return map2.get(key) * value; } }); //result {key0=4, key1=9} System.out.println(transformed); }

http://stackoverflow.com/q/24814734
downvote count: 0
tagged with: public-key-encryption
favorite count: 0
score: 2
has body: So I have a PublicKey in Java, and I need to send a post request to the server with the key in it, then read the key server side, and send some data encrypted with it! I succeeded at: Generating the keypair (duh) Encrypting and decrypting data with it in the Java program Maybe: making a pem formatted key from it, I'm not sure String phpPublic = (&quot;-----BEGIN PUBLIC KEY-----&quot;+Base64.encodeToString(MainActivity.instance.rsa.readPublicKeyFromFile(MainActivity.instance.rsa.PUBLIC_CLIENT_KEY_FILE).getEncoded(),Base64.DEFAULT)+&quot;-----END PUBLIC KEY-----&quot;); I think this does it, but I'm not sure! And would it be the same process to convert private keys to pem, just to make PUBLIC -&gt; PRIVATE in the header and footer. I don't know if converting to pem is really necessary, if it's not, please suggest a better way to do it. This is how I do it in PHP, but I'm 99% sure it is wrong $PubKey = openssl_pkey_get_public($publicPem); $encrypted; openssl_public_encrypt($toEncode, $encrypted, $PubKey); echo $encrypted;
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
has answer: http://stackoverflow.com/a/24832334
tagged with: php
has comment: http://stackoverflow.com/comment/38542885
tagged with: java
tagged with: rsa
type: Question
has title: Java send PublicKey to PHP and encrypt data
has comment: http://stackoverflow.com/comment/38525243
answer count: 1

http://stackoverflow.com/comment/38639622
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24877347
score: 0
has text: What IDE are you using?

http://stackoverflow.com/q/24753177
has answer: http://stackoverflow.com/a/24753320
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/38404452
has answer: http://stackoverflow.com/a/24753258
has answer: http://stackoverflow.com/a/55679266
has comment: http://stackoverflow.com/comment/38404753
has answer: http://stackoverflow.com/a/24753449
answer count: 10
has comment: http://stackoverflow.com/comment/38404538
favorite count: 0
linked to: http://stackoverflow.com/q/14833008
has body: Trying to split a double number into two decimal parts by dot. Like this: 1.9 into 1 and 9; 0.16 into 0 and 16; Here's what I do, but seems a little redundant, what's the best way to do this? The origin number will always be like Just 0.x or 1.x or 0.xx or 1.xx and xx > 10 double d = 1.9; int a, b; String dString = Double.toString(d); String aString = dString.substring(0, 1); String bString = dString.substring(2); a = Integer.parseInt(aString); b = Integer.parseInt(bString); My way of doing this seems using to much String conversion,which I don't think is very efficient.
has answer: http://stackoverflow.com/a/24753336
has answer: http://stackoverflow.com/a/24753865
has answer: http://stackoverflow.com/a/46959989
has answer: http://stackoverflow.com/a/24753306
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24753412
tagged with: java
possible better answer: http://stackoverflow.com/a/24753370
has title: How to split a double number by dot into two decimal numbers in Java?
has comment: http://stackoverflow.com/comment/38404502
has comment: http://stackoverflow.com/comment/38404411
has answer: http://stackoverflow.com/a/24753370
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24753336

http://stackoverflow.com/q/24895690
tagged with: java
tagged with: counter
type: Question
score: 0
has title: starting my countdown clock when activity is open
has answer: http://stackoverflow.com/a/25106164
answer count: 1
has body: I am a bit of a keen novice at Android! I have a snippet of code for timer I want to use in my app however it works when the button is clicked and I want it to work when I open the activity that it is on. I have tried so many solutions but cannot get it to operate. Would really appreciate any help, I have tried putting an if statement in, I have tried using the onStart, and putting it the OnCreate all with no joy. The closest I can get is that it just starts with "Time Up!" in the field. import android.app.Activity; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { Button buttonStartTime; TextView textViewShowTime; CountDownTimer countDownTimer; long totalTimeCountInMilliseconds; long timeBlinkInMilliseconds; boolean blink; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getReferenceOfViews (); setActionListeners (); totalTimeCountInMilliseconds = 60 * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void setActionListeners() { buttonStartTime.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { textViewShowTime.setTextAppearance(getApplicationContext(), R.style.normalText); countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { @Override public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; if ( leftTimeInMilliseconds &lt; timeBlinkInMilliseconds ) { textViewShowTime.setTextAppearance(getApplicationContext(), R.style.blinkText); if ( blink ) { textViewShowTime.setVisibility(View.VISIBLE); } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); } @Override public void onFinish() textViewShowTime.setText("Time up!"…
has comment: http://stackoverflow.com/comment/39279521
tagged with: android
type: UnansweredQuestion
tagged with: countdowntimer
has comment: http://stackoverflow.com/comment/39069579
has comment: http://stackoverflow.com/comment/38674274
tagged with: oncreate

http://stackoverflow.com/comment/38608250
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24860874
has text: @DThought OP's issue is that the rest of the system becomes unresponsive. So yes, he wants to *throttle* the processing intensity.
score: 0

http://stackoverflow.com/comment/38660398
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24877814
score: 0
has text: Thanks, I'll try the solution. But I would like to better undertand why this happens on unidirectional relationship, but does not happen if I make it bidirectional. Would this be Hibernate specific or would be the same on all JPA implementations? And how `if ( this == obj ) return true;` would fail if the two references are bound to the same EntityManager (same transaction)?

http://stackoverflow.com/comment/38555269
type: Comment
has text: oh, sorry. I read your question again, and I was completely wrong. I misread it.
comment on: http://stackoverflow.com/a/24832986
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38526746
comment on: http://stackoverflow.com/a/24817392
score: 0
type: AnswerComment
type: Comment
has text: i still don't understand! there is so much code already i am getting everything mixed up :(

http://stackoverflow.com/q/24806922
tagged with: java
score: -1
tagged with: broadcastreceiver
has body: I want to detect the switch of GPS. My idea is to use IntentService and Broadcast intent. My service is running but my broadcast receiver doesn't work. I just wanna say to my HomeActivity if GPS is turn on/off by user. With this info, i will able to set up my GoogleMap with the current location. Thx ! GpsService.java : public class GpsService extends IntentService implements LocationListener { private final static String TAG = "com.example.smartoo.gpsservice"; public GpsService () { super(TAG); Log.e("TAG", "GPS service k"); } @Override public void onLocationChanged(Location location) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { if (LocationManager.GPS_PROVIDER.equals(provider)) { Intent i = new Intent("android.location.PROVIDERS_CHANGED"); i.putExtra("enabled", 1); sendBroadcast(i); } } @Override public void onProviderDisabled(String provider) { if (LocationManager.GPS_PROVIDER.equals(provider)) { Intent i = new Intent("android.location.PROVIDERS_CHANGED"); i.putExtra("disnabled", 1); sendBroadcast(i); } } @Override protected void onHandleIntent(Intent intent) { } } HomeActivity.java public class HomeActivity extends ActionBarActivity implements LocationListener, GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener { //My attrs private GoogleMap mMap = null; Location currentLocation; /* * Initialize the Activity */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_layout); //Get the map from xml file mMap = getMap(); Intent i = new Intent(HomeActivity.this, GpsService.class); startService(i); } /* * Called when the Activity is restarted, even before it becomes visible. */ @Override public void onStart() { super.onStart(); final LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); //Check if GPS …
answer count: 1
has comment: http://stackoverflow.com/comment/38507287
favorite count: 0
has comment: http://stackoverflow.com/comment/38506728
has answer: http://stackoverflow.com/a/24808597
accepted answer: http://stackoverflow.com/a/24808597
tagged with: android
has title: Service with Broadcast to say if GPS is enabled
type: AnsweredQuestion
upvote count: 0
tagged with: android-intentservice
has comment: http://stackoverflow.com/comment/38508037
has comment: http://stackoverflow.com/comment/38507657
has comment: http://stackoverflow.com/comment/38506343
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38507217

http://stackoverflow.com/q/24824936
tagged with: maven
answer count: 0
score: 0
tagged with: java
tagged with: m2e
tagged with: eclipse
type: Question
has body: I am having Maven managed Java project in Eclipse (using the built in Maven integration of Eclipse Kepler/Luna). I observed that sometimes a Java component which is a dependency to another one is not found at runtime. This sometimes could be resolved by removing the project form Eclipse, deleting the .settings, .classpath and .projectfiles and reimport it to Eclipse. I would expect that a simple Maven -&gt; Update did the same but it does not. Is this a known behaviour?
has comment: http://stackoverflow.com/comment/38540367
has comment: http://stackoverflow.com/comment/38542473
has title: Eclipse Maven Update does not completely regenerate Eclipse project files
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38539395

http://stackoverflow.com/comment/38553231
comment on: http://stackoverflow.com/q/24831857
score: 0
type: Comment
type: QuestionComment
has text: If that's all your code, I'm willing to bet you're getting a NullPointerException in your onCreate method when calling calculate_button.setOnClickListener, since it doesn't look like you've ever initialized that variable in either of your Activities.

http://stackoverflow.com/comment/38593643
type: QuestionComment
has text: I think you at least know the basics of how floating point numbers are internally represented in the various representations. Otherwise you may introduce bugs in your program simply by treating them incorrectly. (compare to zero directly, expect unrealistic high accuracy etc)
comment on: http://stackoverflow.com/q/24853428
score: 0
type: Comment

http://stackoverflow.com/q/24902301
has answer: http://stackoverflow.com/a/37669121
upvote count: 23
has answer: http://stackoverflow.com/a/24935519
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31295088
tagged with: java
score: 23
type: Question
tagged with: apache-kafka
has answer: http://stackoverflow.com/a/45025669
has title: How to get topic list from kafka server in Java
accepted answer: http://stackoverflow.com/a/24935519
answer count: 6
possible better answer: http://stackoverflow.com/a/35045852
downvote count: 0
has answer: http://stackoverflow.com/a/35045852
has comment: http://stackoverflow.com/comment/38707562
favorite count: 0
has answer: http://stackoverflow.com/a/35095810
has body: I am using kafka 0.8 version and very much new to it. I want to know the list of topics created in kafka server along with it's metadata. Is there any API available to find out this? Basically, I need to write a Java consumer that should auto-discover any topic in kafka server.There is API to fetch TopicMetadata, but this needs name of topic as input parameters.I need information for all topics present in server.

http://stackoverflow.com/comment/38638413
comment on: http://stackoverflow.com/a/24875502
score: 1
has text: @PeterLawrey What is an operation that 1) wouldn't be optimized into oblivion and 2) wouldn't completely overpower the results of the test? Even a simple `System.out.println("a");` was so expensive that the difference between methods was negligible compared to the time it took to print.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38616205
type: QuestionComment
has text: can i apply filtering to any xml or only to pom.xml
score: 0
comment on: http://stackoverflow.com/q/24864777
type: Comment

http://stackoverflow.com/comment/38638286
type: AnswerComment
has text: If he didn't have write access to the directory he wouldn't be able to create the file.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24875950

http://stackoverflow.com/comment/38696682
comment on: http://stackoverflow.com/a/24907878
score: 0
type: AnswerComment
has text: Hi I think you should use different id for each notification .. and use loops for sending multiple notifications..
type: Comment

http://stackoverflow.com/q/24829532
tagged with: android
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38548596
has answer: http://stackoverflow.com/a/24829661
has body: i am developing android simple calculator it works fine but only one issue when i press 0 again and again it result 00000000 it should be only one 0 my activity file is: package com.example.droidcalc; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; enter code here public class MainActivity extends ActionBarActivity { int first,second,result; char operation; EditText disp; boolean newValue = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); disp = (EditText) findViewById(R.id.editText1); } @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); } public void button1(View sender){ if(newValue == true) disp.setText("1"); else disp.setText(disp.getText().toString() + "1"); newValue = false; } public void button2(View sender){ if(newValue == true) disp.setText("2"); else disp.setText(disp.getText().toString() + "2"); newValue = false; } public void button3(View sender){ if(newValue == true) disp.setText("3"); else disp.setText(disp.getText().toString() + "3"); newValue = false; } public void button4(View sender){ if(newValue == true) disp.setText("4"); else disp.setText(disp.getText().toString() + "4"); newValue = false; } public void button5(View sender){ if(newValue == true) disp.setText("5"); else disp.setText(disp.getText().toString() + "5"); ne…
type: AnsweredQuestion
score: -5
tagged with: java
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/24829661
downvote count: 5
has title: I am trying to build a simple calculator

http://stackoverflow.com/q/24836260
tagged with: java
downvote count: 3
tagged with: eclipse
tagged with: gradle
type: Question
answer count: 1
score: -2
has body: For my workspace I have: ProjectA (Core Api project using maven for build management) ProjectB (Spring Rest Webservice using Gradle for build management) What is the best way to reference ProjectA from ProjectB?
has answer: http://stackoverflow.com/a/24845656
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: build
has title: Reference other eclipse projects using gradle

http://stackoverflow.com/comment/38511389
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24809768
score: 0
has text: @njzk2 Respect for you Sir :) Can you please put it in answer so i can accept and upvote ?

http://stackoverflow.com/comment/38467534
has text: Rather than the question `What is system.in`, I believe, you should first understand, what are constructor parameters. In ur sample, `new Scanner(System.in)`, it is calling the Scanner constructor and passing system.in as a parameter. And System.in is the standard input stream - typically keyboard.
type: Comment
comment on: http://stackoverflow.com/q/24786399
type: QuestionComment
score: 1

http://stackoverflow.com/a/24845057
upvote count: 4
downvote count: 0
has body: You are checking the wrong character for being a digit: this expression postfix.charAt(i) does not check the correct character, because the index i goes out of sync with the position in the original string postfix. Your loop uses i to index str array, so the index goes from zero to the number of tokens, not from zero to the length of the string. Use this expression instead: if(Character.isDigit(str[i].charAt(0))) { ... } ...
answers question: http://stackoverflow.com/q/24845012
type: Answer
score: 4

http://stackoverflow.com/q/24798922
has comment: http://stackoverflow.com/comment/38565748
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38493026
tagged with: gradle
type: Question
tagged with: cucumber
has title: How to determine running environment type in cucumber runtime?
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: jenkins
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24838979
has body: I want to run a cucmber I use jenkins to run gradle build and then run test with cucumber script. I want to create a user for testing. If I run on DEV env I want to use user1. When running on QA server I want to use user2. I can to use this zs_proile var: export WEBDRIVER=local and user user2 but maybe reading from config file will be more generic What would be the clean way to check in test during run time which env do I run in?

phone-state-listener
type: Tag
tag name: phone-state-listener
tags question: http://stackoverflow.com/q/24834084

http://stackoverflow.com/a/24767844
has body: Try this: exec(String[] cmdarray) Executes the specified command and arguments in a separate process. process.exec("new String[]{"grep", "'auth\.'", "/var/lib/iscsi/nodes/10.1.1.36/*/default"});
has comment: http://stackoverflow.com/comment/38432078
has comment: http://stackoverflow.com/comment/38467523
type: Answer
has comment: http://stackoverflow.com/comment/38432300
answers question: http://stackoverflow.com/q/24767786
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/24831140
has answer: http://stackoverflow.com/a/24831289
has comment: http://stackoverflow.com/comment/38551766
accepted answer: http://stackoverflow.com/a/24831256
has comment: http://stackoverflow.com/comment/38551539
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38551589
tagged with: java
type: Question
has body: I have a directory with some image files. I want to move all those files to a different place as long as they are not tar extensions. What is the regex in Java to filter tar files? This is my code: String regex = "^[[a-z]\\.[^tar]$]*";
has title: tar extension match using regex
has answer: http://stackoverflow.com/a/24831256
has comment: http://stackoverflow.com/comment/38551581
has answer: http://stackoverflow.com/a/24831696
has comment: http://stackoverflow.com/comment/38551514
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/24831289

http://stackoverflow.com/comment/48227127
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24780733
has text: Thank you, JoD. Unfortunately it did not make a difference in the result.
type: QuestionComment

http://stackoverflow.com/comment/38673645
score: 0
type: QuestionComment
type: Comment
has text: @christopher : What is resource loader, and how can I use it ?
comment on: http://stackoverflow.com/q/24895362

http://stackoverflow.com/comment/38668123
has text: Sorry the userinputs is under the src folder as well.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24890991

http://stackoverflow.com/comment/38498419
comment on: http://stackoverflow.com/a/24799648
score: 0
has text: Hi fiffy that issue is fixed, same issue is araised in the above file. can u give me solution??
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24816159
answers question: http://stackoverflow.com/q/24815897
has comment: http://stackoverflow.com/comment/38523656
upvote count: 1
type: Answer
downvote count: 0
has body: I think you might solve this by eliminating the synchronized nature of the method; to do that, just initialize the variable when the class is loaded. The obvious way to do this is with a static initializer, which you may need to look up -- it is a code block that is executed when the class is loaded, so it completes before any use of the class is made. Synchronizing a method can take significant time in comparison to method calls without synchronization, so this is an easy thing to try. It doesn't have much to do with Swing, but it's a lot simpler to do something about in this case. edit: -------------------- You don't say why you suspect a memory leak, or indeed what you mean by a "performance problem"; I think it is far more usual, in a Swing or other GUI application, to have a "performance problem" somewhere besides the synchronized call to a method, even if it's called often. But this is the code you identified, and the first thing I saw about it related to performance. I hope it helps, but it won't surprise me much if your problem is something you have not said and is caused by something you haven't mentioned. Just saying.
score: 1

http://stackoverflow.com/comment/38530791
has text: thx, i cant to check it right now. maybe you also tell me how to parse that json to html table with two columns(name, avg salary) after jquery ajax succes call to my service?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24819667

http://stackoverflow.com/a/24806985
has comment: http://stackoverflow.com/comment/38506316
score: 1
has comment: http://stackoverflow.com/comment/38506184
upvote count: 2
has body: You can't instantiate an abstract class, bacause it usually contains abstract methods, which have no implementation. In order to instantiate a class, all of its methods must be implemented. Sub classes would implement the abstract methods, and you would instantiate those sub classes. However, even if you implement all the methods, you would sometimes define the class as abstract if you want to prevent users of the class from instantiating it. You would define a class as abstract if it is meant to be sub-classed, and doesn't contain all that is required for creating a fully functional object. As for interfaces, they just declare methods without implementation (with the exception of default methods introduced in Java8), and don't have constructors or class variables. You can't instantiate them without implementing all of their methods.
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/24806959

http://stackoverflow.com/a/24899503
has comment: http://stackoverflow.com/comment/38681370
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24899410
has comment: http://stackoverflow.com/comment/38682116
has body: You create an instance with nPlayer nplayer = new nPlayer(); "nplayer" is the name of the variable, choose one you like. You have to save the data of this instance somewhere if you want to access the data upon reopening the program. If you have the instance there (in this case 'nplayer'), you access the data like that: boolean b = nplayer.getAdmin(); I should mention that you generally write class names always with the first letter capital, that would be "NPlayer".
type: Answer

http://stackoverflow.com/a/29224155
type: Answer
has comment: http://stackoverflow.com/comment/86134236
has body: TableColumn&lt;ProductStockDto , String&gt; ProductNameCol = new ProductNameCol ("Product Name"); ProductNameCol.setCellValueFactory(new Callback&lt;TableColumn.CellDataFeatures&lt;ProductStockDto , String&gt;, ObservableValue&lt;String&gt;&gt;() { @Override public ObservableValue&lt;String&gt; call(TableColumn.CellDataFeatures&lt;ProductStockDto , String&gt; param) { return new SimpleObjectProperty&lt;&gt;(param.getValue().ProductDto ().getName()); } });
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24769296
downvote count: 0
has comment: http://stackoverflow.com/comment/46656856

http://stackoverflow.com/a/24901380
has comment: http://stackoverflow.com/comment/38684709
upvote count: 3
type: Answer
downvote count: 0
has body: You're missing a close quote here on Thursday, String[] DaysOfTheWeek = { "Monday", "Tuesday", "Wednesday", "Thursday, "Friday" }; should be String[] DaysOfTheWeek = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };
score: 3
answers question: http://stackoverflow.com/q/24901361

http://stackoverflow.com/q/24829212
has body: So I have been looking at Spring MVC as a framework and maybe a schema-less DB like Redis, to develop a website from scratch. I see that AWS (Amazon Web Services), is an ideal solution for me that I will try to use as the host; if things pick up, down the line. I was hoping someone could point me toward some great resources or books, that may help me in my venture. Additionally does anyone know if you can dev/design your code base around AWS without actually using it? Sorry if this is a dumb question that doesnt make sense. I am not familiar enough with the process as of yet. I just know I will probably end up hosting my project on a cheaper service before I get it onto the Amazon Services.
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24829917
has title: Resource for AWS with Java
tagged with: amazon-web-services
score: 2
answer count: 1
downvote count: 0
tagged with: web
accepted answer: http://stackoverflow.com/a/24829917
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/24809748
tagged with: java
accepted answer: http://stackoverflow.com/a/44022227
has body: I need to be able to convert from proto to xsd, I know that there is some tools to convert from XSD to PROTO, but I need the oppositive. Could be in .NET or Java Thanks
type: Question
possible better answer: http://stackoverflow.com/a/24810040
answer count: 2
has comment: http://stackoverflow.com/comment/38511966
has answer: http://stackoverflow.com/a/24810040
has title: Convert from Proto to XSD
downvote count: 0
tagged with: protocol-buffers
favorite count: 0
tagged with: protobuf-net
upvote count: 1
has answer: http://stackoverflow.com/a/44022227
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/38635784
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24875362
has text: Maybe the question could be generalized to other interesting assignments or comparisons.

http://stackoverflow.com/comment/46031132
type: Comment
comment on: http://stackoverflow.com/a/25986403
type: AnswerComment
score: 0
has text: Thanks for spreading this on multiple questions, that setting was indeed the cause in my case!

http://stackoverflow.com/a/24890409
type: Answer
answers question: http://stackoverflow.com/q/24828453
score: 18
has body: Eclipse uses the data in org.eclipse.wst.common.component to figure out the dependencies needed for deployment. The file corresponds to the settings found in Eclipse when Right-clicking on an EAR project &gt; Properties &gt; Deployment Assembly. E.g. if your EAR project has a dependency on a WAR project then Eclipse knows to include the WAR when deploying because of the Deployment Assembly settings which get stored in org.eclipse.wst.common.component When building the EAR using Ant you need to add these dependencies manually (without relying on Eclipse metadata)
has comment: http://stackoverflow.com/comment/38668647
upvote count: 18
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38673256
accepted answer of: http://stackoverflow.com/q/24828453

http://stackoverflow.com/comment/38411465
has text: I'm using @Autowired for the Services. The problem is not the wiring, that works very well. The confusing point is the fact that I need to add it to both configurations: WebMvc and Security, which in fact means: it will create two classes and not use one shared singleton across the whole application.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24756618

http://stackoverflow.com/comment/38665946
has text: What about the other part of my question?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24891401
score: 0

http://stackoverflow.com/q/24827026
has comment: http://stackoverflow.com/comment/38544534
has comment: http://stackoverflow.com/comment/38543728
upvote count: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/38605386
accepted answer: http://stackoverflow.com/a/24827544
has body: I should be using getRemoteUser functionality to get the logged in user. Until the authentication part get created I am trying to hard code the user in the jsp page and pass that in the my servlet. But when I try to print out the value its null: &lt;input type="hidden" name="userId" id="userId" value="123456789" /&gt; Here is how I tried to get the user: String fakeUser = request.getParameter("userId"); PrintWriter out = response.getWriter(); out.println(fakeUser); System.out.println(fakeUser) I also tried the solution mentioned following Stackoverflow post but that didn't work either. passing value from jsp to servlet
has comment: http://stackoverflow.com/comment/38605331
linked to: http://stackoverflow.com/q/10268415
favorite count: 0
downvote count: 1
has title: JSP pass hidden input value to servlet when the page load
type: Question
has answer: http://stackoverflow.com/a/24827544
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38543777
tagged with: java
score: -1
tagged with: servlets

http://stackoverflow.com/comment/38442432
has text: If there is a reference from a living thread it won't get collected, no matter how long you don't use it. If you don't have a reference ... how do you intend to use it later on?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24773286

http://stackoverflow.com/a/24815017
score: 0
type: Answer
has body: In order to be able to call the method of a subclass, the actual object must be of that subclass. For example, you will have: Student[] students = new Students[1]; students[0] = new Undergraduate(); ((Undergraduate))students[0]).setInternship(new Internship()); Or if you have a bigger array without knowing the actual type of the object, you must check before the type in order to avoid a ClassCastException: for (int i = 0; i &lt; students.length; ++i) { if (students[i] instanceof Undergraduate) { ((Undergraduate)students[i]).setInternship(new Internship()); } }
answers question: http://stackoverflow.com/q/24814928

http://stackoverflow.com/q/24817182
favorite count: 0
score: 13
has body: Just installed new version of Birt 4.x in eclipse and couldn't find preview tab in layout window.
has answer: http://stackoverflow.com/a/24817314
has answer: http://stackoverflow.com/a/24819127
upvote count: 13
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24819127
tagged with: birt
tagged with: java
accepted answer: http://stackoverflow.com/a/24817314
type: Question
tagged with: eclipse
answer count: 2
has title: Missing preview tab in Birt layout
downvote count: 0

http://stackoverflow.com/a/24886620
type: AcceptedAnswer
has body: Remove if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); }
type: Answer
accepted answer of: http://stackoverflow.com/q/24885731
answers question: http://stackoverflow.com/q/24885731
score: 0
has comment: http://stackoverflow.com/comment/38689058

http://stackoverflow.com/q/24889323
upvote count: 0
has answer: http://stackoverflow.com/a/24889543
answer count: 1
favorite count: 0
tagged with: sockets
tagged with: netty
score: -3
has body: I have some very basic doubts on this topic. I have a legacy server written some 30 years ago in C, C++, that supports socket communication but it works great. I am in the process of writing a new java based client to connect to this server basically the goal is to expose the services (REST etc) for enterprise applications. 1) Should i go for plain java socket based approach or use Netty or Apache-Mina, what benefits i may have by using these modern apis in this scenario. 2) When using NIO based IO, does the sever also need to be a NIO based to take advantage of it or a NIO client to a legacy server (non NIO) would just work as good as it does with a NIO server. Thank you very much
type: UnansweredQuestion
tagged with: tcp
tagged with: java
downvote count: 3
type: Question
has title: TCP/IP socket client
tagged with: apache-mina

http://stackoverflow.com/q/24900594
accepted answer: http://stackoverflow.com/a/24900679
tagged with: http://stackoverflow.com/tag/xml
has body: This is my current XML file it gives me the dialogue for different characters, or at least it should. I want it to work so that I can specify the entity id and the option/quest id and get the output. So what should I do? Any help is appreciated, thank you very much. <?xml version="1.0"?> player has not started quest hello there, can you kill 2 enemies for me? player has completed quest and player has not... thankyou, have a sword for your troubles. player has not finished quest you haven't finished yet. thank you. village is being destroyed our village is being destroyed, please help us! village has been saved or destroyed we will never forget this. hello. This is what I currently have, but it does not work. I know this is probably a stupid question, but I couldn't find an answer anywhere on the web. Thanks. public static void read() { try { File file = new File("text.xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(file); doc.getDocumentElement().normalize(); System.out.println("root of xml file " + doc.getDocumentElement().getNodeName()); NodeList nodes = doc.getElementsByTagName("entity"); System.out.println("=========================="); for(int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if(node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; if(element.getElementsByTagName("entity").item(0).getTextContent().equals("output")) { } System.out.println("" + getValue("output", element)); } } }catch(Exception e) { e.printStackTrace(); } } private static String getValue(String tag, Element element) { NodeList nodes = element.getElementsByTagName(tag).item(0).getChildNodes(); Node node = (Node) nodes.item(0); return node.getNodeValue(); }
possible better answer: http://stackoverflow.com/a/24900777
type: AnsweredQuestion
tagged with: java
has title: How to reading an XML by its element id's?
type: Question
answer count: 2
tagged with: xml-parsing
has answer: http://stackoverflow.com/a/24900777
score: 0
linked to: http://stackoverflow.com/q/6828703
has answer: http://stackoverflow.com/a/24900679

http://stackoverflow.com/a/24797305
has body: In Java Boolean (like String) is immutable. That means if you use Boolean x = new Boolean(true); x = false; x will point to a different Object after the "x = false" than it did before. So if you use the Boolean.valueOf() method Java will take care that there are only two Boolean objects at max, one representing true and the other representing false. If you use .valueOf(true) it will return a handle to the true-object and if you use .valueOf(false) it will return a handle to the false-object. Thus you don't create any unnecessary objects and thus they won't have to be deleted by the garbage collector. If you use "new Boolean()" instead this doesn't work and Java will create a new Object every time. Thus you will have a ton of unnecessary objects that will probably be freed quite quickly and have to be cleaned by the garbage collector. So this costs you more memory (for all the objects), time for the allocation (when creating new Booleans) and time for the deallocation (when the objects are caught by the garbage collector), while giving you no advantages at all.
type: Answer
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24797155

http://stackoverflow.com/a/24829671
has body: For the first part of the question, I have not been able to reproduce your results with the newest version of the API. If you can reproduce your results in version 1.9.7 then post some code and I'll take a look at it again. The dev server and the production server should behave the same, and if not, then it is a bug. One alternative to get around the limits is by not storing them as numbers but as atoms. But then you won't be able to apply the &lt;,>,&lt;=,..., operators only equality.
type: Answer
answers question: http://stackoverflow.com/q/24793380
has comment: http://stackoverflow.com/comment/38713268
score: 0
has comment: http://stackoverflow.com/comment/38601156
has comment: http://stackoverflow.com/comment/38769095
has comment: http://stackoverflow.com/comment/38682488
has comment: http://stackoverflow.com/comment/38668441

http://stackoverflow.com/comment/38640615
type: QuestionComment
comment on: http://stackoverflow.com/q/24877867
type: Comment
has text: You no need to declare `guess` again in your loop. just `guess = scan.nextInt();` in your loop.
score: 0

http://stackoverflow.com/comment/38616976
score: 0
type: Comment
type: QuestionComment
has text: This is another problem I am facing now. I have configured this but still it wouldn't open Java console. Even if I double click on a jar file. So finally I have to do it manually as java -jar testTool.jar Either I have become lazy working in Visual Studio and C# or Configuring java is rally dificult for an amature developer :-D
comment on: http://stackoverflow.com/q/24828641

foreach
tags question: http://stackoverflow.com/q/24845281
tags question: http://stackoverflow.com/q/24890200
tags question: http://stackoverflow.com/q/24811229
tags question: http://stackoverflow.com/q/24860049
type: Tag
tags question: http://stackoverflow.com/q/24819967
tag name: foreach
tags question: http://stackoverflow.com/q/24785321
tags question: http://stackoverflow.com/q/24856811
tags question: http://stackoverflow.com/q/24791365

http://stackoverflow.com/comment/38485228
has text: I tried closing the FileOutputStream but still getting a black output. I also changed BufferImage.TYPE_BYTE_BINARY to TYPE_INT_RGB but without any luck. Can you please suggest possible amendments to the code to accomodate the ImageObserver?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24777873
type: Comment

http://stackoverflow.com/comment/38408144
type: Comment
type: QuestionComment
has text: Thank you JasonPlutext,I will be doing that.
comment on: http://stackoverflow.com/q/24751063
score: 0

http://stackoverflow.com/a/24799739
downvote count: 1
has comment: http://stackoverflow.com/comment/38493829
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24799727
has comment: http://stackoverflow.com/comment/38492739
answers question: http://stackoverflow.com/q/24799727
has body: EJB and JPA are two different specifications that are part of the Java EE standard. You can use either of them without using the other. EDIT: EJB is used within Java EE compliant servers like WildFly (formerly known as JBoss) and Glassfish. IF you are using one, you always have an implementation of JPA on board. JPA on the other hand is not bound to such a server and can be used in servlet containers like Tomcat and standalone Java SE applications.
type: Answer
score: 2
upvote count: 3

http://stackoverflow.com/comment/38466482
score: 0
has text: Don't update the GUI from the background thread; use `setProgress()`, as shown in this [duplicate](http://stackoverflow.com/q/4637215/230513).
type: QuestionComment
comment on: http://stackoverflow.com/q/24785087
type: Comment

http://stackoverflow.com/q/24749788
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24780122
tagged with: xpath
type: Question
upvote count: 1
tagged with: html-parsing
has body: Need help with this expression "//tr[td[normalize-space(font) = '"+params[1]+"']]/td/font/text()" I'm trying to get the information out of this HTML document CRN Materia Sección Créditos Título Cupo Inscritos Disponible 10110 IIND1000 1 3 INTROD. INGEN. INDUSTRIAL 100 100 0 If I look for params1=10110, I want to get every td element within that tr tag (10110,IIND1000, 1, 3, INTROD. INGEN. INDUSTRIAL, 100, 100, 0). Jtidy wasn't really doing the job well (it was having trouble with the spaces between font and div), so I decided to use Jsoup instead. Would anyone happen to know how to convert that Xpath Expression at the beginning so it can be used in Jsoup? So far I've managed to get this expression: font.texto4:contains(10110), which gets only "10110". I haven't found a way, however, to get the text from every child node on its same level. EDTI: I'm a noob at Jsoup, but I'm trying out more expressions and checking the result. I found that if I try this expression tr>td:contains(10110) font.texto4, I get the text for EVERY element in the table. I just want to narrow it down to the set of tr nodes in the same level.
has title: XPath Expression with Jsoup
tagged with: java
linked to: http://stackoverflow.com/q/24668436
accepted answer: http://stackoverflow.com/a/24780122
answer count: 1
tagged with: jsoup

http://stackoverflow.com/a/24795675
has comment: http://stackoverflow.com/comment/38522466
score: 0
accepted answer of: http://stackoverflow.com/q/24794416
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24794416
has body: Okay, here's how I solved it. The basic idea is that you have to: Detect whether or not a soft-keyboard is showing, React. Based on the detected information (is-soft-keyboard-showing), resize your layout accordingly. There are two ways of achieving this: to give your activity's root view a known ID, say '@+id/activityRoot', hook a GlobalLayoutListener into the ViewTreeObserver, and from there calculate the size diff between your activity's view root and the window size: Customize your top-level layout class into one which overrides onMeasure() And I would like to credit the above answer to this SO Post: how-to-check-visibility-of-software-keyboard-in-android, which I have found earlier on this particular problem.
type: Answer

http://stackoverflow.com/comment/38681382
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24899575
has text: JavaScript !== Java - I removed the tag.
type: Comment

http://stackoverflow.com/comment/38430289
comment on: http://stackoverflow.com/q/24766546
score: 0
type: Comment
type: QuestionComment
has text: @JigarJoshi: I don't understand what you mean.

http://stackoverflow.com/comment/38613930
comment on: http://stackoverflow.com/q/24864042
score: 0
type: Comment
type: QuestionComment
has text: @immibis you should write an answer on this.

http://stackoverflow.com/comment/38593373
type: Comment
has text: If you have an AchorPane in your FXML, do ``AnchorPane anchorPane = FXMLLoader...`` and then ``tab.setContent(anchorPane)``.
comment on: http://stackoverflow.com/a/24853158
score: 3
type: AnswerComment

http://stackoverflow.com/comment/38504990
comment on: http://stackoverflow.com/a/24805334
score: 0
has text: @A4L: What do you mean overflow? It works fine as far as I can see.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38600141
type: QuestionComment
comment on: http://stackoverflow.com/q/24851650
has text: For [example](http://stackoverflow.com/questions/13223065/color-fading-algorithm/13223818#13223818) and [example](http://stackoverflow.com/questions/21270610/java-smooth-color-transition/21270957#21270957)
score: 0
type: Comment

http://stackoverflow.com/comment/38697321
type: QuestionComment
has text: If your question is "Can I use a Java module from Python?" then how are sockets relevant?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24908276

http://stackoverflow.com/q/24823420
has answer: http://stackoverflow.com/a/24823568
answer count: 4
has comment: http://stackoverflow.com/comment/38536745
downvote count: 0
score: 16
has title: What is the difference between char and Character in Java?
tagged with: char
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24823630
has answer: http://stackoverflow.com/a/24823548
favorite count: 0
tagged with: character
linked to: http://stackoverflow.com/q/8790809
possible better answer: http://stackoverflow.com/a/24823548
has answer: http://stackoverflow.com/a/24823624
upvote count: 16
accepted answer: http://stackoverflow.com/a/24823630
has comment: http://stackoverflow.com/comment/38536819
tagged with: java
has body: I need to know what is the difference between char and Character in Java because when I was making a java program, the char worked while the Character didn't work.

http://stackoverflow.com/comment/38682927
has text: You're not printing anything. That'd be the leading cause as to why there's no output.
comment on: http://stackoverflow.com/q/24900443
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38546482
type: QuestionComment
comment on: http://stackoverflow.com/q/24763580
type: Comment
has text: "getting rid of the xml" means the definitions you see in that xml could be translated into Java code. See [here](http://docs.spring.io/spring/docs/4.0.4.RELEASE/spring-framework-reference/htmlsingle/#beans-java) more details. I strongly suggest reading the reference documentation for Spring, it is very good and has a lot of good info in there. You seem to be missing the basics of both Spring Boot and Spring itself.
score: 0

http://stackoverflow.com/comment/38493495
type: QuestionComment
has text: Although, it is possible not to create any more filter and have it redirect to a specific jsp page instead but this is not the ideal...
comment on: http://stackoverflow.com/q/24799416
score: 0
type: Comment

http://stackoverflow.com/q/24891489
score: 4
tagged with: mouseevent
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/2627946
has answer: http://stackoverflow.com/a/38148772
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/38666072
tagged with: java
has answer: http://stackoverflow.com/a/38148446
has title: Java - disable click after JLabel is pressed
has comment: http://stackoverflow.com/comment/38666136
has body: I want to disable click on a same jLabel again. For example, I have 3 JLabels = JLabel1, JLabel2, JLabel3. If I clicked JLabel1. I want to disable to the click for JLabel1 and only JLabel2 and JLabel3 is clickable. I tried .setEnabled(false) in mousePressed event but it's seems that I am still able to click the JLabel. How do I disable the click after a JLabel is clicked then? public class LabelListener extends MouseAdapter { @Override public void mousePressed(MouseEvent e) { JLabel label = (JLabel) e.getSource(); for(int i = 0; i&lt; 3; i++) { if(label == jLabel[i]) { System.out.println("You clicked on " + i); label.setEnabled(false); } } }
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38667082
has comment: http://stackoverflow.com/comment/38666104

http://stackoverflow.com/q/24901978
linked to: http://stackoverflow.com/q/5156113
tagged with: android
has answer: http://stackoverflow.com/a/24969695
has comment: http://stackoverflow.com/comment/39014918
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14664471
has body: spock-core:0.7-groovy-2.0 robospock:0.5.0 Android Studio 0.8.2 Fedora release 20 (Heisenbug) This is the complete solution. Now it compiles and runs the unit test successfully, and the directory structure is the same as the preview edit. Please feel free to comment on anything that doesn't look right. Edit Solution ===== build.gradle: apply plugin: 'java' apply plugin: 'groovy' repositories { mavenCentral() maven { // Location of Android SDK for compiling otherwise get this error: /* Could not find com.android.support:support-v4:19.0.1. Required by: :testSQLite:unspecified &gt; org.robospock:robospock:0.5.0 &gt; org.robolectric:robolectric:2.3 */ url "/home/steve/local/android-studio/sdk/extras/android/m2repository/" } } dependencies { // just compile so we can use the sqlite API compile 'com.google.android:android:4.1.1.4', { // Do not bring in dependencies transitive = false } testCompile 'org.codehaus.groovy:groovy:2.3.+' testCompile 'org.spockframework:spock-core:0.7-groovy-2.0' testCompile 'org.robospock:robospock:0.5.0' testCompile 'org.robospock:robospock-plugin:0.4.0' } SnapzClientTest.groovy: package com.example.DataAccess import com.example.DataAccess.SnapzAndroidDB import org.robolectric.Robolectric import pl.polidea.robospock.RoboSpecification class SnapClientTest extends RoboSpecification { /* Create Sqlite database for Android */ def 'Create a sqlite database for Android'() { setup: def androidDB = new SnapzAndroidDB(Robolectric.application) expect: androidDB != null } } SnapzAndroidDB.java, no change from the 5th August Edit Edit 5 August ================ Basically, I am trying to create a JAR file that will be used in an Android app that will have the functionality of SQLite, so I can use this JAR file for many apps. I have started from scratch and created a smaller application that is easier to bug fix. This is the directory structure, and there is only three files: testSQLite/build.gradle testSQLite/src/main/java/com/example/sqltest/SnapzAndroidDB.…
tagged with: java
has answer: http://stackoverflow.com/a/25055947
upvote count: 18
tagged with: robospock
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/39170339
answer count: 2
linked to: http://stackoverflow.com/q/14205451
linked to: http://stackoverflow.com/q/2774726
score: 18
linked to: http://stackoverflow.com/q/18595482
has title: Unit testing creating an SQLite database using Spock and Robospock
accepted answer: http://stackoverflow.com/a/25055947
tagged with: sqlite
linked to: http://stackoverflow.com/q/7725386
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/9109438
linked to: http://stackoverflow.com/q/24090707
possible better answer: http://stackoverflow.com/a/24969695

http://stackoverflow.com/q/24906971
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24908330
tagged with: locale
has answer: http://stackoverflow.com/a/24908330
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has title: Changing the locale is modifying the text dimensions of my app
has body: I'm trying to change the language on my Android app and I'm using this code: String languageToLoad = "en"; Locale locale = new Locale(languageToLoad); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); I've created different values directories (\values-fr, \values-it, etc.) where I put my string.xml files. Changing the language works normally, but the problem is that it's changing text dimensions in my app (text sizes on textviews, menu, dialogs, edittexts, buttons...basically in all my app). Removing the block code that changes the locale, the app layout gets back to normal. Is the getDisplayMetrics() creating the problem? I'm using styles for some of the texts: And some example of textviews: <TextView android:id="@+id/login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="15dp" style="@style/title_font" android:text="@string/login_title" /> <TextView android:id="@+id/label_user" android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginTop="50dp" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/user_label" android:layout_below="@+id/login"/> Can you tell me why is this happening and how to solve it? If you need any additional information, please ask.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7289060

http://stackoverflow.com/q/24782872
downvote count: 0
has title: Hibernate: which one is better way: saving source or target in many to one association
favorite count: 0
score: 3
has answer: http://stackoverflow.com/a/24797811
has answer: http://stackoverflow.com/a/24783358
has body: @Entity public class Troop { @OneToMany(mappedBy="troop") public Set&lt;Soldier&gt; getSoldiers() { ... } @Entity public class Soldier { @ManyToOne @JoinColumn(name="troop_fk") public Troop getTroop() { ... } I do something like this: Troup t = new Troup(); t.getSoldiers().add(soldier); This saves troop and soldier also. Foreign key is also added since soldier is the owner. But which one is better way, I mean saving toop or soldier using: Troop t = ..... // Get troop from session Soldier s = new Soldier(); s.setTroop(t);
tagged with: one-to-many
upvote count: 3
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
answer count: 2
tagged with: jpa

http://stackoverflow.com/comment/38397809
type: Comment
has text: Like yourself, I'm not sure if "cannot include interfaces" means not being able to *implement* interfaces, but if that's the assumption, implementing `Comparator<Person>` is also implementing an interface ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24749402

http://stackoverflow.com/comment/38689318
type: Comment
score: 0
type: AnswerComment
has text: it has to be added as questioner is referring in the select query. this is the select query "SELECT id, AUD, CAD, EUR, GBP, USD FROM table"
comment on: http://stackoverflow.com/a/24903830

http://stackoverflow.com/comment/38666173
type: Comment
comment on: http://stackoverflow.com/a/24875151
type: AnswerComment
has text: Thanks @Ignasi Barrera (+1) - it looks like the `chef-bootstrap.sh` script itself is bad. When I run `sh chef-bootstrap.sh` I get the following error: `chef-bootstrap.sh: 5: chef-bootstrap.sh: Syntax error: "(" unexpected`. This corresponds to the following line of code: `function ensure_cmd_or_install_package_apt(){`. Any ideas?
score: 0

http://stackoverflow.com/q/24876440
has comment: http://stackoverflow.com/comment/38637760
linked to: http://stackoverflow.com/q/24871872
has comment: http://stackoverflow.com/comment/38640623
type: Question
score: 0
answer count: 1
tagged with: java
has body: I'm in a class in college and we're doing Java. This is only my 4th class so I'm super new (be nice). My problem, hopefully my only one is that this will actually run but, after the user is asked to input the number of students grades you'd like to enter. It then goes into the for loop and asks the next two questions at the same time and then I get an error. I'm trying to figure out how to get it to ask the questions separately but I'm not having any luck. Someone had suggested io.console but I don't think we're allowed to use that, we haven't learned it yet. I came across hasNext but I'm not really sure how it works, and the more I read on it the more it confuses me. Any help is greatly appreciated! /*Write a java program that prompts the user to enter the number of students and then each student’s name and score, * and finally displays the student with highest score and the student with the second- highest score. * You are NOT allowed to use ‘Arrays’ for this problem (as we have not covered arrays yet). * * HINT: You do not need to remember all the inputs. You only need to maintain variables for max and second max * scores and corresponding names. Whenever you read a new input, you need to compare it to the so far established * max &amp; second max scores and change things accordingly. */ import java.util.Scanner; public class StudentScore { public static void main(String[] args) { String studentName="", highName="", secondHighName=""; int score=0, highScore=0, secondHighScore=0; int count; int classSize; Scanner scan = new Scanner(System.in); System.out.print("How many students' grades do you want to enter? "); classSize = scan.nextInt(); for (int i = 0; i &lt; classSize.hasNext; i++) { System.out.print("Please enter the students name? "); studentName = scan.hasNextLine(); System.out.print("Please enter the students score? "); score = scan.nextInt(); } if (score &gt;= secondHighScore) { secondHighScore = highScore; secondHighName = highName; highScore = score; hi…
has title: for loop class assignment gone wrong
has comment: http://stackoverflow.com/comment/38637770
tagged with: for-loop
has answer: http://stackoverflow.com/a/24876638
type: UnansweredQuestion

http://stackoverflow.com/a/24873826
accepted answer of: http://stackoverflow.com/q/24868668
score: 10
has comment: http://stackoverflow.com/comment/38663630
has body: Add this piece of code to root build.gradle and it should work fine: allprojects { apply plugin: 'java' repositories { mavenCentral() } } task copyJars(type: Copy, dependsOn: subprojects.jar) { from(subprojects.jar) into project.file('dest') } task copyDeps(type: Copy) { from(subprojects.configurations.runtime) into project.file('dest/lib') } task copyFiles(dependsOn: [copyJars, copyDeps])
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24868668
upvote count: 10

http://stackoverflow.com/comment/38645188
comment on: http://stackoverflow.com/q/24865382
type: Comment
type: QuestionComment
score: 0
has text: Where should i add the back press method in fragment it is before the class or after the baseadapter @BhaveshJethani if i use the Override method inside the class then i will get an error such that i cant use the super keyword or override the method

http://stackoverflow.com/a/24869025
type: AcceptedAnswer
downvote count: 0
has body: There is no such notation as srcDirs("src") { include "my/program/some/package/Acct.java" }. Try: sourceSets { acct { java { srcDirs = ["src"] // replaces default rather than adding another dir include "my/program/some/package/Acct.java" } } }
answers question: http://stackoverflow.com/q/24868528
type: Answer
accepted answer of: http://stackoverflow.com/q/24868528
upvote count: 2
score: 2

http://stackoverflow.com/a/24867466
has comment: http://stackoverflow.com/comment/38622827
score: 0
accepted answer of: http://stackoverflow.com/q/24866737
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24866737
type: Answer
has comment: http://stackoverflow.com/comment/38622074
has body: Here: public class HomePagePanel { // note code conventios! ... public HomePagePanel() { ... emailModel = new EmailTableModel(); sorter = new TableRowSorter&lt;EmailTableModel&gt;(emailModel); table = new JTable(emailModel); ... } } You don't call emailModel.setData() right before creating the table. It means your table model's data never is initialized and dc still being null at this point. Consequently when getRowCount() method is called during JTable creation it throws the NPE you're facing. IMHO you should consider remove setData() method and add the items list to the EmailTableModel constructor instead, and better organize your code to avoid this kind of situation: Do database call and get items list Create a new table model Create new JTable Edit "Should i just call fireTableDataChanged when I insert or delete an item?" No, you just need to provide methods to add/delete items to your table model and then notify TableModelListeners about such events. For instance: public class EmailTableModel extends AbstractTableModel { ... public void addRow(Item item) { int rowIndex = dc.size(); dc.add(item); fireTableRowsInserted(rowIndex, rowIndex); } ... public void deleteRow(Item item) { int rowIndex = dc.indexOf(item); if(rowIndex &gt; -1) { dc.remove(item); fireTableRowsDeleted(rowIndex, rowIndex); } } ... } See AbstractTableModel API: fireTableRowsInserted(int firstRow,int lastRow) fireTableRowsDeleted(int firstRow, int lastRow)

http://stackoverflow.com/comment/38462190
comment on: http://stackoverflow.com/a/24778128
type: Comment
score: 0
has text: This solution is different from the original: The original calls source.getConnection() just one time, and then it periodically pings the one connection. This solution creates a new connection (and does not close it) each time.
type: AnswerComment

http://stackoverflow.com/q/24838202
has comment: http://stackoverflow.com/comment/38566934
has answer: http://stackoverflow.com/a/24838389
has body: I am currently using JAXB to parse XML documents, however i need a better performing XML processor. Better = Faster and decrease memory footprint. I have to process literally millions of separate XML documents. I am using websphere application server v7 and java 6. I have read Stax is the way to go via JAXP, but then i have seen articles saying JAXP is outdated. If this is true, what are my althernatives to effeciently process millions of XML doucments (each XML doc is beteen 5Kb - 10Kb) without causing my application servers to crash with memory issues.
has comment: http://stackoverflow.com/comment/38564997
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38564455
possible better answer: http://stackoverflow.com/a/36278929
has title: Alternative to JAXB for XML parsing
tagged with: java
has answer: http://stackoverflow.com/a/36278929
tagged with: jaxb
has comment: http://stackoverflow.com/comment/38565640
type: Question
upvote count: 4
answer count: 2
tagged with: xml-parsing
accepted answer: http://stackoverflow.com/a/24838389
downvote count: 0
has comment: http://stackoverflow.com/comment/38565152
score: 4
favorite count: 0
tagged with: stax
has comment: http://stackoverflow.com/comment/38566182

http://stackoverflow.com/q/24887083
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24887484
tagged with: fragmentpageradapter
score: 2
tagged with: java
type: Question
has body: My application pulls data from a web service that generates different sections for each user. Then I am going to use these sections to create tabs using FragmentPagerAdapter. I have used an Async task to pull data from the web service. However the overridden methods such as getCount() and getPageTitle() in the FragmentPagerAdapter executed prior to my asynctask and completes its job. How can I prevent this and generate dynamic number of tabs and their title name based on the data fetched from the web service? In other words how can I create dynamic number of tabs and titles based on the data fetch from the web service My Code for FragmentPagerAdapter as below. As you can see I have hard coded the amount of tabs as well as their title names. public class SectionsPagerAdapter extends FragmentPagerAdapter{ private boolean proceedStatus = false; private String requestURL = "xxxxxxxxxxxxxxxxxxxxxxxx"; //list of fragments need to be added dynamically public final ArrayList&lt;Fragment&gt; screens = new ArrayList&lt;Fragment&gt;(); public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { // getItem is called to instantiate the fragment for the given page. // Return a DummySectionFragment (defined as a static inner class // below) with the page number as its lone argument. Fragment fragment = new SectionFragment(); Bundle args = new Bundle(); args.putInt(SectionFragment.ARG_SECTION_NUMBER, position + 1); fragment.setArguments(args); return fragment; } @Override public int getCount() { return 2; } @Override public CharSequence getPageTitle(int position) { Locale l = Locale.getDefault(); switch (position) { case 0: return "Camera".toUpperCase(l); case 1: return getString(R.string.title_section2).toUpperCase(l); case 2: return getString(R.string.title_section3).toUpperCase(l); case 3: return "SECTION 4"; } return null; } //setting the section title private void setSectionTitle(){ } //count the number of sections private i…
answer count: 2
has title: FragmentPagerAdapter dynamic tabs and page count
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/42483989
upvote count: 2

http://stackoverflow.com/comment/38464395
type: QuestionComment
type: Comment
has text: "I have opened many database connection but haven't closed any of them." probably :) without your code we cannot tell ...
comment on: http://stackoverflow.com/q/24784655
score: 0

http://stackoverflow.com/q/24860120
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38606849
type: Question
score: 0
answer count: 2
has title: remove only matching word from file in java
has comment: http://stackoverflow.com/comment/38606945
tagged with: string
has answer: http://stackoverflow.com/a/24860467
favorite count: 0
tagged with: io
possible better answer: http://stackoverflow.com/a/24860312
tagged with: regex
has answer: http://stackoverflow.com/a/24860312
type: AnsweredQuestion
has body: Hi i have a file contain some word , my requirement is to remove the matching word.If word is remove from between the line rest of the word below has to shifted up to avoid white space. File.txt medical_data01 medical_data02 medical_data Census_data_10000_k.gen Census_data_10000_k.gen_01 Census_data_10000_k.gen_02 If i remove medical_data Output should come like this medical_data01 medical_data02 Census_data_10000_k.gen Census_data_10000_k.gen_01 Census_data_10000_k.gen_02 But my code output is coming like this 01 02 Census_data_10000_k.gen Census_data_10000_k.gen_01 Census_data_10000_k.gen_02 File file = new File( RESOURCE_BUNDLE.getString("tested")); File temp = File.createTempFile("file", ".txt", file.getParentFile()); String charset = "UTF-8"; String delete = "medical_data"; BufferedReader reader = new BufferedReader( new InputStreamReader(new FileInputStream(file), charset)); PrintWriter writer = new PrintWriter( new OutputStreamWriter(new FileOutputStream(temp), charset)); String currentLine; while ((currentLine = reader.readLine()) != null) { currentLine = currentLine.replace(delete,""); if (currentLine.equals("")) { } else writer.println(currentLine); } writer.close(); reader.close(); file.delete(); temp.renameTo(file);
tagged with: java
accepted answer: http://stackoverflow.com/a/24860467

http://stackoverflow.com/a/24772821
has body: Put Rectangle chicken = new Rectangle(); at the start of spawnChicken() method. Reasons If you keep chicken a member, it will be replaced every time spawnChicken() method is called. Also, the same object is added to the array every time you try to spawn a chicken.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24763379
answers question: http://stackoverflow.com/q/24763379

http://stackoverflow.com/q/24894477
tagged with: java
has comment: http://stackoverflow.com/comment/38680095
type: Question
has answer: http://stackoverflow.com/a/24894498
has body: I am using the JNCryptor library to encrypt a string before sending it to my server as an encrypted string. Here is my code: String teststring = "Hello World"; JNCryptor cryptor = new AES256JNCryptor(); byte[] plaintext = teststring.getBytes(); String password = "test"; try { byte[] ciphertext = cryptor.encryptData(plaintext, password.toCharArray()); String a = new String(ciphertext); return a; } catch (CryptorException e) { // Something went wrong e.printStackTrace(); return "0"; } However, when I send my string "a" to the server, it has a bunch of unrecognizable characters. I read an explanation regarding this: String is not a suitable container for binary data and ciphertext is binary data. For any given character encoding not all bytes and byte sequences represents characters and when an un-representable byte or sequence is found it is converted to some error character. Obviously this error character cannot be converted back to a unique byte or byte sequence (it is a many->one mapping). Is this advice correct? In that case, how do I convert the byte[] to a string correctly? So that I can readably store it on my server?
answer count: 1
has title: Convert byte[] to String Java Android Encryption
score: 0
upvote count: 1
tagged with: android
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
tagged with: jncryptor

http://stackoverflow.com/a/24882660
accepted answer of: http://stackoverflow.com/q/24882515
score: 1
answers question: http://stackoverflow.com/q/24882515
upvote count: 1
has body: If the user is uploading a file to your servlet, the file is contained in the request body, it's not on any path on the server. The path on the end user's client machine is irrelevant (and you can't access it anyway, not even client-side). There's a Java EE 6 tutoral on file upload here: http://docs.oracle.com/javaee/6/tutorial/doc/glraq.html Fundamentally (from that example), if the field used for upload has the name file, you do this in your servlet: final Part filePart = request.getPart("file"); InputStream filecontent = null; and then later within a try/catch: filecontent = filePart.getInputStream(); ...and use the data from the stream. Here's the source from the tutorial above (in case it's inaccessible when someone's reading this later). In this case, it's writing the file out to a file server-side, but in your case of course you would populate your imageData (which I take it you then put in a DB) instead. @WebServlet(name = "FileUploadServlet", urlPatterns = {"/upload"}) @MultipartConfig public class FileUploadServlet extends HttpServlet { private final static Logger LOGGER = Logger.getLogger(FileUploadServlet.class.getCanonicalName()); protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); // Create path components to save the file final String path = request.getParameter("destination"); final Part filePart = request.getPart("file"); final String fileName = getFileName(filePart); OutputStream out = null; InputStream filecontent = null; final PrintWriter writer = response.getWriter(); try { out = new FileOutputStream(new File(path + File.separator + fileName)); filecontent = filePart.getInputStream(); int read = 0; final byte[] bytes = new byte[1024]; while ((read = filecontent.read(bytes)) != -1) { out.write(bytes, 0, read); } writer.println("New file " + fileName + " created at " + path); LOGGER.log(Level.INFO, "File{0}being uploaded t…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38650579
has comment: http://stackoverflow.com/comment/38651668
type: Answer

http://stackoverflow.com/comment/39515469
comment on: http://stackoverflow.com/a/25344191
type: AnswerComment
score: 0
type: Comment
has text: "All OS's and most device drivers are written in C for performance reasons." And that is not true.

http://stackoverflow.com/comment/38440586
type: QuestionComment
comment on: http://stackoverflow.com/q/24771788
score: 0
type: Comment
has text: Better you take others' advice and switch to javascript. Unless you want to hide the way you are generating random card. JavaScript code is open to world.

http://stackoverflow.com/comment/38593850
has text: Ok but how i declarate a List of int?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24853250
type: AnswerComment

http://stackoverflow.com/a/24907385
type: Answer
answers question: http://stackoverflow.com/q/24907280
has body: The problem in your case is the += operator. What do you += on if the variable is not initialized? You probably want to initialize the value to "".
score: 0

http://stackoverflow.com/comment/38666229
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24891269
has text: I think the problem is here : `Mode.MULTIPLY` if i change the mode it change the colors.. always 2 anyway
score: 0

http://stackoverflow.com/a/25665610
accepted answer of: http://stackoverflow.com/q/24844399
upvote count: 5
downvote count: 0
has body: It appears that the dependency com.google.code.findbugs:jsr305 is missing when Eclipse runs the annotation processor. Try adding it by opening the project properties, browsing to Java Compiler -> Annotation Processing -> Factory Path, clicking on "Add External JARs" and then selecting the jsr305 JAR. If you have built the project with maven from the command line, you should be able to select the JAR from your .m2 directory. Here's what the proprties look like in my project (the first entry is automatically added by Eclipse and doesn't seem to be relevant): In the pom.xml in version 1.0-rc1 of AutoValue, there is a comment "Must have this where procesor runs" at the jsr305 dependency. The dependency was removed after the release of 1.0-rc1, so adding it to the annotation processor factory path will probably not be necessary with version 1.0. See also this blog post for an introduction to using AutoValue with Eclipse.
answers question: http://stackoverflow.com/q/24844399
score: 5
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/38601096
comment on: http://stackoverflow.com/q/24857104
score: 0
type: QuestionComment
has text: Use a `DateTimeFormatter`
type: Comment

http://stackoverflow.com/q/24887490
has comment: http://stackoverflow.com/comment/38658301
has comment: http://stackoverflow.com/comment/38658380
tagged with: java
has comment: http://stackoverflow.com/comment/38658170
has answer: http://stackoverflow.com/a/24887573
type: Question
tagged with: http://stackoverflow.com/tag/json
has title: How to read json file (array form) using simple JSON library?
has body: Actually, The example below is an answer somewhere in StackOverFlow. I tried to use the below code, but, JSONArray a = (JSONArray) parser.parse(new FileReader("c:\\exer4-courses.json")); Above line doesn't work because of the below Exception. java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to org.json.simple.JSONArray Is there any way to read my JSON file? JSON file: [ { "name": "John", "city": "Berlin", "cars": [ "audi", "bmw" ], "job": "Teacher" }, { "name": "Mark", "city": "Oslo", "cars": [ "VW", "Toyata" ], "job": "Doctor" } ] Java code: JSONArray a = (JSONArray) parser.parse(new FileReader("c:\\exer4-courses.json")); for (Object o : a) { JSONObject person = (JSONObject) o; String name = (String) person.get("name"); System.out.println(name); String city = (String) person.get("city"); System.out.println(city); String job = (String) person.get("job"); System.out.println(job); JSONArray cars = (JSONArray) jsonObject.get("cars"); for (Object c : cars) { System.out.println(c + ""); } }
score: 0
tagged with: arrays
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/38411984
score: 0
has text: -1 This question is not about hibernate and not about spring-mvc- it is about displaying elements of a collection in a JSP page - and has been answered a couple of times already.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24757140

http://stackoverflow.com/q/24851886
score: 7
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/25146558
upvote count: 7
tagged with: unit-testing
has title: How to unit test that a JavaFX application launches
type: Question
answer count: 2
tagged with: javafx-8
has body: I've got a JavaFX application, and I want to test if it launches or not. How would I go about doing that? Is it possible with just JUnit, or can TestFX help me in that? My main issue is: How do I shut down the application right after it has (succesfully) launched? Example application class: public class MovieDB extends Application { @Override public void start(final Stage primaryStage) throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(MovieDBController.class.getResource("MovieDB.fxml"), ResourceBundle.getBundle("bundles/bundle", new Locale("en"))); Parent root = fxmlLoader.load(); Scene scene = new Scene(root, 1024, 768); StyleManager.getInstance().addUserAgentStylesheet(getClass().getResource("/css/MovieDB.css").getPath()); primaryStage.setTitle("MovieDB"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
downvote count: 0
favorite count: 0
tagged with: testfx
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/42099278

http://stackoverflow.com/a/25555117
score: 0
has body: JBoss is not compatible with Eclipse Luna.
type: Answer
answers question: http://stackoverflow.com/q/24799162

http://stackoverflow.com/comment/38573807
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24842550
has text: I have done all that. The problem is the actual construction of the grid.

http://stackoverflow.com/a/24782527
score: 1
answers question: http://stackoverflow.com/q/24777242
type: Answer
upvote count: 1
downvote count: 0
has body: This onClick handler works for me. onclick="setTimeout(function(){window.location.href='test.html'},100)" You can put it in your anchor tag that calls your servlet and the encapsulated anonymous function can call any other function you like. 'test.html' could be a page that says "Your file is being prepared and will download shortly. The content type of the response on the servlet should match the file type you are pushing so that the browser knows to download the file rather than try to open it.

http://stackoverflow.com/comment/38591893
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24850110
has text: @Rajnish Mishra figured out what was that difference. The reason it worked on your PC and not on my.

http://stackoverflow.com/comment/38404887
comment on: http://stackoverflow.com/a/24753306
score: 0
type: AnswerComment
has text: This is a not very elegant way of putting a double in a String variable
type: Comment

http://stackoverflow.com/comment/38653545
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24884733
type: QuestionComment
has text: I edited and added a comment on @laune reply. The downvote are faster than the clarification question... LOL :D

http://stackoverflow.com/comment/38443111
type: QuestionComment
score: 0
has text: Never waste time thinking about these things unless you are observing some kind of problem. Java is _very_ good at allocating and deallocating objects and references fast.
type: Comment
comment on: http://stackoverflow.com/q/24773762

http://stackoverflow.com/comment/38572655
score: 0
has text: No I want to make sure the text field doesn't get covered by the background. Right now I add the text field when the user clicks a certain button, but it gets covered up right away by the background. What I'm asking is if there is a way to keep the JTextField in the foreground so it isn't being painted over by the background.
type: Comment
comment on: http://stackoverflow.com/a/24842298
type: AnswerComment

http://stackoverflow.com/q/24875434
has answer: http://stackoverflow.com/a/24875525
has title: How to use reference with custom attributes?
has comment: http://stackoverflow.com/comment/38636026
has body: I have defined a custom widget (MyWidget) res/layout/mywidget.xml res/values/attrs.xml code &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;declare-styleable name="my_widget"&gt; &lt;attr name="maxValueFromTextId" format="reference"/&gt; &lt;/declare-styleable&gt; &lt;/resources&gt; MyWidget.java into I would like retrieve the reference object describe by maxValueFromTextId. This object to me is a TextView which are not into this widget &lt;RelativeLayout &lt;TextView android:id="@+id/text1" /&gt; &lt;Mywidget maxValueFromTextId="@id/text1" /&gt; /&gt; So what to do in MyWidget.java to get TextView reference object ? I read this useful article: Defining custom attrs Thanks
type: AnsweredQuestion
upvote count: 0
favorite count: 0
tagged with: attributes
type: Question
accepted answer: http://stackoverflow.com/a/24875525
tagged with: android
score: -1
linked to: http://stackoverflow.com/q/3441396
has comment: http://stackoverflow.com/comment/38636570
tagged with: java
has comment: http://stackoverflow.com/comment/38636650
answer count: 1
downvote count: 1

http://stackoverflow.com/a/24812869
has comment: http://stackoverflow.com/comment/38517512
has comment: http://stackoverflow.com/comment/38520613
score: 0
has comment: http://stackoverflow.com/comment/38517159
type: Answer
answers question: http://stackoverflow.com/q/24812155
has body: Found the solution! Apparently I wasn't the only one that came up with this question, I just didn't word it quite the same. Here's the best solution (and it does use the Call Hierarchy in Eclipse, thanks Raedwald!)

http://stackoverflow.com/q/24778468
accepted answer: http://stackoverflow.com/a/24780826
has answer: http://stackoverflow.com/a/60665683
has comment: http://stackoverflow.com/comment/38451721
tagged with: testng
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has body: How to count number of images available on a web page using selenium webdriver? The web page contains a lots of image some are visible and some are hidden (display:none). I only wants to count images which are visible(not hidden). I tried this but it doesn't work for only visible images. @Test public void imagetest() { driver.get("http://uat.tfc.tv/"); List&lt;WebElement&gt; listwebelement = driver.findElements(By.className("img-responsive")); int i=0; for (WebElement Element : listwebelement) { i = i+1; System.out.println(Element.getTagName()); System.out.println(Element.getText()); String link = Element.getAttribute("alt"); System.out.println(link); } System.out.println("total objects founds " + i); }
type: Question
has title: How to count number of images available on a web page using selenium webdriver?
has answer: http://stackoverflow.com/a/24780826
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/38452274
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/24779008
favorite count: 0
has answer: http://stackoverflow.com/a/24779008

http://stackoverflow.com/a/24831055
answers question: http://stackoverflow.com/q/24830610
type: Answer
upvote count: 22
score: 21
has comment: http://stackoverflow.com/comment/59740949
has body: just change in settings.xml these as aliteralmind says: nexus-snapshots MY_SONATYPE_DOT_COM_USERNAME MY_SONATYPE_DOT_COM_PASSWORD you probably need to get the username / password from sonatype dot com.
downvote count: 1

http://stackoverflow.com/q/24780521
has body: I have problem with Jmeter variables. My sampler sending two files per request. I created many files with names like data1, metadata1. I get those files in such a way: C:\fake_documents\data${__counter(false, data_counter)} C:\fake_documents\metadata${__counter(false, meta_counter)} This working as well, but sometimes i have problem with counters e.g. data10, metadata11 As the final solution, it's unacceptable Is a way to synchronize those two counters ?
tagged with: java
has comment: http://stackoverflow.com/comment/38455729
upvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38455927
has answer: http://stackoverflow.com/a/52320880
score: 2
tagged with: jmeter
has title: Jmeter variables synchronization
downvote count: 0
type: UnansweredQuestion
tagged with: jetty
has comment: http://stackoverflow.com/comment/38456603
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/38457210

http://stackoverflow.com/a/24823855
has body: One thread (first) acquires a lock on the object, and another thread waits for getting lock of that object. Once task is done, first thread sends notification to waiting threads using notify() and notifyAll() methods.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24823802

http://stackoverflow.com/a/24782339
upvote count: 3
has comment: http://stackoverflow.com/comment/38460166
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24782252
has body: Execute your statements in a Thread and then let your code join on this thread with a timeout: Thread runnableThread = new Thread(yourRunnable); runnableThread.start(); runnableThread.join(executionTimeout); To check if the thread finished with a timeout, call Thread.isAlive().

http://stackoverflow.com/comment/132282699
type: AnswerComment
has text: This is lacking the most important thing; `exhaustive` feature. Without it, it does not even make any sense to create such workaround
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24808584

http://stackoverflow.com/comment/38530450
type: AnswerComment
comment on: http://stackoverflow.com/a/24819948
has text: what javadoc says - A week year is in sync with a WEEK_OF_YEAR cycle. All weeks between the first and last weeks (inclusive) have the same week year value. Therefore, the first and last days of a week year may have different calendar year values.
type: Comment
score: 0

http://stackoverflow.com/comment/38544743
has text: Java carries an initial performance overhead but the JVM can optimize during runtime to perform better than C/C++. See http://stackoverflow.com/questions/538056/jit-compiler-vs-offline-compilers
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24827528
score: 0

http://stackoverflow.com/comment/38545079
score: 1
has text: Java does paging with the GC; it is slow. http://publib.boulder.ibm.com/infocenter/javasdk/tools/index.jsp?topic=%2Fcom.ibm.java.doc.igaa%2F_1vg0001143f2181-11a9b04924e-7ffc_1001.html
type: AnswerComment
comment on: http://stackoverflow.com/a/24827528
type: Comment

http://stackoverflow.com/a/24895869
score: 1
answers question: http://stackoverflow.com/q/24895847
downvote count: 0
has comment: http://stackoverflow.com/comment/38675242
has comment: http://stackoverflow.com/comment/38675770
has comment: http://stackoverflow.com/comment/38674721
type: Answer
upvote count: 1
has body: public static Double expm(Double A[][]) { return expm(A); } This just calls itself over and over and over until the stack overflows.

http://stackoverflow.com/a/24791743
score: 0
type: Answer
has body: Fixed it. Should have been a POST to /Users/ rather than a GET from /Login/. Sharing incase anyone else runs into this. private class ParseLogin extends AsyncTask { JSONObject authData; JSONObject wrapper; @Override protected void onPreExecute() { try { authData = new JSONObject(); wrapper = new JSONObject(); JSONObject twitterAuth = new JSONObject(); twitterAuth.put("id", Long.toString(twitterUser.getId())); twitterAuth.put("screen_name", twitterUser.getScreenName()); twitterAuth.put("consumer_key", CONSUMER_KEY); twitterAuth.put("consumer_secret", CONSUMER_SECRET); twitterAuth.put("auth_token", accessToken.getToken()); twitterAuth.put("auth_token_secret", accessToken.getTokenSecret()); authData.put("twitter", twitterAuth); wrapper.put("authData", authData); } catch (JSONException e) { e.printStackTrace(); } } @Override protected Boolean doInBackground(String... args) { // Send the HttpPostRequest and receive a JSONObject in return JSONObject jsonObjRecv = JSONRequest.SendHttpGet("https://api.parse.com/1/users/", wrapper); return true; } @Override protected void onPostExecute(Boolean response) { } And then the Get (which is actually a post, just need to changed the method name) public static JSONObject SendHttpGet(String URL, JSONObject jsonObjSend) { try { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpPostRequest = new HttpPost(URL); StringEntity se; se = new StringEntity(jsonObjSend.toString()); // Set HTTP parameters httpPostRequest.setEntity(se); httpPostRequest.setHeader("X-Parse-Application-Id", APP ID); httpPostRequest.setHeader("X-Parse-REST-API-Key", REST API KEY); httpPostRequest.setHeader("Accept", "application/json"); httpPostRequest.setHeader("Content-type", "application/json"); //httpPostRequest.setHeader("Accept-Encoding", "gzip"); // only set this parameter if you would like to use gzip compression long t = System.currentTimeMillis(); HttpResponse response = (HttpResponse) httpclient.execute(httpPostRequest); Log.i(TAG, "HTTPR…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24790870
answers question: http://stackoverflow.com/q/24790870
has comment: http://stackoverflow.com/comment/38477814

http://stackoverflow.com/a/24807680
has comment: http://stackoverflow.com/comment/38507594
answers question: http://stackoverflow.com/q/24807573
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38507387
has comment: http://stackoverflow.com/comment/38507285
upvote count: 2
has comment: http://stackoverflow.com/comment/38509185
accepted answer of: http://stackoverflow.com/q/24807573
has comment: http://stackoverflow.com/comment/38508766
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38508710
has comment: http://stackoverflow.com/comment/38507160
has body: I am trying to sort this by what is after the second decimal by that order. You can write your own Comparator: enum MyStringComparator implements Comparator&lt;String&gt; { INSTANCE; @Override public int compare(String s1, String s2) { int n1 = Integer.parseInt(s1.split("\\.")[2]); int n2 = Integer.parseInt(s2.split("\\.")[2]); return Integer.compare(n1, n2); } } And now: String[] numbers = { "2.1.0.0", "2.1.1.0", "2.1.11.0", "2.1.12.0", "2.1.13.0", "2.1.14.0", "2.1.15.0", "2.1.2.0", "2.1.3.0", "2.1.4.0", "2.1.5.0", "2.1.6.0", "2.1.7.0", "2.1.8.0", "2.1.9.0" }; Arrays.sort(numbers, MyStringComparator.INSTANCE); for (String number : numbers) { System.out.println(number); } 2.1.0.0 2.1.1.0 2.1.2.0 2.1.3.0 2.1.4.0 2.1.5.0 2.1.6.0 2.1.7.0 2.1.8.0 2.1.9.0 2.1.11.0 2.1.12.0 2.1.13.0 2.1.14.0 2.1.15.0 I'll leave it to you to incorporate any error-checking mechanism that you may need. In Java 8 it's a lot easier: Arrays.sort(numbers, Comparator.comparingInt(s -&gt; Integer.parseInt(s.split("\\.")[2])));
has comment: http://stackoverflow.com/comment/38509322

http://stackoverflow.com/a/24849713
type: Answer
answers question: http://stackoverflow.com/q/24849513
has body: Remove Z from date string and it should work.
score: 0
has comment: http://stackoverflow.com/comment/38586351

http://stackoverflow.com/a/24868773
has body: I think my question is a bit imprecise, so I will close it. I made the mistake trying to access @ApiOperation attributes but reading the @ApiParams instead. To clarify my actual need, I opened up a separate question https://stackoverflow.com/questions/24868665/accessing-attribute-hidden-of-apioperation-annotation-in-swagger.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24866028

http://stackoverflow.com/q/24895144
type: AnsweredQuestion
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/24902078
type: Question
tagged with: java
tagged with: http-parameters
tagged with: jsoup
has title: Prevent Jsoup to fetch Http response
answer count: 1
accepted answer: http://stackoverflow.com/a/24902078
downvote count: 0
has comment: http://stackoverflow.com/comment/38678327
favorite count: 0
has comment: http://stackoverflow.com/comment/38679090
has body: I'm using HTTP parameters to send a query to a server and fetch the results. I use Jsoup and send my parameters in the URL: String doc = Jsoup.connect("http://server.com/query?a=x").execute().body(); However, in some cases, I don't want the results. I just want to send the parameter to the server and ignore the response. Is there anyway to prevent Jsoup to download the response? Is there any other way to send HTTP URL parameters to the server without downloading the response?

eclipse-virgo
tag name: eclipse-virgo
tags question: http://stackoverflow.com/q/24844369
type: Tag

http://stackoverflow.com/q/24801638
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24801826
has body: I have converted a String input into a character array by using toCharArray. Now I want to do the same thing without using toCharArray. How can I do it? import java.util.*; public class cArray{ public static void main(String[]args){ Scanner input = new Scanner(System.in); System.out.println("Please Give A String"); String s1 = input.nextLine(); char[]data = s1.toCharArray(); } }
has comment: http://stackoverflow.com/comment/38495888
has answer: http://stackoverflow.com/a/24801708
has title: convert a string into a character array
has comment: http://stackoverflow.com/comment/38496086
tagged with: char
answer count: 3
has answer: http://stackoverflow.com/a/24801793
has comment: http://stackoverflow.com/comment/38495957
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/38495642
favorite count: 0
possible better answer: http://stackoverflow.com/a/24801793
has comment: http://stackoverflow.com/comment/38495779
accepted answer: http://stackoverflow.com/a/24801708
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38495994
upvote count: 2
score: 1
tagged with: java

http://stackoverflow.com/q/24817584
score: 1
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24817671
has title: How to trigger key press event explicitly on button click java
tagged with: java
tagged with: key-events
answer count: 1
downvote count: 0
tagged with: button
accepted answer: http://stackoverflow.com/a/24817671
tagged with: keyboard
favorite count: 0
has body: Is there any mechanism to trigger key press event explicitly when button click. When I click a button named in java UI "+" it will explicitly trigger "+" key press event.
tagged with: events
type: AnsweredQuestion

http://stackoverflow.com/comment/38695517
type: Comment
comment on: http://stackoverflow.com/a/24907175
has text: The delegation pattern is exactly what I need. Are there AOP alternatives? I've seen several classes in Spring that have empty bodies, but still appear to contain methods. I wonder how they do it...
score: 0
type: AnswerComment

http://stackoverflow.com/a/24895558
has body: I've done something like what you want. try and see if it can help you. public class YourActivity extends Activity { private ListView l; public void onCreate(Bundle saveInstanceState) { setContentView(R.layout.your_layout); l = (ListView) findViewById(R.id.your_list_view_id); List&lt;String&gt; your_array_list = new ArrayList&lt;String&gt;(); your_array_list.add("foo"); your_array_list.add("bar"); ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;( this, android.R.layout.simple_list_item_1, your_array_list ); l.setAdapter(arrayAdapter); } }
type: Answer
answers question: http://stackoverflow.com/q/24895403
score: 0

http://stackoverflow.com/q/24772626
upvote count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/24772675
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24772698
tagged with: eclipse
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24772705
has answer: http://stackoverflow.com/a/24772691
accepted answer: http://stackoverflow.com/a/24772698
has body: Brand new to android development and I wanted to test some new code that I was working on. So I launched the my app on the emulator and the splash screen loads fine.However after the 5 second timer finishes the app crashes. This is my Manifest file <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.SET_WALLPAPER" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.PackageName.AlarmClock.MENU" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.PackageName.AlarmClock.ASDF" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.PackageName.AlarmClock.TextPlay" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.PackageName.AlarmClock.Email" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.PackageName.AlarmClock.Camera" /> <category android:name="android.intent.category.LAUNCHER" /> Here is my splash.java OnCreate is dashed out in eclipse and I don't know why and if that is the reason for the crashing package com.PackageName.alarmclock; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; public class Splash extends Activity{ MediaPlayer ourSong; @Override @Deprecated protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); ourSong = MediaPlayer.create(Splash.this, R.raw.splashsound); ourSong.start(); Thread timer = new Thread(){ public void run(){ try{ sleep(5000); } catch (InterruptedException e){ e.printStackTrace(); }finally{ Intent openMainActivity = new Intent("com.PackageName.AlarmClock.MENU"); startActivity(openMainActivity); } } }; timer.start(); } @Override protected void onPause() { //…
has title: App crashes after splash screen
has comment: http://stackoverflow.com/comment/38441112
has answer: http://stackoverflow.com/a/24772675
favorite count: 0

http://stackoverflow.com/comment/38703042
type: Comment
has text: I do understand your theory but since I'm using Play 2.3.2 and the new Activator command line tool, I'm not sure of how achieve this with this setup. Perhaps you can enlighten me? I didn't install play directly, I rather used SBT to import it.
comment on: http://stackoverflow.com/a/24850694
type: AnswerComment
score: 0

google-api-client
tags question: http://stackoverflow.com/q/24784945
tag name: google-api-client
type: Tag

http://stackoverflow.com/comment/38433747
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24768353
has text: The formatting fixes made a big improvement in readability; thanks.
score: 1

http://stackoverflow.com/comment/38685496
score: 0
has text: I tried following this format and it seemed like it just wanted me to add throws IOEXception and InterruptedException onto my main method, which makes me think that it's just going to bomb out in main again anyways. Also the concerns about the stack overflow-- what would be necessary to clear out in order to avoid that? is there a simple way to write a clearJunk() method to re-initialize everything?
type: Comment
comment on: http://stackoverflow.com/a/24901633
type: AnswerComment

http://stackoverflow.com/q/24838329
has body: I have tried to use a SQLite db by copying it from asset folder to device. I have also checked using DDMS if db is being copied or not. Everything was fine but when I opened my copied db no tables were present inside it i.e. it was a blank db. Please help me how to copy db along with its tables. This is my DBHelper class:- public class DBHelper extends SQLiteOpenHelper { private static String DB_NAME = "collegeDb2"; private SQLiteDatabase db; private final Context context; private String DB_PATH; public DBHelper(Context context) { super(context, DB_NAME, null, 1); this.context = context; DB_PATH = context.getApplicationInfo().dataDir + "/databases/"; } public void createDataBase() throws IOException { boolean dbExist = checkDataBase(); if (dbExist) { } else { this.getReadableDatabase(); try { copyDataBase(); } catch (IOException e) { throw new Error("Error copying database"); } } } private boolean checkDataBase() { File dbFile = new File(DB_PATH + DB_NAME); return dbFile.exists(); } private void copyDataBase() throws IOException { InputStream myInput = context.getAssets().open(DB_NAME); String outFileName = DB_PATH + DB_NAME; OutputStream myOutput = new FileOutputStream(outFileName); byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) &gt; 0) { myOutput.write(buffer, 0, length); } // Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } public Cursor getColleges() { String myPath = DB_PATH + DB_NAME; db = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); Cursor c = db.rawQuery("SELECT * FROM collegeslist", null); // Note: colleges is the one table in External db. Here we trying to access the records of table from external db. return c; } public Cursor getProducts() { String myPath = DB_PATH + DB_NAME; db = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); Cursor d = db.rawQuery("SELECT * FROM productslist", null); // Note: products is the one table in External db. Here we…
tagged with: java
tagged with: database
has title: Copy db from assets to db folder in device memory
score: 0
has comment: http://stackoverflow.com/comment/38564842
answer count: 2
tagged with: sqlite
has answer: http://stackoverflow.com/a/24838473
tagged with: android
has comment: http://stackoverflow.com/comment/38564759
has comment: http://stackoverflow.com/comment/38565037
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38564790
possible better answer: http://stackoverflow.com/a/24838473
has answer: http://stackoverflow.com/a/25052240
has comment: http://stackoverflow.com/comment/38564677
accepted answer: http://stackoverflow.com/a/25052240
type: Question
has comment: http://stackoverflow.com/comment/38564717
has comment: http://stackoverflow.com/comment/38564830

http://stackoverflow.com/q/24772621
score: 1
has body: Could anyone please explain what is the necessity of annotations in java? OR Let me put it more specifically as 'What would have happened if there were annotations in java?'. I have often seen @Override annotation used extensively. But code can compile even without this annotation then what is it's need? I do understand this makes code less prone to spell mistakes but are annotations optional in general?
tagged with: java
tagged with: annotations
upvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/1372876
has comment: http://stackoverflow.com/comment/38441739
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38597592
favorite count: 0
linked to: http://stackoverflow.com/q/1372876
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24773115
has title: Necessity of Annotation in Java

http://stackoverflow.com/comment/38562030
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24822228
has text: Thanks for the reply and yes I have GWT libraries in the lib folder. do i require to add them anywhere in the JBoss AS 7.1 directories as well?

http://stackoverflow.com/comment/38592139
type: AnswerComment
has text: I removed the @Remote annotation from the service bean, but still the same exception occurs.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24851716

http://stackoverflow.com/comment/38424477
comment on: http://stackoverflow.com/q/24763823
type: Comment
type: QuestionComment
has text: what do you do inside display text method? Where is the problem here?
score: 0

http://stackoverflow.com/q/24888009
tagged with: gradle
type: Question
tagged with: automation
has comment: http://stackoverflow.com/comment/38661783
has title: How to define re-run task in cucumber using gradle?
upvote count: 1
has comment: http://stackoverflow.com/comment/38671645
tagged with: cmd
linked to: http://stackoverflow.com/q/48815890
favorite count: 0
linked to: http://stackoverflow.com/q/11719898
has body: I have seen this post on how to re-run failed tasks in cucumber. I'm using jenkins IC and gradle as build tool. How would you create a re-run task? Using gradle task? What syntax is used in my build.gradle today? Shell script? run { args += ['-f', 'html:build/reports/cucumber/', '-f', 'json:build/reports/cucumber/report.json', '--glue', 'com.waze.testing.cucumber', 'src/main/resources/features', '--tags', '~@ignore'] } Writing python scrip? The problem is I don't remember python. Using any jenkins cucumber plugin? (I have this plug in, but didn't see any helpful step)
linked to: http://stackoverflow.com/q/24895370
has comment: http://stackoverflow.com/comment/38689105
answer count: 0
downvote count: 0
tagged with: jenkins
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/84635682

http://stackoverflow.com/comment/43665592
type: AnswerComment
has text: FYI: I was getting the same error but in my case I was pointing it to the bin folder in my Java_Home path. Once I changed it to its parent folder to C:\Program Files\Java\jdk1.8.0_25, everything went smooth.
type: Comment
score: 14
comment on: http://stackoverflow.com/a/25054118

http://stackoverflow.com/q/24796435
has comment: http://stackoverflow.com/comment/57186678
has comment: http://stackoverflow.com/comment/38486432
has title: No adapter for handler in spring
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38488468
linked to: http://stackoverflow.com/q/32905917
type: Question
has body: I'm trying to change url-patter in dispather servler mapping: dispatcher-servlet.xml: indexController <context:component-scan base-package="Controllers"/> <mvc:annotation-driven/> Chunk of web.xml: dispatcher org.springframework.web.servlet.DispatcherServlet 2 dispatcher / and Controller: @Controller public class SaleController { @RequestMapping(value = "/sales/info", produces = "application/json", headers = "") public @ResponseBody Product getProductJson(@RequestParam String id) throws SQLException { ProductDAO mapping = new ProductDAOImpl(); Product product = mapping.getProductById(Integer.parseInt(id)); return product; } } But when I'm trying to get http://localhost:8080/appk/sales/info I have exception: javax.servlet.ServletException: No adapter for handler [Controllers.SaleController@15370df]: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:1144) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52 What exactly handler I need to configure and how it can be done?
score: 0
linked to: http://stackoverflow.com/q/3896013
has comment: http://stackoverflow.com/comment/38486397
has comment: http://stackoverflow.com/comment/38486515
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/24897276
type: Question
has comment: http://stackoverflow.com/comment/38676951
has answer: http://stackoverflow.com/a/24897360
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38676993
has title: Search without iterator for Map
has comment: http://stackoverflow.com/comment/38678877
has comment: http://stackoverflow.com/comment/38676934
downvote count: 5
score: -4
has body: Is it possible to search without iterator without using map. Map&lt;String,Short&gt; map = new HashMap&lt;String,Short&gt;(); map.put("String2", (short)2); map.put("String1", (short)1); map.put("String3", (short)4); I am looking for a way to get the value based on the key (Return 2 for value String2). Is Map the right one to use in this scenario. Thanks !
has comment: http://stackoverflow.com/comment/38676927
has comment: http://stackoverflow.com/comment/38676943
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24897360
tagged with: java

http://stackoverflow.com/q/24893738
has answer: http://stackoverflow.com/a/24913941
has body: I have a REST api that returns an object in json format, with Content-Type of application/json, pretty standard. I'm creating a basic TestNg Jersey test using Jersey's test framework, and want to run a simple test against an external container deployed independently in Tomcat. The setup seems OK for tests that don't need to read the entity of a response, but those that do fail with: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=application/json, type=class com.test.Status, genericType=class com.specktro.orchid.rest.api.Status. at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:225) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:149) at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1124) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:851) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:783) at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:326) at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:111) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:228) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:399) at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:108) at com.specktro.orchid.rest.api.tests.CoreTest.test(CoreTest.java:81) at com.specktro.orchid.rest.api.tests.CoreTest.second(CoreTest.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.refl…
accepted answer: http://stackoverflow.com/a/24913941
downvote count: 0
tagged with: jersey-client
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/24903668
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38681459
tagged with: jersey
tagged with: jersey-2.0
has title: Jersey test keeps failing with MessageBodyReader not found when reading entity?
favorite count: 0
upvote count: 3
tagged with: rest
possible better answer: http://stackoverflow.com/a/24903668

http://stackoverflow.com/q/24779440
accepted answer: http://stackoverflow.com/a/24799445
type: AnsweredQuestion
score: 3
has title: Efficient way to search records from an excel file using Apache-POI
upvote count: 3
tagged with: java
type: Question
answer count: 2
tagged with: database
downvote count: 0
possible better answer: http://stackoverflow.com/a/24780847
has answer: http://stackoverflow.com/a/24799445
has answer: http://stackoverflow.com/a/24780847
favorite count: 0
has body: I am creating a web application which allows you to search some records from excel sheets.Excel sheets which need to be searched is a large one , it has 100k rows and 500 columns. What approach should be use for this? I just want to allow users to perform search on this excel sheet,SO should I use database for it(for it first I need to set excel sheet values in database)? Or Is there any other better approach than this? Does Apache POI provides any such direct method for searching excel files? What will be most efficient approach for this scenario.Help with respective links will be appreciated
tagged with: apache-poi

http://stackoverflow.com/q/24811428
type: UnansweredQuestion
tagged with: swing
has body: I want to make a big form with Jgoodies FormLayout. I have learn recently how to make forms without a GUI builder, but this form is so big that everytime i have to make a change it takes me a while. So i was wondering if there is a free GUI builder for Eclipse and how can i add it?
answer count: 0
has comment: http://stackoverflow.com/comment/38514686
tagged with: java
tagged with: forms
type: Question
linked to: http://stackoverflow.com/q/5621338
has title: Free GUI builder to make Jgoodies Forms
score: 0
tagged with: jgoodies
has comment: http://stackoverflow.com/comment/38514918

http://stackoverflow.com/comment/38478743
type: AnswerComment
comment on: http://stackoverflow.com/a/24772381
has text: thx it worked well but when i remove some lines from the collection and i repaint it doesn't update the modifications any suggestions too ?
type: Comment
score: 0

http://stackoverflow.com/comment/38653504
score: 0
comment on: http://stackoverflow.com/q/24884366
type: Comment
type: QuestionComment
has text: Thank guys, the HelloFreemarket.class.getResource("../..").getPath() line gave me the correct String variable to use as argument with new File() object creation.

http://stackoverflow.com/comment/38522036
comment on: http://stackoverflow.com/q/24815014
has text: Thanks for your reply. In part, I am confused by http://www.oracle.com/technetwork/java/painting-140037.html#awt_summary , namely by the following "_For most programs, all client paint code should be placed within the scope of the component's paint() method._"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38609170
type: AnswerComment
comment on: http://stackoverflow.com/a/24860817
type: Comment
has text: Note that performance won't suffer even if you go much lower, say a 100. Any querying overhead doesn't amount to much when diluted by a factor of 100.
score: 0

http://stackoverflow.com/q/24889141
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38661683
has comment: http://stackoverflow.com/comment/38662226
has title: Changing Scriplet to Servlet simple case
tagged with: java
has body: I have a question I have really simple scriplet code to retrive data from database and then plot it on the graph. Should I consider to change that code to servlet? Here is the code: <% int sum=0; int all=0; int userID=-1; int EcimNum=0; int CommNum=0; int AppNum=0; int InstNum=0; String connectionURL = "jdbc:mysql://localhost:3306/imf_jsp"; Connection connection = null; PreparedStatement st; ResultSet rs = null; Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "root", ""); if(!connection.isClosed()) { st = connection.prepareStatement("SELECT * FROM user WHERE signum = ?"); //Find user with given username & pass st.setString(1, session.getAttribute("username").toString());//Bind param (Should prevent SQL Injection? Not sure but it is working in PHP with PDO) st.execute();//statemant execution rs = st.getResultSet(); if(rs.next()){ userID = rs.getInt("id");//If not then check in LDAP } } st = connection.prepareStatement("SELECT COUNT(*) FROM model INNER JOIN user ON model.user_id=user.id WHERE model_type='ECIM' AND user.id = ?" ); st.setInt(1, userID); st.execute(); rs = st.getResultSet(); if(rs.next()){ EcimNum = rs.getInt("COUNT(*)");//If not then check in LDAP System.out.println(EcimNum); sum+=EcimNum; } st = connection.prepareStatement("SELECT COUNT(*) FROM model INNER JOIN user ON model.user_id=user.id WHERE model_type='Common' AND user.id = ?"); st.setInt(1, userID); st.execute(); rs = st.getResultSet(); if(rs.next()){ CommNum = rs.getInt("COUNT(*)");//If not then check in LDAP System.out.println(CommNum); sum+=CommNum; } st = connection.prepareStatement("SELECT COUNT(*) FROM model INNER JOIN user ON model.user_id=user.id WHERE model_type='Application' AND user.id = ?"); st.setInt(1, userID); st.execute(); rs = st.getResultSet(); if(rs.next()){ AppNum = rs.getInt("COUNT(*)");//If not then check in LDAP System.out.println(AppNum); sum+=AppNum; } st = connection.prepareStatement("SELECT COUNT(*) FROM mod…
tagged with: scriptlet
type: Question
tagged with: jstl
tagged with: jsp
tagged with: servlets
score: 0
has answer: http://stackoverflow.com/a/24889435

http://stackoverflow.com/comment/38449378
comment on: http://stackoverflow.com/q/24776601
type: Comment
type: QuestionComment
has text: You can use one activity class and start it x times
score: 0

http://stackoverflow.com/comment/38643171
score: 0
has text: Probably yes, but this wasn't the question.
type: AnswerComment
comment on: http://stackoverflow.com/a/24873876
type: Comment

http://stackoverflow.com/a/24806352
has body: Here is a way to get the id of a TimeZone that matches your local system clock's offset, Calendar cal = Calendar.getInstance(); long milliDiff = cal.get(Calendar.ZONE_OFFSET); // Got local offset, now loop through available timezone id(s). String [] ids = TimeZone.getAvailableIDs(); String name = null; for (String id : ids) { TimeZone tz = TimeZone.getTimeZone(id); if (tz.getRawOffset() == milliDiff) { // Found a match. name = id; break; } } System.out.println(name);
has comment: http://stackoverflow.com/comment/38505635
has comment: http://stackoverflow.com/comment/38506810
has comment: http://stackoverflow.com/comment/74846103
has comment: http://stackoverflow.com/comment/38505873
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/105304062
answers question: http://stackoverflow.com/q/24806183
type: Answer
accepted answer of: http://stackoverflow.com/q/24806183
score: 15
downvote count: 1
upvote count: 16
has comment: http://stackoverflow.com/comment/38505366
has comment: http://stackoverflow.com/comment/38505264

http://stackoverflow.com/comment/38489956
has text: @user1516873 I tried that already and removed the `baseAddress` property in the config. But the web service defaults to `localhost:8080` and not to the HTTPS port. I get 404 when trying to access via the HTTPS.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24797796
type: QuestionComment

war
tags question: http://stackoverflow.com/q/24891310
tags question: http://stackoverflow.com/q/24895071
tags question: http://stackoverflow.com/q/24785875
tags question: http://stackoverflow.com/q/24879107
type: Tag
tag name: war
tags question: http://stackoverflow.com/q/24762522

http://stackoverflow.com/q/24789999
type: UnansweredQuestion
tagged with: sql
has title: Need a help to create hibernate query
score: -1
favorite count: 0
type: Question
has body: need a help to create hibernate query that table is jdwCustomerTlrdRef and it should take all the operation_spec = customer name. the method should return sysId. Here is the code to review. Please help me i am new to this hibernate query. public getCustomerTlrdRef(BigDecimal sysId) { System.out.println("---- getAllCustomerTlrdRef " ); String query = "from JdwCustomerTlrdRef as jdwCustomerTlrdRef where jdwCustomerTlrdRef.operation_spec= '+customer_name+'"; Query q = getSessionFactory().getCurrentSession().createQuery(query); List&lt;JdwCustomerTlrdRef&gt; customerTlrdRefSysId = q.list(); System.out.println(" List size: " + customerTlrdRefSysId.size()); return customerTlrdRefSysId; }
answer count: 1
has answer: http://stackoverflow.com/a/24790389
tagged with: java
tagged with: hibernate
downvote count: 1
upvote count: 0

http://stackoverflow.com/q/24830610
has answer: http://stackoverflow.com/a/52780992
tagged with: maven-central
type: Question
has answer: http://stackoverflow.com/a/69448774
has answer: http://stackoverflow.com/a/58001359
has answer: http://stackoverflow.com/a/74318377
has comment: http://stackoverflow.com/comment/38551135
has answer: http://stackoverflow.com/a/73580734
has answer: http://stackoverflow.com/a/26995640
has answer: http://stackoverflow.com/a/78710316
has answer: http://stackoverflow.com/a/24831055
has answer: http://stackoverflow.com/a/24831550
has answer: http://stackoverflow.com/a/53064915
has answer: http://stackoverflow.com/a/65231855
has answer: http://stackoverflow.com/a/62083017
has answer: http://stackoverflow.com/a/72351898
score: 183
has answer: http://stackoverflow.com/a/72186181
has answer: http://stackoverflow.com/a/36466903
has answer: http://stackoverflow.com/a/50972632
has answer: http://stackoverflow.com/a/40479027
has answer: http://stackoverflow.com/a/66043399
has answer: http://stackoverflow.com/a/27842727
upvote count: 183
accepted answer: http://stackoverflow.com/a/24831550
has answer: http://stackoverflow.com/a/24832494
downvote count: 0
has answer: http://stackoverflow.com/a/76605354
tagged with: publish
has answer: http://stackoverflow.com/a/27262962
favorite count: 0
possible better answer: http://stackoverflow.com/a/40479027
answer count: 33
has answer: http://stackoverflow.com/a/48690859
has comment: http://stackoverflow.com/comment/111220001
has answer: http://stackoverflow.com/a/61776870
linked to: http://stackoverflow.com/q/23417588
has answer: http://stackoverflow.com/a/35062881
tagged with: maven
has answer: http://stackoverflow.com/a/52072716
has answer: http://stackoverflow.com/a/62876314
has body: Why am I getting a "401 Unauthorized" error in Maven? Here's the error I'm getting when calling mvn deploy (full logs at the bottom): [INFO] BUILD FAILURE [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project xbnjava: Failed to deploy artifacts: Could not transfer artifact com.github.aliteralmind:xbnjava:pom:0.1.2 from/to sonatype-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Failed to transfer file: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/aliteralmind/xbnjava/0.1.2/xbnjava-0.1.2.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1] According to this sonatype support page: "If you are receiving a 401 it is because maven is sending the wrong login credentials, or no credentials at all." Below are the steps I've taken, below that are my full settings.xml and pom.xml files, and below that are the full logs from mvn deploy and mvn deploy -e. Any ideas would be appreciated. I am just hitting wall after wall with Maven. I followed sonatype's checklist when receiving a 401 error: Checklist item 1. Make sure your username/password is correct by logging into the Nexus UI. If curl is installed on your machine, you can try deploying an artifact with... I successfully logged in and out of the sonatype.org website, using the user/pass in settings.xml. I attempted to use curl to manually deploy an artifact, with the command [C:\]curl -u MY_SONATYPE_DOT_COM_USERNAME:MY_SONATYPE_DOT_COM_PASSWORD https://oss.sonatype.org/content/repositories/snapshots/com/github/aliteralmind/xbnjava/0.1.2-SNAPSHOT/xbnjava-0.1.2-20140716.224928-1.pom --request PUT --data @pom.xml but got this error: Warning: Couldn't read data from file "pom.xml", this makes an empty POST. curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed More details here: http://curl.haxx.s…
has answer: http://stackoverflow.com/a/38608026
has answer: http://stackoverflow.com/a/73631134
has answer: http://stackoverflow.com/a/74898474
type: AnsweredQuestion
has title: Why am I getting a "401 Unauthorized" error in Maven?
has answer: http://stackoverflow.com/a/66468291
has answer: http://stackoverflow.com/a/50792980
has answer: http://stackoverflow.com/a/50361738
tagged with: java

http://stackoverflow.com/a/24828239
answers question: http://stackoverflow.com/q/24827753
has body: You can use Jquery to add a class. That would be- $( "body" ).addClass( "loaderCssProps" ); Reference: http://api.jquery.com/addclass/
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38587790
accepted answer of: http://stackoverflow.com/q/24827753
downvote count: 0
score: 1

http://stackoverflow.com/comment/63089702
type: Comment
has text: @RafiqueMohammed, is correct. This does not work with the default Request#getHeaders() implementation because by default it returns an immutable empty set. Trying to add stuff to this set will throw an `com.android.volley.VolleyError: java.lang.UnsupportedOperationException`. So, obviously this doesn't work. However, if you override the getHeaders() in your own classes to return a mutable instance variable then you can do that, but it requires that you then extend this class for all your requests. Not sure why they do this in Volley..
comment on: http://stackoverflow.com/a/24878748
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38590966
score: 0
type: Comment
has text: I have added an example now, and looking at the linked questions can show you how to use `JTextPanes` too
comment on: http://stackoverflow.com/a/24852070
type: AnswerComment

http://stackoverflow.com/comment/38519395
comment on: http://stackoverflow.com/q/24813932
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [How do you rotate a two dimensional array?](http://stackoverflow.com/questions/42519/how-do-you-rotate-a-two-dimensional-array)

http://stackoverflow.com/q/24806570
upvote count: 1
answer count: 1
tagged with: shell
has title: how to redirect shell script output to java console
favorite count: 0
type: AnsweredQuestion
has body: I have a shell script which is sending output to console ID=$PPID echo the process id of the parent of this script is $ID #fetch the parent of the program which executed this shell read PID &lt; &lt;(exec ps -o ppid= "$ID") echo the grand parent id of the script is $PID read GPID &lt; &lt;(exec ps -o ppid= "$PID") echo the grand parent id of the script is $GPID while read -u 4 P; do top -c -n 1 -p "$P" done 4&lt; &lt;(exec pgrep -P "$PID") &gt;&amp;1 I am calling this script from java program and trying to display the output on console but only the output of echo is appearing. The output of top command is not appearing on the java console. Here is my java program import java.io.BufferedReader; public class InformationFetcher { public InformationFetcher() { } public static void main(String[] args) { InformationFetcher informationFetcher = new InformationFetcher(); try { Process process = Runtime.getRuntime().exec( informationFetcher.getFilePath()); InputStream in = process.getInputStream(); printInputStream(in); } catch (IOException e) { e.printStackTrace(); } } private static void printInputStream(InputStream in) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuffer outBuffer = new StringBuffer(); String newLine = System.getProperty("line.separator"); String line; while ((line = reader.readLine()) != null) { outBuffer.append(line); outBuffer.append(newLine); } System.out.println(outBuffer.toString()); } public String getFilePath() { return this.getClass().getResource("/idFetcher.sh").getPath(); } } output is the process id of the parent of this script is 3721 the grand parent id of the script is 3241 the grand parent id of the script is 3240 but it should also display output of top command. Any help would be greatly appreciated.
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24807044
accepted answer: http://stackoverflow.com/a/24807044
type: Question

http://stackoverflow.com/comment/38477771
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24791657
score: 0
has text: I don't want to insta-re-close as a dupe with my 20k power, but is this a dupe of http://stackoverflow.com/questions/16323030/nullpointerexception-in-array ?

http://stackoverflow.com/q/24865110
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24867953
favorite count: 0
type: Question
tagged with: file-locking
tagged with: windows
has title: Java: issue with channel File lock in Windows
has body: I'm writing a little program in Java writing data into an XML file. As there are more than one user launching it, I need that the xml file, before beeing written, is locked. So I've written like that: if (new File(path).exists()) { try { FileChannel channel = new RandomAccessFile(new File(path), "rw") .getChannel(); java.nio.channels.FileLock lock = channel.lock(); DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(path); // Get the root element Node economato = doc.getFirstChild(); NodeList protocolli = doc.getElementsByTagName("numero"); if (protocolli.getLength() == 0) p.setNumero(1); else p.setNumero(protocolli.getLength()+1); Element protocolloNode = doc.createElement("protocollo"); economato.appendChild(protocolloNode); Element protocolloNumero = doc.createElement("numero"); protocolloNumero.appendChild(doc.createTextNode(Integer .toString(p.getNumero()))); protocolloNode.appendChild(protocolloNumero); Element protocolloData = doc.createElement("data"); protocolloData.appendChild(doc.createTextNode(p.getData())); protocolloNode.appendChild(protocolloData); Element protocolloObj = doc.createElement("oggetto"); protocolloObj.appendChild(doc.createTextNode(p.getOggetto())); protocolloNode.appendChild(protocolloObj); Element protocolloDest = doc.createElement("destinatario"); protocolloDest.appendChild(doc.createTextNode(p .getDestinatario())); protocolloNode.appendChild(protocolloDest); Element protocolloOp = doc.createElement("operatore"); protocolloOp.appendChild(doc.createTextNode(p.getOperatore())); protocolloNode.appendChild(protocolloOp); TransformerFactory transformerFactory = TransformerFactory .newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(path); transformer.transform(source, result); lock.release(); channel.close(); JOptionPane.s…
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/24867953
upvote count: 1
has answer: http://stackoverflow.com/a/59178442
possible better answer: http://stackoverflow.com/a/59178442
type: AnsweredQuestion

http://stackoverflow.com/a/24909010
score: 0
has body: As long as finally really has to run even if !jedis.exists(name) evaluates to true, it's not only a good idea, it's practically a must. So for example, if you have a line like jedis.connect() (not real code, just an example), then the if should be inside the try, and finally should call jedis.disconnect. But if the code in your finally is fully dependent on what you would do after the check, then the if makes more sense before the try.
answers question: http://stackoverflow.com/q/24908860
type: Answer

http://stackoverflow.com/a/61512533
score: 0
answers question: http://stackoverflow.com/q/24756207
type: Answer
has body: As mentioned earlier, the mdht ipf API is perfect for this problem. I had the same issue and I used this API. https://mvnrepository.com/artifact/org.openehealth.ipf.modules/ipf-modules-cda-mdht CDAR2Parser ccdaParser = new CDAR2Parser(); ClinicalDocument clinicalDocument = ccdaParser.parse(inputStream, new Object[10]);

http://stackoverflow.com/comment/38527077
type: QuestionComment
score: 1
has text: Could you show us the actual code that you're using to do your conversion, along with what output you're expecting, and what output you're actually getting? Also, what timezone you're in.
comment on: http://stackoverflow.com/q/24817528
type: Comment

http://stackoverflow.com/comment/38674434
type: Comment
comment on: http://stackoverflow.com/a/24893938
score: 0
type: AnswerComment
has text: No, if you want I can zip the whole project up and upload it somewhere

http://stackoverflow.com/comment/38585914
score: 0
comment on: http://stackoverflow.com/a/24845938
type: AnswerComment
type: Comment
has text: @Boann your right my mention of mutable objects in my awnser was a vague, updated.

http://stackoverflow.com/a/24758390
has comment: http://stackoverflow.com/comment/38416355
answers question: http://stackoverflow.com/q/24758276
has body: See org.apache.http.impl.client.CloseableHttpClient It is annotated as @ThreadSafe while org.apache.http.impl.client.HttpClientBuilder is not. What is more it implements Java 7 Closable interface. Cheers.
score: 0
type: Answer

http://stackoverflow.com/q/24908731
type: UnansweredQuestion
has body: this is my original postgresql.conf: # #Wed Jul 23 16:13:09 IST 2014 lc_monetary='English_India.1252' # locale for monetary formatting listen_addresses='*' # what IP address(es) to listen on; max_connections=100 # (change requires restart) port=5433 shared_buffers=128MB # min 128kB log_timezone='Asia/Calcutta' timezone='Asia/Calcutta' datestyle='iso, dmy' lc_numeric='English_India.1252' # locale for number formatting lc_time='English_India.1252' # locale for time formatting default_text_search_config='pg_catalog.english' lc_messages='English_India.1252' # locale for system error message I'm updating postgresql.conf at runtime from java using following code: Properties input = new java.util.Properties(); InputStream reader=new FileInputStream(System.getProperty("user.dir")+"/postgresql.conf"); input.load(reader); input.setProperty("port", String.valueOf(Installer.newport)); OutputStream confFile=new FileOutputStream(System.getProperty("user.dir")+"\\postgresql.conf"); input.store(confFile, ""); confFile.close(); This code results in following postgresql.conf : # #Wed Jul 23 16:13:09 IST 2014 lc_monetary='English_India.1252'\t\t\t\# locale for monetary formatting listen_addresses='*'\t\t\# what IP address(es) to listen on; max_connections=100\t\t\t\# (change requires restart) port=5433 shared_buffers=128MB\t\t\t\# min 128kB log_timezone='Asia/Calcutta' timezone='Asia/Calcutta' datestyle='iso, dmy' lc_numeric='English_India.1252'\t\t\t\# locale for number formatting lc_time='English_India.1252'\t\t\t\t\# locale for time formatting default_text_search_config='pg_catalog.english' lc_messages='English_India.1252'\t\t\t\# locale for system error message Somehow the '\t' characters are getting added or rather seen as escape sequence. I've also tried by specifying encoding with: Reader reader = new InputStreamReader(new FileInputStream(System.getProperty("user.dir")+"/postgresql.conf"),"UTF-8"); and OutputStreamWriter confFile=new OutputStreamWriter(new FileOutputStream(Syst…
tagged with: properties
tagged with: java
has comment: http://stackoverflow.com/comment/38699938
type: Question
tagged with: properties-file
has comment: http://stackoverflow.com/comment/38701314
has title: java.util.Properties adds \t characters on .store()
has answer: http://stackoverflow.com/a/24908926
score: 0
linked to: http://stackoverflow.com/q/16273174
answer count: 1
tagged with: postgresql

http://stackoverflow.com/q/24908818
tagged with: eclipse
linked to: http://stackoverflow.com/q/24820325
type: Question
has comment: http://stackoverflow.com/comment/38698453
has answer: http://stackoverflow.com/a/24908868
downvote count: 0
has comment: http://stackoverflow.com/comment/38698689
answer count: 1
favorite count: 0
has body: I was just playing around with JUnit 4 so I whacked in these two static imports: import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; Wrote the best unit test in the world and did an optimise imports in Eclipse just because I have that set to happen on saving a file. My screen now looks like this (except of course without the big red arrow - I drew that): OK, so it is all fine in that it compiles and runs (and the test even passes) but I have the heeby-jeebies because Eclipse has crossed out the is and I do not know why. So, experts, what does this strikethrough mean? Nervously hovering over it reveals there are three possible is methods - could that be the reason?
type: AnsweredQuestion
score: 3
duplicate of: http://stackoverflow.com/q/24820325
accepted answer: http://stackoverflow.com/a/24908868
has title: What does a crossed out static import in Eclipse mean?
upvote count: 3
tagged with: java

http://stackoverflow.com/q/24766728
has comment: http://stackoverflow.com/comment/38431038
type: Question
has answer: http://stackoverflow.com/a/24774772
tagged with: jakarta-ee
downvote count: 0
has comment: http://stackoverflow.com/comment/38443887
has comment: http://stackoverflow.com/comment/38430832
has title: response code 500 when returning an object using @ResponseBody
answer count: 3
score: 2
has answer: http://stackoverflow.com/a/24774510
favorite count: 0
accepted answer: http://stackoverflow.com/a/24774510
upvote count: 2
tagged with: spring
has body: I'm fairly new to spring Restful programming The requirement to use the controller method as a rest service, so I'm trying to return an object in a JSON format, but for some reason I'm getting a response code as 500 with no errors and exceptions in log files. But it is successfully working if I the return type is of a string rather an object I'm using the jackson dependencies and I'm configuring in context file and in a assumption that converts the object to json format and puts in the response body on using @ResponseBody annotation //Response code 500 If I return an object @RequestMapping(value = "/donorSummary", method = RequestMethod.GET,produces = "application/json") @PreAuthorize("hasRole('"+PermissionConstants.VIEW_DONOR+"')") public @ResponseBody Donor donorSummaryGenerator(HttpServletRequest request, Model model,HttpServletResponse response, @RequestParam(value = "donorId", required = false) Long donorId) { //some code here return donorObject; } //Working if I return a string @RequestMapping(value = "/donorSummary", method = RequestMethod.GET,produces = "application/json") @PreAuthorize("hasRole('"+PermissionConstants.VIEW_DONOR+"')") public @ResponseBody StringdonorSummaryGenerator(HttpServletRequest request, Model model,HttpServletResponse response, @RequestParam(value = "donorId", required = false) Long donorId) { //some oode here return donorObject.toString(); } ApplicationContext File <?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:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-mail="http://www.springframework.org/schema/integration/mail" xmlns:security="htt…
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38431197
has answer: http://stackoverflow.com/a/24775400
tagged with: java
has comment: http://stackoverflow.com/comment/38463714
has comment: http://stackoverflow.com/comment/38431294
possible better answer: http://stackoverflow.com/a/24774772

http://stackoverflow.com/comment/39126045
has text: But why Android L(Preview) is selected automatically as best option and then it's not working? How to make it work?
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24886966
type: Comment

http://stackoverflow.com/comment/38498447
score: 0
comment on: http://stackoverflow.com/a/24802799
type: Comment
has text: Thank you, I'm trying to convert to UTF-8, but this test also does work (but shouldn't): `@Test public void getBytes_buggy() throws Exception { final byte[] iso8859bytes = "Oberbüren".getBytes("ISO-8859-1"); final String actual = new String(iso8859bytes, "UTF-8"); assertEquals("Oberb�", actual); }`
type: AnswerComment

http://stackoverflow.com/q/24865893
accepted answer: http://stackoverflow.com/a/24881130
favorite count: 0
tagged with: aggregation-framework
has body: I have a "product" collection which has a "category" field. I am trying to get count of distinct categories. I can't use db.product.distinct("category").length as it exceeds 16mb cap with below error:- &gt; db.product.distinct("category").length 2014-07-21T08:58:25.289-0400 distinct failed: { "errmsg" : "exception: distinct too big, 16mb cap", "code" : 17217, "ok" : 0 } at src/mongo/shell/collection.js:1108 So,I am using aggregation framework for this and I am able to get count using this query:- db.product.aggregate([{$group: {_id:"$category"}}, {$group: {_id:"", count:{$sum:1}}}], {allowDiskUse: true}) I am not able to translate this into spring data mongodb aggregation query. Please help. I am getting following errors with what I have tried: Aggregation aggregation = Aggregation.newAggregation( Aggregation.group("category"), Aggregation.group(" ").count().as("numDistinctCategories")); Error: AggregationField can't be null. I have tried other strings in second group operation but it gives Invalid reference error.
tagged with: spring-data-mongodb
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/24881130
has title: Spring data equivalent of below aggregation operation in mongodb
downvote count: 0
answer count: 1

http://stackoverflow.com/a/24796910
has comment: http://stackoverflow.com/comment/85270466
has comment: http://stackoverflow.com/comment/38487315
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38487526
has body: Create String variable in Activity. String text; In activity put following functions: void onTextChanged(String text){ this.text=text; //Receive new text here } void onButtonClick(){ //use current value of text variable as the latest edit text value in fragment1 } And in fragment1 onClick of button: @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); et1 = (EditText) getView().findViewById(R.id.text1); et1.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { ((MainActivity)getActivity()).onTextChanged(s); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); } And in fragment 2: btnGetValues.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // Here I want to get the value of edittext which is in fragment1. ((MainActivity)getActivity()).onButtonClick(); } }); At the event of fragment change (Swipe), when fragment1 disappears and fragment2 is visible, you can simply collect all the values in a domain object and call an activity function passing this object.
has comment: http://stackoverflow.com/comment/38487238
type: Answer
accepted answer of: http://stackoverflow.com/q/24796675
has comment: http://stackoverflow.com/comment/38487413
upvote count: 2
answers question: http://stackoverflow.com/q/24796675
score: 2
has comment: http://stackoverflow.com/comment/38487471
has comment: http://stackoverflow.com/comment/38487872
has comment: http://stackoverflow.com/comment/38487351
has comment: http://stackoverflow.com/comment/38487711

http://stackoverflow.com/comment/38535757
comment on: http://stackoverflow.com/q/24822964
type: Comment
type: QuestionComment
has text: so you just want to get the text inside the ``?
score: 0

http://stackoverflow.com/q/24826051
has title: Problems with JSON and Memory
tagged with: android
has comment: http://stackoverflow.com/comment/38542004
has comment: http://stackoverflow.com/comment/38939770
has comment: http://stackoverflow.com/comment/38541877
has comment: http://stackoverflow.com/comment/38542904
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38542357
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38542321
type: Question
has answer: http://stackoverflow.com/a/24826194
has comment: http://stackoverflow.com/comment/38541785
score: 4
linked to: http://stackoverflow.com/q/1565388
answer count: 2
has body: I'm trying to load a lot of data from the web to my android application and I've been getting this error: 07-18 10:16:00.575: E/AndroidRuntime(30117): java.lang.OutOfMemoryError: [memory exhausted] and already read a lot about JSON. I've found some solutions but nothing really helped me. This is my code : public class HistoricoAdapter extends BaseAdapter { private Context ctx; JSONArray jsonArray; public HistoricoAdapter(Context ctx) { this.ctx = ctx; String readHttp = readHttp(); try { // transforma a string retornada pela função readHttp() em array jsonArray = new JSONArray(readHttp); } catch (Exception e) { e.printStackTrace(); } } public String readHttp() { // Acessa a URL que retorna uma string com os dados do banco StringBuilder builder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("some url"); try { HttpResponse response = client.execute(httpGet); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { builder.append(line); } } else { Log.e(this.toString(), "Erro ao ler JSON!"); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return builder.toString(); } public int getCount() { return jsonArray.length(); } public boolean isEmpty(){ if(jsonArray.toString().isEmpty()){ return true; } else { return false; } } public Object getItem(int position) { JSONObject ob = null; try { ob = jsonArray.getJSONObject(position); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ob; } public long getItemId(int arg0) { return 0; } public View getView(int position, View view, ViewGroup arg2) { LayoutInflater layout = (LayoutInflater) ctx .getSystem…
downvote count: 1
has answer: http://stackoverflow.com/a/24826469
favorite count: 0
upvote count: 5

http://stackoverflow.com/comment/38575377
comment on: http://stackoverflow.com/a/24843596
type: Comment
score: 0
has text: He is my redirect.jsp :`<%-- Views should be stored under the WEB-INF folder so that they are not accessible except through controller process. This JSP is here to provide a redirect to the dispatcher servlet but should be the only JSP outside of WEB-INF. --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <% response.sendRedirect("index.htm"); %>`
type: AnswerComment

http://stackoverflow.com/comment/38457279
comment on: http://stackoverflow.com/a/24759293
type: Comment
has text: The file did not exist in my example was created new. If it helps i tend to use the newest Java 7 classes Files.newBufferedWriter(Paths.get("URL"), StandardCharsets.UTF_8 , StandardOpenOption.APPEND). Note that StandardCharsets and StandardOpenOption are enum classes so you can check possible values. Also it is a common practice to use Apache IO libraries to make these operations easier since it hides some of the complexities of the file IO operations. Finally please do not forget to flush and close files. Hope some of this suggestions may help you.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38712973
has text: I did not compile it, since I know there is an error already
comment on: http://stackoverflow.com/q/24889998
type: Comment
score: 0
type: QuestionComment

javafx
tags question: http://stackoverflow.com/q/24842202
tags question: http://stackoverflow.com/q/24751488
tags question: http://stackoverflow.com/q/24855565
tags question: http://stackoverflow.com/q/24769296
type: Tag
tags question: http://stackoverflow.com/q/24838762
tags question: http://stackoverflow.com/q/24898792
tags question: http://stackoverflow.com/q/24823373
tags question: http://stackoverflow.com/q/24822839
tags question: http://stackoverflow.com/q/24889907
tags question: http://stackoverflow.com/q/24762217
tags question: http://stackoverflow.com/q/24768466
tags question: http://stackoverflow.com/q/24841062
tags question: http://stackoverflow.com/q/24825839
tags question: http://stackoverflow.com/q/24788677
tags question: http://stackoverflow.com/q/24821287
tags question: http://stackoverflow.com/q/24896498
tags question: http://stackoverflow.com/q/24775500
tags question: http://stackoverflow.com/q/24780785
tags question: http://stackoverflow.com/q/24877022
tag name: javafx
tags question: http://stackoverflow.com/q/24782280
tags question: http://stackoverflow.com/q/24850050
tags question: http://stackoverflow.com/q/24763051
tags question: http://stackoverflow.com/q/24780226
tags question: http://stackoverflow.com/q/24856287
tags question: http://stackoverflow.com/q/24766591
tags question: http://stackoverflow.com/q/24763873
tags question: http://stackoverflow.com/q/24862594
tags question: http://stackoverflow.com/q/24762966
tags question: http://stackoverflow.com/q/24782335
tags question: http://stackoverflow.com/q/24778220
tags question: http://stackoverflow.com/q/24765549
tags question: http://stackoverflow.com/q/24810254
tags question: http://stackoverflow.com/q/24870071
tags question: http://stackoverflow.com/q/24837636
tags question: http://stackoverflow.com/q/24789098
tags question: http://stackoverflow.com/q/24848752
tags question: http://stackoverflow.com/q/24767234
tags question: http://stackoverflow.com/q/24847951
tags question: http://stackoverflow.com/q/24855051
tags question: http://stackoverflow.com/q/24851886
tags question: http://stackoverflow.com/q/24899115
tags question: http://stackoverflow.com/q/24799125
tags question: http://stackoverflow.com/q/24786606
tags question: http://stackoverflow.com/q/24802259
tags question: http://stackoverflow.com/q/24891937
tags question: http://stackoverflow.com/q/24806696

http://stackoverflow.com/a/24823894
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24823802
type: Answer
upvote count: 3
has body: In the Java language, each Object has what is called a Monitor, which basically is a lock. This lock is what powers Object methods such as wait / signal / signalAll that are available on every objects. When using the synchronized keyword, what happens behind the scenes is that the compiler writes code that acquires the monitor (the lock) and releases it when invocation is complete. If the method is static, the Monitor that is accessed is that of the Class object. You can read more about this keyword here : http://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html

http://stackoverflow.com/comment/46298842
type: Comment
comment on: http://stackoverflow.com/a/24850344
has text: @jpangamarca: Interesting. You should provide this as an answer, since this makes mine wrong. Will update.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24759006
score: 0
answers question: http://stackoverflow.com/q/24758961
type: Answer
has body: You have to declare it outside the try-block and initialize it with some kind of default value.

http://stackoverflow.com/comment/38625886
comment on: http://stackoverflow.com/q/24812755
has text: Setting the enabled protocols might have done it. Using your line still caused the error, but I removed the TLSv1 part of it (since I know this server only uses SSLv3)(so it just says "sslsocket.setEnabledProtocols(new String[]{"SSLv3"});"), and it cached the client session after the verify data. Not sure if it all works yet, but that fixed the handshake_failure issue that I asked about. If you post that up as an answer, I'll mark it as such and we can close this question for now.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24856811
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/70517910
has title: Why iterator.remove does not throw ConcurrentModificationException
possible better answer: http://stackoverflow.com/a/25131800
tagged with: java
score: 24
answer count: 6
tagged with: iterator
downvote count: 2
accepted answer: http://stackoverflow.com/a/25131943
favorite count: 0
has answer: http://stackoverflow.com/a/25131800
has answer: http://stackoverflow.com/a/25131943
upvote count: 26
has answer: http://stackoverflow.com/a/32238686
has answer: http://stackoverflow.com/a/25132372
tagged with: foreach
type: AnsweredQuestion
has body: What does iterator.remove() do differently from list.remove(), so that iterator does not throw an exception and list.remove() does throw one? In the end, both are modifying the collection size. Please ignore multi-threading here. I am just talking about a for-each loop and an iterator loop. As far as I know, a for-each loop creates an iterator only internally. I am confused.
has answer: http://stackoverflow.com/a/50434414

http://stackoverflow.com/q/24898820
tagged with: class
type: Question
has body: I have a problem. I made a new class which extends the Color class. However, it gives me an error. Here is the code: public class LabeledColored1 extends Color { public Color colour; public String nom; public LabeledColored1(Color color, String name) { colour = color; nom = name; toString(); } public String toString(){ return nom; } } The error: Implicit super constructor Color() is undefined. Must explicitly invoke another constructor. The only way to get around it is put super() with integer as an argument, but I don't want to use super(). Is there a solution to this? This is a question from the book: The Art and Science of Java. Chapter 10 question 6. I am trying extremely hard to learn Java
score: 2
answer count: 1
downvote count: 0
has title: How to extend from a Color class
favorite count: 0
tagged with: colors
has answer: http://stackoverflow.com/a/24898842
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38679869
has comment: http://stackoverflow.com/comment/38680047

http://stackoverflow.com/comment/38638253
score: 1
has text: I agree with this answer as the example given by the user is a clear case where disambiguation is required. "m_" does not follow the general standard of camel-case variable names and "this" is the general standard used.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24876666

http://stackoverflow.com/q/24785072
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/24785947
tagged with: sorting
score: 0
has comment: http://stackoverflow.com/comment/38465015
has answer: http://stackoverflow.com/a/24785947
has body: I know that this topic can be well covered, but they only use a Treemap which use only one value and in case of same value does not return what I would like. Here is my object: public classe myObjectToMap { long id; double price; String name; long date; public static void GetMyObject(long id, double price, String name) { myObjectToMap newObject = new myObjectToMap; newObject.id = id; newObject.price = price; newObject.name = name; newObject.date = new Date().getTime(); PlaceOfMyMap.myMap.put(id, newObject); } Here is where my map is located, I put a LinkedHashMap, and I do not which is the best between Hashmap, TreeMap and LinkedHashMap, I did see that TreeMap give a comparator of Value, but I do not arrive to Compare with more than one value. public class PlaceOfMyMap { public static LinkedHashmap&lt;Long, myObjectToMap&gt; myMap = new LinkedHashmap&lt;~&gt;; } And finally, here is my main program: public class MainClass { public static void main(String args[]) throws Exception { MyObjectToHashmap.GetMyObject(1, 26, "Mat") MyObjectToHashmap.GetMyObject(4, 25, "Tommy") MyObjectToHashmap.GetMyObject(16, 24, "Kate") MyObjectToHashmap.GetMyObject(63, 26, "Mary") MyObjectToHashmap.GetMyObject(99, 24, "Ronny") } } First: I would like to sort them from the highest price to the lowest with a time priority, which means that I would like to Mat being the first and Kate the second. Second: I would like to sort them from the Lowest price to the the Highest with a time priority which means that I would like to Kate being the first and Ronny the second. Any tips to sort them correctly ?
answer count: 1
has title: Sort a LinkedHashMap with Values and with Time Priority in case of Equal
has comment: http://stackoverflow.com/comment/38465736
tagged with: linkedhashmap
type: AnsweredQuestion
tagged with: java
tagged with: treemap
type: Question
has comment: http://stackoverflow.com/comment/38465685

http://stackoverflow.com/comment/38563234
type: QuestionComment
has text: Try RequestDispatcher, Reference http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/RequestDispatcher.html
comment on: http://stackoverflow.com/q/24837424
score: 0
type: Comment

http://stackoverflow.com/comment/38500619
comment on: http://stackoverflow.com/q/24804011
has text: Thank you all for your help, i finally found the right answer, as a total java beginner i didn't declare s in my code, which is strange because before my code was working without it. Thank you anyway!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24772802
has body: Seems like you want to create a new List to add to. By assigning to the same one as the internal list you are appending to it.
score: 0
answers question: http://stackoverflow.com/q/24772728
type: Answer

http://stackoverflow.com/q/24872009
answer count: 3
has answer: http://stackoverflow.com/a/24873442
has comment: http://stackoverflow.com/comment/38629446
favorite count: 0
accepted answer: http://stackoverflow.com/a/24872165
possible better answer: http://stackoverflow.com/a/24873442
has comment: http://stackoverflow.com/comment/38629487
type: AnsweredQuestion
tagged with: multithreading
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24872382
score: 3
has answer: http://stackoverflow.com/a/24872165
tagged with: java
has title: How can I execute code when exiting a thread
tagged with: dispose
upvote count: 4
tagged with: teardown
has body: I want to execute code at the very end before a thread dies. So what I am looking for is some kind of dispose(), tearDown() method for threads guaranteeing that certain tasks are performed before exiting the thread.

http://stackoverflow.com/q/24793371
type: Question
tagged with: android
tagged with: android-studio
upvote count: 3
has answer: http://stackoverflow.com/a/24794049
tagged with: java
answer count: 2
has title: Implement methods
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/24793591
has body: I was wondering if there is a way to implement a method in "Android Studio" at the begin of creating a class such as in Eclipse. When you create a class in Eclipse you have the option to add an superclass when you create a class, however, in AS you can only name the class and you have to put the methods manually by writing for instance "extends BroadcastReceiver" and then press ctrl+i to get the method list. My question is if there is a auto-generator for superclass/methods in Android Studio or not?
score: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/38540782
type: QuestionComment
comment on: http://stackoverflow.com/q/24825347
score: 0
type: Comment
has text: @laura make sure that the dependencies in your `pom.xml` and the setting in `Project > Properties > Project Facets` and doctype or schema definition in the `web.xml` are consistent

http://stackoverflow.com/q/24897735
score: 11
has comment: http://stackoverflow.com/comment/125482729
upvote count: 11
has title: What does this nested annotation do / allow?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24910881
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/24910881
has body: I was looking at the @org.hibernate.validator.constaints.NotEmpty annotation: @Documented @Constraint(validatedBy = { }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) @Retention(RUNTIME) @ReportAsSingleViolation @NotNull @Size(min = 1) public @interface NotEmpty { String message() default "{org.hibernate.validator.constraints.NotEmpty.message}"; Class&lt;?&gt;[] groups() default { }; Class&lt;? extends Payload&gt;[] payload() default { }; /** * Defines several {@code @NotEmpty} annotations on the same element. */ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) @Retention(RUNTIME) @Documented public @interface List { NotEmpty[] value(); } } I'm confused by the last part: /** * Defines several {@code @NotEmpty} annotations on the same element. */ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) @Retention(RUNTIME) @Documented public @interface List { NotEmpty[] value(); } I'm not sure how that works, nor how to use it. From my understanding, anything under Java 8 does not allow repeated annotations on the same element. Can anybody clarify?
tagged with: validation
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-validator
tagged with: annotations
has comment: http://stackoverflow.com/comment/38684502

http://stackoverflow.com/a/24758503
has body: try this android:layout_gravity="right"
answers question: http://stackoverflow.com/q/24758341
has comment: http://stackoverflow.com/comment/38414839
score: 0
has comment: http://stackoverflow.com/comment/38415865
type: Answer

http://stackoverflow.com/q/24793078
has body: So I've been looking around for a way to write from an Arduino directly onto a file on the PC, and basically I've found out there's no native way to do so. I wanted to do this in order to then read the file from a C++/Java program, and use the information in it. I also wanted to do this in real-time at some point, so it would be kind of like sending information from the Arduino over to the Java/C++ program for processing. However, I've seen multiple people state on other forums that you can link the Serial output to some program running on the PC, and then use that program to write the output to a file. However, each time, they neglect to write out how exactly to do this. The main purpose I wanted to write from the Arduino directly to a file was to read this file from another (Java/C++) program, so the above would be great for me. So how can I get the Serial output into a Java (much more preferably, as I might want to use Swing later) or C++ program, to then use this information in the program itself, or write it to a file? Real-time sending would be a great help. If the above isn't possible, MATLAB might do, but to be clear, I would much rather be able to interface with Java/C++. Or both Java and MATLAB. EDIT: To be more specific about what exactly I'd like to do, it is to sort of 'trigger' the Java program to read from the Serial output when a new line has been written (so it reads each line separately) and store it in a string in the Java program, then process it, all at once, and then sleep until another new line is written to the Serial port.
possible better answer: http://stackoverflow.com/a/24798059
accepted answer: http://stackoverflow.com/a/25147887
has title: Write Arduino Serial output to file or program on PC
tagged with: matlab
tagged with: c++
type: AnsweredQuestion
tagged with: arduino
type: Question
has answer: http://stackoverflow.com/a/25147887
tagged with: java
has answer: http://stackoverflow.com/a/24798059
score: 0
answer count: 2

http://stackoverflow.com/comment/38706565
type: AnswerComment
type: Comment
has text: I dont have the encoding. can be anything
comment on: http://stackoverflow.com/a/24893278
score: 0

http://stackoverflow.com/comment/38611249
comment on: http://stackoverflow.com/a/24862508
has text: Thanks, I have my hibernate.cfg.xml with everything set up. Like I said I can successfully create entries in the database with my current hibernate setup, it's the querying part with 'where' clauses that I'm not sure about. Also I'm using annotations.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24857931
linked to: http://stackoverflow.com/q/11410015
possible better answer: http://stackoverflow.com/a/24886076
linked to: http://stackoverflow.com/q/11118323
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24886076
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24862491
upvote count: 3
accepted answer: http://stackoverflow.com/a/24862491
tagged with: java
tagged with: selenium
has title: Java Webdriver: How to save the page same as "save page as" in firefox?
type: Question
has body: Similar question asked below How to save complete web page But there is no answer yet. The expected result is to get many files, some file to store image, etc. I used the following,it will pop up a windows saying to save the file val a=new FirefoxDriver() a.get("http://www.baidu.com") val b=new Actions(a) b.action.keyDown(Keys.ALT).keyDown(Keys.F4).keyUp(Keys.ALT).perform(); But then how to click the save button? The following doesn't work b.sendKeys(Keys.ENTER)

http://stackoverflow.com/comment/38576744
type: Comment
has text: I have the most basic of web applications with only an index.jsp page containing ` Should see true: ${Boolean.TRUE} ` But the rendered html is blank after the colon.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24768377

http://stackoverflow.com/q/24875141
has title: error while converting hexadecimal to latitude and longitude in java
has answer: http://stackoverflow.com/a/24875617
tagged with: numberformatexception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38635801
tagged with: latitude-longitude
linked to: http://stackoverflow.com/q/5488885
type: Question
accepted answer: http://stackoverflow.com/a/24875617
has comment: http://stackoverflow.com/comment/38635840
has body: public String getLatitude(String hex) { int latStart=0; String str09 = hex.substring(latStart,latStart+8); System.out.println("latitude Hex::"+str09); Integer outDec = Integer.parseInt(str09, 16); double d = outDec / new Double(1000); System.out.println("Hex to float&gt;&gt;&gt;" + d); double lat = d /`enter code here` 3600; return String.valueOf(lat); } public String getLongitude(String hex) throws Exception { int lonStart=8; String str09 = hex.substring(lonStart,lonStart+8); System.out.println("Longitude Hex::"+str09); Integer outDec = Integer.parseInt(str09,16); double d = outDec / new Double(1000); System.out.println("Hex to float&gt;&gt;&gt;" + asHex); double lon = d / 3600; return String.valueOf(lon); } hexstring -->090bc3b3ed1b479c I am trying to convert this to latitude and longitude. Actual output is latitude Hex::090bc3b3 latitude:::42.157205277777784 Longitude Hex::ed1b479c longitude:::-88.04980555555555 I am getting NumberFormatException when i am trying to convert into Interger values. Here is the code i am working on: I am getting exception i am converting longitude hex string into Interger. public String getLongitude(String hex) throws Exception { int lonStart=8; String str09 = hex.substring(lonStart,lonStart+8); System.out.println("latitude Hex::"+str09); System.out.println("Longitude Hex::"+str09); Long outDec = Long.parseLong(str09, 16); double d = outDec / new Double(1000); System.out.println("Hex to float&gt;&gt;&gt;" + d); double lon = d / 3600; return String.valueOf(lon); } i also tried with Long but here is is what i am getting :longitude:::1104.9966655555554
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/38544435
has text: Any method to do.Does it mean that the whole set of integers that i need to multiply should be kept in another array?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24827424
type: Comment

http://stackoverflow.com/comment/38502882
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24803535
has text: For best performance you need the heavyweight component and to have VLC render your video. Unfortunately, it simply won't work inside a SwingNode and there's nothing to be done about it frankly.
type: AnswerComment

http://stackoverflow.com/comment/40105997
has text: Your answer seems a little bit incomplete. Can you please elaborate it more.
comment on: http://stackoverflow.com/a/25664475
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24800896
has comment: http://stackoverflow.com/comment/39581293
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/39266277
tagged with: openshift
type: Question
has title: java.net.SocketException: Permission denied openshift
upvote count: 1
answer count: 1
has body: I'm trying to make several socket connection in an app. deployed on oTomcat OpenShift and I get this exception: java.net.SocketException: Permission denied My Account is free it's possible that with a payment Account openshift let me make binding to several port (open several sockect).
favorite count: 0
has answer: http://stackoverflow.com/a/24811661
type: UnansweredQuestion
tagged with: sockets

css
tags question: http://stackoverflow.com/q/24811967
tags question: http://stackoverflow.com/q/24839824
tags question: http://stackoverflow.com/q/24821583
tags question: http://stackoverflow.com/q/24899115
tags question: http://stackoverflow.com/q/24827753
tags question: http://stackoverflow.com/q/24762821
tags question: http://stackoverflow.com/q/24891937
type: Tag
tags question: http://stackoverflow.com/q/24794887
tags question: http://stackoverflow.com/q/24872855
tags question: http://stackoverflow.com/q/24768466
tags question: http://stackoverflow.com/q/24877022
tag name: css
tags question: http://stackoverflow.com/q/24756191
tags question: http://stackoverflow.com/q/24899421

http://stackoverflow.com/comment/38436555
comment on: http://stackoverflow.com/q/24768480
score: 0
type: Comment
has text: Are you sure you have all the parameters on the JSP? As in ... does that JSP just return some canned or random barcode or are you missing the parameters that actually generate the specific barcode in question? If you are not sending all the information, it could of course return nothing and you get nothing.
type: QuestionComment

http://stackoverflow.com/comment/38554570
type: Comment
comment on: http://stackoverflow.com/a/24832513
has text: I thought destroy() is only one of the step taken at the unload sequence. So in practice they are not exactly the same. The question is more specific to unload than just the destroy method call.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38547464
comment on: http://stackoverflow.com/q/24828969
has text: I believe you have some issues with Git here, it doesn't cares about empty directories. Try adding an empty `.placeholder` file to these folders and let's see if that helps after a new 'check out' into Eclipse (it is a clone under the hood).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38698689
comment on: http://stackoverflow.com/q/24908818
score: 3
has text: Thanks everyone. In my defense, on investigation the is that I am actually using is not deprecated - the is(Class) overload is, however. I guess the import will bring in all 3 possible versions of that method so eclipse will cross it out if any of the overloads are deprecated.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24896353
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/38705960
has comment: http://stackoverflow.com/comment/38675834
has comment: http://stackoverflow.com/comment/38675745
answer count: 0
linked to: http://stackoverflow.com/q/5150637
tagged with: wcf
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12850143
duplicate of: http://stackoverflow.com/q/5150637
type: Question
has comment: http://stackoverflow.com/comment/38705035
has comment: http://stackoverflow.com/comment/38676189
tagged with: java
has comment: http://stackoverflow.com/comment/38705851
has comment: http://stackoverflow.com/comment/38705341
has body: I have been attempting to to connect to a WCF Service from a Android device. I have read a lot of blogs that does not seem to be useful. One of the Operations running on my WCF is [OperationContract] [WebGet(UriTemplate = "write", ResponseFormat = WebMessageFormat.Json)] string write(); This writes one entity to a database. When I enter the URL in my phones browser "10.0.0.14/serv/UserManagement.svc/write" I get the relevant message and it writes to the database with no problem. The problem arises when I attempt to Consume the WCF from a android application. I have jumped between many different solution types and I am currently using try { DefaultHttpClient httpClient = new DefaultHttpClient(); URI uri = new URI("http://10.0.0.14/serv/UserManagement.svc/write"); HttpGet httpget = new HttpGet(uri); httpget.setHeader("Accept", "application/json"); httpget.setHeader("Content-type", "application/json; charset=utf-8"); HttpResponse response = httpClient.execute(httpget); HttpEntity responseEntity = response.getEntity(); } catch (Exception e) { e.printStackTrace(); } This does not work. I have added &lt;uses-permission android:name="android.permission.INTERNET"/&gt; to my manifest. In my LogCat there is a NetworkOnMainThreadException. How can I fix the problem?
has comment: http://stackoverflow.com/comment/38675802
has comment: http://stackoverflow.com/comment/38676236
has comment: http://stackoverflow.com/comment/38706398
has comment: http://stackoverflow.com/comment/38705731
has comment: http://stackoverflow.com/comment/38705448
has title: Consuming Restful WCF Service using Android
linked to: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/38704821
has comment: http://stackoverflow.com/comment/38675663
score: 0
has comment: http://stackoverflow.com/comment/38706494
tagged with: rest
has comment: http://stackoverflow.com/comment/38706667

http://stackoverflow.com/q/24814433
tagged with: jsf-2
answer count: 2
downvote count: 0
has body: Problem I am using JSF 2.1.13 to create a prototype to demostrate the benefits of JSF over our current webapp built with JSP and struts 1.1. I following code using works with JSF 2.2.6, but I had to down grade once I found out that Oracle Weblogic 12c doesn't support JSF 2.2 yet. When running the code with 2.1.13 I receive the following error: /pages/sites/tab-details.xhtml @27,90 <ccc:codedType> Tag Library supports namespace: http://java.sun.com/jsf/composite/ccc, but no tag was defined for name: codedType Googling only pointed me to a bug about nested composite components, but that isn't something I'm doing. Code Excerpt from pom.xml com.sun.faces jsf-api 2.1.13 com.sun.faces jsf-impl 2.1.13 Composite Compontent: webapp/WEB-INF/resources/ccc/codedType.xhtml <?xml version="1.0" encoding="UTF-8"?> <ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:cc="http://java.sun.com/jsf/composite"> <cc:interface shortDescription="Renders a CodedType"> <cc:attribute name="value" required="true" shortDescription="Instance of CodedType to be properly rendered" type="company.prototype.uireplacement.presenter.CodedType" /> <cc:attribute name="includeCode" shortDescription="Whether or not the rendeder type should include the code" type="boolean" default="false"/> </cc:interface> <cc:implementation> #{cc.attrs.value.label}<ui:fragment rendered="#{cc.attrs.includeCode}"> (#{cc.attrs.value.code})</ui:fragment> </cc:implementation> </ui:component> Page using composite component: webapp/pages/sites/tab-details.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:ccc="http://java.sun.com/jsf/composite/ccc"> <ccc:codedType value="#{siteControllerBean.selectedSite.type}" includeCode="true"/> </ui:co…
score: 7
has answer: http://stackoverflow.com/a/24829064
tagged with: composite-component
has answer: http://stackoverflow.com/a/32218665
has title: JSF 2.1.13 custom component not found: Tag Library supports namespace: <namsepace> but no tag was defined for name: <compositecomponent>
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/32218665
tagged with: mojarra
upvote count: 7
accepted answer: http://stackoverflow.com/a/24829064
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/10898906

http://stackoverflow.com/q/24883339
tagged with: download-manager
tagged with: android
favorite count: 0
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38650732
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
has title: Not able to download video but for pdf its working Download manager
has comment: http://stackoverflow.com/comment/38650622
downvote count: 0
has comment: http://stackoverflow.com/comment/38650574
has body: Hi i am trying to download video file and pdf through DownloadManager. For pdf its working fine but when i am trying to download the video its not getting downloaded. I am using below code: private void downloadFileFromServer(String fid, String title, String uri) { boolean isPdf = uri.matches(".*\\b.pdf\\b.*"); if (isPdf) { fileName = fid + ".pdf"; } else { fileName = fid + ".mp4"; } File file = new File(getActivity().getExternalFilesDir("DDocs/") + "/Files/" + fileName); if (file.exists()) { Intent intent = new Intent(Intent.ACTION_VIEW); if (isPdf) { intent.setDataAndType(Uri.fromFile(file), "application/pdf"); } else { intent.setDataAndType(Uri.fromFile(file), "video/mp4"); } startActivity(intent); } else if (BUtil.isOnline(getActivity())) { downloadManager = (DownloadManager) getActivity().getSystemService( DOWNLOAD_SERVICE); Uri Download_Uri = Uri.parse(uri); DownloadManager.Request request = new DownloadManager.Request( Download_Uri); request.addRequestHeader(BConstant.WEB_SERVICES_COOKIES, cookie); request.addRequestHeader(BConstant.WEB_SERVICES_TOKEN_HEADER, token); request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE); request.setTitle(title); request.setDestinationInExternalFilesDir(getActivity(), "DDocs/Files", fileName); if (!file.exists()) { progressBar = new ProgressDialog(getActivity()); progressBar.setCancelable(false); progressBar.setMessage(BConstant.LODING); progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressBar.show(); lastDownload = downloadManager.enqueue(request); } } else if (!BUtil.isOnline(getActivity())) { ToastUserMessage.message(getActivity(), BUserMessage.FIRST_TIME_LOAD_MESSAGE); } }

http://stackoverflow.com/comment/38522280
has text: Well, what the for loop code does is just render tiles that are inside of the screen. But, I didn't understood, what should I do to my code? PS: Thanks for answering... +1
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24815460
type: Comment

http://stackoverflow.com/a/24850419
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24850252
upvote count: 2
has body: You are already looking in class path using ClassPathXmlApplicationContext hence there is no need to add classpath::*. Simply remove it and see your problem will be gone. ctx = new ClassPathXmlApplicationContext("com/springDemo/main/contextBean.xml"); You can try with FileSystemXmlApplicationContext as well where you have to use classpath: ctx = new FileSystemXmlApplicationContext("classpath:com/springDemo/main/contextBean.xml");
type: Answer

http://stackoverflow.com/comment/38644270
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24879949
score: 0
has text: what do you get when you print person? What exactly do you want to do? could you please be clearer?

http://stackoverflow.com/comment/38455523
score: 0
comment on: http://stackoverflow.com/q/24780508
type: Comment
type: QuestionComment
has text: can u show your AsyncTask code which is more suitable here.. with PreExecute and PostExecute

http://stackoverflow.com/q/24797212
has answer: http://stackoverflow.com/a/24798070
has answer: http://stackoverflow.com/a/40264107
downvote count: 0
has comment: http://stackoverflow.com/comment/38488008
has title: sorting on the basis on a column not alphabetically
favorite count: 0
has answer: http://stackoverflow.com/a/24797832
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24797497
score: 1
tagged with: java
has body: I have a bean called vulnerability. It is having a column "severity". private String severity; Severity can hold string value High,Medium and Low. Now whenever sorting of this bean on the basis of severity column is done it happens alphabetically i.e. High,Low and Medium. But i want the sorting to happen high,medium, low when descending and low, medium,high when ascending. I was seeing comparator to make this custom sorting but it needs to cover lots of cases. Isn't their any other way?
has answer: http://stackoverflow.com/a/53380493
upvote count: 1
has comment: http://stackoverflow.com/comment/38487836
has comment: http://stackoverflow.com/comment/38488117
type: Question
has comment: http://stackoverflow.com/comment/38487840
tagged with: sorting
linked to: http://stackoverflow.com/q/1149671

http://stackoverflow.com/q/24810586
favorite count: 0
tagged with: android
score: -2
tagged with: android-asynctask
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24810647
downvote count: 2
has body: ORIGINAL TITLE: android.os.NetworkOnMainThreadException with MongoDB cursor in an AsyncTask? I'm developing for Android using AndroidStudio and a MongoDB backend, and I'm getting a NetworkOnMainThreadException despite doing everything network-related using an AsyncTask. Here is the method in our database class (MyDB) that calls the GetTasksTask (subclass of AsyncTask): public void getStoredTasks(CallbackHandler&lt;ArrayList&lt;PAWTask&gt;&gt; handler) { GetTasksTask task = new GetTasksTask(mongoDB, handler); task.doInBackground(); } And here is the GetTasksTask class (PAWTaskMongo is a Mongo model class, and PAWTask is a wrapper for that used throughout the app): private class GetTasksTask extends AsyncTask&lt;Void, Void, ArrayList&lt;PAWTask&gt;&gt; { private DB mongoDB; private CallbackHandler handler; public GetTasksTask(DB mongoDB, CallbackHandler handler) { this.mongoDB = mongoDB; this.handler = handler; } @Override protected ArrayList&lt;PAWTask&gt; doInBackground(Void... voids) { ArrayList&lt;PAWTask&gt; storedTasks = new ArrayList&lt;PAWTask&gt;(); DBCollection coll = mongoDB.getCollection(DBMongoParse.PAW_TASK_COLLECTION); BasicDBObject query = new BasicDBObject("isDeleted", false); List&lt;DBObject&gt; tasks = coll.find(query).toArray(); for (DBObject task : tasks) { storedTasks.add(new PAWTask((PAWTaskMongo) task)); } return storedTasks; } @Override protected void onPostExecute(ArrayList&lt;PAWTask&gt; result) { handler.handle(result); } } The code for the CallbackHandler: public abstract class CallbackHandler&lt;T&gt; { public abstract void handle(T result); } Here is how I get an instance of the Mongo DB (which is done earlier, when I instantiate the MyDB class): private MyDB() { new OpenMongoConnectionTask().execute(); } private class OpenMongoConnectionTask extends AsyncTask&lt;Void, Void, Void&gt; { protected Void doInBackground(Void... voids) { try { MongoClient mongoClient = new MongoClient(); mongoDB = mongoClient.getDB("mydb"); pawTaskCollection …
has comment: http://stackoverflow.com/comment/38512723
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/24810647
has comment: http://stackoverflow.com/comment/38513543
upvote count: 0
has title: android.os.NetworkOnMainThreadException in an AsyncTask?
answer count: 1

http://stackoverflow.com/a/24858694
answers question: http://stackoverflow.com/q/24858624
score: 3
upvote count: 3
has body: The fact that you are using a DataSource in no way means that your code doesn't need to close a connection when it is done with it. No matter how you get the connection, you need to ensure that you close the connection when you're done with it. The DataSource tutorial, for example, explicitly points out that you need to close your connections and suggests something like try { Connection con = ds.getConnection(username, password); // ... code to use the pooled // connection con } catch (Exception ex { // ... code to handle exceptions } finally { if (con != null) con.close(); }
has comment: http://stackoverflow.com/comment/38622197
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38605513

http://stackoverflow.com/comment/38560968
comment on: http://stackoverflow.com/a/24798353
score: 0
type: AnswerComment
has text: thank you for your input... I originally removed the open jdk because I didnt think I needed it. I installed the oracle jdk the same way you mentioned as well... my problem has been, since removing eclipse adt originally, every install has some kind of problem now when the original ran perfect. I also dont want oracle jdk for eclipse since I am doing android builds not apps which the open jdk is suggested... I have both oracle and open on my system, through the terminal I set open jdk as default and javac is set to open jdk, yet anything associated with android assigns oracle, weird.
type: Comment

http://stackoverflow.com/comment/38603516
type: Comment
comment on: http://stackoverflow.com/a/24857852
has text: http://www.megafileupload.com/en/file/551807/AdaDerana-rar.html here..this is my code
type: AnswerComment
score: 0

http://stackoverflow.com/a/24832494
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/24830610
has body: As stated in @John's answer, the fact that there is already a 0.1.2-SNAPSHOT, interfered with my new non-SNAPSHOT version 0.1.2. Since the 401 Unauthorized error is nebulous and unhelpful--and is normally associated to user/pass problems--it's no surprise that I was unable to figure this out on my own. Changing the version to 0.1.3 brings me back to my original error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project xbnjava: Failed to install artifact com.github.aliteralmind:xbnjava:jar:0.1.3: R:\jeffy\programming\build\xbnjava-0.1.3\download\xbnjava-0.1.3-all.jar (The system cannot find the path specified) -> [Help 1]. A sonatype support person also recommended that I remove the <parent> block from my POM (it's only there because it's in the one from ez-vcard, which is what I started with) and replace my <distributionManagement> block with <distributionManagement> ossrh https://oss.sonatype.org/content/repositories/snapshots ossrh https://oss.sonatype.org/service/local/staging/deploy/maven2/ </distributionManagement> and then make sure that lines up with what's in your settings.xml: ossrh your-jira-id your-jira-pwd After doing this, running mvn deploy actually uploaded one of my jars for the very first time!!! Output: [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building XBN-Java 0.1.3 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- build-helper-maven-plugin:1.8:attach-artifact (attach-artifacts) @ xbnjava --- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ xbnjava --- [INFO] Installing R:\jeffy\programming\sandbox\z__for_git_commit_only\xbnjava\pom.xml to C:\Users\jeffy\.m2\repository\com\github\aliteralmind\xbnjava\0.1.3\xbnjava-0.1.3.pom [INFO] Installing R:\jeffy\programming\build\xbnjava-0.1.3\download\xbnjava-0.1.3.jar to C:\Users\jeffy\.m2…
score: 4
downvote count: 0

http://stackoverflow.com/comment/38672187
score: 0
type: Comment
has text: I am not sure exactly what is wrong, because query does not show anything. There are also no errors...
type: QuestionComment
comment on: http://stackoverflow.com/q/24894701

spring-social
tags question: http://stackoverflow.com/q/24853949
tag name: spring-social
type: Tag

http://stackoverflow.com/comment/38595689
comment on: http://stackoverflow.com/a/24849804
score: 0
has text: I think I understand what do you say, but I am not sure what I have to do to fix it. I am trying to avoid "miSocket.close()", but it doesn't work. Do you think it's better to use a socket only?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24873574
has comment: http://stackoverflow.com/comment/38767944
score: 1
has comment: http://stackoverflow.com/comment/38717626
answers question: http://stackoverflow.com/q/24873506
has comment: http://stackoverflow.com/comment/38765377
has comment: http://stackoverflow.com/comment/38636555
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38773260
has comment: http://stackoverflow.com/comment/38635918
has comment: http://stackoverflow.com/comment/38728839
has body: A variable is available only in the scope it was declared. In your case the scope is inside the run() method. If you want it available outside - it should be declared outside. public static void main(String[] args) { final MyObj obj = new MyObj(); Timer t = new Timer(); t.schedule(new TimerTask(){ public void run(){ obj.set(0.5); } },500); System.out.println(obj.get()); } private static class MyObj { private double od; public void set(double val) { od = val; } public double get() { return od; } } Remark: A good rule of thumb is to declare the variable in the smaller (most specific) scope possible, in order to help GC deal with unused objects.
type: Answer
has comment: http://stackoverflow.com/comment/38776454
has comment: http://stackoverflow.com/comment/38773286
accepted answer of: http://stackoverflow.com/q/24873506
has comment: http://stackoverflow.com/comment/38760864
has comment: http://stackoverflow.com/comment/38730851
upvote count: 1
has comment: http://stackoverflow.com/comment/38775035
has comment: http://stackoverflow.com/comment/38776757
has comment: http://stackoverflow.com/comment/38773031

http://stackoverflow.com/a/24794355
score: 1
has comment: http://stackoverflow.com/comment/38499902
has comment: http://stackoverflow.com/comment/38482963
type: Answer
has body: set collation greek_general_ci. ALTER TABLE &lt;table name&gt; CONVERT TO CHARACTER SET utf8 COLLATE greek_general_ci; EDIT: In MySQL Workbench right click on table->Alter Table--> change Collation to greek_general_ci or greekbin
answers question: http://stackoverflow.com/q/24794098
upvote count: 1
has comment: http://stackoverflow.com/comment/38482870
downvote count: 0

http://stackoverflow.com/comment/38692794
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24903397
type: Comment
has text: Still doesnt work. My echo$classpath is empty. I have not enter the class files in eclpise but I am sure that I can load the main Harness class from outside.

http://stackoverflow.com/q/24856566
accepted answer: http://stackoverflow.com/a/24856634
tagged with: java
has title: Countdown Timer in Minutes
has comment: http://stackoverflow.com/comment/38600048
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24856634
downvote count: 0
has body: I'm trying to write a program to display a countdown timer which shows minutes and seconds. I know how to do it in seconds but I'm not sure how I can get it to countdown in minutes and seconds. For Example the countdown should look like this: 2 minutes, 59 seconds 2 minutes, 58 seconds 2 minutes, 57 seconds etc etc Here is my code thus far: import java.util.Scanner; public class Test { public static void main(String[] args) throws InterruptedException { Scanner scan = new Scanner(System.in); System.out.println("How much time (In Minutes) ?"); int timet= scan.nextInt(); long delay = timet * 1000; do { Thread.sleep(1000); System.out.println(timet / 1); timet = timet - 1; delay = delay - 1000; } while (delay != 0); System.out.println("Time's Up!"); } }
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/24856771
has answer: http://stackoverflow.com/a/24856771
score: 2
type: AnsweredQuestion
tagged with: java.util.scanner

http://stackoverflow.com/q/24784655
has title: Tomcat on ec2 works fine but after sometime it fails
has body: I have deployed my java application on Tomcat running on aws.It works fine for initial hours but after that it fails while login.The login logic is a servlet called AuthenticateUser.Fails means it goes to the AuthenticateUser and it displays a blank page there.The thing is that I have opened many database connection but haven't closed any of them.Is it because of that? Thanks.
type: UnansweredQuestion
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/38464395
answer count: 0
tagged with: java
type: Question
tagged with: amazon-ec2
has comment: http://stackoverflow.com/comment/38466037
tagged with: amazon-web-services
tagged with: tomcat
score: 0

http://stackoverflow.com/a/24767113
has comment: http://stackoverflow.com/comment/38431668
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/38431520
has comment: http://stackoverflow.com/comment/38431156
has body: Use a comparator import java.util.Comparator; class CustomComparator implements Comparator&lt;String&gt; { @Override public int compare(String a, String b) { if(a.contains("-") &amp;&amp; !b.contains("-")) return 1; else if(!a.contains("-") &amp;&amp; b.contains("-")) return -1; return a.compareTo(b); } } Collections.sort(arrays, new CustomComparator()); return a negative value means b comes before a and a positive value means a comes before b
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/38431357
has comment: http://stackoverflow.com/comment/38431816
has comment: http://stackoverflow.com/comment/38431506
has comment: http://stackoverflow.com/comment/38431923
has comment: http://stackoverflow.com/comment/38431909
has comment: http://stackoverflow.com/comment/38431521
has comment: http://stackoverflow.com/comment/38431327
has comment: http://stackoverflow.com/comment/38431123
accepted answer of: http://stackoverflow.com/q/24767022
score: 4
has comment: http://stackoverflow.com/comment/38431711
has comment: http://stackoverflow.com/comment/38431496
answers question: http://stackoverflow.com/q/24767022

http://stackoverflow.com/q/24870042
tagged with: unit-testing
type: Question
tagged with: mockito
score: 0
has body: I have a class with two methods. I want to replace invocation of second method with expected result. Here is my class under test public class A { public int methodOne() { return methodTwo(1); } public int methodTwo(int param) { // corresponding logic replaced for demo throw new RuntimeException("Wrong invocation!"); } } And test public class ATest { @Test public void test() { final A a = spy(new A()); when(a.methodTwo(anyInt())).thenReturn(10); a.methodOne(); verify(a, times(1)).methodTwo(anyInt()); } } Why I'm get an exception when start the test?
has comment: http://stackoverflow.com/comment/38625606
answer count: 1
has title: How to replace method invocation with mock?
accepted answer: http://stackoverflow.com/a/24870166
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38625454
has answer: http://stackoverflow.com/a/24870166

http://stackoverflow.com/q/24788443
type: AnsweredQuestion
tagged with: libgdx
tagged with: java
has title: Libgdx InputListener "exit()" is not being called with TextButton
has comment: http://stackoverflow.com/comment/38473968
has answer: http://stackoverflow.com/a/24807385
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38495442
has comment: http://stackoverflow.com/comment/38490929
favorite count: 0
score: 3
tagged with: android
tagged with: input
tagged with: listener
accepted answer: http://stackoverflow.com/a/24807385
upvote count: 3
has comment: http://stackoverflow.com/comment/38473231
has comment: http://stackoverflow.com/comment/38475036
type: Question
has body: I want to use the exit() method in the InputListener to see wheter the cursor is inside the button or not. Here is the explanation in the libGDX docs. public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) Called any time the mouse cursor or a finger touch is moved out of an actor. But when I put my cursor on the button and then move it outside the button, the method is not called. I am testing it by a System.out.println("exited"); and I get nothing in the console. EDIT: LibGDX Version: Latest Stable Nightlies InputListener implementation: //This button class is a custom class to make button creation easier. This is the constructor. public Button(Vector2 position, String packLocation, String text, Stage stage, BitmapFont font, Color color) { //Removed buttonStyle creation etc. to shorten the code. button = new TextButton(text, buttonStyle); button.setPosition(position.x, position.y); stage.addActor(button); Gdx.input.setInputProcessor(stage); pressed = false; button.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { pressed = true; return true; } @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { pressed = false; } @Override public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) { System.out.println("exited"); } }); } EDIT: Hovering over the button also does not change the texture of the button as I set it to like so: buttonStyle.over = skin.getDrawable("over"); But clicking does.

http://stackoverflow.com/comment/38533594
has text: @JohnSmith The problem is in your encrypt method if you return `encrypted` string instead of `return URLEncoder.encode(encrypted, "UTF-8");`, all will be ok.
comment on: http://stackoverflow.com/a/24807271
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24827445
score: 1
linked to: http://stackoverflow.com/q/538056
favorite count: 0
type: Question
tagged with: out-of-memory
has answer: http://stackoverflow.com/a/24827599
upvote count: 1
has answer: http://stackoverflow.com/a/24828806
has body: Out-of-memory error occurs frequently in the java programs. My question is simple: when exceeding the memory limitation, why java directly kill the program rather than swap it out to the disk? I think memory paging/swapping strategy is frequently used in the modern operating system and programming languages like c++ definitely supports swapping. Thanks.
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/38545069
has comment: http://stackoverflow.com/comment/38544492
accepted answer: http://stackoverflow.com/a/24827599
possible better answer: http://stackoverflow.com/a/24827528
downvote count: 0
tagged with: paging
has answer: http://stackoverflow.com/a/24827528
has comment: http://stackoverflow.com/comment/38545461
has comment: http://stackoverflow.com/comment/38545590
has title: out-of-memory error -- why not paging?
type: AnsweredQuestion

http://stackoverflow.com/a/24859623
answers question: http://stackoverflow.com/q/24859475
has body: before asking that kind you of question, you should really get some understanding of java variables visibility. You cannot make a variable "accessible to only one another class". What you can do is creating a getter for it and checking the class the getter was called from, I don't see any sense here however
type: Answer
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/a/24841749
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24841563
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24841563
score: 1
has body: I have run this code, which is just a cleaned up version of yours: final Scanner in = new Scanner(System.in); System.out.println("Enter Chinese: "); String input = in.nextLine(); BufferedReader br = new BufferedReader(new FileReader("database.txt")); for (String sCurrentLine; (sCurrentLine = br.readLine()) != null;) { final String[] lineValues = sCurrentLine.split(","); input = input.replace(lineValues[0], lineValues[1]+" "); } System.out.println(input); The two sessions I tried looked as follows: Enter Chinese: 重水重 cung5 seoi2 cung4 Enter Chinese: 重水水 cung5 seoi2 seoi2 Conclusion: this program works as required. As an aside, this is how you can rewrite it with Java 8 Streams: System.out.println("Enter Chinese: "); final String input = new Scanner(System.in).nextLine(); final String result = new BufferedReader(new FileReader("database.txt")).lines() .map(line-&gt;line.split(",")) .reduce(input, (acc, lineValues) -&gt; acc.replace(lineValues[0], lineValues[1]+" ")); System.out.println(result);
type: AcceptedAnswer

maven
tags question: http://stackoverflow.com/q/24827621
tags question: http://stackoverflow.com/q/24811430
tags question: http://stackoverflow.com/q/24899985
tags question: http://stackoverflow.com/q/24855531
tags question: http://stackoverflow.com/q/24884366
tags question: http://stackoverflow.com/q/24864777
tags question: http://stackoverflow.com/q/24783000
tags question: http://stackoverflow.com/q/24903458
type: Tag
tags question: http://stackoverflow.com/q/24851941
tags question: http://stackoverflow.com/q/24756738
tags question: http://stackoverflow.com/q/24829415
tags question: http://stackoverflow.com/q/24763182
tags question: http://stackoverflow.com/q/24778098
tags question: http://stackoverflow.com/q/24787269
tags question: http://stackoverflow.com/q/24770961
tags question: http://stackoverflow.com/q/24862298
tags question: http://stackoverflow.com/q/24792292
tags question: http://stackoverflow.com/q/24906862
tags question: http://stackoverflow.com/q/24781932
tags question: http://stackoverflow.com/q/24779657
tags question: http://stackoverflow.com/q/24841572
tags question: http://stackoverflow.com/q/24892833
tags question: http://stackoverflow.com/q/24764676
tags question: http://stackoverflow.com/q/24908988
tags question: http://stackoverflow.com/q/24793800
tags question: http://stackoverflow.com/q/24820134
tags question: http://stackoverflow.com/q/24807136
tags question: http://stackoverflow.com/q/24892637
tags question: http://stackoverflow.com/q/24883102
tags question: http://stackoverflow.com/q/24884985
tags question: http://stackoverflow.com/q/24766546
tags question: http://stackoverflow.com/q/24791086
tags question: http://stackoverflow.com/q/24865454
tags question: http://stackoverflow.com/q/24830610
tags question: http://stackoverflow.com/q/24764367
tags question: http://stackoverflow.com/q/24858599
tags question: http://stackoverflow.com/q/24781938
tags question: http://stackoverflow.com/q/24782704
tags question: http://stackoverflow.com/q/24827194
tags question: http://stackoverflow.com/q/24765243
tags question: http://stackoverflow.com/q/24801059
tags question: http://stackoverflow.com/q/24838114
tags question: http://stackoverflow.com/q/24869810
tags question: http://stackoverflow.com/q/24802852
tags question: http://stackoverflow.com/q/24844399
tags question: http://stackoverflow.com/q/24885555
tags question: http://stackoverflow.com/q/24877537
tags question: http://stackoverflow.com/q/24815264
tags question: http://stackoverflow.com/q/24773844
tags question: http://stackoverflow.com/q/24870730
tags question: http://stackoverflow.com/q/24898825
tags question: http://stackoverflow.com/q/24840534
tags question: http://stackoverflow.com/q/24826164
tags question: http://stackoverflow.com/q/24813357
tags question: http://stackoverflow.com/q/24791298
tags question: http://stackoverflow.com/q/24868552
tags question: http://stackoverflow.com/q/24836224
tags question: http://stackoverflow.com/q/24830965
tags question: http://stackoverflow.com/q/24899538
tags question: http://stackoverflow.com/q/24842455
tags question: http://stackoverflow.com/q/24808196
tags question: http://stackoverflow.com/q/24824936
tags question: http://stackoverflow.com/q/24895014
tags question: http://stackoverflow.com/q/24809048
tags question: http://stackoverflow.com/q/24820329
tags question: http://stackoverflow.com/q/24896522
tags question: http://stackoverflow.com/q/24822756
tags question: http://stackoverflow.com/q/24872326
tags question: http://stackoverflow.com/q/24824103
tags question: http://stackoverflow.com/q/24876773
tags question: http://stackoverflow.com/q/24888316
tags question: http://stackoverflow.com/q/24907449
tags question: http://stackoverflow.com/q/24880617
tags question: http://stackoverflow.com/q/24776378
tags question: http://stackoverflow.com/q/24819395
tags question: http://stackoverflow.com/q/24881348
tags question: http://stackoverflow.com/q/24811905
tags question: http://stackoverflow.com/q/24753602
tags question: http://stackoverflow.com/q/24908727

http://stackoverflow.com/comment/38595466
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24854365
has text: A better much more complete answer than mine. 1+
type: Comment

http://stackoverflow.com/q/24857681
has answer: http://stackoverflow.com/a/48301853
score: 4
answer count: 2
has title: Benefits of Java ClassLoader delegation model?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38602638
has body: As I know that ClassLoader first check if the class has been loaded, if not then immediately delegate this check to its parent ClassLoader.But at the end all the classes are loaded by the Bootstrap. why we are delegating and what are benefits we are achieving by this ?
has comment: http://stackoverflow.com/comment/38602309
has comment: http://stackoverflow.com/comment/38602258
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/38602390
type: Question
has answer: http://stackoverflow.com/a/24857861
upvote count: 5

svn
tags question: http://stackoverflow.com/q/24815366
tags question: http://stackoverflow.com/q/24783453
type: Tag
tags question: http://stackoverflow.com/q/24766546
tag name: svn

http://stackoverflow.com/comment/38636773
score: 0
type: AnswerComment
has text: @tieTYT - *"That works, but I don't get why I have to do it. Why isn't a List<Dog> a List<Animal>?"* That's **exactly** what [my question](http://stackoverflow.com/questions/24188824) (linked to in my comment above) was asking.
type: Comment
comment on: http://stackoverflow.com/a/24875906

http://stackoverflow.com/comment/38475092
type: Comment
comment on: http://stackoverflow.com/a/24790057
type: AnswerComment
has text: If I understand your answer correctly, I think you're answering the wrong question. Note that there is no setter in `MyInt`. Once set by the constructor, the value of `x` will never be updated by any thread. It might as well be final, but the article claims that the fact that it isn't final creates a potential problem. I still don't understand how Thread-2 in your explanation could read a non-null value of `a` **before** the value of `x` in the object referenced by `a` is set to 42.
score: 0

http://stackoverflow.com/comment/38731308
type: QuestionComment
has text: I doubt you have to close the socket, just closing the stream should do. Could you please update your code, may be just the bit where you are facing the error(only the write part)
score: 0
comment on: http://stackoverflow.com/q/24907854
type: Comment

http://stackoverflow.com/comment/38595454
has text: I changed it to NodeList nodeList = element.getAttributeNode(tag).getChildNodes(); thanks it works
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24854303
score: 0

http://stackoverflow.com/q/24792898
has title: In Android, is there a way to set flags/ broadcast receivers to affect other applications?
tagged with: java
tagged with: flags
type: Question
tagged with: broadcastreceiver
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24808274
tagged with: android
has body: working on an idea for an app but research is proving difficult to get a straight answer on the subject so I wanted to ask the experts. What I want to know it, is there a way within your written code to have a direct effect on other applications? 3 Examples (To try and make it more clear): 1) Adjust something in my app so that whenever I open up an app that starts with N (IE Netflix) the media volume turns to max, or the wifi turns on. 2) Adjust something in my app so that whenever I receive an email to my yahoo account (using the yahoo mail app) a toast comes up that says, "DANGER WILL ROBINSON!". 3) Adjust something in my app so that whenever I open up the application facebook, a notification bar icon appears. Essentially, I am trying to change something within the phone (a Setting, a toast, whatever) whenever another app is opened up via my application's code. Ideas? Can this be done? Thanks for the help all!
accepted answer: http://stackoverflow.com/a/24808274
type: AnsweredQuestion

http://stackoverflow.com/a/24832649
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24831291
has body: I've never used trimmomatic but it looks like you are passing in the incorrect parameters. the trimmomatic webpage lists the usage from version 0.27+ as: java -jar &lt;path to trimmomatic.jar&gt; PE [-threads &lt;threads] [-phred33 | -phred64] [-trimlog &lt;logFile&gt;] &lt;input 1&gt; &lt;input 2&gt; &lt;paired output 1&gt; &lt;unpaired output 1&gt; &lt;paired output 2&gt; &lt;unpaired output 2&gt; &lt;step 1&gt; ... or using the "old way" java -classpath &lt;path to trimmomatic jar&gt; org.usadellab.trimmomatic.TrimmomaticPE [-threads &lt;threads&gt;] [-phred33 | -phred64] [-trimlog &lt;logFile&gt;] &lt;input 1&gt; &lt;input 2&gt; &lt;paired output 1&gt; &lt;unpaired output 1&gt; &lt;paired output 2&gt; &lt;unpaired output 2&gt; &lt;step 1&gt; ... Where the only difference is the new way is specifying "PE" as the main class instead of a fully qualified path. First, addressing your 2nd problem: You look like you are doing both: specifying a fully qualified class name as well as the PE part. This makes trimmomatic think you have a fastq file named "PE" which doesn't exist. If you get rid of the "PE" OR the qualfited class name; it will call the correct class. Which is what you do first in your first problem. 1st problem I don't think you have the correct number of arguments listed in your first invocation so trimmomatic displays the usage to tell you what parameters are required. It would be nice if it told you what was wrong but it doesn't. Solution It looks like you are only providing 2 fastq files but trimmmoatic needs 6 file paths. You are missing the output paired and unpaired files paths for the read 1 and read 2 data which I assume get created by the program when it runs. I guess your 2nd attempt got further along in the program since it saw enough parameters that you potentially had enough file paths specified (however, it turns out you had optional step parameters)

http://stackoverflow.com/comment/38493983
has text: Using SET is only valid for the current CMD session. Are you starting JBoss in the same session?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24800402
score: 0

http://stackoverflow.com/comment/38629452
comment on: http://stackoverflow.com/q/24871977
score: 0
type: Comment
type: QuestionComment
has text: i know that you want to do it on a different thread, but does .prepare() work?

http://stackoverflow.com/comment/78345101
comment on: http://stackoverflow.com/a/24852542
score: 1
has text: @jpangamarca destroy? Can you explain how?
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24836493
has title: servlet extending another servlet
score: 0
accepted answer: http://stackoverflow.com/a/24836577
has comment: http://stackoverflow.com/comment/38561409
type: AnsweredQuestion
has body: I was going thorugh a recent code which was written in servlet. The servlet hierarchy is like this, There is a servlet A which is extended by servlet B extended by servlet C,D,E,F. Now in my web.xml I have 5 urls configured for these servlets all are mapped to servlet A. So my mapping looks like URL- /downloadservlet - Class - Servlet A URL- /readcontent - Class servlet A URL- /getdetails - Class servlet A .. etc etc Now when I wanted to execte the doPost method in servlet D how can I achieve it? because this request can also be served by C or E or F. The application works correctly but I could not understand how the request is routed to the correct servlet. Any explaination on this is very much appreciated.
has answer: http://stackoverflow.com/a/24836577
tagged with: java
tagged with: servlets
type: Question
answer count: 1

http://stackoverflow.com/q/24893073
favorite count: 0
linked to: http://stackoverflow.com/q/25181929
has answer: http://stackoverflow.com/a/24893112
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38669032
tagged with: jtextpane
upvote count: 1
tagged with: swing
has body: I have a JPanel with Boxlayout and some JTextPanes and JPanels that will be added to it dynamically. I want to set the preferred size of the JTextPanes to fit their content. I use StyledDocument for my JTextPane. How can I do this? Edit: When I create a new JTextPane I have its content and it won't change. Here is my code: public void display(final String text){ StyleContext sc = new StyleContext(); final DefaultStyledDocument doc = new DefaultStyledDocument(sc); Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); final Style style = sc.addStyle("MainStyle", defaultStyle); JTextPane pane = new JTextPane(){ /** * */ private static final long serialVersionUID = 1L; @Override public Dimension getMinimumSize(){ return new Dimension(text.length()*5, getContentHeight(text.length()*5,text)); } @Override public Dimension getMaximumSize(){ return new Dimension(430, getContentHeight(text.length()*5,text)); } }; receive.setStyledDocument(doc); receive.setEditable(false); receive.setPreferredSize(new Dimension(text.length()*5, getContentHeight(text.length()*5,text))); try { doc.insertString(doc.getLength(),text,style); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } Jpanel.add(pane); } public int getContentHeight(int i, String content) { JEditorPane dummyEditorPane=new JEditorPane(); dummyEditorPane.setSize(i,Short.MAX_VALUE); dummyEditorPane.setText(content); return dummyEditorPane.getPreferredSize().height; } The issue is in the getMinimumSize(), getMaximumSize(), and setPreferredSize() methods! Also in the width that I set for dummyEditorPane.setSize(i,Short.MAX_VALUE); How can I set a fixed size for the JTextPane?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/66254110
has answer: http://stackoverflow.com/a/24902627
type: Question
has title: How to set preferred size of JTextPane to its content size?
answer count: 2
tagged with: preferredsize
downvote count: 0

http://stackoverflow.com/q/24863956
has answer: http://stackoverflow.com/a/24865537
tagged with: java
has title: JAXB - Generate schema. Complex Type custom attribute
tagged with: jaxb
type: Question
answer count: 1
has body: I need to generate following schema from java class using JAXB. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb"&gt; &lt;xs:element name="test" type="test"/&gt; &lt;xs:complexType name="testName" xdb:SQLType="WEBY_TEST_NAME"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="date" type="xs:dateTime"/&gt; &lt;xs:element name="id" type="xs:int"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; How to add xdb:SQLType="WEBY_TEST_NAME" into complexType element using jaxb annotations ?
score: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: annotations

http://stackoverflow.com/a/49491297
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24907753
has body: Please Check the Pending Intent request code, that should be unique for each cycle of loop.

http://stackoverflow.com/comment/38653709
score: 1
type: QuestionComment
has text: I'm not sure I understand what information is missing here. Should I attach a sound file containing the data? So far my app does not record and save the data. It comes in as an analog signal through the microphone port. After it's processed the only output I expected was an integer number representing the remote code as I mentioned in the question. Could you be more specific about what is missing? As for the complexity, I spend a lot of time writing computer vision applications. I kind of assumed that this would be similar in complexity. Was I wrong?
comment on: http://stackoverflow.com/q/24845761
type: Comment

http://stackoverflow.com/q/24865961
has answer: http://stackoverflow.com/a/24934956
has title: WinForm : How to load rad autocomplete textbox from database with text and value in a block
type: Question
tagged with: c#
tagged with: java
tagged with: javascript
score: 0
has body: I have a code like this: public void LoadDiseaes() { da.OpenConnection(); Disease disease = new Disease(da); txtDisease.AutoCompleteDataSource = disease.GetAll(); txtDisease.AutoCompleteDisplayMember ="DiseaseName"; txtDisease.AutoCompleteValueMember ="ID"; } Initially, I have used above code to bind autocomplete textbox(txtDisease) with its Datasource. `````````````````````````````````````````````````````````````````````````````````````` Then, after I selected particular disease and saved the record. This work fine. My question is that when I want update that record I want to populate my AutoComplete(txtDisease) with the Disease from the Database with its Text and Value in a block which I have selected during saving the record but it gives me only a text and not value in background.
answer count: 1
tagged with: jquery
tagged with: asp.net
type: UnansweredQuestion

http://stackoverflow.com/comment/39018383
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25077728
has text: There are two errors in code:- First on line `container = findViewById(R.id.linearLayoutForm);` saying *"Type mismatch: cannot convert from View to LinearLayout"* and second is on line ` Spinner s = newView.findViewById(R.id.spinner1);` saying *"Type mismatch: cannot convert from View to Spinner"*. How to fix them???
type: Comment

http://stackoverflow.com/q/24764378
score: -1
has comment: http://stackoverflow.com/comment/38426363
type: Question
has body: If I exit my app in the usual way by pressing the back button from the Main Activity it remains in the "Active Applications" list (Hold down home button, press left icon, first tab). I have noticed that other applications do not seem to do this. Gmail for example disappears from the Active Applications list when you press the back button and go back to the home screen. What is the Gmail app doing that my app isnt? All the apps always remain in the recent apps list (long press home button), but its just mine that seems to remain in the "Active Applications" list. I have users contacting me saying that my app is using up their system resources as it is appearing in this Active Applications list, and none of their other apps seem to do this. Currently I am doing this in my main activity: @Override public void onBackPressed() { moveTaskToBack(true); } How can I fix this? Am I not shutting the app down properly?
answer count: 2
has title: My Android app doesnt disappear from "Active Applications" list like others
upvote count: 0
has comment: http://stackoverflow.com/comment/38426337
favorite count: 0
has comment: http://stackoverflow.com/comment/38426395
tagged with: android
has answer: http://stackoverflow.com/a/24764609
has comment: http://stackoverflow.com/comment/38426189
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38427418
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24764484

http://stackoverflow.com/a/24786365
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24783836
has comment: http://stackoverflow.com/comment/38467361
answers question: http://stackoverflow.com/q/24783836
type: AcceptedAnswer
downvote count: 0
score: 1
has body: Since you are developing for Android, the easiest way to get access is by using the Firebase Client. Once you have that setup, read the Nest documentation about working with the thermostat data model.
has comment: http://stackoverflow.com/comment/38527316
type: Answer
has comment: http://stackoverflow.com/comment/38499181
has comment: http://stackoverflow.com/comment/38526554

http://stackoverflow.com/q/24842765
tagged with: jsoup
has body: Class test package test; import java.io.IOException; import org.jsoup.*; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.util.Scanner; public class test { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); String url, artistIn, artist, base; SongUrl[] obj = new SongUrl[100]; base = "http://lyrics.wikia.com/"; int count = 0; System.out.println("Enter an artist"); artistIn = in.nextLine(); artist = artistIn.replace(' ', '_'); url = "http://lyrics.wikia.com/api.php?func=getSong&amp;artist=" + artist + "&amp;fmt=html"; Document doc = Jsoup.connect(url).get(); Elements a = doc.select("a[href]"); for(Element alink : a){ obj[count] = new SongUrl(); obj[count].urlSong = alink.toString(); count++; obj[count].serialNo = count; //Faced NPE on this line System.out.println(count + " " + alink.html()); } } } Class SongUrl public class SongUrl { int serialNo; String urlSong; } I was faced with NullPointerException on the line obj[count].serialNo = count; . It's surprising that if NPE was to occur, it should have happened on this line obj[count].urlSong = alink.toString(); which came before it. I'm in the dark as to what has gone wrong.
has answer: http://stackoverflow.com/a/24842796
score: 0
tagged with: nullpointerexception
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/38573025
accepted answer: http://stackoverflow.com/a/24842796
has title: Error due to NullPointerException
type: AnsweredQuestion
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/24842804
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24842804

http://stackoverflow.com/comment/38620455
type: Comment
score: 0
type: AnswerComment
has text: Thank you for clearing this thing out for me. I will edit your answer so that if someone has the same problem he or she can find the answer in these comments.
comment on: http://stackoverflow.com/a/24843923

http://stackoverflow.com/q/24857003
has answer: http://stackoverflow.com/a/68967858
upvote count: 9
has comment: http://stackoverflow.com/comment/38638577
tagged with: java
has comment: http://stackoverflow.com/comment/99089514
has comment: http://stackoverflow.com/comment/59576832
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/38601729
has comment: http://stackoverflow.com/comment/38638940
has comment: http://stackoverflow.com/comment/38622740
has body: I'm building a small application using Spring and Spring Data JPA and I need to use the CrudRepository methods in the service layer, so I made 2 classes: GenericService and GenericServiceImpl. But I don't know if this is the right or even the best approach. Here is an example: POJO: @Entity public class User { @Id private Long id; private String username; } DAO: public interface UserDAO extends CrudRepository&lt;User, Long&gt; { User findOneByUsername(String username); } Generic service public interface GenericService&lt;T, ID extends Serializable&gt; { &lt;S extends T&gt; S save(S entity); } Service public interface UserService extends GenericService&lt;User, Long&gt; { User findOneByUsername(String username); } Generic service impl. public class GenericServiceImpl&lt;T, ID extends Serializable&gt; implements GenericService&lt;T, ID&gt; { @Autowired private CrudRepository&lt;T, ID&gt; repository; @Override public &lt;S extends T&gt; S save(S entity) { return repository.save(entity); } } Service Impl. @Service @Transactional public class UserServiceImpl extends GenericServiceImpl&lt;User, Long&gt; implements UserService { @Autowired private UserDAO userDAO; @Override public User findOneByUsername(String username) { userDAO.findOneByUsername(username); } }
tagged with: spring-data-jpa
has title: Crud methods in service layer using Spring Data JPA
has comment: http://stackoverflow.com/comment/38627015
favorite count: 0
score: 8
type: UnansweredQuestion
tagged with: spring
tagged with: design-patterns
downvote count: 1
has comment: http://stackoverflow.com/comment/82720290
type: Question

http://stackoverflow.com/q/24763228
has title: Get Content android error
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38425472
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38423773
type: Question
has body: I encounter this error when I start the get content at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186) 07-15 12:12:17.420: W/System.err(2368): at java.net.URL.openStream(URL.java:470) 07-15 12:12:17.420: W/System.err(2368): at com.axcel.mp3tube.GetContentFiles.makeurl(GetContentFiles.java:25) 07-15 12:12:17.420: W/System.err(2368): at com.axcel.mp3tube.GetContentFiles$1.run(GetContentFiles.java:44) This is the method I'm using: package com.axcel.mp3tube; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.Date; public class GetContentFiles { static long lDateTime = new Date().getTime(); String strLong = Long.toString(lDateTime); static String hash; // Id do video public static String makeurl(String url) throws Exception { URL yahoo = new URL("http://www.youtube-mp3.org/a/itemInfo/?video_id=" + url + "&amp;ac=www&amp;t=grp&amp;r=&amp;r=" + generatelengh(url + lDateTime)); BufferedReader in = new BufferedReader(new InputStreamReader( yahoo.openStream())); String inputLine; String returna = null; while ((inputLine = in.readLine()) != null) returna = inputLine; in.close(); return returna; } public static String ThreadOpen(final String video_id) { Thread thread = new Thread() { @Override public void run() { try { hash = makeurl(video_id); } catch (Exception e) { e.printStackTrace(); } } }; thread.start(); return hash; } public static int generatelengh(String a) { int __AM = 65521; int c = 1, b = 0, d, e; for (e = 0; e &lt; a.length(); e++) { d = a.charAt(e); c = (c + d) % __AM; b = (b + c) % __AM; } return b &lt;&lt; 16 | c; } } I usethis in my activity String hash = GetContentFiles.ThreadOpen(linkvideo2);
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38423637
tagged with: android

http://stackoverflow.com/q/24861936
accepted answer: http://stackoverflow.com/a/24862266
type: Question
answer count: 2
has title: How to use jasper-reports with spring MVC?
possible better answer: http://stackoverflow.com/a/78602655
downvote count: 0
tagged with: jsp
favorite count: 0
has body: I want to generate a report using jasper-reports and i can't figure what information should contain the controller, because when i a create the report i am using as data source the result set of a query. reports.jsp <%@ include file="/WEB-INF/template/taglibs.jsp"%> <%@ include file="menu.jsp"%> Generate full report Generate partial report Generate another report ReportsController.java package catering.web.controller; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class ReportsController { protected static Logger logger = Logger.getLogger("controller"); @RequestMapping(value="reports", method = RequestMethod.GET) public String reportsGet(Model model, Authentication authentication){ logger.debug("Received request to show reports page(GET)"); model.addAttribute("username", "You are logged in as " + authentication.getPrincipal()); return "reports"; } @RequestMapping(value = "/reports/fullreport/pdf", method = RequestMethod.GET) public ModelAndView fullReport(ModelAndView model){ logger.debug("Received request to download PDF report"); //List<UserModelSummary> users = UserSummaryDataAccess.getUsersSummary(); //JRDataSource ds = new JRBeanCollectionDataSource(users); //Map<String, Object> parameterMap = new HashMap<String, Object>(); //parameterMap.put("datasource", ds); //model = new ModelAndView("pdfReport",parameterMap); return model; } } jasper-views.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:p="http://www.springframework.…
tagged with: spring
tagged with: spring-mvc
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/78602655
tagged with: jasper-reports
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24862266

http://stackoverflow.com/comment/38497965
type: Comment
comment on: http://stackoverflow.com/a/24802630
score: 0
type: AnswerComment
has text: I have an odd suspicion that that line that increments `result` should say `result += p2 - p1 + 1;` but I'm not sure now - since I've had so many wrong ideas about this question.

http://stackoverflow.com/a/24804323
answers question: http://stackoverflow.com/q/24803315
has comment: http://stackoverflow.com/comment/38542823
has comment: http://stackoverflow.com/comment/38501047
has body: As far as I unterstood your question right, this should do the trick: XSSFCell cell = (XSSFCell) row.getCell( index ); if( cell == null ) { cell = (XSSFCell) row.createCell( index ); } if( cell.getStringCellValue().trim().isEmpty() ) { String cellRef = CellReference.convertNumToColString( cell.getColumnIndex() ); System.err.println( "Empty cell found: " + cellRef + Integer.toString( row.getRowNum() ) ); }
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38501346
score: 1
upvote count: 1

http://stackoverflow.com/q/24782252
score: 1
tagged with: java
has body: I need to set execution time to several statements in java. Once it couldn't be done, then I need to neglect those statements and execute the program normally. I don't want to repeat those statements again and again. Is there some way to code like try and catch event? try{ //some statements to execute in a given time. }catch(){ // if it couldn't be done } I tried this code. DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); sendTokenSock.receive(receivePacket); sentence = new String(receivePacket.getData()); rcvd = receivePacket.getAddress().getHostName(); System.out.println("RECEIVED:"+sentence); I want to wait for a datagram for given time or leave without closing socket.
type: Question
has answer: http://stackoverflow.com/a/24782435
has comment: http://stackoverflow.com/comment/38460081
downvote count: 0
has title: Set Execution time to several Statements in Java
has answer: http://stackoverflow.com/a/24782567
answer count: 3
has comment: http://stackoverflow.com/comment/38459118
favorite count: 0
has comment: http://stackoverflow.com/comment/38459063
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24782339

http://stackoverflow.com/a/24885718
answers question: http://stackoverflow.com/q/24885391
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38654692
has body: At first a new object of the Random-Class and an array with 7 elements are created. Each element of the Array has the value 0. Inside the for-loop you randomly pick element 2 to 7 of the Array and increase its current value by 1. This is done 9 times. Your code will never pick the first element of the Array which has the index 0. I would rewrite the code to make it more clear: Random rand = new Random(); int freq[] = new int[6]; int randomIndex = 0; for(int roll = 0; roll &lt; 9; ++roll) { randomIndex = rand.nextInt(6); freq[randomIndex] = freq[randomIndex] + 1; } This code has not been tested, but it should basicly do the same.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38654751
has comment: http://stackoverflow.com/comment/38654515

http://stackoverflow.com/a/24883129
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24883018
answers question: http://stackoverflow.com/q/24883018
has body: Swing isn't really a great technology for writing games, it updates slowly and is quite limited in a number of ways. Having said that yes calling invokeLater or using a SwingWorker would be the correct way to update the screen when your game thread has done its work. Before you go too much further though I really suggest looking at a 2d or 3d java graphics and game framework. You will be able to get much better results that way and a lot of the work in terms of setting up the game loop, updates, managing frame rates, etc will be done for you.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38670638
has comment: http://stackoverflow.com/comment/38672125
score: 5

http://stackoverflow.com/q/24796195
has title: Audio file is play late after write in buffer in android Audio Tack
tagged with: java
tagged with: audiotrack
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24796255
tagged with: buffer
has body: when i increase the size of buffer the audio sound that will write on buffer is play late.And when i discrease the size of buffer the file is played correctly means the file is play on time not late. any one can help ... The buffer size is 64k. public class MediaSPK { private static final int RECORDER_SAMPLERATE = 16000; private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_OUT_MONO; private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT; VaxSIPUserAgent m_objVaxSIPUserAgent; boolean m_bMuteSpk = false; boolean m_bPlay = false; AudioTrack m_objAudioTrack = null; public MediaSPK(VaxSIPUserAgent objVaxSIPUserAgent) { m_objVaxSIPUserAgent = objVaxSIPUserAgent; } public void OpenSpk() { int nMinBuffSize = AudioTrack.getMinBufferSize(RECORDER_SAMPLERATE, RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING); //Log.i("size SPK", "" + m_nMinBuffSize); m_objAudioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, RECORDER_SAMPLERATE, RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING, 64000, AudioTrack.MODE_STREAM); m_objAudioTrack.play(); m_bPlay = false; } public void PlaySpk(byte[] aData, int nDataSize) { if(m_bMuteSpk) { byte[] aDataSilence = new byte[nDataSize]; m_objAudioTrack.write(aDataSilence, 0, nDataSize); } else { m_objAudioTrack.write(aData, 0, nDataSize); } } public void Mute(boolean bEnable) { //m_bMuteSpk = bEnable; //m_objAudioTrack } public void CloseSpk() { if(m_objAudioTrack == null) return; try { m_objAudioTrack.stop(); m_objAudioTrack.release(); m_objAudioTrack = null; } catch (IllegalStateException e) { e.printStackTrace(); } } }
type: UnansweredQuestion
tagged with: android
tagged with: audio
type: Question

http://stackoverflow.com/comment/38970132
type: AnswerComment
has text: OK, but why should I save Company if there is no change in "company" table? I would like to remove Department.
comment on: http://stackoverflow.com/a/24886125
type: Comment
score: 0

http://stackoverflow.com/a/24825739
accepted answer of: http://stackoverflow.com/q/24824052
type: AcceptedAnswer
downvote count: 0
has body: Try removing: true Collect the statistics from: SessionFactory.getStatistics().getSecondLevelCacheStatistics() Try getting an entity by it's id using session.get or session.load: entityManager.find or entityManager.getReference The entity loading goes to 2st level cache, then 2nd level cache only to hit the db if there isn't such entity already loaded For methods like countryService.getAll(); that imply the query cache too, you need to explicitly activate the query cache for each particular query: query.setCacheable(true);
has comment: http://stackoverflow.com/comment/38544322
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24824052
has comment: http://stackoverflow.com/comment/38543328
has comment: http://stackoverflow.com/comment/38565437
has comment: http://stackoverflow.com/comment/38543888
score: 1
has comment: http://stackoverflow.com/comment/38543535

http://stackoverflow.com/comment/38557945
comment on: http://stackoverflow.com/q/24834511
score: 2
has text: Source code generally isn't available to compiled programs, but resources are.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38652591
type: QuestionComment
score: 0
has text: Isn't this your code: SalesAgentDao.java? Looks like a NPE at line 49. What is there? Check!
comment on: http://stackoverflow.com/q/24884527
type: Comment

http://stackoverflow.com/q/24804952
has answer: http://stackoverflow.com/a/24804973
has answer: http://stackoverflow.com/a/24805462
score: 0
tagged with: rollback
tagged with: sql
has body: I'm developing a software in Java processing data in a MySQL database and I'm facing an issue due to a rollback call not doing what I was expecting ... My function is composed of two queries and I need to rollback if the second query is not executed (or with errors) in order to keep consistent data. Here is my code, I've been doing a syntax error on purpose for throwing an error during the second query execution. The rollback method is called but my first statement is executed and committed in my database, can you explain me why ? @Override public void updateIndicatorRemainingTimeAndExecuted(int id) throws ServiceException { PreparedStatement stmt = null; Connection con = null; String query1 = "UPDATE "+indicatorSchedulerTable+" i " +"JOIN adv_frequency f ON i.id_frequency = f.id_frequency " +"SET i.ind_remainingtime = i.ind_remainingtime + f.frq_seconds WHERE id_indicator = ?"; String query2 = "UPDATE "+indicatorSchedulerTable +" SET ind_executing = WHERE id_indicator = ?"; try { con = mySQLManipulator.getConnection(); stmt = con.prepareStatement(query1); stmt.setInt(1,id); /*Updating remaining time*/ stmt.executeUpdate(); stmt.close(); /*Updating executing status*/ stmt = con.prepareStatement(query2); stmt.setInt(1,id); stmt.executeUpdate(); con.commit(); } catch (SQLException e) { try { con.rollback(); System.out.println("ROLLBACK OK"); } catch (SQLException e1) { throw new ServiceException("Problème de rollback lors de la mise à jour dans la fonction \"updateIndicatorRemainingTimeAndExecuted\" : "+e1.getMessage()+e.getMessage()); } throw new ServiceException("Problème lors de la mise à jour dans la fonction \"updateIndicatorRemainingTimeAndExecuted\" : "+e.getMessage()); } finally { handleDatabaseClosure(con, stmt, null); } } I'm also using a pool of connection like this maybe the error is because of this : public class JDBCManipulator { private static final BasicDataSource dataSource = new BasicDataSource(); private DBType type = null; private String URI = null…
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38501968
accepted answer: http://stackoverflow.com/a/24805462
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has title: JDBC rollback method not behaving like expected
type: Question
possible better answer: http://stackoverflow.com/a/24804973
answer count: 2

http://stackoverflow.com/q/24832887
has comment: http://stackoverflow.com/comment/38555549
has answer: http://stackoverflow.com/a/24835419
has comment: http://stackoverflow.com/comment/38555490
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38557038
has comment: http://stackoverflow.com/comment/38581156
tagged with: client-server
has comment: http://stackoverflow.com/comment/38555286
has comment: http://stackoverflow.com/comment/38559703
has comment: http://stackoverflow.com/comment/38557224
type: Question
tagged with: android
has title: client/server connection closing causes loop error
has comment: http://stackoverflow.com/comment/38555648
score: 0
has body: I got to stage where client and server communicate, sending messages from and to each other. The problem I am having is how to close the connection without causing an error? If I terminate one of the apps (either server or client) that causes the connection to be lost, and then it causes the loop that is waiting for input to loop indefinitely and showing null's. I tried closing sockets, buffers and even the thread, didn't work. This is the client side public void onClick(View view) { try { EditText et = (EditText) findViewById(R.id.EditText01); String str = et.getText().toString(); PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(str); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } class ClientThread implements Runnable { @Override public void run() { try { InetAddress serverAddr = InetAddress.getByName(SERVER_IP); socket = new Socket(serverAddr, SERVERPORT); CommunicationThread commThread = new CommunicationThread(socket); new Thread(commThread).start(); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } } This is the server side class ServerThread implements Runnable { public void run() { Socket socket = null; try { serverSocket = new ServerSocket(SERVERPORT); } catch (IOException e) { e.printStackTrace(); } while (!Thread.currentThread().isInterrupted()) { try { socket = serverSocket.accept(); CommunicationThread commThread = new CommunicationThread( socket); new Thread(commThread).start(); } catch (IOException e) { e.printStackTrace(); } } } } Both use these classes: class CommunicationThread implements Runnable { private Socket clientSocket; private BufferedReader input; public CommunicationThread(Socket clientSocket) { this.clientSocket = clientSocket; try { this.input = new BufferedReader(new InputStreamReader( this.clientSocket.getInputStream())); } catch (IOExceptio…
tagged with: sockets
answer count: 1

http://stackoverflow.com/comment/38565017
score: 0
type: Comment
has text: Thanks for reply.But the problem is little more complicated. The LinkedHashMap contained in the container map contains the key and value of options that i want to display as a dropdown on my jsp.What i mean to say is Suppose the container map has Q1,LinkedHashMap then Q1 is the key (question number) and its value (the linkedHashMap) contains the Value and description that i want to display on my JSP.
comment on: http://stackoverflow.com/a/24826382
type: AnswerComment

http://stackoverflow.com/q/24885768
has answer: http://stackoverflow.com/a/24911691
accepted answer: http://stackoverflow.com/a/24911691
score: 2
type: AnsweredQuestion
tagged with: java
has body: One of my generated Tables has a field called start which is of Type Field&lt;Timestamp&gt; (in the database the column is actualy a datetime). The same table also has a field duration which holds an Int. I would like to add the duration to the start. I've found DSL.dateAdd but this requires a Field&lt;Date&gt;. How can i convert the Timestamp field to a Date field so that i can use it like in the following example? DSL.dateAdd(MYTABLE.START, MYTABLE.DURATION, DatePart.MINUTE) EDIT: Little bit more research on my part revealed that there is a DSL.timestampAdd function which solved my problem.
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/38689056
downvote count: 0
tagged with: sql
answer count: 1
favorite count: 0
tagged with: jooq
has title: jOOQ - DSL.dateAdd with Field<Timestamp>

http://stackoverflow.com/q/24776554
type: Question
has answer: http://stackoverflow.com/a/35562383
tagged with: jboss
linked to: http://stackoverflow.com/q/17543202
score: 0
answer count: 2
has title: Error occurred while unscheduling jobs
has body: When i shutdown JBOSS server (ctrl+C) results in the following exception 12:39:50,020 ERROR [com.kony.sync.console.job.scheduler.ConsoleJobScheduler] (ServerService Thread Pool -- 20) Error occurred while unscheduling jobs for application ID:PaaSJobs: org.qu artz.JobPersistenceException: Failed to obtain DB connection from data source 'syncQuartzDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:jboss/datasources/C onsoleDB' java.sql.SQLException: javax.resource.ResourceException: IJ000451: The connection manager is shutdown: java:jboss/datasources/ConsoleDB [See nested exception: java.sql.SQLExce ption: Could not retrieve datasource via JNDI url 'java:jboss/datasources/ConsoleDB' java.sql.SQLException: javax.resource.ResourceException: IJ000451: The connection manager is shutdow n: java:jboss/datasources/ConsoleDB] at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:715) [quartz-all-1.8.6.jar:] at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:69) [quartz-all-1.8.6.jar:] at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3785) [quartz-all-1.8.6.jar:] at org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:90) [quartz-all-1.8.6.jar:] at org.quartz.impl.jdbcjobstore.JobStoreSupport.removeTrigger(JobStoreSupport.java:1458) [quartz-all-1.8.6.jar:] at org.quartz.core.QuartzScheduler.unscheduleJob(QuartzScheduler.java:965) [quartz-all-1.8.6.jar:] at org.quartz.impl.StdScheduler.unscheduleJob(StdScheduler.java:290) [quartz-all-1.8.6.jar:] at com.kony.sync.console.job.scheduler.ConsoleJobScheduler.unscheduleJob(ConsoleJobScheduler.java:225) [syncconsole.jar:] at com.kony.sync.services.context.SyncContextListener.contextDestroyed(SyncContextListener.java:221) [classes:] at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3427) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.c…
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/38604755
tagged with: spring
has comment: http://stackoverflow.com/comment/38448943
has comment: http://stackoverflow.com/comment/38448715
has comment: http://stackoverflow.com/comment/38448640
tagged with: java
tagged with: quartz-scheduler
has answer: http://stackoverflow.com/a/27863062

http://stackoverflow.com/comment/38501047
comment on: http://stackoverflow.com/a/24804323
score: 1
type: AnswerComment
has text: verbose-mode Thanks for quick reply ..yep it is nice trick but shows first empty cell thats it
type: Comment

http://stackoverflow.com/comment/38553276
type: QuestionComment
has text: OK, I *think* I might have figured out at least part of the problem. I think the difference between the compilers comes down to figuring out when an unbounded wildcard is really truly unbounded, i.e. when `<?>` really means `<? extends Bound>`, in this case. Evidently Eclipse is better at figuring that out, based on the lack of an error message. Unfortunately, I cannot find any JLS passages at the moment describing this behavior, so I can't tell you for sure if this is a bug or simply Eclipse going above and beyond.
score: 0
comment on: http://stackoverflow.com/q/24817306
type: Comment

http://stackoverflow.com/q/24843966
tagged with: android
tagged with: java
has body: I am trying to create a top bar for my app that shows the users level, coins. So i have an image view that displays the coin icon and a textview that displays the number of coins, if the number gets high it overlaps the image rather than pushing back the image and keeping everything aligned, is there a way to do that?
type: Question
has title: Android TextView OverLapping
has answer: http://stackoverflow.com/a/24844724
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24844036
has comment: http://stackoverflow.com/comment/38576644
type: UnansweredQuestion

http://stackoverflow.com/comment/38678575
has text: @RNJ's answer will work if you handle duplicates in a manner consistent with whatever your requirements are. If not you will potentially lose data.
comment on: http://stackoverflow.com/q/24897539
score: 0
type: Comment
type: QuestionComment

binary
tags question: http://stackoverflow.com/q/24754854
tags question: http://stackoverflow.com/q/24827403
tag name: binary
type: Tag
tags question: http://stackoverflow.com/q/24876323

http://stackoverflow.com/comment/38505551
has text: Thanks @SyamS (+1) - I guess I don't understand your question. I am trying to parse the HTML file (`fizz.html`) in the jsFiddle link above. In that HTML file, on line 238, is a hyperlink (`` tag). I want that specific hyperlink's `href`, no other ones. Ultimately, all I'm interested in is the `repositoryId` substring inside the href, but I can parse that out later, after the JSoup code.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24806691

http://stackoverflow.com/comment/38658911
type: QuestionComment
has text: Why *not* a string key (and what is the content)? Why *would* a UUID be better?
score: 0
comment on: http://stackoverflow.com/q/24887825
type: Comment

http://stackoverflow.com/q/24772953
has answer: http://stackoverflow.com/a/24773061
favorite count: 0
tagged with: integer-arithmetic
linked to: http://stackoverflow.com/q/24676375
score: 62
has title: Java Primitives range calculation
has answer: http://stackoverflow.com/a/24772991
has body: In Java when we declare short number=1024*1024*1024; it will give compile time error but short number=1024 * 1024 * 1024 * 1024; compiles fine. Why does this happen?
has comment: http://stackoverflow.com/comment/45838817
downvote count: 1
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/24676375
tagged with: java
accepted answer: http://stackoverflow.com/a/24772991
type: Question
answer count: 2
upvote count: 63
has comment: http://stackoverflow.com/comment/38699613
possible better answer: http://stackoverflow.com/a/24773061

http://stackoverflow.com/comment/38643328
type: AnswerComment
has text: the OP has the second part outside of the loop, as else to **"if (!dep.isEmpty())"**
comment on: http://stackoverflow.com/a/24863860
type: Comment
score: 1

http://stackoverflow.com/a/24804980
has body: I did a little benchmark of TreeSet vs ArrayList insertion/performance. Obviously ArrayList performs the better but, with a million unique records 279ms of full iteration time is not that bad. If in your case that time is negligible i'd stick with the TreeSet. Otherwise you'll be forced to reivent the wheel and to manually check for duplicates before inserting the element into the ArrayList. import java.util.ArrayList; import java.util.Iterator; import java.util.TreeSet; public class TestTreeSetVsArrayList { public static int ENTRIES = 10000000; public static void main(String[] args) { TreeSet&lt;String&gt; treeSet = new TreeSet&lt;String&gt;(); ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(10000); long l = System.currentTimeMillis(); for (int i = 0; i &lt; TestTreeSetVsArrayList.ENTRIES; i++) { treeSet.add("String"+i); } System.out.println("treeset insertion time: "+ (System.currentTimeMillis()-l)); l = System.currentTimeMillis(); for (int i = 0; i &lt; TestTreeSetVsArrayList.ENTRIES; i++) { treeSet.add("String"+i); } System.out.println("arraylist insertion time: "+ (System.currentTimeMillis()-l)); Iterator&lt;String&gt; iter; iter = treeSet.iterator(); l = System.currentTimeMillis(); while(iter.hasNext()) { iter.next(); } System.out.println("treeset iteration time: "+ (System.currentTimeMillis()-l)); iter = arrayList.iterator(); l = System.currentTimeMillis(); while(iter.hasNext()) { iter.next(); } System.out.println("arraylist iteration time: "+ (System.currentTimeMillis()-l)); } } The results on my pc are: treeset insertion time: 11350 arraylist insertion time: 3583 treeset iteration time: 279 arraylist iteration time: 0
downvote count: 0
answers question: http://stackoverflow.com/q/24803741
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/24777132
has comment: http://stackoverflow.com/comment/38449564
answer count: 1
downvote count: 0
has title: The dependency is missing from repository (error 404)
favorite count: 0
tagged with: maven
has body: I'm trying to use the reflections-maven plugin in a project. However, Maven refuses to compile the project because the following dependency is missing: org.jfrog.jade.plugins.common jade-plugin-common 1.3.8 I checked on the Maven central repository. The dependency is missing there (error 404). How can I use reflections-maven without this dependency ? NOTA: The rules in my company disallow the use of custom repositories directly in pom.xml. The internal Nexus MUST be used.
has comment: http://stackoverflow.com/comment/38450351
has comment: http://stackoverflow.com/comment/38449413
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24777851
upvote count: 1
has comment: http://stackoverflow.com/comment/38449760
type: Question
has comment: http://stackoverflow.com/comment/38450275
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38450163
tagged with: reflections
has comment: http://stackoverflow.com/comment/38449513
has comment: http://stackoverflow.com/comment/38453532
accepted answer: http://stackoverflow.com/a/24777851

hibernate
tags question: http://stackoverflow.com/q/24886504
tags question: http://stackoverflow.com/q/24889907
tags question: http://stackoverflow.com/q/24758888
tags question: http://stackoverflow.com/q/24824052
tags question: http://stackoverflow.com/q/24792112
tags question: http://stackoverflow.com/q/24770563
tags question: http://stackoverflow.com/q/24896675
tags question: http://stackoverflow.com/q/24852837
tags question: http://stackoverflow.com/q/24840600
tags question: http://stackoverflow.com/q/24782386
tags question: http://stackoverflow.com/q/24864099
tags question: http://stackoverflow.com/q/24906436
tags question: http://stackoverflow.com/q/24777495
tags question: http://stackoverflow.com/q/24778648
tags question: http://stackoverflow.com/q/24902158
tags question: http://stackoverflow.com/q/24804534
tags question: http://stackoverflow.com/q/24757019
tags question: http://stackoverflow.com/q/24760971
tags question: http://stackoverflow.com/q/24897735
tags question: http://stackoverflow.com/q/24901300
tags question: http://stackoverflow.com/q/24788101
tags question: http://stackoverflow.com/q/24789999
tags question: http://stackoverflow.com/q/24903146
tags question: http://stackoverflow.com/q/24756443
tags question: http://stackoverflow.com/q/24862058
tags question: http://stackoverflow.com/q/24874949
tags question: http://stackoverflow.com/q/24826310
tags question: http://stackoverflow.com/q/24906834
tags question: http://stackoverflow.com/q/24832294
tags question: http://stackoverflow.com/q/24831729
tags question: http://stackoverflow.com/q/24761770
tags question: http://stackoverflow.com/q/24800679
tags question: http://stackoverflow.com/q/24871676
tags question: http://stackoverflow.com/q/24825010
tags question: http://stackoverflow.com/q/24830932
tags question: http://stackoverflow.com/q/24885590
tags question: http://stackoverflow.com/q/24818108
tags question: http://stackoverflow.com/q/24815520
tags question: http://stackoverflow.com/q/24762266
tags question: http://stackoverflow.com/q/24906862
tags question: http://stackoverflow.com/q/24752884
tags question: http://stackoverflow.com/q/24788197
tags question: http://stackoverflow.com/q/24900849
tags question: http://stackoverflow.com/q/24870004
tags question: http://stackoverflow.com/q/24749962
tags question: http://stackoverflow.com/q/24852770
tags question: http://stackoverflow.com/q/24769318
tags question: http://stackoverflow.com/q/24809844
tags question: http://stackoverflow.com/q/24841621
tags question: http://stackoverflow.com/q/24897183
tags question: http://stackoverflow.com/q/24860309
tags question: http://stackoverflow.com/q/24836649
tags question: http://stackoverflow.com/q/24889981
tags question: http://stackoverflow.com/q/24759841
tags question: http://stackoverflow.com/q/24881121
tags question: http://stackoverflow.com/q/24830021
tag name: hibernate
tags question: http://stackoverflow.com/q/24850125
tags question: http://stackoverflow.com/q/24888353
tags question: http://stackoverflow.com/q/24823903
tags question: http://stackoverflow.com/q/24778346
tags question: http://stackoverflow.com/q/24809429
tags question: http://stackoverflow.com/q/24852752
tags question: http://stackoverflow.com/q/24906251
tags question: http://stackoverflow.com/q/24791223
tags question: http://stackoverflow.com/q/24765288
tags question: http://stackoverflow.com/q/24906289
tags question: http://stackoverflow.com/q/24835592
tags question: http://stackoverflow.com/q/24846285
tags question: http://stackoverflow.com/q/24905693
tags question: http://stackoverflow.com/q/24757555
tags question: http://stackoverflow.com/q/24884527
tags question: http://stackoverflow.com/q/24817594
tags question: http://stackoverflow.com/q/24890657
tags question: http://stackoverflow.com/q/24812147
tags question: http://stackoverflow.com/q/24793247
tags question: http://stackoverflow.com/q/24806909
tags question: http://stackoverflow.com/q/24866145
tags question: http://stackoverflow.com/q/24757857
tags question: http://stackoverflow.com/q/24752555

http://stackoverflow.com/a/24916162
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24898020
has body: The time zone only affects how the Date is displayed when formatted to a String. The Date object stores its value in milliseconds since January 1, 1970 UTC. And that value is used when comparing Dates. You can test this by calling Date.getTime() See this answer for a more detailed explanation: https://stackoverflow.com/a/308689/3855010
accepted answer of: http://stackoverflow.com/q/24898020
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/24858532
upvote count: 3
answers question: http://stackoverflow.com/q/24858352
has comment: http://stackoverflow.com/comment/38604279
type: Answer
has comment: http://stackoverflow.com/comment/38603971
has body: There isn't anything similar to with in Java 7. The closest you can do is use an Initialization block while instantiating an anonymous class: new Test() { { method1(); method2(); } }; which might not suit every case, as you can only use it for initialization. Where Test is: class Test{ public void method1() { System.out.println(1); } public void method2() { System.out.println(2); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/38604423
has comment: http://stackoverflow.com/comment/38604268
has comment: http://stackoverflow.com/comment/38604299
has comment: http://stackoverflow.com/comment/38604321
score: 3
has comment: http://stackoverflow.com/comment/38604175

http://stackoverflow.com/a/30322753
answers question: http://stackoverflow.com/q/24893049
downvote count: 1
has body: public class PrintPrime { public static void main(String args[]) { for (int i = 2; i &lt; 1000; i++) { primes(i, Math.ceil(Math.sqrt(i))); } } public static int primes(int x, double i) { if (i == 1) System.out.println(x); if (x % i == 0) return 0; else return primes(x, i - 1); } }
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/q/24907914
tagged with: layout
has comment: http://stackoverflow.com/comment/38698145
has comment: http://stackoverflow.com/comment/38696725
score: 0
has comment: http://stackoverflow.com/comment/38697767
has answer: http://stackoverflow.com/a/24909472
tagged with: android
answer count: 1
tagged with: tabs
has comment: http://stackoverflow.com/comment/38698855
has body: I use a tabview in my main layout where every tab has it's own layout. Now when I want to declare a button in my first tab layout I get a nullPointerException because the ID of this button is not found in my main layout. So to explain in code when I use: Button button = (Button) findViewById(R.id.button1); And the button is in the layout of my first tab I will get a NullPointerException because the code chooses my main layout over my first tab layout. What is the best way to get around this?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24909472
has title: Accessing ID's from an active but not main layout
tagged with: java
has comment: http://stackoverflow.com/comment/38696655
has comment: http://stackoverflow.com/comment/38698713
type: Question
has comment: http://stackoverflow.com/comment/38699076

http://stackoverflow.com/comment/38562751
has text: Well, if you really want to do this with C constructs that Java deliberately doesn't provide, you could write C code and call it through the [Java Native Interface](http://en.wikipedia.org/wiki/Java_Native_Interface). I wouldn't recommend it, though. Why not write helper methods to extract each part of `commndStr`?
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24837200

http://stackoverflow.com/a/24752355
has body: First I try to debug this error with some more information so I create class: import net.javacrumbs.springws.test.simple.annotation.WsMockControlTestExecutionListener; import net.javacrumbs.springws.test.util.MockMessageSenderInjector; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.test.context.TestContext; public class WsMockControlTestExecutionSpring4Listener extends WsMockControlTestExecutionListener { private static final String MESSAGE_SENDER_BEAN_NAME = "net.javacrumbs.springws.test.simple.annotation.WsMockControlMockWebServiceMessageSender"; private static final String MOCK_CONTROL_BEAN_NAME = "net.javacrumbs.springws.test.simple.annotation.WsMockControl"; @Override public void prepareTestInstance(TestContext testContext) throws Exception { ConfigurableListableBeanFactory beanFactory = ((AbstractApplicationContext) testContext.getApplicationContext()) .getBeanFactory(); if (!beanFactory.containsBean(MOCK_CONTROL_BEAN_NAME)) { beanFactory.registerSingleton(MOCK_CONTROL_BEAN_NAME, createWsMockControlFactoryBean()); beanFactory.registerSingleton(MESSAGE_SENDER_BEAN_NAME, createMessageSender()); new MockMessageSenderInjector().postProcessBeanFactory(beanFactory); } } } and in test I used this listener: @TestExecutionListeners({ WsMockControlTestExecutionSpring4Listener.class, DependencyInjectionTestExecutionListener.class }) and now the weird part. Tests are again working but I really dont understand why. I did nothing. Just override method prepareTestInstance with the exactly same code as in WsMockControlTestExecutionListener. Can someone explain me this "solution"
answers question: http://stackoverflow.com/q/24751855
score: 0
type: Answer

http://stackoverflow.com/comment/38491356
has text: Your first line statement `if(thisRow >= num)` is used to output the middle line only. Consider dropping the leading space before the first asterisk here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24798173
score: 0

http://stackoverflow.com/a/24794303
has comment: http://stackoverflow.com/comment/38483061
score: 0
answers question: http://stackoverflow.com/q/24794104
upvote count: 1
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38482550
has body: I don't think you need to change anything. Do you use any native code through jni? First, are you using JDK or JRE on the 32 bit Windows? You just need JRE to run your application. Second, on Windows 8, you can still install 32 bit JRE so your application should run. Third, if you installed 64 bit JRE, your application should still run. There might be more bugs in 64 bit JRE. If you encounter a lot of bugs, just use 32 bit JRE instead.

http://stackoverflow.com/q/24831844
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/24975074
accepted answer: http://stackoverflow.com/a/24945489
type: Question
has title: How do I create an Android Test Module in IntelliJ 13 for a Gradle Android project?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24945270
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/24953878
tagged with: gradle
score: 5
tagged with: intellij-idea
possible better answer: http://stackoverflow.com/a/24953878
downvote count: 0
tagged with: android-testing
favorite count: 0
has answer: http://stackoverflow.com/a/24945489
has body: I have successfully create a Android project in IntelliJ 13 and I want to setup the Android Testing Framework. I used the new project wizard to create the android project using Gradle. When I go to add a new module I only have options for "Gradle: Android Module" and "Gradle: Java Library", the "Test Module" option is missing. How do I generate an Android Test Module? I have read http://www.jetbrains.com/idea/webhelp/testing-android-applications.html but I can never find any "test" option. If an Android Test Module can not be automatically generated, then how do I configure and use the Android Testing Framework with a Gradle Android Project? Links to examples or documentation is very much appreciated. Details: IntelliJ 13.1.3

http://stackoverflow.com/comment/38466963
type: Comment
comment on: http://stackoverflow.com/a/24786155
score: 0
type: AnswerComment
has text: Thanks for the quick answer. I swear that the field ID_REFERENT is in my table PERSONNE. I did map my abstract class with @MappedSuperclass because I want to be able to have a collection of AbstractClientEntity in my AbstractEmployeEntity. When I trie with the @ MappedSuperclass annotation, the exception org.hibernate.AnnotationException: Use of @ OneToMany or @ ManyToMany targeting an unmapped class: ch.tupperware.tuppergestion.entity.AbstractEmployeEntity.listeClients[ch.tupperware.tuppergestion.entity.AbstractClientEntity] Is thrown...

http://stackoverflow.com/a/24813572
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24813430
has body: There are no advantages to using pattern/matcher in cases where the manipulation to be done is as simple as this. You can look at String.split() as a convenience method that leverages many of the same functionalities you use when you use a pattern/matcher directly. When you need to do more complex matching/manipulation, use a pattern/matcher, but when String.split() meets your needs, the obvious advantage to using it is that it reduces code complexity considerably - and I can think of no good reason to pass this advantage up.

http://stackoverflow.com/comment/38487836
type: QuestionComment
has text: Well, 3 cases are not *lot of cases* IMHO. Why don't you simply make your bean implement Comparable?
score: 3
comment on: http://stackoverflow.com/q/24797212
type: Comment

http://stackoverflow.com/comment/38518814
score: 0
type: Comment
has text: Which is not per my requirements in the question. I will give you points for making me think about the problem a little more and driving to a better solution. Thanks!
comment on: http://stackoverflow.com/a/24812900
type: AnswerComment

http://stackoverflow.com/comment/38513534
comment on: http://stackoverflow.com/q/24795615
type: Comment
type: QuestionComment
has text: Thanks Sarz. I did try that but couldn't find what I was looking for. Hence the post here. Didn't realize folks just down vote questions here.
score: 0

http://stackoverflow.com/comment/38605982
has text: No , Actually If i have 10 EditText and the user enter only in 5 then i exit my app on click the onBackPressed Button without submit the EditText data which is entering , and then when i restart my app i want to same activity on start up.
comment on: http://stackoverflow.com/a/24859492
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24871683
has comment: http://stackoverflow.com/comment/38629548
tagged with: java
has answer: http://stackoverflow.com/a/24873922
linked to: http://stackoverflow.com/q/16899842
type: Question
has comment: http://stackoverflow.com/comment/38629040
upvote count: 12
has comment: http://stackoverflow.com/comment/38630826
has title: How do you design a services layer that's not all try/catch blocks?
score: 12
answer count: 2
has comment: http://stackoverflow.com/comment/38629134
downvote count: 0
has comment: http://stackoverflow.com/comment/81077593
has comment: http://stackoverflow.com/comment/38629138
favorite count: 0
has comment: http://stackoverflow.com/comment/38630092
tagged with: exception
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/38630421
has comment: http://stackoverflow.com/comment/38628982
has answer: http://stackoverflow.com/a/26123057
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38628985
has body: When designing a SpringMVC application the @ExceptionHandler annotation is at our disposal in the REST layer. This greatly de-clutters controller methods by offloading exception handling to a set of semi-generic handlers. The basic architecture of our services is this: [REST API] &lt;==> [Application Services] &lt;==> [Data Layer] I'm of the belief that a REST layer controller should not be dealing directly with Data layer exceptions, instead it should be dealing with Application Service exceptions only. However, that means all my Application Services methods basically have to look like this: public DomainObject getSomeDomainObjectById(String id) { DomainObject retVal = null; try { myDomainDao.getSomeDomainObjectById(id); } catch (DataLayerExceptionOfSomeSort ex) { throw translateToAppropriateServiceException(ex); } //do some further processing return retVal; } To me, that's a lot of in-your-face exception handling, which I don't care for. How else could I solve this? Is there an easy way to achieve the same thing in the Application Services layer as there is in the Rest layer? My first thought is AOP. I'm open to this providing it doesn't add a lot of cruft and is easy to configure.

http://stackoverflow.com/q/24790158
has body: I am trying to do insert to a table whose primary key is set to auto increment using a prepared statement. The fields in the table are as follows; id, username, password, email, firstname, last name My code is such that String sql = "INSERT INTO Users values (?,?,?,?,?, ?)"; RegistrationStatus status = null; Connection conn = null; PreparedStatement st = null; try { conn = source.getConnection(); st = conn.prepareStatement(sql); st.setString(2, username); st.setString(3, password); st.setString(4, email); st.setString(5, firstname); st.setString(6, lastname); st.executeUpdate(); Where i have read that we should no include the first item as the database will take care of it. This approach for me appears to be failing. Would it be possible to get some help on how to solve this?
favorite count: 0
has answer: http://stackoverflow.com/a/24790219
accepted answer: http://stackoverflow.com/a/24790219
has title: Using a prepared statement with auto increment field
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38474958
score: 1
tagged with: java
tagged with: prepared-statement
type: Question
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38474877
tagged with: sql
answer count: 1

http://stackoverflow.com/a/24812134
has body: And currently under WEB-INF directory I have a META-INF directory Then you've done it wrong. Read your own quotation. It says WEB-INF/classes/META-INF. URL resource = this.getClass().getClassLoader().getResource("test.txt"); That should be: URL resource = this.getClass().getClassLoader().getResource("META-INF/test.txt");
upvote count: 4
answers question: http://stackoverflow.com/q/24811475
score: 4
downvote count: 0
type: Answer

http://stackoverflow.com/q/24780785
upvote count: 1
has answer: http://stackoverflow.com/a/25021951
possible better answer: http://stackoverflow.com/a/28760033
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28760033
has title: How to serialize JavaFX Nodes preferably in XML?
score: 1
linked to: http://stackoverflow.com/q/11033943
tagged with: java
tagged with: scenebuilder
tagged with: javafx
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25021951
downvote count: 0
tagged with: javafx-8
has body: I have some kind of drawpane, where the user can draw different kinds of Shapes, like Pathes, Rectangles, Texts, etc. Now I´d like to persist the DrawState, so that I can recreate it at any time. I just tried it with xstream, but like usual I get a whole lot of dependencies within these Shapes when persisting it in XML. After some research I found this Thread here: Serialize JavaFX components I liked the idea of jewelsea using the SceneBuilder API to serialize my shapes, since they are all supported and the FXML contains all the things I probably will need without any disturbing references. Do you have any experiences with the Scenebuilder API? In the thread its pointed out, that it might be difficult to get only the things needed. Or can you maybe recommend any other way to serialize Shapes in XML?
favorite count: 0
tagged with: serialization

http://stackoverflow.com/a/24800797
upvote count: 3
has body: Annotations for managed beans have been introduced after JSF 2.0. But XPages is based on JSF 1.1. So you cannot use such annotations in XPages. Update: Make sure you have checked Jesse's blog entry: https://frostillic.us/f.nsf/posts/a-quick--dirty--and-inefficient-%40managedbean-implementation-in-xpages
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24800360

http://stackoverflow.com/comment/38415556
score: 0
type: Comment
type: AnswerComment
has text: Okay. FYI: The focus can't be disabled, the correct term is "focus is lost". The odd thing is that the ONBLUR event happens so late. Also check that disabled form fields look different (to make sure that some JavaScript isn't disabling the field while you type but you can't see this).
comment on: http://stackoverflow.com/a/24757479

http://stackoverflow.com/a/24904018
downvote count: 1
answers question: http://stackoverflow.com/q/24903658
upvote count: 2
has comment: http://stackoverflow.com/comment/44327458
type: Answer
has body: After Googling you will get the following: Executorservice The java.util.concurrent.ExecutorService interface represents an asynchronous execution mechanism which is capable of executing tasks in the background. An ExecutorService is thus very similar to a thread pool. In fact, the implementation of ExecutorService present in the java.util.concurrent package is a thread pool implementation. ThreadPoolTaskExecutor This implementation can only be used in a Java 5 environment but is also the most commonly used one in that environment. It exposes bean properties for configuring a java.util.concurrent.ThreadPoolExecutor and wraps it in a TaskExecutor. If you need something advanced such as a ScheduledThreadPoolExecutor, it is recommended that you use a ConcurrentTaskExecutor instead.
score: 1

http://stackoverflow.com/a/24758890
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24757983
has body: You do not need to change you applications version to update your database - not saying it is incorrect but there is a more efficient way of doing it. And that is through the use of the super's constructor of your helper it would look something like the following: public class MyDatabaseHelper extends SQLiteOpenHelper { public MyDatabaseHelper(Context context) { super(context, "My.db", null, 1 /* This is the version of the database*/); } @Override public void onCreate(SQLiteDatabase database) { sql = "CREATE TABLE IF NOT EXISTS funcionarios (codigo INTEGER PRIMARY KEY, funcionario TEXT, apelido TEXT , functionTEXT, cartao TEXT , foto TEXT , tipo_foto TEXT);"; db.execSQL(sql); } @Override public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { if(oldVersion &lt; 2){ db.execSQL("CREATE TABLE IF NOT EXISTS calibrar_aceleracao (limiteMaximo INTEGER, limiteMinimo INTEGER);"); } } }

http://stackoverflow.com/comment/38493763
has text: This is fairly self explanatory. The call to greeting is not using the instance (which is null) so no NPE occurs.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24800356
type: AnswerComment

glassfish-4
tags question: http://stackoverflow.com/q/24897750
type: Tag
tags question: http://stackoverflow.com/q/24750871
tag name: glassfish-4
tags question: http://stackoverflow.com/q/24767330

http://stackoverflow.com/comment/38427978
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24765598
has text: The html code is identical to code I use with a scanner applet and works fine. I did do this though, just to be sure and it gave me the same message. It appears the functions in the Java code are not visible to the outside world, but I thought that's what "public" did. I'm open to other thoughts though :). Yeah, I know I'll need to recode for html5, but that's going to be a rewrite of lots of code on a legacy system.

http://stackoverflow.com/q/24866737
tagged with: jpanel
score: -1
has comment: http://stackoverflow.com/comment/38619149
tagged with: jtable
has body: I am trying to create a table that can be filtered but I keep getting a null pointer exception for the getRowCount() method in my table model class. HomePagePanel(where my table is) public class homepagePanel extends JPanel implements ActionListener { private JButton uploadEmail, viewEmail, logout, delete; private JLabel userLog; private JLabel tableLabel; private JScrollPane scrollPane; private EmailTableListener emailTableListener; //private EmailTablePanel EmailPanel; private HomePagePanelListener homepagePanelListener; private List&lt;Item&gt; dc; private Controller controller; private JTable table; private EmailTableModel emailModel; private JPopupMenu popup; private JTextField filterText; private JLabel filterLabel; private TableRowSorter&lt;EmailTableModel&gt; sorter; public homepagePanel() { controller = new Controller(); userLog = new JLabel("Logged in:"); uploadEmail = new JButton("Upload"); viewEmail = new JButton("View"); delete = new JButton("Delete"); logout = new JButton("Log Out"); tableLabel = new JLabel("Emails stored"); //Email stuff emailModel = new EmailTableModel(); sorter = new TableRowSorter&lt;EmailTableModel&gt;(emailModel); table = new JTable(emailModel); table.setRowSorter(sorter); // filterLabel = new JLabel("Filter Text: ", SwingConstants.TRAILING); filterText = new JTextField(10); filterLabel.setLabelFor(filterText); //documenet listener filterText.getDocument().addDocumentListener(new DocumentListener(){ @Override public void changedUpdate(DocumentEvent e) { // TODO Auto-generated method stub newFilter(); } @Override public void insertUpdate(DocumentEvent e) { // TODO Auto-generated method stub newFilter(); } @Override public void removeUpdate(DocumentEvent e) { // TODO Auto-generated method stub newFilter(); } }); // Adds the table to a scrollpane scrollPane = new JScrollPane(table); scrollPane .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR…
has title: I keep getting nullpointer exception for jtable getrowcount() method
accepted answer: http://stackoverflow.com/a/24867466
upvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: tablemodel
tagged with: java
has answer: http://stackoverflow.com/a/24867466
has comment: http://stackoverflow.com/comment/38619619
tagged with: swing
downvote count: 1
type: Question

http://stackoverflow.com/comment/40779372
type: Comment
has text: when I create the LoggerConfig, or if it was already added via the setAdditivity method
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24866243

http://stackoverflow.com/comment/38597178
type: Comment
has text: You should use startActivityForResult(). Check the developer docs http://developer.android.com/reference/android/app/Activity.html#StartingActivities to see what I mean. You can also check http://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)
comment on: http://stackoverflow.com/a/24854970
score: 0
type: AnswerComment

http://stackoverflow.com/a/25226854
score: 0
answers question: http://stackoverflow.com/q/24867420
has body: There is the upcoming Web NFC API to access client-side NFC hardware, but this API is still in draft status and I'm not sure about its availability in current web browsers. Other than that, you would need some form of middleware running on the client PC. Such a middleware could be a browser plugin, a Java applet embedded into your web page or a stand-alone application. If the NFC reader is PC/SC compliant, a Java applet embedded into the web page could easily access the NFC reader using the Java SmartcardIO API.
type: Answer

macos
tags question: http://stackoverflow.com/q/24789310
tags question: http://stackoverflow.com/q/24817786
tags question: http://stackoverflow.com/q/24894109
tags question: http://stackoverflow.com/q/24850014
tags question: http://stackoverflow.com/q/24813589
tags question: http://stackoverflow.com/q/24853727
tags question: http://stackoverflow.com/q/24755900
tags question: http://stackoverflow.com/q/24859507
tags question: http://stackoverflow.com/q/24844982
tags question: http://stackoverflow.com/q/24872259
tags question: http://stackoverflow.com/q/24753150
type: Tag
tags question: http://stackoverflow.com/q/24840414
tags question: http://stackoverflow.com/q/24787530
tags question: http://stackoverflow.com/q/24788675
tags question: http://stackoverflow.com/q/24809790
tag name: macos

http://stackoverflow.com/comment/38500381
comment on: http://stackoverflow.com/a/24802809
has text: @sp00m: You are missing the _minimum_ part before the space. Read your quote again, 3 letters (or more) is perfectly fine too.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38660630
comment on: http://stackoverflow.com/a/24875673
has text: That would work on my simple example, but it would not work on most of the other cases I have (when I load some entities and set a non-link field in all of them for example). What I actually want is to not have to handle the links at all.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38505762
has text: Why return the instance you're working on in a set method? Return nothing and keep working. unless this is just for the purpose of the question rather than real code.
score: 1
comment on: http://stackoverflow.com/q/24806672
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24882372
upvote count: 0
answers question: http://stackoverflow.com/q/24878130
has comment: http://stackoverflow.com/comment/43242191
has body: Did you try "Could not locate the launcher comand" running JDeveloper, Weblogic installers
type: Answer
has comment: http://stackoverflow.com/comment/42396532
downvote count: 1
has comment: http://stackoverflow.com/comment/42417934
score: -1

http://stackoverflow.com/q/24800218
has answer: http://stackoverflow.com/a/25174647
accepted answer: http://stackoverflow.com/a/25174647
upvote count: 1
answer count: 1
tagged with: amazon-web-services
tagged with: copy
favorite count: 0
has body: I've been looking for a tool to help me copy content of an S3 bucket into a second bucket without downloading the content first to a local system. I've tried AWS S3 console copy option but that resulted in some missing. source Path :- https://s3.amazonaws.com/RedRidingHoodFiles/inmemory/Basket/dffd7780-238a-4750-96b2-9e9ef1b4a4cf/main.png destination path:- https://s3.amazonaws.com/RedRidingHoodFiles/inmemory/Basket/test/main.png.
downvote count: 0
has title: AWS S3 copy file from one root to another using java
type: Question
type: AnsweredQuestion
tagged with: amazon-s3
score: 1
tagged with: java

http://stackoverflow.com/comment/38526949
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24805171
has text: So you have no class in RMI Server's classpath, and I don't mean here your server application but RMI Registry. If I were you, I would register needed classes from application code (btw. I am doing so in my current project) so you would have no classpath issuees
score: 0

http://stackoverflow.com/comment/38526452
type: QuestionComment
score: 0
has text: Please your question more.
comment on: http://stackoverflow.com/q/24817876
type: Comment

http://stackoverflow.com/comment/38668386
type: Comment
type: QuestionComment
has text: I'd probably just wrap up something like http://stackoverflow.com/questions/1776496/a-simple-command-line-to-download-a-remote-maven2-artifact-to-the-local-reposito with a shell script that then executes the downloaded artifact. Or write a simple program that talks Maven repo and can fetch an artifact and skip Maven altogether.
score: 1
comment on: http://stackoverflow.com/q/24892637

http://stackoverflow.com/comment/38626844
type: Comment
has text: Are they in any particular order? Can you do intersection check as you add a new value? There is the obvious bruteforce O(n^2) option with an iterator.
score: 2
comment on: http://stackoverflow.com/q/24870714
type: QuestionComment

http://stackoverflow.com/comment/38455485
has text: have you tried looking at joda library at http://www.joda.org/joda-time/
comment on: http://stackoverflow.com/q/24780474
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38470673
type: QuestionComment
has text: Yes, that is true. But its a requirement. This JSON is intended to be a serialization of data, and not an object model. Hence I going down this route..
score: 0
comment on: http://stackoverflow.com/q/24787808
type: Comment

http://stackoverflow.com/a/25010684
upvote count: 9
answers question: http://stackoverflow.com/q/24762086
score: 9
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38924776
has body: You can learn a lot by looking at the documentation, but I agree that their tutorials are lacking a lot of basic information. chart.getAxeLayout().setXAxeLabel(""); chart.getAxeLayout().setYAxeLabel(""); chart.getAxeLayout().setZAxeLabel("");
type: Answer
accepted answer of: http://stackoverflow.com/q/24762086

http://stackoverflow.com/q/24830021
score: 0
has title: HQL for this entity model?
tagged with: sql
answer count: 1
has body: Given the following entity one-to-many model: One Repository can be linked to many AuditRecords. Many Audit records can all link to the same AuditRecord What would be the HQL query to get the latest (by accessTime) Audit record for each distinct Repository? Thanks
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24832648
accepted answer: http://stackoverflow.com/a/24832648
tagged with: java
tagged with: hibernate
tagged with: hql
type: Question

http://stackoverflow.com/comment/38468376
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24786588
has text: Here is the complete method I have to change the question

http://stackoverflow.com/a/24810846
has comment: http://stackoverflow.com/comment/38514548
type: Answer
has body: The method takes the worker list and counts the workers that are being locked. By the time counting reaches the end of the list, some of the workers previously counted may have finished. (Or some unused workers may have been given a task.) But you shouldn't be relying on this knowledge as a client, just the fact that it's a best effort approximation. Note that this "inaccuracy" isn't a result of sloppy implementation, it's inherent in every truly multi-threaded system. In such systems there's no global moment of "present". Even if you stop all the workers to count them, by the time you return the result, it may be inaccurate.
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/38513280
has comment: http://stackoverflow.com/comment/38514743
has comment: http://stackoverflow.com/comment/38513243
has comment: http://stackoverflow.com/comment/38515578
score: 12
accepted answer of: http://stackoverflow.com/q/24810744
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24810744
has comment: http://stackoverflow.com/comment/38513181

http://stackoverflow.com/comment/38455948
type: Comment
comment on: http://stackoverflow.com/q/24779771
type: QuestionComment
has text: @nobalG... buddy i tried to do all these reset adb all messeges but lets see if after restarting it works?
score: 0

http://stackoverflow.com/comment/38701597
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24908942
type: AnswerComment
has text: Do you have to add a null terminator or is that done automatically?

http://stackoverflow.com/comment/38689601
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24903954
has text: Which tomcat version exactly is it? Did you already deploy anything, or is this just a plain vanilla installation from the download package? And, which JRE version are you using (`/usr/bin/java -version`)?

http://stackoverflow.com/comment/38409216
score: 2
comment on: http://stackoverflow.com/q/24751432
has text: I belive [ICU](http://site.icu-project.org/) contains [Transliterator](http://icu-project.org/apiref/icu4j/com/ibm/icu/text/Transliterator.html) class that can handle what you are looking for. According to [this document](http://userguide.icu-project.org/transforms/general) Devanagari should be supported.
type: QuestionComment
type: Comment

last-modified
type: Tag
tags question: http://stackoverflow.com/q/24804618
tag name: last-modified

http://stackoverflow.com/a/24808631
type: AcceptedAnswer
has body: Will editing this in the table update the underlying set as expected ? No because, you are doing a copy of the set: new ArrayList<E>(pojo.getObservableSet()) Is it the 'right' way of doing this ? I think the right way is not doing that. Set are not List and vice versa. Both have specific contraints. For example, the lists are ordered and sets contains no duplicate elements. Moreover, nor FXCollections neither Bindings provides this kind of stuff. I would like the collection to remain as a set to enforce uniqueness I guess you could write a custom ObservableList, for example the Parent::children have a similar behavior. It throws an IllegalArgumentException if a duplicate children is added. If you look at the source code, you will see that it is a VetoableListDecorator extension. You could write your own: import java.util.HashSet; import java.util.List; import java.util.Set; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import com.sun.javafx.collections.VetoableListDecorator; public class CustomObservableList<E> extends VetoableListDecorator<E> { public CustomObservableList(ObservableList<E> decorated) { super(decorated); } @Override protected void onProposedChange(List<E> toBeAdded, int... indexes) { for (E e : toBeAdded) { if (contains(e)) { throw new IllegalArgumentException("Duplicament element added"); } } } } class Test { public static void main(String[] args) { Object o1 = new Object(); Object o2 = new Object(); Set<Object> set = new HashSet<Object>(); set.add(o1); CustomObservableList<Object> list = new CustomObservableList<Object>(FXCollections.observableArrayList(set)); list.add(o2); list.add(o1); // throw Exception } }
has comment: http://stackoverflow.com/comment/61838607
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/38509489
accepted answer of: http://stackoverflow.com/q/24808243
downvote count: 1
answers question: http://stackoverflow.com/q/24808243
upvote count: 5
has comment: http://stackoverflow.com/comment/111344159

http://stackoverflow.com/a/24864723
type: Answer
downvote count: 0
score: 13
answers question: http://stackoverflow.com/q/24864163
accepted answer of: http://stackoverflow.com/q/24864163
upvote count: 13
has comment: http://stackoverflow.com/comment/62813023
type: AcceptedAnswer
has body: Try using the http.port=disabled flag play -Dhttp.port=disabled -Dhttps.port=443 -Dhttps.keyStore=/path/to/keystore -Dhttps.keyStorePassword=password start

jinternalframe
tags question: http://stackoverflow.com/q/24882198
tag name: jinternalframe
type: Tag

http://stackoverflow.com/comment/38468593
type: QuestionComment
comment on: http://stackoverflow.com/q/24786992
score: 0
has text: Also verify ffmpeg is in your system path.
type: Comment

http://stackoverflow.com/a/24772225
answers question: http://stackoverflow.com/q/24772080
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/38441573
downvote count: 1
has body: If you are sure that you really need this, please, think twice, but anyway: import java.lang.reflect.Field; ... X x = new X(); Field variableName = x.getClass().getDeclaredField("variableName"); // this is for private scope variableName.setAccessible(true); variableName.set(x, "some value");
type: Answer

http://stackoverflow.com/a/24875563
score: 0
has comment: http://stackoverflow.com/comment/38636704
has comment: http://stackoverflow.com/comment/38636682
has body: You can store message as session scope attribute and then redirect to jsp page where you can access it back using JSP Standard Tag Library and Expression language. Controller: @RequestMapping(...) public String method1(...){ ... session.setAttribute("message", "Hello, How are you?"); return "redirect:product/edit"; } Note: Here you can use RedirectView as well. JSP: ${sessionScope.message}
has comment: http://stackoverflow.com/comment/38636811
type: Answer
answers question: http://stackoverflow.com/q/24875305
has comment: http://stackoverflow.com/comment/38637115
has comment: http://stackoverflow.com/comment/38636855

http://stackoverflow.com/a/25643368
type: Answer
upvote count: 0
score: -1
has body: Use android 4.2 and API 19 to avoid these kind of errors and change: &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /&gt;
answers question: http://stackoverflow.com/q/24751116
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24751116

http://stackoverflow.com/a/24795834
has comment: http://stackoverflow.com/comment/38485371
score: -1
has comment: http://stackoverflow.com/comment/38485256
upvote count: 0
has body: Simply make your while loop as: } while ( choice!=0 );(The Wrong one) Correction: } while(choice!=0 &amp;&amp; choice&lt;=5)
type: Answer
answers question: http://stackoverflow.com/q/24795355
downvote count: 1
has comment: http://stackoverflow.com/comment/38485800

http://stackoverflow.com/a/24755888
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24755730
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24755730
has body: I believe the only reasonable access I have to the text file is InputStream. Why? Use a BufferedReader. Millions of lines per second. And it doesn't have the bugs in your own code, notably that you aren't checking for end of stream in any of the multiple places it can arise.
has comment: http://stackoverflow.com/comment/38409767

http://stackoverflow.com/a/24835688
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38714086
downvote count: 0
has body: I don't recommend deleting plugins from the file system. To achieve what you are looking for, follow these steps: download the Eclipse Standard Edition Open a new workspace Go to 'Window' --> 'Preferences' --> 'General' --> 'Capabilities' click on 'Disable All' button then 'OK' button Restart the workspace XML syntax validation is out of the box and no need to develop a special plugin for it. And even spelling validation is included.
accepted answer of: http://stackoverflow.com/q/24834743
type: Answer
answers question: http://stackoverflow.com/q/24834743
score: 1
has comment: http://stackoverflow.com/comment/38623497
upvote count: 1

http://stackoverflow.com/q/24827456
tagged with: spring-data
type: Question
upvote count: 4
downvote count: 0
score: 4
favorite count: 0
tagged with: spring-batch
accepted answer: http://stackoverflow.com/a/26453239
has title: Spring dynamically choosing between data sources (alternative to ThreadLocal)
answer count: 1
tagged with: multithreading
has body: I've read about AbstractRoutingDataSource and the standard ways to bind a datasource dynamically in this article: public class CustomerRoutingDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { return CustomerContextHolder.getCustomerType(); } } It uses a ThreadLocal context holder to "set" the DataSource: public class CustomerContextHolder { private static final ThreadLocal<CustomerType> contextHolder = new ThreadLocal<CustomerType>(); public static void setCustomerType(CustomerType customerType) { Assert.notNull(customerType, "customerType cannot be null"); contextHolder.set(customerType); } public static CustomerType getCustomerType() { return (CustomerType) contextHolder.get(); } // ... } I have a quite complex system where threads are not necessarily in my control, say: Scheduled EJB reads a job list from the database For each Job it fires a Spring (or Java EE) batch job. Each job have its origin and destination databases (read from a central database). Multiple jobs will run in parallel Jobs may be multithreaded. ItemReader will use the origin data source that was set for that specific job (origin data source must be bound to some repositories) ItemWriter will use the destination data source that was set for that specific job (destination data source must also be bound to some repositories). So I'm feeling somewhat anxious about ThreadLocal, specially, I'm not sure if the same thread will be used to handle multiple jobs. If that happens origin and destination databases may get mixed. How can I "store" and bind a data source dynamically in a safe way when dealing with multiple threads?
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26453239
tagged with: java

http://stackoverflow.com/a/27830852
has comment: http://stackoverflow.com/comment/62101435
has comment: http://stackoverflow.com/comment/56880033
has comment: http://stackoverflow.com/comment/60106640
has comment: http://stackoverflow.com/comment/87427014
has comment: http://stackoverflow.com/comment/63400712
downvote count: 0
score: 8
upvote count: 8
answers question: http://stackoverflow.com/q/24762657
type: Answer
has body: A colleague and I came across this issue as well. We found the answer in the IntelliJ documentation... On the main menu, choose Run | Reload Changed Classes

http://stackoverflow.com/a/24866789
type: Answer
has body: "Is there any way to like disable the button if the user is at the start of the panel or at end of the panel?" According to How to Use CardLayout and CardLayout API there's no direct way to do it. But you can implement this feature easily keeping an int variable with current card number and checking its value againts 0 (for first card) or container's component count (for last card). For instance: public class GridBagLayoutDemo { // note code convention! int currentCard = 0; Action backAction, nextAction; ... public GridBagLayoutDemo() { ... backAction = new AbstractAction("&lt; Back") { @Override public void actionPerformed(ActionEvent e) { currentCard--; GridBagLayoutDemo.this.evaluateActions(); } }; nextAction = new AbstractAction("Next &gt;") { @Override public void actionPerformed(ActionEvent e) { currentCard++; GridBagLayoutDemo.this.evaluateActions(); } }; JButton btnBack = new JButton(backAction); ... JButton btnNext = new JButton(nextAction); ... } private void evaluateActions() { backAction.setEnabled(currentCard &gt; 0); nextAction.setEnabled(currentCard &lt; container.getComponentCount() - 1); } ... } Addendum Looking closer at CardLayout implementation, it would be really easy to have this feature implemented by default (unless I'm missing something): public class CardLayout implements LayoutManager2, Serializable { /* * This creates a Vector to store associated * pairs of components and their names. * @see java.util.Vector */ Vector vector = new Vector(); /* * Index of Component currently displayed by CardLayout. */ int currentCard = 0; ... /* * Hypothetical implementations */ public boolean isDisplayingFirstCard() { return currentCard == 0; } public boolean isDisplayingLastCard() { return currentCard == vector.size() - 1; } } Don't know why they didn't provide such useful feature.
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38642425
accepted answer of: http://stackoverflow.com/q/24866220
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24866220
has comment: http://stackoverflow.com/comment/38632278
has comment: http://stackoverflow.com/comment/38629978
downvote count: 0
has comment: http://stackoverflow.com/comment/38682233

http://stackoverflow.com/comment/66822599
has text: The OP asked for list of topics not brokers
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/35095810

http://stackoverflow.com/q/24882965
has comment: http://stackoverflow.com/comment/38650498
upvote count: 4
has title: Injecting configured values into Spring 4 WebApplicationInitializer
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38651675
has comment: http://stackoverflow.com/comment/38650741
downvote count: 0
tagged with: servlet-3.1
has body: I have a web application using Spring 4 and servlet-api 3.1 in which I am using AbstractAnnotationConfigDispatcherServletInitializer to initialize the DispatcherServlet and ContextLoaderListener via annotated @Configuration java-config Spring app contexts. Environment-specific configuration of the application is achieved using a PropertySourcesPlaceholderConfigurer with @PropertySource annotations. This all works nicely. My question is: I am now in the position of overriding Filter[] getServletFilters() to add filters to the servlet context. However, for the init-param values of some of these filters, I would really like to be able to access some of the aforementioned environment-specific configuration values. Unfortunately, because the environments stuff is post-processing in the application contexts, it appears that I am unable to simply re-use the rather neat Spring configuration injection here. If at all possible, I would like to avoid either hard-coding values that are elsewhere dynamically configured or having to effectively duplicate the environment config logic provided by Spring. Has anyone come up with a neat way to inject configured values that are shared with an app context into a WebApplicationInitializer?
favorite count: 0
type: Question
tagged with: spring
tagged with: spring-mvc
score: 4
has comment: http://stackoverflow.com/comment/38653231
tagged with: java

http://stackoverflow.com/q/24786992
score: 0
has body: I am trying to run a cmd command. Everything works fine but no output. I don't understand why. UPDATED CODE import java.io.*; import java.util.*; class CmdTest { public static void main(String[] args) throws Exception { String command= "ffmpeg -i D:\\test%d.jpg -vcodec mpeg4 outfile.avi"; Process process; System.out.println("first stmt"); try { process = Runtime.getRuntime().exec(command); Scanner kb = new Scanner(process.getInputStream()); System.out.println("try block"); } catch (IOException e) { e.printStackTrace(); } System.out.println("last stmt"); } } I am expecting execution of cmd command mentioned above. Nothing is going wrong during compilation and execution. However, command not executing write.
tagged with: windows
has comment: http://stackoverflow.com/comment/38468593
has answer: http://stackoverflow.com/a/24788719
answer count: 1
tagged with: cmd
has comment: http://stackoverflow.com/comment/38468522
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38468532
has comment: http://stackoverflow.com/comment/38468449
has title: cmd command not running within java program
tagged with: java
has comment: http://stackoverflow.com/comment/38468880
type: Question
has comment: http://stackoverflow.com/comment/38468436

http://stackoverflow.com/q/24874424
tagged with: junit
favorite count: 0
tagged with: rest
possible better answer: http://stackoverflow.com/a/24874779
has answer: http://stackoverflow.com/a/24874779
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Mockito for REST + DAO objects
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24875228
accepted answer: http://stackoverflow.com/a/24875228
has body: This is my mock code for testing end to end: @RunWith(MockitoJUnitRunner.class) public class testRest extends Jersey Test{ DAOFactory mockDAOfactory; RPRestrictionReasonDAO fakeDao; @Before public void init() { mockDAOfactory = mock(DAOFactory.class); fakeDao = mock(RPRestrictionReasonDAO.class); } @Test public void testServiceWorks() throws Exception { //Assuming I hav already initialized restrictReasons with a dummy value when(fakeDao.findAll()).thenReturn(restrictReasons); when(mockDAOfactory.getRPRestrictionReasonDAO()).thenReturn(fakeDao); String response = client().resource("http://localhost:9998/") .path("EmployerDetails/PossibleRestrictions") .get(String.class); System.out.println("Response is " + response.toString()); } } Whenever I do this, I always get the ACTUAL results in my DB rather than the restrictReasons. I've tried all blogs but nothing seems to help. How I get around this? lemme know If I need to post more code. Note: I have implemented the methods while extending Jersey Test with Grizzly container.
answer count: 2
upvote count: 1
tagged with: mockito

http://stackoverflow.com/q/24847257
answer count: 3
possible better answer: http://stackoverflow.com/a/24847273
has answer: http://stackoverflow.com/a/24847273
has answer: http://stackoverflow.com/a/24847276
favorite count: 0
has title: Getting IndexOutOfBoundException
accepted answer: http://stackoverflow.com/a/24847276
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: indexoutofboundsexception
type: Question
has body: why does following main method gives IndexOutOfBoundException at list.add(1, 2)? public static void main(String[] args) { List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); list.add(1, 2); int total = list.get(0); System.out.println(total); }
has answer: http://stackoverflow.com/a/67365511
downvote count: 0

http://stackoverflow.com/a/53578910
has comment: http://stackoverflow.com/comment/96123757
has body: public class PixelGridView extends View { //number of row and column int horizontalGridCount = 2; private Drawable horiz; private Drawable vert; private final float width; public PixelGridView(@NonNull Context context) { this(context, null); } public PixelGridView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); horiz = new ColorDrawable(Color.WHITE); horiz.setAlpha(160); vert = new ColorDrawable(Color.WHITE); vert.setAlpha(160); width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0.9f, context.getResources().getDisplayMetrics()); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); horiz.setBounds(left, 0, right, (int) width); vert.setBounds(0, top, (int) width, bottom); } private float getLinePosition(int lineNumber) { int lineCount = horizontalGridCount; return (1f / (lineCount + 1)) * (lineNumber + 1f); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // drawTask.start(); int count = horizontalGridCount; for (int n = 0; n &lt; count; n++) { float pos = getLinePosition(n); // Draw horizontal line canvas.translate(0, pos * getHeight()); horiz.draw(canvas); canvas.translate(0, - pos * getHeight()); // Draw vertical line canvas.translate(pos * getWidth(), 0); vert.draw(canvas); canvas.translate(- pos * getWidth(), 0); } //drawTask.end(count); } } and in your main activity: //inside on create method val myView = PixelGridView(this) id_frame.addView(myView) id_frame is frame layout in xml
answers question: http://stackoverflow.com/q/24842550
score: 5
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/a/24783705
accepted answer of: http://stackoverflow.com/q/24783486
answers question: http://stackoverflow.com/q/24783486
has comment: http://stackoverflow.com/comment/38465246
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/38486558
has comment: http://stackoverflow.com/comment/38467739
has body: You're not using absolute IRIs to name you graphs, so I don't know offhand what your graph names will be. You can use a query like this to help find out what they are: select * { graph ?g { ?s ?p ?o } } Once you've done that, you can continue using the graph ?g { … } pattern, or use from named to specify a graph in your query: select * from named &lt;name-of-graph&gt; { ?s ?p ?o } select * { graph &lt;name-of-graph&gt; { ?s ?p ?o } } See 13.2 Specifying RDF Datasets and 13.3 Querying the Dataset for the full details and for more examples.
has comment: http://stackoverflow.com/comment/38464726
downvote count: 0

http://stackoverflow.com/comment/38683666
type: Comment
has text: My total memory is 4GB, together with some other uses. I've modified the settings, and new problem appears. It tells that "Out of memory".
comment on: http://stackoverflow.com/a/24875594
type: AnswerComment
score: 0

http://stackoverflow.com/q/24875836
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24880250
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24877586
tagged with: antlr4
has title: ANTLR mismatched input error
possible better answer: http://stackoverflow.com/a/24877586
upvote count: 2
has answer: http://stackoverflow.com/a/24880250
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: antlr
has body: I'm writing a parser for my own language. I'm trying to parse the phrase Number a is 10; which is basically equivalent to int a = 10;. It should match the variable_def rule. When I run it, I get the error line 1:0 extraneous input 'Number' expecting {&lt;EOF&gt;, 'while', ';', 'if', 'function', TYPE, 'global', 'room', ID} line 1:9 mismatched input 'is' expecting '(' This is my grammar: grammar Script; @header { package script; } // PARSER program : block EOF ; block : ( statement | functionDecl )* ; statement : (variable_def | functionCall | ifStatement | forStatement | whileStatement) ';' ; whileStatement : 'while' '(' expression ')' '{' (statement)* '}' ; forStatement : ; ifStatement : 'if' '(' expression ')' '{' statement* '}' ( ( 'else' '{' statement* '}' ) | ( 'else' ifStatement ) )? ; functionDecl : 'function' ID ( '(' ( TYPE ID )? ( ',' TYPE ID )* ')' )? ( 'returns' RETURN_TYPE )? '{' statement* '}' ; functionCall : ID '(' exprList? ')' ; exprList : expression ( ',' expression )* ; variable_def : TYPE assignment | GLOBAL variable_def | ROOM variable_def ; expression : '-' expression # unaryMinusExpression | '!' expression # notExpression | expression '^' expression # powerExpression | expression '*' expression # multiplyExpression | expression '/' expression # divideExpression | expression '%' expression # modulusExpression | expression '+' expression # addExpression | expression '-' expression # subtractExpression | expression '&gt;=' expression # gtEqExpression | expression '&lt;=' expression # ltEqExpression | expression '&gt;' expression # gtExpression | expression '&lt;' expression # ltExpression | expression '==' expression # eqExpression | expression '!=' expression # notEqExpression | expression '&amp;&amp;' expression # andExpression | expression '||' expression # orExpression | expression IN expression # inExpression | NUMBER # numberExpression | BOOLEAN # boolExpression | functionCall # functionCallExpression | '(' expression ')' # expressionExpres…

http://stackoverflow.com/a/24762493
has body: Here you go. Created especially for you. import java.util.Map; import java.util.TreeMap; public class TreeMapWithoutGNULicense&lt;K, V&gt; extends TreeMap&lt;K, V&gt; { private static final long serialVersionUID = 3069492680223110767L; public boolean putEntry(Map.Entry&lt;K, V&gt; entry) { return super.entrySet().add(entry); } } I'm thinking of licensing it as beerware. Update SO leaves me no choice: it's got to be the CC-BY-SA. Please refrain from sending me beer.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38450556
has comment: http://stackoverflow.com/comment/38453871
has comment: http://stackoverflow.com/comment/38422002
downvote count: 0
answers question: http://stackoverflow.com/q/24761820
has comment: http://stackoverflow.com/comment/38450667
has comment: http://stackoverflow.com/comment/38488543
type: Answer
has comment: http://stackoverflow.com/comment/38426758

http://stackoverflow.com/comment/38466520
type: Comment
type: QuestionComment
has text: Have you tried Oracle's hotspot build on Linux? What happens if you give both VMs enough memory where they don't run out of memory in seconds?
comment on: http://stackoverflow.com/q/24784368
score: 0

http://stackoverflow.com/comment/38622214
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24863407
has text: I tested t out is is the same.

http://stackoverflow.com/a/24892864
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24873786
downvote count: 0
answers question: http://stackoverflow.com/q/24873786
score: 1
has body: It turns out @XmlRootElement was required with CXF. I only had experience with Jersey as a JSON mapper.

http://stackoverflow.com/a/24760045
score: 0
answers question: http://stackoverflow.com/q/24759860
has body: If you want your own hashcode try this int hash = 3; hash = 7 * hash + a; hash = 7 * hash + b; But I thing you should use hashCodeBuilder from Apache Utilis BTW return a == t.a || b == t.b; are you sure?
has comment: http://stackoverflow.com/comment/38417209
type: Answer

http://stackoverflow.com/a/24779578
answers question: http://stackoverflow.com/q/24777535
has comment: http://stackoverflow.com/comment/38454158
downvote count: 0
has body: @Kayaman actually already answered the question, but maybe a bit more information may be helpful here. EDIT ... and isnot2bad wrote a similar answer (+1). I'm obviously too slow. However, maybe it is considered useful nevertheless. First of all: The code System.out.println("Producer added " + i); queue.put(String.valueOf(i)); will obviously print Producer added 1 before it was actually added to the queue. Simply swapping the lines to queue.put(String.valueOf(i)); System.out.println("Producer added " + i); will reduce the number of cases where the output seems to be wrong, but not eliminate them completely. The reason is that these two lines are not atomic. An example schedule that shows what each thread is doing at each step shows that the result may look arbitrarily wrong, depending on the order of operations: Producer thread: Consumer thread: Queue: Output: ------------------------------------------------------------------------ queue.put(0); [0] println("Added " + 0); [] Added 0 String 0 = queue.take(); [] println("Used " + 0); [] Used 0 queue.put(1); [1] String 1 = queue.take(); [] println("Added " + 1); [] Added 1 queue.put(2); [2] println("Added " + 2); [2] Added 2 println("Used " + 1); [2] Used 1 String 2 = queue.take(); [] println("Used " + 2); [] Used 2 queue.put(3); [3] String 3 = queue.take(); [] println("Used " + 3); [] Used 3 println("Added " + 3); [] Added 3 queue.put(4); [4] println("Added " + 4); [4] Added 4 Still, the key point is that the queue never contains more than one element.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/24911116
has body: Problem solved. I am not sure if it is the limitation of classpath size in MAINFEST file, but it really matters when it was too long, I changed all jar name as 1, 2 , 3... and be able to put all jars in the classpath, and it works. Please leave your comments if you have different opinion on this, Thanks.
score: 0
accepted answer of: http://stackoverflow.com/q/24897264
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24897264

http://stackoverflow.com/comment/38440888
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24772498
type: AnswerComment
has text: i need to retrieve the array from javascript i am passing to servlet . How to retrieve it in servlet?

http://stackoverflow.com/q/24836315
has comment: http://stackoverflow.com/comment/38565762
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/38561227
accepted answer: http://stackoverflow.com/a/24836400
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38562648
downvote count: 0
has answer: http://stackoverflow.com/a/24836400
type: Question
has body: Situation I am making a graph class that looks like this: class ImmutableGraph&lt;G&gt; { Node&lt;G&gt; selectedNode; private ImmutableGraph(Node&lt;G&gt; initialNode) { selectedNode = initialNode; } //many more things } and I'm currently using a (nested) builder class like so public static class GraphBuilder&lt;B&gt; { Node&lt;B&gt; currentNode; public GraphBuilder(B value){ currentNode = new Node(value); } public ImmutableGraph&lt;B&gt; build(){ return new ImmutableGraph&lt;B&gt;(currentNode); } //many more things } which uses the (nested) node class private static class Node&lt;N&gt; { private final N value; Array&lt;Nodes&lt;N&gt;&gt; neighbours; public Node(N v){ value = v; } //many more things } Problem I can't find a way to instantiate my ImmutableGraph using my builder because the return type is not correct. Indeed, compilation suggests that GraphBuilder.build() should return a type ImmutableGraph&lt;Node&lt;B&gt;&gt; and not ImmutableGraph&lt;B&gt; For now the only solution I found is to change the return type to ImmutableGraph&lt;Node&lt;B&gt;&gt; but that's feels dumb since all graphs (except empty ones) are graphs of nodes. The Node type is also confusing since the user never interacts with it. edit: corrected the "new" in the factory method of the builder
score: 1
tagged with: java
has title: Generic class uses generic argument
upvote count: 1
answer count: 1

http://stackoverflow.com/q/24890639
has body: I'm using Android Studio and I can't find a way to edit each Tab. I need to have a custom image for each tab and not the text. I 've found a way, but it applies one image for all the tabs. Another question is how can I change fragment layout for each tab? Every time I slide, I always see the same item's. This is the source of the MainActivity: public class MainActivity extends Activity implements ActionBar.TabListener { SectionsPagerAdapter mSectionsPagerAdapter; ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(false); mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); for (int i = 0; i &lt; mSectionsPagerAdapter.getCount(); i++) { actionBar.addTab(actionBar.newTab().setIcon(R.drawable.ic_action_help).setTabListener(this)); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_settings: Toast.makeText(this, "Impostazioni", 2500).show(); return true; case R.id.action_info: Toast.makeText(this, "Informazioni", 2500).show(); return true; } return super.onOptionsItemSelected(item); } @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { mViewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(ActionBar…
tagged with: android-tabhost
tagged with: edit
has comment: http://stackoverflow.com/comment/38666125
has title: Android Studio - TabHost Error & Customization
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38664737
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/38523049
has text: Did you read the part of the accepted answer that says, "if you override it, you'll probably break it"?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24815852

http://stackoverflow.com/a/60521592
downvote count: 0
has body: About java.lang.NoSuchMethodError : This error is a runTime error which occurs as a result of missing method definition in the classes available in the ClassPath. After the classLoader loads the class, linking phase fails to link the method call as the requested method is not available in the ClassPath classes This error generally occurs when you compile and test your code in one environment (generally local machine) and you deploy your code in another environment. We will consider the following example for our use case : java.lang.NoSuchMethodError: org.json.JSONTokener Why the classes are not available in the ClassPath despite creating a uber jar? : It’s because classes are loaded at runtime and if loader finds multiple classes with same signature, it loads the first one it encounters. If that class doesn’t have the required method, we will get the NoSuchMethodError. Gist is that classLoader fails to find the exact class which we want it to load. How to find which class is getting load? We can use following code snippet in the main method to find out the class which is getting loaded. ClassLoader classloader = org.json.JSONTokener.class.getClassLoader(); URL res = classloader.getResource("org/json/JSONTokener.class"); String path = res.getPath(); System.out.println("Core JSONTokener came from " + path) What to do after finding the path of class from which it is getting loaded? If you find that the library that is getting loaded is coming from some other path in the machine, you have to make sure that the desired library gets loaded. The best method to do so is to shade your jar and rename the references in your project. How to shade a jar and rename references in Scala/Java? In Scala, you can add addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7") to ./project/plugins.sbt and then use the sbt commandsbt assembly to generate a fat jar-file. Now to shade the jar use following code in your sbt: assemblyShadeRules in assembly := Seq( ShadeRule.rename(“org.json.**…
type: Answer
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/24899839

http://stackoverflow.com/comment/38567378
comment on: http://stackoverflow.com/a/24839840
type: Comment
has text: Thanks for Your quick response, Your answer seems really helpful. I am trying all these mentioned steps.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24868943
has comment: http://stackoverflow.com/comment/38623540
has title: Efficiency of custom comparators
tagged with: java
has comment: http://stackoverflow.com/comment/38623439
type: Question
has body: Which of these two custom comparators is the most efficient? (Used on a vector of thousands of arrays) //Compares arrays by their first element, then second if equal Comparator&lt;String[]&gt; comparator = new Comparator&lt;String[]&gt;() { public int compare(String[] c1, String[] c2) { int comparison; if((comparison=(c1[0].compareTo(c2[0])))==0) return c1[1].compareTo(c2[1]); else return comparison; } }; //Compares arrays by their first element, then second if equal Comparator&lt;String[]&gt; comparator = new Comparator&lt;String[]&gt;() { public int compare(String[] c1, String[] c2) { if(c1[0].compareTo(c2[0])==0) return c1[1].compareTo(c2[1]); else return c1[0].compareTo(c2[0]); } }
has comment: http://stackoverflow.com/comment/38623420
score: -1
has comment: http://stackoverflow.com/comment/38623352
tagged with: comparator
has comment: http://stackoverflow.com/comment/38623490
has answer: http://stackoverflow.com/a/24869065
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38623495
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38623393
type: AnsweredQuestion
tagged with: performance
accepted answer: http://stackoverflow.com/a/24869065

http://stackoverflow.com/q/24751978
has answer: http://stackoverflow.com/a/24752215
has answer: http://stackoverflow.com/a/59798236
answer count: 6
has answer: http://stackoverflow.com/a/65750977
score: 0
has answer: http://stackoverflow.com/a/24752089
possible better answer: http://stackoverflow.com/a/24752215
has answer: http://stackoverflow.com/a/47546170
has body: Here is the problem from codingbat.com that I am having trouble understanding the solution to. Given a string, return a version where all the "x" have been removed. Except an "x" at the very start or end should not be removed. stringX("xxHxix") → "xHix" stringX("abxxxcd") → "abcd" stringX("xabxxxcdx") → "xabcdx" Here is the solution they provided: public String stringX(String str) { String result = ""; for (int i=0; i&lt;str.length(); i++) { // Only append the char if it is not the "x" case if (!(i &gt; 0 &amp;&amp; i &lt; (str.length()-1) &amp;&amp; str.substring(i, i+1).equals("x"))) { result = result + str.substring(i, i+1); // Could use str.charAt(i) here } } return result; } If someone could break down the complex logic in the if statement, it would be really helpful. Does the negation operator(!) apply to the entire if statement or only to what's inside of the first set of parenthesis? That if statement is what's really confusing me. Thank you in advance.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24752089
has answer: http://stackoverflow.com/a/60886992
tagged with: java
type: Question
has title: Confusion while trying to comprehend the solution to a codingbat assignment

http://stackoverflow.com/comment/38671645
type: QuestionComment
comment on: http://stackoverflow.com/q/24888009
score: 0
has text: what is the syntax in build.gradle called? what kind of script is it?
type: Comment

http://stackoverflow.com/comment/42143436
type: Comment
type: QuestionComment
has text: I did not solve the problem. My solution was to move away from QuickBlox and used OpenTok SDK instead. Give them a try!
comment on: http://stackoverflow.com/q/24892652
score: 0

http://stackoverflow.com/comment/38493208
score: 0
comment on: http://stackoverflow.com/a/24800076
type: Comment
has text: @Andrew Stubbs added a synopsis
type: AnswerComment

http://stackoverflow.com/a/35178782
has body: I have done this way, its very simple: Just add 1 Line for Clicked RecyclerView position: int position = getLayoutPosition() Full code for ViewHolder class: private class ChildViewHolder extends RecyclerView.ViewHolder { public ImageView imageView; public TextView txtView; public ChildViewHolder(View itemView) { super(itemView); imageView= (ImageView)itemView.findViewById(R.id.imageView); txtView= (TextView) itemView.findViewById(R.id.txtView); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.i("RecyclerView Item Click Position", String.valueOf(getLayoutPosition())); } }); } } Hope this will help you.
upvote count: 10
downvote count: 0
score: 10
answers question: http://stackoverflow.com/q/24885223
has comment: http://stackoverflow.com/comment/108688083
type: Answer

http://stackoverflow.com/q/24824353
tagged with: image
answer count: 2
tagged with: file-io
upvote count: 7
tagged with: executable-jar
favorite count: 0
has answer: http://stackoverflow.com/a/24824537
tagged with: javax.imageio
type: AnsweredQuestion
downvote count: 0
has body: I have created executable jar file(using Eclipse) , there are a set of image (.png) files that is to be inculded in the jar. So I have added a source folder with all the images inside /images folder in the project . Code has to access these file to create BufferedImage using ImageIO.read(new File(path); Earlier, To get the path I used ClassName.class.getResource(/image/test.png).toURI(); On executing jar , it throw error URI is not hierarchical So now I am using ClassName.class.getResourceAsStream(/image/test.png); But how to make ImageIO read from Inputstream ? I tried cast as follows InputStreamReader resourceBuff=ClassName.class.getResourceAsStream(/image/test.png); ImageIO.read((ImageInputStream) new InputStreamReader(resourceBuff)); It throws error InputStreamReader cannot be cast to ImageInputStream
possible better answer: http://stackoverflow.com/a/24824537
has answer: http://stackoverflow.com/a/24824509
has title: How to make ImageIO read from InputStream :Java
accepted answer: http://stackoverflow.com/a/24824509
score: 7
tagged with: java
type: Question

http://stackoverflow.com/comment/38548340
comment on: http://stackoverflow.com/a/24829058
has text: I don't understand why you added anything beyond the first solution. Also unless java requires you to group, there'd be no need to group `\d+$` (though it may well be required by java, I have no idea)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/38459120
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/80834717
downvote count: 1
upvote count: 4
answers question: http://stackoverflow.com/q/24766591
has body: None of the previous solutions worked for me. I solved it by editing .idea/compiler.xml There were "extra" (1) and (2) copies of the bad module with different targets. I deleted the extraneous entried and changed the targets in the section to 1.8 and it worked.

http://stackoverflow.com/comment/38603744
score: 0
has text: Nope I am not overriding hashCode anywhere. That was the whole point of this example that if you don't override hashCode, it won't work properly. I understand that it returns "Jenny" because those two are the same instances somehow, but would like to know what the difference came from compared to the first example.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24858454

http://stackoverflow.com/comment/38400420
type: QuestionComment
has text: @lenabru Thanks for your answer and please give more tips for development so i can develop powerful app with good performance.
comment on: http://stackoverflow.com/q/24750959
score: 0
type: Comment

http://stackoverflow.com/q/24805664
has answer: http://stackoverflow.com/a/24805703
has answer: http://stackoverflow.com/a/24805869
tagged with: android-listview
has title: How to get the first element of HashMap
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/24809447
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24805711
has answer: http://stackoverflow.com/a/24805716
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24805711
tagged with: hashmap
has body: Tried so many ways and read huge amounts of text, but I still can not understand how to solve my problem. The idea is that there is HashMap that is filled with a loop "for" with data from the database. Further, this parameter (HashMap) is passed to listViewContent then created adapter and eventually fills the listView. The fact is that every row in the listView has 2 textView and 1 imageView and I need to get text from the second textView of this listView, the data is stored in the database. Here is my code blocks: HashMap block if (posts != null) { for (WallPostItem post : posts) { //create new map for a post Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); map.put(ATTRIBUTE_NAME_TEXT, post.text); PictureItem postPicture = new PictureItem(); map.put(ATTRIBUTE_NAME_IMAGE, postPicture); map.put(ATTRIBUTE_NAME_DATE, post.date); if ((post.pictures != null) &amp;&amp; (post.pictures.size() != 0)) { //start downloading of pictures String pictureLink = post.pictures.get(0); if (dbHandler.hasPicture(pictureLink)) { Bitmap image = dbHandler.getPicture(pictureLink); int width = image.getWidth(); int height = image.getHeight(); if (width&gt;800 || height&gt;800){ int threeWidth = width / 2; int threeHeight = height / 2; Bitmap bmThree = Bitmap.createScaledBitmap(image, threeWidth, threeHeight, false); postPicture.picture = bmThree;} else if (width&gt;500 &amp;&amp; width &lt;800 || height&gt;500 &amp;&amp; height&lt;800) { int halfWidth = width; int halfHeight = height; Bitmap bmHalf = Bitmap.createScaledBitmap(image, halfWidth, halfHeight, false); postPicture.picture = bmHalf; } else postPicture.picture = image; //Log.d("mytest", " HAS PICTURE " + pictureLink); } else { DownloadImageTask downloadImageTask = new DownloadImageTask(postPicture){ @Override public void onResponseReceived(){ //Log.d("mytest", "adding picture to db: " + urldisplay); if (bmImage.picture != null) dbHandler.addPicture(bmImage.picture, urldisplay); sAdapter.notifyDataSetChanged(); }…
possible better answer: http://stackoverflow.com/a/24805703
tagged with: listview
score: 0

http://stackoverflow.com/a/24863405
answers question: http://stackoverflow.com/q/24863295
has body: Your problem is here: for (int i=0; i&lt;4; i++) list_12.remove(i); if you have list [1, 2, 3, 4] for example, and you remove first element (at index 0) you will have [2,3,4] and then if you remove second element from that list (at index 1) you will have [2,4]. So change that loop to: for (int i=0; i&lt;4; i++) list_12.remove(0); (Also note that removing elements from start of ArrayList is costly since all other elements needs to shift.)
accepted answer of: http://stackoverflow.com/q/24863295
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/38505723
type: AnswerComment
comment on: http://stackoverflow.com/a/24806876
score: 0
type: Comment
has text: First thing it is not specific to the name Mickaël, it was just used as sample data, and I dont want any other character in there apart from 'e' over there. Thnx for the reply bdw.

jgoodies
tags question: http://stackoverflow.com/q/24811428
type: Tag
tag name: jgoodies

http://stackoverflow.com/comment/38588637
type: Comment
has text: but that wouldn't be easily accessible from other classes. I need to be able to stop that message from sending
type: QuestionComment
comment on: http://stackoverflow.com/q/24850524
score: 0

http://stackoverflow.com/q/24827319
answer count: 2
has answer: http://stackoverflow.com/a/24837600
has comment: http://stackoverflow.com/comment/38545754
has comment: http://stackoverflow.com/comment/38545161
downvote count: 0
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38544847
has body: Okay so i have a custom class which represents a company saying they have a certain quantity of an item, on a specific date. To simplify my problem, let me say that in this case we are looking only at three important class variables, which are: String partNumber - Contains the part# that a company is saying is in stock. int quantity - The amount of the item that is in stock. Calendar dateOfAccess - This variable contains the date the statement was found. What i want to do is take a collection of these objects, and sort them first by part number, then by date of access, so one could loop through part numbers, and inside that loop, have a nested loop that sums up the total number of parts for each day... in order to make a graph of total quantities over time. This needs to be done in a way that is efficient, and where the code is fairly clear. What i have already tried: Assuming the input collection is an arraylist, we could easily set pre-defined part numbers to have the program match, and get an arraylist of all one part number (by the way... there are variations, like "St-56" and "St 56" and "St56", but we could pass in an array of strings and if the object's part number matches any string in this array we can say its part number is matching) Once we have an array list of an individual part, this becomes the tricky bit. I have tried putting them in an array where the index is the "Time since Jan 1, 2014". In this way if we have arr[index] and our array has dates: Jan 6, Feb 1, Jan 24, Jan 5, Jan 6.... then: arr[5] = (ArrayList containing 1 object with date "Jan 5") arr[6] = (ArrayList containing 2 objects with date "Jan 6") arr[24] = (ArrayList containing 1 objects with date "Jan 24") arr[32] = (ArrayList containing 1 objects with date "Feb 1") This way we could appropriately do some sort of sum: for (int i = 0; i &lt; arr.length(); i++) { int arrayListTotal = arr[i].size(); .... } ..... and begin to sum up every day of a given part number. The problem with my appr…
tagged with: dictionary
score: 2
has comment: http://stackoverflow.com/comment/38547046
type: UnansweredQuestion
tagged with: collections
has answer: http://stackoverflow.com/a/24828185
has comment: http://stackoverflow.com/comment/38545019
type: Question
tagged with: algorithm
tagged with: java
has title: How to properly sort collection of objects so that quantities can be totaled for a graph
upvote count: 2

http://stackoverflow.com/a/24846314
has comment: http://stackoverflow.com/comment/38579956
has body: What does it return when you do this? &lt;c:forEach items="${abc}" var="row"&gt; &lt;td&gt;${row.values}&lt;/td&gt; &lt;/c:forEach&gt;
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24846276

http://stackoverflow.com/comment/38755072
comment on: http://stackoverflow.com/q/24906226
has text: I add my RefractiveIndex class.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38676196
type: QuestionComment
comment on: http://stackoverflow.com/q/24896405
has text: @user3800301 do you mind adding the stacktrace of the crash?
score: 0
type: Comment

http://stackoverflow.com/a/24807272
score: 1
has comment: http://stackoverflow.com/comment/38506785
has comment: http://stackoverflow.com/comment/38506740
has comment: http://stackoverflow.com/comment/38507022
has comment: http://stackoverflow.com/comment/38506801
answers question: http://stackoverflow.com/q/24807234
upvote count: 1
has comment: http://stackoverflow.com/comment/38507113
has comment: http://stackoverflow.com/comment/38507074
has comment: http://stackoverflow.com/comment/38506962
has comment: http://stackoverflow.com/comment/38507150
has body: It should work. \d+\.?\d*|\d*\.?\d+ DEMO Use String#matches() method to match it. sample code: String regex="\\d+\\.?\\d*|\\d*\\.?\\d+"; System.out.println("1".matches(regex)); // true System.out.println("1.00".matches(regex));// true System.out.println(".1".matches(regex)); // true System.out.println("1.".matches(regex)); // true System.out.println(".".matches(regex)); // false
has comment: http://stackoverflow.com/comment/38507815
has comment: http://stackoverflow.com/comment/38507024
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38506899
downvote count: 0
has comment: http://stackoverflow.com/comment/38506844
type: Answer
has comment: http://stackoverflow.com/comment/38506718
has comment: http://stackoverflow.com/comment/38512795
accepted answer of: http://stackoverflow.com/q/24807234

http://stackoverflow.com/comment/38609566
comment on: http://stackoverflow.com/q/24861766
type: QuestionComment
has text: `<>` and `()` and `{}` are completely unrelated - they're not instances of a "information passing" concept or anything.
type: Comment
score: 4

http://stackoverflow.com/a/25097251
answers question: http://stackoverflow.com/q/24784792
type: Answer
has body: for me, the question is now clearly a Java 8 bug. I found the workaround to integrate the Java 7 JavaScript engine into my project. This should work until the bug is fixed. See this description on how to do it: https://wiki.openjdk.java.net/display/Nashorn/Using+Rhino+JSR-223+engine+with+JDK8 cu Frank
score: 0

http://stackoverflow.com/comment/38509150
comment on: http://stackoverflow.com/q/24808075
score: 0
has text: 3, marked in gray: 1 - Restart Eclipse, 2 - Set Windows environment path for your JDK and restart Windows, 3 - Set the JRE path in Eclipse
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24870714
has title: delete intersecting values in an arraylist
has comment: http://stackoverflow.com/comment/38626722
tagged with: algorithm
has comment: http://stackoverflow.com/comment/38626770
answer count: 3
possible better answer: http://stackoverflow.com/a/24871650
has answer: http://stackoverflow.com/a/24870857
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24870903
accepted answer: http://stackoverflow.com/a/24870903
has comment: http://stackoverflow.com/comment/38626844
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24871650
upvote count: 2
tagged with: java
type: Question
has body: I have a class like this public class Func { String id; long startTime; long endTime; } and in one of the methods I have list of these class objects List&lt;Func&gt; funList = new ArrayList&lt;Func&gt;(); Whats the best way to remove the objects from this funList whose startTime and endTime intersect with another object in the same list. One way I can think of is to take each object in the list and compare with other objects and put the id in an other data structure if it intersects. After every object is compared against other, go through the datastructure where ID's are save and remove them from the List.

http://stackoverflow.com/q/24758741
has comment: http://stackoverflow.com/comment/38414787
has body: I have a code which is running inside Oracle JVM. Is there any way to debug the java code which is running inside the oracle jvm?? Thanks in advance..
has answer: http://stackoverflow.com/a/24759146
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38414973
has title: Debugging a Java Code running in Oracle JVM
tagged with: oracle11g
type: Question
linked to: http://stackoverflow.com/q/975271
tagged with: debugging
tagged with: java
has comment: http://stackoverflow.com/comment/38414934
answer count: 1
has comment: http://stackoverflow.com/comment/38414944
tagged with: jvm
score: 0

http://stackoverflow.com/a/45671030
upvote count: 2
has comment: http://stackoverflow.com/comment/78300060
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24801507
has body: I solve this problem by setting hbase.client.scanner.caching see also Client and RS maintain a nextCallSeq number during the scan. Every next() call from client to server will increment this number in both sides. Client passes this number along with the request and at RS side both the incoming nextCallSeq and its nextCallSeq will be matched. In case of a timeout this increment at the client side should not happen. If at the server side fetching of next batch of data was over, there will be mismatch in the nextCallSeq number. Server will throw OutOfOrderScannerNextException and then client will reopen the scanner with startrow as the last successfully retrieved row. Since the problem is caused by the client-side overtime, then the corresponding reduction in client cache (hbase.client.scanner.caching) size or increase rpc timeout time (hbase.rpc.timeout) can be. Hope this answer helps.

http://stackoverflow.com/comment/38527457
type: QuestionComment
comment on: http://stackoverflow.com/q/24817287
score: 0
type: Comment
has text: http://im4java.sourceforge.net/

http://stackoverflow.com/comment/38443499
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24773849
has text: looking at the code, the collection can only have a scope equal to or bigger than the scope of SomeObject so the scenario where the collection is GCed before SomeObject cannot happen.

http://stackoverflow.com/comment/93809868
type: Comment
score: 0
type: AnswerComment
has text: sometimes, a GlassFish restart helps.
comment on: http://stackoverflow.com/a/33744513

http://stackoverflow.com/comment/38485107
type: Comment
score: 1
has text: Ahha, since I too use to put integers for this thingy, though I always wanted myself to change to boolean for this behaviour, +! though to all :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/24795496

http://stackoverflow.com/q/24765713
has comment: http://stackoverflow.com/comment/38430635
downvote count: 0
tagged with: java
has title: ClassNotFoundException: javax.ws.rs.client.ClientBuilder
type: Question
has answer: http://stackoverflow.com/a/24778531
has body: I´m trying to consume a Jersey Rest Service from a Web Application (Dynamic Web App in eclispe) as follows: Client client = ClientBuilder.newBuilder().build(); // Here is the error WebTarget target = client.target("url/rest").path("List"); String result = target.request(MediaType.TEXT_PLAIN).get(String.class); When debugging in the line ClientBuilder.newBuilder() the system throws the ClassNotFoundException: javax.ws.rs.client.ClientBuilder error, but the same code, in a java project works perfect. Full trace: javax.servlet.ServletException: Error instanciando clase de servlet test org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Unknown Source) causa raíz java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder test.&lt;init&gt;(test.java:27) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) java.lang.reflect.Constructor.newInstance(Unknown…
tagged with: jersey
accepted answer: http://stackoverflow.com/a/24778531
has comment: http://stackoverflow.com/comment/38428729
tagged with: jackson
score: 4
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38430189
has comment: http://stackoverflow.com/comment/38428163
has comment: http://stackoverflow.com/comment/38428120
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/38646903
has text: View this question : http://stackoverflow.com/questions/27745/getting-parts-of-a-url-regex
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24881240
type: Comment

http://stackoverflow.com/comment/38552294
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24831477
has text: How are you getting your reference to myActionBar and where are you placing that code?

http://stackoverflow.com/a/24780291
has comment: http://stackoverflow.com/comment/38455233
answers question: http://stackoverflow.com/q/24780236
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/38455186
type: Answer
has body: The Android SDK does not have javax.sound. You need to use Android media APIs for audio playback on Android.
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38460667
accepted answer of: http://stackoverflow.com/q/24780236

http://stackoverflow.com/a/24838991
score: 0
has body: here is a batch-solution: del %temp%\x.x 2&gt;nul for /f "tokens=*" %%i in ('dir /s /b /a-d *') do (find "%%~xi" %temp%\x.x ||&lt;nul set/p .= %~xi&gt;&gt;x.x) set /p ext=&lt;%temp%\x.x set ext=%ext:.=,% set ext=%ext:~1% echo %ext%
type: Answer
has comment: http://stackoverflow.com/comment/38566281
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24833727

http://stackoverflow.com/comment/38733015
type: AnswerComment
comment on: http://stackoverflow.com/a/24894861
has text: Thanks that helped a lot! My intentions where to use png and not a proprietary format to store all the data with the image i need, and make it simple to open with other software.
type: Comment
score: 0

http://stackoverflow.com/comment/38652037
score: 0
type: Comment
type: QuestionComment
has text: Same question, same answer provided here: http://stackoverflow.com/questions/15291400/is-this-overloading-methods-with-same-name-in-different-classes-and-different-s
comment on: http://stackoverflow.com/q/24884151

http://stackoverflow.com/a/24862228
accepted answer of: http://stackoverflow.com/q/24861892
has body: What you are looking for is a ManyToOne relationship. What this says is simple: @ManyToOne How many pages can a person create? Many. How many persons can create a single page? One @ManyToMany How many pages can be modified by a single person? Many How many persons can modify a single page? Many (But i would go for OneToMany here and have a list of Persons who modified the page. @ManyToMany would be a tricky a fair) @ManyToOne How pages can be owned by a single person?Many How persons can own a single page? One (Well sometimes you can have more than one owner, but in your scenario, am guessing only one owner is desired) So: @Entity public class Page{ @ManyToOne private Person creator; @OneToMany private List&lt;Person&gt; modifiers; @ManyToOne private Person owner; //which i guess may be the same as owner. }
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24861892
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38611800

http://stackoverflow.com/q/24805351
has title: unable to findright file path
tagged with: selenium-webdriver
tagged with: java
has comment: http://stackoverflow.com/comment/38502769
type: Question
answer count: 2
has body: I am facing some problem to fix the right file path. I have a configuration file and following is the entry in config.properties: strMasterTestSuiteFilePath="D:\\KeywordDrivenFramework\\MasterTestSuiteFile.xls" Then i tried to read this property as Properties prop=new Properties(); prop.load("config.properties") String strpath=prop.getProperty("strMasterTestSuiteFilePath") Syso(strpath) //prints above path with single slash as D:\KeywordDrivenFramework\MasterTestSuiteFile.xls //When i use the same var for File existance check it say not exists File obj=new File(strpath) if(obj.exists()) Syso("Exists....") else Syso("Does not exist....") Why it is going to else block, even though the file exists at path? How to overcome it? I tried String str= strpath.replaceAll("\","\\") //but i am getting some syntax error "The method replaceAll(String, String) in the type String is not applicable for the arguments (String)" Can anyone help me how to overcome this? Find the code which i am trying, where i am going wrong? public void LoadMasterTestSuite() { String strGlobalConfigSettingFilePath=System.getProperty("user.dir")+"/src/GlobalConfigurationSettings.properties"; FileInputStream objFIS; //Variable to hold FileSystem Objet File objFile; //Variable to hold File Object try { objFIS = new FileInputStream(new File(strGlobalConfigSettingFilePath)); globalObjProp.load(objFIS); strMasterTSFilePath=globalObjProp.getProperty("strMasterTestSuiteFilePath"); objAppLog.info("Master Test Suite File Path configured as "+strMasterTSFilePath); }catch (FileNotFoundException e) { objAppLog.info("Unable to find Global Configuration Settings File. So aborting..."); e.printStackTrace(); }catch (IOException e) { e.printStackTrace(); } String str=strMasterTSFilePath.replace("\\", "\\\\"); objFile=new File(str); System.out.println(str); if(objFile.exists()) { LoadTestSuite(strMasterTSFilePath); } else { objAppLog.info("Master Test Suite File not found at Path: "+strMasterTSFilePath); System.exit(-1);…
has comment: http://stackoverflow.com/comment/38593576
score: 0
has answer: http://stackoverflow.com/a/24805586
has answer: http://stackoverflow.com/a/24805469
type: UnansweredQuestion

http://stackoverflow.com/comment/38680286
score: 0
type: Comment
has text: @Israelm exactly: A java.sql.Date is a normal except it ignores the hours, minutes and seconds in its toString() impl.
comment on: http://stackoverflow.com/a/24790596
type: AnswerComment

http://stackoverflow.com/q/24844884
type: Question
has title: Checkbox in JTable always return false despite of it's checked
answer count: 1
has body: I am using checkboxes in JTable which itsef is part of JPanel. Initially I was using JOptionPane and on clicking OK button I was getting value but now I added JPanel in a JFrame. When I click X sign on top right it is not retrieving value of clicked Checkboxes but able to fetch values of other columns. Code snippet given below: DefaultTableModel dtm = new DefaultTableModel(rowData, columnNames) { }; for (int i = 0; i &lt; records.size(); i++) { // System.out.println(records.get(i)); singleRecord = records.get(i).toString().split("%"); Pages = singleRecord[0].toString(); BKey= singleRecord[1].toString(); Title = singleRecord[2].toString(); Author = singleRecord[3].toString(); TimeStamp = singleRecord[4].toString(); dtm.addRow(new Object[] { Boolean.FALSE ,Pages,BKey,Title,Author,TimeStamp}); } table = new javax.swing.JTable(dtm) { public boolean isCellEditable(int row,int column) { /*if(column == 0) return true; else return false; * */ return(column &lt; 2); } }; for (int i = 0; i &lt; table.getRowCount(); i++) { System.out.println(table.getValueAt(i,1).toString()); boolean isChecked = (Boolean) table.getValueAt(i,0);//always return false if (isChecked) { System.out.println("checked "); Ids+=table.getValueAt(i,2).toString()+"%"; } }
tagged with: jtable
has answer: http://stackoverflow.com/a/24844930
type: UnansweredQuestion
score: 0
tagged with: swing
tagged with: checkbox
tagged with: java

avi
tags question: http://stackoverflow.com/q/24844066
tag name: avi
type: Tag

http://stackoverflow.com/a/24803030
type: Answer
answers question: http://stackoverflow.com/q/24802724
has comment: http://stackoverflow.com/comment/38498377
has body: document = Jsoup.connect("http://www.beyazperde.com/filmler/tum-filmleri/kullanici- puani/tur-13015/"+"?page=" + i).get(); Elements links = document.select("div.content a.no_underline"); for (Element link : links) { Attributes attributes = link.attributes(); String hrefVal = attributes.get("href"); //use substring or any other logic to get your value // Element url = link.after("filmler/film-"); System.out.println(hrefVal); }
has comment: http://stackoverflow.com/comment/38498603
has comment: http://stackoverflow.com/comment/38499013
score: 0

http://stackoverflow.com/comment/38548928
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24826922
has text: Not really, except that I don't *think* it is supported out of the box. Hence the reference to the special class in the BC lightweight (direct) API.

http://stackoverflow.com/comment/38533832
type: Comment
type: QuestionComment
score: 0
has text: length is variable as in? mutable?
comment on: http://stackoverflow.com/q/24821938

http://stackoverflow.com/comment/38543714
type: Comment
comment on: http://stackoverflow.com/a/24826919
score: 0
type: AnswerComment
has text: Too bad, that is only for fields. I would like to have this alignment in my constructor. But thanks anyway.

http://stackoverflow.com/comment/38500821
has text: inside my view pager also large content.. so what to do
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24803518
type: AnswerComment

http://stackoverflow.com/q/24888494
tagged with: c++
type: Question
has comment: http://stackoverflow.com/comment/38660527
answer count: 1
downvote count: 1
has body: I have a 100x100 array, but i need to clearly show the difference between the 4 sides(topleft,topright,bottomleft,bottomright) besides using color to show the difference, how am i suppose to show that it is different. The catch is that i have to use the letter 'A' for the array output. I also am allowed to use only 1 100x100 array. meaning i cannot use 4 25x25 array. This is in c++, but java codes or explanations are also welcomed. Something like this? Sample output: AAAAAAAAA AAAAAAAAA AAAAAAAAA AAAAAAAAA AAAAAAAAA AAAAAAAAA AAAAAAAAA AAAAAAAAA
tagged with: java
has answer: http://stackoverflow.com/a/24889247
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/38660765
has comment: http://stackoverflow.com/comment/38660317
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24889247
has title: Making a 2d 100x100 array splitted in to a 4 25x25 different output
has comment: http://stackoverflow.com/comment/38660148
favorite count: 0
score: -1

http://stackoverflow.com/q/24827753
answer count: 1
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/38545120
score: 0
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38545356
has answer: http://stackoverflow.com/a/24828239
tagged with: css
has title: CSS class disappears when the parent jsp loads
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24828239
tagged with: java
has body: I am having a jsp file which gets loaded after the index.jsp file. I have added a css class name for the body tag of index.jsp and also a css class name for it's child jsp's body tag. index.jsp (parent jsp):- &lt;body id="siteBody" class="tundra parentCssProps"&gt; ... ... preLoader.jsp (child jsp):- &lt;body class="loaderCssProps"&gt; ... ... My issue in here is, the css class name (loaderCssProps) of the child jsp gets replaced by the index.jsp (which is the parent) css class names (tundra parentCssProps). Child jsp's body tag looks like below, when inspecting by using firebug. Due to this none of the style I have added to loaderCssProps gets applied. preLoader.jsp (child jsp):- &lt;body id="siteBody" class="tundra parentCssProps"&gt; This looks like all the attributes of the parent jsp body tag is replacing the child jsp. Appreciate your support on this to overcome the issue. Thanks.
type: Question

http://stackoverflow.com/q/24765568
tagged with: raspberry-pi
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24767551
accepted answer: http://stackoverflow.com/a/24767551
tagged with: lwjgl
tagged with: raspbian
has body: I need to port something written in Java with LWJGL to a Raspberry. Im using Raspbian and tried oracles java version and some called "openjdk" or something like that. With both versions I get this Exception: java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.GLContext.nLoadOpenGLLibrary()V when creating the "Display". I already searched for some solution, but they refer to OpenGLES and I did never use OpenGLES nor I found any download to use it. I have no clue what to do and what information you might need, just comment if you need some more input. edit: Well you might want my current sourcecode too: import java.io.File; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.PixelFormat; public class Main { private int fps; private long lastFPS, lastTime; Main() { createWindow(); init2D(); loop(); } private void init2D() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 500, 400, 0, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); lastFPS = getTime(); getDelta(); } private long getTime() { return (Sys.getTime() * 1000) / Sys.getTimerResolution(); } public void updateFPS() { if (getTime() - lastFPS &gt; 1000) { Display.setTitle(Integer.toString(fps)); fps = 0; lastFPS += 1000; } fps++; } private int getDelta() { long time = getTime(); int delta = (int) (time - lastTime); lastTime = time; return delta; } private void loop() { float rot = 0; while(!Display.isCloseRequested()&amp;&amp;!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity(); int x = Display.getDisplayMode().getWidth()/2; int y = Display.getDisplayMode().getHeight()/2; GL11.glTranslated(x, y, 0); GL11.glRotated(rot, 0, 0, 1); if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)) { GL11.glColor3f(1, 0, 0)…
type: AnsweredQuestion
has title: Running LWJGL on a Raspberry Pi
tagged with: opengl
tagged with: java
type: Question

http://stackoverflow.com/q/24772268
has answer: http://stackoverflow.com/a/24772381
score: 2
upvote count: 2
tagged with: java
tagged with: swing
type: Question
tagged with: graphics
has body: i need to draw some lines in a JPanel in Java, I'm trying to draw them in another method outside the paintComponent() method to call it from another class but i faced a problem because drawing graphics need a Graphics object, i tried using this.getGraphics() but didn't work for me : public class Panel extends JPanel{ public void drawLine(int x1, int y1, int x2, int y2){ this.getGraphics().drawLine(x1, y1, x2, y2); } } any suggessions please ?
has title: how to draw graphics in JPanel out of paintComponent method?
answer count: 1
downvote count: 0
tagged with: paintcomponent
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/24831681
answers question: http://stackoverflow.com/q/24831603
upvote count: 4
has body: You could call setRolloverIcon with the result of getIcon.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38552734
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/24831603

pdf-parsing
type: Tag
tag name: pdf-parsing
tags question: http://stackoverflow.com/q/24859158

http://stackoverflow.com/q/24788862
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25069316
upvote count: 2
tagged with: openshift
type: Question
tagged with: java
tagged with: openshift-client-tools
has answer: http://stackoverflow.com/a/25069316
downvote count: 0
answer count: 1
favorite count: 0
has title: Openshift pre_start hook does not work on app restart
has body: I have set up an OpenShift testing app using tomcat6 (jbossews-1.0) cartridge, a pre_start action hook with name pre_start_jbossews-1.0 was pushed to the remote repository. The hook includes a JVM export statement that runs a javaagent like below: export _JAVA_OPTIONS="-javaagent:&lt;...javagent jar location...&gt;" This actually worked fine when the app was started using rhc app start &lt;app name&gt; I could see in the rhc tail which showed something like Picked up _JAVA_OPTIONS: -javaagent:... However, when I used app restart rhc app restart &lt;app name&gt; The jvm opts was no longer picked up and the javaagent did not seem to be running anymore Many thanks for your help in advance!

http://stackoverflow.com/a/24819380
type: Answer
has comment: http://stackoverflow.com/comment/38675487
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24774877
downvote count: 0
has body: Your client library(probably RabbitMQ provided client?) is using guest/guest as default username and password. Check com.rabbitmq.client.ConnectionFactory's source code, especially DEFAULT_USER and DEFAULT_PASSWORD. You might need to change it to use new id and password if you don't want to use guest/guest.

http://stackoverflow.com/comment/41328690
comment on: http://stackoverflow.com/a/24934278
type: AnswerComment
score: 0
type: Comment
has text: Adding -dontwarn java.util.zip.** and -dontnote java.util.zip.** worked for me

http://stackoverflow.com/q/24875476
type: Question
linked to: http://stackoverflow.com/q/6352208
score: 0
tagged with: maven
answer count: 1
has title: How to properly ignore "Plugin execution not covered by lifecycle configuration:" errors
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/24895055
has body: After upgrading to Eclipse Luna and installing the m2e plugin this morning, my project is now showing an error in the pom file for my project. The errors are: - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.6:testResources (execution: default-testResources, phase: process-test-resources) - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.6:resources (execution: default-resources, phase: process-resources) My original pom.xml looked like this: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example TestProject 0.0.1-SNAPSHOT org.testng testng 6.8.8 org.seleniumhq.selenium selenium-java 2.42.0 target target/classes ${project.artifactId}-${project.version} src/main/java src/main/scripts src/main/resources target/test-classes src/test/java src/test/resources I tried updating it via the docs here: http://wiki.eclipse.org/M2E_plugin_execution_not_covered And it now looks like this: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example TestProject 0.0.1-SNAPSHOT org.testng testng 6.8.8 org.seleniumhq.selenium selenium-java 2.42.0 target target/classes ${project.artifactId}-${project.version} src/main/java src/main/scripts src/main/resources target/test-classes src/test/java src/test/resources org.apache.maven.plugins maven-resources-plugin org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.apache.maven.plugins maven-resources-plugin [1.0.0,) resources testResources <ignore /> </lifecycleMappingMetadata> However, the error still shows up. So, there must be something wrong with this config, can someone point me to where I'm going wrong?

http://stackoverflow.com/comment/38643269
comment on: http://stackoverflow.com/a/24878581
type: Comment
has text: What do you mean not to override equals and hashCode? Where did you get that from the official documentation. It's exactly the opposite. You should override equals and hashCode because otherwise the default reference equality is being employed. There's no such thing as "Hibernate's own implementation" for equals/hashCode. It's just standard Java equality contract that's being used. The only thing I agree with is that equality and hashCode play an important role, especially when using Hash collections.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24907498
answer count: 1
has body: I'm writing a program that one can register on a web page in java and the details be stored in a mysql database. Can someone help me on how to write a code that encrypts the passwords using md5 and also how to parse a date string and store this date in the database.
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38695952
linked to: http://stackoverflow.com/q/415953
has title: Java jdbc on md5 and parsing date string to mysql
downvote count: 3
score: -3
tagged with: mysql
has comment: http://stackoverflow.com/comment/38696392
type: Question
has comment: http://stackoverflow.com/comment/38695940
has answer: http://stackoverflow.com/a/24907829
has comment: http://stackoverflow.com/comment/38696058
tagged with: java
upvote count: 0

http://stackoverflow.com/q/24906464
linked to: http://stackoverflow.com/q/3969713
accepted answer: http://stackoverflow.com/a/24906846
possible better answer: http://stackoverflow.com/a/24906811
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24906811
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24906746
type: Question
has answer: http://stackoverflow.com/a/24906521
has answer: http://stackoverflow.com/a/24906846
has body: I'd like to parse an XML file in Java line by line because the framework of a file that I got is a bit different than usual. It is not nested; each tag is in its own line. Part of XML file: 3 Zdravo z d r "a: v O 0 moje ... I searched and found a lot of different ways to parse an XML file but all of them scan the whole file and I don't want that because my file is almost 100k lines and for now (and maybe even later) I only need first 800 lines so it would be much faster to just parse line by line. I don't know how many lines I really need in advance but I'd like to count how many times I reach tag and stop at certain count (for now it's 17 - that's around line 800). Tutorials that I found: nested XML: http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/ nested XML: http://www.javacodegeeks.com/2013/05/parsing-xml-using-dom-sax-and-stax-parser-in-java.html single line XML with attributes: Read single XML line with Java Each sentence is then separated into word and each word into phonemes, so in the end I'd have 3 ArrayLists: flags, words and phonemes. I hope I gave you enough information. Thank you.
downvote count: 0
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/5231285
has title: Parsing XML in Java line by line
answer count: 5
has comment: http://stackoverflow.com/comment/38694222
has answer: http://stackoverflow.com/a/24906738

http://stackoverflow.com/a/24885291
answers question: http://stackoverflow.com/q/24884507
type: Answer
accepted answer of: http://stackoverflow.com/q/24884507
type: AcceptedAnswer
has body: There are a few common patterns for priority handling. Use thread priority If you only have two threads, and you spawn the threads yourself, then you can set their priority. Thread t = new Thread(yourRunnable); t.setPriority(Thread.MAX_PRIORITY); // or MIN_PRIORITY // or something in between Use a priority based ExecutorService You could refactor all your calls to the manager into Runnable or Callable instances. Then, using a PriorityQueue and a Comparator of your own, it's easy to dispatch your work units to a pool of threads. See : How do I implement task prioritization using an ExecutorService in Java 5? If you really need a strong priority, this is a solution I'd recommend because the conccurent package is the current standard, "go-to", solution for concurrency, and its scalable to as many thread and priorities as you need. Alternative options include: Use multiple ExecutorServices You could be to use two ExecutorService instances, one with 2 threads and another with 1, the idea would be to allow more threads to deal with your most important work, and less thread to the less important. This is more a workaround than a solution, but it's one that's easy and also (almost) guarantees your high priority task will not starve lower priority ones. Use Locking This is a more error prone way of solving the issue. But you could imagine locking access to your manager instance so that when an addQueue event arises, then calls to sendData get locked out untill the first event stops. But this is actually not a priority implementation, it's more of a "mutual exclusion" pattern. Use producer / consummer pattern You can have producer threads that create work units into one (or more) queues. Consumer threads then pop work out of this (these) queues and deal with it (call the manager). If your queue is a PriorityQueue or if you have a "high priority" and a "low priority" event queues, then your consummer has the choice of how it handles the priority based on your needs. In any cas…
score: 0

http://stackoverflow.com/q/24780659
has comment: http://stackoverflow.com/comment/38456380
upvote count: 1
has answer: http://stackoverflow.com/a/24780715
has title: how to get the client port of a URLConnection in java
favorite count: 0
type: UnansweredQuestion
has body: Is it possible to get the client side port number of a URLConnection in java, I didn't find any method to do that. edit: I am on client side. As java API said, it will try to use the same connection for any URL, just like set "keep-alive" to true. And I want to verify this by: 1: create a URL by using new URL(someurl) 2: create a second URL by using new URL(someurl), the same ulr 3: get the client port for both 1 and 2. If they are the same, then there should be the same connection, meaning java reuse the connect as setting keep-alive.
has comment: http://stackoverflow.com/comment/38455884
has answer: http://stackoverflow.com/a/24780912
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38467975
type: Question
has comment: http://stackoverflow.com/comment/38466393
tagged with: network-programming
tagged with: java
answer count: 2

http://stackoverflow.com/q/24803037
upvote count: 5
tagged with: tomcat
has comment: http://stackoverflow.com/comment/44184271
downvote count: 0
answer count: 1
has title: Tomcat 7: "setenv.sh" vs "/etc/default/tomcat7" to update JAVA_OPTS
favorite count: 0
type: UnansweredQuestion
tagged with: jmx
tagged with: tomcat7
has body: I wish to update the JAVA_OPTS used by Tomcat 7 to enable JMX monitoring. When I look at the internet I see 2 primary ways to do it: Using "setenv.sh" [The popular way] Update "/etc/default/tomcat7" Now which is the recommended way to do this? What are the advantages and disadvantages of each?
tagged with: java
has answer: http://stackoverflow.com/a/29772251
type: Question
score: 5
tagged with: configuration

http://stackoverflow.com/comment/44585109
score: 0
comment on: http://stackoverflow.com/q/24761990
type: Comment
type: QuestionComment
has text: I'm voting to close this question as off-topic because the code posted is the solution itself, so the question does not help users of this site.

http://stackoverflow.com/a/24823389
has comment: http://stackoverflow.com/comment/38536858
answers question: http://stackoverflow.com/q/24822964
type: Answer
has comment: http://stackoverflow.com/comment/38536735
has comment: http://stackoverflow.com/comment/38536534
has comment: http://stackoverflow.com/comment/38536916
has comment: http://stackoverflow.com/comment/38536767
score: 0
has body: here you go: String value = e.select(".image .lrg").html();

http://stackoverflow.com/a/32872406
has comment: http://stackoverflow.com/comment/57500819
has comment: http://stackoverflow.com/comment/67954211
has comment: http://stackoverflow.com/comment/67289465
has comment: http://stackoverflow.com/comment/105113530
has comment: http://stackoverflow.com/comment/67982682
type: Answer
upvote count: 55
score: 54
has body: Using emoji-java i've wrote a simple method that removes all emojis including fitzpatrick modifiers. Requires an external library but easier to maintain than those monster regexes. Use: String input = "A string with a 👦🏿few emojis!"; String result = EmojiParser.removeAllEmojis(input); emoji-java maven installation: com.vdurmont emoji-java 3.1.3 gradle: implementation 'com.vdurmont:emoji-java:3.1.3' EDIT: previously submitted answer was pulled into emoji-java source code.
answers question: http://stackoverflow.com/q/24840667
has comment: http://stackoverflow.com/comment/62653247
downvote count: 1

http://stackoverflow.com/q/24885223
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135230190
has answer: http://stackoverflow.com/a/27653597
has answer: http://stackoverflow.com/a/51867820
has answer: http://stackoverflow.com/a/32985328
has answer: http://stackoverflow.com/a/63849420
has answer: http://stackoverflow.com/a/29142005
has comment: http://stackoverflow.com/comment/65287670
favorite count: 0
upvote count: 1052
has comment: http://stackoverflow.com/comment/92504921
has answer: http://stackoverflow.com/a/79226195
has answer: http://stackoverflow.com/a/46619095
has title: Why doesn't RecyclerView have onItemClickListener()?
has body: I was exploring RecyclerView and I was surprised to see that RecyclerView does not have onItemClickListener(). I've two question. Main Question I want to know why Google removed onItemClickListener()? Is there a performance issue or something else? Secondary Question I solved my problem by writing onClick in my RecyclerView.Adapter: public static class ViewHolder extends RecyclerView.ViewHolder implements OnClickListener { public TextView txtViewTitle; public ImageView imgViewIcon; public ViewHolder(View itemLayoutView) { super(itemLayoutView); txtViewTitle = (TextView) itemLayoutView.findViewById(R.id.item_title); imgViewIcon = (ImageView) itemLayoutView.findViewById(R.id.item_icon); } @Override public void onClick(View v) { } } Is this ok / is there any better way?
score: 1049
type: Question
has answer: http://stackoverflow.com/a/35730528
tagged with: android
linked to: http://stackoverflow.com/q/26245139
has comment: http://stackoverflow.com/comment/104781476
has answer: http://stackoverflow.com/a/31959511
has answer: http://stackoverflow.com/a/30976972
has answer: http://stackoverflow.com/a/33971661
has answer: http://stackoverflow.com/a/34476682
has answer: http://stackoverflow.com/a/35178782
has answer: http://stackoverflow.com/a/42001588
has comment: http://stackoverflow.com/comment/44653140
accepted answer: http://stackoverflow.com/a/24933117
tagged with: android-recyclerview
linked to: http://stackoverflow.com/q/24471109
has answer: http://stackoverflow.com/a/47320904
has answer: http://stackoverflow.com/a/42041128
has answer: http://stackoverflow.com/a/33999017
has answer: http://stackoverflow.com/a/45262503
has answer: http://stackoverflow.com/a/30685908
linked to: http://stackoverflow.com/q/31685842
answer count: 31
tagged with: java
has comment: http://stackoverflow.com/comment/115064603
has comment: http://stackoverflow.com/comment/70372762
downvote count: 3
has answer: http://stackoverflow.com/a/29841832
has comment: http://stackoverflow.com/comment/79704563
possible better answer: http://stackoverflow.com/a/35917564
has answer: http://stackoverflow.com/a/46072681
linked to: http://stackoverflow.com/q/28525112
has comment: http://stackoverflow.com/comment/87092721
has answer: http://stackoverflow.com/a/35917564
has answer: http://stackoverflow.com/a/38790050
has comment: http://stackoverflow.com/comment/104782298
has answer: http://stackoverflow.com/a/29408566
has answer: http://stackoverflow.com/a/38628786
linked to: http://stackoverflow.com/q/26517855
linked to: http://stackoverflow.com/q/4709870
has answer: http://stackoverflow.com/a/31589524
has answer: http://stackoverflow.com/a/35891102
has answer: http://stackoverflow.com/a/45169942
has answer: http://stackoverflow.com/a/44037121
has answer: http://stackoverflow.com/a/24933117
has answer: http://stackoverflow.com/a/39034715

http://stackoverflow.com/q/24896522
tagged with: java
has answer: http://stackoverflow.com/a/25651077
linked to: http://stackoverflow.com/q/25224864
type: Question
tagged with: amazon-s3
tagged with: amazon-web-services
score: 12
has title: Deploying Maven dependencies to S3: No connector available
has answer: http://stackoverflow.com/a/52086603
favorite count: 0
possible better answer: http://stackoverflow.com/a/25560868
has answer: http://stackoverflow.com/a/25560868
has body: I'm trying to use Amazon S3 to host my Maven artifacts. I've added the following to my pom.xml: <distributionManagement> maven.xxx.com-release AWS S3 Release Repository s3://maven.xxx.com/release maven.xxx.com-snapshot AWS S3 Snapshot Repository s3://maven.xxx.com/snapshot </distributionManagement> org.springframework.build aws-maven 5.0.0.RELEASE This is working fine and my snapshot is stored on S3. Now I'm trying to reference the artifact in another project: maven.xxx.com-release AWS S3 Release Repository s3://maven.xxx.com/release maven.xxx.com-snapshot AWS S3 Snapshot Repository s3://maven.xxx.com/snapshot true org.springframework.build aws-maven 5.0.0.RELEASE When I run $ mvn deploy -X, I get the following error: Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T15:51:42+02:00) Maven home: /usr/local/Cellar/maven/3.2.2/libexec Java version: 1.8.0_11, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.4", arch: "x86_64", family: "mac" [INFO] Error stacktraces are turned on. [DEBUG] Reading global settings from /usr/local/Cellar/maven/3.2.2/libexec/conf/settings.xml [DEBUG] Reading user settings from /Users/philipp/.m2/settings.xml [DEBUG] Using local repository at /Users/philipp/.m2/repository [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/philipp/.m2/repository [INFO] Scanning for projects... [DEBUG] Skipped remote update check for com.xxx:parent-pom:1.4.11-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date. [DEBUG] Skipped remote update check for com.xxx:parent-pom:1.4.11-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date. [DEBUG] Skipped remote update check for com.xxx:parent-pom:1.4.11-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date. [DEBUG] java.util.NoSuchElementException role: org.apache.maven.wagon.Wagon roleH…
accepted answer: http://stackoverflow.com/a/25651077
tagged with: maven
answer count: 4
has answer: http://stackoverflow.com/a/44372775
upvote count: 12
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/38498583
type: Comment
has text: Resolved. Yesterday I had copy a corrupted version of my colleagues server, now I try again and it's run! Thank you very much!!!
comment on: http://stackoverflow.com/q/24754435
score: 0
type: QuestionComment

http://stackoverflow.com/q/24792692
has title: oracle sql developer connection error
tagged with: oracle-database
tagged with: jdbc
has answer: http://stackoverflow.com/a/25663803
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/38509895
upvote count: 2
type: UnansweredQuestion
tagged with: java
has body: I can't get the connection to work for Oracle WebLogic 12c using SQL Developer. Here is the error that I get when I click connect: An error was encountered performing the requested operation: /usr/lib/java/libocijdbc11.dylib: dlopen(/usr/lib/java/libocijdbc11.dylib, 1): Library not loaded: /ade/b/2475221476/oracle/rdbms/lib/libclntsh.dylib.11.1 Referenced from: /usr/lib/java/libocijdbc11.dylib Reason: image not found Vendor code 0 When I click Test in the Settings of SQL Developer I get the following log: Testing the Instant Client located at /usr/lib/java Testing client directory ... OK Testing loading Oracle JDBC driver ... OK Testing checking Oracle JDBC driver version ... OK Driver version: 11.2.0.3.0 Testing testing native OCI library load ... Failed: Error loading the native OCI library The native OCI driver could not be loaded. The system propertyjava.library.path contains the entries from the environment variable DYLD_LIBRARY_PATH. Check it to verify that the expected native library directory /usr/lib/java is present and precedes any other client installations. java.library.path = /Users/gasim/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. Here is an outline of my setup: Operating system: OSX Mavericks (10.9.4 to be specific) The Java SE Runtime version: "1.8.0" (build "1.8.0_11-b12") Oracle Instant is located under /usr/lib/java. The directory is set in the SQL Developer (through Database > Advanced) The Oracle server is up and running with default parameters (localhost:7001) and I can access the web admin console. Oracle Instant Client version: 11.2.0.4.0 java.library.path = /Users/gasim/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. The directory listing of /usr/lib/java: BASIC_README adrci genezi libclntsh.dylib.11.1 libnnz11.dylib libocci.dylib.11.1 libociei.dylib libocijdbc11.dylib ojdbc5.…
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40102150

http://stackoverflow.com/q/24863443
has body: I'd like to rewrite the following xml definition to annotation-based java classes: CXFServlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /services/* The following does not work: @Service @RequestMapping(value = "services/*") public class CXFStartServlet extends CXFServlet { } Result: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NullPointerException at org.apache.cxf.transport.servlet.CXFNonSpringServlet.destroy(CXFNonSpringServlet.java:184) at org.apache.cxf.transport.servlet.CXFServlet.onApplicationEvent(CXFServlet.java:166) at org.apache.cxf.transport.servlet.CXFServlet.onApplicationEvent(CXFServlet.java:41) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:776) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4961) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5455) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.…
tagged with: spring
has answer: http://stackoverflow.com/a/24863717
type: AnsweredQuestion
tagged with: java
tagged with: servlets
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24863717
has answer: http://stackoverflow.com/a/24863765
possible better answer: http://stackoverflow.com/a/24863765
has title: How to write annotation-based servlet mapping in Spring?

http://stackoverflow.com/a/24763075
answers question: http://stackoverflow.com/q/24762888
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38423259
score: 1
has comment: http://stackoverflow.com/comment/38423349
has body: You should be able to add the parameter consumers to the abstract class: abstract class Step { public abstract Step getNextStep(); public void addParameter(Parameter p) { } public void addParameter(Argument a) { } public void addParameter(Something s) { } } class Evaluated extends Step { Parameter p; @Override public Step getNextStep() { } @Override public void addParameter(Parameter p) { this.p = p; } }
downvote count: 0

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/24818483
type: Tag

http://stackoverflow.com/comment/38528043
type: AnswerComment
has text: thank you for taking time to answer. I have edited my questions above
type: Comment
comment on: http://stackoverflow.com/a/24809928
score: 0

http://stackoverflow.com/q/24823569
tagged with: java
score: 0
answer count: 1
has title: command line does not recognise mvn(maven)
favorite count: 0
has comment: http://stackoverflow.com/comment/38537283
has comment: http://stackoverflow.com/comment/38536896
has comment: http://stackoverflow.com/comment/38537363
has answer: http://stackoverflow.com/a/24823797
has body: Here is my set up on variables path. C:\Program Files\J2EE\apache-maven-3.2.2 %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\ WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core- Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Java\jdk1.6.0_45\bin;%MAVEN_HOME%\bin Am I missing something?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38537118
has comment: http://stackoverflow.com/comment/38537165
tagged with: maven
upvote count: 1
downvote count: 1
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/24823797

http://stackoverflow.com/a/24837966
type: Answer
score: 0
has body: You need to use a loop to cycle get array to print its element. If you print directly the array of string, you get the objec codename
answers question: http://stackoverflow.com/q/24837939

http://stackoverflow.com/q/24815494
type: Question
accepted answer: http://stackoverflow.com/a/24815609
answer count: 1
linked to: http://stackoverflow.com/q/14928213
has body: The following is a simple code for converting an image to byte array (Which is already shown in this forum): File imgPath= new File(textFiled_Path.getText()); BufferedImage originalImage = ImageIO.read(imgPath); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(originalImage, "png", baos); baos.flush(); byte[] imageInByte = baos.toByteArray(); However, when the image size is big, the program takes too much time to convert. Therefore, I'm thinking of adding a JProgressBar to the GUI that I made to let the user know how much time left. All examples that I've seen are mostly dealing with JProgressBar with loops. I don't know how to start here :( Can I have an idea to start with. In other word, where should I put JProgressBar here. Thank you in advance.
score: 0
tagged with: jprogressbar
has answer: http://stackoverflow.com/a/24815609
tagged with: swing
type: AnsweredQuestion
tagged with: java
has title: Using JProgressBar while converting image to byte array

http://stackoverflow.com/q/24791311
has comment: http://stackoverflow.com/comment/38478487
has comment: http://stackoverflow.com/comment/38478160
has comment: http://stackoverflow.com/comment/38476976
tagged with: performance
has comment: http://stackoverflow.com/comment/38477430
tagged with: java
tagged with: methods
type: Question
has title: Chaining method calls java performance
has body: Okay so I want to know the performance cost of chaining method calls repeatedly. For example if you are creating a game and you need to keep checking for collision detection, you would be calling methods the way I am thinking off. Basically is it worth it to have methods like getters that you are going to repeatedly be calling? For example in a large program having getters for private variables of every class and having to call them plus other methods... Would this reduce performance significantly? Thanks!
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24791417
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38458997
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24780458
has text: Only if you're using persistent sessions. I doubt that's on by default in tomcat.

http://stackoverflow.com/comment/38536947
type: Comment
comment on: http://stackoverflow.com/a/24822706
has text: @Llangostu coming to your point of having to read "just when the hardware sends the bytes", you need to listen "all the time" and you need to use the "same" Socket instance. Only doing all the above will make sure you read the data as and when the hardware sends you the bytes.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38612177
type: Comment
type: QuestionComment
has text: `cvc-complex-type.2.4.a: Invalid content was found starting with element` Usually this means the elements are not in the correct order. Try moving the element up in the JNLP one spot at a time till the error disappears or changes to another element.
comment on: http://stackoverflow.com/q/24828641
score: 0

http://stackoverflow.com/q/24861645
answer count: 2
tagged with: docx4j
has answer: http://stackoverflow.com/a/35054938
score: 4
has title: How to create or update table of contents in a word file?
has body: I can read or write word document in Java using Apache POI or docx4j. But I cant find any references to create or update table of contents in a Word file. Is there any other API can support TOC in Java? Or, is it possible in Apache POI or docx4j to have options to create or update TOC?
downvote count: 1
favorite count: 0
upvote count: 5
tagged with: apache-poi
possible better answer: http://stackoverflow.com/a/35054938
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36772246
accepted answer: http://stackoverflow.com/a/36772246
tagged with: java
type: Question

http://stackoverflow.com/a/24909206
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/24909106
downvote count: 1
has body: Create index for the columns C_DateCreated and C_DataSourceId. This will reduce the time to execute the query. Refer this link to know how to create indices. http://www.tutorialspoint.com/mysql/mysql-indexes.htm
type: Answer
has comment: http://stackoverflow.com/comment/38699349

http://stackoverflow.com/a/24876417
has comment: http://stackoverflow.com/comment/38638075
has comment: http://stackoverflow.com/comment/38637934
has comment: http://stackoverflow.com/comment/38638008
downvote count: 0
has comment: http://stackoverflow.com/comment/38637972
score: 1
has comment: http://stackoverflow.com/comment/38637750
has comment: http://stackoverflow.com/comment/38637678
has body: Maybe you want this: int i = Integer.valueOf(binary, 2); // ie base 2 This call expects the input to be a string of 0 and 1 chars. Then if you want an array of bytes: byte[] bytes = new ByteBuffer().putInt(i).compact().array();
has comment: http://stackoverflow.com/comment/38637777
has comment: http://stackoverflow.com/comment/38638168
has comment: http://stackoverflow.com/comment/38637809
has comment: http://stackoverflow.com/comment/38638017
upvote count: 1
has comment: http://stackoverflow.com/comment/38638144
has comment: http://stackoverflow.com/comment/38638634
has comment: http://stackoverflow.com/comment/38638632
type: Answer
answers question: http://stackoverflow.com/q/24876323

http://stackoverflow.com/a/24823918
has comment: http://stackoverflow.com/comment/38540114
has body: You have hit quite a subtlety with your question number 2. In your very specific case, you: first write msg from the main thread; then write the volatile pause from the main thread; then read the volatile pause from the child thread; then read msg from the child thread. Therefore you have transitively established a happens-before relationship between the write and the read of msg. Therefore msg itself does not have to be volatile. In real-life code, however, you should avoid depending on such subtle behavior: better overapply volatile and sleep calmly. Here are some relevant quotes from the Java Language Specification: If x and y are actions of the same thread and x comes before y in program order, then hb(x, y). If an action x synchronizes-with a following action y, then we also have hb(x, y). Note that, in my list of actions, 1 comes before 2 in program order; same for 3 and 4; 2 synchronizes-with 3. As for your other questions, ad 1: t doesn't have to be volatile because it's written to prior to thread creation and never mutated later. Starting a thread induces a happens-before on its own; ad 3: setPause does not have to be synchronized because all it does is set the volatile var.
has comment: http://stackoverflow.com/comment/38542689
has comment: http://stackoverflow.com/comment/38539252
has comment: http://stackoverflow.com/comment/38538134
has comment: http://stackoverflow.com/comment/38538968
downvote count: 1
has comment: http://stackoverflow.com/comment/38539675
has comment: http://stackoverflow.com/comment/38539064
has comment: http://stackoverflow.com/comment/38540965
has comment: http://stackoverflow.com/comment/38541587
has comment: http://stackoverflow.com/comment/38539168
has comment: http://stackoverflow.com/comment/38540372
has comment: http://stackoverflow.com/comment/38539796
answers question: http://stackoverflow.com/q/24823590
has comment: http://stackoverflow.com/comment/38542975
has comment: http://stackoverflow.com/comment/38540680
has comment: http://stackoverflow.com/comment/38539142
upvote count: 5
has comment: http://stackoverflow.com/comment/38539565
has comment: http://stackoverflow.com/comment/38540285
has comment: http://stackoverflow.com/comment/38540011
has comment: http://stackoverflow.com/comment/38538249
has comment: http://stackoverflow.com/comment/38539207
has comment: http://stackoverflow.com/comment/38540201
has comment: http://stackoverflow.com/comment/38538181
has comment: http://stackoverflow.com/comment/38538770
has comment: http://stackoverflow.com/comment/38541800
has comment: http://stackoverflow.com/comment/38538084
has comment: http://stackoverflow.com/comment/38538473
score: 4
has comment: http://stackoverflow.com/comment/38539603
has comment: http://stackoverflow.com/comment/38538528
has comment: http://stackoverflow.com/comment/38539052
has comment: http://stackoverflow.com/comment/38539854
has comment: http://stackoverflow.com/comment/38541686
has comment: http://stackoverflow.com/comment/38538911
has comment: http://stackoverflow.com/comment/38539821
has comment: http://stackoverflow.com/comment/38539789
type: Answer
has comment: http://stackoverflow.com/comment/38540537
has comment: http://stackoverflow.com/comment/38538496
has comment: http://stackoverflow.com/comment/38538681
has comment: http://stackoverflow.com/comment/38541138
has comment: http://stackoverflow.com/comment/38538286
has comment: http://stackoverflow.com/comment/38538607

http://stackoverflow.com/comment/38710751
has text: could you please take a look at the issue here http://stackoverflow.com/questions/24915142/classnotfoundexception-when-running-ant-junit
type: Comment
comment on: http://stackoverflow.com/a/24832559
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38638008
comment on: http://stackoverflow.com/a/24876417
type: AnswerComment
score: 0
type: Comment
has text: @LinkTheProgrammer Why is `1111` a value of 256?

http://stackoverflow.com/q/24807265
has answer: http://stackoverflow.com/a/24807582
tagged with: motionevent
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24807582
type: Question
tagged with: android
upvote count: 3
has body: I am trying to display a different message depending on where an image is dragged. So far, I have been able to drag and drop an image with motion event. And I have created 3 textviews that are invisible when the app starts (Too High, Perfect, and Too Low). After the user moves the image, I want to display a different message depending on if it falls within certain y coordinates. So how do I figure out if the image is within the desired y coordinates and then set the text to be visible if it is within those coordinates? Here is my code so far: Main Activity: package com.example.touchanddragimage; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends ActionBarActivity implements OnTouchListener { ImageView arrow; TextView hightext; TextView lowtext; TextView perfecttext; TextView guide; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); arrow = (ImageView)findViewById(R.id.arrow); arrow.setOnTouchListener(this); hightext = (TextView) findViewById(R.id.high) ; lowtext = (TextView) findViewById(R.id.low); perfecttext = (TextView) findViewById(R.id.perfect); guide = (TextView) findViewById(R.id.textView2); hightext.setVisibility(View.INVISIBLE); lowtext.setVisibility(View.INVISIBLE); perfecttext.setVisibility(View.INVISIBLE); } float x,y=0.0f; boolean moving = false; @Override public boolean onTouch(View arg0, MotionEvent arg1) { // TODO Auto-generated method stub switch(arg1.getAction()){ case MotionEvent.ACTION_DOWN: moving=true; break; case MotionEvent.ACTION_MOVE: if(moving){ x=arg1.getRawX()-arrow.getWidth()/2; y=arg1.getRawY()-arrow.getHeight()*3/2; arrow.setX(x); arrow.setY(y); } break; case MotionEvent.AC…
answer count: 1
has title: How to display a message based on where an image is dropped on screen

http://stackoverflow.com/q/24882608
has body: I am using gwt highcharts and I want to get client timezone calling jsni method from jstimezoneDetect in my client java code: I bind it to my html: &lt;script type="text/javascript" src="js/jstz-1.0.4.min.js"&gt;&lt;/script&gt; and call this on client: static native String getClientTZ() /*-{ var tz = jstz.determine(); return tz.name(); }-*/; then I am calling it on page loading: private String clientTimeZone; pulic UI{ clientTimeZone=getClientTZ(); .... but I'm gettin these error: com.google.gwt.core.client.JavaScriptException: (ReferenceError) @UI::getClientTZ()([]): 'jstz' is undefined Please any suggestions, what i am doing wrong?
possible better answer: http://stackoverflow.com/a/57458809
has answer: http://stackoverflow.com/a/57458809
type: AnsweredQuestion
score: 1
has title: Exception jstz library using
tagged with: java
upvote count: 1
type: Question
tagged with: gwt
accepted answer: http://stackoverflow.com/a/24882773
tagged with: javascript
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24882773

http://stackoverflow.com/a/24900178
answers question: http://stackoverflow.com/q/24899854
has body: This is because you call createInputP() as it's a procedure , but it's not ! it's a function it will return something that is in this case inputP panel ! so what's actually happening is overridable method call in constructor ! so the solution is add final keyword before createInputP() method !! // final keyword after public keyword! public final JPanel createInputP(){ ..... } And modify goBListener like below : public class goBListener implements ActionListener { public void actionPerformed(ActionEvent e) { numMons = Integer.parseInt(numMonsFi.getText()); panel.revalidate(); panel.add(createStatusP()); } } Dang !! That's it !!
score: 0
type: Answer

http://stackoverflow.com/a/24800853
type: Answer
answers question: http://stackoverflow.com/q/24800639
downvote count: 1
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/38494293
has body: Try: int number = 54353, divisor = 256; byte[] byteArray = new byte[4]; byteArray[3] = number%divisor; number = number/divisor byteArray[2] = number%divisor; number = number/divisor byteArray[1] = number%divisor; number = number/divisor byteArray[0] = number;

http://stackoverflow.com/q/24762657
tagged with: java
has answer: http://stackoverflow.com/a/67668011
has answer: http://stackoverflow.com/a/39752723
accepted answer: http://stackoverflow.com/a/24768611
has answer: http://stackoverflow.com/a/34672904
type: Question
has answer: http://stackoverflow.com/a/50717700
possible better answer: http://stackoverflow.com/a/39334398
has answer: http://stackoverflow.com/a/24764196
has answer: http://stackoverflow.com/a/39334398
linked to: http://stackoverflow.com/q/18492457
has title: Refreshing static content with Spring MVC and Boot
has answer: http://stackoverflow.com/a/43089726
has answer: http://stackoverflow.com/a/51411523
has answer: http://stackoverflow.com/a/60269373
has answer: http://stackoverflow.com/a/47914903
has answer: http://stackoverflow.com/a/27830852
upvote count: 57
has comment: http://stackoverflow.com/comment/38422696
downvote count: 0
has answer: http://stackoverflow.com/a/76997426
answer count: 17
has answer: http://stackoverflow.com/a/40203800
favorite count: 0
has answer: http://stackoverflow.com/a/34651557
has answer: http://stackoverflow.com/a/24768611
score: 57
has answer: http://stackoverflow.com/a/45997670
has body: I'm evaluating Spring MVC &amp; Boot and AngularJs for building web applications. I've run into the problem that when I make modifications to my static content (html, js, css), I have to restart the application every time. I hope there is a some way of solving that because restarting the whole application for static content changes is not efficient. Every other web app framework I've tried allows updating static content files on the fly(even just Spring MVC and plain old WAR application). I've setup my project from "Building a RESTful Web Service with Spring Boot Actuator" guide (http://spring.io/guides/gs/actuator-service/). Basically it uses Spring Boot and MVC controllers to create a REST service. In addition, I've used "Consuming a RESTful Web Service with AngularJS" guide (http://spring.io/guides/gs/consuming-rest-angularjs/) to build a frontend with AngularJS. It creates a web page that displays the response from the REST service. The only change I've made is that the requests are made to my application instead of "http://rest-service.guides.spring.io/greeting". My static content is stored in "src/main/resources/public" folder. This setup works correctly except it doesn't reload static content.
has answer: http://stackoverflow.com/a/37641815
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-boot

http://stackoverflow.com/comment/38445815
has text: The "label" is part of the content stream. The "key" is the name of the field. You are confusing the "label" with the "key". When using the `setField()` method you need to use the key. Is "Patient Name" the key or the label? If you don't know the answer to this question, you need to share your PDF.
comment on: http://stackoverflow.com/q/24758500
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38597918
type: Comment
type: QuestionComment
has text: @Takendarkk Will do! Ah, dumb mistake on my part. Anyways thank you very much for the help!
comment on: http://stackoverflow.com/q/24855448
score: 0

http://stackoverflow.com/q/24900525
upvote count: 1
has body: Hello i am trying to create a game of Video Poker. This is part of what I have so far (I did not include enums, imports, variables, toStrings, etc. in order to save space): My Card class defines our cards: public Card(Value value, Suit suit) { this.value = value; this.suit = suit; } My Deck class creates a 52 card deck and returns a 5 card hand in the draw() method: private ArrayList&lt;Card&gt; deck = new ArrayList&lt;Card&gt;(); private ArrayList&lt;Card&gt; hand = new ArrayList&lt;Card&gt;(); private final int HANDSIZE = 5; public Deck() { for(Suit suit : Suit.values()) { for(Value value : Value.values()){ Card card = new Card(value, suit); deck.add(card); } } } public ArrayList&lt;Card&gt; draw() { Random rng = new Random(); for(int i = 0; i &lt; HANDSIZE; i++){ int getCard = rng.nextInt(deck.size()); Card addCard = deck.get(getCard); hand.add(addCard); deck.remove(getCard); } return hand; } My Player class lets gives information on our players. public class Player extends Deck { private String name; private int chips; public Player(String name, int chips) { this.name = name; this.chips = chips; } The problem is that every player uses their own deck, therefore sometimes two or more different players may have the same card. My question is how do I set up my program to have each player use the same deck? Thanks. Example of an output: Name: John Doe, Cash: 500 [Jack of Hearts, Ten of Hearts, Two of Diamonds, Ace of Clubs, Nine of Diamonds] Name: Jane Doe, Cash: 500 [King of Spades, Two of Diamonds, Jack of Hearts, Ace of Spades, Seven of Diamonds]
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38683105
tagged with: poker
tagged with: duplicates
tagged with: class
accepted answer: http://stackoverflow.com/a/24900615
score: 0
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/38683145
has title: Each Player in my Java Poker Game uses their own deck
possible better answer: http://stackoverflow.com/a/24900613
has answer: http://stackoverflow.com/a/24900613
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24900615
has answer: http://stackoverflow.com/a/31714234
tagged with: java

http://stackoverflow.com/comment/38617420
type: Comment
type: QuestionComment
has text: Show us `Address`. What JAXB annotations do you use on it?
comment on: http://stackoverflow.com/q/24865758
score: 0

http://stackoverflow.com/a/24791369
score: 0
answers question: http://stackoverflow.com/q/24791072
type: Answer
has body: I think it would be better to use a static method to update the static list : public class Image { public static ArrayList&lt;Image&gt; list = new ArrayList&lt;&gt;(); public static void addLib(Image image) { Image.list.add(image); } public static void main(String[] args) { Image.addLib (new Image()); Image.addLib (new Image()); } } I find it clearer to use static methods to manipulate static members.

http://stackoverflow.com/a/24799670
has body: All interactions with swing components have to be done on the Event Dispatch Thread. Accessing swing compoments from other threads is not supported and will have all kind of nasty side effects. If you want to execute something in an other thread have a looke at the SwingWorker class. From the javadoc: An abstract class to perform lengthy GUI-interacting tasks in a dedicated thread. When writing a multi-threaded application using Swing, there are two constraints to keep in mind: (refer to How to Use Threads for more details): Time-consuming tasks should not be run on the Event Dispatch Thread. Otherwise the application becomes unresponsive. Swing components should be accessed on the Event Dispatch Thread only.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24799497
type: Answer
answers question: http://stackoverflow.com/q/24799497
downvote count: 0
score: 1

http://stackoverflow.com/comment/64793884
has text: Our testing confirms that 24.0.0 fixes the issue. We upgraded the support library to 24.0.0 (not alpha), removed the obfuscation we were using as a workaround, and saw no crashes on a Samsung test device where we've previously seen the crash.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/38301963

http://stackoverflow.com/q/24755730
has comment: http://stackoverflow.com/comment/38409034
type: Question
has body: I am writing a Java applet, and I am trying to read a 220K line (9.2 MB) text file that I am archiving with the .jar. I believe the only reasonable access I have to the text file is InputStream. In order to read my text file with InputStream, I rolled my own line-by-line reader, shown below. Using InputStream with my own line-by-line reader, however, causes a java.lang.OutOfMemoryError: Java heap space. Any suggestions about how I can read my text file, which I am trying to bundle with my .jar applet? Here is my attempt to read the InputStream line-by-line: public class InputStreamUtil { private static final int _CR = 13; private static final int _LF = 10; private int _last = -1; // The last char we've read private int _ch = -1; // currently read char private InputStream in; public InputStreamUtil(InputStream i) { in = i; } /** * Read a line of data from the underlying inputstream * * @return a line stripped of line terminators */ public String readLine() throws IOException { StringBuffer sb = new StringBuffer(""); if (_last != -1) sb.append((char) _last); _ch = in.read(); while (_ch != _CR &amp;&amp; _ch != _LF) { sb.append((char) _ch); _ch = in.read(); } // Read the next byte and check if it's a LF _last = in.read(); if (_last == _LF) { _last = -1; } return (new String(sb)); } } And here is the full error from the applet console: ed reader. Read file input lines... Exception caught: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3326) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:622) at java.lang.StringBuffer.append(StringBuffer.java:383) at utilities.InputStreamUtil.readLine(InputStreamUtil.java:28) at utilities.CensusResultsCalculator.parseCensusData(CensusResultsCalculator.java:216) at util…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24755888
tagged with: java
accepted answer: http://stackoverflow.com/a/24755888
tagged with: inputstream
answer count: 1
has title: How to "efficiently" read a text file line-by-line using InputStream?
tagged with: applet
score: 0

http://stackoverflow.com/comment/38413584
type: QuestionComment
score: 1
has text: This post may help you http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception
comment on: http://stackoverflow.com/q/24758195
type: Comment

http://stackoverflow.com/comment/38549722
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24830075
score: 0
has text: @RoboticMoneylender Just check for each possible 3 position win-combination if one of the players has 2 of them and the other is free. Then the AI should either win the game or block the player respectively.

http://stackoverflow.com/a/24843596
has comment: http://stackoverflow.com/comment/38575377
has comment: http://stackoverflow.com/comment/38575219
has comment: http://stackoverflow.com/comment/38574665
has comment: http://stackoverflow.com/comment/38574976
score: 0
has comment: http://stackoverflow.com/comment/38575198
has comment: http://stackoverflow.com/comment/38575645
has comment: http://stackoverflow.com/comment/38574624
type: Answer
has body: As per the mapping and configuration you should have the jsp files inside the WEB-INF/jsp folder. setSuccessView("helloView"); In above code helloView is converted to WEB-INF/jsp/helloView.jsp as per prefix and suffix rule that is defined in dispatcher-servelt.xml at viewResolver. <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /> Make sure you have helloView.jsp under WEB-INF/jsp folder. Same thing applies for hello as well. As per configuration you have defined controller for index.htm. Apply same thing for hello.htm if you don't want spring InternalResourceViewResolver to come in picture. indexController
has comment: http://stackoverflow.com/comment/38584185
has comment: http://stackoverflow.com/comment/38575013
answers question: http://stackoverflow.com/q/24843520

http://stackoverflow.com/q/24778220
tagged with: concurrency
possible better answer: http://stackoverflow.com/a/25436755
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25436755
has body: Are the following two AssertionErrors placed right? final Task&lt;String&gt; myTask = new Task&lt;String&gt;() { @Override protected String call() throws Exception { return "Lorem Ipsum"; } @Override protected void succeeded() { super.succeeded(); try { final String computedString = get(); } catch (final InterruptedException | ExecutionException ex) { throw new AssertionError( "Expected get() can called safely in succeeded"); } } }; myTask.setOnSucceeded(e -&gt; { try { final String computedString = myTask.get(); } catch (final Exception ex) { throw new AssertionError( "Expected get() can called safely in onSucceeded"); } });
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24779739
has title: Is calling Task#get safe in Task#onSucceeded?
score: 0
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24779739
linked to: http://stackoverflow.com/q/3976344

http://stackoverflow.com/a/24810865
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24810802
has comment: http://stackoverflow.com/comment/38513506
answers question: http://stackoverflow.com/q/24810802
type: Answer
has comment: http://stackoverflow.com/comment/38514717
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38513292
has comment: http://stackoverflow.com/comment/38513226
has body: How could thread 1 give up the monitor after checking that helper is null? It won't release the lock until it has initialized helper. This didn't work years ago on the JVM, but they changed the memory model and it fixed this. The current "best" way is not DCL, but to implement singletons as enums.
has comment: http://stackoverflow.com/comment/38513621

http://stackoverflow.com/comment/38710699
has text: That would have to be @NotEmpty.List({ ... }) wouldn't it?
comment on: http://stackoverflow.com/a/24910881
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/50026845
has body: You can generate your own regex whenever the spec changes. This tool (screenshot here). For utf-8/32 mode (stringed), expanded mode : " # Use the 'Mega-Conversion' tool to change into other syntaxes" " # -------------------------------------------------------------" " " " [#*0-9] \\x{FE0F} \\x{20E3}" " | [\\x{A9}\\x{AE}\\x{203C}\\x{2049}\\x{2122}\\x{2139}\\x{2194}-\\x{2199}\\x{21A9}\\x{21AA}\\x{231A}\\x{231B}\\x{2328}\\x{23CF}\\x{23E9}-\\x{23F3}\\x{23F8}-\\x{23FA}\\x{24C2}\\x{25AA}\\x{25AB}\\x{25B6}\\x{25C0}\\x{25FB}-\\x{25FE}\\x{2600}-\\x{2604}\\x{260E}\\x{2611}\\x{2614}\\x{2615}\\x{2618}]" " | \\x{261D} [\\x{1F3FB}-\\x{1F3FF}]?" " | [\\x{2620}\\x{2622}\\x{2623}\\x{2626}\\x{262A}\\x{262E}\\x{262F}\\x{2638}-\\x{263A}\\x{2640}\\x{2642}\\x{2648}-\\x{2653}\\x{265F}\\x{2660}\\x{2663}\\x{2665}\\x{2666}\\x{2668}\\x{267B}\\x{267E}\\x{267F}\\x{2692}-\\x{2697}\\x{2699}\\x{269B}\\x{269C}\\x{26A0}\\x{26A1}\\x{26AA}\\x{26AB}\\x{26B0}\\x{26B1}\\x{26BD}\\x{26BE}\\x{26C4}\\x{26C5}\\x{26C8}\\x{26CE}\\x{26CF}\\x{26D1}\\x{26D3}\\x{26D4}\\x{26E9}\\x{26EA}\\x{26F0}-\\x{26F5}\\x{26F7}\\x{26F8}]" " | \\x{26F9}" " (?:" " \\x{FE0F} \\x{200D} [\\x{2640}\\x{2642}] \\x{FE0F}" " | [\\x{1F3FB}-\\x{1F3FF}]" " (?: \\x{200D} [\\x{2640}\\x{2642}] \\x{FE0F} )?" " )?" " | [\\x{26FA}\\x{26FD}\\x{2702}\\x{2705}\\x{2708}\\x{2709}]" " | [\\x{270A}-\\x{270D}] [\\x{1F3FB}-\\x{1F3FF}]?" " | [\\x{270F}\\x{2712}\\x{2714}\\x{2716}\\x{271D}\\x{2721}\\x{2728}\\x{2733}\\x{2734}\\x{2744}\\x{2747}\\x{274C}\\x{274E}\\x{2753}-\\x{2755}\\x{2757}\\x{2763}\\x{2764}\\x{2795}-\\x{2797}\\x{27A1}\\x{27B0}\\x{27BF}\\x{2934}\\x{2935}\\x{2B05}-\\x{2B07}\\x{2B1B}\\x{2B1C}\\x{2B50}\\x{2B55}\\x{3030}\\x{303D}\\x{3297}\\x{3299}\\x{1F004}\\x{1F0CF}\\x{1F170}\\x{1F171}\\x{1F17E}\\x{1F17F}\\x{1F18E}\\x{1F191}-\\x{1F19A}]" " | \\x{1F1E6} [\\x{1F1E8}-\\x{1F1EC}\\x{1F1EE}\\x{1F1F1}\\x{1F1F2}\\x{1F1F4}\\x{1F1F6}-\\x{1F1FA}\\x{1F1FC}\\x{1F1FD}\\x{1F1FF}]" " | \\x{1F1E7} [\\x{1F1E6}\\x{1F1E7}\\x{1F1E9}-\\x{1F1EF}\\x{1F1F1}-\\x{1F1F4}\\x{1F…
type: Answer
answers question: http://stackoverflow.com/q/24840667
score: 0

http://stackoverflow.com/comment/38683685
has text: Well that would be the answer to my #2 question, `Am I using methods capable of giving this information?` So, the answer is no. I got this method from a SO question: http://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java. So, I'll have to figure out how to do it without `transferFrom()`.
comment on: http://stackoverflow.com/a/24900702
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38460847
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24783051
has text: The question actually was about security and encapsulation.

http://stackoverflow.com/comment/38439294
type: Comment
type: QuestionComment
score: 1
has text: A [related answer](http://stackoverflow.com/questions/24706576/rank-of-cards-in-a-game/24706671#24706671) I wrote a couple days ago, about implementing cards (suits and ranks) with enums.
comment on: http://stackoverflow.com/q/24771394

http://stackoverflow.com/a/35054938
type: Answer
score: 1
upvote count: 1
has body: There's a cleaner way for this too. You just need to open a empty docx which will act as a template. Add some sample text into it with the style that you want to include and then this piece of code will work. XWPFDocument document = new XWPFDocument(new FileInputStream("template.docx"); paragraph = document.createParagraph(); lastParagraph.setStyle("Heading1");
answers question: http://stackoverflow.com/q/24861645
downvote count: 0

http://stackoverflow.com/comment/38605500
type: Comment
score: 0
has text: Thanks Elliott Frisch, This is bit old application,Recently the issue of connections occuring. I have checked the code , we are closing all the connections generically in one method closeJDBCObjects() and calling in all places where new connections are created in finally block.
comment on: http://stackoverflow.com/q/24858624
type: QuestionComment

http://stackoverflow.com/q/24879701
accepted answer: http://stackoverflow.com/a/24880642
answer count: 2
possible better answer: http://stackoverflow.com/a/24879818
has answer: http://stackoverflow.com/a/24879818
upvote count: 3
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/38643848
has comment: http://stackoverflow.com/comment/38645170
has body: I wrote this program to find a way I could draw a String centered onto a BufferedImage of any size (in this case, the size of the BufferedImage is the same as the JPanel its in) and location. When I resize the JFrame, the text flickers as it repositions itself in the BufferedImage and I don't know why. import java.awt.*; import java.awt.image.BufferedImage; import javax.swing.*; @SuppressWarnings("serial") class test extends JPanel { double scale = 0; String draw = "1"; test() { setPreferredSize(new Dimension(600, 600)); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; paintText(g2, 0, 0); } public void paintText(Graphics2D g, int x, int y) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D big = (Graphics2D) bi.getGraphics(); FontMetrics fm = big.getFontMetrics(); scale = bi.getHeight()/(fm.getHeight()); double xt = -(((scale*bi.getWidth())-bi.getWidth())/2); double yt = -(((scale*bi.getHeight())-bi.getHeight())/2); big.translate(xt, yt); big.scale(scale, scale); big.drawString(draw, (bi.getWidth()/2)-(fm.stringWidth(draw)/2), (bi.getHeight()/2)+(fm.getHeight()/4)+1); g.drawImage(bi, x, y, this); } public static void main(String[] args) { JFrame frame = new JFrame("test"); frame.add(new test()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }
type: AnsweredQuestion
score: 3
has title: Fitting text into BufferedImage
downvote count: 0
has answer: http://stackoverflow.com/a/24880642
has comment: http://stackoverflow.com/comment/38643893
favorite count: 0
tagged with: java-2d
type: Question

http://stackoverflow.com/comment/38491092
score: 0
type: Comment
type: QuestionComment
has text: @SteveNash could you post the same. Start is it a Activity class. I mean do you have `public class Start extends Activity` anywhere
comment on: http://stackoverflow.com/q/24783743

http://stackoverflow.com/q/24902328
answer count: 1
has body: Can anyone help to how to add modify header user-agent to chrome browser using selenium webdriver programmatically File addonpath = new File("D:\\innpjfdalfhpcoinfnehdnbkglpmogdi_20452.crx"); ChromeOptions chrome = new ChromeOptions(); chrome.addArguments("start-maximized"); chrome.addExtensions(addonpath);
tagged with: javascript
score: 0
has title: Can anyone help to how to add modify header user-agent to chrome browser using selenium webdriver programmatically
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24956347
tagged with: testng
type: UnansweredQuestion
tagged with: selenium
tagged with: java
type: Question

reactive-programming
tags question: http://stackoverflow.com/q/24798569
tag name: reactive-programming
type: Tag

http://stackoverflow.com/comment/38631614
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24873139
has text: There's no need for a class though, unless you're using a language that doesn't have non-member functions.
type: AnswerComment

http://stackoverflow.com/a/24768211
has comment: http://stackoverflow.com/comment/38432960
has comment: http://stackoverflow.com/comment/38432923
score: -1
has comment: http://stackoverflow.com/comment/38432800
answers question: http://stackoverflow.com/q/24768076
has body: I believe the problem here is a rather subtle one. the usual way to test for boolean conditions in JUnit is (I believe), to call either assertTrue or assertFalse. However, what you are doing is calling assertEquals, which based on the documentation, has no overload for booleans, just objects and a few other primitives. Why is this important though? Java does something under the covers called autoboxing . What this does is, whenever you give a primitive to a method that is expecting an object, Java automatically converts that primitive into an Object wrapper (ints get boxed into Integers, booleans into Booleans, etc). I believe that in your code, when you are calling assertEquals(this.map.containsKey("john"), false); what Java is doing is autoboxing the false value into a Boolean object, and then trying to call .equals on it with the first object. This is likely the source of your nullpointer.
downvote count: 1
has comment: http://stackoverflow.com/comment/38432901
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/38435742

http://stackoverflow.com/q/24904731
tagged with: java
has comment: http://stackoverflow.com/comment/38733464
type: Question
has comment: http://stackoverflow.com/comment/38696066
score: 0
has body: Let's say I encounter this event on a Windows box. The time service has not synchronized the system time for 86400 seconds because none of the time service providers provided a usable time stamp. The time service will not update the local system time until it is able to synchronize with a time source. If the local system is configured to act as a time server for clients, it will stop advertising as a time source to clients. The time service will continue to retry and sync time with its time sources. Check system event log for other W32time events for more details. Run 'w32tm /resync' to force an instant time synchronization. I'm thinking it could have bearing on currently running Java apps that use the GregorianCalendar class or Calendar.getInstance() method. To be specific, I have this code, where file.lastModified() is actually a month earlier than the date today. What are the chances that the "this should execute" part will not print? Calendar cal = new GregorianCalendar(); File file = new File("/some/file/path"); if(file.lastModified()&gt;cal.getTimeInMillis()){ return; } System.out.println("This should execute, but will it certainly do so?");
type: UnansweredQuestion
tagged with: windows
has title: Can file.lastModified()>cal.getTimeInMillis() return true?
answer count: 0

http://stackoverflow.com/comment/38544862
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24827046
has text: Well, It will run on a 1024x768 screen resolution. If the image doesn't look good, I can exchange or simply remove it. I'm using SpringLayout, is it the correct one for the purpose? I can show an image of a previous try. I'm trying to organize the code.

http://stackoverflow.com/comment/38612723
has text: `c.gridy = 30;` Why are you using such numbers? Also try to organize better your code, your GUI has a clear structure, 2 cards, a num panel... so put all of that in different methods. It will make your life easier.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24863238

http://stackoverflow.com/comment/38527435
has text: How to increase the JVM C-heap ?
comment on: http://stackoverflow.com/a/24818311
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38443982
type: Comment
type: QuestionComment
has text: You might want to override `hashCode()` in such a way that two equal (`equals()` returns `true`) `Rational`s return the same hash code value.
score: 0
comment on: http://stackoverflow.com/q/24774188

http://stackoverflow.com/comment/38691603
type: AnswerComment
has text: It didn't work for me. I get the same error, althought I already had this permission in my manifest
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24901223

http://stackoverflow.com/a/24887812
has comment: http://stackoverflow.com/comment/38674776
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38672515
has comment: http://stackoverflow.com/comment/38672063
has body: You're missing quotes around the JavaScript strings. Change dept_names[&lt;%=i%&gt;] = &lt;%=dept_list[i]%&gt;; to dept_names[&lt;%=i%&gt;] = "&lt;%=dept_list[i]%&gt;"; or simply dept_names.push("&lt;%=dept_list[i]%&gt;"); Change also limit = dept_list.length; to limit = dept_names.length; Notes : there's no reason here to loop twice, once in Java and once in JS. You could do a simple Java loop to build your options it would be cleaner and less tedious to use a JSON encoder to directly write your JS literals from Java. This would also avoid errors (like a " in the middle of your string) you should declare the variables in JavaScript (limit, index)
answers question: http://stackoverflow.com/q/24887761
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24887761

http://stackoverflow.com/comment/38601650
comment on: http://stackoverflow.com/a/24855027
score: 0
has text: No.. I want to populate the OrderPayment with the inputs like customerid, addressid and order id rather than sending the whole Orderpayment as an input to the method.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38441893
has text: Doh! Of course you're right. I've edited my answer (although it's basically equivalent to @Th3Cuber's).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24773043
type: AnswerComment

http://stackoverflow.com/a/24933117
has comment: http://stackoverflow.com/comment/51432473
has comment: http://stackoverflow.com/comment/58757371
type: Answer
has comment: http://stackoverflow.com/comment/53503070
has comment: http://stackoverflow.com/comment/51435653
has comment: http://stackoverflow.com/comment/50097882
has comment: http://stackoverflow.com/comment/52618531
has comment: http://stackoverflow.com/comment/67700451
downvote count: 17
has comment: http://stackoverflow.com/comment/52143012
has comment: http://stackoverflow.com/comment/61572840
has comment: http://stackoverflow.com/comment/42115509
has comment: http://stackoverflow.com/comment/54736482
has comment: http://stackoverflow.com/comment/46509927
has comment: http://stackoverflow.com/comment/48326179
has comment: http://stackoverflow.com/comment/70904838
has comment: http://stackoverflow.com/comment/82015599
has comment: http://stackoverflow.com/comment/46493604
has comment: http://stackoverflow.com/comment/104294685
has comment: http://stackoverflow.com/comment/50098244
has comment: http://stackoverflow.com/comment/67432694
has comment: http://stackoverflow.com/comment/87165378
has comment: http://stackoverflow.com/comment/58785610
has comment: http://stackoverflow.com/comment/81831591
has comment: http://stackoverflow.com/comment/90687118
has comment: http://stackoverflow.com/comment/69650206
has comment: http://stackoverflow.com/comment/44070124
has comment: http://stackoverflow.com/comment/72427582
has comment: http://stackoverflow.com/comment/87165238
upvote count: 1265
has comment: http://stackoverflow.com/comment/51313573
has comment: http://stackoverflow.com/comment/87092450
has comment: http://stackoverflow.com/comment/53502930
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/67695435
has comment: http://stackoverflow.com/comment/75109265
has comment: http://stackoverflow.com/comment/87122365
has comment: http://stackoverflow.com/comment/67432745
has comment: http://stackoverflow.com/comment/48442436
has comment: http://stackoverflow.com/comment/87008031
score: 1248
has comment: http://stackoverflow.com/comment/73380875
has comment: http://stackoverflow.com/comment/48323534
has comment: http://stackoverflow.com/comment/67700493
has comment: http://stackoverflow.com/comment/73331865
has comment: http://stackoverflow.com/comment/44282242
has comment: http://stackoverflow.com/comment/51145428
has comment: http://stackoverflow.com/comment/61573840
has comment: http://stackoverflow.com/comment/50240322
accepted answer of: http://stackoverflow.com/q/24885223
has comment: http://stackoverflow.com/comment/87122289
has comment: http://stackoverflow.com/comment/52137442
has comment: http://stackoverflow.com/comment/110517982
has comment: http://stackoverflow.com/comment/87122309
has comment: http://stackoverflow.com/comment/66102115
answers question: http://stackoverflow.com/q/24885223
has comment: http://stackoverflow.com/comment/69650584
has comment: http://stackoverflow.com/comment/90828357
has comment: http://stackoverflow.com/comment/50591287
has comment: http://stackoverflow.com/comment/70902578
has comment: http://stackoverflow.com/comment/46470420
has comment: http://stackoverflow.com/comment/67388339
has comment: http://stackoverflow.com/comment/42114477
has body: tl;dr 2016 Use RxJava and a PublishSubject to expose an Observable for the clicks. public class ReactiveAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt; { String[] mDataset = { "Data", "In", "Adapter" }; private final PublishSubject&lt;String&gt; onClickSubject = PublishSubject.create(); @Override public void onBindViewHolder(final ViewHolder holder, int position) { final String element = mDataset[position]; holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onClickSubject.onNext(element); } }); } public Observable&lt;String&gt; getPositionClicks(){ return onClickSubject.asObservable(); } } Original Post: Since the introduction of ListView, onItemClickListener has been problematic. The moment you have a click listener for any of the internal elements the callback would not be triggered but it wasn't notified or well documented (if at all) so there was a lot of confusion and SO questions about it. Given that RecyclerView takes it a step further and doesn't have a concept of a row/column, but rather an arbitrarily laid out amount of children, they have delegated the onClick to each one of them, or to programmer implementation. Think of Recyclerview not as a ListView 1:1 replacement but rather as a more flexible component for complex use cases. And as you say, your solution is what google expected of you. Now you have an adapter who can delegate onClick to an interface passed on the constructor, which is the correct pattern for both ListView and Recyclerview. public static class ViewHolder extends RecyclerView.ViewHolder implements OnClickListener { public TextView txtViewTitle; public ImageView imgViewIcon; public IMyViewHolderClicks mListener; public ViewHolder(View itemLayoutView, IMyViewHolderClicks listener) { super(itemLayoutView); mListener = listener; txtViewTitle = (TextView) itemLayoutView.findViewById(R.id.item_title); imgViewIcon = (ImageView) itemLayoutView.findViewById(R.id.item_icon); i…
has comment: http://stackoverflow.com/comment/69121413
has comment: http://stackoverflow.com/comment/69035109
has comment: http://stackoverflow.com/comment/48442721
has comment: http://stackoverflow.com/comment/64067352

http://stackoverflow.com/q/24832956
has comment: http://stackoverflow.com/comment/38555079
score: 0
has title: sqlite table stores the first record but not after that
tagged with: java
has body: I have created a database and added it to asset folder. Table name orders has three columns id, orderItems and orderDate. In orderItems i'm converting the arraylist to a string and then saving which stores successfully for the first record but when i try to store the second one it shows an error. Here is the function which i'm using to add the records in my orders Table. void addOrders(Order ord) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues orderValues = new ContentValues(); orderValues.put(ORDER_ID, ord.get_orderId()); orderValues.put(ORDER_ITEMS, ord.get_orderItems()); orderValues.put(ORDER_DATE, ord.get_orderDate()); // Inserting Row db.insert(TABLE_ORDERS_NEW, null, orderValues); db.close(); // Closing database connection } Here is the function which i'm using to convert the arraylist (selectedProducts) to string and saving to table. public void saveOrders(){ Gson gson = new Gson(); String arrayList = gson.toJson(selectedProducts); db.addOrders(new Order(arrayList, formattedDate)); } DatabaseHandler.class public class DatabaseHandler extends SQLiteAssetHelper { // All Static variables private static String TAG = DatabaseHandler.class.getName(); // Database Path private static String DB_PATH = "/data/data/com.WaqasAsgharBhalli.za_traders/databases/"; private static String DB_NAME = "myDatabase.sqlite"; private SQLiteDatabase myDataBase = null; private final Context myContext; // Database Version private static final int DATABASE_VERSION = 1; // Contacts table name private static final String TABLE_CONTACTS_NEW = "customer"; // Medicine table name private static final String TABLE_PRODUCT_NEW = "products"; // Medicine table name private static final String TABLE_USERLOGIN_NEW = "userlogin"; // ORDERS table name private static final String TABLE_ORDERS_NEW = "orders"; // Contacts Table Columns name private static final String CUSTOMER_ID = "id"; private static final String CUSTOMER_CODE = "code"; private static final String CUSTOMER_NAME = "name"…
has answer: http://stackoverflow.com/a/24833057
answer count: 3
has comment: http://stackoverflow.com/comment/38555285
accepted answer: http://stackoverflow.com/a/24833057
type: AnsweredQuestion
tagged with: sqlite
type: Question
has answer: http://stackoverflow.com/a/24833269
tagged with: android
has comment: http://stackoverflow.com/comment/38555198
possible better answer: http://stackoverflow.com/a/24833150
has comment: http://stackoverflow.com/comment/38555167
has answer: http://stackoverflow.com/a/24833150

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/24886618
tags question: http://stackoverflow.com/q/24872784
tags question: http://stackoverflow.com/q/24831477
tags question: http://stackoverflow.com/q/24772360
tag name: android-actionbar

http://stackoverflow.com/comment/38531517
type: Comment
type: QuestionComment
score: 0
has text: `Caused by: java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?`
comment on: http://stackoverflow.com/q/24820769

http://stackoverflow.com/a/24885886
answers question: http://stackoverflow.com/q/24883982
type: Answer
accepted answer of: http://stackoverflow.com/q/24883982
upvote count: 1
has body: If you are using Servlet 3.0 then you should be able to use String fieldnameValues = request.getParameterValues("fieldname"); you don't need to use to Part to get values of your form field, but if you are using servlet &lt; 3.0 you need to look at this answer. &lt;web-app ... version="xxx"&gt; tag in your web.xml will give you details of servlet api you are using.
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38495080
comment on: http://stackoverflow.com/q/24800639
type: QuestionComment
type: Comment
score: 1
has text: What is wrong with the code snippets you provided?

http://stackoverflow.com/q/24847213
accepted answer: http://stackoverflow.com/a/24847228
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
answer count: 2
has body: I use NetBeans IDE, as you may know there is a JFrame creator plugin (Its pre-installed) I use it to make JFrames (Because I'm too lazy to do it my self =/). in the event of creating a button within that JFrame it will generate a area for the event code. I was wondering what code i need to type in to generate the Alert Dialog. Heres what is pre-generated upon create a swing/awt component or a JFrame: public class NewJFrame extends javax.swing.JFrame { public NewJFrame() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jDialog2 = new javax.swing.JDialog(); jButton1 = new javax.swing.JButton(); javax.swing.GroupLayout jDialog2Layout = new javax.swing.GroupLayout(jDialog2.getContentPane()); jDialog2.getContentPane().setLayout(jDialog2Layout); jDialog2Layout.setHorizontalGroup( jDialog2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); jDialog2Layout.setVerticalGroup( jDialog2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("&gt;:D"); setResizable(false); addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() { public void ancestorMoved(java.awt.event.HierarchyEvent evt) { formAncestorMoved(evt); } public void ancestorResized(java.awt.event.HierarchyEvent evt) { } }); jButton1.setText("Press Me :D"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEF…
possible better answer: http://stackoverflow.com/a/24853784
has answer: http://stackoverflow.com/a/24847228
has answer: http://stackoverflow.com/a/24853784
has title: Making a JFrame button create a Alert Dialog. Java - Netbeans
favorite count: 0
score: 2
tagged with: netbeans
has comment: http://stackoverflow.com/comment/38581561
tagged with: jframe
tagged with: swing
downvote count: 1

http://stackoverflow.com/q/24902968
tagged with: java
type: Question
has title: Get read permissions or security related objects via salesforce API
has answer: http://stackoverflow.com/a/24945597
score: 0
answer count: 1
tagged with: salesforce
type: UnansweredQuestion
has body: I am planning to get read access for object with following query, queryResults = connection.query("SELECT Assignee.Id, Assignee.Name" + " FROM PermissionSetAssignment" + " WHERE PermissionSetId" + " IN (SELECT ParentId" + " FROM ObjectPermissions" + " WHERE SObjectType = GivenObjectType AND" + " PermissionsRead = true)"); This is working for most of the salesforce objects. But for security related objects such as Groups, Profiles this is not working. (i.,e when I want to check users who can see user information, I should be able to pass GivenObjectType="User" and get all the users who can see other user's information. Is there a way that I can achieve this? Note: I identified following object types that doesn't have support in ObjectPermissions.SObjectType User, Group, Partner, Profile and Task (not a security related object) Thanks!

http://stackoverflow.com/comment/38501021
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24804536
has text: see the difference in case "rssApplication" and "rssapplication"
type: Comment

http://stackoverflow.com/a/36820891
type: Answer
has body: //you need to check if 2G or 3G lac = String.valueOf(finalLocation.getLac()); cellId = String.valueOf(finalLocation.getCid()); if(3G) { cellId= String.valueOf( Integer.valueOf( cellId)&amp; 0xffff); lac= String.valueOf( Integer.valueOf( lac)&amp; 0xffff); }
downvote count: 1
answers question: http://stackoverflow.com/q/24781627
has comment: http://stackoverflow.com/comment/61215590
score: -1
upvote count: 0

http://stackoverflow.com/q/24877022
answer count: 2
downvote count: 0
favorite count: 0
tagged with: css
has title: Why is this CSS property not detailed in the JavaFX CSS Reference Guide?
type: UnansweredQuestion
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24880812
type: Question
has body: I'm learning how to use CSS to style UI components in JavaFX, and in going through Oracle's tutorials I found the color property -fx-base in a piece of example code: http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/button.htm (example 3-5, the very last piece of code on the page). In the complete JavaFX CSS Reference Guide (http://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html), there is clear documentation on every property I have seen so far EXCEPT -fx-base, and it seems that it isn't in the reference guide at all. Am I searching in the wrong place or is it missing? Are there any other undocumented properties?
has answer: http://stackoverflow.com/a/24886810
score: 4
upvote count: 4

http://stackoverflow.com/comment/38593702
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24853250
score: 0
has text: Give me again 50, probably is more easy do with List? no?, becouse i think isnt necessary say the size in the initialation.(Sry my english)

http://stackoverflow.com/comment/62080659
score: 0
type: Comment
has text: Replaced studio64.exe to studio.exe in C:\Program Files\Android\Android Studio\bin folder and created a new shortcut of studio.exe on desktop. All doing great now. Thanks.
comment on: http://stackoverflow.com/a/25386926
type: AnswerComment

http://stackoverflow.com/q/24899554
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/24899740
type: Question
has title: Check if JSON node is null
has answer: http://stackoverflow.com/a/24900044
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/24899641
has answer: http://stackoverflow.com/a/24899740
favorite count: 0
possible better answer: http://stackoverflow.com/a/62929064
has answer: http://stackoverflow.com/a/62929064
tagged with: android
has body: I'm returning some JSON from an api, and one of the child nodes of the root object is item. I want to check whether this value at this node is null. Here's what I'm trying, which is currently throwing a JSONException when the node actually is null: if (response.getJSONObject("item") != null) { // do some things with the item node } else { // do something else } Logcat 07-22 19:26:00.500: W/System.err(1237): org.json.JSONException: Value null at item of type org.json.JSONObject$1 cannot be converted to JSONObject Note that the this item node isn't just a string value, but a child object. Thank you in advance!
answer count: 4
score: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/38421574
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24762274
has text: No, I dont have any packages starts with java!

http://stackoverflow.com/comment/38478926
comment on: http://stackoverflow.com/q/24792232
has text: Have you seen the maven dbus plugin (http://quest.windwards.net/content/maven-dbus-plugin)? I've never tried it, but I know sometimes it's hard to find plugins so I thought it was worth mentioning.
score: 0
type: QuestionComment
type: Comment

philips-hue
tag name: philips-hue
type: Tag
tags question: http://stackoverflow.com/q/24806877

http://stackoverflow.com/comment/38481102
comment on: http://stackoverflow.com/a/24780579
type: AnswerComment
has text: @sankrish, there is no magic behind this, either way we have to put efforts on it, OP has asked: `how to find that particular(modified) fields in server side, i dont want to execute update query to all the tables`, so anyways I am suggesting the client side efforts to avoid to server side efforts.
type: Comment
score: 0

http://stackoverflow.com/comment/38465400
type: AnswerComment
has text: While true, this doesn't really address the OP's issue. What do you do if `in.ready()` is false? Go into a hard polling loop until something _does_ come in? Two threads are required.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24785118

http://stackoverflow.com/q/24860448
has body: For a little application that I'm writing there's a file.xml which is a database. When the file.xml is created with: File xmlDB = new File(newYear + ".xml"); PrintWriter writer = new PrintWriter(newYear+".xml", "UTF-8"); String header = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?&gt;&lt;economato&gt; &lt;/economato&gt;"; writer.println(header); then I can set permissions with xmlDB.setwReadable() XML.setWritable() but I've understood that with these primitives I can set the permission either for the owner of for everyone. Instead how can I set these permissions for 2 or 3 people (of given their username they use to log in into the server?)?? I'd need to know this for Linux but overall for Windows. Am I supposed to use Runtime.getRuntime().exec("Windows prompt command"); to do that? Thanks
has title: Java: Set file permissions to several users
type: Question
tagged with: http://stackoverflow.com/tag/xml
score: 0
tagged with: java
tagged with: file
answer count: 1
has answer: http://stackoverflow.com/a/24860608
type: UnansweredQuestion
tagged with: java-io
tagged with: r.java-file

http://stackoverflow.com/q/24874622
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24893585
has body: In my registry, for the extension '.conf' I made the (Default) value point to the pathway of my App. However when I try clicking a file with the extension '.conf' the window asking the user to select a program still opens, rather than simply opening the app associated with the extension. Am I declaring something wrong? Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.conf] @="C:\\Users\\izhodzis\\workspace\\ConfCompiler\\src\\ConfCompiler.jar" PS. The idea is that it will work on other peoples' computers. They shouldn't need to select "Always use the selected program to open this kind of file"
answer count: 1
downvote count: 0
tagged with: file-association
favorite count: 0
has title: Despite creating file association, file will not open in my Application
tagged with: registry
has comment: http://stackoverflow.com/comment/38637167
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24893585
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38668738
has comment: http://stackoverflow.com/comment/38635676
has comment: http://stackoverflow.com/comment/38635164

http://stackoverflow.com/q/24756464
type: Question
has comment: http://stackoverflow.com/comment/38410547
has answer: http://stackoverflow.com/a/24756533
score: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/3716920
tagged with: generics
has title: Unable to add object to generic list using wildcard
linked to: http://stackoverflow.com/q/3716920
type: UnansweredQuestion
tagged with: java
has body: Why can't I add any object here , I was hoping I would be allowed to add any kind of object in such a list. List&lt;?&gt; l = new ArrayList&lt;Object&gt;(); l.add(new Object()); l.add(new String("hello"));

http://stackoverflow.com/q/24831010
has body: The problem is the following: Given a matrix of characters. In the very beginning of the game I am at position (0, 0) in the matrix. Depending on the character in the current position (i, j) I can move Up (if the current character is 'U'), Down if the current character is 'D', Right if the current character is 'R' and Left if the current character is 'L'. Once I reach position with character '*' I cannot move any more (there is exactly one such position). I have some time K in which I have to reach the character. I also have right to change characters, s.t. I can reach character ' * ' faster, but for each changing I pay cost of 1. In the end I have to return the min number of changes I have performed s.t. I have to reach character ' * ' in time k. If it is not possible I have to return -1. My idea is as follows: traverse the whole matrix, to find the position of character ' * '. create boolean method isReachable(x, y, k), which tells me if character at position (x, y) is reachable from position (0, 0) for time k. Here is the method: public static boolean isReachable(int x, int y, int time){ if(time &lt; 0){ return false; } if(x == 0 &amp;&amp; y == 0){ return true; } if(isInBounds(x-1, y)){ if(maze[x-1][y] == 'D'){ return isReachable(x-1, y, time-1); } } if(isInBounds(x, y-1)){ if(maze[x][y-1] == 'R'){ return isReachable(x, y-1, time-1); } } if(isInBounds(x+1, y)){ if(maze[x+1][y] == 'U'){ return isReachable(x+1, y, time-1); } } if(isInBounds(x, y+1)){ if(maze[x][y+1] == 'L'){ return isReachable(x, y+1, time-1); } } return false; } private static boolean isInBounds(int x, int y) { if(x &gt;= 0 &amp;&amp; x &lt;= N-1 &amp;&amp; y &gt;= 0 &amp;&amp; y &lt;= M-1){ return true; } return false; } If the method return true - I output 0 (i.e. there is no need to change any square in the matrix). If the method return false - I want to perform another method which will tell me the min number of changes. However I dont know how to write it. This is my draft that obiously does…
tagged with: java
has title: need dynamic programming solution
type: Question
has comment: http://stackoverflow.com/comment/38551315
has answer: http://stackoverflow.com/a/25115661
downvote count: 0
tagged with: dynamic-programming
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38551406
tagged with: recursion
score: 2
tagged with: algorithm

http://stackoverflow.com/a/24853250
accepted answer of: http://stackoverflow.com/q/24853182
has comment: http://stackoverflow.com/comment/38593850
answers question: http://stackoverflow.com/q/24853182
has comment: http://stackoverflow.com/comment/38620831
has comment: http://stackoverflow.com/comment/38620879
type: Answer
has comment: http://stackoverflow.com/comment/38593781
has comment: http://stackoverflow.com/comment/38593900
has comment: http://stackoverflow.com/comment/38593738
downvote count: 0
has comment: http://stackoverflow.com/comment/38593921
score: 1
has comment: http://stackoverflow.com/comment/38593758
has comment: http://stackoverflow.com/comment/38593702
has comment: http://stackoverflow.com/comment/38593807
has comment: http://stackoverflow.com/comment/38593811
has comment: http://stackoverflow.com/comment/38594009
has comment: http://stackoverflow.com/comment/38593661
upvote count: 1
has body: public int aNums[] = {}; You have not initialized the integer array. To avoid your application getting crashhed. The best way to declare integer array is as show here. public int array_name[]=new int[size_of_array]; now to add data inside the array.simply write array_name[position]=integer_data; where position should range from ( 0 and size_of_array-1).
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38593467
has comment: http://stackoverflow.com/comment/38594137

http://stackoverflow.com/q/24871388
downvote count: 5
has comment: http://stackoverflow.com/comment/38662927
favorite count: 0
has answer: http://stackoverflow.com/a/24890606
answer count: 1
has body: So I have a piece of code that is should to change the texture of an game object, but unfortunately for me its not working! My treasure and blocks are not changing to what they should be! I think a part of the problem lies in these following pieces of code: Game.java: if(red == 255 &amp;&amp; green == 255 &amp; blue == 255) handler.addObject(new Block(xx*32, yy*32, 0, ObjectId.Block)); if(red == 128 &amp;&amp; green == 128 &amp; blue == 128) handler.addObject(new Block(xx*32, yy*32, 1, ObjectId.Block)); if(red == 0 &amp;&amp; green == 0 &amp; blue == 255) handler.addObject(new Player(xx*32, yy*32, handler, ObjectId.Player)); if(red == 255 &amp;&amp; green == 255 &amp; blue == 0) handler.addObject(new Treasure(xx*32, yy*32, 0, ObjectId.Treasure)); if(red == 255 &amp;&amp; green == 254 &amp; blue == 0) handler.addObject(new Treasure(xx*32, yy*32, 1, ObjectId.Treasure)); block: public void render(Graphics g) { if(type == 0){//dirt g.drawImage(tex.block[0], (int)x, (int)y, null); } if(type == 1){//grass g.drawImage(tex.block[1], (int)x, (int)y, null); } } treasure: public void render(Graphics g) { if(i == 0) { g.drawImage(tex.treasure[0], (int)x, (int)y, null); } if(i == 1) { System.out.println("i = 1"); g.drawImage(tex.treasure[1], (int)x, (int)y, null); } } Textures: public void render(Graphics g) { if(i == 0) { g.drawImage(tex.treasure[0], (int)x, (int)y, null); } if(i == 1) { System.out.println("i = 1"); g.drawImage(tex.treasure[1], (int)x, (int)y, null); } } So these are the parts of my code which I think are causing the problem. Also, i and type have been declared earlier in the code, I just did not include those parts.
type: UnansweredQuestion
has title: Texture not changing?
has comment: http://stackoverflow.com/comment/38706793
has comment: http://stackoverflow.com/comment/38628701
score: -5
tagged with: java
type: Question
upvote count: 0

http://stackoverflow.com/comment/38684597
type: Comment
type: QuestionComment
score: 0
has text: It is hard to get two different versions of Java to work on the same box -- can be done, but takes more than simply changing `cd`.
comment on: http://stackoverflow.com/q/24900753

http://stackoverflow.com/q/24803028
tagged with: celltable
tagged with: gwtp
tagged with: gwt
has body: I have a GWT CellTable that I have just moved from a PopupPresenter to a regular nested PresenterWidget. I am using GWTP. Since moving it, the FieldUpdater on my ButtonCell is not calling the update() method at all. I have tried a test button and the same thing happens. // edit offer Column&lt;OfferDto, String&gt; buttonColumn = new Column&lt;OfferDto, String&gt;(new ButtonCell(IconType.PLUS, ButtonType.SUCCESS)) { @Override public String getValue(OfferDto object) { return "View/Edit"; } }; buttonColumn.setFieldUpdater(new FieldUpdater&lt;OfferDto, String&gt;() { @Override public void update(int index, OfferDto object, String value) { // NOTHING IN HERE IS BEING CALLED System.out.println("Update called in setFieldUpdater..."); getUiHandlers().onAddCommsClick(index, object); } }); table.addColumn(buttonColumn); I'm at a loss as to what could be causing it. Other regular buttons in the same View still work OK, it's just the CellTable.
has comment: http://stackoverflow.com/comment/38504045
score: 1
tagged with: java
has title: GWT: Why isn't my Cell's FieldUpdater working?
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38501120
tagged with: gwt-platform
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/38507376
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/38625571
has text: It's probably related to stale paths and the state of the build tree at the time you invoke the `javah`. I don't known enough about your build environment to be able to determine this with any degree of certainty. In general, though, you should be driving all this from build scripts in eclipse and not running it from the command line. Build scripts give you repeatable results, manual execution gives you headaches.
score: 0
comment on: http://stackoverflow.com/q/24868501
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38640005
comment on: http://stackoverflow.com/a/24874106
has text: Yes you need to add the code (how would it work otherwise?). You add the code AFTER you create the table and load it with data. The Action is required for the ButtonColumn class, so you need to create the Action before you create the ButtonColumn class.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38592684
type: Comment
comment on: http://stackoverflow.com/a/24845962
has text: There could be complex structure of xml files (these files are seared by some 3rd party logic), so it is not an option to scan them manually.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24823959
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24820969
score: 2
has comment: http://stackoverflow.com/comment/38538226
answers question: http://stackoverflow.com/q/24820969
has body: Using FetchMode will allow you to fetch all data in a single select (by joining the root entity to other associations you are also interested in fetching). Hibernate.initialize(list) will always issue a new select. It's appropriate to join up to one one-to-many association while there is no strict fetch limit for the many-to-one associations. If you need to select multiple one-to-many associations then additional selects are required. You can use: Hibernate.initialize(list) SUBSELECT fetching BATCH fetching My advice is to use explicit fetching policies on a per-query basis and to always validate the actual executed SQL queries.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42025621

http://stackoverflow.com/q/24880260
has body: I'm using Netty Socket IO to send socket.io content from Java (well, actually Scala.) I've tried several ways of sending a JSON object to the client: hardcoded String standard Java json library Gson library Each time, when the data gets to the client, it's just a string that looks like a JSON object. I'm currently sending it with: case class Data(message:String) and gson.toJson(new Data("what up")). The object looks like this on the client: "{"message":"what up"}", although it's just a String and not a JSON object. Any ideas on how to get an actual JSON object on the other side? Thanks
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
tagged with: socket.io
type: Question
score: 0
has answer: http://stackoverflow.com/a/24901367
answer count: 1
has comment: http://stackoverflow.com/comment/38645138
has comment: http://stackoverflow.com/comment/38645514
type: UnansweredQuestion
tagged with: netty
has title: How to deserialize JSON object on the client side

jdbc
tags question: http://stackoverflow.com/q/24847239
tags question: http://stackoverflow.com/q/24796241
tags question: http://stackoverflow.com/q/24878693
tags question: http://stackoverflow.com/q/24870622
tags question: http://stackoverflow.com/q/24842828
tags question: http://stackoverflow.com/q/24821583
tags question: http://stackoverflow.com/q/24903209
tags question: http://stackoverflow.com/q/24861686
tags question: http://stackoverflow.com/q/24771392
tags question: http://stackoverflow.com/q/24791197
tags question: http://stackoverflow.com/q/24852782
tags question: http://stackoverflow.com/q/24772851
tags question: http://stackoverflow.com/q/24845551
tags question: http://stackoverflow.com/q/24792692
tags question: http://stackoverflow.com/q/24858624
tags question: http://stackoverflow.com/q/24835800
tags question: http://stackoverflow.com/q/24866668
tags question: http://stackoverflow.com/q/24778648
tags question: http://stackoverflow.com/q/24756819
tags question: http://stackoverflow.com/q/24795830
tags question: http://stackoverflow.com/q/24782596
tags question: http://stackoverflow.com/q/24830170
tags question: http://stackoverflow.com/q/24797478
tags question: http://stackoverflow.com/q/24860854
tags question: http://stackoverflow.com/q/24799412
type: Tag
tags question: http://stackoverflow.com/q/24858072
tags question: http://stackoverflow.com/q/24838298
tags question: http://stackoverflow.com/q/24803757
tags question: http://stackoverflow.com/q/24783252
tags question: http://stackoverflow.com/q/24815458
tags question: http://stackoverflow.com/q/24753096
tags question: http://stackoverflow.com/q/24857193
tags question: http://stackoverflow.com/q/24840038
tags question: http://stackoverflow.com/q/24773892
tags question: http://stackoverflow.com/q/24772789
tags question: http://stackoverflow.com/q/24778827
tags question: http://stackoverflow.com/q/24773506
tags question: http://stackoverflow.com/q/24903430
tags question: http://stackoverflow.com/q/24751087
tags question: http://stackoverflow.com/q/24890355
tags question: http://stackoverflow.com/q/24826509
tags question: http://stackoverflow.com/q/24860440
tags question: http://stackoverflow.com/q/24801447
tags question: http://stackoverflow.com/q/24834064
tags question: http://stackoverflow.com/q/24837831
tags question: http://stackoverflow.com/q/24846983
tags question: http://stackoverflow.com/q/24796634
tags question: http://stackoverflow.com/q/24804952
tags question: http://stackoverflow.com/q/24909125
tags question: http://stackoverflow.com/q/24853379
tags question: http://stackoverflow.com/q/24831151
tags question: http://stackoverflow.com/q/24878579
tags question: http://stackoverflow.com/q/24870021
tags question: http://stackoverflow.com/q/24751157
tag name: jdbc
tags question: http://stackoverflow.com/q/24764817
tags question: http://stackoverflow.com/q/24868256
tags question: http://stackoverflow.com/q/24764733
tags question: http://stackoverflow.com/q/24862846
tags question: http://stackoverflow.com/q/24790436
tags question: http://stackoverflow.com/q/24833106
tags question: http://stackoverflow.com/q/24828020
tags question: http://stackoverflow.com/q/24786562
tags question: http://stackoverflow.com/q/24782717
tags question: http://stackoverflow.com/q/24814794
tags question: http://stackoverflow.com/q/24827052
tags question: http://stackoverflow.com/q/24858758
tags question: http://stackoverflow.com/q/24768114

http://stackoverflow.com/q/24798530
has title: Android Kitkat Default SMS app
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24798581
type: UnansweredQuestion
tagged with: android
has body: Good noon, I have developed an application that listen about some special sms from some selected numbers on android pre Kitkat and on Kitkat also it will run smoothly on pre kitkat version but on Kitkat due to default sms app when a sms received from other number than selected numbers then it will not allow to go to inbox is it possible when an sms received and it is not related with app then default app allow to go it to inbox please specifies me an answer .. thanks in advance. thanks n regards Om Parkash..
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: eclipse
upvote count: 1

http://stackoverflow.com/comment/38446328
comment on: http://stackoverflow.com/q/24775294
score: 0
type: Comment
has text: TimeStamp has its own for at requirements, so the only way to convert a String to a TimeStamp where the String does not match this requirement is through use of SimpleDateFormat to parse the String value to a Date value
type: QuestionComment

http://stackoverflow.com/q/24780733
has comment: http://stackoverflow.com/comment/38456087
tagged with: eclipse
has body: For the code below I get a different result when I run it like this, and when I run it inside a Tomcat web app. public static void main(String[] args) { System.out.println(System.getProperty("user.language")); System.out.println(System.getProperty("user.country")); System.out.println(Locale.getDefault(Category.DISPLAY)); System.out.println(Locale.getDefault(Category.FORMAT)); Locale l = new Locale("de", "DE"); System.out.println(l.getDisplayLanguage()); DecimalFormatSymbols dfs = new DecimalFormatSymbols(l); System.out.println(dfs.getDecimalSeparator()); l = new Locale.Builder().setLanguage("de").setRegion("DE").build(); System.out.println(l.getDisplayLanguage()); dfs = new DecimalFormatSymbols(l); System.out.println(dfs.getDecimalSeparator()); } Standalone result (expected): en US en_US en_US German , German , In Tomcat: en US en_US en_US German . German . Can someone suggest what else influences DecimalFormatSymbols (and NumberFormat for that matter) that it doesn't use the locale provided. I'm using JDK 1.8 with language level 1.7. EDIT: This only happens when Tomcat runs in Eclipse. Eclipse/OSGi seems to interfere with the locale-based formatting, but only in a specific situation.
type: Question
tagged with: locale
downvote count: 0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38457792
has comment: http://stackoverflow.com/comment/38457414
answer count: 1
has answer: http://stackoverflow.com/a/30376306
upvote count: 11
favorite count: 0
has title: DecimalFormatSymbols with Locale
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/48080368
score: 11
has comment: http://stackoverflow.com/comment/38456167
has comment: http://stackoverflow.com/comment/48227127
tagged with: java

http://stackoverflow.com/comment/38406884
type: Comment
comment on: http://stackoverflow.com/a/24754253
has text: findViewById ... really?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38485613
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24795830
type: Comment
has text: It now gives this error :SQLBindParameter not used for all parameters

http://stackoverflow.com/q/24877437
tagged with: bluetooth
score: 0
tagged with: android
type: UnansweredQuestion
has body: I have an application which connects to a bluetooth device, opens an input/outputstream and a socket and functions as some kind of "chat" between these two devices. The chat part and connection and everything is done. However I've run into quite a wall here, I need to add an option so that when the app connects to a bluetooth device it gives you the option to save it as the default bluetooth device, so when you first open the app, if the default device is in range it automatically connects to it (the device is already paired). So basically what I need is: We connect to a (already paired) bluetooth device, we answer yes to saving it as a default device and now whenever the app is opened it should automatically look for and connect to this device if it is in range.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24878586
answer count: 1
has title: Automatically connect to predetermined bluetooth paired device on Android

http://stackoverflow.com/comment/65777428
score: 0
type: Comment
has text: hi friend nice its working charm,i have a requirement activity with categories and products initially,if user select category icon i need to display categories in dialog box or activity if user select any category based thata load filtered data on to first activity please help me how to solve
comment on: http://stackoverflow.com/a/35891102
type: AnswerComment

http://stackoverflow.com/comment/38496016
type: Comment
comment on: http://stackoverflow.com/a/24773170
has text: You need at least 50 reputation to post comments: http://stackoverflow.com/help/privileges/comment Either ask here or open new question.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24792337
tagged with: java
upvote count: 1
has title: How can I open another command line application in Linux from a Java program?
type: Question
accepted answer: http://stackoverflow.com/a/24792542
tagged with: command-line-interface
answer count: 1
downvote count: 0
has body: I'm trying to write a small Java command-line application that will create a new file, and then open it with the systems default editor stored in $EDITOR, and then exit after the editor is closed. So far, without luck, I've tried the following: Desktop dt = Desktop.getDesktop(); dt.edit(file); This method resulted in an UnsupportedOperationException, which sort of makes sense as I'm running my program from the terminal, not as a Java appliacation from the desktop. Right now, I have this: Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(commandString); // "vim newfile" proc.waitFor(); This is working, but not how I need it to. When I run ps a | grep vim I can see that it is indeed running in the background, with the filename I've given it: 1000 pts/1 S+ 0:00 vim 2014-07-16.23-02 Any ideas on how to make this run in the foreground?
favorite count: 0
tagged with: linux
has answer: http://stackoverflow.com/a/24792542
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/24875577
upvote count: 2
accepted answer: http://stackoverflow.com/a/24882041
answer count: 1
tagged with: java
has body: I fired up an EMR cluster through the GUI screens. After the cluster got fired up,I could see the ID. How do I get an object of class Cluster that represents that the cluster with that ID? I am using Java for interacting with EMR.
tagged with: hadoop
has title: Get cluster object from ID Amazon EMR
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24882041
type: Question
tagged with: emr

http://stackoverflow.com/comment/38418871
type: QuestionComment
has text: Welcome to Stack Overflow. Please read [Stack Overflow: How to ask](http://stackoverflow.com/questions/how-to-ask) and [Jon Skeet's Question Checklist](http://msmvps.com/blogs/jon_skeet/archive/2012/11/24/stack-overflow-question-checklist.aspx) to find out how to ask a good question that will generate good useful, answers.
comment on: http://stackoverflow.com/q/24759859
type: Comment
score: 1

list
type: Tag
tags question: http://stackoverflow.com/q/24808033
tags question: http://stackoverflow.com/q/24790557
tags question: http://stackoverflow.com/q/24808610
tags question: http://stackoverflow.com/q/24797274
tags question: http://stackoverflow.com/q/24853688
tags question: http://stackoverflow.com/q/24778648
tags question: http://stackoverflow.com/q/24873602
tags question: http://stackoverflow.com/q/24814189
tags question: http://stackoverflow.com/q/24904382
tags question: http://stackoverflow.com/q/24889972
tags question: http://stackoverflow.com/q/24865329
tags question: http://stackoverflow.com/q/24901027
tag name: list
tags question: http://stackoverflow.com/q/24796273
tags question: http://stackoverflow.com/q/24827209
tags question: http://stackoverflow.com/q/24863295
tags question: http://stackoverflow.com/q/24884381
tags question: http://stackoverflow.com/q/24872962
tags question: http://stackoverflow.com/q/24873523
tags question: http://stackoverflow.com/q/24850099
tags question: http://stackoverflow.com/q/24862669
tags question: http://stackoverflow.com/q/24845276

http://stackoverflow.com/q/24797265
answer count: 0
type: UnansweredQuestion
has body: I was wondering if there are any good Java libraries for manipulating netmasks, subnets, etc. As far as I can tell, Java's net package and Guava's net package don't include these capabilities. In Python, I've been using netaddr and I've been wondering if there's anything similarly powerful in Java.
tagged with: guava
has comment: http://stackoverflow.com/comment/38488195
tagged with: java
linked to: http://stackoverflow.com/q/1221517
type: Question
tagged with: ip
has title: Manipulating netmasks, subnets, etc. in Java?
has comment: http://stackoverflow.com/comment/38488169
has comment: http://stackoverflow.com/comment/38488114
score: 0

http://stackoverflow.com/q/24902840
has body: i have problem with setRGB() method. After get int color=getRGB(x,y) then setRGB(x,y,color) the image had changed. File file=new File(fileName); image = ImageIO.read(file); int width=image.getWidth(); int high=image.getHeight(); for (int xPixel = 0; xPixel &lt; width; xPixel++) { for (int yPixel=0; yPixel&lt;high; yPixel++) { int color = image.getRGB(xPixel, xPixel); image.setRGB(xPixel, yPixel, color); } } Then i write the image to a bmp file. the new image is not same with old image. What is problem?
downvote count: 2
has answer: http://stackoverflow.com/a/24902886
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/24902886
answer count: 1
favorite count: 0
has title: bufferedimage image.getRGB and image.setRGB not refer to same pixel
score: -2

http://stackoverflow.com/comment/38539430
type: Comment
comment on: http://stackoverflow.com/a/24822641
type: AnswerComment
score: 0
has text: change in employee-servlet.xml <context:component-scan base-package="com.verve" />

http://stackoverflow.com/a/24838759
answers question: http://stackoverflow.com/q/24838495
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24838495
type: Answer
has body: The simple solution is to output each line as you get it (not save it in an array and then send/write it), or every 1000 lines as you get them. This way you only read the file in one go. The less line you hold in memory, the less memory you use. Note: the only way to read to from line N is to read N lines and ignore them. This would become increasingly expensive as the file get larger. Say you have a method which translates a line of CSV into JSon. try(BufferedReader br = new BufferedReader(new FileReader(infile)); PrintWriter bw = new PrintWriter(new FileWriter(outfile))) { for(String line; (line = br.readLine()) != null;) { String json = process(line); bw.println(json); } } This will only need enough memory for one line of CSV and one line of JSON, no matter how big the file is.
has comment: http://stackoverflow.com/comment/38565534
has comment: http://stackoverflow.com/comment/38565655
score: 1
has comment: http://stackoverflow.com/comment/38565513
upvote count: 1
has comment: http://stackoverflow.com/comment/38566465
has comment: http://stackoverflow.com/comment/38569834
has comment: http://stackoverflow.com/comment/38565584

http://stackoverflow.com/q/24789504
tagged with: spring
has comment: http://stackoverflow.com/comment/38473680
has body: I am using Spring to create a Java Service that is hosted through Tomcat locally. The user is able to store information from the service to a MySQL database. But when I try to create an entry, it gives me just hangs here. Here is the stack trace: o.s.web.client.RestTemplate - Created POST request for "http://localhost:8080/javaservice/admin/createinfo" o.s.web.client.RestTemplate - Setting request Accept header to [application/json, application/*+json] o.s.web.client.RestTemplate - Writing [com.project1.set.transfer.infoTO@5d31159f] using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@590e9ae1] Its just stuck in that Writing line. In the web browser it says "waiting for localhost". I have the schema created in MySQL and the MySQL database is running. Can someone help me figure out why this is happening?
tagged with: java
tagged with: mysql
type: Question
answer count: 1
score: 0
has title: MySQL database not writing
has comment: http://stackoverflow.com/comment/38473528
has answer: http://stackoverflow.com/a/24789602
type: UnansweredQuestion

http://stackoverflow.com/q/24901027
tagged with: gridview
type: UnansweredQuestion
has body: I make personal project with java. using graphics library, so I don't use awt grid, tab etc. my idea is below with images. only use keyboard arrow keys and enter key. moving list with arrow keys, get information with enter key. A list has a tab minimum 3. only access item1 of tab1. and move available only right. because tab1 is first. User can see visible area. If user pressed right arrow key. then all of item move left. and tab4 is invisible state to visible state. and focus moves item1 of tab1 to tab1 of tab2 user show number of tabs is three. this is one of item list use press up key and down key. item list will be movable. tihs is my idea. I use only java graphics library. How I design my idea?
has comment: http://stackoverflow.com/comment/38684160
has comment: http://stackoverflow.com/comment/38684925
has title: make grid view with java graphics
tagged with: list
has comment: http://stackoverflow.com/comment/38684097
answer count: 0
tagged with: java
tagged with: grid
type: Question
has comment: http://stackoverflow.com/comment/38684190
score: 0
tagged with: user-experience

http://stackoverflow.com/q/24859595
has comment: http://stackoverflow.com/comment/38605897
answer count: 0
type: UnansweredQuestion
type: Question
has body: I have schedules such as : Time Events ---- ------ 1week a,b,c 2week b,c 5month d,j 8month m,n 7week c,f 10year a 6year g How can i store these most efficiently in a java application in an OO model, so that I can easily create schedules starting at a particular date?
has title: How to store multiple date to event relations(schedules) efficiently
tagged with: java
has comment: http://stackoverflow.com/comment/38605969
score: 0

http://stackoverflow.com/comment/38491658
type: Comment
type: QuestionComment
has text: What is the question? How to transform the String `"ff 00 d8 00 ff 00 e0 00 18 20"` to `"ff d8 ff e0 91"`?
comment on: http://stackoverflow.com/q/24799313
score: 0

http://stackoverflow.com/q/24905752
has comment: http://stackoverflow.com/comment/38834926
score: 0
has comment: http://stackoverflow.com/comment/38708126
has comment: http://stackoverflow.com/comment/38707692
has comment: http://stackoverflow.com/comment/38707859
answer count: 0
has comment: http://stackoverflow.com/comment/38696414
type: UnansweredQuestion
has title: Adding dependency of another project into Spring MVC web project
tagged with: spring
has comment: http://stackoverflow.com/comment/38709695
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38709281
tagged with: java
tagged with: artifactory
has comment: http://stackoverflow.com/comment/38707779
type: Question
has comment: http://stackoverflow.com/comment/38708623
has body: I my Spring MVC web project I have two parts of project. Core Part : which contains all the model class, services class and some utility classes. Web Part : which contains controllers, views, resources, XMLs etc. Both project in single workspace and having their own pom.xml. To use any class from core part in web part what I am doing is, I am exporting core project as JAR selecting only src/main/java then importing the JAR as an artifact to a Maven repository. The same process I have to do if any small change occur in core part. Is there any way to minimize the step for exporting as JAR and re-deploying as an artifact to a Maven repository. I have tried this: As my core part's pom says it is already creating an artifact: (Image below of core part's pom) So I tried with adding that artifact in my web project and its got added but as I run my project I got HTTP Status 500 - Servlet.init() for servlet appServlet threw exception error. looks like web application is not referring to core JAR at runtime.
has comment: http://stackoverflow.com/comment/38693782
has comment: http://stackoverflow.com/comment/38693495

http://stackoverflow.com/q/24781938
tagged with: maven-2
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: maven
type: Question
has title: NoClassDefFoundError for dependent library projects in Android app project (using maven as build tool)
tagged with: java
has answer: http://stackoverflow.com/a/24800571
has body: I developed two Android library projects: Project A (MyBaseA) & Project B(MyBaseB). I am using maven as build tool, MyBaseA is a of MyBaseB. I also have an Android app project which uses the built MyBaseB.jar as library, this jar is added to the build path of the Android app project. For library project A, the maven coordinate definition in pom.xml is: <?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/maven-v4_0_0.xsd"> 4.0.0 com.my.base.a MyBaseA 1.0 jar MyBaseA ... For library project B which is dependent on above library project A project, the pom.xml is: <?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/maven-v4_0_0.xsd"> 4.0.0 com.my.base.b MyBaseB 1.0 apklib MyBaseB com.my.base.a MyBaseA 1.0 ... I mvn clean install library project A & B which are all successful. Under target/ directory of project B, there are MyBaseB.ap_, MyBaseB.apklib & MyBaseB.jar files. At this point, I created a new Android app project, in which I included the above MyBaseB.jar to the build path of my new Android app project, and used java classes defined in MyBaseB project, which in turns call functions defined in MyBaseA project. But when I run my new Android app project, I got exception: java.lang.NoClassDefFoundError: com.my.base.a.ProjectAClass . My android app can not find the java class defined in project A. Then I checked the content of MyBaseB.jar, all classes of library project A are not included in MyBaseB.jar. Why? I think the MyBaseB.jar should include project A classes, because the pom has included project A as a . Why this error happen? ==================== Update ===================== After I changed library project A 's section of pom…
answer count: 1
downvote count: 0
tagged with: maven-3
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/38496573
has text: Number of connections can always to restricted. But I truly agree, Holding it open as long as possible: good idea :)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24801560

http://stackoverflow.com/comment/38511120
type: QuestionComment
comment on: http://stackoverflow.com/q/24809711
has text: @KevinWorkman I'd describe that as benchmarking. Profiling (IMO) includes tracing and relative times in methods. You could try [VisualVM](http://java.sun.com/javase/7/docs/technotes/guides/visualvm/).
score: 0
type: Comment

http://stackoverflow.com/comment/38478011
comment on: http://stackoverflow.com/q/24791657
type: QuestionComment
score: 0
has text: Apart from the otherwise correct answers, this solution screams for an `ArrayList<ItemClass>` or `LinkedList<ItemClass>` instead of an array of 1500 items. Then you could use `items.add(item)` to grow the list and you would never encountered the null pointer.
type: Comment

http://stackoverflow.com/comment/38662264
has text: Can you be a bit more specific? Does the AsyncTask generate a single item, or all the items? What exactly is is changing or being modified in the AsyncTask?
comment on: http://stackoverflow.com/q/24889499
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24889781
answers question: http://stackoverflow.com/q/24889698
has body: Not really, because functionality is acutally being lost. A java.util.Set only stores keys whereas a java.util.Map stores keys and values. They are not equivelant. An adapter is typically something which adapts one interface to another where both interfaces do the same / similar thing, but have different signatures. An adapter could be made to adapt a java.util.Enumeration to a java.util.Iterator for example. Or perhaps an adapter between java.io.InputStream and java.io.Writer such as the java.io.InputStreamWriter.
score: 0
type: Answer

http://stackoverflow.com/q/24767438
favorite count: 0
has comment: http://stackoverflow.com/comment/38431432
has answer: http://stackoverflow.com/a/24767481
has comment: http://stackoverflow.com/comment/38431356
tagged with: priority-queue
has comment: http://stackoverflow.com/comment/38433447
has comment: http://stackoverflow.com/comment/38431664
tagged with: freeze
has comment: http://stackoverflow.com/comment/38431753
has comment: http://stackoverflow.com/comment/38431702
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/38431854
upvote count: 1
has comment: http://stackoverflow.com/comment/38431750
type: Question
has comment: http://stackoverflow.com/comment/38433139
tagged with: java
has comment: http://stackoverflow.com/comment/38431809
has comment: http://stackoverflow.com/comment/38431643
has body: The aim was to create a priority queue along with a consumer and a producer. Now i do not wish to stop the running of the consumer when there is no data in the queue and just want that it waits till there is some data and then goes ahead and executes it. And So i want the consumer to run for the full duration of my application as there could at any time be a request in the queue. There is only one way to add to the queue and that is thru a specific function of the Producer class. So to make sure that when the queue has some data, the Consumer spins automatically into action, I created the consumer class object inside the consructor of the producer and passed it the empty queue, with the aim that it would wait till some data is put into the queue and then pulls it out and does its job on it. Inside the consumer there is a while loop; while(true){ { if (commandsQueue != null){ doWorkOnCommand(commandsQueue.take()); } break; } But the moment it reaches doWorkOnCommand(commandsQueue.take()); it hangs as it does not find any data in the queue. But it still remains hung even when something is put into this queue at a later stage. I was under the impression that in a priorityBlockingQueue, it waits till there is some data and then proceeds. So why is it not proceeding? Could someone please help? Thanks and regards, Sunny Edit: Section of producer: public class ClientImpl implements IClient{ private PriorityBlockingQueue&lt;SocketCommandParams&gt; gatewayCommandsQueue; public ClientImpl() { this.gatewayCommandsQueue = new PriorityBlockingQueue&lt;SocketCommandParams&gt;(); Thread socketCmdThread = new SocketThread(gatewayCommandsQueue); socketCmdThread.start(); } @Override public void sendCommandToGateway(String ipAddress, int port, ICommand command) { SocketCommandParams cmdParams = new SocketCommandParams(ipAddress, port, command, callback); gatewayCommandsQueue.put(cmdParams); } } Consumer public class SocketThread extends Thread{ private PriorityBlockingQueue&lt;SocketC…
answer count: 1
has comment: http://stackoverflow.com/comment/126556290
downvote count: 0
has title: PriorityBlockingQueue hangs during take(): Java

http://stackoverflow.com/q/24757076
tagged with: oauth-2.0
has body: I am writing a java rest module, with jersey 2, whose first step is to get user credentials from an external Oauth2 server. When I try to redirect the user to the authentications service I see that url is correctly generated but It stays in the place. This is the code i am executing: @GET public String inOk( @DefaultValue("") @QueryParam("code") String inoauthcode) { String oauthserv = "https://xxx"; String oauthclientid = "xxx"; String oauthsecret = "xxxx"; String oauthredirect = "http://myapp/url"; String oauthurl = "xxxx"; String redurl = "http"; String authurl = "http"; if (inoauthcode.equals("")) { redurl = oauthserv + "?response_type=code&amp;client_id=" + oauthclientid + "&amp;redirect_uri=" + oauthredirect; URI uri = UriBuilder.fromUri(redurl).build(); Response.temporaryRedirect(uri); } authurl = oauthurl + inoauthcode + "&amp;redirect_uri=" + oauthredirect + "&amp;client_id=" + oauthclientid + "&amp;client_secret=" + oauthsecret; ...REST OF CODE ... } If I write the generated url to the screen It works perfectly but the temporaryRedirect command is doing nothing (aparently). What am I doing wrong? Did I forget something? This code is almost directly copied from similar questions asked in this forum, but I can't get it to work.
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/38411729
has comment: http://stackoverflow.com/comment/38411622
answer count: 1
tagged with: jersey-2.0
accepted answer: http://stackoverflow.com/a/24774593
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/24774593
type: AnsweredQuestion
has title: java rest jersey redirection for oauth2 not working
tagged with: java

http://stackoverflow.com/comment/38453007
has text: Hi biziclop,I don't think your reply is rude, but I was doing the same thing you wrote: I tried to solve the problem on paper first, I just got stuck...
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24768520

http://stackoverflow.com/a/24877738
type: Answer
score: 3
upvote count: 3
has body: If I understand your question, you could use DateFormat.setLenient(false). Per the JavaDoc, Specify whether or not date/time parsing is to be lenient ... With strict parsing, inputs must match this object's format. DateFormat df = new SimpleDateFormat("yyyyMMdd"); df.setLenient(false); try { Date d = df.parse("20141511"); } catch (ParseException e) { e.printStackTrace(); } Does not allow the invalid date to parse and throws java.text.ParseException: Unparseable date: "20141511"
downvote count: 0
answers question: http://stackoverflow.com/q/24877678

http://stackoverflow.com/q/24756326
has answer: http://stackoverflow.com/a/24757060
answer count: 2
has comment: http://stackoverflow.com/comment/38410708
tagged with: libgdx
downvote count: 0
linked to: http://stackoverflow.com/q/22865648
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: The markup declarations contained or pointed to by the document type declaration must be well-formed
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38411377
upvote count: 1
has body: So I'm using a library called libgdx for a java project. It has an autogenerated XML file which I have no idea what does. Suddenly this xml file returns an error which is: "The markup declarations contained or pointed to by the document type declaration must be well-formed" Having no idea what the xml file does or any deep knowledge of xml I'm completely stuck as to how to fix it. The XML code can be seen here: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd"&gt; &lt;module&gt; &lt;source path="com/starship/security" /&gt; &lt;/module&gt;
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24769883
type: Question

http://stackoverflow.com/a/24795956
type: AcceptedAnswer
type: Answer
score: 25
downvote count: 0
has body: Phone: String replaced = yourString.replaceAll("\\b(\\d{2})\\d+(\\d)", "$1*******$2"); Email: String replaced = yourString.replaceAll("\\b(\\w)[^@]+@\\S+(\\.[^\\s.]+)", "$1***@****$2"); Explanation: phone The \b boundary helps check that we are the start of the digits (there are other ways to do this, but here this will do). (\d{2}) captures two digits to Group 1 (the two first digits) \d+ matches any number of digits (\d) captures the final digit to Group 2 In the replacement, $1 and $2 contain the content matched by Groups 1 and 2 Explanation: Email The \b boundary helps check that we are the start of the characters (there are other ways to do this, but here this will do). (\w) captures one word char to Group 1 [^@]+ matches one or more chars that are not @ \S+ matches one or more chars that are not whitespace chars (\.[^\s.]+) captures a dot and any chars that are not a dot or space to Group 2 In the replacement, $1 and $2 contain the content matched by Groups 1 and 2
accepted answer of: http://stackoverflow.com/q/24795817
has comment: http://stackoverflow.com/comment/67570222
answers question: http://stackoverflow.com/q/24795817
upvote count: 25

http://stackoverflow.com/comment/38543342
score: 0
has text: http://www.techrepublic.com/blog/software-engineer/use-gson-to-work-with-json-in-your-android-apps/
type: Comment
comment on: http://stackoverflow.com/a/24826194
type: AnswerComment

java-8
tags question: http://stackoverflow.com/q/24841616
tags question: http://stackoverflow.com/q/24875012
tags question: http://stackoverflow.com/q/24765179
tags question: http://stackoverflow.com/q/24892890
tags question: http://stackoverflow.com/q/24896498
tags question: http://stackoverflow.com/q/24841423
tags question: http://stackoverflow.com/q/24822323
tags question: http://stackoverflow.com/q/24808243
tags question: http://stackoverflow.com/q/24874256
tags question: http://stackoverflow.com/q/24873979
tags question: http://stackoverflow.com/q/24851732
tags question: http://stackoverflow.com/q/24787879
tags question: http://stackoverflow.com/q/24850748
tags question: http://stackoverflow.com/q/24794924
tags question: http://stackoverflow.com/q/24855746
tags question: http://stackoverflow.com/q/24814794
tags question: http://stackoverflow.com/q/24882927
tags question: http://stackoverflow.com/q/24764118
tags question: http://stackoverflow.com/q/24849043
tags question: http://stackoverflow.com/q/24799125
tags question: http://stackoverflow.com/q/24873010
tags question: http://stackoverflow.com/q/24864219
tag name: java-8
tags question: http://stackoverflow.com/q/24816190
tags question: http://stackoverflow.com/q/24821445
tags question: http://stackoverflow.com/q/24872995
tags question: http://stackoverflow.com/q/24850737
tags question: http://stackoverflow.com/q/24809548
tags question: http://stackoverflow.com/q/24750576
tags question: http://stackoverflow.com/q/24801925
tags question: http://stackoverflow.com/q/24852922
type: Tag
tags question: http://stackoverflow.com/q/24819556
tags question: http://stackoverflow.com/q/24893597
tags question: http://stackoverflow.com/q/24770637
tags question: http://stackoverflow.com/q/24779806
tags question: http://stackoverflow.com/q/24897183
tags question: http://stackoverflow.com/q/24799650
tags question: http://stackoverflow.com/q/24792312
tags question: http://stackoverflow.com/q/24887196

http://stackoverflow.com/q/24848503
downvote count: 1
type: Question
score: -1
tagged with: sorting
tagged with: array-merge
upvote count: 0
answer count: 1
has title: mergesort not printing correct value
tagged with: mergesort
favorite count: 0
has comment: http://stackoverflow.com/comment/38584527
has body: I am trying to implement the mergesort algorithm and I did what you see below, but I don't seem to get the right result, please check my code out and let me know what I am missing. package test; public class MergeSort { private static void mergesort(int[] arr, int n) { int mid; int[] left; int[] right; if(n&lt;2 ){return;} mid = n/2; left = new int[mid]; right = new int[n-mid]; for(int i=0;i&lt;mid;i++){ left[i]=arr[i]; } for(int i=mid;i&lt;n;i++){ right[i-mid]=arr[i]; } mergesort(left,mid); mergesort(right,n-mid); merge(arr,left,mid,right,n-mid); } private static void merge(int[] arr, int[] left, int leftcount, int[] right, int rightcount) { // TODO Auto-generated method stub int i,j,k; i=0;j=0;k=0; while(i&lt;leftcount &amp;&amp; j&lt;rightcount){ if(left[i] &lt;right[i]){ arr[k]=left[i]; k++; i++; } else{ arr[k]=right[j]; k++; j++; } } //copy what left if any while(i&lt;leftcount){ arr[k]=left[i]; k++; i++; } //copy whats left if any while(j&lt;rightcount){ arr[k]=right[j]; k++; j++; } } public static void main(String[]args){ int[] arr = {2,4,1,7,3}; for(int i = 0;i&lt;arr.length;i++){ System.out.print(arr[i] + " "); } System.out.println(); mergesort(arr,arr.length); for(int i = 0;i&lt;arr.length;i++){ System.out.println(arr[i] +" "); } } } as you see my test array to sort is {2,4,1,7,3}; but i have this as my sorted array {1 3 7 2 4}
has answer: http://stackoverflow.com/a/24848783
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24848783

http://stackoverflow.com/a/24902897
score: 2
downvote count: 0
upvote count: 2
has body: You can use !a.equals(b) || !c.equals(d) || !e.equals(f) Well with double data type you can use ==,!= (you should try to use these first.. )
type: Answer
answers question: http://stackoverflow.com/q/24902801

http://stackoverflow.com/q/24852553
type: Question
has title: Reusing hibernateTemplate object can cause resource/memory leak?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38633726
tagged with: memory-leaks
has body: I am using Spring ORM support for implementing some RESTFul web services in my application. The application is stopping to respond after a few hours. I am suspecting a resource leak. I have code similar to this: protected Session getSession() { Session session = null; try { session = hibernateTemplate.getSessionFactory().getCurrentSession(); } catch (Exception ex) {} if (session == null) { session = hibernateTemplate.getSessionFactory().openSession(); } return session; } ..... public void someMethod(){ Session session = null; try { session = getSession(); } catch (Exception ex) {} query = session.createSQLQuery(queryString); List&lt;Object[]&gt; myObjs= (List&lt;Object[]&gt;) query.list(); .... .... Query query2 = session.createSQLQuery(queryString2); BigInteger count = (BigInteger) query2.uniqueResult(); } catch(Exception e){} I am reusing the session object to execute query as well as query2. Can reusing the session object result in a resource leak?
tagged with: spring
has comment: http://stackoverflow.com/comment/38591841
answer count: 0
score: 0
tagged with: java
tagged with: hibernate
tagged with: spring-orm

http://stackoverflow.com/q/24760457
has title: How to use "Context" of one class into another class - Android
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24760784
tagged with: class
has comment: http://stackoverflow.com/comment/38418263
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/38418155
has comment: http://stackoverflow.com/comment/38418386
has comment: http://stackoverflow.com/comment/38418131
has answer: http://stackoverflow.com/a/24761002
tagged with: android-context
tagged with: android
favorite count: 0
score: 2
has body: I am using a context in one class. How can i refer the same context while initiating it in another class? MyHttpClient.java public class MyHttpClient extends DefaultHttpClient { final Context contextkey; public MyHttpClient(Context contextkeystore) { this.contextkey = contextkeystore; } @Override protected ClientConnectionManager createClientConnectionManager() { SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); // Register for port 443 our SSLSocketFactory with our keystore // to the ConnectionManager registry.register(new Scheme("https", newSslSocketFactory(), 443)); return new SingleClientConnManager(getParams(), registry); } private SSLSocketFactory newSslSocketFactory() { try { // Get an instance of the Bouncy Castle KeyStore format KeyStore trusted = KeyStore.getInstance("BKS"); // Get the raw resource, which contains the keystore with // your trusted certificates (root and any intermediate certs) InputStream in = contextkey.getResources().openRawResource(R.raw.mykeystore); try { // Initialize the keystore with the provided trusted certificates // Also provide the password of the keystore trusted.load(in, "mysecret".toCharArray()); } finally { in.close(); } // Pass the keystore to the SSLSocketFactory. The factory is responsible // for the verification of the server certificate. SSLSocketFactory sf = new SSLSocketFactory(trusted); // Hostname verification from certificate // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e506 sf.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER); return sf; } catch (Exception e) { throw new AssertionError(e); } } } To use in another class : DefaultHttpClient client = new MyHttpClient(getApplicationContext()); ?? Here "getApplicationContext" won't work and shown an error
downvote count: 0
type: UnansweredQuestion

pojo
tags question: http://stackoverflow.com/q/24844779
tag name: pojo
type: Tag
tags question: http://stackoverflow.com/q/24855307

http://stackoverflow.com/a/24853550
has comment: http://stackoverflow.com/comment/38595275
type: Answer
has body: Your view can not find the TextView 'cause its not aware of the view hierarchy. Try implementing a setter/getter for the TextView inside your custom view, or consider something like: LinearLayout llParent = (LinearLayout)getParent(); TextView textView2 = (TextView)llParent.findViewById(R.id.textView2); I would prefer implementing a setter and using textView2 as a private member instead, so you don't have to get the reference every time. Hope it helps.
has comment: http://stackoverflow.com/comment/38594848
has comment: http://stackoverflow.com/comment/38595056
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24853417
has comment: http://stackoverflow.com/comment/38594660
downvote count: 0
has comment: http://stackoverflow.com/comment/38596541

http://stackoverflow.com/comment/38523291
type: Comment
has text: It is not always the same files that fail, but randomly and can't specify it. Again, Thanks for your suggestion and i have finally found the solution without coding the line separator at the end. Besides, i am quite sure for Base64.NO_WRAP is used correctly, as it should omit the line terminator for avoiding the line is too long, but i could only allow it without line terminator. i will update my question after removing some dummy code. Thanks again.
comment on: http://stackoverflow.com/a/24799372
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38552527
type: Comment
comment on: http://stackoverflow.com/q/24831568
type: QuestionComment
score: 0
has text: Have you checked the scopes of you dependencies? Runtime VS compile

http://stackoverflow.com/q/24826775
tagged with: spring
has title: Resolve dependencies error in Sling OSGi container
tagged with: sling
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24860109
has body: I want to deploy a Spring MVC web application to Sling OSGi Container. I follow this guide http://www.jasonday.net/content/running-spring-mvc-sling#configure-slingdispatcherservlet-sling-aware. But when I deploy jar file to Sling OSGi Container, my bundle is not 'Active' (it's just 'Installed') and I found that the root cause is some dependencies are not resolved. javax.annotation,version=[1.0,2) -- Cannot be resolved javax.inject,version=[1.0,2) -- Cannot be resolved net.sf.cglib.beans,version=[2.2,3) -- Cannot be resolved net.sf.cglib.core,version=[2.2,3) -- Cannot be resolved net.sf.cglib.proxy,version=[2.2,3) -- Cannot be resolved net.sf.cglib.reflect,version=[2.2,3) -- Cannot be resolved net.sf.cglib.transform,version=[2.2,3) -- Cannot be resolved net.sf.cglib.transform.impl,version=[2.2,3) -- Cannot be resolved net.sf.cglib.util,version=[2.2,3) -- Cannot be resolved org.aopalliance.aop,version=[1.0,2) -- Cannot be resolved org.aopalliance.intercept,version=[1.0,2) -- Cannot be resolved org.apache.commons.codec,version=[1.5,2) -- Cannot be resolved org.apache.commons.codec.binary,version=[1.5,2) -- Cannot be resolved org.apache.commons.lang,version=[2.6,3) -- Cannot be resolved org.apache.commons.lang.builder,version=[2.6,3) -- Cannot be resolved org.apache.commons.lang.math,version=[2.6,3) -- Cannot be resolved org.apache.commons.lang.time,version=[2.6,3) -- Cannot be resolved org.aspectj.lang,version=[1.6,2) -- Cannot be resolved org.aspectj.lang.annotation,version=[1.6,2) -- Cannot be resolved org.objectweb.asm,version=[3.2,4) -- Cannot be resolved org.objectweb.asm.signature,version=[3.2,4) -- Cannot be resolved org.springframework.aop,version=[3.0,4) -- Cannot be resolved org.springframework.aop.aspectj,version=[3.0,4) -- Cannot be resolved org.springframework.aop.aspectj.annotation,version=[3.0,4) -- Cannot be resolved org.springframework.aop.aspectj.autoproxy,version=[3.0,4) -- Cannot be resolved org.springframework.aop.config,version=[3.0,4) -- Cannot b…
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24902158
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38686302
tagged with: java
tagged with: hibernate
type: Question
has title: c3p0 : java.sql.SQLException: Some resources failed to close properly
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38686292
has comment: http://stackoverflow.com/comment/38686449
has body: I am using Hibernate 4 and Spring 3. My application is running and inserting / updating data in database correctly.Once the insertion/updation is completed after some time i am getting below exception : 00:02:35,738 INFO [STDOUT] WARN : com.mchange.v2.resourcepool.BasicResourcePool - Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@1e69c03 java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@1e69c03 at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:651) at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:259) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:619) at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1024) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648) 00:02:38,380 INFO [STDOUT] WARN : com.mchange.v2.resourcepool.BasicResourcePool - Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@1dc2498 java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@1dc2498 at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:651) at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:259) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:619) at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1024) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648) 00:02:38,990 INFO [STDOUT] WARN : com.mchange.v2.resourcepool.BasicResourcePool - Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPoole…
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/38470239
type: QuestionComment
has text: @trashgod I am sorry, but I dont't see how this helps?
comment on: http://stackoverflow.com/q/24785353
score: 0
type: Comment

http://stackoverflow.com/q/24844049
tagged with: rest
has comment: http://stackoverflow.com/comment/38575601
type: AnsweredQuestion
has body: I am using following code for querying REST API but it is very slow. Where as response time for browser is in milliseconds. I think there is no issue in API. Could anyone please suggest what changes I should do to optimize it? Thanks for your time HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(URI); HttpResponse response = client.execute(request); BufferedReader rd = new BufferedReader (new InputStreamReader(response.getEntity().getContent())); String line = ""; StringBuilder outputLine=new StringBuilder(); while ((line = rd.readLine()) != null) { outputLine.append("\n"+line); } return (JSONObject)new JSONParser().parse(outputLine.toString());
accepted answer: http://stackoverflow.com/a/24844168
has title: Java Code for quering REST API is very slow
type: Question
has answer: http://stackoverflow.com/a/24844759
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38576132
tagged with: optimization
score: 0
possible better answer: http://stackoverflow.com/a/24844759
answer count: 2
has comment: http://stackoverflow.com/comment/38576164
has comment: http://stackoverflow.com/comment/38576144
has answer: http://stackoverflow.com/a/24844168

http://stackoverflow.com/comment/38621148
type: QuestionComment
comment on: http://stackoverflow.com/q/24826062
score: 0
has text: One more: If you extract the WAR (just unzip it) does it contain the JAR files in `WEB-INF/lib/`? It would be good to narrow down whether it is a build-step failure, a classpath issue, or something nice and weird...
type: Comment

http://stackoverflow.com/comment/38679090
type: QuestionComment
comment on: http://stackoverflow.com/q/24895144
score: 0
type: Comment
has text: @alkis Just want to trigger a procedure in the server. How about any other library/method to use instead of Jsoup?

http://stackoverflow.com/q/24874014
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24874130
tagged with: filesystems
downvote count: 0
has answer: http://stackoverflow.com/a/24876209
favorite count: 0
has body: I am currently trying to split a String folder. I get the value from a file system and it usually looks something like EAM\Testing. String folder = "EAM\Testing" String[] parts = folder.split("\\"); I know \ has special rules to it in java. String folder = "EAM\\Testing" String[] parts = folder.split("\\\\"); (I know the code above would work if I could control what the input looked like) My problem is that I can not control what string folder is as input from a location of a file. Is there a way to get this to work where folder only has one \ in it? This is for a recycle bin component I am writing for Documentum a enterprise management system. When a document is deleted and the folder doesn't exist anymore I want to recreate it and inorder to recreate it the folder names must be seperate as I have to create them one at a time. Here is how I get the name of the folder. File f = new File(relationRecord.getRepeatingString( "dp_original_folder_paths", i)); (This gives an input such as \EAM\testing String folder1 = f.toString(); I then get rid of the first \ by String folder = folder1.substring(1); Which gives me EAM\testing
has comment: http://stackoverflow.com/comment/38634532
has title: Java how to handle a \ on input
has comment: http://stackoverflow.com/comment/38634925
has comment: http://stackoverflow.com/comment/38633400
answer count: 4
has comment: http://stackoverflow.com/comment/38633377
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24874174
has comment: http://stackoverflow.com/comment/38634668
upvote count: 1
has answer: http://stackoverflow.com/a/24874108
type: Question

http://stackoverflow.com/comment/38607362
comment on: http://stackoverflow.com/q/24860273
score: 0
type: Comment
type: QuestionComment
has text: @Keppil added the code I used to rotate the bit matrix. I need the same transformation without converting the numbers to bits.

http://stackoverflow.com/a/55997972
score: 1
has body: Source of confusion: Your friend would be right if speaking about C++ not Java. In C++, function overloading can only occur between members of the same class. Whereas in Java, overloading can occur, in addition to that, across two classes with inheritance relationship.
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24884151

documentation
tags question: http://stackoverflow.com/q/24798933
tag name: documentation
type: Tag

http://stackoverflow.com/q/24875680
has comment: http://stackoverflow.com/comment/38636504
answer count: 1
has comment: http://stackoverflow.com/comment/38636423
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38636383
has body: public class Ability{ ItemStack i; public Ability(ItemStack i){ this.i = i; } } public class OtherClass{ onEvent(Event e){ if(e.getItemStack() is an ItemStack from the Ability class){ //do stuff } } } You hopefully noticed that this was pseudo code but it represents what I'm trying to achieve. This would turn my really big switch statement that also ties my project to Java 7 reliance into something much more concise and versatile. I need a way of finding whether or not ItemStack objects passed through my event listener originate from my Ability class.
has answer: http://stackoverflow.com/a/24875763
has comment: http://stackoverflow.com/comment/38636434
type: Question
has comment: http://stackoverflow.com/comment/38637274
has comment: http://stackoverflow.com/comment/38637085
score: 0
tagged with: java
has title: Find out if an object was created in a certain other class?

http://stackoverflow.com/comment/38692299
comment on: http://stackoverflow.com/a/24898374
score: 0
type: AnswerComment
has text: Thank you very very much :) I have edited the for statement. However I have come up with a rather peculiar error http://puu.sh/ansI9/c738ff23f7.png
type: Comment

http://stackoverflow.com/comment/38512982
score: 2
comment on: http://stackoverflow.com/a/24807362
type: Comment
has text: I added compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } and that made the error go away. Is that the best way to do it?
type: AnswerComment

http://stackoverflow.com/comment/38522075
has text: Thats what i was doing, did you look at my code. the problem is getting and setting information between the two threads. like setCancelled(true), getPacket().setField("a", 1)
type: Comment
comment on: http://stackoverflow.com/a/24815293
score: 0
type: AnswerComment

http://stackoverflow.com/a/24776716
score: 0
answers question: http://stackoverflow.com/q/24775974
has comment: http://stackoverflow.com/comment/38450410
type: Answer
has body: Try something like: <menuContribution allPopups="true" locationURI="popup:org.eclipse.ui.popup.any">

http://stackoverflow.com/comment/38597285
score: 0
has text: It simply makes no sense. Since the class is determined at compile time, there is no potential for polymorphism. And calling a static method on an instance is a bit of (stupid, IMO) compiler slight-of-hand. What you're really doing is calling the static method on the declared class of the reference variable -- which is determined at compile time.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24855056

http://stackoverflow.com/comment/38568089
has text: possible duplicate of [PHP: Public, Private, Protected](http://stackoverflow.com/questions/4361553/php-public-private-protected)
score: 0
comment on: http://stackoverflow.com/q/24840217
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25535535
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24895424
type: AcceptedAnswer
has body: I solve the problem increasing the -Xss memory in the virtual machine options. -Xss256k to -Xss512k
answers question: http://stackoverflow.com/q/24895424

http://stackoverflow.com/comment/38562850
type: AnswerComment
score: 0
type: Comment
has text: What happens if the removable drive's letter is not fixed? For example , it could be F in one computer and G in another computer. Would it be String drive = " "?
comment on: http://stackoverflow.com/a/24837265

http://stackoverflow.com/a/24903555
has body: Here is the solution that works in the case of using Base64OutputStream. I will explain some of them after code: Here is the Code: FileOutputStream fout = new FileOutputStream(path + ".txt"); FileInputStream fin = new FileInputStream(path); System.out.println("File Size:" + path.length()); ByteArrayOutputStream os = new ByteArrayOutputStream(); Base64OutputStream base64out = new Base64OutputStream(os,Base64.NO_WRAP); byte[] buffer = new byte[3 * 512]; int len = 0; while ((len = fin.read(buffer)) &gt;= 0) { base64out.write(buffer, 0, len); } System.out.println("Encoded Size:" + os.size()); base64out.flush(); base64out.close();//this did the tricks. Please see explanation. String result = new String(os.toByteArray(), "UTF-8"); fout.write(os.toByteArray()); fout.flush(); fout.close(); os.close(); fin.close(); return result; Actually, after using the suggestion from Dawnkeeper by added flush(), i have moved one line of code only. The tricks is did in the base64out.close() before processing any data. As closing the Base64OutputStream might write Ending Padding of Base64 to the Output. I got my idea from org.apache.myfaces.trinidad.util.Base64OutputStream close() method. That's why i tried. It might seems strange closing the OutputStream before data processing, but it only close Base64OutputStream but not ByteArrayOutputStream at the same time in this case. Therefore, the data could still retrieve from ByteArrayOutputStream. Thanks Dawnkeeper efforts, and hope this question could helps other suffered in OutOfMemory Exception.
has comment: http://stackoverflow.com/comment/44866138
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/44865947
upvote count: 4
has comment: http://stackoverflow.com/comment/39747545
accepted answer of: http://stackoverflow.com/q/24798745
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24798745

http://stackoverflow.com/comment/61894765
has text: @MitsuakiIshimoto serious question: why is a `Samurai` paid more than a `Ninja` ?
comment on: http://stackoverflow.com/q/24802171
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24817833
has comment: http://stackoverflow.com/comment/38538664
has body: you have to provide default super() and change your adapter's name because there is already ExpandableListAdapter in android. Suppose you rename your adapter class to CustomExpandableListAdapter. So, constructor should be public CustomExpandableListAdapter(Context context, List&lt;String&gt; listDataHeader, HashMap&lt;String, List&lt;String&gt;&gt; listChildData) { super(); this._context = context; this._listDataHeader = listDataHeader; this._listDataChild = listChildData; } Example Official doc of BaseAdapter
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38554729
type: Answer
accepted answer of: http://stackoverflow.com/q/24817662
has comment: http://stackoverflow.com/comment/38537339
answers question: http://stackoverflow.com/q/24817662
has comment: http://stackoverflow.com/comment/38534530
upvote count: 1
has comment: http://stackoverflow.com/comment/38527174
score: 1
has comment: http://stackoverflow.com/comment/38538429
has comment: http://stackoverflow.com/comment/38534596

http://stackoverflow.com/a/24754671
has body: In addition to what immibis said, this source explain the difference between a &lt; b and a-b &lt; 0 with big long: long t1 = Long.MAX_VALUE; long t2 = Long.MIN_VALUE; //should have the same result with small longs, but is different when rotating from max value to min value of Long System.out.println(t1 - t2 &lt; 0); //true System.out.println(t1 &lt; t2); //false //should have the same result System.out.println(t1 - t2 &gt; 0); // false System.out.println(t1 &gt; t2); //true System.out.println(t2 - t1); // 1 =&gt; 1 nanosecond of difference Since time in nanosceond can exceed the "long" size, when the time arrive to the max value, it begins again to the min value. So there is 1 nanesecond of difference between MAX_VALUE end MIN_VALUE
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24754299
downvote count: 0

http://stackoverflow.com/q/24797774
has body: I have created an infinite transparent loading jframe however it flickers when setting Background to transparent with a call to f.setBackground(new Color(0, 0, 0, 0));, if setBackground is commented the JFrame shows the animated icon correctly. Can anybody fix this? import java.awt.Color; import java.awt.EventQueue; import java.net.MalformedURLException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class InfiniteLoad extends JPanel { private JPanel loadingPanel() throws MalformedURLException { JPanel panel = new JPanel(); BoxLayout layoutMgr = new BoxLayout(panel, BoxLayout.PAGE_AXIS); panel.setLayout(layoutMgr); java.net.URL imageURL = new URL("http://oi59.tinypic.com/106a6vo.jpg"); ImageIcon imageIcon = new ImageIcon(imageURL); JLabel iconLabel = new JLabel(); iconLabel.setIcon(imageIcon); imageIcon.setImageObserver(iconLabel); JLabel label = new JLabel("Loading..."); panel.add(iconLabel); panel.add(label); panel.setOpaque(false); return panel; } public static void main(String[] args) throws MalformedURLException { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame f = new JFrame("Window"); f.setUndecorated(true); //AWTUtilities.setWindowOpacity(f, 0.6f); //f.setOpacity(0.4f); InfiniteLoad imagePanel = new InfiniteLoad(); JPanel jp = null; try { jp = imagePanel.loadingPanel(); } catch (MalformedURLException ex) { Logger.getLogger(InfiniteLoad.class.getName()).log(Level.SEVERE, null, ex); } f.setContentPane(jp); f.setBackground(new Color(0, 0, 0, 0)); //&lt;-- THIS CAUSES FLICKERING f.pack(); f.setVisible(true); } }); } } EDIT: Ok problem was OpenJDK Java related, it displayed the mentioned problem with java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1~0.13.10.1) OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode…
has comment: http://stackoverflow.com/comment/38488929
has answer: http://stackoverflow.com/a/24798692
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7943584
tagged with: jframe
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/38490586
score: 3
has title: Java Swing transparent infinite load / loading animation flickering
tagged with: java
has comment: http://stackoverflow.com/comment/38490445
has comment: http://stackoverflow.com/comment/38489018
upvote count: 3
has comment: http://stackoverflow.com/comment/38490517
answer count: 1
has comment: http://stackoverflow.com/comment/38489938
downvote count: 0
has comment: http://stackoverflow.com/comment/38490522
favorite count: 0
tagged with: transparency

http://stackoverflow.com/comment/38451652
has text: Not sure if this is related, I cannot open this link from work: https://hibernate.atlassian.net/browse/HHH-8697
comment on: http://stackoverflow.com/q/24778346
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24759449
upvote count: 1
has body: Running in embedded mode currently does not support externalization of server.xml, however the given link shows how you could override some of Tomcat classes to address this. Needless to say, there are no guarantees this will work in the next (even minor) release.
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24758062
type: Answer
accepted answer of: http://stackoverflow.com/q/24758062

http://stackoverflow.com/a/27692390
downvote count: 0
answers question: http://stackoverflow.com/q/24782590
type: Answer
score: 1
upvote count: 1
has body: Traditionally, the "Abstract Data Type" (see also this definition) is used to designate the abstract concept of a "class". Wikipedia says: Abstract data types are purely theoretical entities, used (among other things) to simplify the description of abstract algorithms, to classify and evaluate data structures, and to formally describe the type systems of programming languages. However, an ADT may be implemented by specific data types or data structures, in many ways and in many programming languages; or described in a formal specification language. ADTs are often implemented as modules: the module's interface declares procedures that correspond to the ADT operations, sometimes with comments that describe the constraints. This information hiding strategy allows the implementation of the module to be changed without disturbing the client programs. In particular, a numeric data type, whether primitive type or reference type, are instances of "abstract data types". The Java Language Specification uses the words "Primitive Data Type/Values" and "Reference Data Types/Values" in chapter 4.1: 4.1 The Kinds of Types and Values There are two kinds of types in the Java programming language: primitive types (§4.2) and reference types (§4.3). There are, correspondingly, two kinds of data values that can be stored in variables, passed as arguments, returned by methods, and operated on: primitive values (§4.2) and reference values (§4.3). However, the "abstract data type" wording is never used, with good reason.

http://stackoverflow.com/comment/38761854
has text: Think about generic batch of INSERT, each INSERT could fail because of some restriction, i.e. `INSERT INTO films VALUES('UA502', 'Bananas', 105, '1971-07-13', 'Comedy', '82 minutes');`
comment on: http://stackoverflow.com/q/24776129
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38448873
score: 1
comment on: http://stackoverflow.com/q/24776578
has text: I want to disable whole component I know I can disable scrolling with scroll.getVerticalScrollBar().setEnabled(false);
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38505635
type: AnswerComment
has text: @KiranKulkarni looks like your pc isn't set in `IST` . Check the timezone [here](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones) and African is the same as `GMT` (0 offset)
comment on: http://stackoverflow.com/a/24806352
score: 0
type: Comment

http://stackoverflow.com/comment/38506256
type: QuestionComment
type: Comment
has text: I gave you a link in French, sorry. Here is a list of possibles collations (in English :) ) : http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html
comment on: http://stackoverflow.com/q/24806717
score: 0

http://stackoverflow.com/comment/38646685
comment on: http://stackoverflow.com/q/24881196
has text: Do you want to exaclty use the same Sample or any other is fine ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38593803
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24845962
has text: I always post an answer after testing at my end. I have tested it. I you want then use it otherwise leave it as it is.

http://stackoverflow.com/q/24886504
score: 8
type: AnsweredQuestion
tagged with: mysql
has body: I have actually found this problem multiple times on Stackoverflow, but the solutions would not help me. I have a chat module in my android app and want to persist the messages in my server db, which works fine until special characters like emojis appear. ERROR: Incorrect string value: '\xF0\x9F\x98\x81' for column 'message' at row 1 ... ... Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x81' for column 'message' at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2334) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2262) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2246) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:187) ... 23 more My environment is: -Mysql 5.6 -Tomcat 8.0.8 -Hibernate 4.3.5 -JDK 1.8.0_05 This is the used table with the column in question, 'message': These are my properties in the persistence.xml (version 2.1): &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/gamedb?useUnicode=true&amp;amp;characterEncoding=UTF-8" /&gt; &lt;property name="javax.persistence.jdbc.user" value="*********" /&gt; &lt;property name="javax.persistence.jdbc.password" value="**************" /&gt; &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /&gt; &lt;prop…
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/26077243
has answer: http://stackoverflow.com/a/63774377
possible better answer: http://stackoverflow.com/a/24895466
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24895466
has answer: http://stackoverflow.com/a/64588662
has answer: http://stackoverflow.com/a/44578466
has answer: http://stackoverflow.com/a/24936737
has title: Can't persist emojis with mysql and hibernate
downvote count: 0
has answer: http://stackoverflow.com/a/54074182
tagged with: unicode
accepted answer: http://stackoverflow.com/a/26077243
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/37315374

http://stackoverflow.com/comment/38631561
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24873104
has text: For the hex example you could just do `int test1 = 0xb;`
type: Comment

http://stackoverflow.com/comment/38583103
type: QuestionComment
type: Comment
score: 0
has text: @user3857111 you have an error in xml file, check all layout, shape , manifest , menu and ...
comment on: http://stackoverflow.com/q/24847936

http://stackoverflow.com/a/24754139
type: Answer
has body: The line int x = 20; in ChildTest declares a separate variable also called x. An instance of ChildTest then has two unrelated variables named x, one from Test with value 10 and one from ChildTest with value 20. Code in class Test can only see the variable it declared itself, which is why it sees the value 10. If you want ChildTest to modify the value rather than creating a separate variable, add a constructor (or initializer block) and set the variable there without redeclaring it: class ChildTest extends Test { ChildTest() { x = 20; } public void bar() { System.out.println("ChildTest Bar called " + x); } }
answers question: http://stackoverflow.com/q/24753965
score: 0

http://stackoverflow.com/comment/38677717
comment on: http://stackoverflow.com/q/24895424
score: 0
type: Comment
type: QuestionComment
has text: Try running GlassFish on the command line, by executing `glassfish/bin/startserv` in a terminal in Unix/Linux or `glassfish\bin\startserv.bat` in a Windows command window.

http://stackoverflow.com/q/24758957
has answer: http://stackoverflow.com/a/24769955
has comment: http://stackoverflow.com/comment/38415735
has title: Creating Model Listener on liferay Social Plugin
score: 0
answer count: 1
tagged with: eclipse-plugin
type: UnansweredQuestion
tagged with: liferay-ide
tagged with: liferay-6
has body: I have created my custom Model Listener for Social Office Calendar as this thread suggests but when trying to extend my plugin the build fails and the reason is that the target "compile-java" does not exist in the project. BUILD FAILED C:\devel\fishnet\liferay-fishnet-project-6-2\liferay-plugins-sdk-6.2\build-common-plugin-ext.xml:66: The following error occurred while executing this line: C:\devel\fishnet\liferay-fishnet-project-6-2\liferay-plugins-sdk-6.2\build-common-plugin-ext.xml:347: The following error occurred while executing this line: Target "compile-java" does not exist in the project "calendar-new-portlet". Does this have to do with the build-common-plugin-ext.xml or I should have followed another procedure for implementing a custom model listener in social office calendar? Note: I have extended successfully other social office plugins(chat-portlet, contacts etc.) with the same build file(build-common-plugin-ext.xml) but in those cases I didn't add a custom Java class like now with the model listener.
tagged with: java
type: Question
tagged with: liferay

http://stackoverflow.com/comment/38594103
score: 0
has text: Are you asking us how to read every second word?
type: Comment
comment on: http://stackoverflow.com/q/24853688
type: QuestionComment

http://stackoverflow.com/a/24763206
has comment: http://stackoverflow.com/comment/38448173
answers question: http://stackoverflow.com/q/24758807
has comment: http://stackoverflow.com/comment/38488027
score: 0
has comment: http://stackoverflow.com/comment/38441853
type: Answer
has comment: http://stackoverflow.com/comment/38445099
has comment: http://stackoverflow.com/comment/38499697
has body: HTTP Content-Location header is used for an alternate location of the returned data. What you probably need is Location header that is used when a new resource has been created. First build URI containing the given ID and used to retrieve the created data back. You can use for example UriBuilder class to build such a URI. Then return HTTP 200 OK response with Content-Location header containing your URI Response.ok().contentLocation(locationUri)).entity(entity).build(); Or return HTTP 201 Created response with Location header containing the URI Response.created(locationUri).build();
has comment: http://stackoverflow.com/comment/38488167
has comment: http://stackoverflow.com/comment/38447041

http://stackoverflow.com/comment/38598463
score: 0
type: Comment
type: QuestionComment
has text: @McLovin Yeah, guess I misread.
comment on: http://stackoverflow.com/q/24855253

http://stackoverflow.com/comment/38575968
type: AnswerComment
type: Comment
has text: Find the extracted tomcat server. Locate your extracted tomcat server you will see a directory called something like apache-tomcat-7.0.54 under that directory you should see a conf folder. Put your context.xml in that folder, or edit the one that is already there.
comment on: http://stackoverflow.com/a/24844254
score: 0

http://stackoverflow.com/comment/38440451
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24771153
has text: Thanks for the response Colonel Thirty Two. You're right it should be '3' not '1'. I tried changing it to glDrawArraysInstanced(GL_TRIANGLES, 0, 3, 1); but no luck, still a blue screen without a triangle. I'm using glDrawArraysInstanced because I'll be using instancing (not yet but will be). I also tried glDrawArrays(GL_TRIANGLES, 0, 3) and same issue.
score: 0

http://stackoverflow.com/comment/38460232
type: AnswerComment
comment on: http://stackoverflow.com/a/24764190
type: Comment
has text: @Jan: DeltaSpike uses standard CDI-API calls in that helper.
score: 1

http://stackoverflow.com/q/24844711
has comment: http://stackoverflow.com/comment/38580944
favorite count: 0
has body: I am using Java 7. Updated antlr config file to point to Java 7. And looking at other issues on StackOverflow and elsewhere, seems like the fact that 'NetBeans' annotation-processor-compiled-with-RELEASE_6; but need 7 warning is a non-issue. I do get these warnings in the ANTLR TestRig (java) Window many times, for different compiled in annotations, I guess. Sample: warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.modules.PatchedPublicProcessor' less than -source '1.7' When my grammar VCFG.g4 is opened in ANtlrworks2 - there are no warnings no errors. Previously when I did a run =&gt; Run in TestRig an passed it an input file, EVEN IF the input file was invalid (didn't adhere to the grammar) ANTLRworks2 still used to pop up the tree and indicate errors in input file, if any. - Help me please, get my GUI Tree back! More Information: 'Show tokens', 'Print tree', 'Show tree in GUI' => all three check-boxes are Checked. Encoding is UTF-8 and the checkbox is CHecked as well. The ANTLR Codegen (java) Window tab has no errors It's message: Arguments: [-o, /tmp/TestRigTask-1405822965065, -lib, /home/kundan/eworkspace/antlrCentral/resources, -no-listener, -no-visitor, /home/kundan/eworkspace/antlrCentral/resources/VCFG.g4] Thank you.
has comment: http://stackoverflow.com/comment/38580395
type: AnsweredQuestion
tagged with: netbeans
score: 2
upvote count: 2
tagged with: java
tagged with: antlrworks2
type: Question
has answer: http://stackoverflow.com/a/24885154
has title: AntlrWorks 2.1 - Parse Tree (GUI) not popping up
has comment: http://stackoverflow.com/comment/68802784
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24885154

http://stackoverflow.com/comment/38486780
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24795197
score: 0
has text: I copied and installed all Japanese font from my project-team, but it still can't read Japanese.

http://stackoverflow.com/comment/38484487
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24795003
has text: Hey James. Thanks for this answer but I'm already familiar with all this but problem is that when I try to marshal this object via jackosn or xstream it throws lazy loading error, of course because there is no more session when it gets there. That's why I have to set null value so I overwrite PersisteceSet or PersistenceList that has listeners on it. I want to send only main object, without objects that could be attached to it. I hope that clears it. But your answer is good so leave it for some others if they face something familiar.

http://stackoverflow.com/q/24872766
upvote count: 1
has comment: http://stackoverflow.com/comment/38631287
tagged with: network-programming
tagged with: java
has title: Path of jar: URI
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38642736
tagged with: uri
answer count: 0
downvote count: 0
tagged with: jar
has body: can anyone please explain me, what does it exactly mean 'path' in terminology of URI? I mean, when I have URI file:///somedir/somefile the method getURI on java.net.URI returns simply /somedir/somefile When I use URI with HTTP protocol as follows http://localhost/some-ehm-dir/somefile it's not suprisingly, that the path is /some-ehm-dir/somefile But, when I try to get path from jar:, it returns null in each combination I tried: jar:file:///somedir/somejarfile.jar jar:file:///somedir/somejarfile.jar!somedir/somefile jar:http:///whatever/some-ehm-dir/somejarfile.jar ... I found that URI syntax looks like: jar:&lt;url&gt;!/[&lt;entry&gt;] Does it mean, that jar protocol has path not defined and returns null for every URL? (I am asking because I am using class SimpleJavaFileObject, which requires uri with non-null path.)
favorite count: 0
type: Question
score: 1

http://stackoverflow.com/comment/38584225
score: 1
comment on: http://stackoverflow.com/q/24848539
type: Comment
type: QuestionComment
has text: @user2498079 https://source.android.com/source/report-bugs.html

http://stackoverflow.com/a/36564373
upvote count: 0
answers question: http://stackoverflow.com/q/24752840
downvote count: 1
score: -1
has body: == checks to see if the two objects refer to the same place in memory. In other words, it checks to see if the 2 object names are basically references to the same memory location EX1: String obj1 = new String("xyz"); String obj2 = new String("xyz"); obj1==obj2; //False EX2 String obj1 = new String("xyz"); String obj2 = obj1; obj1==obj2; //True
type: Answer

http://stackoverflow.com/a/24775872
score: 53
has comment: http://stackoverflow.com/comment/57256797
has body: String#split() expects a regular expression as the first argument and | is a control character in regex. To make regex parser understand that you mean to split by the literal |, you need to pass \| to the regex parser. But \ is a control character in Java string literals. So, to make Java compiler understand that you want to pass \| to the regex parser, you need to pass "\\|" to the String#split() method.
answers question: http://stackoverflow.com/q/24775817
type: Answer
upvote count: 53
downvote count: 0

http://stackoverflow.com/a/24897503
type: Answer
has body: It should be giving you code completion for those methods. Have you tried doing a "Make Project" to ensure everything's synced with your gradle script? Alternatively, you can go do "Code > Override..." to bring up a list of available methods to override.
answers question: http://stackoverflow.com/q/24897429
score: 0

http://stackoverflow.com/q/24762086
downvote count: 0
tagged with: java
tagged with: jzy3d
type: Question
score: 3
upvote count: 3
answer count: 1
accepted answer: http://stackoverflow.com/a/25010684
has body: I was wondering if anybody knows how to assign labels for the (x,y,z) axis using jzy3d 3D plotting library. I have tried to use such assignment: chart.getView().setAxeLabels("","",""); From here: https://groups.google.com/forum/#!topic/jzy3d/6nkwF8C01Do But it does not work. Any ideas how to do that as by default they show up unassigned.
favorite count: 0
tagged with: jogl
has answer: http://stackoverflow.com/a/25010684
type: AnsweredQuestion
has title: How to label 3D plot axis using jzy3d library?

http://stackoverflow.com/comment/38586900
has text: I read twice your question and feel want to answer but I am lazy to copy so many code and try it out. Is it possible for you create a sample project just to illustrate your problem? Preferable maven project.
score: 0
comment on: http://stackoverflow.com/q/24849950
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24861561
has comment: http://stackoverflow.com/comment/38649238
downvote count: 0
has comment: http://stackoverflow.com/comment/38648436
has comment: http://stackoverflow.com/comment/38614099
answers question: http://stackoverflow.com/q/24859083
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24859083
has comment: http://stackoverflow.com/comment/38610828
type: Answer
has comment: http://stackoverflow.com/comment/38612266
has comment: http://stackoverflow.com/comment/38612093
has body: Instead of trying to add a value change listener to the pager you could put the code in the data provider (assuming you have one). In the data provider that is providing the content (again I am assuming a table or list) then simply update the browser history as necessary. Something like @Override protected void onRangeChanged(final HasData&lt;YourObject&gt; display) { // update browser URL without navigating History.newItem(historyMapper.getToken(place), false); ... } then add support into your place token for storing the paging data, start index, page length, that sort of thing. You will need corresponding code at the start of your activity to read the paging data and handle it as necessary. Ideally if you are using activities and places you want to avoid using the browser back button as generally it will cause a new place and new activity to be created which is a bit heavy. I would imagine you can code your way around this.
has comment: http://stackoverflow.com/comment/38618737
score: 1
has comment: http://stackoverflow.com/comment/38612919
upvote count: 1

http://stackoverflow.com/a/24867271
upvote count: 2
answers question: http://stackoverflow.com/q/24867041
downvote count: 0
type: Answer
has body: There might be some thing error in your res folder once check each and every file and clean your project once and refresh it again.. Sounds like the R.java file has not updated, try some of these general pointers to begin with: Do not manually edit any of the files in the gen folder, as these are automatically built for you. If you find it is out of sync then try refreshing the project. If that did not work try a clean (project -> clean) If that did not work delete the gen folder, from within Eclipse, (do not panic) it will then be rebuilt by Eclipse - however if there is a coding error of some sort it may not do this straight away. Hope this helps..
score: 2

playframework
tags question: http://stackoverflow.com/q/24791992
tags question: http://stackoverflow.com/q/24759163
tags question: http://stackoverflow.com/q/24786681
tags question: http://stackoverflow.com/q/24860897
tags question: http://stackoverflow.com/q/24756749
tags question: http://stackoverflow.com/q/24753876
tags question: http://stackoverflow.com/q/24885380
tags question: http://stackoverflow.com/q/24901221
tags question: http://stackoverflow.com/q/24879279
tags question: http://stackoverflow.com/q/24897777
tags question: http://stackoverflow.com/q/24901391
tags question: http://stackoverflow.com/q/24779879
tags question: http://stackoverflow.com/q/24799638
tags question: http://stackoverflow.com/q/24872404
tags question: http://stackoverflow.com/q/24820596
tags question: http://stackoverflow.com/q/24864163
tags question: http://stackoverflow.com/q/24834449
type: Tag
tags question: http://stackoverflow.com/q/24780678
tag name: playframework
tags question: http://stackoverflow.com/q/24795264

http://stackoverflow.com/a/24773294
type: Answer
answers question: http://stackoverflow.com/q/24773210
score: 0
has body: Java is using integer math, this int x = 435; int y = x / 2 * 5; is equivalent to int x = 435; int y = x / 2; // &lt;-- 217 y *= 5; // &lt;-- 1085 If you wanted to round the other way try, int x = 435; int y = (int) Math.round(((double) x / 2) * 5); // &lt;-- 1088

playframework-2.0
tags question: http://stackoverflow.com/q/24762525
tags question: http://stackoverflow.com/q/24844453
tags question: http://stackoverflow.com/q/24799638
tags question: http://stackoverflow.com/q/24826424
tags question: http://stackoverflow.com/q/24864163
tags question: http://stackoverflow.com/q/24780290
tags question: http://stackoverflow.com/q/24779879
type: Tag
tags question: http://stackoverflow.com/q/24819449
tags question: http://stackoverflow.com/q/24894381
tags question: http://stackoverflow.com/q/24761843
tags question: http://stackoverflow.com/q/24791454
tag name: playframework-2.0
tags question: http://stackoverflow.com/q/24771679
tags question: http://stackoverflow.com/q/24879279
tags question: http://stackoverflow.com/q/24828042

http://stackoverflow.com/a/24823368
has body: Keep it simple. user_(ent_mov|mov_ent)_?\d* DEMO use String#matches() to check for matches. String regex="user_(ent_mov|mov_ent)_?\\d*"; System.out.println("user_ent_mov".matches(regex)); //true System.out.println("user_ent_mov_123".matches(regex));//true System.out.println("user_mov_ent123".matches(regex)); //true System.out.println("user_ent".matches(regex)); //false System.out.println("user_ent123".matches(regex)); //false System.out.println("user_mov123".matches(regex)); //false
upvote count: 2
answers question: http://stackoverflow.com/q/24822849
has comment: http://stackoverflow.com/comment/38536945
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38537796
has comment: http://stackoverflow.com/comment/38537771

http://stackoverflow.com/comment/38405985
has text: hi rafael, thanks for your suggestion. I want exact comparison logic for mentioned scenarios
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24753251
score: 0

http://stackoverflow.com/q/24831647
upvote count: 1
tagged with: sqlite
answer count: 1
favorite count: 0
tagged with: android
tagged with: cordova
downvote count: 0
type: UnansweredQuestion
has body: I have a Phonegap app which creates/open a database: db = window.openDatabase("MyDB.db", "1.0", "MyDB", 656565); Besides that, I created an Widget for this app and I need to access the same database the Phonegap App creates. However, I'm not sure how I do this, since: mydb = SQLiteDatabase.openDatabase("MyDB.db", null, Context.MODE_PRIVATE); does not do the trick, apparently it doesn't find the database properly, the following error occurs: sqlite3_open_v2("MyDB.db", &amp;handle, 2, NULL) failed Does anyone know if something like this is possible?
has title: Access a Phonegap-created Database from the app Widget
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24886008
type: Question

http://stackoverflow.com/comment/38653324
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24885065
type: AnswerComment
has text: Okay! thank you very much, but I'm new to this, could tell me how it's done?

http://stackoverflow.com/q/24884528
tagged with: jboss7.x
favorite count: 0
has answer: http://stackoverflow.com/a/24950722
type: AnsweredQuestion
score: 3
tagged with: connection-pooling
tagged with: database-connection
upvote count: 3
tagged with: java
has body: I have already done the following settings in standalone.xml as: <datasource jta="true" jndi-name="java:jboss/datasources/myDS" pool-name="java:jboss/datasources/myDS" enabled="true" use-ccm="true"> <cached-connection-manager debug="true" error="true"/> Therefore, I am also getting the messages like "Closing a connection for you" as: INFO [org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager] (http--0.0.0.0-8080-160) IJ000100: Closing a connection for you. Please close them yourself: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@5cdb81dc: java.lang.Throwable: STACKTRACE at org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl.registerConnection(CachedConnectionManagerImpl.java:265) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:495) at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129) Still, Sometimes my pool gets exhausted. It runs out of connections beyond 200 as defined. Why? 30 200 There is no way, that my application needs these much connections. There is surely a connection leakage. And If it is, Why jboss is not closing it by it's own when I have enabled the setting as i said above: <datasource jta="true" jndi-name="java:jboss/datasources/myDS" pool-name="java:jboss/datasources/myDS" enabled="true" use-ccm="true"> <cached-connection-manager debug="true" error="true"/> How to resolve? Thanks.
has answer: http://stackoverflow.com/a/37709446
has comment: http://stackoverflow.com/comment/69933111
type: Question
accepted answer: http://stackoverflow.com/a/24950722
possible better answer: http://stackoverflow.com/a/37709446
tagged with: jboss
answer count: 2
has title: JBOSS AS 7.1.1.Final Closing Leaked Connections?
downvote count: 0

http://stackoverflow.com/q/24853949
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 2
has answer: http://stackoverflow.com/a/24870890
tagged with: java
type: Question
tagged with: spring-social
has comment: http://stackoverflow.com/comment/38604155
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/21426519
has body: I need to transport certain data from one request to another for the oauth workflow. @RequestMapping(value = "/connect/twitter", method = RequestMethod.POST) public RedirectView connectTwitter(HttpServletRequest request, Model model) { TwitterConnectionFactory connectionFactory = new TwitterConnectionFactory( environment.getProperty("spring.social.twitter.app-id"), environment.getProperty("spring.social.twitter.app-secret")); OAuth1Operations oauthOperations = connectionFactory.getOAuthOperations(); OAuthToken requestToken = oauthOperations.fetchRequestToken(request.getRequestURL().toString(), null); String authorizeUrl = oauthOperations.buildAuthorizeUrl(requestToken.getValue(), OAuth1Parameters.NONE); //need requestToken in the next process return new RedirectView(authorizeUrl); } @RequestMapping(value = "/connect/twitter", method = RequestMethod.GET) @ResponseBody public String verifyTwitter(@RequestParam("oauth_token") String oauthToken, @RequestParam("oauth_verifier") String oauthVerifier, OAuthToken requestToken /*need requestToken from last request*/) { TwitterConnectionFactory connectionFactory = new TwitterConnectionFactory( environment.getProperty("spring.social.twitter.app-id"), environment.getProperty("spring.social.twitter.app-secret")); OAuth1Operations oauthOperations = connectionFactory.getOAuthOperations(); OAuthToken accessToken = oauthOperations.exchangeForAccessToken(new AuthorizedRequestToken(requestToken, oauthVerifier), null); Connection&lt;Twitter&gt; twitterConnection = connectionFactory.createConnection(accessToken); return "asd"; } the requestToken from the frist request has to be available in the next request. how to handle it?
has title: Create OAuth Flow for Twitter and Facebook with spring social
upvote count: 2

http://stackoverflow.com/comment/38468689
type: Comment
has text: @aegis: Could you provide further information about that? Do all your projects are running on the same application server? Could you also confirm the bandwidth is the issue you are facing?
comment on: http://stackoverflow.com/a/24786741
type: AnswerComment
score: 0

http://stackoverflow.com/q/24786353
has title: DFS isn't being performed correctly
upvote count: 3
downvote count: 2
tagged with: depth-first-search
answer count: 1
tagged with: tree-traversal
tagged with: algorithm
tagged with: java
type: UnansweredQuestion
has body: I want to solve this problem, but I'm stuck on some small part of the problem. Shortly, given a tree, every vertex of this tree has some weight. We define sum of a tree to be the sum of all weights of all nodes contained at the tree. I have N nodes and I want to calculate the sum of the subtrees rooted at each of these N nodes. This sum I want to store in an array res[]. To do so I have to perform DFS and to sum up correctly the weights of the nodes. However, my DFS doesn't work like this and I don't know how to correct it. EDIT: I've debugged my code, but I don't know how to correct it. It fails on calculating the res[] value for the leaves (for them it doesn't return anything). Also it doesn't calculate the right value for the internal nodes. I thought that I have to define new variable int tempRes in the dfs method and to return this variable, but at some point I have to zero it, and I don't know where. package searching; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Stack; public class CutTheTree { static List&lt;ArrayList&lt;Integer&gt;&gt; adj; //list which stores adjacency nodes, i.e. at position i I have list of the neighbours of node i static int N; //number of nodes static int[] res; //store the sum of weights of tree rooted at node i static boolean[] visited; //array which indicates if I have visited node or not static int[] weights; //array of the given weights of each node static int W; //this variable is not relevant to my problem public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line1 = br.readLine(); N = Integer.parseInt(line1); String[] line2 = br.readLine().split(" "); weights = new int[N]; //weights of each vertex visited = new boolean[N]; res = new int[N]; adj = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(N); for …
has comment: http://stackoverflow.com/comment/38467510
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24786639
type: Question

http://stackoverflow.com/q/24846707
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24846800
possible better answer: http://stackoverflow.com/a/60294006
has answer: http://stackoverflow.com/a/60294006
has comment: http://stackoverflow.com/comment/44097055
accepted answer: http://stackoverflow.com/a/24846800
has title: Content assist doesn't work for java objects in Eclipse Juno IDE
has body: i use Eclipse Juno, the content assist doesn't work for me specially for Java object: Example: When i type "na" content assist work and propose "name" for me, but when i type "." to get some String methods, content assist doesn't work in this case. public class A { private String name; public String getName() { return name.toString(); } } i get this exception stack trace: org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.LinkageError: loader constraint violation: when resolving method "org.eclipse.recommenders.utils.rcp.JdtUtils.createUnresolvedType(Lorg/eclipse/jdt/internal/compiler/lookup/TypeBinding;)Lcom/google/common/base/Optional;" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/eclipse/recommenders/internal/completion/rcp/BaseRecommendersCompletionContext, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for resolved class, org/eclipse/recommenders/utils/rcp/JdtUtils, have different Class objects for the type (Lorg/eclipse/jdt/internal/compiler/lookup/TypeBinding;)Lcom/google/common/base/Optional; used in the signature) at org.eclipse.swt.SWT.error(SWT.java:4361) at org.eclipse.swt.SWT.error(SWT.java:4276) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3946) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3623) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.ecli…
type: AnsweredQuestion
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/24869679
favorite count: 0
has body: I'm using the library sshj for sending an scp command. It uses the option -f for downloading from a server to another. I can't find the -f option in the man. What is the signification of -f in an scp command?
accepted answer: http://stackoverflow.com/a/24870138
has comment: http://stackoverflow.com/comment/38625084
downvote count: 1
tagged with: scp
has comment: http://stackoverflow.com/comment/38625340
type: AnsweredQuestion
tagged with: java
tagged with: sshj
upvote count: 10
has answer: http://stackoverflow.com/a/24870138
type: Question
score: 9
answer count: 1
has title: What is the signification of -f in scp command?

http://stackoverflow.com/comment/38464619
comment on: http://stackoverflow.com/a/24784974
type: Comment
has text: No need to escape the forward slash.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24802223
score: 1
has body: You can create your own thumbnail with ThumbnailUtils class (added in API level 8). Bitmap source = BitmapFactory.decodeFile(pathToImage); Bitmap thumb = ThumbnailUtils.extractThumbnail(source, thumbWidth, thumbHeight); ExifInterface class is very limited, so you cannot attach thumbnails.
answers question: http://stackoverflow.com/q/24801978
has comment: http://stackoverflow.com/comment/38497219
downvote count: 0
has comment: http://stackoverflow.com/comment/38499112
type: Answer
has comment: http://stackoverflow.com/comment/38497087
upvote count: 1
has comment: http://stackoverflow.com/comment/38497009

http://stackoverflow.com/a/24770951
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24767749
answers question: http://stackoverflow.com/q/24767749
has body: The only way I am aware of is to replicate the behavior of namespace parsers of these custom namespaces. So, &lt;jee:jndi-lookup&gt; is handled by org.springframework.ejb.config.JndiLookupBeanDefinitionParser and ultimate creates a bean which is an instance of JndiObjectFactoryBean with the passed in attributes. Similarly, &lt;tx:jta-transaction-manager/&gt; is handled by org.springframework.transaction.config.JtaTransactionManagerBeanDefinitionParser and based on the runtime environment, returns a specific instance of class. A neat feature of Spring 4 that you can use is @Conditional(reference here). With @Conditional and using a Spring-Boot Conditional implementation called ConditionalOnClass(reference here), you can replicate the behavior of &lt;tx... something like this: @Configuration @ConditionalOnClass(name="weblogic.transaction.UserTransaction") public class WebLogicTxMgrConfig { @Bean public JtaTransactionManager txManager() { return new WebLogicJtaTransactionManager(); } } I know this is not a complete answer, but hopefully should help you create the relevant configuration.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38545596
score: 3

http://stackoverflow.com/comment/38442535
comment on: http://stackoverflow.com/a/24773261
has text: But i don't have EAR File As well in hand. Can i export the EAR file from server through Admin Console?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38676407
type: AnswerComment
has text: True. I found no better way though. The only alternative is to use derived collections or wrappers, so you have a type-safe way to determine the ones to be intercepted. Or you can hide the collections inside your classes and manipulate them only via accessor methods. Have you measured the performance penalty for the map lookups? They should be fast, but the overhead remains.
score: 0
comment on: http://stackoverflow.com/a/24839202
type: Comment

http://stackoverflow.com/q/24899125
answer count: 1
has answer: http://stackoverflow.com/a/24904393
accepted answer: http://stackoverflow.com/a/24904393
tagged with: optaplanner
has title: Cannot find drl resource in ejb project
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/38690282
tagged with: java
tagged with: glassfish
score: 0
has body: I am creating an enterprise application (Glassfish 4) which uses optaplanner (6.0.1). The solver is launched from within the EJB project. I can load the xml configuration just find, but it wont find the drl building the solver. SolverFactory solverFactory = new XmlSolverFactory().configure(PropositionSB.class.getResourceAsStream("/resources/todoSolverConfig.xml")); Solver solver = solverFactory.buildSolver(); Throws Caused by: java.lang.IllegalArgumentException: The scoreDrl (/resources/todoScoreRules.drl) does not exist as a classpath resource. at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildKieBase(ScoreDirectorFactoryConfig.java:304) at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:279) at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:186) at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:174) at org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:145) at org.optaplanner.core.config.solver.XmlSolverFactory.buildSolver(XmlSolverFactory.java:101) at entityManagement.PropositionSB.solve(PropositionSB.java:110) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081) at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153) at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695) at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630) at com.sun.ejb.containers.inter…

http://stackoverflow.com/q/24769296
has answer: http://stackoverflow.com/a/29224155
has answer: http://stackoverflow.com/a/54416559
has answer: http://stackoverflow.com/a/30154517
has answer: http://stackoverflow.com/a/40847061
has answer: http://stackoverflow.com/a/29256781
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24774286
has answer: http://stackoverflow.com/a/52230495
answer count: 9
linked to: http://stackoverflow.com/q/35534723
type: UnansweredQuestion
has title: Binding nested object properties to TableView in JavaFx
has body: I have the next class public class ProductStockDto extends private Long id; private Long amount; private ProductDto product; private StockDto stock; //getters and setters... } In JavaFx I have my table and I want to bind the product.name property to the column, something like this. ObservableList&lt;ProductStockDto&gt; data = FXCollections.observableArrayList(); data.addAll(products); nameColumn.setCellValueFactory(new PropertyValueFactory("product.name")); productTable.setItems(data); But when I do that, the rows on the TableView appears on blank. Somebody can help me with this? I want to bind nested object properties, on Java Swing was something like that ${product.name} Thanks.
upvote count: 14
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/40824937
type: Question
score: 14
has answer: http://stackoverflow.com/a/35731746

http://stackoverflow.com/comment/38674806
has text: huh, interesting about the "non-private" bit for inner classes! Any idea what that exemption is doing there? javap shows that a private ctor with the one parameter _does_ exist: https://gist.github.com/yshavit/9cd954b1c01b0f5d27cc
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24895748

http://stackoverflow.com/comment/38470075
score: 0
comment on: http://stackoverflow.com/q/24785519
type: Comment
has text: Then it's not an iText problem, but a problem similar to http://stackoverflow.com/questions/14411463/java-nio-file-filealreadyexistsexception-how-to-resolve-this-in-java7
type: QuestionComment

http://stackoverflow.com/q/24786318
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38468371
has body: I have a JAVA Class that is defied as a managed-bean. The code below is a stripped down version of it: package ca.wfsystems.core; import lotus.domino.*; public class Utils { public static void recycleObjects(Object... args) { for (Object o : args) { if (o != null) { if (o instanceof Base) { try { ((Base) o).recycle(); } catch (Throwable t) { // who cares? } } } } } //end recycleObjects public static void sysOut(Object msg){ System.out.println(msg.toString()); } //end sysOut }// End Class The call to recycleObjects(someObject) works fine when called from JAVA Code, but when I call it from SSJS in a button on an XPage called TestError I get the message "State data not available for /TestError because no control tree was found in the cache." The SSJS code in the button is: WFSUtils().sysOut("In Button"); var vw:NotesView = WFSAppProperties().get(sessionScope.get("ssApplication")).getAppDB().getView("vwWFSForms"); WFSUtils().sysOut("Testing Bean" + vw.getName()); WFSUtils().recycleObjects(vw); where WFSUtils is the name of the managed bean. the error in the client says: Error while executing JavaScript action expression Script interpreter error, line=6, col=12: Java method 'recycleObjects(lotus.domino.local.View)' on java class 'ca.wfsystems.core.Utils' not found JavaScript code I have searched for the error "State data not available for" but found a single reference aout it when using the Extension Library but this code does not use it.
has answer: http://stackoverflow.com/a/24786907
accepted answer: http://stackoverflow.com/a/24786907
tagged with: xpages-ssjs
upvote count: 1
has comment: http://stackoverflow.com/comment/38519707
answer count: 1
has title: JAVA bean method fails when called from SSJS but not from JAVA
tagged with: xpages

http://stackoverflow.com/comment/38669271
type: Comment
has text: In that extent in which it helps reducing coupling within the class, increases readability of a method and helps you realize how the method interacts with the classes intrinsics. At least that's my opinion, of course this approach has it's limits. E. g. it makes no sense to introduce a private static helper method with, let's say, 5+ parameters, since that would rather reduce clarity.
score: 1
comment on: http://stackoverflow.com/a/24886874
type: AnswerComment

http://stackoverflow.com/q/24815737
answer count: 2
has comment: http://stackoverflow.com/comment/38522828
possible better answer: http://stackoverflow.com/a/24815774
has comment: http://stackoverflow.com/comment/38522833
favorite count: 0
has body: I've been using a Java book which has been excellent so far but it hasn't been to good at explaining the reason why we use setters and getter. I've searched other posts but none have really helped me specifically. I'll just post a program from the book and explain my problems with it. package lesson1; public class GoodDog { private int size; public void setSize(int sz){ if(sz &gt; 10){ size = sz; } } public int getSize(){ return size; } } Second class: package lesson1; public class GoodDogTestDrive { public static void main(String[] args) { GoodDog one = new GoodDog(); one.setSize(15); System.out.println(one.getSize()); } } This is my first post so if it doesn't come out as code then forgive me. Don't ask why the classes are named that, I had no imagination and just used the book's name. Anyway, my understanding is that encapsulation (To me this basically means getters and setters) prevents the direct access to instant variables. The only valid reason for this is because some values of instant variables should not be allowed. For example say we had int height; (Instant variable) We should not be able to say object.height = 0; ('object' being a random reference variable). In my little program it is simply a dog's height with a simply restriction. It's not meant to make sense but I'm just trying to make sense of this concept. Is encapsulation simply meant for programming firms when programmers need to use each others code to. say, make a game for example or is it different? I watched a video also stating that it simply makes code easier to manage. However I still don't feel that I fully understand this concept. Can someone please explain this to me in simple terms. Please note that I'm a beginner and will not understand examples involving intermediate code. Thank you for your help.
has comment: http://stackoverflow.com/comment/38522708
has comment: http://stackoverflow.com/comment/38522680
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24815774
has comment: http://stackoverflow.com/comment/38523809
linked to: http://stackoverflow.com/q/1568091
type: Question
linked to: http://stackoverflow.com/q/16418571
has answer: http://stackoverflow.com/a/24815772
tagged with: oop
accepted answer: http://stackoverflow.com/a/24815772
has comment: http://stackoverflow.com/comment/38522728
score: 1
tagged with: java
tagged with: setter
tagged with: encapsulation
tagged with: getter
has comment: http://stackoverflow.com/comment/38522683
has title: Can you help me understand encapsulation please (Beginner)?
upvote count: 3
downvote count: 2

http://stackoverflow.com/a/24867193
type: Answer
answers question: http://stackoverflow.com/q/24866120
score: 0
has comment: http://stackoverflow.com/comment/38626634
has body: Think this through logically: the clear text "stackoverflow" when represented as 7-bit ASCII represents 13 times 7 bits (=91 bits) of information. Thats more than a long (64 bits) can hold. So your encoding will lose information, making decoding impossible. That should be also quite apparent from the formula you use: l = l * 47 + text.getBytes()[i] % 97; For each charcter you get a number between 0 and 96 (you already loosing information in the modulo, reducing information to 97 possible characters (e.g. you cannot distinguish between the bytes 1 and 98 after the modulo any more). Then you multiply your long by a number less than 97 (47), so two consecutive characters will overlap in terms of information distribution in the cyphertext. Finally, after adding more an more characters, the long simply overflows and the topmost bits are simply lost. In conclusion: If you want to decode the cyphertext ever again, fix the loss of information in these three places.

http://stackoverflow.com/comment/38491440
type: Comment
score: 0
has text: no, source code like this, in your activity @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK ) { // and you have to make a intent to call this activity again with parameter other finish(); // and call finish() here to close the old activity } return super.onKeyDown(keyCode, event); }
type: AnswerComment
comment on: http://stackoverflow.com/a/24797856

http://stackoverflow.com/comment/38553603
score: 0
has text: possible duplicate of [Transfer data to PC from android device via NFC](http://stackoverflow.com/questions/24096356/transfer-data-to-pc-from-android-device-via-nfc)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24831898

http://stackoverflow.com/comment/38673188
type: Comment
type: QuestionComment
score: 0
has text: @Ben no it won't amortize to anything smaller because the testing is done in the wrong order. n=1000 primes means ~ **N=8000** numbers to test, by **an O(N^2) algorithm**; don't be so sure that it will run fast just because n=1000 seems small (you did say "anyway"...) - its complexity is atrocious (see e.g. this [Haskell test entry](http://ideone.com/Y7pnCO) with the equivalent algorithm showing ~ N^2.2 , ~ n^2.5 run-time behaviour.
comment on: http://stackoverflow.com/q/24893049

http://stackoverflow.com/q/24753218
tagged with: java
tagged with: hibernate
type: Question
tagged with: second-level-cache
has answer: http://stackoverflow.com/a/24754385
score: 0
has body: I am fairly new to ehcache and as far as I know on method level the cacheing is working on the id of object to be cached. However I have a different situation. I have a User class and a role class, the relation between them is many-to-many and stored in another table by ids. public class User{ @Id @Column(name="ID") @GeneratedValue(generator="idGenerator",strategy = GenerationType.SEQUENCE) private Long id; ... @ManyToMany(targetEntity = Role.class, fetch = FetchType.EAGER) @JoinTable(name = "ROLE", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") }) protected Set&lt;Role&gt; roles; ... } public class Role{ @Id @Column(name="ID") @GeneratedValue(generator="idGenerator",strategy = GenerationType.SEQUENCE) private Long id; ... @ManyToMany(targetEntity = User.class) @JoinTable(name = "USER", joinColumns = { @JoinColumn(name = "ROLE_ID") }, inverseJoinColumns = { @JoinColumn(name = "USER_ID") }) protected Set&lt;Role&gt; roles; ... } Just to mention, there no such a UserRole domain class. And the service method is somethig like; public RoleService{ @Cacheable public Set&lt;Role&gt; getUserRoles(Long userId) { ... } } The thing is that on the service level I want the roles to be cached per userId basis. How can I cache roles using id of the user?
answer count: 1
tagged with: ehcache
accepted answer: http://stackoverflow.com/a/24754385
has title: How to cache an object with a key which is not owned by the object, using ehcache?
type: AnsweredQuestion

http://stackoverflow.com/q/24872350
has title: What is the equivalent of web.xml's <env-entry> tag when using ServletContainerInitializer?
tagged with: spring-java-config
has answer: http://stackoverflow.com/a/66109565
answer count: 3
has answer: http://stackoverflow.com/a/24881155
accepted answer: http://stackoverflow.com/a/24881155
favorite count: 0
linked to: http://stackoverflow.com/q/63939387
has answer: http://stackoverflow.com/a/77345476
upvote count: 4
tagged with: spring
has comment: http://stackoverflow.com/comment/40840018
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40839766
has comment: http://stackoverflow.com/comment/38647319
downvote count: 0
tagged with: java
has body: I'm trying to replace my web.xml file with a code based class that extends from Spring's WebApplicationInitializer. My web.xml file has a couple "env-entry" elements. I'm trying to figure out how to set these in my WebApplicationInitializer class, but with no luck. Perhaps someone knows the code equivalent of these tags? public class MyWebApplicationInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { XmlWebApplicationContext appContext = new XmlWebApplicationContext(); appContext.setConfigLocation("WEB-INF/springmvc-servlet.xml"); Dynamic servlet = servletContext.addServlet("springmvc", new DispatcherServlet(appContext)); servlet.setLoadOnStartup(1); servlet.addMapping("/*"); //How do I add this? // // logback/configuration-resource // java.lang.String // logback.xml // } }
type: Question
possible better answer: http://stackoverflow.com/a/66109565
score: 4
tagged with: servlet-3.0

http://stackoverflow.com/a/24798840
accepted answer of: http://stackoverflow.com/q/24798568
score: 10
has body: You can do this programatically like this: findViewById(R.id.txt).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TextView textView = (TextView) v; if (textView.isSelected()) { textView.setTextColor(Color.RED); v.setSelected(false); } else { textView.setTextColor(Color.BLUE); v.setSelected(true); } } }); And here's my layout: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"&gt; &lt;TextView android:id="@+id/txt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="some text" android:textSize="20sp" android:textColor="#FF0000"/&gt; &lt;/LinearLayout&gt; EDIT: For your specific case would be like: View previousView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); View.OnClickListener clickListener = new View.OnClickListener() { @Override public void onClick(View v) { TextView previousText = (TextView) previousView; TextView curText = (TextView) v; // If the clicked view is selected, deselect it if (curText.isSelected()) { curText.setSelected(false); curText.setTextColor(Color.RED); } else { // If this isn't selected, deselect the previous one (if any) if (previousText != null &amp;&amp; previousText.isSelected()) { previousText.setSelected(false); previousText.setTextColor(Color.RED); } curText.setSelected(true); curText.setTextColor(Color.BLUE); previousView = v; } } }; findViewById(R.id.txt).setOnClickListener(clickListener); findViewById(R.id.txt2).setOnClickListener(clickListener); findViewById(R.id.txt3).setOnClickListener(clickListener); }
has comment: http://stackoverflow.com/comment/38491829
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38490958
type: Answer
has comment: http://stackoverflow.com/comment/38492662
has comment: http://stackoverflow.com/comment/38492432
has comment: http://stackoverflow.com/comment/38492116
has comment: http://stackoverflow.com/comment/90437276
has comment: http://stackoverflow.com/comment/38491990
upvote count: 10
has comment: http://stackoverflow.com/comment/38490849
answers question: http://stackoverflow.com/q/24798568

http://stackoverflow.com/comment/39952654
type: QuestionComment
type: Comment
has text: You could check out [JavaCPP - Creating Callbacks Functions](https://github.com/bytedeco/javacpp#creating-callback-functions) for that. It would save you a lot of trouble.
score: 0
comment on: http://stackoverflow.com/q/24869389

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/24804172

http://stackoverflow.com/comment/38443121
has text: There is never an object created in this code.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24773806
type: Comment

http://stackoverflow.com/a/24817854
has comment: http://stackoverflow.com/comment/38527570
accepted answer of: http://stackoverflow.com/q/24817745
has comment: http://stackoverflow.com/comment/38527448
answers question: http://stackoverflow.com/q/24817745
has comment: http://stackoverflow.com/comment/38526716
has body: Firstly, it's important to be able to diagnose this yourself more. Either adding some logging or using a debugger should help you work out what the code is doing - you shouldn't just need to depend on perfect output. Secondly, some unit tests would help you to validate individual sections of your code more clearly. Thirdly, I suspect the issue is your while loop in shuffle: do { if (newDeck[element]== null) { newDeck[element]=deck[index]; } else { element = (int) (Math.random()*52); } }while(newDeck[element]!=null); On the last iteration of the enclosing loop, you'll have filled every slot of newDeck - so it's impossible to find a value of element such that newDeck[element] = null. So your while loop will go on forever. This is actually a pretty painful way of shuffling anyway - consider using Collections.shuffle(Arrays.asList(deck)) instead. You then also need to override toString() in places in order to get good output. Additionally, I'd recommend string arrays for the suits and values, to massively cut down on the size of your Card constructor: private static final String[] SUIT_NAMES = { "Hearts", "Clubs", "Diamonds", "Spades" }; // Fill in the rest yourself private static final String[] VALUE_NAMES = { "Ace", "2", "3" ... "King" }; private final String suitName; private final String valueName; public Card(int suit, int value) { this.suitName = SUIT_NAMES[suit]; this.valueName = VALUE_NAMES[value]; } Alternatively, use enums for both the suit and value - a card deck is often used as an example of a situation where an enum makes a lot of sense.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38527751
has comment: http://stackoverflow.com/comment/38527640
score: 1
has comment: http://stackoverflow.com/comment/38527659
has comment: http://stackoverflow.com/comment/38526808
upvote count: 1

http://stackoverflow.com/a/24801862
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24801824
has comment: http://stackoverflow.com/comment/38497243
answers question: http://stackoverflow.com/q/24801824
type: Answer
has body: TestFramework.getLoginPage().Login(username, password); There in that line TestFramework is not an instance and compiler assuming it as a static type. Create an instance of TestFramework and call the method. You might need TestFramework tfWork = new TestFramework(); tfwork.getLoginPage().Login(username, password); assertTrue(tfWork.getLoginPage().CheckIfLoggedIn(username));
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38497180
score: 3

http://stackoverflow.com/q/24853752
type: Question
has answer: http://stackoverflow.com/a/24857613
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/38594332
answer count: 1
downvote count: 0
favorite count: 0
has body: I am trying to use a AlertDialog in my application, but it requires an input to be given. So i was forced to create an interface and override the onAttach() method within my custom DialogFragment class. Once i properly set everything in both the Dialog class and MainActivity, i tried to run my app and it gave me a runtime exception referring to nullpointer among other things. im not sure why this is and i am in need of assistance, please help. Below you will wind the Override of my interface method, the place where my .show() method is called, the code for my DialogFragment class, and my error log lastly. public class MainActivity extends FragmentActivity implements CDia_exp.NDListener { //Integers and Strings for performing calculations int a; int b; static int deci_cnt; int cnt; int temp; Double exp_x; Double exp; Double [] num_trk; String [] op_trk; String num_hold; String op_hold; String del_hold; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //....Lots of other code here....... //Exp_x Button opSet[6].setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(num_hold != "") { cDia_exp.show(getSupportFragmentManager(), "exp_x"); del_hold = tViews[0].getText().toString(); for(int x = num_hold.length() - 1; x &gt;= 0; x--) { del_hold = del_hold.substring(0, del_hold.length() - 1); } num_hold = exp.toString(); tViews[0].setText(del_hold + num_hold); return; } else { return; } } }); } //Objects and Overrides for calling foreign functions CTrim cTrim = new CTrim(); CDia cDia = new CDia(); CDia_exp cDia_exp = new CDia_exp(); EditText exp_inp = (EditText) findViewById(R.id.exp_inp); @Override public void onDPClick(DialogFragment dialog) { exp = Double.parseDouble(num_hold); exp_x = Double.parseDouble(exp_inp.getText().toString()); for(double x = exp_x; x &gt; 0; x--) { exp *= exp; } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate th…
type: UnansweredQuestion
tagged with: dialogfragment
tagged with: android
score: 1
tagged with: java
has title: Dialog Fragment throws null pointer exception after implementing it into MainActivity
upvote count: 1

http://stackoverflow.com/a/24891955
upvote count: 6
has comment: http://stackoverflow.com/comment/38688187
has comment: http://stackoverflow.com/comment/38689030
has comment: http://stackoverflow.com/comment/38689454
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38690426
has comment: http://stackoverflow.com/comment/38689629
has comment: http://stackoverflow.com/comment/38695595
has body: Your IApplication needs to check the return code from PlatformUI.createAndRunWorkbench in the start method: The simplest is: int returnCode = PlatformUI.createAndRunWorkbench(display, advisor); if (returnCode == PlatformUI.RETURN_RESTART) return IApplication.EXIT_RESTART; return IApplication.EXIT_OK; More recent applications seem to use this: private static final String SYSTEM_PROPERTY_EXIT_CODE = "eclipse.exitcode"; int returnCode = PlatformUI.createAndRunWorkbench(display, advisor); if (returnCode == PlatformUI.RETURN_RESTART) { // eclipse.exitcode system property may be set to re-launch if (IApplication.EXIT_RELAUNCH.equals(Integer.getInteger(SYSTEM_PROPERTY_EXIT_CODE))) return IApplication.EXIT_RELAUNCH; return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK;
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/38692870
has comment: http://stackoverflow.com/comment/38688592
has comment: http://stackoverflow.com/comment/38701944
downvote count: 0
answers question: http://stackoverflow.com/q/24890851
accepted answer of: http://stackoverflow.com/q/24890851

http://stackoverflow.com/q/24787047
score: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/24787103
has answer: http://stackoverflow.com/a/24787129
accepted answer: http://stackoverflow.com/a/24787129
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24787159
type: Question
possible better answer: http://stackoverflow.com/a/24787103
has body: I have data in the below format: List&lt;ArrayList&lt;String&gt;&gt; I want to write it to CSV. Below is my code: private static void writeToCSV(List&lt;ArrayList&lt;String&gt;&gt; csvInput) throws IOException{ String csv = "C:\\output.csv"; CSVWriter writer = null; try { writer = new CSVWriter(new FileWriter(csv)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } for(ArrayList&lt;String&gt; each: csvInput){ writer.writeNext(each); } writer.close(); }//end of writeTOCSV The method 'writeNext' allows only String[ ] as it's argument. When I try to type cast 'ArrayList each' into String[] using an Object[ ] as shown below, I am getting run time type casting error: Object[] eachTemp = each.toArray(); writer.writeNext((String[]) eachTemp); Could anyone please tell me where I am going wrong?
tagged with: casting
has title: How to write a List of ArrayLists to CSV format in Java
tagged with: arraylist

http://stackoverflow.com/comment/38416833
type: Comment
comment on: http://stackoverflow.com/q/24759664
type: QuestionComment
has text: Have you checked the [docs](http://docs.oracle.com/javaee/6/api/javax/persistence/FlushModeType.html)?
score: 4

http://stackoverflow.com/q/24873691
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24873902
tagged with: servlets
type: AnsweredQuestion
tagged with: google-cloud-datastore
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24873902
type: Question
tagged with: google-app-engine
has body: Here my problem: I have a .jsp file with the following code: form class="form" action="deleteServlet" method="post"&gt; &lt;% DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Query query = new Query("Notice").addSort("date", Query.SortDirection.DESCENDING); PreparedQuery pq = datastore.prepare(query); for (Entity notice : pq.asIterable()) { String title = (String) notice.getProperty("title"); %&gt; &lt;input type="checkbox" name="selected" value=" &lt;% KeyFactory.keyToString(notice.getKey()); %&gt; " &gt; &lt;%out.println(title); } %&gt; &lt;input type="submit" value="Delete!"&gt; &lt;/form&gt; I do a query on AppEngine datastore to get a list of items. I need to show each of this item with a checkbox, in a way that user can select some of them and delete them from datastore. Logic is managed using a Servlet, in this way: public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); String[] noticesChecked = req.getParameterValues("selected"); for (int i=0; i&lt;noticesChecked.length; i++) { Key noticeKey = KeyFactory.stringToKey(noticesChecked[i]); datastore.delete(noticeKey); } I get, using getParameterValues, an array of selected items. Then, I iterate on them and I try to delete them from datastore. Since I cannot pass to a servlet a Key object, I use KeyFactory.keyToString and KeyFactory.stringToKey to convert to a String and pass it. My problem is that elements in noticesChecked are all empty String "". I checked and notice.getKey gives me correct key. Also keyToString and stringToKey seem to work well. A check on array size tell me that isn't null, but it's correctly related to items checked. However all elements in this array are "". Someone with a similar problem? Any idea about the problem? Where is the mistake? Thanks in advance.
has title: AppEngine/Java: delete items retrieved from checkboxes

http://stackoverflow.com/a/24867725
has comment: http://stackoverflow.com/comment/38644138
has comment: http://stackoverflow.com/comment/38643612
downvote count: 0
has comment: http://stackoverflow.com/comment/38683816
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38642481
answers question: http://stackoverflow.com/q/24866220
has comment: http://stackoverflow.com/comment/38642059
has body: Check out Card Layout Actions for a simple extension of the CardLayout. It provides "Next" and "Previous" actions that you can use to create buttons or menu items and the Actions will automatically be disabled when you are at the end/beginning of the cards.

http://stackoverflow.com/a/24888606
has body: public boolean onCreateMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); return true; } change like this: public boolean onCreateMenu(Menu menu) { MenuInflater inflater = getMenuInflater().inflate(R.menu.addXml, menu); return true; }
type: Answer
has comment: http://stackoverflow.com/comment/38661183
has comment: http://stackoverflow.com/comment/38662161
downvote count: 1
has comment: http://stackoverflow.com/comment/38661310
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/24888559

http://stackoverflow.com/comment/38985777
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24799935
score: 0
has text: I suggest you just try to debug this until you find the source of the error. Look at the stack trace. It tells you which methods are calling each other continuously, it's basically just an infinite loop that never gets broken until the stack is full hence the `StackOverflowError`. Place brake point somewhere in there and then just debug step by step until you find the reason this is behaving as it is. If you cannot find the error, then you are going to have to find another library.

http://stackoverflow.com/a/24869970
answers question: http://stackoverflow.com/q/24869716
has body: Try adding this to your onCreate (you MUST add a new method and call him in your activity, onCreate method must be as clean as you can, it's just a tip.) String url = "http://e-promotion.al/"; WebView view = (WebView) this.findViewById(R.id.webView1); view.getSettings().setJavaScriptEnabled(true); WebSettings settings = view.getSettings(); settings.getJavaScriptEnabled(); settings.getBuiltInZoomControls(); settings.setBuiltInZoomControls(true); // I use that to show a map in my app, you can delete this line if you want. view.setWebViewClient(new WebViewClient()); view.loadUrl(url);
score: 0
type: Answer

http://stackoverflow.com/q/24788197
has body: My REST class: @Path("/Root") public class REST{ @GET @Path("/test") @Produces(MediaType.TEXT_PLAIN) public String testClass() { return "Jersey Test"; } .....etc} My jersey test: public class Test extends JerseyTest { @Override protected AppDescriptor configure(){ System.out.println("Here"); return (new WebAppDescriptor.Builder(REST.class.getPackage().getName()) .contextParam("contextConfigLocation", "application-context-prm-test.xml").build()); } @Override protected TestContainerFactory getTestContainerFactory() { return new GrizzlyWebTestContainerFactory(); } @Test public void testGet(){ WebResource webResource = client().resource("http://localhost:9998/Root/test"); String actual = webResource.getRequestBuilder().get(String.class); System.out.println(actual); } I always seem to get a 404 and I've been stuck with this for four hours now. What am I missing? Thanks SO MUCH!
has comment: http://stackoverflow.com/comment/38471263
score: 0
has comment: http://stackoverflow.com/comment/38471954
has comment: http://stackoverflow.com/comment/38471225
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38470888
has comment: http://stackoverflow.com/comment/38471196
has comment: http://stackoverflow.com/comment/38471162
has comment: http://stackoverflow.com/comment/47826722
has comment: http://stackoverflow.com/comment/38471985
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38471137
has comment: http://stackoverflow.com/comment/38471856
type: Question
tagged with: testing
tagged with: jersey
has title: 404 with Jersey test

http://stackoverflow.com/comment/38521418
score: 0
type: Comment
type: QuestionComment
has text: @user3580294 If one map was a `TreeMap` and the other was a `HashMap` (included example in my answer :-) .
comment on: http://stackoverflow.com/q/24814577

http://stackoverflow.com/a/24871144
upvote count: 1
has body: &lt;pathelement location= ...&gt;: The location attribute specifies a single file or directory relative to the project's base directory (or an absolute filename), while the path attribute accepts colon- or semicolon-separated lists of locations. The path attribute is intended to be used with predefined paths - in any other case, multiple elements with location attributes should be preferred. ..from HERE using &lt;pathelement path="${class.path}" /&gt; should work, unless there are further errors.
answers question: http://stackoverflow.com/q/24870579
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24870579
type: Answer

http://stackoverflow.com/comment/38610165
comment on: http://stackoverflow.com/q/24862005
has text: Have you tried to do ``PdfReader reader = new PdfReader(w_Blob.getBytes(1, w_Blob.length()));`` just to check?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38623263
type: Comment
type: QuestionComment
has text: It didn't throw any errors, but the value never changed from what it was initialized to.
comment on: http://stackoverflow.com/q/24832784
score: 0

http://stackoverflow.com/comment/38655070
comment on: http://stackoverflow.com/a/24884421
has text: If I do that ,It does't take any of parameters entered with script
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24867563
type: AcceptedAnswer
downvote count: 0
has body: This is not a very good design. Show me another professional application that works like this? People don't like to see the size of frames jump. The user is usually resizing the frame to fit the app on their desktop and will get frustrated if they fix the width and the height changes. Let the user control the size. If you want all the buttons to display, then maybe a better solution is to just make the frame non resizable by using: frame.setResizable( false ); frame.pack(); frame.setVisible(); Anyway, if you really want to do this then you would probably add a ComponentListener to the content pane of the frame. Then in the componentResized() method you would invoke pack(). However, this will cause multiple events to be generated every couple of pixels so you may also want to use: Toolkit.getDefaultToolkit().setDynamicLayout( false ); So that the pack() is only done once when the mouse is released.
answers question: http://stackoverflow.com/q/24867154
type: Answer
accepted answer of: http://stackoverflow.com/q/24867154
upvote count: 2
score: 2

http://stackoverflow.com/q/24905615
score: 2
type: AnsweredQuestion
upvote count: 2
has body: When creating JAXB java objects for usage with SOAP webservices/jaxws, is it better - from the design point of view - to fill these objects by constructor, or by their setters? Example: @XmlRootElement Customer { int id; String name; int age; String birthdate; String notes; Address address; } Use either: customer.setId(..); customer.setName(); customer.setAge(); customer.setBirthdate(); customer.setNotes(); customer.setAddress(); or: new Customer(12, "testname", 19, 2014-03-03, "test", new Address("streetname", 12345, "town"));
tagged with: web-services
type: Question
has title: Should soap objects use constructor or setter for creation?
accepted answer: http://stackoverflow.com/a/24910639
tagged with: java
tagged with: jaxb
answer count: 1
downvote count: 0
favorite count: 0
tagged with: soap
has answer: http://stackoverflow.com/a/24910639

http://stackoverflow.com/comment/38406275
score: 0
type: Comment
has text: There is no error in your parsing except the loop, it may happen you are calling this webservice on main thread. Are you using AsynchTask or calling it on main Thread.
type: AnswerComment
comment on: http://stackoverflow.com/a/24754027

http://stackoverflow.com/comment/38601604
score: 1
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example).
comment on: http://stackoverflow.com/q/24853317
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38502268
comment on: http://stackoverflow.com/q/24805148
has text: use curly braces in your else blocks.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38564819
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24838379
has text: I think this should be apparent from even a cursory reading of the Java reference. Does this really merit a SO post?
score: 0

http://stackoverflow.com/q/24823678
has comment: http://stackoverflow.com/comment/38537643
has comment: http://stackoverflow.com/comment/38586447
has answer: http://stackoverflow.com/a/24849726
has title: Passing value from jsp to Action for java.util.Set
has comment: http://stackoverflow.com/comment/38563410
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24824188
tagged with: java
has comment: http://stackoverflow.com/comment/38546835
linked to: http://stackoverflow.com/q/24186111
has comment: http://stackoverflow.com/comment/38538586
has comment: http://stackoverflow.com/comment/38586026
type: Question
has body: I want to set values for Set elements of login from JSP . JSP page: Company Name <s:textfield name="name" value="%{name}" id="name"/> Address <s:textarea name="address" value="%{address}" id="address"/> User Name <s:textfield name="logins[0].userName" value="%{logins[0].userName}" id="userName"/> User Id <s:textfield name="logins[0].userId" value="%{logins[0].userId}" id="userId"/> Mail Id <s:textfield name="logins[0].userMailid" value="%{logins[0].userMailid}" id="userMailid"/> Pojo Classes: public class Client implements java.io.Serializable { private Set logins = new HashSet(0); //getter and setter } public class Login implements java.io.Serializable { private Long id; private Client client; private String userId; private String userName; private String userMailid; } Action Class: public String register() { Client cl = new Client(); System.out.println(cl.getName() + " " + cl.getAddress()); } I want to set values of set in to my Action class for Client and Login. How to do this?
has comment: http://stackoverflow.com/comment/38537593
answer count: 2
tagged with: ognl
tagged with: jsp
tagged with: struts2
tagged with: type-conversion
score: 0
has comment: http://stackoverflow.com/comment/38561322
linked to: http://stackoverflow.com/q/23470075
has comment: http://stackoverflow.com/comment/38538811

http://stackoverflow.com/comment/38590685
comment on: http://stackoverflow.com/a/24848153
type: Comment
has text: @StephenC Kindly look at this [link](http://www.geeksforgeeks.org/counting-sort/) and read second line.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24811012
has comment: http://stackoverflow.com/comment/38514507
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38522107
has comment: http://stackoverflow.com/comment/38513593
answers question: http://stackoverflow.com/q/24810904
has comment: http://stackoverflow.com/comment/38514552
has body: It looks like you do not have an OnItemClickListener mylist.setOnItemClickListener(this); @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View arg1, int pos, long arg3) { switch (pos){ case 0: aerospace = true; break; case 1: agricultural = true; break; ......etc } }

http://stackoverflow.com/comment/106932354
has text: @ROMANIA_engineer, Can I run and test above code online. Please suggest a website.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26834494
type: AnswerComment

http://stackoverflow.com/comment/38665283
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24857994
has text: I have updated the program with your suggestions and I have added a function that prompts the user to re-enter their password and compares the password with the password entered first. However I am unable to find why the program keeps prompting for the re-enter password stage. If you could take a look that would help a lot!

http://stackoverflow.com/a/62929064
score: 10
upvote count: 10
type: Answer
has body: To do a proper null check of a JsonNode field: JsonNode jsonNode = response.get("item"); if(jsonNode == null || jsonNode.isNull()) { } The item is either not present in response, or explicitly set to null .
downvote count: 0
answers question: http://stackoverflow.com/q/24899554

http://stackoverflow.com/comment/38563470
type: AnswerComment
has text: getConnection("jbdc:mysql://localhost:3306/tours" getConnection("jdbc:mysql://localhost:3306/tours"
type: Comment
comment on: http://stackoverflow.com/a/24837287
score: 0

http://stackoverflow.com/q/24791908
type: UnansweredQuestion
has body: On Windows installed newest version of grails 2.4.2(java 1.7), created a new project. When run app it fails to resolve dependencies. I'm not behind proxy. Below the stacktrace: Error | Resolve error obtaining dependencies: Failed to read artifact descriptor for xalan:serializer:jar:2.7.1 (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for xalan:serializer:jar:2.7.1 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:370) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:525) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:509) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254) at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316) at grails.util.BuildSettings.doResolve(BuildSettings.groovy:514) at grails.util.BuildSettings.doResolve(BuildSettings.groovy) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270) at grails.util.BuildSettings$_getDefaultBuildDependencies_closure19.doCall(BuildSettings.groovy:775) at grails.util.BuildSettings$_getDefaultBuildDependencies_closure19.doCall(BuildSetting…
score: 2
upvote count: 2
tagged with: maven
type: Question
tagged with: java
tagged with: grails
has answer: http://stackoverflow.com/a/24791983
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38479057
has answer: http://stackoverflow.com/a/68849212
favorite count: 0
has title: Grails new project cant resolve dependencies

http://stackoverflow.com/comment/38489258
type: QuestionComment
score: 0
has text: Possible for `List<String>`, but think about other types.
type: Comment
comment on: http://stackoverflow.com/q/24797857

http://stackoverflow.com/q/24883154
has comment: http://stackoverflow.com/comment/38650132
score: 3
has comment: http://stackoverflow.com/comment/38650251
has answer: http://stackoverflow.com/a/24883519
tagged with: servlets
tagged with: response
answer count: 3
has answer: http://stackoverflow.com/a/24883529
accepted answer: http://stackoverflow.com/a/24883529
downvote count: 0
has title: How to send request and proceed response, and send back to Client?
favorite count: 0
has body: A Client calls the Servlet via a HTTP Request (via the Browser, post), then the Servlet should send a request (get) to a external Website, and receive the response (post) from the Website. The Servlets proceed the response and sends a response (post) to the Client. My question is how to send and receive a request/response inside a Servlet and send something back to the Client?
has answer: http://stackoverflow.com/a/38011222
possible better answer: http://stackoverflow.com/a/24883519
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: request
type: Question

http://stackoverflow.com/comment/38443630
comment on: http://stackoverflow.com/q/24773739
has text: @Dev so your question also include How to create such a data structure ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/24907492
tags question: http://stackoverflow.com/q/24844753
tags question: http://stackoverflow.com/q/24863321
tags question: http://stackoverflow.com/q/24799369
tags question: http://stackoverflow.com/q/24763623
tags question: http://stackoverflow.com/q/24751454
tags question: http://stackoverflow.com/q/24884967
tags question: http://stackoverflow.com/q/24751695
tags question: http://stackoverflow.com/q/24831477
tags question: http://stackoverflow.com/q/24908251
tags question: http://stackoverflow.com/q/24798568
tags question: http://stackoverflow.com/q/24869716
tags question: http://stackoverflow.com/q/24871473
tags question: http://stackoverflow.com/q/24902248
tags question: http://stackoverflow.com/q/24760796
tags question: http://stackoverflow.com/q/24834743
tags question: http://stackoverflow.com/q/24757819
tags question: http://stackoverflow.com/q/24822953
tags question: http://stackoverflow.com/q/24823073
type: Tag
tags question: http://stackoverflow.com/q/24850780
tags question: http://stackoverflow.com/q/24894518
tags question: http://stackoverflow.com/q/24784506
tags question: http://stackoverflow.com/q/24826105
tags question: http://stackoverflow.com/q/24861464
tags question: http://stackoverflow.com/q/24797085
tags question: http://stackoverflow.com/q/24863956
tags question: http://stackoverflow.com/q/24895551
tags question: http://stackoverflow.com/q/24900478
tags question: http://stackoverflow.com/q/24894689
tags question: http://stackoverflow.com/q/24831071
tags question: http://stackoverflow.com/q/24854100
tags question: http://stackoverflow.com/q/24860770
tags question: http://stackoverflow.com/q/24851643
tags question: http://stackoverflow.com/q/24894108
tags question: http://stackoverflow.com/q/24833273
tags question: http://stackoverflow.com/q/24872809
tags question: http://stackoverflow.com/q/24798884
tags question: http://stackoverflow.com/q/24900594
tags question: http://stackoverflow.com/q/24900769
tags question: http://stackoverflow.com/q/24827858
tags question: http://stackoverflow.com/q/24829267
tags question: http://stackoverflow.com/q/24796981
tags question: http://stackoverflow.com/q/24864424
tags question: http://stackoverflow.com/q/24773391
tags question: http://stackoverflow.com/q/24818483
tags question: http://stackoverflow.com/q/24874328
tags question: http://stackoverflow.com/q/24860448
tags question: http://stackoverflow.com/q/24772433
tags question: http://stackoverflow.com/q/24851581
tags question: http://stackoverflow.com/q/24808314
tags question: http://stackoverflow.com/q/24838284
tags question: http://stackoverflow.com/q/24865551
tags question: http://stackoverflow.com/q/24881057
tags question: http://stackoverflow.com/q/24870681
tags question: http://stackoverflow.com/q/24833777
tags question: http://stackoverflow.com/q/24895549
tags question: http://stackoverflow.com/q/24853395
tags question: http://stackoverflow.com/q/24895403
tags question: http://stackoverflow.com/q/24786793
tags question: http://stackoverflow.com/q/24906653
tags question: http://stackoverflow.com/q/24764687
tags question: http://stackoverflow.com/q/24800777
tags question: http://stackoverflow.com/q/24876045
tags question: http://stackoverflow.com/q/24755162
tags question: http://stackoverflow.com/q/24752615
tags question: http://stackoverflow.com/q/24865758
tags question: http://stackoverflow.com/q/24764981
tags question: http://stackoverflow.com/q/24798687
tags question: http://stackoverflow.com/q/24779401
tag name: xml
tags question: http://stackoverflow.com/q/24817011
tags question: http://stackoverflow.com/q/24833710
tags question: http://stackoverflow.com/q/24774130
tags question: http://stackoverflow.com/q/24822860
tags question: http://stackoverflow.com/q/24753497
tags question: http://stackoverflow.com/q/24905513
tags question: http://stackoverflow.com/q/24864199
tags question: http://stackoverflow.com/q/24908711
tags question: http://stackoverflow.com/q/24792032

http://stackoverflow.com/a/24753072
type: Answer
downvote count: 1
has body: You should be using SwipeRefreshLayout, newly released in the latest support library from Google. Since Chris Banes's it deprecated and will no longer by maintained by him. Also this library will give you the desired effect of bouncing back to it´s original position if the user doesn't pull it all the way down. Here you have a example of how to use it. XML view &lt;android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;ScrollView android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;TextView android:text="@string/hello_world" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center"/&gt; &lt;/ScrollView&gt; &lt;/android.support.v4.widget.SwipeRefreshLayout&gt; Java code @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); swipeLayout.setOnRefreshListener(this); swipeLayout.setColorScheme(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); } @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { swipeLayout.setRefreshing(false); } }, 5000); }
score: -1
has comment: http://stackoverflow.com/comment/139672554
answers question: http://stackoverflow.com/q/24751466
upvote count: 0

http://stackoverflow.com/comment/38841306
has text: Why do you feel that you need to do this? I would normally take a [Tell, don't Ask](http://pragprog.com/articles/tell-dont-ask) approach.
comment on: http://stackoverflow.com/q/24778774
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38602638
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24857681
type: Comment
has text: `But at the end all the classes are loaded by the Bootstrap.` is not true, the bootstrap class loader is an integral part of the JVM and is responsible for loading trusted classes (e.g. basic Java class library classes). Also `ClassLoader first check if the class has been loaded, if not then immediately delegate this check to its parent ClassLoader`, is not always true, The class loaders used to load servlets in a servlet engine (e.g. Tomcat), for example, are developed in such a way that they attempt to load a class directly before delegating the request.

http://stackoverflow.com/comment/38517661
score: 0
type: Comment
type: QuestionComment
has text: when you iterate over the list you iterate over Pair, so use .getT()
comment on: http://stackoverflow.com/q/24813117

http://stackoverflow.com/q/24840217
has comment: http://stackoverflow.com/comment/38568089
has answer: http://stackoverflow.com/a/24840442
has comment: http://stackoverflow.com/comment/38568113
has comment: http://stackoverflow.com/comment/38568151
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24840244
tagged with: oop
has answer: http://stackoverflow.com/a/24840318
has answer: http://stackoverflow.com/a/24840244
has title: OOP - Who can access to public, private, protected variable?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38568094
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38568149
has comment: http://stackoverflow.com/comment/38568186
tagged with: pseudocode
linked to: http://stackoverflow.com/q/4361553
accepted answer: http://stackoverflow.com/a/24840318
has body: I'm new to OOP. Look at following pseudo code: Class Test{ public String a; protected String b; private String c; public void aa(){} protected void bb(){} private void cc(){} Class Test2{ private void dd(){} } } Class Test3 extends Test{ private void ee(){} } Class Test4{ private void ff(){} } Can a, b and c access into aa(), bb() and cc()? Can a, b and c access into the class Test2 and dd()? Is true that only a and b can access into the class Test3 and ee()? Is true that only a can access into the class Test4 and ff()?
linked to: http://stackoverflow.com/q/215497
answer count: 3
has comment: http://stackoverflow.com/comment/38568218
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24834702
tagged with: exception
has comment: http://stackoverflow.com/comment/38558926
possible better answer: http://stackoverflow.com/a/24836663
has answer: http://stackoverflow.com/a/24845697
has comment: http://stackoverflow.com/comment/38563253
has answer: http://stackoverflow.com/a/24836663
has comment: http://stackoverflow.com/comment/38561245
type: AnsweredQuestion
has body: Thread.UncaughtExceptionHandler states that when the method which handles uncaught exceptions itself throws an exception, that exception will be ignored: void uncaughtException(Thread t, Throwable e): Method invoked when the given thread terminates due to the given uncaught exception. Any exception thrown by this method will be ignored by the Java Virtual Machine. However when I tested it, the JVM did not ignore the exceptions handled by the uncaught exception handler`: public static void main(final String args[]) { Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread arg0, Throwable arg1) { throw new java.lang.RuntimeException("e2"); } }); throw new RuntimeException("e1"); } Eclipse Console output (JRE 1.7): Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "main" Another oddity I found out is that the output I get isn't coming from System.err. It seems to be from another stream altogether. I verified this by redirecting System.err to System.out, but I'm still getting "red" output: public static void main(final String[] args) { System.setErr(System.out); System.out.println(System.err == System.out); System.err.println("this is black color"); try { throw new Error("test stacktrace color"); } catch (Throwable e) { e.printStackTrace(); } try { Thread.sleep(2500); } catch (InterruptedException e) { e.printStackTrace(); } Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { throw new RuntimeException("from handler"); } }); throw new RuntimeException("from main"); } The output (bolded signifies red color): true this is black color java.lang.Error: test stacktrace color at asf.df.main(df.java:13) Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "main" What's the explanation for these phenomenons? What happens …
has comment: http://stackoverflow.com/comment/38559936
has comment: http://stackoverflow.com/comment/38558387
tagged with: java
accepted answer: http://stackoverflow.com/a/24845697
has comment: http://stackoverflow.com/comment/38558346
has title: Do errors thrown within UncaughtExceptionHandler get swallowed?
linked to: http://stackoverflow.com/q/7240872
score: 9
type: Question
upvote count: 9
answer count: 2
tagged with: uncaught-exception
downvote count: 0
tagged with: uncaughtexceptionhandler
tagged with: jvm
favorite count: 0

import
tags question: http://stackoverflow.com/q/24881196
type: Tag
tags question: http://stackoverflow.com/q/24755439
tags question: http://stackoverflow.com/q/24759252
tag name: import
tags question: http://stackoverflow.com/q/24831183
tags question: http://stackoverflow.com/q/24846909
tags question: http://stackoverflow.com/q/24800886
tags question: http://stackoverflow.com/q/24820325
tags question: http://stackoverflow.com/q/24775118
tags question: http://stackoverflow.com/q/24803143
tags question: http://stackoverflow.com/q/24892217

http://stackoverflow.com/q/24808000
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
tagged with: system
has answer: http://stackoverflow.com/a/24808163
has comment: http://stackoverflow.com/comment/38508035
answer count: 1
has body: As we know libraries are precompiled programs. So, can libraries of a language be used by other languages? If so, how can I call a C library function from Java?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Calling library functions from different language
tagged with: java
tagged with: libraries
has comment: http://stackoverflow.com/comment/38508036
type: Question
score: 2
tagged with: function

http://stackoverflow.com/comment/38652476
has text: _Doe this mean I need to decouple it and pass in each class as a parameter to the method?_ That would be a good way to solve this, yes.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24884555

http://stackoverflow.com/q/24765499
upvote count: 0
has comment: http://stackoverflow.com/comment/38428352
downvote count: 5
tagged with: nullpointerexception
tagged with: exception
tagged with: android
has answer: http://stackoverflow.com/a/24766084
answer count: 1
favorite count: 0
has body: When i run my application on my device there is this error: LOGCAT 07-15 14:09:00.808: E/AndroidRuntime(1831): FATAL EXCEPTION: main 07-15 14:09:00.808: E/AndroidRuntime(1831): Process: com.example.findmycar, PID: 1831 07-15 14:09:00.808: E/AndroidRuntime(1831): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.findmycar/com.findmycar.activity.PosizioneAttualeActivity}: java.lang.NullPointerException 07-15 14:09:00.808: E/AndroidRuntime(1831): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 07-15 14:09:00.808: E/AndroidRuntime(1831): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 07-15 14:09:00.808: E/AndroidRuntime(1831): at android.app.ActivityThread.access$800(ActivityThread.java:135) 07-15 14:09:00.808: E/AndroidRuntime(1831): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 07-15 14:09:00.808: E/AndroidRuntime(1831): at android.os.Handler.dispatchMessage(Handler.java:102) 07-15 14:09:00.808: E/AndroidRuntime(1831): at android.os.Looper.loop(Looper.java:136) 07-15 14:09:00.808: E/AndroidRuntime(1831): at android.app.ActivityThread.main(ActivityThread.java:5017) 07-15 14:09:00.808: E/AndroidRuntime(1831): at java.lang.reflect.Method.invokeNative(Native Method) 07-15 14:09:00.808: E/AndroidRuntime(1831): at java.lang.reflect.Method.invoke(Method.java:515) 07-15 14:09:00.808: E/AndroidRuntime(1831): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 07-15 14:09:00.808: E/AndroidRuntime(1831): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 07-15 14:09:00.808: E/AndroidRuntime(1831): at dalvik.system.NativeStart.main(Native Method) 07-15 14:09:00.808: E/AndroidRuntime(1831): Caused by: java.lang.NullPointerException 07-15 14:09:00.808: E/AndroidRuntime(1831): at com.findmycar.activity.PosizioneAttualeActivity.onLocationChanged(PosizioneAttualeActivity.java:264) 07-15 14:09:00.808: E/AndroidRuntime(1831): at c…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38428442
score: -5
tagged with: java
type: Question
has title: Fatal exception main: a method does not work
has comment: http://stackoverflow.com/comment/38427999
has comment: http://stackoverflow.com/comment/38427497

http://stackoverflow.com/comment/38399546
type: QuestionComment
has text: It is google reflections API. It is scanning classes from my class path. I am running this in eclipse.
score: 1
comment on: http://stackoverflow.com/q/24750230
type: Comment

http://stackoverflow.com/comment/38529805
type: AnswerComment
type: Comment
has text: However, you do not need to fully unzip the outer file before unzipping the internal one; you could read through the outer zip until you find the entry for the inner one, and unzip *that*.
score: 0
comment on: http://stackoverflow.com/a/24817759

http://stackoverflow.com/a/24770031
has comment: http://stackoverflow.com/comment/38436713
type: Answer
has comment: http://stackoverflow.com/comment/38436635
score: 3
has comment: http://stackoverflow.com/comment/38436889
upvote count: 3
has body: Why not simply use Date#compareTo() for the comparison since java.util.Date implements the Comparable interface. It is not necessary for the method to return an instance of the List after it is sorted because the underlying List object will be modified by invoking sort. Basically, the method is invoked by passing a reference value as an argument. So when modifications are made, the changes are reflected on the underlying object pointed to by the reference value. With this approach, the code simply passes the List into the method and then continues using the same reference in the proceeding code, which will point to an underlying List which has been sorted. Another item to consider is modifying the method to accept an argument of the type Listas opposed to ArrayList, since List is an interface, hence more abstract. This would allow the code to switch the implementation of List being passed to the method. This is important because ArrayList does not guarantee the order of the items in the list is maintained. To guarantee the order of items in the List is maintained used LinkedList. static public void sortArrayByDate(List&lt;Artist&gt; list) { Collections.sort(list, new Comparator&lt;Artist&gt;() { @Override public int compare(Artist lhs, Artist rhs) { return lhs.getDate().compareTo(rhs.getDate()); } }); } Here is a GitHub Gist I created, that show this method in action, with a complete working example.
has comment: http://stackoverflow.com/comment/38437135
has comment: http://stackoverflow.com/comment/38436849
has comment: http://stackoverflow.com/comment/38436917
has comment: http://stackoverflow.com/comment/38437151
has comment: http://stackoverflow.com/comment/38436861
accepted answer of: http://stackoverflow.com/q/24769988
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24769988
has comment: http://stackoverflow.com/comment/38449644

http://stackoverflow.com/comment/38579434
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24846094
has text: Yeah I suppose I've been putting off learning about `FragmentManager` for too long now. Guess I'll start on that next. Thanks

http://stackoverflow.com/comment/38410735
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24752404
has text: Still I find it dubious to wrap a `ResourceHttpRequestHandler` in a controller. You could check the status code for the response but that is about it what you can do, the request is already handled by the `ResourceHttpRequestHandler` itself so there isn't anything you can do about it.

http://stackoverflow.com/q/24827358
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/38603554
has comment: http://stackoverflow.com/comment/38544524
tagged with: shell
linked to: http://stackoverflow.com/q/525212
tagged with: unix
favorite count: 0
has comment: http://stackoverflow.com/comment/38544415
upvote count: 2
has comment: http://stackoverflow.com/comment/38544395
has title: Running a Shell script from Java progam not picking up Environment variables
tagged with: java
has comment: http://stackoverflow.com/comment/38603517
has comment: http://stackoverflow.com/comment/38544670
score: 2
has body: I have a java program which executes a shell script. The shell script involves many environment variables in it($HOME). When executing the command from shell, it is working fine. An echo $HOME is giving me the actual path to the command. (The script changes paths and executes commands from changed paths) $cat nightly.sh #!/bin/bash ... echo $HOME ... echo "end of script" I see /home/ when executed from the shell at appropriate place. Now I invoke the same shell script from java program by, static Proces p; ... Runtime instance = Runtime.getRuntime(); p = instance.exec(nightly.sh + " " + branch + " " + stack + " " + profile, null, new File(/home/bmanoj/fps/workspaces/APRIL14REL1/testing/integration-tests/regressions)); Now I am capturing the output from the shell to a external file. When I go see the file "echo $HOME" is resulting to a empty line. For that matter I am constructing many relative paths based on the $HOME variable. So nothing in the script works for me now. Why is it like that? Why isn't the instance invoked by java program not picking up the environment variables? To exactly mock the script as it executes on the shell from the java program what has to be done?
downvote count: 0
answer count: 0
type: UnansweredQuestion
tagged with: linux

http://stackoverflow.com/comment/38469254
score: 0
type: Comment
type: QuestionComment
has text: @leony I really don't get what you want. There is no such method (`fixAfterInsertion`) in Java TreeMap (neither public not private). Anyways, for accessing private methods using java reflection have a look at this link: http://stackoverflow.com/questions/880365/any-way-to-invoke-a-private-method
comment on: http://stackoverflow.com/q/24767261

http://stackoverflow.com/a/24774469
has body: Problem is with your code, In first case you are calling a method String#toString() which does not have any parameters and it gets called successfully. In second case you are calling Object#equals() method which expects one argument as well so you need to pass that argument value as well while using m.invoke(), so your code should be for second case m.invoke(obj,new Object[]{&lt;object to be compared&gt;}); and for fist case this will suffice m.invoke(obj,null); Hope this helps. EDIT You should write it something like this: Method m = null; if(null !=signature &amp;&amp; !signature.isEmpty()) { m = obj.getClass().getMethod(method, parameterTypes); } else { m = obj.getClass().getMethod(method); arguments = null; } Object response = m.invoke(obj, arguments); return response;
accepted answer of: http://stackoverflow.com/q/24773592
has comment: http://stackoverflow.com/comment/38444799
answers question: http://stackoverflow.com/q/24773592
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38453931
has comment: http://stackoverflow.com/comment/38455819
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/38455010
has comment: http://stackoverflow.com/comment/38454423

http://stackoverflow.com/q/24751929
has comment: http://stackoverflow.com/comment/38402045
tagged with: https
has answer: http://stackoverflow.com/a/24752715
type: Question
accepted answer: http://stackoverflow.com/a/24752715
has comment: http://stackoverflow.com/comment/38402052
type: AnsweredQuestion
tagged with: java
tagged with: ssl
has body: I am new to code signing and certificates. Short description: I connect to a Alfresco repository to download some documents to the client using OpenCMIS. Everything is working fine until I tested is with our test server which uses SSL (HTTPS Url) connections. Here I get an exception sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target I have no experience with such things and dont know what I have to do so my application is running properly? I have read I have to use the certificate or a truststore or something? But what exactly I need to do? Can someone help me please? EDIT: I should have mentioned that I am developing a java web start application. Is there a solution in which I dont have to manually install the certificate to the local truststore? EDIT2: Okay since I have to import the certificate on every computer this is no longer an option and I will use the workaround which ignores the verification of the certificate. Thank you anyways guys!!!
answer count: 1
tagged with: ssl-certificate
score: 0
has title: What do I need for a java SSL (HTTPS) connection
has comment: http://stackoverflow.com/comment/38402322
tagged with: cmis

http://stackoverflow.com/comment/38671230
type: QuestionComment
comment on: http://stackoverflow.com/q/24891347
has text: Can you say more? Are you using tomcat or jetty or jboss? Does it happen with the base installation or does it require having a particular web app loaded?
score: 0
type: Comment

http://stackoverflow.com/q/24847719
has comment: http://stackoverflow.com/comment/38583700
tagged with: android
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38587267
tagged with: java
has body: After configuring the AOSP fully. I tried to build it using make -j4. But I got the below error: ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.0.4 TARGET_PRODUCT=full TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a HOST_ARCH=x86 HOST_OS=linux HOST_BUILD_TYPE=release BUILD_ID=IMM76 ============================================ Checking build tools versions... ************************************************************ You are attempting to build with the incorrect version of java. Your version is: java version "1.7.0_55". The correct version is: Java SE 1.6. It is trying to build 4.0.4, not the Android-L. Thats why it is asking for Java 6, because java 6 is needed for building 4.0.4. How do I build for Android-L which can be build with Java-7? I want to contribute to AOSP. For which I only need latest AOSP master branch to be build not the older versions. Any help would be great. Thanks.
type: Question
tagged with: android-source
upvote count: 2
answer count: 1
has title: How do I build latest AOSP?
favorite count: 0
has answer: http://stackoverflow.com/a/24867362
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38583002

http://stackoverflow.com/comment/38568287
score: 0
has text: I don't really understand what you're asking Jimmy. Beny, the first_name and last_name have to be filled, and will be added to the array as the first and second entry so membersDetails.get(0) and membersDetails.get(1) should get the compulsory first and last name entries?
type: Comment
comment on: http://stackoverflow.com/q/24840038
type: QuestionComment

http://stackoverflow.com/comment/38491994
score: 0
type: QuestionComment
has text: how do i open a particular path.. like option batch abort option confirm off open sftp://user@example.com/ put examplefile.txt /home/user/ exit This is a winscp script how do i make java do this ??
comment on: http://stackoverflow.com/q/24798881
type: Comment

http://stackoverflow.com/q/24887803
tagged with: swing
downvote count: 1
tagged with: excel
tagged with: java
has comment: http://stackoverflow.com/comment/38684042
has comment: http://stackoverflow.com/comment/38659126
type: Question
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/38697502
has body: I have a fairly simple program that once some data is entered into a JTable it can then be exported or "saved" to an excel spreadsheet. All of this is working fine and it is making a saved excel file perfectly. The problem I have run into is this: When you try to put the excel file in a subfolder of, say, the desktop folder (desktop/folder) it saves it on the desktop instead; but it only does this on macs. When I do this on a windows computer it works 100% of the time. I was wondering if anyone has any insight into the problem or a fix for this? This is my JFileChooser code which would in theory be causing the problem. JFileChooser fc = new JFileChooser(); fc.setSelectedFile(new File(jTextField3.getText() + jTextField6.getText() + "-" + jTextField7.getText() + "-" + jTextField8.getText())); int option = fc.showSaveDialog(PScalcUI.this); if(option == JFileChooser.APPROVE_OPTION){ String filename = fc.getSelectedFile().getName(); String path = fc.getSelectedFile().getParentFile().getPath(); int len = filename.length(); String ext = ""; String file = ""; if(len &gt; 4){ ext = filename.substring(len-4, len); } if(ext.equals(".xls")){ file = path + "\\" + filename; }else{ file = path + "\\" + filename + ".xcl"; } toExcel(jTable1, new File(file)); }
answer count: 1
tagged with: filechooser
has title: File chooser is picking the wrong directory for exporting
favorite count: 0
has answer: http://stackoverflow.com/a/24905019
has comment: http://stackoverflow.com/comment/38691335
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/24831559
accepted answer of: http://stackoverflow.com/q/24831443
score: 1
has comment: http://stackoverflow.com/comment/38553701
type: AcceptedAnswer
downvote count: 0
has body: ID is a function that returns the internal id of a node or relationship, but in your query you use it as if it were a property on a node. The way to match a node by its internal id is MATCH (n) WHERE ID (n) = {id} In your delete case you could do MATCH (n:Player)-[r]-() WHERE ID (n) = {id} DELETE r, n You can't assign the internal id to a node, Neo4j handles that internally, so it doesn't really make sense to use the ID function with MERGE. You can choose a different uniquely identifying property that you control and for which you create a unique constraint, then use that in most (probably all) places where you now use the internal id.
has comment: http://stackoverflow.com/comment/38553369
has comment: http://stackoverflow.com/comment/38673115
type: Answer
answers question: http://stackoverflow.com/q/24831443
has comment: http://stackoverflow.com/comment/38555111
upvote count: 1

http://stackoverflow.com/a/24812825
has comment: http://stackoverflow.com/comment/38517153
has comment: http://stackoverflow.com/comment/38517311
has comment: http://stackoverflow.com/comment/38517103
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/24812770
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/24812770
has body: You need the (?s) flag too (DOTALL mode) to make . match line terminators. This finds a match: Pattern lineDividerGuessMatchPattern = Pattern.compile("(?msi)(^from:)(.*?)(^sent:)");
downvote count: 0

http://stackoverflow.com/q/24757834
has title: Spring Webservices: Error in WSDL ("use" attribute of soap:body empty)
tagged with: java
has answer: http://stackoverflow.com/a/24758453
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38413864
answer count: 1
tagged with: wsdl
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
tagged with: spring
has comment: http://stackoverflow.com/comment/38412968
has body: I have a question on WSDL generation with DefaultWsdl11Definition from Spring Webservices 1.5: There is a set of abount 50 webservice methods and its request and response types. In I see, that the "use" attribute of "" is empty. &lt;wsdl:operation name="SuspiciousOperation"&gt; &lt;soap:operation soapAction=""/&gt; &lt;wsdl:input name="SuspiciousOperationRequest"&gt; &lt;soap:body use=""/&gt; &lt;!-- here is the error! --&gt; &lt;/wsdl:input&gt; &lt;wsdl:output name="SuspiciousOperationResponse"&gt; &lt;soap:body use="literal"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; This leads to an error in the clients. Here is the fragement of the XSD file defining the request and response types: &lt;xs:element name="SuspiciousOperationRequest"&gt; &lt;xs:complexType&gt; &lt;xs:all&gt; &lt;xs:element name="someID" type="xs:int" /&gt; &lt;/xs:all&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="SuspiciousOperationResponse"&gt; &lt;xs:complexType /&gt; &lt;/xs:element&gt; Can someone explain, what causes this error? Best regards, Markus

http://stackoverflow.com/a/24996416
has body: try to edit your eclipse.ini file like this: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.GTK_version 2 --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms40m -Xmx512m
answers question: http://stackoverflow.com/q/24872995
type: Answer
has comment: http://stackoverflow.com/comment/40308408
upvote count: 10
score: 10
downvote count: 0

http://stackoverflow.com/comment/38607855
score: 0
type: Comment
has text: I edited but still have the same problem... 1 message instead of 3 :(
type: AnswerComment
comment on: http://stackoverflow.com/a/24860682

http://stackoverflow.com/a/24890522
downvote count: 1
answers question: http://stackoverflow.com/q/24890351
has comment: http://stackoverflow.com/comment/38664129
upvote count: 0
has body: In Spring MVC you have to apply ; 1- index.jsp in WEB-INF 2- property names for index.jsp in view.xml 3- Controller for property names 4- mapping for controller in servlet.xml If you want use @RequestParam in a project you need ; -Form action in jsp -Class for variables -Controller for form variables.
has comment: http://stackoverflow.com/comment/38664414
score: -1
type: Answer

http://stackoverflow.com/q/24861983
has title: Remove last row from JPanel set with GridLayout
tagged with: jpanel
has comment: http://stackoverflow.com/comment/38611505
score: 0
tagged with: grid-layout
answer count: 1
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/38612906
has body: I have a JPanel which has GridLayout as the layout. I have a plus button at the end of the Main Panel to add some panels to the grid. I need a minus button that subsequently removes the last row added to the grid. I saw the docs related and it shows removeAll() method, which is not useful for me as I need to remove only the last row. Also it shows some remove(int index). Again I am unaware of the index of the last row, though I tried doing this: myPanel.remove(0); but this removes the first row.
linked to: http://stackoverflow.com/q/6988317
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38613487
has comment: http://stackoverflow.com/comment/38611109
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/27386784

http://stackoverflow.com/a/24756348
accepted answer of: http://stackoverflow.com/q/24750092
type: Answer
upvote count: 6
score: 6
has body: In a way it is a workaround. Creating arrays of non-reifiable component type is unsafe. Therefore such array creation expressions are disallowed by the compiler: // List&lt;String&gt; is erased to List =&gt; disallowed Object example = new List&lt;String&gt;[] { null, null }; // List&lt;?&gt; is effectively reifiable =&gt; allowed Object example = new List&lt;?&gt;[] { null, null }; Yet, hidden array creations via variable arity methods, such as Arrays.asList, are allowed. // RHS amounts to Arrays.asList(new List&lt;String&gt;[] { null, null }) List&lt;List&lt;String&gt;&gt; example = Arrays.asList(null, null); Since you disallowed this array creation, your heap can no longer be polluted. But: How are you ever going to call that constructor? Please note that your constructor may not pollute the heap at all. The only way it does is if it converts the array to a less specifc type (i.e. MyObject&lt;?&gt;[] or Object[]) or it lets the array escape somehow (i.e. assigning it to a field and returning from a getter or passing it to a potentially unsafe method). If you do neither you can mark the constructor as having @SafeVarargs and the warning goes away.
answers question: http://stackoverflow.com/q/24750092
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38669853
has text: @thkala no logs are captured in /var/log/messages
type: Comment
comment on: http://stackoverflow.com/q/24891347
score: 0
type: QuestionComment

http://stackoverflow.com/a/24773043
has comment: http://stackoverflow.com/comment/38441771
has comment: http://stackoverflow.com/comment/38441764
score: 0
has comment: http://stackoverflow.com/comment/38441796
type: Answer
has body: You can loop over the characters in the string one by one and sum each char that is a number: public static int sumInts(String str) { int sum = 0; for (char c : str.toCharArray()) { if (Character.isDigit(c)) { sum += Character.getNumericValue(c); } } return sum; }
answers question: http://stackoverflow.com/q/24772894
has comment: http://stackoverflow.com/comment/38441893

http://stackoverflow.com/comment/38691337
type: Comment
has text: Tej Kiran Think you think you think you are the best
comment on: http://stackoverflow.com/a/24903132
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38470290
score: 0
type: QuestionComment
type: Comment
has text: Show the com.company.GetDBInfo class and where its being refered.
comment on: http://stackoverflow.com/q/24786090

http://stackoverflow.com/q/24756191
tagged with: model-view-controller
tagged with: java
has answer: http://stackoverflow.com/a/24756327
type: Question
answer count: 1
tagged with: jsp
score: 0
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
has title: jsp file not applying styles of linked css files
tagged with: css
has body: I am using a controller to serve my index.jsp page. When I type: http://localhost:8080/Driving-Instructor-Gary/HomeController?page=home It loads the index.jsp file fine using this code: package uk.co.morleys; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class HomeController */ @WebServlet("/HomeController") public class HomeController extends HttpServlet { private static final long serialVersionUID = 1L; public HomeController() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String page = request.getParameter("page"); String views = "/WEB-INF/views/"; switch (page){ case "home": RequestDispatcher rd = getServletContext().getRequestDispatcher(views + "index.jsp"); rd.forward(request, response); break; } } } The problem is that the css styling is not being applied to the webpage. Here is the css file linking in index.jsp document: Morley's Motoring Mentoring <!--[if lt IE 9]> <![endif]--> Here is the file structure of the project: Why is the styling not being applied?

http://stackoverflow.com/comment/38444824
comment on: http://stackoverflow.com/q/24773248
score: 0
has text: Please share the relevant HTML code
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24903941
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/38689622
linked to: http://stackoverflow.com/q/3716116
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38689513
tagged with: android
has comment: http://stackoverflow.com/comment/38689660
has comment: http://stackoverflow.com/comment/38689639
has comment: http://stackoverflow.com/comment/38689466
has comment: http://stackoverflow.com/comment/38689605
tagged with: java
has comment: http://stackoverflow.com/comment/38689465
has comment: http://stackoverflow.com/comment/38689710
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38689675
score: -1
has title: String array length gives null pointer android
has comment: http://stackoverflow.com/comment/38689441
has comment: http://stackoverflow.com/comment/38689705
has comment: http://stackoverflow.com/comment/38689828
has answer: http://stackoverflow.com/a/24904361
has comment: http://stackoverflow.com/comment/38689586
answer count: 2
has answer: http://stackoverflow.com/a/53758929
upvote count: 0
tagged with: arrays
has body: In my code I am forming a string array dynamically. Then when I try to get the size of the array by "length" property, the application crashes giving out the Null Pointer Exception. Is there another way to get array length? File Cur_folder=new File(""+folder.toString()); String[] dirList=Cur_folder.list(); int c=dirList.length; Log cat: 07-23 03:02:40.477: E/AndroidRuntime(1576): FATAL EXCEPTION: AsyncTask #1 07-23 03:02:40.477: E/AndroidRuntime(1576): Process: com.example.nusearch, PID: 1576 07-23 03:02:40.477: E/AndroidRuntime(1576): java.lang.RuntimeException: An error occured while executing doInBackground() 07-23 03:02:40.477: E/AndroidRuntime(1576): at android.os.AsyncTask$3.done(AsyncTask.java:300) 07-23 03:02:40.477: E/AndroidRuntime(1576): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 07-23 03:02:40.477: E/AndroidRuntime(1576): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 07-23 03:02:40.477: E/AndroidRuntime(1576): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 07-23 03:02:40.477: E/AndroidRuntime(1576): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 07-23 03:02:40.477: E/AndroidRuntime(1576): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 07-23 03:02:40.477: E/AndroidRuntime(1576): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 07-23 03:02:40.477: E/AndroidRuntime(1576): at java.lang.Thread.run(Thread.java:841) 07-23 03:02:40.477: E/AndroidRuntime(1576): Caused by: java.lang.NullPointerException 07-23 03:02:40.477: E/AndroidRuntime(1576): at com.example.nusearch.MainActivity$StartIndexing.doInBackground(MainActivity.java:97) 07-23 03:02:40.477: E/AndroidRuntime(1576): at com.example.nusearch.MainActivity$StartIndexing.doInBackground(MainActivity.java:1) 07-23 03:02:40.477: E/AndroidRuntime(1576): at android.os.AsyncTask$2.call(AsyncTask.java:288) 07-23 03:02:40.477: E/AndroidRuntime(1576): at java.util.co…
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38689860

http://stackoverflow.com/comment/38453255
has text: I'll add Gradle to the list although I've mostly seen Maven especially for J2SE and J2EE
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24779281
score: 0

http://stackoverflow.com/comment/38480992
comment on: http://stackoverflow.com/q/24793389
type: Comment
type: QuestionComment
has text: "not meaning array of ints but series of independent ints" - what you're describing *is* an arrayed/aggregated data by the very definition. Using separate variables for vector data is insane IMO.
score: 0

http://stackoverflow.com/q/24807123
linked to: http://stackoverflow.com/q/17567996
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/38534103
has comment: http://stackoverflow.com/comment/38529233
type: Question
tagged with: des
has title: Java decryption throws an exception
possible better answer: http://stackoverflow.com/a/24808563
has answer: http://stackoverflow.com/a/24807271
has answer: http://stackoverflow.com/a/24808563
has body: Here is my encryption method(value is an input parameter): byte key_bytes[] = "12345678".getBytes(); SecretKeySpec _keyspec = new SecretKeySpec(key_bytes, "DES"); Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); // Yes, I know I shouldn't use DES cipher.init(Cipher.ENCRYPT_MODE, _keyspec); byte[] utf8 = value.getBytes("UTF8"); byte[] enc = cipher.doFinal(utf8); // Encrypt String encrypted = new String(new Base64().encode(enc)); return URLEncoder.encode(encrypted, "UTF-8"); Here is my decryption method(value is an input parameter): byte key_bytes[] = "12345678".getBytes(); SecretKeySpec _keyspec = new SecretKeySpec(key_bytes, "DES"); Cipher dcipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); dcipher.init(Cipher.DECRYPT_MODE, _keyspec); byte[] dec = new Base64().decode(value); byte[] utf8 = dcipher.doFinal(dec); // Decrypt, throws exception return new String(utf8, "UTF8"); And I get an Exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher I've read different topics, so I figured out, that this exception occurs, when there is no padding and there is another cipher mode. So, what's wrong?
answer count: 2
has comment: http://stackoverflow.com/comment/38710253
upvote count: 0
accepted answer: http://stackoverflow.com/a/24807271
has comment: http://stackoverflow.com/comment/38520191
favorite count: 0
has comment: http://stackoverflow.com/comment/38540495
has comment: http://stackoverflow.com/comment/38539954
tagged with: encryption
tagged with: cryptography
score: -2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38508748

http://stackoverflow.com/comment/38590255
comment on: http://stackoverflow.com/q/24849691
has text: If you have a panel where you are painting something (a triangle) in the `paintComponent` method, and you want to place text fields at "arbitrary" locations (e.g. the centers of the edges of the triangle), then this might be one of the *very* few occasions where you have to use a `null`-layout manager. No layout manager can arrange the components at "arbitrary" locations, based on where something is painted...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38690002
type: QuestionComment
comment on: http://stackoverflow.com/q/24903726
has text: @user3756637 instead of explaining in the comments, just edit your question.
score: 0
type: Comment

http://stackoverflow.com/comment/129808585
type: Comment
score: 0
type: AnswerComment
has text: @daniele-segato Why `onChildViewDetachedFromWindow` method is empty? should I add this line `view.setOnClickListener(null)` ?
comment on: http://stackoverflow.com/a/35917564

http://stackoverflow.com/q/24797857
type: AnsweredQuestion
has body: My code looks like this: List&lt;String&gt; filterList(List&lt;String&gt; list, String regex) { List&lt;String&gt; result = new ArrayList&lt;String&gt;(); for (String entry : list) { if (entry.matches(regex)) { result.add(entry); } } return result; } It returns a list that contains only those entries that match the regex. I was wondering if there was a built in function for this along the lines of: List&lt;String&gt; filterList(List&lt;String&gt; list, String regex) { List&lt;String&gt; result = new ArrayList&lt;String&gt;(); result.addAll(list, regex); return result; }
downvote count: 0
score: 23
favorite count: 0
type: Question
tagged with: regex
has title: Java - Filtering List Entries by Regex
possible better answer: http://stackoverflow.com/a/24798025
has answer: http://stackoverflow.com/a/24798025
has answer: http://stackoverflow.com/a/31888916
tagged with: collections
has comment: http://stackoverflow.com/comment/38489846
upvote count: 23
has answer: http://stackoverflow.com/a/24798058
accepted answer: http://stackoverflow.com/a/31888916
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/38489258

http://stackoverflow.com/a/24890401
has comment: http://stackoverflow.com/comment/68833617
type: AcceptedAnswer
downvote count: 0
has body: Presumably you're already using a com.sun.mail.imap.IMAPFolder? That class has the method addMessages(Message[] msgs). Use it to add a Message to the new folder. Alternatively, as mentioned by @gospodin, there's a copyMessages(Message[] msgs, Folder destinationFolder) method, which provides a shortcut for copying messages from their original folder to a new one.
has comment: http://stackoverflow.com/comment/68863133
type: Answer
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24888072
answers question: http://stackoverflow.com/q/24888072
score: 7

http://stackoverflow.com/comment/38806024
score: 0
type: Comment
has text: Yes.. I chose TreeMap with custom comparator. Thanks.
type: AnswerComment
comment on: http://stackoverflow.com/a/24895479

http://stackoverflow.com/comment/38590822
comment on: http://stackoverflow.com/q/24852029
type: Comment
type: QuestionComment
score: 0
has text: Post drawer_list_item.xml

http://stackoverflow.com/comment/38537855
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24823892
has text: http://stackoverflow.com/questions/8040790/joda-time-all-mondays-between-two-dates

http://stackoverflow.com/a/24764726
has comment: http://stackoverflow.com/comment/38427611
has comment: http://stackoverflow.com/comment/38427399
type: Answer
answers question: http://stackoverflow.com/q/24764328
has comment: http://stackoverflow.com/comment/38426637
accepted answer of: http://stackoverflow.com/q/24764328
has comment: http://stackoverflow.com/comment/38426144
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38428547
has comment: http://stackoverflow.com/comment/38426195
type: AcceptedAnswer
downvote count: 0
has body: If you want to see if a string is in the arraylist try this: for (String s : myArrayList) { if (s.equals(wordImLookingFor)) { // Run your code here } } or if (myArrayList.contains(wordImLookingFor)) { // Run your code here } If you want to see if a string entered is a substring of anything in the arraylist, try this: for (String s : myArrayList) { if (s.contains(wordImLookingFor)) { // Run your code here } } This should work for your example of myArrayList containing "dude" and the user inputting "d".

http://stackoverflow.com/comment/38664948
type: Comment
comment on: http://stackoverflow.com/q/24890387
type: QuestionComment
has text: possible because they need correct folder structure .
score: 0

http://stackoverflow.com/comment/38454771
comment on: http://stackoverflow.com/a/24769549
has text: is there a list of major companies that use drools in production like twitter, facebook etc ? Any white papers that describe how it scales/performance with more rules and dynamism ( edits to rules ) ?
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/38441114
type: Comment
type: QuestionComment
has text: @Varundroid Thx for Comment! I notice that fragment costructor is not safety from getActivity(), but when I call getActivity() at override onStart() method, It just return null too.
score: 0
comment on: http://stackoverflow.com/q/24772446

http://stackoverflow.com/comment/38613461
type: Comment
has text: @alihaider thx for the suggestions we tried HBase but it was slow for our near real time needs as for AMQ its the next one on the list :) and i agree with you its much more efficient to use a solution that's already done than to write your own solution from scratch
score: 0
comment on: http://stackoverflow.com/q/24863598
type: QuestionComment

http://stackoverflow.com/q/24823722
accepted answer: http://stackoverflow.com/a/24823846
has body: I have a java app which runs on a linux/unix machine. When setting the system time via system command, on the console using date I see that the date/time has changed, but it seems as my JVM didn't recognize this change. It seems that this is not a rights problem, because in the shell I see that the date/time has changed. Only my JVM didn't recognize this change. Any hints where to search ?
answer count: 1
score: 1
tagged with: unix
favorite count: 0
has title: Setting the system time of JVM
has comment: http://stackoverflow.com/comment/38537415
tagged with: systemtime
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/24823846
has comment: http://stackoverflow.com/comment/38537322
has comment: http://stackoverflow.com/comment/38537161

http://stackoverflow.com/a/24755224
has body: Lets take a peruse at the code. The method retainAll is inherited from AbstractCollection and (at least in OpenJDK) looks like this: public boolean retainAll(Collection&lt;?&gt; c) { boolean modified = false; Iterator&lt;E&gt; it = iterator(); while (it.hasNext()) { if (!c.contains(it.next())) { it.remove(); modified = true; } } return modified; } There is one big this to note here, we loop over this.iterator() and call c.contains. So the time complexity is n calls to c.contains where n = this.size() and at most n calls to it.remove(). This important thing is that the contains method is called on the other Collection and so the complexity is dependant upon the complexity of the other Collection contains. So, whilst: Set&lt;String&gt; common = new HashSet&lt;&gt;(Arrays.asList(a)); common.retainAll(new HashSet&lt;&gt;(Arrays.asList(b))); Would be O(a.length), as HashSet.contains and HashSet.remove are both O(1) (amortized). If you were to call common.retainAll(Arrays.asList(b)); Then due to the O(n) contains on Arrays.ArrayList this would become O(a.length * b.length) - i.e. by spending O(n) copying the array to a HashSet you actually make the call to retainAll much faster. As far as space complexity goes, no additional space (beyond the Iterator) is required by retainAll, but your invocation is actually quite expensive space-wise as you allocate two new HashSet implementations which are actually fully fledged HashMap. Two further things can be noted: There is no reason to allocate a HashSet from the elements in a - a cheaper collection that also has O(1) remove from the middle such as an LinkedList can be used. (cheaper in memory and also build time - a hash table is not built) Your modifications are being lost as you create new collection instances and only return b.size().
accepted answer of: http://stackoverflow.com/q/24754881
answers question: http://stackoverflow.com/q/24754881
type: Answer
score: 17
upvote count: 17
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38411098
has comment: http://stackoverflow.com/comment/38411587

http://stackoverflow.com/q/24872100
score: 1
tagged with: java
has body: I have a huge project with many packages and many java classes, I know how to debug and program... but I have a really dummy question. How can I know which class is actually running without breakpoints?
type: Question
tagged with: debugging
downvote count: 0
has comment: http://stackoverflow.com/comment/38629721
favorite count: 0
tagged with: breakpoints
has comment: http://stackoverflow.com/comment/38629793
has title: How to know which class is running at debuging
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/24906314
type: Question
answer count: 2
tagged with: jersey
has title: How to set the cross domain policy with embedded jetty ? RESTserver
downvote count: 0
tagged with: rest
tagged with: cross-domain
possible better answer: http://stackoverflow.com/a/32019094
has answer: http://stackoverflow.com/a/24914178
favorite count: 0
has answer: http://stackoverflow.com/a/32019094
tagged with: jetty
upvote count: 1
has body: I would like to know the way to set the cross domain policy, is that with filters or with the web.xml? How can I add it ? I'm using jetty and jersey. Here's my main public static void main(String[] args) throws Exception { Server server = new Server(8080); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); context.addServlet(org.eclipse.jetty.servlet.DefaultServlet.class, "/"); context.setResourceBase("."); server.setHandler(context); ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*"); jerseyServlet.setInitOrder(0); jerseyServlet.setInitParameter("jersey.config.server.provider.packages", "my.package.rest"); server.start(); server.join(); } my web.xml <web-app> cross-origin org.eclipse.jetty.servlets.CrossOriginFilter cross-origin /* Did I miss something ?
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24914178

http://stackoverflow.com/a/24842859
accepted answer of: http://stackoverflow.com/q/24842462
score: 1
upvote count: 1
has body: Tavian Barnes gave you a tip use a custom Application subclass. Its my technique on android apps and working great. Activities and in-process services can use it. Application instance is a system automanaged singleton, all apps have either default or custom one. I use it for app-global things. AndroidManifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.my.app" android:versionName="1.0" android:versionCode="3" &gt; &lt;application android:name=".MyApplication" ... &lt;/application&gt; &lt;/manifest&gt; com.my.app.MyApplication package com.my.app; import android.app.Application; public class MyApplication extends Application { @Override public void onCreate() {...} public void doSomething() { // getApplicationContext() getter is available here } } Use this getter (MyApplication)getApplication() in any activity or inprocess service class.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24842462
type: Answer

http://stackoverflow.com/a/24784910
type: Answer
answers question: http://stackoverflow.com/q/24784677
score: 0
has body: You have an extra } in the wrong place. See /* &lt;-- remove this */ comment below. import java.util.Scanner; public class Rats { public boolean ratSmeller(String line) { ///{ //write your code here //start if (line.contains("rat")){ return true; } else{ return false; } } //end ///} } /* &lt;-- remove this */ public static void main(String args[]) { Scanner scanner = new Scanner(System.in); System.out.println("Enter a word and we will tell you if it contains the string 'rat' in it: "); String word = scanner.nextLine(); Rats rats = new Rats(); System.out.println("Output: "); System.out.println(rats.ratSmeller(word)); } }

http://stackoverflow.com/comment/38677517
has text: Sorry for the late response. I'm pretty sure I'm making them the same way. I just call the Box2DHandler functions to create them. Let me add an edit showing how I create the bodies when loading the level.
comment on: http://stackoverflow.com/q/24896430
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38446191
comment on: http://stackoverflow.com/q/24774757
type: QuestionComment
type: Comment
has text: you want to fix the regex query? I don't really understand what is your objective?
score: 0

web-services
tags question: http://stackoverflow.com/q/24783840
type: Tag
tags question: http://stackoverflow.com/q/24905880
tags question: http://stackoverflow.com/q/24754267
tags question: http://stackoverflow.com/q/24862561
tags question: http://stackoverflow.com/q/24826166
tags question: http://stackoverflow.com/q/24865758
tags question: http://stackoverflow.com/q/24750871
tags question: http://stackoverflow.com/q/24884371
tags question: http://stackoverflow.com/q/24884124
tags question: http://stackoverflow.com/q/24900138
tags question: http://stackoverflow.com/q/24799904
tags question: http://stackoverflow.com/q/24879524
tags question: http://stackoverflow.com/q/24795827
tags question: http://stackoverflow.com/q/24797796
tags question: http://stackoverflow.com/q/24890675
tags question: http://stackoverflow.com/q/24799520
tags question: http://stackoverflow.com/q/24863725
tags question: http://stackoverflow.com/q/24780989
tags question: http://stackoverflow.com/q/24880520
tags question: http://stackoverflow.com/q/24860075
tags question: http://stackoverflow.com/q/24868910
tags question: http://stackoverflow.com/q/24839827
tags question: http://stackoverflow.com/q/24813947
tags question: http://stackoverflow.com/q/24766202
tags question: http://stackoverflow.com/q/24821151
tags question: http://stackoverflow.com/q/24751454
tags question: http://stackoverflow.com/q/24865762
tags question: http://stackoverflow.com/q/24805416
tags question: http://stackoverflow.com/q/24769878
tags question: http://stackoverflow.com/q/24905615
tags question: http://stackoverflow.com/q/24776378
tag name: web-services
tags question: http://stackoverflow.com/q/24906685
tags question: http://stackoverflow.com/q/24844959
tags question: http://stackoverflow.com/q/24779373
tags question: http://stackoverflow.com/q/24827401
tags question: http://stackoverflow.com/q/24872809
tags question: http://stackoverflow.com/q/24856453
tags question: http://stackoverflow.com/q/24757834
tags question: http://stackoverflow.com/q/24814316
tags question: http://stackoverflow.com/q/24820383
tags question: http://stackoverflow.com/q/24888135
tags question: http://stackoverflow.com/q/24905697
tags question: http://stackoverflow.com/q/24864865

http://stackoverflow.com/comment/38575140
has text: Yeah I wasn't using valud JSON because I'm not sure how to achieve what I'm saying so I'm not sure what the format would be, I was using a semi pseudo-code text to explain. And it's Java.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24843850

http://stackoverflow.com/a/24842993
answers question: http://stackoverflow.com/q/24842550
has comment: http://stackoverflow.com/comment/38577259
score: 0
type: Answer
has body: One available option is to look into using the Android Gridview as the drawing grid; I have not tested this myself, however if you create an object to be touched in each cell with your desired pixel dimensions, you should be able to create a rudimentary Pixel Art application by saving the variables. Note, grid view cells are sized based on their contents, as noted in How to set a cell size in Android grid view? Also, when it comes to drawing things, there are many different ways to handle it, however following a guide or tutorial such as http://code.tutsplus.com/tutorials/android-sdk-create-a-drawing-app-touch-interaction--mobile-19202 is generally the best place to start and pull what you need from it. Good luck!
has comment: http://stackoverflow.com/comment/38573578

http://stackoverflow.com/q/24869502
tagged with: cygwin
tagged with: http://stackoverflow.com/tag/c
has title: JNI JVM Invocation Classpath
has body: I am writing a small C program using Cygwin that launches a Java Virtual Machine (libraries I am using require POSIX environment). So far, I have been able to get it to work as long as I place all of my classes in the same folder as the executable. However, I want to specify an actual JAR file that contains the application I want to run. This does not seem to work though, FindClass simply returns a null. I've narrowed it down to a problem with the classpath setting, like I said, because I can extract my jar file in the same directory as the executable and it will work. Here is a subset of my code: I've loosely been following this guide: http://www.inonit.com/cygwin/jni/invocationApi/ int main( int argc, char *argv[] ) { void* jvmDllHandle; JNIEnv* jenv; JavaVM* jvm; JavaVMInitArgs args; JavaVMOption options[1]; jclass cls; jmethodID mainMethod; jobjectArray appArgs; jstring arg0; assert( cygwin_internal( CW_SYNC_WINENV ) != 1UL ); jvmDllHandle = LoadLibrary( "c:\\Path\\To\\Application\\jre\\bin\\server\\jvm.dll" ); createJavaVM = dlsym( jvmDllHandle, "JNI_CreateJavaVM" ); args.version = JNI_VERSION_1_6; args.nOptions = 1; options[0].optionString = "-Djava.class.path=c:\\Path\\To\\Application\\TheJarFile.jar"; args.options = options; args.ignoreUnrecognized = JNI_FALSE; createJavaVM( &amp;jvm, (void **) &amp;jenv, &amp;args ); cls = (*jenv)-&gt;FindClass( jenv, "some/package/MainClass" ); assert( cls != NULL ); // This fails. /// Omitted... return 0; } Tried using -classpath and -cp int main( int argc, char *argv[] ) { void* jvmDllHandle; JNIEnv* jenv; JavaVM* jvm; JavaVMInitArgs args; JavaVMOption options[1]; jclass cls; jmethodID mainMethod; jobjectArray appArgs; jstring arg0; assert( cygwin_internal( CW_SYNC_WINENV ) != 1UL ); jvmDllHandle = LoadLibrary( "c:\\Path\\To\\Application\\jre\\bin\\server\\jvm.dll" ); createJavaVM = dlsym( jvmDllHandle, "JNI_CreateJavaVM" ); args.version = JNI_VERSION_1_6; args.nOptions = 1; options[0].optionString = "-classpath c:\\Path…
linked to: http://stackoverflow.com/q/19059602
linked to: http://stackoverflow.com/q/27891478
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/43429166
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38624535
has comment: http://stackoverflow.com/comment/38624512
has comment: http://stackoverflow.com/comment/38625909
score: 2
has comment: http://stackoverflow.com/comment/38625752
upvote count: 2
has comment: http://stackoverflow.com/comment/38625823
has comment: http://stackoverflow.com/comment/38624544
has comment: http://stackoverflow.com/comment/38624593
type: Question
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/38625782
tagged with: java

http://stackoverflow.com/a/52410852
type: Answer
answers question: http://stackoverflow.com/q/24841172
has body: To summarize his argument: When working with sub-sequences of natural numbers, the difference between the upper bound and the lower bound should be the length of the sub-sequence. The indices of an array can be thought of as a special kind of such a sub-sequence. The lower bound should be inclusive, the upper bound should be exclusive. In other words, the lower bound should be the first index of the array. Otherwise, we risk having to have a lower bound in the unnatural numbers for some sub-sequences. If we want to maintain conditions (1) and (2), then we effectively have two choices for upper and lower bounds: 1 &lt;= i &lt; N+1 or 0 &lt;= i &lt; N. Clearly, putting N+1 in the range is ugly, so we should prefer indexing starting from 0.
score: 0

http://stackoverflow.com/a/24836472
accepted answer of: http://stackoverflow.com/q/24836365
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24836365
has body: Interfaces are used to define methods that an object can support without requiring consumers of the interface to know much about the object or how it wishes to implement the interface. In your situation, you wish to provide an update method onto MyGui that will not require a tight coupling between the MyGui class and your other code. If you define your interface as such, then you can write all of your code that may need to update the GUI to interact only with an object of type GuiUpdater: public interface GuiUpdater { void update(String update); } You would then modify your MyGui class declaration to implement this interface: public class MyGui extends JFrame implements GuiUpdater { You will also have to implement this method inside MyGui: @Override public void update(String update) { this.addActivity(update); } This is similar to what you have in the question, with one important difference. Because it's implemented as a method inside MyGui, you have access to all of the internal state of your MyGui instance (such as this). In other words, you don't need to pass a MyGui instance as a parameter, since this method is inside MyGui. Now, we can assume you an instance of MyGui called myGui have a function that might want to update the GUI, such as: public void foo(GuiUpdater updater) { updater.update("Interfaces are great"); } You can call this function like foo(myGui) because MyGui satisfies that interface. This decouples the implementation of foo from the implementation of MyGui, and means that either side is insulated from changes to the other side's implementation. Irrespective of how you architect your software (MVC, MVP, etc), coding to interfaces is a good habit to get into. It hides implementation details, and as such, reduces the impact of changing those details down the line.

http://stackoverflow.com/comment/38653333
comment on: http://stackoverflow.com/a/24884943
has text: Please post stacktrace
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24788844
type: Answer
score: 0
has body: It saems like the Calendar class already has everything the OP requires. There is no need to place the returned values into a hashmap or array or anything else. In the OP code, there is no return statement, but he wants to be able to re-use the code. Below is a simple method that demonstrates what the Calendar class gives us. Any method that returns a Calendar object is giving us everything we need because we can pull out the required values using get. public static void main(String[] args) { int day,month,year; GregorianCalendar date = new GregorianCalendar(); day = date.get(Calendar.DAY_OF_MONTH); month = date.get(Calendar.MONTH); year = date.get(Calendar.YEAR); System.out.println("Day:" + day); System.out.println("month:" + month); System.out.println("year:" + year); }
answers question: http://stackoverflow.com/q/24788435

http://stackoverflow.com/comment/38517512
has text: Fair enough. Thanks for the help, everyone.
type: Comment
comment on: http://stackoverflow.com/a/24812869
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38524986
comment on: http://stackoverflow.com/q/24817014
score: 1
has text: "more efficient way "? Have you benchmarked and determined you have a bottleneck here?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38686130
score: 0
has text: Iv tried to clean and rebuild it several times.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24902031

http://stackoverflow.com/comment/38567803
type: Comment
has text: You need to post the output of the LOGCAT to determine what the error is. Also, you seem to be using PhoneGap and aren't just making a standard Android app. Also, most importantly, you're missing the TVActivity from the android-manifest.xml. Copy the one you have there and remove the intent-filter, and it should be good to go.
type: QuestionComment
comment on: http://stackoverflow.com/q/24839959
score: 0

http://stackoverflow.com/q/24899427
tagged with: abstract-data-type
has comment: http://stackoverflow.com/comment/38681356
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38681445
score: 1
upvote count: 3
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/24899566
type: Question
linked to: http://stackoverflow.com/q/1913098
has answer: http://stackoverflow.com/a/24899566
answer count: 1
has comment: http://stackoverflow.com/comment/38681678
has title: Relationship between Interfaces and Abstract Data Type in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/38681343
tagged with: interface
has body: This is not about abstract class vs interfaces. I hope someone can explain the relationship between interface and ADT in Java. I think of an interface as a group of abstract methods. I understand that ADT focuses on what operations are possible but don't tell how they are implemented. I read that an interface specifies the operations of an ADT, but don't fully understand what this mean. Thanks

http://stackoverflow.com/comment/38592911
has text: And once again im very new to this so as simple as possible would be very nice
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24853085

http://stackoverflow.com/q/24884517
tagged with: libgdx
score: 0
has body: I am using libgdx with custom Model. Model have got a lot of object (rooms). I use center of ModelInstance to detect clicked object. Ray ray = cam.getPickRay(screenX, screenY); int result = -1; float distance = -1; Array&lt;Room&gt; instances = buildingContainer.getAllRooms(); for (int i = 0; i&lt;instances.size ; i++) { Room room = instances.get(i); if(room.floor == this.last_render_floor &amp;&amp; room.is_room) { GameObject instance = instances.get(i).model; instance.transform.getTranslation(position); position.add(instance.center); final float len = Math.abs(ray.direction.dot(position.x-ray.origin.x, position.y-ray.origin.y, position.z-ray.origin.z)); float dist2 = Math.abs(position.dst2(ray.origin.x+ray.direction.x*len, ray.origin.y+ray.direction.y*len, ray.origin.z+ray.direction.z*len)); if (distance &gt;= 0f &amp;&amp; dist2 &gt; distance) continue; if (dist2 &lt;= instance.radius * instance.radius) { result = i; distance = dist2; } } } clicked ++; return result; All is OK until, I change camera position. I selected wrong rooms. I think it is problem with distance with Ray and center of room. Any sugestion how to fix it?
tagged with: android
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24887427
tagged with: java
has title: Libgdx select ModelInstance
type: Question

http://stackoverflow.com/comment/38701222
comment on: http://stackoverflow.com/q/24904786
score: 0
has text: I too have the same problem
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24755464
tagged with: guava
has title: Is Guava Cache's read lock free
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24763549
type: Question
score: 3
has comment: http://stackoverflow.com/comment/38409103
has comment: http://stackoverflow.com/comment/38410374
tagged with: caching
has body: I am using Guava's Cache and have set concurrencyLevel to 1 so the maximum capacity is utilized w.r.t. eviction is concerned. Following is my code: CacheBuilder.newBuilder() .maximumWeight(maxWeight) .concurrencyLevel(1) .expireAfterWrite(expireDuration, TimeUnit.MINUTES) .removalListener(new RemovalListener&lt;K, V&gt;() { @Override public void onRemoval(RemovalNotification&lt;K, V&gt; removalNotification) { log.warn(removalMsg + removalNotification.getKey()); } }) .weigher(weigher) .build(); Documentation of concurrencyLevel says this: Guides the allowed concurrency among update operations. Used as a hint for internal sizing. The table is internally partitioned to try to permit the indicated number of concurrent updates without contention... And hence I was assuming that the concurrencyLevel plays a role only for update operations and the READs are Lock Free even with concurrencyLevel(1). Is my assumption correct ?? EDIT: I looked at the Guava Caching codeand it looks like my assumption that READs are lock free is correct. In case of get(K, Callable) initially it tries to get the value without lock and if the entry for the specified key is either null or has expired only then it goes for a locked Get or Load. Please Correct me if I am wrong here.
accepted answer: http://stackoverflow.com/a/24763549
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/38579327
has text: thanks...I will certainly mimick in the future
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24845418
type: Comment

http://stackoverflow.com/comment/38667498
has text: Thank you for you reply. :) what if the value has "=" in that?
comment on: http://stackoverflow.com/a/24892149
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38495220
type: AnswerComment
comment on: http://stackoverflow.com/a/24800091
score: 0
type: Comment
has text: Not necessarily. The problem is that you tyoically can't turn off the virtual memory support. So even if the memory pages are physically contiguous, you still have the same (potential) overhead of page table lookup when you address across a page boundary.

http://stackoverflow.com/comment/38507769
score: 0
type: AnswerComment
has text: Another suggestion, I see in your call to findContours() you're creating a new Mat() each time for the hierarchy. I've had issues with that. I eventually just defined and initialized a Mat as a class var and reused it in every call to findCoutours(). Most memory issue's I've had in OpenCV came down to either creating too many Mats or creating Mats that were too big.
type: Comment
comment on: http://stackoverflow.com/a/24807150

http://stackoverflow.com/comment/38435453
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24768649
has text: You will need to navigate to the ImageView with respect to the button. In your xml layout above, there is no ImageView with id sp_image. Where do you have this ImageView?
score: 0

http://stackoverflow.com/q/24759299
tagged with: ireport
has title: JavaBean as Datasource in iReport: “General рroblem: null” (jar is in the classpath!)
tagged with: java
tagged with: datasource
type: Question
tagged with: jasper-reports
answer count: 2
downvote count: 0
tagged with: javabeans
favorite count: 0
score: 3
has body: I am using JasperReports 5.6 via API. I am building a report using iReport. The problem is that I've already set a jar with bean factory in the classpath of iReport as com.myname.beanproject.beanpackage.BeanFactoryClass Also I set up static method to call a list of beans: getListEntries but still getting a error while testing a connection. What am I doing wrong? Error is not helpful at all: General problem: null As I can see, the problem is not in classpath neither factory: when I change any, the error is changing either to "No class found" (if I add something to class name) or "General problem: com.myname.beanproject.beanpackage.BeanFactoryClass.getListEntries11111()" (if I add 11111 to the name of factory method to test)
has answer: http://stackoverflow.com/a/27186760
has comment: http://stackoverflow.com/comment/38484360
has comment: http://stackoverflow.com/comment/38493124
has answer: http://stackoverflow.com/a/28283491
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/q/24752500
tagged with: android-fragmentactivity
score: 0
has title: Fragmentactivity and onCreate
answer count: 1
has comment: http://stackoverflow.com/comment/38403134
has comment: http://stackoverflow.com/comment/38403676
tagged with: android
type: AnsweredQuestion
tagged with: oncreate
tagged with: android-fragments
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24752640
has body: I've got a problem with fragmentactivity and onCreate method. My classes looks like this: public abstract class B extends FragmentActivity implements View.OnKeyListener {} public class A extends B { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // stuff } } OnCreate in class A is not called. I created layout from another after click and onCreate is in second layout. I don't know where is the problem. EDIT: leandrocastelli - i started new layout simply by creating object new A(getActivity()) not by intend. Arash - you have right. I've to start new Activity. And now startActivity throws nullpointer :/ blackbelt - it was create like above and now i've switch to startActivity.
has comment: http://stackoverflow.com/comment/38403224
accepted answer: http://stackoverflow.com/a/24752640

http://stackoverflow.com/q/24768715
has answer: http://stackoverflow.com/a/24769745
has title: unable to connect eclipse market place - I/O exception (java.net.SocketException) Malformed reply from SOCKS server
tagged with: eclipse
answer count: 2
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
tagged with: proxy
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36302742
score: 1
has body: Trying to connect eclipse market place to install the plug-ins but getting this error. I have added the proxy settings and selected the Active Provider to Manual Error Details :- INFO: Retrying connect Jul 15, 2014 2:30:11 PM org.apache.http.impl.client.DefaultRequestDirector tryConnect INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Malformed reply from SOCKS server Eclipse Details:- Version: Kepler Service Release 1 Build id: 20130919-0819 OS - Linux Ubundu GNOME 2.16.0 Do let me know your suggestions. Thanks
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/48851421
type: Comment
has text: The idea is to use different locales at runtime, no matter what the startup setting is.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/30376306

http://stackoverflow.com/a/24750660
upvote count: 1
has comment: http://stackoverflow.com/comment/38401020
has body: If you learn Java, the most logical choice for a client UI is GWT: GWT Overview GWT is a toolkit that takes your Java code and translates the client portion of it into a highly optimized JavaScript that works across all major browsers. It makes it easy to create very complex rich client applications using a combination of Java code, GWT widgets, as well as regular HTML and CSS.
accepted answer of: http://stackoverflow.com/q/24750600
answers question: http://stackoverflow.com/q/24750600
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/38621546
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24867666
has text: The HTML code concerning this part is: Choose file
type: Comment

http://stackoverflow.com/comment/38582217
comment on: http://stackoverflow.com/a/24847464
type: AnswerComment
score: 0
type: Comment
has text: No,it'll be javac $(find . -name '*.java')

http://stackoverflow.com/q/24844753
tagged with: java
score: 0
has title: Android Webview not working2
answer count: 1
has body: I'm trying to use Android Webview development but for some reason I see a white background, or see the website..): It's my code, I've brought you everything so you know maybe I was wrong at first Thank you very much! activity_main.xml <WebView android:id="@+id/webView" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </RelativeLayout> WebActivity.java package nerya.web; import android.annotation.SuppressLint; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient; public class WebActivity extends Activity { //private Button button; private WebView webView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get webview webView = (WebView) findViewById(R.id.webView); startWebView("http://www.androidexample.com/media/webview/login.html"); } @SuppressLint("SetJavaScriptEnabled") private void startWebView(String url) { //Create new webview Client to show progress dialog //When opening a url or click on link webView.setWebViewClient(new WebViewClient() { ProgressDialog progressDialog; //If you will not use this method url links are opeen in new brower not in webview public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } //Show loader on url load public void onLoadResource (WebView view, String url) { if (progressDialog == null) { // in standard case YourActivity.this progressDialog = new ProgressDialog(WebActivity.this); progressDialog.setMessage("Loading..."); progressDialog.show(); } } public void onPageFinished(WebView view, String url) { try{ if (progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } }catch(Exception exception){ exception.printStackTrace(); } } }); // Javascript inabled on webview webView.getSettings().setJavaScriptEnabled(true); // Other webview options /* webView.getSettings().…
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: webview
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24845107
type: Question

http://stackoverflow.com/a/24779013
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24778264
downvote count: 0
has body: If you have a HashMap&lt;String, Integer&gt; that you are using to represent word frequencies, there should be no problem representing 50,000 entries. If there is, then the obvious solution is to increase the Java heap size. (Use the -Xmx command line option to do this.) (If my mental arithmetic is correct, a HashMap has an overhead of something like 8 words per entry ... plus the space occupied by the key and value objects. In your case, that probably adds up to ~25 words including the key and value assuming typical English words. Roughly 5Mb in total in a 32 bit JVM.) But to answer your Question, there is no method or class in the Java standard library for splitting a HashMap into smaller HashMaps.
type: Answer

http://stackoverflow.com/a/24906236
score: 2
accepted answer of: http://stackoverflow.com/q/24905865
has body: You can use Apache Shiro. Shiro also has tag library for JSP. Tutorial For Shiro with JSP Here is a code sample that creates salted hash. import org.apache.shiro.crypto.hash.Sha256Hash; import org.apache.shiro.crypto.RandomNumberGenerator; import org.apache.shiro.crypto.SecureRandomNumberGenerator; ... //We'll use a Random Number Generator to generate salts. This //is much more secure than using a username as a salt or not //having a salt at all. Shiro makes this easy. // //Note that a normal app would reference an attribute rather //than create a new RNG every time: RandomNumberGenerator rng = new SecureRandomNumberGenerator(); Object salt = rng.nextBytes(); //Now hash the plain-text password with the random salt and multiple //iterations and then Base64-encode the value (requires less space than Hex): String hashedPasswordBase64 = new Sha256Hash(plainTextPassword, salt, 1024).toBase64(); User user = new User(username, hashedPasswordBase64); //save the salt with the new account. The HashedCredentialsMatcher //will need it later when handling login attempts: user.setPasswordSalt(salt); userDAO.create(user);
upvote count: 2
answers question: http://stackoverflow.com/q/24905865
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24863768
has comment: http://stackoverflow.com/comment/38613345
upvote count: 2
has comment: http://stackoverflow.com/comment/38614262
has comment: http://stackoverflow.com/comment/38614063
has comment: http://stackoverflow.com/comment/38614105
has comment: http://stackoverflow.com/comment/38613980
has comment: http://stackoverflow.com/comment/38613647
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38613914
downvote count: 0
has body: Repeat the timer using setRepeat(true) method and break the loop after repeating 10 times via calling stop() method inside the actionPerformed() method. Sample code: private int counter = 0; private Timer timer; ... timer = new javax.swing.Timer(500, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { counter++; if(counter==10){ timer.stop(); }else{ label.setText(counter + ""); } } }); timer.setRepeats(true); timer.start(); Note: Don't use Thread.sleep() that sometime hangs the whole swing application instead try with Swing Timer that is most suitable for swing application. Read more How to Use Swing Timers
accepted answer of: http://stackoverflow.com/q/24863698
has comment: http://stackoverflow.com/comment/38613782
answers question: http://stackoverflow.com/q/24863698
type: Answer
has comment: http://stackoverflow.com/comment/38614294
has comment: http://stackoverflow.com/comment/38614340
score: 2

http://stackoverflow.com/comment/38457238
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24781044
type: Comment
has text: tseting on genymotion emulator @nobalG

http://stackoverflow.com/q/24859001
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/38604684
accepted answer: http://stackoverflow.com/a/24859067
has body: I'm trying to get one JSON object and iterate it. In this case it should iterate only once because I'm having only one complete JSON object, if it has multiple, it should iterate multiple times. But rather it shows the system.out.println string twice. I don't understand whats wrong in this code? String str = "{\"userId\":\"1234\",\"businessPrimaryInfo\":{\"53bd2a4\":{\"businessSpecificInfo\":{\"businessType\":\"Manufacturing\",\"tradingPlace\":\"Hyderabad\"}},\"53bd2a4e\":{\"businessSpecificInfo\":{\"businessType\":\"Milling\",\"tradingPlace\":\"Mumbai\"}}}}"; JSONObject jsonObj = new JSONObject(str); Iterator&lt;String&gt; keys = jsonObj.keys(); // Iterate all the users. while (keys.hasNext()) { String key = keys.next(); try { // If the user has Business primary info as JSON object. if (jsonObj.has("businessPrimaryInfo")) { JSONObject jsonBizPrimaryInfo = jsonObj .getJSONObject("businessPrimaryInfo"); System.out.println("Object is:" + jsonBizPrimaryInfo); } } finally { } } Please have a look and let me know where I'm doing wrong.
score: 0
answer count: 1
has title: Iterating the JSON object using Java not working exactly
has answer: http://stackoverflow.com/a/24859067
type: AnsweredQuestion

http://stackoverflow.com/comment/38446962
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24775329
has text: but are you using SpriteBatch or Scene2d and Actors
score: 0

http://stackoverflow.com/comment/38443700
has text: @user1719212: `ojdbc14.jar` is intended for Java **1.4**, that is almost certainly not an up-to-date driver. Also are you really still using Oracle 10.x?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24773065

http://stackoverflow.com/a/24846370
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38580919
has comment: http://stackoverflow.com/comment/38579959
upvote count: 3
has comment: http://stackoverflow.com/comment/38580514
type: Answer
has comment: http://stackoverflow.com/comment/38580137
has comment: http://stackoverflow.com/comment/38580028
has body: frame.getRootPane().setDefaultButton( btnAddMarks ); Then when the user uses the Enter key it will behave like the user clicked on the button. This method will look after creating the appropriate Key Bindings for you. To understand more about Key Bindings read the Swing tutorial on How to Use Key Bindings. Edit: The issue is, the ENTER button only works to trigger that button when jTextField txtInput_mark is NOT in focus KeyEvent are always dispatched to the component that has focus. So this means your text field is intercepting the event because you either added an ActionListener to the text field or are handling the Enter key in a KeyListener added to the text field. Get rid of the KeyListener and/or ActionListener.
answers question: http://stackoverflow.com/q/24846345
has comment: http://stackoverflow.com/comment/38580093
score: 3
has comment: http://stackoverflow.com/comment/38580113
accepted answer of: http://stackoverflow.com/q/24846345
downvote count: 0
has comment: http://stackoverflow.com/comment/38579933
has comment: http://stackoverflow.com/comment/38580029
has comment: http://stackoverflow.com/comment/38580417

http://stackoverflow.com/comment/38584327
has text: @INear See the documentation for Map's [keySet()](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html#keySet%28%29) method.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/24847290
type: Comment

http://stackoverflow.com/comment/38666405
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24888055
has text: Glad it worked - would you mind accepting this answer if it worked for you? Thanks!

http://stackoverflow.com/q/24873359
answer count: 1
downvote count: 0
favorite count: 0
has body: In Program Development in Java by Liskov and Guttag, they use static inner classes to implement Iterators (section 6.4, pg 134-136). They justify the use of the static inner classes by saying "its code can access private instance variables and methods of [enclosing type] objects." But this (being able to access fields of enclosing objects) is not true of static inner classes, only nested inner classes, correct?
has answer: http://stackoverflow.com/a/24873876
type: UnansweredQuestion
upvote count: 1
has title: Error in use of static inner classes in Program Development in Java by Liskov and Guttag
type: Question
score: 1
tagged with: java

generics
tags question: http://stackoverflow.com/q/24859700
tags question: http://stackoverflow.com/q/24896611
tags question: http://stackoverflow.com/q/24762487
tags question: http://stackoverflow.com/q/24808996
tags question: http://stackoverflow.com/q/24785185
tags question: http://stackoverflow.com/q/24807562
tags question: http://stackoverflow.com/q/24897986
tags question: http://stackoverflow.com/q/24819556
tags question: http://stackoverflow.com/q/24861758
tags question: http://stackoverflow.com/q/24891390
tags question: http://stackoverflow.com/q/24756464
tags question: http://stackoverflow.com/q/24907390
tags question: http://stackoverflow.com/q/24833208
tags question: http://stackoverflow.com/q/24834391
tags question: http://stackoverflow.com/q/24785695
tags question: http://stackoverflow.com/q/24789734
type: Tag
tags question: http://stackoverflow.com/q/24802155
tags question: http://stackoverflow.com/q/24759920
tags question: http://stackoverflow.com/q/24806672
tags question: http://stackoverflow.com/q/24860164
tags question: http://stackoverflow.com/q/24750092
tags question: http://stackoverflow.com/q/24836315
tags question: http://stackoverflow.com/q/24824317
tags question: http://stackoverflow.com/q/24800304
tags question: http://stackoverflow.com/q/24852410
tags question: http://stackoverflow.com/q/24840307
tags question: http://stackoverflow.com/q/24882549
tags question: http://stackoverflow.com/q/24769061
tags question: http://stackoverflow.com/q/24839794
tags question: http://stackoverflow.com/q/24882872
tags question: http://stackoverflow.com/q/24850748
tags question: http://stackoverflow.com/q/24794924
tags question: http://stackoverflow.com/q/24904327
tags question: http://stackoverflow.com/q/24766564
tags question: http://stackoverflow.com/q/24761092
tags question: http://stackoverflow.com/q/24817306
tag name: generics
tags question: http://stackoverflow.com/q/24879851
tags question: http://stackoverflow.com/q/24875816
tags question: http://stackoverflow.com/q/24826424
tags question: http://stackoverflow.com/q/24833822
tags question: http://stackoverflow.com/q/24877958
tags question: http://stackoverflow.com/q/24829111
tags question: http://stackoverflow.com/q/24772080
tags question: http://stackoverflow.com/q/24879051

http://stackoverflow.com/q/24760769
answer count: 1
has body: I'm starting to migrate a restlet based application to spring mvc. Currently we use restlet Filters for security and logging. What's the best approach to migrate this filters to spring mvc? I was thinking about aspects added to the action methods via annotation. Is this the spring way to implement filters?
has title: How to migrate restlet filter to spring mvc?
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24761945
type: Question
tagged with: restlet
score: 0
has comment: http://stackoverflow.com/comment/38419589
accepted answer: http://stackoverflow.com/a/24761945

http://stackoverflow.com/comment/38708981
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24866814
has text: Yes but it already gives the same result... `Permission Denied`
score: 0

http://stackoverflow.com/a/24870334
has comment: http://stackoverflow.com/comment/38626270
has comment: http://stackoverflow.com/comment/38626105
type: Answer
has comment: http://stackoverflow.com/comment/38626325
has body: You need to use full class qualified name java access.Coffee Also if there is some problem that you are facing in classpath you can always do java -cp . access.Coffee (considenring class file is in current directory)
answers question: http://stackoverflow.com/q/24870281
score: 0

http://stackoverflow.com/q/24848752
has comment: http://stackoverflow.com/comment/50629422
favorite count: 0
has comment: http://stackoverflow.com/comment/38629813
has body: I am trying to play mp3 file in java program using javafx. I installed dependencies libavcodec53 and libavformat53 mentioned here. I used following code public void play(String path_to_song){ JFXPanel fxPanel = new JFXPanel(); String song = new File(path_to_song).toURI().toString(); Media audio =null; audio = new Media(song); MediaPlayer mediaPlayer = new MediaPlayer(audio); mediaPlayer.play(); } But I still got error "Error media audio format unsupported" Exception in thread "main" MediaException: MEDIA_UNSUPPORTED : com.sun.media.jfxmedia.MediaException: "Error media audio format unsupported" : com.sun.media.jfxmedia.MediaException: "Error media audio format unsupported" at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:125) at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:474) at javafx.scene.media.MediaPlayer.&lt;init&gt;(MediaPlayer.java:383) at playback.Player.play(Player.java:39) at engine.Execute.main(Execute.java:15) Caused by: com.sun.media.jfxmedia.MediaException: "Error media audio format unsupported" at com.sun.media.jfxmediaimpl.MediaUtils.nativeError(MediaUtils.java:331) at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMedia.init(GSTMedia.java:50) at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMedia.&lt;init&gt;(GSTMedia.java:33) at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer.&lt;init&gt;(GSTMediaPlayer.java:39) at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform.prerollMediaPlayer(GSTPlatform.java:100) at com.sun.media.jfxmediaimpl.platform.PlatformManager.createMediaPlayer(PlatformManager.java:173) at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:264) at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:139) at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:431) Any ideas?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26068631
has title: JavaFX mp3 playback Ubuntu 14.04
has comment: http://stackoverflow.com/comment/38628396
score: 2
answer count: 0
upvote count: 2
tagged with: java
tagged with: javafx
tagged with: http://stackoverflow.com/tag/mp3
type: Question
has comment: http://stackoverflow.com/comment/38629579
tagged with: ubuntu-14.04
has comment: http://stackoverflow.com/comment/40844858
downvote count: 0

http://stackoverflow.com/a/24765016
has comment: http://stackoverflow.com/comment/38532412
accepted answer of: http://stackoverflow.com/q/24764158
answers question: http://stackoverflow.com/q/24764158
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38535853
has body: There tons of examples at the netty github repository: https://github.com/netty/netty/tree/3.9/src/main/java/org/jboss/netty/example
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38564514
type: Answer

http://stackoverflow.com/comment/38477250
type: AnswerComment
score: 0
type: Comment
has text: I updated the demo project master branch with a 2nd button to send the deleteIntent to a Service. During development I thought I reproduced the issue I'm seeing with the Service not working despite commenting out `Notification.setLatestEventInfo()`, but the demo project seems to work fine with Service now too. I'm marking this as the answer since re-applying the `deleteIntent` seems to be the only viable workaround for both BroadcastReceivers and Services in the original project. I plan to file a bug with AOSP issue tracker for the `Notification.setLatestEventInfo()` deleteIntent problem.
comment on: http://stackoverflow.com/a/24778900

http://stackoverflow.com/a/24875613
has body: I'm not a ROM developer so my guess is just as good as yours, but this sounds like they probably implemented it in their custom kernel, not on the application level. So not really something you can do yourself, unless someone ported the feature over to a kernel for your ROM as well.
has comment: http://stackoverflow.com/comment/54282332
type: Answer
answers question: http://stackoverflow.com/q/24875113
score: 0

http://stackoverflow.com/a/24800671
downvote count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/38495546
has body: You can change your ValueComparator declaration like this: class ContainerComparator&lt;V extends Comparable&lt;V&gt;&gt; implements Comparator&lt;Container&lt;V&gt;&gt; { @Override public int compare(Container&lt;V&gt; o1, Container&lt;V&gt; o2 ) { return ...; } } Now you can declare it with a single type parameter: new ContainerComparator&lt;String&gt;().compare(x1, x2);
type: Answer
answers question: http://stackoverflow.com/q/24800304
score: 3

http://stackoverflow.com/comment/38407864
has text: @Akshay, you haven't answered to any of the previous questions that were asked or addressed.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24753102

http://stackoverflow.com/q/24760796
has title: How to validate an XML against schema using JAXB?
favorite count: 0
score: 17
type: Question
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24761264
tagged with: java
tagged with: jaxb
has body: I am working with XML and JAXB as I am unmarshalling and marshalling the XML into Java objects and vice versa. Now I am trying to validate our XML against our schema(test.xsd). Suppose if any required field is missing in my XML, then I would like to know which field is missing after validating the XML against schema test.xsd. public void unmarshal(final InputStream is) { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(is); Object req = unmarshaller.unmarshal(reader); // how would I validate here? } How would I validate my XML against test.xsd schema. My test.xsd schema path is - C:\workspace\one\two\three\src\main\java\com\package\serv\ap\versionOne\test.xsd UPDATE: loading test.xsd as: Schema schema = factorySchema.newSchema(new File("C:\\workspace\\one\\two\\three\\src\\main\\java\\com\\package\\serv\\ap\\versionOne\\test.xsd"));
answer count: 1
upvote count: 17
accepted answer: http://stackoverflow.com/a/24761264
tagged with: unmarshalling
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/24856192
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38599366
tagged with: writer
score: 0
has title: Why am I receiving a java.io.IOException in this loop?
upvote count: 1
has comment: http://stackoverflow.com/comment/38600802
has comment: http://stackoverflow.com/comment/38599353
downvote count: 1
has comment: http://stackoverflow.com/comment/38599836
has answer: http://stackoverflow.com/a/24857027
favorite count: 0
has comment: http://stackoverflow.com/comment/38600082
has comment: http://stackoverflow.com/comment/38600882
tagged with: stream
possible better answer: http://stackoverflow.com/a/24857027
accepted answer: http://stackoverflow.com/a/24858586
has body: I have written the following block of code which picks up a plaintext file, and if the current modified date on the file is greater than the last iteration of the loop, parse the file into an HTML version and upload it to an ftp server. I believe the issue is something to do with the Writer, but I am not understanding what is happening here. The first iteration of the loop seems to execute fine, and then it sleeps for 5 minutes and throws the following error: java.io.IOException: Stream closed at java.io.BufferedWriter.ensureOpen(BufferedWriter.java:116) at java.io.BufferedWriter.write(BufferedWriter.java:221) at java.io.Writer.write(Writer.java:157) at java.io.Writer.append(Writer.java:227) at PrintOutConvosFtp3.main(PrintOutConvosFtp3.java:130) Here is the code which is throwing the error: import java.io.*; import java.util.*; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import java.sql.Timestamp; public class PrintOutConvosFtp3 { public static void main(String[] args) throws IOException, InterruptedException { boolean infiniteLoop = true; long currentLoopModified = 0; long lastLoopModified = 0; while (infiniteLoop) { currentLoopModified = new File("C:/Documents and Settings/Cuckoo/Desktop/Syss-convos.LOG").lastModified(); if (currentLoopModified > lastLoopModified) { //Read in the conversation log BufferedReader reader = new BufferedReader(new FileReader("C:/Documents and Settings/Cuckoo/Desktop/Syss-convos.LOG")); FileWriter output = new FileWriter("C:/Documents and Settings/Cuckoo/Desktop/Conversations.html"); List<String> lines = new ArrayList<String>(); String line = null; while ((line = reader.readLine()) != null) //Remove some unnecessary clutter from the log { if (!(line.contains("just hung up!!!") || line.contains("just left the Realm.") || line.contains("Hurry, I've many esoteric secrets to divulge, and welcome to BaDbOy's realm.") || line.contains("For custom MegaMud paths and additional information, check out the …
type: AnsweredQuestion
tagged with: ioexception
tagged with: java
has answer: http://stackoverflow.com/a/24858586

http://stackoverflow.com/comment/38653829
has text: The NPE sounds like a bug. Can you clarify which version of the code you are using -- meaning, what is line 163 in the code you compiled?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24885024
score: 0

http://stackoverflow.com/comment/38495718
has text: Yes @maskapsiz it will work! But then you have to change your sql query to select * from employee e where e.emp_fname = :empFname OR e.emp_lname:empLname . SQL query needs to be tuned from and to or. now you can either set empFname or empLname or even both. Because named or native query behind the back changes to sql query only.Let me know if you have any issue.
comment on: http://stackoverflow.com/a/24799821
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24841913
has body: i still struggling learning java injection i have EJB class, it name is MyEJB i have another class, my application begin in this class, it name is Main Class Main call MyEJB, then i need class MyEJB to have a reference to Class Main MyEJB @LocalBean @Stateless public class MyEJB{ private Main main; public MyEJB(){ } public void doSomething(){ //later i will do something here with class Main if(main == null){ System.out.println("main is null"); }else{ System.out.println("main not null token = "+main.token); } } } Main @EJB MyEJB myEJB; private String token = "123"; // i will call this function public void test(){ myEJB.doSomething(); } i need MyEJB to have class Main reference when it instantiated How to do this? forgive my english thanks
type: Question
accepted answer: http://stackoverflow.com/a/24859251
tagged with: inject
tagged with: java
score: 0
answer count: 1
tagged with: ejb
has answer: http://stackoverflow.com/a/24859251
has title: How to give EJB reference when instantiated?
type: AnsweredQuestion

http://stackoverflow.com/q/24869445
has answer: http://stackoverflow.com/a/24869483
tagged with: sqlite
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: Im attempting to create a method that runs a query in order to recieve results from my SQLite database. However I am getting an error in Logcat, and the application stops working. How do I solve this? The query: String selectQuery = "SELECT * FROM " + TABLE_SCORE + "WHERE COL_SCORE &gt;= " + scoreEntered ; Logcat error Log: 07-21 16:18:43.527: E/AndroidRuntime(29365): FATAL EXCEPTION: main 07-21 16:18:43.527: E/AndroidRuntime(29365): Process: com.example.brianapp, PID: 29365 07-21 16:18:43.527: E/AndroidRuntime(29365): android.database.sqlite.SQLiteException: near "&gt;=": syntax error (code 1): , while compiling: SELECT * FROM scoresWHERE COL_SCORE &gt;=4 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1121) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:694) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteQuery.&lt;init&gt;(SQLiteQuery.java:37) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1436) 07-21 16:18:43.527: E/AndroidRuntime(29365): at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1375) The full below extended code is for reference: The full method is as follows: public List&lt;Score&gt; getSpecificScore(int scoreEntered) { List&lt;Score&gt; scoreList = new ArrayList&lt;Score…
upvote count: 0
tagged with: java
score: -1
has title: Android: SQLite Exception?
type: Question

http://stackoverflow.com/q/24879697
downvote count: 1
has body: I am trying to create a label that will show what the current selected value is for a particular slider. Currently, I am able to insert the labels and get them onto the window. I am not sure how to get the value of the slider to show up in the label. I am pretty sure that I need to parse the information being that it is two different value types. Any help with where to go from here would be greatly appreciated. Code added on edit: import javax.swing.*; import javax.swing.event.*; import java.awt.*; public class ColorSliders extends JFrame implements ChangeListener { ColorPanel canvas = new ColorPanel(); JSlider red = new JSlider(0, 255, 255); JSlider blue = new JSlider(0, 255, 0); JSlider green = new JSlider(0, 255, 0); // Creating labels to measure output of Slider Value JLabel redLabelValue = new JLabel("Red Value: "); JLabel greenLabelValue = new JLabel("Green V: "); JLabel blueLabelValue = new JLabel("Blue: "); public ColorSliders() { super("Color Slide"); setSize(350, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); red.setMajorTickSpacing(50); red.setMinorTickSpacing(10); red.setPaintTicks(true); red.setPaintLabels(true); red.addChangeListener(this); green.setMajorTickSpacing(50); green.setMinorTickSpacing(10); green.setPaintTicks(true); green.setPaintLabels(true); green.addChangeListener(this); blue.setMajorTickSpacing(50); blue.setMinorTickSpacing(10); blue.setPaintTicks(true); blue.setPaintLabels(true); blue.addChangeListener(this); JLabel redLabel = new JLabel("Red: "); JLabel greenLabel = new JLabel("Green: "); JLabel blueLabel = new JLabel("Blue: "); GridLayout grid = new GridLayout(4,1); FlowLayout right = new FlowLayout(FlowLayout.LEFT); setLayout(grid); JPanel redPanel = new JPanel(); redPanel.setLayout(right); redPanel.add(redLabel); redPanel.add(red); redPanel.add(redLabelValue); add(redPanel); JPanel greenPanel = new JPanel(); greenPanel.setLayout(right); greenPanel.add(greenLabel); greenPanel.add(green); greenPanel.add(green…
tagged with: java
has answer: http://stackoverflow.com/a/24879859
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24879862
tagged with: string
has answer: http://stackoverflow.com/a/24879862
favorite count: 0
has title: How do I set a String variable equal to that of the value on a slider?
accepted answer: http://stackoverflow.com/a/24879859
type: Question
has comment: http://stackoverflow.com/comment/38643864
tagged with: parsing
score: 0
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/44126525
type: QuestionComment
has text: I see no reason why it should be possible. For the USB aspect you may read this thread: [link](http://stackoverflow.com/questions/3803871/android-apps-communicating-with-a-device-plugged-in-the-usb-port)
type: Comment
comment on: http://stackoverflow.com/q/24831898
score: 0

http://stackoverflow.com/q/24865190
has comment: http://stackoverflow.com/comment/38645161
has comment: http://stackoverflow.com/comment/38629569
tagged with: jsp
has body: I am getting NullPointerException in Weblogic Server while changing below changes in jsp: &lt;jsp:include page="Nav.jspx"&gt; &lt;jsp:param name="invoiceType" value="${invoiceTypeLong}"/&gt; &lt;jsp:param name="current" value="Header"/&gt; &lt;/jsp:include&gt; I have given instructions to modify above code to below mentioned code for security implementations.Both code snippents are working fine in tomcat but coming to weblogic below mentioned code giving NullPointerException. &lt;jsp:include page="Nav.jspx"&gt; &lt;jsp:param name="invoiceType"&gt; &lt;jsp:attribute name="value"&gt; &lt;c:out value="${invoiceTypeLong}"/&gt; &lt;/jsp:attribute&gt; &lt;/jsp:param&gt; &lt;jsp:param name="current" value="Header"/&gt; &lt;/jsp:include&gt; Could anybody suggest me if i required to change any configuration files or what is the cause? Exception StackTrace: 2014-07-21 05:13:38.861 0 Error Exception weblogic.servlet.jsp.CompilationException: Failed to compile JSP /WEB-INF/ml/jsp/Invoice/INVOICE/Header.jspx Exception occurred while processing 'C:\Views\spambi_64view\GC3\WEB-INF\ml\jsp\Invoice\INVOICE\Header.jspx'java.lang.NullPointerException at weblogic.jsp.internal.jsp.JspScriptTransform$TransformContext.addTokens(JspScriptTransform.java:2408) at weblogic.jsp.internal.jsp.JspJavaTransform.addParamTag(JspJavaTransform.java:1100) at weblogic.jsp.internal.jsp.JspJavaTransform.addActionBefore(JspJavaTransform.java:171) at weblogic.jsp.internal.jsp.JspScriptTransform.transformAction(JspScriptTransform.java:1194) at weblogic.jsp.internal.jsp.JspScriptTransform.transformAll(JspScriptTransform.java:750) at weblogic.jsp.internal.jsp.JspScriptTransform.transformAction(JspScriptTransform.java:1207) at weblogic.jsp.internal.jsp.JspScriptTransform.transformAll(JspScriptTransform.java:750) at weblogic.jsp.internal.jsp.JspScriptTransform.transformAction(JspScriptTransform.java:1425) at weblogic.jsp.internal.jsp.JspScriptTransform.transformAll(JspScriptTransform.java:750) at weblogic.jsp.int…
tagged with: nullpointerexception
tagged with: jsp-tags
type: UnansweredQuestion
has title: <jsp:param> throwing NullPointerException
answer count: 0
score: 0
tagged with: java
type: Question
tagged with: weblogic
linked to: http://stackoverflow.com/q/5780314

http://stackoverflow.com/comment/38612279
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24862751
score: 0
has text: Can you post logging.properties as well, please?

http://stackoverflow.com/a/24873379
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: e.getSource() will return the label that is clicked, not the color of that label (in your example, anyway) So, cast to a label: JLabel theLabel = (JLabel) e.getSource(); then setBackground on it appropriately: if (theLabel.getBackground().equals(Color.WHITE)) theLabel.setBackgound(...);
score: 3
answers question: http://stackoverflow.com/q/24873321
has comment: http://stackoverflow.com/comment/38632362
accepted answer of: http://stackoverflow.com/q/24873321
upvote count: 3
has comment: http://stackoverflow.com/comment/38632626

http://stackoverflow.com/comment/38690073
comment on: http://stackoverflow.com/a/24903830
score: 0
type: AnswerComment
has text: ok. let me modify my answer so it does not misguide any body. I would request if you can modify in the way it does not misguide anybody else looking at the post, then it would be really great. :)
type: Comment

http://stackoverflow.com/comment/38631587
score: 0
type: AnswerComment
has text: @SamYonnou True, but that's not a String or char type.
type: Comment
comment on: http://stackoverflow.com/a/24873104

http://stackoverflow.com/a/34204501
has body: Use from this : &lt;TextView android:id="@+id/txt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" /&gt;
score: 0
answers question: http://stackoverflow.com/q/24758341
type: Answer

http://stackoverflow.com/comment/38497233
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24800298
score: 0
has text: possible duplicate of [How can I get the Eclipse version programmatically?](http://stackoverflow.com/questions/20652614/how-can-i-get-the-eclipse-version-programmatically)

http://stackoverflow.com/a/24841371
downvote count: 0
has body: To expand upon @Kevin's answer, I take this quote from an answer on Programmers.SE: The index in an array is not really an index. It is simply an offset that is the distance from the start of the array. The first element is at the start of the array so there is no distance. Therefore the offset is 0. Further, if you want to learn more about how different languages do their array indexing, then look at this exhaustive list on Wikipedia.
type: Answer
answers question: http://stackoverflow.com/q/24841172
upvote count: 26
score: 26

http://stackoverflow.com/comment/38487379
type: Comment
type: QuestionComment
has text: `catch(NegativeArraySizeException e)` :D
score: 7
comment on: http://stackoverflow.com/q/24797013

http://stackoverflow.com/q/24845299
favorite count: 0
has comment: http://stackoverflow.com/comment/38577832
linked to: http://stackoverflow.com/q/18093928
has title: Error executing Java program : Could not find or load main class
has comment: http://stackoverflow.com/comment/38577886
has comment: http://stackoverflow.com/comment/38577944
accepted answer: http://stackoverflow.com/a/24845376
duplicate of: http://stackoverflow.com/q/18093928
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38577873
upvote count: 3
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/38577988
has comment: http://stackoverflow.com/comment/38577858
type: Question
has answer: http://stackoverflow.com/a/24845376
tagged with: class
has comment: http://stackoverflow.com/comment/38578084
score: 0
has body: I am taking a Udemy class and I am stuck on the first lesson, getting command prompt to write "Hello world" through java. My error is once I have compiled it, and it creates the class file, and I try to run it through "java HelloWorld" it doesn't run. The error is. Error: Could not find or load main class HelloWorld And I can't figure it out, Here is a screenshot showing everything I have: https://app.box.com/s/4heybbazxswm4otjazrw I have looked through my class discussion and no one had the error, and no StackOverflow topics seemed to be the same problem.
has comment: http://stackoverflow.com/comment/38577883
answer count: 1
has comment: http://stackoverflow.com/comment/38578030

http://stackoverflow.com/q/24875676
type: AnsweredQuestion
downvote count: 0
has title: Building a concurrent TableColumnAdjuster for JTable
tagged with: jtableheader
tagged with: swing
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38678316
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38661626
tagged with: jtable
has comment: http://stackoverflow.com/comment/38636582
has answer: http://stackoverflow.com/a/24877541
upvote count: 1
accepted answer: http://stackoverflow.com/a/24877541
answer count: 1
favorite count: 0
has body: I copied a TableColumnAdjuster class which seems to be pretty popular. http://tips4java.wordpress.com/2008/11/10/table-column-adjuster/ However, the JTables I am developing are dynamic and can have a large amount of data flow in and out of them (as much as 30,000 records). Obviously, when the TableColumnAdjuster has to iterate through every cell it can take awhile and make the Swing interface unresponsive. I tried putting the adjustColumns() method on its own thread, but the columns began to resize wildly and randomly. Obviously not threadsafe. So I started to reverse engineer the class, turning variables into volatiles, replacing the hashmap with a concurrent hash map, and separating the calculation from the Swing invokeLater() thread. However, nothing is working and the columns still resize wildly. I'm beginning to wonder if the JTable is not threadsafe altogether. Is JTable even threadsafe for tasks like this? Is there a somewhat simple, strategic insertion of code to make the adjustColumns() run on a separate thread safely? And interact with the Swing thread when it has updates for the view?

http://stackoverflow.com/comment/38750268
score: 1
type: Comment
type: QuestionComment
has text: It seems that another user has the same issue. We've created a ticket (including a workaround) to track this: https://github.com/jOOQ/jOOQ/issues/3445
comment on: http://stackoverflow.com/q/24869810

http://stackoverflow.com/q/24830699
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38551047
has comment: http://stackoverflow.com/comment/38550696
accepted answer: http://stackoverflow.com/a/24868996
has comment: http://stackoverflow.com/comment/38550703
has comment: http://stackoverflow.com/comment/38555445
has comment: http://stackoverflow.com/comment/52315798
answer count: 2
has comment: http://stackoverflow.com/comment/38550655
has title: How Parse JSON using GSON WHen object is either JSONObject or JSONArray
has comment: http://stackoverflow.com/comment/38557355
favorite count: 0
has answer: http://stackoverflow.com/a/24831939
has comment: http://stackoverflow.com/comment/132443722
has answer: http://stackoverflow.com/a/24868996
has body: I am using Gson to convert JSON into a Java object. I have a field in the json that our wise services people coded as either an array or object depending on how many items come back in database. Question is how do model the Java object to pass into Gson converter so that I can handle both types? json = new Gson().fromJson(reader, Order.class); Java Classes only parses the JSON array properly public class Order { private Detail detail } public class Detail { public String id; public List&lt;Type&gt; types; //// getters and setters } public class Type { public String typeId; public String typeName //// getters and setters } JSON data array { "detail":{ "id":"1234565", "types":{ "type":[ {"typeId":"1246565","typeName":"MyName1"}, {"typeId":"1444445","typeName":"MyName2"} ] } } } JSON data object { "detail":{ "id":"1234565", "types":{ "type":{"typeId":"1246565","typeName":"MyName1"} } } }
possible better answer: http://stackoverflow.com/a/24831939
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
linked to: http://stackoverflow.com/q/43412261

http://stackoverflow.com/q/24878513
type: Question
has answer: http://stackoverflow.com/a/24878695
has answer: http://stackoverflow.com/a/24878571
has title: How to remove only punctuation but leave accented letters?
has answer: http://stackoverflow.com/a/24878607
downvote count: 0
tagged with: string
favorite count: 0
answer count: 5
score: 2
has answer: http://stackoverflow.com/a/24878763
has body: I am trying to remove only the punctuation from my text data but leave the accented letters. I do not want to replace the accented letters with English equivalents. I cannot figure out how to adapt my existing code to allow for higher ascii characters. while (input.hasNext()){ String phrase = input.nextLine(); String[] words = phrase.split(" "); for(String word: words){ String strippedInput = word.replaceAll("[^0-9a-zA-Z\\s]", ""); } } If original input is: O sal, ou o sódio, também é contraindicado em pacientes hipotensos? Expected output should be: O sal ou o sódio também é contraindicado em pacientes hipotensos Any ideas? Thanks!
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24878594

http://stackoverflow.com/a/24787508
type: Answer
has body: "typ" should be a property of your base class. so we should be able to get desired instance in this manner: GsonFireBuilder builder = new GsonFireBuilder() .registerTypeSelector(Base.class, new TypeSelector&lt;Base&gt;() { @Override public Class&lt;? extends Base&gt; getClassForElement(JsonElement readElement) { String typ = readElement.getAsJsonObject().get("typ").getAsString(); if("a".equals(typ)){ return A.class; } else if("b".equals(typ)) { return B.class; } else { //"base".equals(typ) return Base.class; } } }); Gson gson = builder.createGson(); A a = new A(); a.typ = "a"; B b = new B(); b.typ = "b"; Base base = new Base(); base.typ = "base"; String jsona = gson.toJson(a); String jsonb = gson.toJson(b); String jsonbase = gson.toJson(base); Base ba = gson.fromJson(jsona, Base.class); // ^ returns A Base bb = gson.fromJson(jsonb, Base.class); // ^ returns B Base bbase = gson.fromJson(jsonbase, Base.class); // ^ returns Base You can find more examples on github
accepted answer of: http://stackoverflow.com/q/24785695
answers question: http://stackoverflow.com/q/24785695
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38500081

http://stackoverflow.com/a/24804645
score: 0
answers question: http://stackoverflow.com/q/24804388
type: Answer
has body: What is a LoadImage? Unless it's both a BufferedImage AND a Container your code won't even compile. And as a class can't be both a Container and a BufferedImage at the same time (given that both are classes, not interfaces, and multiple inheritance at class level doesn't exist in Java) your code can't work. You're going to have to figure out how to correctly initialise your LoadImage instance, and only the documentation (and possibly source) of that class is going to help you.

http://stackoverflow.com/q/24822756
accepted answer: http://stackoverflow.com/a/24822845
favorite count: 0
has comment: http://stackoverflow.com/comment/38535459
has body: I have mvn and java installed in my machine. Still it throws JAVA_HOME is not defined correctly.: mvn clean compile install -DskipTests Error: JAVA_HOME is not defined correctly. We cannot execute /opt/software/jdk1.7.0_65/bin/java ijaz@ijaz20:~/codebase/central-repo/core-container$ java -version java version "1.7.0_60" Java(TM) SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode) ijaz@ijaz20:~/codebase/central-repo/core-container$
tagged with: maven
has comment: http://stackoverflow.com/comment/38535361
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/24822823
has comment: http://stackoverflow.com/comment/38535561
score: 1
has comment: http://stackoverflow.com/comment/38535370
tagged with: java
has comment: http://stackoverflow.com/comment/38535312
type: Question
has answer: http://stackoverflow.com/a/24822935
has comment: http://stackoverflow.com/comment/38535339
answer count: 3
has title: while running mvn it throws error of java home not defined
has answer: http://stackoverflow.com/a/24822823
upvote count: 1
has answer: http://stackoverflow.com/a/24822845

http://stackoverflow.com/comment/38441344
type: Comment
type: QuestionComment
has text: That depends on your (business) requirements. If all inserts/update should be in a single transaction than you don't have a choice (and I don't believe you have 1,000,000,000,000 records in a single file)
comment on: http://stackoverflow.com/q/24772789
score: 0

android-asynctask
tags question: http://stackoverflow.com/q/24905981
tags question: http://stackoverflow.com/q/24779886
type: Tag
tags question: http://stackoverflow.com/q/24795914
tags question: http://stackoverflow.com/q/24800544
tags question: http://stackoverflow.com/q/24777778
tags question: http://stackoverflow.com/q/24896405
tags question: http://stackoverflow.com/q/24780508
tag name: android-asynctask
tags question: http://stackoverflow.com/q/24782996
tags question: http://stackoverflow.com/q/24768178
tags question: http://stackoverflow.com/q/24848811
tags question: http://stackoverflow.com/q/24804028
tags question: http://stackoverflow.com/q/24809730
tags question: http://stackoverflow.com/q/24827812
tags question: http://stackoverflow.com/q/24842268
tags question: http://stackoverflow.com/q/24906295
tags question: http://stackoverflow.com/q/24833696
tags question: http://stackoverflow.com/q/24779301
tags question: http://stackoverflow.com/q/24800982
tags question: http://stackoverflow.com/q/24856967
tags question: http://stackoverflow.com/q/24893780
tags question: http://stackoverflow.com/q/24902760
tags question: http://stackoverflow.com/q/24884587
tags question: http://stackoverflow.com/q/24761254
tags question: http://stackoverflow.com/q/24889042
tags question: http://stackoverflow.com/q/24773574
tags question: http://stackoverflow.com/q/24810586

http://stackoverflow.com/a/24750380
has body: the href has to be a valid URL for it to work on a server, so probably what you are after is something like Test this php file Of course replace it will valid server / context values
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24750342

http://stackoverflow.com/comment/38509836
has text: This is a Swing application so use a `JFrame` not a Frame.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24807952

http://stackoverflow.com/a/24819667
downvote count: 0
has comment: http://stackoverflow.com/comment/38546632
has comment: http://stackoverflow.com/comment/38530850
score: 4
accepted answer of: http://stackoverflow.com/q/24819442
has comment: http://stackoverflow.com/comment/62961332
type: AcceptedAnswer
type: Answer
has body: Just return the list from the controller method @RequestMapping(value = "/all", method = RequestMethod.GET) @ResponseBody public List&lt;Object[]&gt; getAllDeps() { List&lt;Object[]&gt; list = departmentService.getAllDepartments(); return list; } The @ResponseBody annotation does the transformation for you.
answers question: http://stackoverflow.com/q/24819442
upvote count: 4
has comment: http://stackoverflow.com/comment/38556474
has comment: http://stackoverflow.com/comment/38530791

http://stackoverflow.com/q/24790864
tagged with: jmenu
type: Question
tagged with: jmenuitem
upvote count: 2
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24791652
accepted answer: http://stackoverflow.com/a/24791652
has title: Java Swing JMenu text animation does not works as expected
has body: I need to animate some selected menuitems and their perent menus. So far the solution I got that works well with menuitems but doesn't work well with their parent menu. (Solution source :Is it possible to make some items in the menu to fade in with 500 ms onset delay in Java?). To do the same effect on JMenus, I tried to do the same thing that was in the solution for animating JMenuItems (overriding addNotify() and removeNotify() check FadeMenu Class). My code is following (yo can run this code): AnimationEngine.java package aphemeralmenudemo; import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; public class FadeMenuDemo { private AnimationEngine engine; public static void main(String[] args) { new FadeMenuDemo(); } public FadeMenuDemo() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } engine = new AnimationEngine(); JMenuBar mb = new JMenuBar(); JMenu Level1 = new JMenu("Level 1"); Level1.add("111"); Level1.add("222"); JMenu Level2 = new FadeMenu("Flip"); Level1.add(Level2); Level2.add(new FadeMenuItem("Fade 1")); Level2.add(new FadeMenuItem("Fade 2")); Level2.add("Static 1"); Level2.add("Static 2…
linked to: http://stackoverflow.com/q/15892571
score: 2
type: AnsweredQuestion
tagged with: jmenubar
tagged with: java
tagged with: swing

http://stackoverflow.com/comment/38508778
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24808034
has text: It's not clear that this is the case. The other quotes in the string are not escaped.

http://stackoverflow.com/q/24798793
tagged with: jndi
answer count: 1
downvote count: 0
favorite count: 0
has body: All, I understand that one can't access Tomcat's JNDI provider from outside Tomcat i.e, can't use a stand-alone java class to invoke the tomcat jndi. But this was in older version tomcat 5 and 6 Does anyone here has an idea if this is feasible with the latest versions staring from Tomcat7? If so, please let me know. Thanks!
type: UnansweredQuestion
score: 1
tagged with: java
has title: Tomcat JNDI + Standalone Java
upvote count: 1
tagged with: tomcat7
has answer: http://stackoverflow.com/a/24798909
type: Question

http://stackoverflow.com/comment/38473716
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24759295
type: AnswerComment
has text: Never mind I figured it out. Instead of using `to(Endpoint endpoint)` I used `recipientList(simple("${header.directory}"))`

http://stackoverflow.com/comment/38537044
comment on: http://stackoverflow.com/q/24823590
score: 1
has text: 1) No. 2) No. 3) No. 4) No. --- I think you should work through some tutorials about threading in Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24862927
has comment: http://stackoverflow.com/comment/38612170
has answer: http://stackoverflow.com/a/24867908
score: 2
has comment: http://stackoverflow.com/comment/38617072
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
tagged with: jakarta-ee
answer count: 2
possible better answer: http://stackoverflow.com/a/24867127
has body: I have a Bean, which creates an instance of an object, which i need to inject into other beans. Everything works fine, i can print a property of the injected object in the @PostConstruct method, but if i try to call a method from that injected object inside the @OnOpen method of a ServerEndpoint it gives me a NullPointerException. Here is my ServerEndpoint @Named @ApplicationScoped @ServerEndpoint(value = "/websocket") public class BeanThree { private String message = "test"; @Inject private User user; @PostConstruct public void init() { System.out.println(user.getUserName()); } &lt;-- displayed in the console correctly public String getMessage() { return this.message; } @OnOpen public void onOpen(Session session) { System.out.println("onOpen"); System.out.println(user.getUserName()); &lt;-- causes NullPointerException } } Is it possible to fix this? Edit1: Im using cdi 1.2, jetty 9.1, jsf 2.2, java-ee7 and websockets from java-ee7
downvote count: 0
accepted answer: http://stackoverflow.com/a/24867908
favorite count: 0
tagged with: cdi
has title: how to use an Object injected with @Inject within a server endpoints @OnOpen method
has answer: http://stackoverflow.com/a/24867127

windows
tags question: http://stackoverflow.com/q/24839087
tags question: http://stackoverflow.com/q/24883056
tags question: http://stackoverflow.com/q/24758093
tags question: http://stackoverflow.com/q/24774877
tags question: http://stackoverflow.com/q/24898743
tags question: http://stackoverflow.com/q/24904138
tags question: http://stackoverflow.com/q/24816349
tags question: http://stackoverflow.com/q/24841626
tags question: http://stackoverflow.com/q/24876423
tags question: http://stackoverflow.com/q/24827012
tags question: http://stackoverflow.com/q/24850014
tags question: http://stackoverflow.com/q/24777073
tags question: http://stackoverflow.com/q/24769836
tags question: http://stackoverflow.com/q/24837367
tags question: http://stackoverflow.com/q/24786992
tags question: http://stackoverflow.com/q/24829808
tags question: http://stackoverflow.com/q/24803733
tags question: http://stackoverflow.com/q/24843491
tags question: http://stackoverflow.com/q/24865110
tags question: http://stackoverflow.com/q/24805238
tags question: http://stackoverflow.com/q/24749853
type: Tag
tags question: http://stackoverflow.com/q/24863381
tags question: http://stackoverflow.com/q/24844971
tags question: http://stackoverflow.com/q/24771613
tags question: http://stackoverflow.com/q/24818874
tags question: http://stackoverflow.com/q/24808295
tags question: http://stackoverflow.com/q/24822566
tags question: http://stackoverflow.com/q/24833727
tag name: windows
tags question: http://stackoverflow.com/q/24751691
tags question: http://stackoverflow.com/q/24752202
tags question: http://stackoverflow.com/q/24750713
tags question: http://stackoverflow.com/q/24859188
tags question: http://stackoverflow.com/q/24904731
tags question: http://stackoverflow.com/q/24804547

http://stackoverflow.com/a/24850808
type: Answer
answers question: http://stackoverflow.com/q/24850707
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24850707
upvote count: 2
type: AcceptedAnswer
has body: when clearing your ArrayList temp, all you do is deleting it's values. however when you put the ArrayList into your map, you actually put the object reference of the ArrayList into the map and not a new list with new values. So in your map is four times the same ArrayList (and thus four times the same values). HashMap&lt;Integer, ArrayList&lt;Integer&gt;&gt; map = new HashMap&lt;Integer, ArrayList&lt;Integer&gt;&gt;(); int serialno = 0; for (int i = 1000; i &lt; 1004; i++) { ArrayList&lt;Integer&gt; temp = new ArrayList&lt;Integer&gt;(); temp.add(i); temp.add((i + 1000)); System.out.println(i + 1000); map.put(serialno++, temp); } System.out.println(map); When you create a new List in every loop, you will actually put different ArrayLists (with different references) in the map.

http://stackoverflow.com/comment/38445662
type: AnswerComment
has text: `"You have to..."` ammm...it may be `"you can..."`, he can implement other collections also..!!!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24774753

http://stackoverflow.com/comment/38834504
type: Comment
comment on: http://stackoverflow.com/q/24888760
type: QuestionComment
has text: Possible duplicate of [How to access the status of the printer](http://stackoverflow.com/questions/16035739/how-to-access-the-status-of-the-printer "How to access the status of the printer?")
score: 0

http://stackoverflow.com/comment/38690480
score: 1
has text: So, you want to execute the query `select count(*) from Admitclinic where childid = ?`. Google for "JDBC tutorial". This is pretty basic stuff.
comment on: http://stackoverflow.com/q/24903711
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38646669
score: 0
type: Comment
type: QuestionComment
has text: Maybe it's easier for us if you tell us what library you are using.
comment on: http://stackoverflow.com/q/24881120

http://stackoverflow.com/q/24785353
has answer: http://stackoverflow.com/a/24787963
has comment: http://stackoverflow.com/comment/38470239
tagged with: swing
has body: I am trying to listen to the keystroke for a slash character in a Swing component. Registering it with component.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, 0), myAction); works, when using an english keyboard layout (where a slash is a single keystroke). However when using a german keyboard layout, a slash is entered via shift-7 and the obove code doesn't work! Now what is the correct way to listen for exactly a slash character, instead of a combination of key?
score: 2
tagged with: key-bindings
type: AnsweredQuestion
tagged with: java
has title: Listening for a slash keystroke without knowing the modifier key in Swing
has comment: http://stackoverflow.com/comment/38465928
type: Question
accepted answer: http://stackoverflow.com/a/24787963
downvote count: 0
has comment: http://stackoverflow.com/comment/38470882
answer count: 1
tagged with: keystroke
has comment: http://stackoverflow.com/comment/38477698
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/38523656
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24816159
has text: Sorry, should have clarified what I meant by performance problems - basically it'll start up and run fine for a few hours, but over time the memory size will steadily increase, and CPU usage likewise increases, until the whole application has hung at 100% CPU and most of the system's memory a few days later.
score: 0

http://stackoverflow.com/comment/38647639
type: Comment
has text: I wouldn't be so dogmatic with "should never use the ID for equality/hashing" statement. I'm working on a big project that successfully uses ID as a hash key for several years. ID "fits this criteria nicely" (PRO JPA 2.0 book). The key point is to not compare entities that was not persisted yet. Maintaining hash key based on business attributes of the entity might be a great idea but is much more challenging.
comment on: http://stackoverflow.com/a/24879391
score: 0
type: AnswerComment

http://stackoverflow.com/q/24904260
type: AnsweredQuestion
upvote count: 3
tagged with: java
has title: programming logic of java program
has body: I need to create a program in java in which when the input given is say: hhllyyjhhh the output should be h2l2y2j1h3 instead i get the output h2l2y2j1 I know the reason why, but please tell me how should I correct it or may be tell a new logic. in the following code T is the character array and ans is an empty string. int counter=0; for(int i=0;i&lt;T.length;i++) { for(int j=i;j&lt;T.length;j++) { if(T[i]==T[j]) { counter++; } else { ans=ans+T[i]+counter; i=j-1; counter=0; break; }
accepted answer: http://stackoverflow.com/a/24904457
type: Question
score: 3
has answer: http://stackoverflow.com/a/24908752
downvote count: 0
favorite count: 0
tagged with: logic
has answer: http://stackoverflow.com/a/24904457
has answer: http://stackoverflow.com/a/24904370
has answer: http://stackoverflow.com/a/24904534
answer count: 4
possible better answer: http://stackoverflow.com/a/24904370

http://stackoverflow.com/comment/38452344
type: Comment
has text: @Zmavus I have no idea what your program does, so there is no way I could give suggestions. If you have the time and patient to explain what your system is aimming to do in the question and why you'd need to keep all those data in memory instead of discarding them right away, then maybe someone could help you solve the problem from the root. i.e. doesn't have to create/store 50k entries in the first place. That said, if you HAVE TO store 50k word,frequency pair with get/set in memory, then hashmap is probably the way to go.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24778264

http://stackoverflow.com/a/24817406
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24796838
has body: 1 Confirm the server is indeed using 512m of perm space. 2 ensure you explicitly undeploy and then deploy your new version of applications. If needed explicitly delete old app and even remove temp and stage folder contents. You would run out of perm space when wls thinks it needs all the classes old and new.
upvote count: 1

http://stackoverflow.com/comment/38664494
type: QuestionComment
has text: Thanks greg449 , it helped. Can u plz add this as a answer, so i can accept it
comment on: http://stackoverflow.com/q/24890088
score: 0
type: Comment

http://stackoverflow.com/q/24827720
has answer: http://stackoverflow.com/a/24828462
type: AnsweredQuestion
has body: I need set system environment path for java, sdk, opencv, ndk etc.. can I put all the path under the same variable "path", &amp; use the semicoma, ";" to separate each other. The problem is when I try to test by using cmd.exe It can only recognize the first path values. Example: when I put sdk's path on first place and follow by java's path, it shown vice verse, it shown SO I should separate the path by difference variables name? WHat is the best way to solve it? Thanks.
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38545387
has comment: http://stackoverflow.com/comment/38545316
has comment: http://stackoverflow.com/comment/38545152
type: Question
accepted answer: http://stackoverflow.com/a/24828462
tagged with: sdk
has title: environment system variables: path not recognized error
has comment: http://stackoverflow.com/comment/38545084
answer count: 1
tagged with: android

http://stackoverflow.com/comment/38684870
score: 1
has text: Cell rendering is control by the `TableCellRenderer`, you can learn more about those at [Concepts: Editors and Renderers](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#editrender) and [Using Custom Renderers](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#renderer). If you really want something easier, you could take a look at the `JXTable` from the SwingLabs libraries, which provides row highlighting
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24901424

http://stackoverflow.com/comment/38517898
comment on: http://stackoverflow.com/q/24813117
score: 0
type: Comment
has text: What do you mean by integer value?
type: QuestionComment

http://stackoverflow.com/comment/38582190
comment on: http://stackoverflow.com/q/24847275
score: 0
type: Comment
type: QuestionComment
has text: Well, that was essential info you should have provided in the first place. Looks like @user1432734 is on the right track.

http://stackoverflow.com/q/24753187
has comment: http://stackoverflow.com/comment/38404494
downvote count: 0
has title: Principal Component Analysis in java
answer count: 1
tagged with: principal-components
has body: I am trying to achieve multiplication in array for doing PCA in java I calculated mean and substrtacted it from each x values.Next I need to find covarience So inorder to find that I need to multiply all the combinations in a given array [a,b,c] --&gt; (aa)(ab)(ac)(bb)(bc)(cc) How to construct a matrix of all possible products? Whether taking subset and multiplying solves the problem?
has comment: http://stackoverflow.com/comment/38405293
favorite count: 0
has answer: http://stackoverflow.com/a/24753871
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: multiplication
upvote count: 1
has comment: http://stackoverflow.com/comment/38404469
accepted answer: http://stackoverflow.com/a/24753871
has comment: http://stackoverflow.com/comment/38404496
type: Question

http://stackoverflow.com/a/24810647
has comment: http://stackoverflow.com/comment/38512861
score: 0
type: AcceptedAnswer
has body: public void getStoredTasks(CallbackHandler&lt;ArrayList&lt;PAWTask&gt;&gt; handler) { GetTasksTask task = new GetTasksTask(mongoDB, handler); task.doInBackground(); } replace it with public void getStoredTasks(CallbackHandler&lt;ArrayList&lt;PAWTask&gt;&gt; handler) { GetTasksTask task = new GetTasksTask(mongoDB, handler); task.execute(); } the AsyncTask is in control of the BackThread..
type: Answer
answers question: http://stackoverflow.com/q/24810586
accepted answer of: http://stackoverflow.com/q/24810586

http://stackoverflow.com/comment/38401912
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24751842
has text: If that is all you want, you could just keep polling the list to see if it is still `null` or not.
type: AnswerComment

http://stackoverflow.com/q/24762380
type: UnansweredQuestion
upvote count: 1
has title: Writing custom matchers that play nicely with Hamcrest AllOf / CombinableMatcher matchers
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38473180
has answer: http://stackoverflow.com/a/26083484
linked to: http://stackoverflow.com/q/20566668
type: Question
has comment: http://stackoverflow.com/comment/38537652
downvote count: 0
tagged with: matcher
tagged with: hamcrest
answer count: 1
has body: I am trying to compose two matchers, so that instead of writing assertThat(response, hasStatusCode(OK)); assertThat(response, hasMessage("Some message.")); I can write something like assertThat(response, both(hasStatusCode(OK)) .and(hasMessage("Some message."))); However, I am getting undesirable strange output when running the assertion when one or both matchers fail: Expected: (status code to be &lt;200&gt; and response to contain message "Some Message.") but: response to contain message "Some Message." response message was "Actual message" where something seems to be interfering with the mismatch text. I would expect the 'but' line to read something like but: (status code was &lt;200> and response message was "Actual message") Logically, the matcher appears to work fine. The matchers are: private Matcher&lt;Response&gt; hasMessage(final String expectedMessage) { return new TypeSafeDiagnosingMatcher&lt;Response&gt;() { @Override protected boolean matchesSafely(final Response response, final Description mismatch) { String message = response.getEntity().toString(); if (message != expectedMessage) { mismatch.appendText("response message was ").appendValue(message); return false; } return true; } @Override public void describeTo(final Description description) { description.appendText("response to contain message ").appendValue(expectedMessage); } }; } private Matcher&lt;Response&gt; hasStatusCode(final Status expectedStatusCode) { return new TypeSafeDiagnosingMatcher&lt;Response&gt;() { @Override protected boolean matchesSafely(final Response response, final Description mismatch) { int statusCode = response.getStatus(); if (expectedStatusCode.getStatusCode() != statusCode) { mismatch.appendText("status code was ").appendValue(statusCode); } return true; } @Override public void describeTo(final Description description) { description.appendText("status code to be ").appendValue(expectedStatusCode.getStatusCode()); } }; }
favorite count: 0

http://stackoverflow.com/q/24811400
type: Question
has comment: http://stackoverflow.com/comment/38514494
has body: The program runs if i comment everything to do with the other activity out, but when I try to run my program with it in it crashes as soon as it hits this line: if(savedInstanceState == null) { settings.setImperial(true); settings.setUK(true); } I have created an Object of the class I wish to use: private FuelEconomySettingsActivity settings = new FuelEconomySettingsActivity(); Here is FuelEconomyCalculatorActivity.java package com.example.fuelcalculator; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; public class FuelEconomyCalculatorActivity extends ActionBarActivity implements OnClickListener { private EditText fuelEditText; private EditText distanceEditText; private TextView mpgTextView; private TextView litresTextView; private Button calculateButton; private Button clearButton; private RadioButton gallonsRadio; private RadioButton litresRadio; private RadioButton milesRadio; private RadioButton kmRadio; private String mpg = " "; private String kp100 = " "; private FuelEconomySettingsActivity settings = new FuelEconomySettingsActivity(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fuel_economy_calculator); fuelEditText = (EditText) findViewById(R.id.fuelEditText); distanceEditText = (EditText) findViewById(R.id.distanceEditText); mpgTextView = (TextView) findViewById(R.id.mpgTextView); litresTextView = (TextView) findViewById(R.id.litresTextView); calculateButton = (Button) findViewById(R.id.calculateButton); clearButton = (Button) findViewById(R.id.clearButton); gallonsRadio = (RadioButton) findViewById(R.id.gallonsRadio); litresRadio = (Ra…
accepted answer: http://stackoverflow.com/a/24894520
has comment: http://stackoverflow.com/comment/38671057
has comment: http://stackoverflow.com/comment/38538598
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38670978
tagged with: stack-overflow
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38514365
has answer: http://stackoverflow.com/a/24894520
has comment: http://stackoverflow.com/comment/38515398
has comment: http://stackoverflow.com/comment/38514457
has comment: http://stackoverflow.com/comment/38514309
has title: stack overflow exception upon using a setter through another class
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38514563
upvote count: 1
has comment: http://stackoverflow.com/comment/38514452

http://stackoverflow.com/a/24899254
answers question: http://stackoverflow.com/q/24899178
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24899178
has body: Here is an example of a text field using swing: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class GUI extends JFrame { // The JFrame is the window JTextField textField; // The textField public GUI() { textField = new JTextField(10); // The user can enter 10 characters into the textField textField.addActionListener(new ActionListener() { // This will listen for actions to be performed on the textField (enter button pressed) @Override public void actionPerformed(ActionEvent e) { // Called when the enter button is pressed // TODO Auto-generated method stub String inputText = textField.getText(); // Get the textField's text textField.setText(""); // Clear the textField System.out.println(inputText); // Print out the text (or you can do something else with it) } }); JPanel panel = new JPanel(); // Make a panel to be displayed panel.add(textField); // Add the textField to the panel this.add(panel); // Add the panel to the JFrame (we extend JFrame) this.setVisible(true); // Visible this.setSize(500, 500); // Size this.setDefaultCloseOperation(EXIT_ON_CLOSE); // Exit when the "x" button is pressed } public static void main(String[] args) { GUI gui = new GUI(); } }
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24767747
upvote count: 1
has body: You should not change the sourcecode of TreeMap, instead you should extend it as escitalopram said in the comments: class MyTreeMap extends TreeMap { void myShinyFunction() { ... } @Override void someNiceFunctionInTreeMap() { ... } } If you are not extending the functionality of TreeMap (for example, you want to change the private methods/fields rather than public API for some reason), then you should implement a new class yourself rather than modifying the source code. But to try and answer your original question directly: As far as I understand, Java SE is under the Oracle Binary Code license: Java SE continues to be available under the Oracle Binary Code License (BCL) free of charge. and the OpenJDK source code is released under GPL v2: What open-source license is OpenJDK published under? GPL v2 for almost all of the virtual machine, and GPL v2 + the Classpath exception for the class libraries and those parts of the virtual machine that expose public APIs. If you modified the OpenJDK source code and put that in your commercial program, then from my understanding your entire program would need to be GPL. However, I'm not a lawyer, and this information may very well be incorrect. Consulting with one would be a good idea if you plan on doing this.
score: 1
accepted answer of: http://stackoverflow.com/q/24767261
has comment: http://stackoverflow.com/comment/38433441
answers question: http://stackoverflow.com/q/24767261
has comment: http://stackoverflow.com/comment/38433676
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/24759536
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/24759695
score: -2
has comment: http://stackoverflow.com/comment/38416452
has title: Google maps : Current location blue bubble not shown , current location button not working in older device
answer count: 2
tagged with: google-maps
has body: I am doing a project using google maps.The current location is shown in new devices , but is not shown in older 2.3 device.How do i make the current location visible in the older device. My code: public void initialiseMap() { if (googleMap == null) { googleMap = ( (SupportMapFragment) getSupportFragmentManager().findFragmentById( R.id.map)).getMap(); } // check if map is created successfully or not if (googleMap == null) { Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); } else { googleMap.setMyLocationEnabled(true); googleMap.getUiSettings().setMyLocationButtonEnabled(true); googleMap.getUiSettings().setCompassEnabled(true); // UiSettings uiSettings = googleMap.getUiSettings(); // uiSettings.setMyLocationButtonEnabled(true); } //locationManager.requestLocationUpdates(provider, 20000, 0, this); LatLng latLng = new LatLng(current_latitude, current_longitude); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Zoom in the Google Map //googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 11.5f)); } I have heard using a support libarary would help..Can someone clarify that point too pls.
upvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24778250
tagged with: android

http://stackoverflow.com/comment/38691575
type: Comment
has text: so.. is that able to get data from ActivityDashboard.java ? if Broadcast Receiver is on different file ?
comment on: http://stackoverflow.com/a/24904865
score: 0
type: AnswerComment

specifications
type: Tag
tags question: http://stackoverflow.com/q/24840748
tag name: specifications

http://stackoverflow.com/comment/38948716
has text: This Question is specifically for a Gradle build because Ant and Gradle projects are setup very differently. It is my understanding that Android is moving away form both Ant and Eclipse in favor of Gradle and Android Studio (built on top of IntelliJ). IntelliJ can setup the Ant project without any issues.
type: AnswerComment
comment on: http://stackoverflow.com/a/24945270
score: 0
type: Comment

http://stackoverflow.com/q/24891390
type: Question
accepted answer: http://stackoverflow.com/a/24891433
possible better answer: http://stackoverflow.com/a/34187213
has comment: http://stackoverflow.com/comment/38665853
tagged with: java
has title: Using ArrayList of abstract class
score: 0
answer count: 2
tagged with: casting
tagged with: generics
tagged with: arraylist
has answer: http://stackoverflow.com/a/24891433
type: AnsweredQuestion
has body: I have an abstract class C0. I have several other classes that inherit from C0. They override the abstract methods and have special methods of their own. I want to create an ArrayList containing every one of those specialized classes. Here is a chunk of code showing how I (want to) do it: ArrayList&lt;C0&gt; A = new ArrayList&lt;&gt;(); A.add(new C1() ); A.add(new C2() ); A.get(x).method_of_C0(); // Works because my classes extend C0. A.get(0).method_of_C1(); // Does not work A.get(1).method_of_C2(); // Does not work I would like to be able to call C1's and C2's own methods through this ArrayList. Would that be possible? I tried some tweaks by casting manually but I had no success.
has comment: http://stackoverflow.com/comment/38665976
has answer: http://stackoverflow.com/a/34187213

http://stackoverflow.com/comment/38705448
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24896353
has text: I don't know your application and what you expect from your service. When you get a bad result and don't want to show this to your user, then not. Depends on your use case and what your service makes. All my services are using an envelop which is parsabel in a generic way, which tells me if got a result from the service (embeded in the envelop) or if an error happens including a http status code like number concept. Depending on the status code my generic part of client libs decide how to handle the response.

http://stackoverflow.com/q/24776129
has answer: http://stackoverflow.com/a/25045284
has comment: http://stackoverflow.com/comment/38956833
has comment: http://stackoverflow.com/comment/38826730
tagged with: java
type: UnansweredQuestion
has body: I am using Postgres 9.3, Spring and Java. For BatchUpdateException from javadoc: After a command in a batch update fails to execute properly and a BatchUpdateException is thrown, the driver may or may not continue to process the remaining commands in the batch. If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will have an element for every command in the batch rather than only elements for the commands that executed successfully before the error. In the case where the driver continues processing commands, the array element for any command that failed is Statement.EXECUTE_FAILED. The I register following translator in jdbcTemplate public class DuplicateRecordSQLErrorCodesTranslator extends SQLErrorCodeSQLExceptionTranslator { @Override protected DataAccessException doTranslate(String task, String sql, SQLException ex) { String errorCode = ex.getErrorCode() == 0 ? ex.getSQLState() : String.valueOf(ex.getErrorCode()); if (ex instanceof BatchUpdateException) { int[] updatesCount = ((BatchUpdateException) ex).getUpdateCounts(); Then in scenario I am trying to insert a batch to DB of 100 entries, but 50 of them are duplicated. Eventually I am not able to retrieve all duplicated entries in the first transaction because updateCounts returned is always 1.
has comment: http://stackoverflow.com/comment/38449444
has comment: http://stackoverflow.com/comment/38448660
has comment: http://stackoverflow.com/comment/38726550
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/4069718
favorite count: 0
tagged with: postgresql
type: Question
has title: BatchUpdateException updateCounts is 1 always
has answer: http://stackoverflow.com/a/25047351
tagged with: spring-jdbc
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/38761854

http://stackoverflow.com/comment/38461315
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24783195
has text: This is horrible. Just horrible. Even if you could hack your way around this why would you want to? Why not take `param1` in the ctor? Otherwise rename the method parameter. But using an instance initialiser on an anonymous class to hack internal state is just nasty.

http://stackoverflow.com/a/24900097
downvote count: 0
has body: For Mac, it might work without -Djava.library.path option. Try the following command: java -jar DynamoDBLocal.jar Also, the link to the download in the blog does not point to the latest DynamoDB Local version. You can get the latest version from here. This link is also present in the AWS Documentation. Thanks.
has comment: http://stackoverflow.com/comment/38692913
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24894109
score: 2

http://stackoverflow.com/q/24850780
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38588445
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24851142
linked to: http://stackoverflow.com/q/18063395
has body: Actually, my app is a sample from the book: Beginning Android 4 Development. It's very simple - I just want to apply a dialog theme to an activity. MainActivity.java: package com.example.activity101; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; 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); } } Layout: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.activity101.MainActivity" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;/RelativeLayout&gt; This the AndroidManifest.xml codes: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.activity101" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sd…
accepted answer: http://stackoverflow.com/a/24851142
has answer: http://stackoverflow.com/a/24851056
answer count: 3
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/30016244
favorite count: 0
has answer: http://stackoverflow.com/a/30016244
has title: My Android app crashes after adding "@android:style/Theme.Dialog" in the AndroidManifest.xml
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/24892965
type: AnsweredQuestion
tagged with: java
has body: This is my main method, i am trying to get back into coding, for i failed at it repeatedly in school. I want to take an array from my main method with user input from a loop, and pass it to a constructor in my "TestScoresTwo.java" class. I want to then take that array and use it to sum the values and find the average in a method in the class, and then return the sum. import java.math.*; import java.text.DecimalFormat; import java.io.*; public class labBookFortyTwo { public static void main(String[] args) { Scanner myInput = new Scanner(System.in); System.out.println("Please enter the amount of grades there are "); int size = myInput.nextInt(); double grade = 0; double[] myArray = new double[size]; for(int count = 0; count &lt; myArray.length; count++) { System.out.println("enter grade "); grade = myInput.nextDouble(); myArray[count] = grade; System.out.println("grade is " + myArray[count] ); } TestScoresTwo myScore = new TestScoresTwo(myArray, size); double avg = myScore.avgGrade(); System.out.println("avg is" + avg); } } This is my TestScoresTwo.java Class. public class TestScoresTwo { int size = 0; double[] tScore = new double[size]; double sum = 0; public TestScoresTwo(double[] scores ,int sizE) { double[] tScore = scores; size = sizE; } public double avgGrade() { for(int count = 0; count &lt; tScore.length ; count++) { sum = tScore[count] + sum; } double avg = sum / size; return avg; } } When it compiles my output is: "Please enter the amount of grades there are" 3 "enter grade" 11 "grade is 11.0" 50 "grade is 50.0" 70 "grade is 70.0" "avg" is 0.0" "Press any key to continue..." So for some reason in my class TestScoresTwo.java, the for loop inst being entered, and im not sure why. They are two separate files , and i cant think of any other information to include. Thank you for any help you can give.
type: Question
tagged with: arrays
has title: How to pass a array to a constructor and use it in a class?
tagged with: class
score: 0
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24893009
downvote count: 1
has answer: http://stackoverflow.com/a/24893013
accepted answer: http://stackoverflow.com/a/24893013
favorite count: 0
tagged with: constructor
possible better answer: http://stackoverflow.com/a/24893009
has comment: http://stackoverflow.com/comment/38668851

http://stackoverflow.com/comment/38672249
type: AnswerComment
has text: See this question for some suggestions: http://stackoverflow.com/questions/24883018/is-using-swingutilities-invokelater-inside-a-java-game-loop-a-bad-practice/24883129?noredirect=1#comment38670638_24883129
type: Comment
comment on: http://stackoverflow.com/a/24887470
score: 0

http://stackoverflow.com/q/24882343
has answer: http://stackoverflow.com/a/24900045
accepted answer: http://stackoverflow.com/a/24900045
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
answer count: 1
downvote count: 0
has body: I've recently enabled Proguard's obfuscation feature for the first time, and it's finding all the holes in my -keep rules, it seems. My keep rules are defined using annotations: annotated elements are to be left alone. The ensuing config looks something like this: # Keep the annotation. -keep @interface org.mozilla.gecko.mozglue.JNITarget # Keep classes tagged with the annotation. -keep @org.mozilla.gecko.mozglue.JNITarget class * # Keep all members of an annotated class. -keepclassmembers @org.mozilla.gecko.mozglue.JNITarget class * { *; } # Keep annotated members of any class. -keepclassmembers class * { @org.mozilla.gecko.mozglue.JNITarget *; } # Keep classes which contain at least one annotated element. Split over two directives # because, according to the developer of ProGuard, "the option -keepclasseswithmembers # doesn't combine well with the '*' wildcard" (And, indeed, using it causes things to # be deleted that we want to keep.) -keepclasseswithmembers class * { @org.mozilla.gecko.mozglue.JNITarget &lt;methods&gt;; } -keepclasseswithmembers class * { @org.mozilla.gecko.mozglue.JNITarget &lt;fields&gt;; } All entry points to Java from Reflection/JNI/etc. are annotated with this (or an equivalently-configured, but better-named) annotation. Unfortunately, this doesn't stop Proguard from renaming the class used as the return type for a method, thus changing its signature and breaking the entry point. Javap reveals, for example, that the method with signature: public org.mozilla.gecko.Tab loadUrl(java.lang.String); comes out of Proguard looking like: public mt loadUrl(java.lang.String); despite being annotated. So, what's the mystical -keep syntax to keep dependant classes? It seems strange that, having told it I wish to keep an entry point, it proceeds to corrupt it anyway...
has title: How to stop Proguard from deleting return types?
tagged with: proguard
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/24875336
has comment: http://stackoverflow.com/comment/38820473
accepted answer of: http://stackoverflow.com/q/24875234
answers question: http://stackoverflow.com/q/24875234
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: Are you looking for something to translate X-SAMPA (which phoneticForm looks like) to IPA? If so, this page has code for doing so in several programming languages. Unfortunately none of them are Java, but if you know one of Perl, Python, C++ or Lisp you may be able to adapt that code into Java.
downvote count: 0
has comment: http://stackoverflow.com/comment/38637454
has comment: http://stackoverflow.com/comment/38820639
score: 1

http://stackoverflow.com/q/24903325
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24903353
score: 0
answer count: 2
has title: Cannot find existing Java version from JAVA_HOME
type: UnansweredQuestion
has body: I have installed java successfully [ ~]$ echo $JAVA_HOME /usr/local/java/jdk1.7.0_07/ [ ~]$ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/java/jdk1.7.0_07/bin But while starting my application, I am getting error like : Cannot find existing Java version from JAVA_HOME Please help!
has answer: http://stackoverflow.com/a/24903838
tagged with: installation

http://stackoverflow.com/q/24850971
answer count: 1
tagged with: spring-security
score: 0
tagged with: vaadin7
has title: Role based view in VAADIN 7
type: AnsweredQuestion
has body: I have an Vaadin 7 application working with Spring and currently there is one ADMIN role that can log in into the system and see all views. Now I need to add another role let's say CO_ADMIN and allow user with this role to view part of views. What is the best way to achieve this? Thanks
tagged with: java
has answer: http://stackoverflow.com/a/24903566
accepted answer: http://stackoverflow.com/a/24903566
type: Question

http://stackoverflow.com/q/24796355
upvote count: 0
tagged with: applet
has body: I have a self signed application, when i load it in browser it give this warning (Do you want to run this application) each time. I don't want this pop up to appear. I have tried all the settings in java configure setting.
answer count: 1
has title: How to stop java warning pop ups from appearing again and again
has answer: http://stackoverflow.com/a/24796395
favorite count: 0
score: -1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38486276
downvote count: 1
tagged with: java
type: Question

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/24824936
tags question: http://stackoverflow.com/q/24767567

http://stackoverflow.com/comment/38641187
comment on: http://stackoverflow.com/q/24878211
has text: Never mind I got it figured out, thanks for the help!!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24812286
type: Answer
answers question: http://stackoverflow.com/q/24812260
has comment: http://stackoverflow.com/comment/39939101
score: 2
has comment: http://stackoverflow.com/comment/38516048
has comment: http://stackoverflow.com/comment/38516257
upvote count: 2
has comment: http://stackoverflow.com/comment/38516024
downvote count: 0
has comment: http://stackoverflow.com/comment/38516137
has body: you are missing spring-core library in your runtime classpath

http://stackoverflow.com/a/25073679
type: Answer
has body: Storm is fairly resilient when it comes to worker-nodes coming offline &amp; online. However, just like Spark, it does require Zookeeper. The good news is that Storm is comes with a sister project to make deployment a breeze: https://github.com/nathanmarz/storm-deploy/wiki If you're running vanilla storm on EC2, the storm-deploy project could be what you're looking for.
score: 0
answers question: http://stackoverflow.com/q/24892962

http://stackoverflow.com/comment/38504334
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24805866
score: 1
has text: @tobias_k, I believe your comment constitutes a fine answer.

http://stackoverflow.com/comment/38636854
score: 2
comment on: http://stackoverflow.com/a/24867630
type: AnswerComment
type: Comment
has text: If your stuff is XML, then any random string of characters is XML, and the term XML has ceased to have any meaning. If you must handle it, then the first step is to acknowledge that it is not XML and that XML tools will be of no use to you. The next step is to understand what it actually is: that is, reverse-engineer a language specification that your parser will be written to handle.

http://stackoverflow.com/comment/38446146
type: Comment
has text: ok so I tried this approach also, I deleted the 'guest' user and then tried login using 'test' (test user is still their). It showed 'Authentication Failure'
comment on: http://stackoverflow.com/q/24774877
score: 0
type: QuestionComment

http://stackoverflow.com/q/24789495
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38473673
type: Question
accepted answer: http://stackoverflow.com/a/24789610
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24789788
has title: Java delete first part of string (case-insensitive)
answer count: 3
possible better answer: http://stackoverflow.com/a/24789633
has comment: http://stackoverflow.com/comment/38473766
has answer: http://stackoverflow.com/a/24789633
has body: I searched and couldn't find the right code as I only saw case sensitive ones. I am writing code that checks that the file name starts with "CMF-". I have the code that if the name doesn't start with CMF- then it is added (this works). However, I am having an issue with case-sensitivity. The first if statement is where I need help. For example, when someone saves the name as cmf-something then I need to delete the cmf- and put CMF- in its place. As another example, someone saves a file as Cmf-something it will also need to delete the Cmf- and put CMF- in its place. String name = document.getObjectName(); String newName; String haystack = "CMF-"; if(haystack.regionMatches(true, 0, name, 0, 4) &amp;&amp; !name.startsWith(haystack)) { //part to delete lowercase cmf and then add cmf } //Check the object name for CMF- if(!haystack.regionMatches(true, 0, name, 0, 4)) { //System.out.println("Missing CMF- on name \nAdding CMF- to " + name); StringBuffer str = new StringBuffer("CMF-"); newName = str.append(name).toString(); document.setObjectName(newName); }
has answer: http://stackoverflow.com/a/24789610
upvote count: 1

http://stackoverflow.com/a/24757897
has comment: http://stackoverflow.com/comment/38431115
has comment: http://stackoverflow.com/comment/38413713
has comment: http://stackoverflow.com/comment/38413258
has body: If you look at the Advanced bindings section of the manual, they note that uploaded files will be bound to a File object. File upload is easy with Play. Use a multipart/form-data encoded request to post files to the server, and then use the java.io.File type to retrieve the file object. When I take your code and test it with the f1 parameter of addPhoto2 as a File, it works perfectly fine. With f1 as Object, the parameter doesn't get set (and thus is null). I'm guessing the automatic Play parameter binding process gets confused when you specify a file parameter as an object and refuses to set it.
has comment: http://stackoverflow.com/comment/38413868
answers question: http://stackoverflow.com/q/24756749
score: 0
has comment: http://stackoverflow.com/comment/38449266
type: Answer

http://stackoverflow.com/comment/38617925
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24866091
type: Comment
has text: `d.grantedUsers.id` would it work?? as its a set not an object

http://stackoverflow.com/a/36586944
answers question: http://stackoverflow.com/q/24894658
type: Answer
has comment: http://stackoverflow.com/comment/60818936
has body: BLE scanning on Android is pretty battery intensive, and it's definitely not something you want to do in the background all the time. If you are working on a background application with stationary bluetooth devices (à la ibeacons) that you know the location of, you can use Geofences to turn scanning on and off when you think you are in the approximate proximity of a device. If you are not careful geofencing can also drain battery. If you don't know the location of your bluetooth devices I guess you can also play tricks with ActivityRecognition, i.e only scan periodically when the user is walking and stopping it if the user is stationary/running/biking/in vehicle. Again, the activity recognition stuff also takes battery so you are going to have to be judicious.
has comment: http://stackoverflow.com/comment/60777961
has comment: http://stackoverflow.com/comment/60885517
score: 4
has comment: http://stackoverflow.com/comment/60813635
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/60813533

http://stackoverflow.com/q/24882840
has body: I'm trying to create a connection between two ellipses on a canvas, AFTER having created the ellipses and storing their positions on the canvas. These stored positions need to be used to create the connection. The code I've written works for RectangleFigures but does not for Ellipses. I can't seem to see the difference between the two cases. Could someone please help? Thanks.*I've added short testable code to illustrate my problem. To see it working with Rectangles, please uncomment the line saying UNCOMMENT THIS import java.util.ArrayList; import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.ChopboxAnchor; import org.eclipse.draw2d.Ellipse; import org.eclipse.draw2d.Figure; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.LightweightSystem; import org.eclipse.draw2d.PolygonDecoration; import org.eclipse.draw2d.PolylineConnection; import org.eclipse.draw2d.RectangleFigure; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DragSource; import org.eclipse.swt.dnd.DragSourceEvent; import org.eclipse.swt.dnd.DragSourceListener; import org.eclipse.swt.dnd.DropTarget; import org.eclipse.swt.dnd.DropTargetEvent; import org.eclipse.swt.dnd.DropTargetListener; import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Label; public class EllipseProblem { private Shell shell; private Display display; private final Label lblUnicorn; private final Canvas canvas; final IFigure pan…
accepted answer: http://stackoverflow.com/a/24883523
has comment: http://stackoverflow.com/comment/38650201
tagged with: draw2d
type: AnsweredQuestion
tagged with: user-interface
downvote count: 0
score: 1
tagged with: ellipse
favorite count: 0
has comment: http://stackoverflow.com/comment/38650310
has title: Implementing Polyline Connections between Ellipses
has answer: http://stackoverflow.com/a/24883523
type: Question
tagged with: swt
upvote count: 1
answer count: 1
tagged with: java

http://stackoverflow.com/comment/38617072
score: 0
type: Comment
type: QuestionComment
has text: My explanation is that the bean created by cdi is different from the bean created by the websocket container, since websockets are created only when a connection has been requested. Try probably to change the bean from applicationscoped to sessionscoped.
comment on: http://stackoverflow.com/q/24862927

http://stackoverflow.com/comment/38660382
type: Comment
has text: briefly? No ... you have to implement it.
score: 6
comment on: http://stackoverflow.com/q/24888629
type: QuestionComment

http://stackoverflow.com/a/24903021
has comment: http://stackoverflow.com/comment/38693976
has comment: http://stackoverflow.com/comment/38689996
has comment: http://stackoverflow.com/comment/38697561
has body: There are a few fundamental flaws... Let's start with the main method... System.out.println("DStarting"); SwingIt swObj = new SwingIt(); swObj.runn(); Is pointless, because you then completely ignore it... SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SwingIt gtw = new SwingIt(); gtw.setVisible(true); } And the window which is shown on the screen is not the one you created and called runn on, which means it is basically invisible (no size or position)... Instead of using swingText to initialise the window, you should use it's constructor, but speaking of swingText.... You create a JTextField called jj and then simply throw it away... JTextField jj=new JTextField(); jj.setText(txt); add(new JTextField("Text")); This means that the text you supply will never be shown on the screen...you seem to be having a hard time understanding object/variable references... Anyway, you should throw away the swingText method and replace it with a class constructor, for example... private JButton aButton = new JButton("I am a Button \n"); private JLabel label = new JLabel("Label \n"); private JTextArea ta = new JTextArea("Text area", 5, 5); private JTextField jj = new JTextField(5); public SwingIt() { setUndecorated(true); setBackground(new Color(0, 0, 0, 0)); setSize(new Dimension(600, 500)); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); System.out.println("bbb"); if (g instanceof Graphics2D) { final int R = 250; final int G = 210; final int B = 220; Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 0), 0.0f, getHeight(), new Color(R, G, B, 255), true); Graphics2D g2d = (Graphics2D) g; g2d.setPaint(p); g2d.fillRect(0, 0, getWidth(), getHeight()); } } }; setContentPane(panel); setLayout(new GridBagLayout()); add(aButton); add(label); add(ta); add(jj); pack(); } This will now mean you need some way to set the te…
accepted answer of: http://stackoverflow.com/q/24902673
downvote count: 0
has comment: http://stackoverflow.com/comment/38693645
answers question: http://stackoverflow.com/q/24902673
has comment: http://stackoverflow.com/comment/38695915
upvote count: 1
has comment: http://stackoverflow.com/comment/38688296
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38695349
has comment: http://stackoverflow.com/comment/38689377
type: Answer
has comment: http://stackoverflow.com/comment/38688224
score: 1

http://stackoverflow.com/comment/38480069
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24792975
has text: @JunedAhsan: ???? this is the Stickman constructor.

http://stackoverflow.com/comment/38439436
comment on: http://stackoverflow.com/a/24766455
score: 0
type: Comment
has text: Yes its there, it's reaching the method but somehow while returning the list it's failing
type: AnswerComment

http://stackoverflow.com/comment/38538670
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24824188
has text: ok. I didn't know. so you solve your problem or I edit my answer?

artifactory
tags question: http://stackoverflow.com/q/24829415
tags question: http://stackoverflow.com/q/24878614
tag name: artifactory
tags question: http://stackoverflow.com/q/24905752
type: Tag

http://stackoverflow.com/a/25846700
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/73639327
answers question: http://stackoverflow.com/q/24850304
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24850304
type: AcceptedAnswer
has body: Here's sample code that demonstrates how to embed JxBrowser Browser component into JPanel: import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.swing.BrowserView; import javax.swing.*; import java.awt.*; /** * This sample demonstrates how to create Browser instance, * embed it into Swing BrowserView container, display it in JFrame and * navigate to the "www.google.com" web site. */ public class BrowserSample { public static void main(String[] args) { Browser browser = new Browser(); BrowserView view = new BrowserView(browser); JPanel panel = new JPanel(new BorderLayout()); panel.add(view, BorderLayout.CENTER); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(panel, BorderLayout.CENTER); frame.setSize(700, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.loadURL("https://google.com"); } } More samples you can find at https://jxbrowser.support.teamdev.com/support/solutions/9000049010
type: Answer

http://stackoverflow.com/comment/38414934
type: QuestionComment
has text: I am running JAVA code inside the Oracle JVM and i want to debug that. I do not need to connect to any external JVM.
comment on: http://stackoverflow.com/q/24758741
score: 0
type: Comment

http://stackoverflow.com/comment/38603921
score: 0
has text: @JonSkeet Sorry, just added the semi-colons and the static main method. That's exactly the code I ran.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24858454

http://stackoverflow.com/comment/38665177
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24879825
has text: ok thanks for your answers, really helpful. for now I cant vote up the answer because my reputation is only 11. I will mark it as accepted if I find the button :))
score: 0

http://stackoverflow.com/comment/38649442
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24882752
type: Comment
has text: can you post `activity_my.xml`

http://stackoverflow.com/a/66049682
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The encoding in ProcessBuilder refers to the file.encoding system property. For example, when you have the following source: import java.io.*; class Main { public static void main(String args[]) throws Exception { ProcessBuilder pb = new ProcessBuilder("/bin/bash", "-c", "echo -n тест | hexdump -C"); Process p = pb.start(); InputStream is = p.getInputStream(); printInputStream(is); p.waitFor(); } public static void printInputStream(InputStream is) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(is)); try { for (;;) { String line = br.readLine(); if (line == null) break; System.out.println(line); } } finally { br.close(); } } } You will get f2 e5 f1 f2 if the encoding like Windows-1251 is the default encoding in your runtime environment (or you have set Windows-1251 to file.encoding explicitly). $ java -Dfile.encoding=Windows-1251 Main 00000000 f2 e5 f1 f2 |....| 00000004 You should set UTF-8 to file.encoding explicitly if you want to get d1 82 d0 b5 d1 81 d1 82 as a result. $ java -Dfile.encoding=UTF-8 Main 00000000 d1 82 d0 b5 d1 81 d1 82 |........| 00000008
score: 2
answers question: http://stackoverflow.com/q/24802042
accepted answer of: http://stackoverflow.com/q/24802042

http://stackoverflow.com/comment/38549481
has text: @RoboticMoneylender can you please explain what you have already researched? Did you find any of the numerous implementations of this online? Why didn't they suit your needs?
comment on: http://stackoverflow.com/q/24830075
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24907753
has answer: http://stackoverflow.com/a/49491297
has comment: http://stackoverflow.com/comment/38696458
tagged with: java
has comment: http://stackoverflow.com/comment/38697548
answer count: 3
downvote count: 0
linked to: http://stackoverflow.com/q/3465230
favorite count: 0
has comment: http://stackoverflow.com/comment/38696441
tagged with: notifications
score: 3
tagged with: android
has answer: http://stackoverflow.com/a/24936221
has answer: http://stackoverflow.com/a/24907878
has comment: http://stackoverflow.com/comment/38697510
has body: I am creating a notification system that pushes multiple notifications through a FOR loop. Logcat shows that I am creating multiple notifications (The phone even sends two ringtones corresponding to each one). But the notification bar only shows the last one. I read the documentation and it says that calling NotificationManager.notify takes a unique Id and if this Id exists, then the notification will be replaced with the new one. I used a unique GUID for each notification but still no success. notificationManager.notify(notification.getInt("id"), n); Any suggestions I can work with? Could it be the PendingIntent part of the notification? Thanks in advance.
upvote count: 3
type: UnansweredQuestion
has title: Android Multiple Notifications Only Showing Last One
type: Question

http://stackoverflow.com/comment/38592964
has text: Just in case you are looking for the library jar (as I did) you can find it here: http://www.java2s.com/Code/JarDownload/java-json/java-json.jar.zip
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24852983

http://stackoverflow.com/a/24818859
upvote count: 1
has comment: http://stackoverflow.com/comment/38543416
has comment: http://stackoverflow.com/comment/38535394
accepted answer of: http://stackoverflow.com/q/24816480
has body: Check if your context configuration files [SPRING_CONFIG_FILE, SPRING_CONFIG_TEST_FILE] contains injection of ManageService bean implementation. It seems that the Spring can't autowire that bean and that's why you get NullPointerException.
has comment: http://stackoverflow.com/comment/38533724
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24816480
type: Answer
score: 1

http://stackoverflow.com/q/24778110
has comment: http://stackoverflow.com/comment/38450952
has comment: http://stackoverflow.com/comment/38451273
type: Question
has comment: http://stackoverflow.com/comment/38451489
score: -2
has answer: http://stackoverflow.com/a/24778281
tagged with: eclipse
has body: I was searching for the proper answer, but I could not find it. All of them did not work for me. Basically I have an activity with five EditText fields(input type is number). What I want to do is that when that activity is closed and re-opened that it does not lose those numbers that were inputted. I believe that there is an easy solution, any kind of help would be appreciated! :)
has comment: http://stackoverflow.com/comment/38451040
accepted answer: http://stackoverflow.com/a/24778281
has comment: http://stackoverflow.com/comment/38451154
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38451020
favorite count: 0
tagged with: android
has title: How to save activity data?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38451080
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/38429968
type: QuestionComment
has text: Can you explain your "cubic" coordinate system? Your picture depicts a 2-dimensional image; how do you have a 3-dimensional coordinate system?
comment on: http://stackoverflow.com/q/24766079
score: 0
type: Comment

http://stackoverflow.com/q/24771394
has answer: http://stackoverflow.com/a/24771637
linked to: http://stackoverflow.com/q/24706576
type: Question
has title: Creating Deck Of Cards For Blackjack simulator in Java
has comment: http://stackoverflow.com/comment/38439294
tagged with: arrays
accepted answer: http://stackoverflow.com/a/24771637
has body: I am creating a blackjack simulator to better learn java. I recently completed the free course available at udacity which is an excellent resource, https://www.udacity.com/course/cs046. So far, I have created a deck of cards and printed it successfully. It consists of 3 classes, Blackjack which holds the main method, deck which creates the deck and card which creates the cards. Is there a better way to do this? One thing that jumps out at me is how long the deck constructor is. In all the examples I have seen, constructors are much shorter. Also, I am not making any use of the getter methods in card, so they should either be deleted or used. I am leaning towards deleting them since no other method is going to call these methods once the deck is created. I have not googled this since I don't want to have the answers for future methods given to me. I am not the first person to have this idea! Thank you for your feedback. Card.java package blackjack; public class Card { private final String name; private final String suit; private final int value; public Card(String name, String suit, int value){ this.name = name; this.suit = suit; this.value = value; } public String getName(){ return name; } public String getSuit() { return suit; } public int getValue() { return value; } public String toString(){ return (this.name + " of " + this.suit + " " + this.value); } } Deck.java package blackjack; import java.util.*; public class Deck { private static int numSuits = 4; private static int numRanks = 13; private static int numCards = numSuits * numRanks; private Card[] cards; public Deck() { String suit = null; String name = null; int value = 0; cards = new Card[numCards]; int arrayIndex=0; for (int i=1; i&lt;=numSuits; i++){ for (int j=1; j &lt;= numRanks; j++){ switch (i){ case 1: suit = "Clubs"; break; case 2: suit = "Diamonds"; break; case 3: suit = "Hearts"; break; case 4: suit = "Spades"; break; } switch (j){ case 1: name = "Ace"; value = 0; break; case 2: name = "Two"; val…
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38438732
has comment: http://stackoverflow.com/comment/38438755
has comment: http://stackoverflow.com/comment/38467575
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/38440596
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/38426252
type: QuestionComment
comment on: http://stackoverflow.com/q/24764765
has text: You should not have any own package whose name starts with `java`.
score: 2
type: Comment

http://stackoverflow.com/q/24780059
has body: I've a requirement to generate select criteria dynamically from java end and pass it to ibatis and it works well this way select $runtime$ from .... (runtime is being generated in a java class) but as $runtime$ causes sql injection , I'm looking for ways to use #runtime# instead of $. Note : #runtime# is putting the value as prepared statement and the query prints it as it is instead of using it as a select clause runtime = 'sysdate'; select $runtime$ from dual -&gt; select sysdate from dual -&gt; 16-Jun-2014 .... select #runtime# from dual -&gt; select 'sysdate' from dual -&gt; sysdate
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
favorite count: 0
tagged with: ibatis
has title: iBatis dynamic select clause
type: UnansweredQuestion

http://stackoverflow.com/a/24858031
has comment: http://stackoverflow.com/comment/38603817
has comment: http://stackoverflow.com/comment/38606821
has comment: http://stackoverflow.com/comment/38604523
accepted answer of: http://stackoverflow.com/q/24857795
has comment: http://stackoverflow.com/comment/38602799
answers question: http://stackoverflow.com/q/24857795
has comment: http://stackoverflow.com/comment/38611998
has comment: http://stackoverflow.com/comment/38602730
type: AcceptedAnswer
score: 0
has body: You are all there only put new DownloadJSON().execute(); inside your News button onClick() like that: Button b = (Button) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub new DownloadJSON().execute(); } });
type: Answer

http://stackoverflow.com/comment/38696918
has text: You don't need to use BasicConfigurator.configure(); and all. Just Initialize the logger. Then you will be able use it. See my latest answer.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24907928

http://stackoverflow.com/comment/86350050
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25093377
has text: I'm using Intellij 2018 and GlassFish 5(Paraya)in my project, I had created another folder by the name `resources` and placed it on same hierarchy level as `src` and I got this same error. I moved `/META-INF/persistence.xml` from resources folder and placed it inside `src` as @BalusC and it worked like a charm. But of course this was after making necessary configurations at the paraya server(that is, setting up the JDBC resources and Connection Pool).
score: 0

http://stackoverflow.com/a/24821366
accepted answer of: http://stackoverflow.com/q/24821291
has comment: http://stackoverflow.com/comment/38533151
has comment: http://stackoverflow.com/comment/38535913
answers question: http://stackoverflow.com/q/24821291
has comment: http://stackoverflow.com/comment/38533368
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38532792
type: AcceptedAnswer
has body: public static void main(String[] args) { String s = "https://www.google.com/abc.jpg is a url of an image."; System.out.println(s.replaceAll("https?://.*?\\s+", "")); } O/P : is a url of an image.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38532843
has comment: http://stackoverflow.com/comment/38533104

http://stackoverflow.com/a/24788156
has body: I've just played with this a little bit and I'm afraid that having different backgrounds in one group is simply not possible. It doesn't matter if you have just a group of notifications or group of notifications with pages - there will be only one background for entire stack. If you will disable the setGroup line everything will work fine with backgrounds - you will have different backgrounds on first page. BTW. To set a background for particular notification just make use of WearableExtender: .extend(new NotificationCompat.WearableExtender().setBackground(trendImage)) instead of applying largeIcon or BigPictureStyle. But this doesn't solve your problem with groups of course.
has comment: http://stackoverflow.com/comment/38471121
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24784106
has comment: http://stackoverflow.com/comment/38471019
score: 4
accepted answer of: http://stackoverflow.com/q/24784106
type: AcceptedAnswer

http://stackoverflow.com/comment/38573877
score: 0
comment on: http://stackoverflow.com/q/24843037
type: Comment
type: QuestionComment
has text: No. I get an error message about something null.

http://stackoverflow.com/q/24864595
type: Question
score: 0
has title: log4j2 adding logger + appender by code
answer count: 1
has answer: http://stackoverflow.com/a/24866243
type: UnansweredQuestion
tagged with: logging
tagged with: java
has body: I am trying to add by code a custom appender that should log some package. And everything works using this code : String loggerName = "org.test"; final LoggerContext ctx = (LoggerContext) LogManager.getContext(false); Configuration cfg = ctx.getConfiguration(); if (cfg instanceof XmlConfiguration) { //add appender if not added Appender appender = cfg.getAppender(MyAppender.NAME); if (appender == null) { Appender appender = MyAppender.createAppender(MyAppender.NAME, "%highlight{%d [%t] %-5level: %msg%n%throwable}", "false", null); appender.start(); cfg.addAppender(appender); } LoggerConfig logger = ((XmlConfiguration) cfg).getLogger(loggerName); if (logger == null) { logger = new LoggerConfig(loggerName, Level.DEBUG, true); cfg.addLogger(loggerName, logger); } logger.addAppender(appender, Level.DEBUG, null); } //closing the instanceof XMLConfiguration part So in short.. as you can see I am creating an appender if there was no appender defined before. Then I am creating a logger for org.test if there was no added and adding the appender to this logger. Everything is fine except one thing: The new appender and logger works correctly. However I have other appenders in my XML configuration Console Appender and so on.. and for some reason they are ALSO added as DEBUG level for the org.test logger... even if this logger doesnt have ANY other appenders configured like in my case.. I am debuging .. it has ONLY one appender, in the configuration object.. but the logger still sends debug messages to ALL appends that I have... (I guess all that I have on ROOT level which were set to INFO) ... from now on are also showing DEBUG messages from org.test ... how I can remove this appends and use only this one.. :( Thanks.
tagged with: log4j2

http://stackoverflow.com/comment/38511252
score: 0
type: Comment
has text: Return the List. Also, this is getting a little ridiculous. Please post a new question when you have one.
comment on: http://stackoverflow.com/a/24808722
type: AnswerComment

http://stackoverflow.com/q/24868300
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: ejb
has body: I am trying to use @EJB annotation to call a stateless bean. When I print the value of the reference, it is NULL I a'm running on jboss 7. Please help me I have traied all possipole configruation, If I missed any thing please notify me. find the full stack below Jboss log:- JBAS015876: Starting deployment of "medmark.war" 17:33:56,948 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings for session bean named HelloService in deployment unit deployment "medmark.war" are as follows: java:global/medmark/HelloService!com.ntgclarity.medmark.service.HelloService java:app/medmark/HelloService!com.ntgclarity.medmark.service.HelloService java:module/HelloService!com.ntgclarity.medmark.service.HelloService java:global/medmark/HelloService java:app/medmark/HelloService java:module/HelloService 17:33:57,374 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1) 17:33:57,388 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1) 17:33:57,580 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-6) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/medmark' 17:33:58,651 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-6) Hibernate Validator 4.2.0.Final 17:33:59,582 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (MSC service thread 1-6) Running on PrimeFaces 5.0 17:33:59,627 INFO [org.jboss.web] (MSC service thread 1-6) JBAS018210: Registering web context: /medmark 17:33:59,644 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015951: Admin console listening on http://0.0.0.0:9990 17:33:59,652 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 8464ms - Started 34…
score: 0
answer count: 1
has title: Failed to inject EJB 3 using @EJB on jboss 7
tagged with: jboss7.x
has answer: http://stackoverflow.com/a/24868538
accepted answer: http://stackoverflow.com/a/24868538
tagged with: java
tagged with: maven

http://stackoverflow.com/comment/38522858
score: 0
type: Comment
has text: Added an answer to try and explain.
type: QuestionComment
comment on: http://stackoverflow.com/q/24815795

http://stackoverflow.com/comment/38624055
has text: CLASSPATH in windows is semicolon separated, not colon separated, so your last javah doesn't have the classpath that you expect. try with `../bin/classes/;D:/OpenCV/OpenCV-2.4.9-android-sdk/sdk/java/bin/classes` - I'm not certain about the direction of the `/` either, though shouldn't it be \?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24868501

http://stackoverflow.com/a/24765322
has comment: http://stackoverflow.com/comment/38433899
has comment: http://stackoverflow.com/comment/38435825
has comment: http://stackoverflow.com/comment/38428755
accepted answer of: http://stackoverflow.com/q/24765179
upvote count: 13
has comment: http://stackoverflow.com/comment/38435896
has comment: http://stackoverflow.com/comment/38427710
answers question: http://stackoverflow.com/q/24765179
has comment: http://stackoverflow.com/comment/38428348
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38436674
has comment: http://stackoverflow.com/comment/38427871
type: Answer
score: 13
has body: this inside lambda doesn't mean the same as this inside an anonymous class instance. Inside a lambda it refers to the enclosing class. ...the lambda expression does not introduce a new level of scoping. Consequently, you can directly access fields, methods, and local variables of the enclosing scope. ... To access variables in the enclosing class, use the keyword this. ... Inside an instance of an anonymous class, it refers to the current object Within an instance method or a constructor, this is a reference to the current object — the object whose method or constructor is being called That's why in the lambda expression, this == current is never true, since it compares an instance of class ItemList with a lambda expression of type OnClickListener.
downvote count: 0
has comment: http://stackoverflow.com/comment/38428036

http://stackoverflow.com/comment/38687182
has text: Get the CSV output to work before trying to make a translucent window, one problem at a time...
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24902673

http://stackoverflow.com/q/24897183
tagged with: jpa-2.1
upvote count: 5
has comment: http://stackoverflow.com/comment/38679278
has comment: http://stackoverflow.com/comment/38678136
has comment: http://stackoverflow.com/comment/38679236
has comment: http://stackoverflow.com/comment/38679190
has comment: http://stackoverflow.com/comment/38679329
has comment: http://stackoverflow.com/comment/38679399
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24898678
tagged with: java-8
accepted answer: http://stackoverflow.com/a/24898678
type: AnsweredQuestion
has title: JPA 2.1 Foreign Key isn't saving on ManyToOne cascade
has comment: http://stackoverflow.com/comment/38679435
has comment: http://stackoverflow.com/comment/38678807
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38679430
type: Question
has comment: http://stackoverflow.com/comment/38679104
has body: I have two classes. public class Reservation { @OneToMany(cascade = CascadeType.ALL, orphanRemoval=true, mappedBy = "reservation") private List&lt;Night&gt; nights; \\assume getters and setters } public class Night { @ManyToOne @JoinColumn(name = "RESERVATION_ID") private Reservation reservation; } My save works like this: Reservation r = new Reservation(); r.getNights().add(new Night()); return dao.save(r); This works, as in it saves the Reservation, and it saves the Night. But when I look at the database, the column RESERVATION_ID in the NIGHT table is null. In previous projects (before upgrading to Java 8 and JPA 2.1), I didn't need to manually set the parent object on the child in order for that association to save. Did something change, or am I doing something wrong? Edit: This saves the association correctly, but it didn't used to be necessary. Reservation r = new Reservation(); Night n = new Night(); n.setReservation(r); r.getNights().add(n); return dao.save(r);
score: 5

http://stackoverflow.com/q/24854456
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24854507
upvote count: 1
has body: I am trying to find the factorial of t numbers and input for each number n is provided by the user.The constraints are; 1 &lt; t &lt;= 100 1 &lt; n &lt;= 100 My code is : import java.util.Scanner; import java.math.BigInteger; public class fact { public static void main(String args[]) { int t = 0, i = 0; BigInteger result = BigInteger.valueOf(1); BigInteger x1 = BigInteger.ONE; Scanner sc = new Scanner(System.in); t = sc.nextInt(); BigInteger a[] = new BigInteger[t]; for(i = 0; i &lt; t; i++) { a[i] = BigInteger.valueOf(sc.nextInt()); } for(i = 0; i &lt; t; i++) { while(!a[i].equals(x1)) { result = result.multiply(a[i]); a[i].subtract(BigInteger.valueOf(1)); } System.out.println(result); result = x1; } } } I am receiving no errors for the above code it compiles fine and when I execute it just keeps on getting input and no output is printed.
type: Question
has comment: http://stackoverflow.com/comment/38595705
has comment: http://stackoverflow.com/comment/38595730
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24854507
has title: Find factorials using BigInteger in java?
favorite count: 0
has comment: http://stackoverflow.com/comment/38595721
has comment: http://stackoverflow.com/comment/38595676
type: AnsweredQuestion
tagged with: biginteger

http://stackoverflow.com/comment/38476071
type: Comment
has text: Glad to hear it! If you are going to do things like transitivity, look into how the rules handle owl:transitiveProperty and the like. There are a few ways to do it. One is `[(p a transitiveProperty) (?x p ?y) (?y p ?z) -> (?x p ?z)]`. The other creates a new rule for each transitive property: `[(p a transitiveProperty) -> [(?x p ?y) (?y p ?z) -> (?x p ?z)]]`. Similar things can be done for subproperty relations, too.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24786478

http://stackoverflow.com/a/24893828
answers question: http://stackoverflow.com/q/24892835
has body: Here's a nice example given at official android developer site: http://developer.android.com/training/camera/photobasics.html Hope this would be helpful.
score: -1
has comment: http://stackoverflow.com/comment/38670878
downvote count: 2
upvote count: 1
type: Answer

http://stackoverflow.com/a/24845010
downvote count: 0
has body: You could ignore blank lines and it wouldn't matter if they were there or not. public static String readNonBlankLine(Scanner in) { while(in.hasNextLine()) { String s = in.nextLine(); if (!s.trim().isEmpty()) return s; } return null; } try { Scanner input = new Scanner (file); while (input.hasNextLine()) { String number1 = readNonBlankLine(input); String number2 = readNonBlankLine(input); System.out.println("String: " + number1); System.out.println("String: " + number2); System.out.println(number1 + " " + number2); } }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24844298

http://stackoverflow.com/comment/39597943
comment on: http://stackoverflow.com/a/25386086
score: 0
type: AnswerComment
type: Comment
has text: The FIPS not is not enabled, Java or Eclipse thinks that it's enabled, but only I change some variable value in the debug, otherwise Java working fine. Thanks

http://stackoverflow.com/q/24830075
has comment: http://stackoverflow.com/comment/38549481
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38549588
tagged with: swing
tagged with: artificial-intelligence
has comment: http://stackoverflow.com/comment/38549446
has comment: http://stackoverflow.com/comment/38549559
upvote count: 2
has comment: http://stackoverflow.com/comment/38549548
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/38549655
has comment: http://stackoverflow.com/comment/38549399
has comment: http://stackoverflow.com/comment/38549439
tagged with: tic-tac-toe
has comment: http://stackoverflow.com/comment/38549401
type: Question
has comment: http://stackoverflow.com/comment/38549602
has body: I've almost put the wraps on my program, but I want to add some way for users to play against the computer. For this, I need to create some kind of conditional logic based AI, but can't see which approach to take. I don't want the computer to take its turn randomly, I want it to actually play like a human player. Would I have to use a deeply nested if statements and multiple moves for each possible turn, or use some kind of for or while loop? My code reduced to just the WinChecker is here: public void calculatevictory(){ if (b1.getText() == b2.getText() &amp;&amp; b2.getText() == b3.getText() &amp;&amp; b1.getText() != "") { win = true ; } else if (b4.getText() == b5.getText() &amp;&amp; b5.getText() == b6.getText() &amp;&amp; b4.getText() != "") { win = true ; } else if (b7.getText() == b8.getText() &amp;&amp; b8.getText() == b9.getText() &amp;&amp; b7.getText() != "") { win = true ; } else if (b1.getText() == b4.getText() &amp;&amp; b4.getText() == b7.getText() &amp;&amp; b1.getText() != "") { win = true ; } else if (b2.getText() == b5.getText() &amp;&amp; b5.getText() == b8.getText() &amp;&amp; b2.getText() != "") { win = true ; } else if (b3.getText() == b6.getText() &amp;&amp; b6.getText() == b9.getText() &amp;&amp; b3.getText() != "") { win = true ; } else if (b1.getText() == b5.getText() &amp;&amp; b5.getText() == b9.getText() &amp;&amp; b1.getText() != "") { win = true ; } else if (b3.getText() == b5.getText() &amp;&amp; b5.getText() == b7.getText() &amp;&amp; b3.getText() != "") { win = true ; } else { win = false ; } } My code so far is here: /* PROGRAM NAME : TIC TAC TOE * AUTHOR : Jack Robinson * DATE : 7/17/2014 */ // Importing necessary classes and directories import java.util.Random ; import java.util.Scanner ; import javax.swing.JOptionPane ; import javax.swing.JFrame ; import javax.swing.JPanel ; import java.util.InputMismatchException ; import java.awt.BorderLayout ; import java.awt.* ; import java.awt.event.* ; import javax.swing.JTextArea ; impor…
has answer: http://stackoverflow.com/a/24866740
score: 0
has comment: http://stackoverflow.com/comment/38549722
has title: How do I create Logic based AI for my Java Tic Tac Toe Program?

http://stackoverflow.com/comment/38514457
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24811400
has text: How else could I access the methods of the FuelEconomySettingsActivity

http://stackoverflow.com/q/24904138
type: Question
tagged with: certificate
has comment: http://stackoverflow.com/comment/38689825
answer count: 1
has body: Our customer is using its own Root CA for internal applicatins. The certificate is in the Windows Keystore but not in the Java Keystore. How can I tell my Java Web Start Application to use the Windows Keystore for searching the valide cert for SSL connections? Importing the cert into each Java Keystore is no option! EDIT: Main reason I want to use the Windows keystore is to verify the certificate of my signed application
downvote count: 0
has answer: http://stackoverflow.com/a/24904283
favorite count: 0
tagged with: keystore
tagged with: windows
has comment: http://stackoverflow.com/comment/38690019
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Tell Java to use Windows keystore

http://stackoverflow.com/a/24913890
has body: In case you're starting (embeded) EJB container or doing something of this kind, singleton session bean can be annotated with @Startup annotation and it's @PostConstruct life cycle method will be invoked after container startup. @Startup @Singleton public class StartupBean { @PostConstruct void init { ... } ... } EDIT: There's WebSpehere documentation on how to run embeded container and invoke EJB's. But note that embeded container has to support only EJB Lite specification: The embeddable container does not support the use of Contexts and Dependency Injection (CDI).
type: Answer
answers question: http://stackoverflow.com/q/24859758
has comment: http://stackoverflow.com/comment/38733851
score: 0

http://stackoverflow.com/q/24822953
has comment: http://stackoverflow.com/comment/38539309
linked to: http://stackoverflow.com/q/8937380
tagged with: android
upvote count: 7
possible better answer: http://stackoverflow.com/a/24823064
has answer: http://stackoverflow.com/a/24823120
type: AnsweredQuestion
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/8460680
type: Question
linked to: http://stackoverflow.com/q/1714297
answer count: 2
has comment: http://stackoverflow.com/comment/38535781
downvote count: 0
accepted answer: http://stackoverflow.com/a/24823120
has title: How to assign unique ids to dynamically created Views?
linked to: http://stackoverflow.com/q/10261190
duplicate of: http://stackoverflow.com/q/1714297
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: In my app I am creating Views - in this case an EditText - dynamically. But every View I add needs to have a unique id. EditText editText = new EditText(context); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); editText.setLayoutParams(params); // Which value am I supposed to use here? editText.setId(value); layout.addView(editText); I am afraid of conflicts if I assign a random value and I cannot think of any way to generate ids without the possibility of conflicts. Please not that I know that one can define a fixed set of ids in res/values/ids.xml, but that is not what I want! I need to create the ids dynamically! I have no idea how many I need. So is there any safe way to generate ids?
has answer: http://stackoverflow.com/a/24823064

motionevent
tags question: http://stackoverflow.com/q/24807265
tag name: motionevent
type: Tag

http://stackoverflow.com/q/24853429
tagged with: date
has body: I'm trying to convert a timestamp coming from a JSON API to a relative time span string like this: try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); Date date = sdf.parse(item.getTimeStamp()); long milliseconds = date.getTime(); CharSequence timeAgo = DateUtils.getRelativeTimeSpanString( milliseconds, System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS); timestamp.setText(timeAgo); } catch (java.text.ParseException e) { e.printStackTrace(); } The timestamp comes back in JSON like this: 2014-07-01T00:05:20Z I'm throwing the exception for Unparseable date What am I doing wrong here?
score: 0
accepted answer: http://stackoverflow.com/a/24853448
linked to: http://stackoverflow.com/q/22464594
answer count: 1
tagged with: android
tagged with: datetime
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/22464594
has answer: http://stackoverflow.com/a/24853448
tagged with: java
has title: java ParseException: Unparseable date
type: Question
tagged with: simpledateformat

http://stackoverflow.com/comment/38519689
comment on: http://stackoverflow.com/a/24795038
type: AnswerComment
has text: Looks like someone also reported it here: https://bugs.openjdk.java.net/browse/JDK-8050875
type: Comment
score: 2

http://stackoverflow.com/comment/38502355
type: Comment
type: QuestionComment
has text: Just a quick tip: Use different debug messages in different places.
comment on: http://stackoverflow.com/q/24805191
score: 0

http://stackoverflow.com/q/24843358
has answer: http://stackoverflow.com/a/24843377
accepted answer: http://stackoverflow.com/a/24843377
tagged with: java
has comment: http://stackoverflow.com/comment/38574068
has title: What is wrong with this piece of java code?
type: Question
has body: it would help me a ton if someone could find the error in this code. I am using Eclipse, and i am trying to make a program that spits out words/sentences at the push of a button. If you need any more information just ask. ERROR: "if (this.boverall[a] != 0) {", ERROR message "The operator != is undefined for the argument type(s) boolean, int" public String sentenceOverall() { ArrayList&lt;String&gt; toBeUsed = new ArrayList(); for (int a = 0; a &lt; this.soverall.length; a++) { if (this.boverall[a] != 0) { toBeUsed.add(this.soverall[a]); } } if (toBeUsed.size() == 2) { int sentencePattern = rand.nextInt(10); if (sentencePattern &lt; 9) { String[] OverallOptions = { " The song is overall both ", " Overall, the song is both ", " This song, overall, is both ", " Your song is quite ", " I think that the song is ", " I believe that your song is both ", " Your song is without a doubt ", " In my point of view, this is ", " First of all, thank you for creating this song. This song is very ", " Judging from my position, this song is ", " Personally, I think that the song is ", " All things taken together, I would say that this song is " };
upvote count: 1
has comment: http://stackoverflow.com/comment/38574090
answer count: 1
favorite count: 0
downvote count: 5
score: -4
has comment: http://stackoverflow.com/comment/38574097
has comment: http://stackoverflow.com/comment/38574116
has comment: http://stackoverflow.com/comment/38574089
type: AnsweredQuestion

http://stackoverflow.com/comment/38397948
type: QuestionComment
comment on: http://stackoverflow.com/q/24749388
has text: Ok, that's one thing I was wondering about. I'm confused as to how to loop through this. I found an older program I'd written about a year ago loading a regular one dimensional array from a file and this is what I kind of modeled my while loop after, but am unsure how to make it work for a 2D array?
score: 0
type: Comment

http://stackoverflow.com/comment/38438612
comment on: http://stackoverflow.com/q/24770948
has text: @Close-voters There is nothing unclear about this question. Please desist.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24804615
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38501702
score: 1
accepted answer of: http://stackoverflow.com/q/24804388
has comment: http://stackoverflow.com/comment/38501409
upvote count: 1
has body: There's a few things wrong with this code.. path and file cannot be accessed by main() because they are not static and main is. Meaning when main() is ran, neither of path or file exist. LoadImage panel = new BufferedImage CopyImage(file) is not valid Java - I'm not sure what you were trying to do but I guess you want to remove the new BufferedImage part img = ImageIO.read(new File(file)); - you can't run this statement outside a method or static block as it requires handling of an IOException ImageIO.read(new File(file)); - file is already of type File and you are passing it to a type File, not necessary. ImageIO.read(file); would do saveAs hasn't been defined anywhere. ImageIO.write(cImg, "png", saveImage); can throw an IOException so you need to add a try-catch around it like in the LoadImage() constructor or append throws IOException to your method signature like so public static BufferedImage CopyImage (File file) throws IOException You are referencing LoadImage which looks like it's trying to do exactly what Display does in a slightly different way. I'm not sure what to advise here because I don't understand the intention but I think perhaps replace LoadImage in the Display code with Display
has comment: http://stackoverflow.com/comment/38501500
answers question: http://stackoverflow.com/q/24804388

http://stackoverflow.com/comment/38529998
type: QuestionComment
comment on: http://stackoverflow.com/q/24818026
score: 0
has text: yes there are getters and setters. Updated the question.
type: Comment

http://stackoverflow.com/comment/38694352
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24886949
type: AnswerComment
has text: @ThomasMueller To be more precise, I guess the OP has _two_ issues. A BOM prefixed UTF8 encoded file _and_ the attempt to read it as ISO-8859-X encoding. On windows, maybe the OP reads its BOM prefixed UTF8 file as UTF8, so the 3 first bytes are converted to the single unicode character `FEFF`. Maybe that character is silently dropped by some call on the road or at display?

http://stackoverflow.com/comment/38637538
type: AnswerComment
has text: He asked which is a better way (in objective terms) of consuming data.. two arrays or one map.. simple question.. no need to go off the topic about data modeling and when to create a POJO.
type: Comment
comment on: http://stackoverflow.com/a/24876261
score: 0

http://stackoverflow.com/comment/38670136
type: QuestionComment
comment on: http://stackoverflow.com/q/24893646
score: 0
has text: http://stackoverflow.com/questions/8725387/why-there-is-no-sortedlist-in-java
type: Comment

http://stackoverflow.com/a/24905113
downvote count: 0
has body: You can use the &lt;fmt:message&gt; tags to use localization. &lt;fmt:message&gt; tag is used to map the key from the key-value paired mapped localized message and returns the value by replacing the key to the respective value. The documentation related to it is as under http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/message.html Example: Taglib imports : &lt;%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%&gt; Then you can use in the code : &lt;fmt:setBundle basename="portugeseLang" var="lang"/&gt; &lt;fmt:setLocale value="hi_port"/&gt; &lt;fmt:message key="Name" bundle="${lang}"/&gt; Here in the setLocale field you specify the locale. You can specify the portugese language counter parts in the portugeseLang.properties file. You can go through the J2EE tutorial on internationalization
type: Answer
has comment: http://stackoverflow.com/comment/38694141
has comment: http://stackoverflow.com/comment/38698304
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24904967

http://stackoverflow.com/a/24866343
score: 0
has body: Yes just like java you can do although the way of doing is different, java.lang.Object ↳ java.net.URLConnection For example to retrieve - ftp://mirror.csclub.uwaterloo.ca/index.html URL url = new URL("ftp://mirror.csclub.uwaterloo.ca/index.html"); URLConnection urlConnection = url.openConnection(); InputStream in = new BufferedInputStream(urlConnection.getInputStream()); try { readStream(in); finally { in.close(); } } URLConnection must be configured before it has connected to the remote resource. Instances of URLConnection are not reusable: you must use a different instance for each connection to a resource. Refer - http://developer.android.com/reference/java/net/URLConnection.html
answers question: http://stackoverflow.com/q/24866258
type: Answer

extjs
tags question: http://stackoverflow.com/q/24842224
type: Tag
tags question: http://stackoverflow.com/q/24843018
tags question: http://stackoverflow.com/q/24804076
tag name: extjs
tags question: http://stackoverflow.com/q/24803147

http://stackoverflow.com/comment/122002305
type: Comment
score: 0
has text: It took me 2 days to find and use this solution. For my (complex) configuration `authenticationManager` in `AbstractSecurityInterceptor` was null without adding `authenticationManagerBean`
comment on: http://stackoverflow.com/a/24867558
type: AnswerComment

http://stackoverflow.com/q/24761082
has answer: http://stackoverflow.com/a/24762078
score: 1
tagged with: java
tagged with: h2
downvote count: 3
linked to: http://stackoverflow.com/q/24591898
tagged with: mysql
tagged with: swing
tagged with: jfreechart
type: Question
accepted answer: http://stackoverflow.com/a/24762078
type: AnsweredQuestion
has title: Populate JFreechart TimeSeriesCollection from Mysql DB?
has body: I'm trying to make a chart in my application that returns me the temperature of days during the months. This chart is a JFreechart TimeSeriesCollection, and I am unable to have the graph read correct data from the database. It shows some of the values, but not all of them, and does not show the correct time. To fix this, I tried to implement the graph as posted here, but still could not solve my problem, even having gone to see this question, as people suggested public class NewClass extends ApplicationFrame { Connection conexao = null; PreparedStatement pst= null; ResultSet rs = null; public NewClass(String title) throws SQLException, ParseException { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); } private static JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart( "Temperatura/Date", // title "Date", // x-axis label "Temperatura", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); return chart; } private static XYDataset createDataset() throws SQLException, ParseException { Connection con = null; String databaseURL = "jdbc:mysql://localhost:3306/world"; String driverName = "com.mysql.jdbc.Driver"; String user = "root"; String password = "rootadmin"; try { Class.forName(driverName).newInstance(); } catch (Exception ex) { System.out.println(""); } con = (Connection) DriverManager.getConnection(databaseURL, user, password); if (!con.isClosed()) { System.out.println("Successfully connected to the DataBase Server..."); } Statement statement; statement = (Statement) con.createStatement(); String selectQuery = "select (CONCAT(`data_registo`, ' ', hora_registo)) as data, temperatura, idSensor from regist…
linked to: http://stackoverflow.com/q/24329963
linked to: http://stackoverflow.com/q/24994704
linked to: http://stackoverflow.com/q/21299096
upvote count: 4
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38509767
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24808996
has text: I disagree that Solution 1 will cause bad readability.
score: 0

http://stackoverflow.com/q/24788707
tagged with: rounding
has comment: http://stackoverflow.com/comment/38472324
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38473915
answer count: 1
tagged with: bigdecimal
score: 0
has answer: http://stackoverflow.com/a/24788887
has body: I am creating an app to calculate a mark average with percents, but the problem is that BigDecimal not always rounding the average, for example if the mark average is 3.85 BigDecimal ROUND_HALF_UP in scale 1 should round to 3.9 but it show the average like 3.8, that happened with only some specific times, sometimes BigDecimal round 4.95 like 5.0 and its good, but I don't know why happened and where is the problem. This is an example code for you can see the problem: import java.io.*; import java.math.BigDecimal; public class Main { public static void main(String[] args) throws IOException{ InputStreamReader input = new InputStreamReader(System.in); BufferedReader buff = new BufferedReader (input); //temporal float average=0; float mark1=0; float mark2=0; float percent1=0.75f; float percent2=0.25f; for(int i=0;i&lt;1;i++){ System.out.println("Enter mark 1 (75%) : "); mark1=Float.parseFloat(buff.readLine()); } for(int i=0;i&lt;1;i++){ System.out.println("Enter mark 2 (25%): "); mark2=Float.parseFloat(buff.readLine()); } average= ((mark1*percent1)+(mark2*percent2)); // convert to BigDecimal BigDecimal bd = new BigDecimal(average); BigDecimal roundingMark = bd.setScale(1, BigDecimal.ROUND_HALF_UP); System.out.println(" the complete average is :"+average); System.out.println(" The rounding average is :"+roundingMark); } } You should put in the first mark 4.5 and in the second mark 1.9 the result will be 3.8 and should be 3.9 Please excuse my for bad English and thank so much for read :)
type: UnansweredQuestion
has title: BigDecimal is not rounding good with ROUND_HALF_UP

http://stackoverflow.com/comment/38678117
has text: @yshavit I'm pulling back on my previous comment: I'm no longer sure it is a typo. too many places metion it: http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.9.3, http://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html#jls-13.1
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24896831

http://stackoverflow.com/comment/38573401
comment on: http://stackoverflow.com/q/24842754
score: 0
type: Comment
type: QuestionComment
has text: path is obviously wrong, so adjust based on output

http://stackoverflow.com/a/24881349
downvote count: 0
upvote count: 2
has body: Stefan is right, adding @EnableGlobalMethodSecurity(securedEnabled = true) does the trick. In my particular situation I had to add to get rid of the excptions. @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user").password("password").authorities("ROLE_USER"); }
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24865588

http://stackoverflow.com/comment/38515811
score: 0
type: AnswerComment
has text: To be honest, this was a former co-worker, so I myself cant even tell you why it's like that. Thanks for bringing it to my attention though!
type: Comment
comment on: http://stackoverflow.com/a/24811779

http://stackoverflow.com/comment/38678887
type: Comment
type: QuestionComment
has text: Are you actually using "print" or g:formatDate? If the latter, there's a way to pass a timezone in: http://grails.org/doc/latest/ref/Tags/formatDate.html
comment on: http://stackoverflow.com/q/24898020
score: 0

http://stackoverflow.com/comment/38508710
type: Comment
comment on: http://stackoverflow.com/a/24807680
has text: i just need this for a comparison after the second dot, I am having trouble in my class that I have now took this code and dropped it into the large scale project. My error is that it cannot find the symbol compare in Integer.compare even though I have imported the comparator?
type: AnswerComment
score: 0

http://stackoverflow.com/a/46585723
has comment: http://stackoverflow.com/comment/81315708
answers question: http://stackoverflow.com/q/24882927
has body: Also, you can do like this. List&lt;String&gt; list = Arrays.asList("One", "Two", "Three"); String result = String.join(", ", list); System.out.println(result);
type: Answer
downvote count: 2
upvote count: 0
score: -2

http://stackoverflow.com/comment/38593928
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24853569
has text: This is the output of sysout (no errors) Info: Generating watermark image using: C:/Program Files/ImageMagick-6.8.9-Q16/convert composite -compose atop -geometry +400 -gravity southeast C:/images/test/watermark.png C:\images\test\67434.jpg C:/123.jpg

http://stackoverflow.com/q/24811122
has title: Implementing a reusable @Controller
has comment: http://stackoverflow.com/comment/38516313
type: UnansweredQuestion
tagged with: spring
type: Question
has body: I'm implementing some SQL-CRUD components for Spring-MVC and I'm facing a problem. I provide a TableController which provides several controller methods: public class TableController ... { public TableController(String tableName) { ... } @RequestMapping("/list") public ModelAndView list() { ... } @RequestMapping("/addForm") public ModelAndView addForm() { ... } ... This TableController basically provides functionality over a database table- a controller method that lists the table's rows, forms for creating and updating table rows, etc. It is a somewhat complex class, as it needs to be customizable to offer different behaviour for different tables. Ideally, I would like users of this controller to be able to add a new instance for each database table they want to expose in their website by adding it to a context, something like this: @Configuration class Context { @Bean("/vets/") public TableController vetController() { return new TableController("vets"); } @Bean("/pets/") public TableController petController() { return new TableController("pets"); } I would expect then to get /vets/list, /vets/addForm, /pets/list URLs exposed in their app. However, this does not work. The only way I've gotten this to work is by not using any @RequestMapping annotation in TableController and having the apps extend TableController for each table they want to expose and define all @RequestMappings in the subclasses, what I'm doing for instance in Application and PetController This works but it's extremely awkward. Any way to improve this? Edit: it seems that I'm fucked: There are also several things no longer possible: Select a controller first with a SimpleUrlHandlerMapping or BeanNameUrlHandlerMapping and then narrow the method based on @RequestMapping annotations. http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-31-vs-30
tagged with: spring-mvc
score: 3
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24873073
downvote count: 0
has answer: http://stackoverflow.com/a/24811808
has comment: http://stackoverflow.com/comment/38533431
favorite count: 0
upvote count: 3

http://stackoverflow.com/q/24797303
favorite count: 0
type: UnansweredQuestion
has body: In this code class.forname it show error that class not found so help me with this code because my is a local database application I am using sqlite database. package appview; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class Databaseconnection { Connection connection = null; public static Connection connection2() { try { Class.forName("org.sqlite.JDBC"); Connection connection = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\Jainam\\Java Application\\JPH\\src\\database\\jph_db.sqlite"); return connection; } catch (Exception e) { e.printStackTrace(); return null; } } }
has answer: http://stackoverflow.com/a/24797364
has answer: http://stackoverflow.com/a/24797533
tagged with: java
has comment: http://stackoverflow.com/comment/38487991
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38488434
tagged with: desktop-application
tagged with: database
has answer: http://stackoverflow.com/a/24797418
score: 0
answer count: 3
has title: In my application in java database connection code is not working
tagged with: sqlite

http://stackoverflow.com/a/24808089
accepted answer of: http://stackoverflow.com/q/24802152
score: 0
type: AcceptedAnswer
type: Answer
has body: If your vision is that you want a piece of what's on the touchscreen to be mirrored to the Presentation, my CWAC-Presentation library has classes dedicated for that scenario. In particular, MirrorPresentationFragment and a source like MirrorWebViewFragment give you code like shown in the sample app: /*** Copyright (c) 2013 CommonsWare, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.commonsware.cwac.preso.demo; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.view.Display; import com.commonsware.cwac.preso.MirrorPresentationFragment; import com.commonsware.cwac.preso.MirroringWebViewFragment; import com.commonsware.cwac.preso.PresentationFragment; import com.commonsware.cwac.preso.PresentationHelper; public class MirrorPresentationActivity extends Activity implements PresentationHelper.Listener { PresentationFragment preso=null; PresentationHelper helper=null; MirroringWebViewFragment source=null; @SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mirror_presentation); helper=new PresentationHelper(this, this); source= (MirroringWebViewFragment)getFragmentManager().findFragmentById(R.id.source); source.getWebView().getSettings().setJavaScriptEnabled(true); source.getWebView().loadUrl("http://commonsware.com"); } @Override public void onResume() { super.onResume(); helper.onResume(); } @Override public void onPause() { …
answers question: http://stackoverflow.com/q/24802152

http://stackoverflow.com/comment/38719649
comment on: http://stackoverflow.com/a/24892058
type: Comment
has text: You can use whatever can send HTTP requests and parse the JSON response. Notice that the REST API documentation shows both the format of the request and the expected response (usually in JSON format).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38683561
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24900753
has text: Have you set `JAVA_HOME` in environment variable?
score: 1

http://stackoverflow.com/a/24853158
has comment: http://stackoverflow.com/comment/38592993
answers question: http://stackoverflow.com/q/24850050
accepted answer of: http://stackoverflow.com/q/24850050
has comment: http://stackoverflow.com/comment/38593293
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38593373
score: 6
has body: Assuming you have a FXML at the same directory as the class where you will load it from, you should do something like this (if your FXML defines a TabPane): TabPane pane = FXMLLoader.load(this.getClass().getResource("SomeWidget.fxml")); Now, suppose you have a nice Tab in a MyTab.fxml file: pane.getTabs().addAll((Tab)FXMLLoader.load(this.getClass().getResource("MyTab.fxml"))); Really easy!
has comment: http://stackoverflow.com/comment/38593107
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/38593018

http://stackoverflow.com/a/24777996
type: Answer
has body: I don't think you can put your required locig into one css selector. However, it should be very easy to accomplish what you need like this: Elements e = d.select("del.grey"); if (e.size() == 0){ e = d.select("span.lrg.bold"); } //do stuff with e Note, that I changed the selectors to use proper class name syntax.
answers question: http://stackoverflow.com/q/24777689
has comment: http://stackoverflow.com/comment/38450900
score: 0
has comment: http://stackoverflow.com/comment/38451030

http://stackoverflow.com/comment/38403644
type: Comment
type: QuestionComment
has text: did you want to match this line `Apple and Mango Banana Lichi`?
score: 0
comment on: http://stackoverflow.com/q/24752681

instantiation
type: Tag
tags question: http://stackoverflow.com/q/24769413
tag name: instantiation

http://stackoverflow.com/q/24890657
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38665076
tagged with: java
tagged with: hibernate
tagged with: mysql
has answer: http://stackoverflow.com/a/24894365
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24894365
has body: I am getting this error when i am trying to insert manually to MySql table with hibernate. I am trying to insert some default data to my application but while inserting manually i am getting Null pointer exception. I am new in java programming so can't able to understand how to fix this error. If anyone can help me with this would me really appreciated.. User_Role Class : package com.sanjay31321.sys.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="user_role") public class User_Role { @Id @Column @GeneratedValue(strategy=GenerationType.AUTO) private int id; @Column(name="role_name") private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } InsertUserRole import org.springframework.beans.factory.annotation.Autowired; import com.sanjay31321.sys.model.User_Role; import com.sanjay31321.sys.service.UserRoleService; public class InsertUserRole { private static final Logger logger = LoggerFactory.getLogger(InsertUserRole.class); @Autowired private UserRoleService userRoleService; public void insert() { User_Role role = new User_Role(); role.setId(1); role.setName("ROLE_ADMIN"); logger.info("id : "+ role.getId() + " | Role : " + role.getName()); userRoleService.addUserRole(role); } } Error: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) javax.servlet.http.HttpServlet.service(HttpServlet.java:641) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) javax.servlet.http.Htt…
tagged with: spring
has title: SpringMvc+Hibernate: Getting NullPointerException in manually inserting data to table

http://stackoverflow.com/comment/38555706
has text: I don't have an ActionBar style set in the theme I'm using. I tried calling show(), but no luck. Thanks though!
type: QuestionComment
comment on: http://stackoverflow.com/q/24831477
score: 0
type: Comment

http://stackoverflow.com/comment/38563736
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24837759
has text: Post the file creation code. Are you certain that file.delete() didn't work?
type: QuestionComment

http://stackoverflow.com/comment/100722326
comment on: http://stackoverflow.com/q/24782704
has text: @EricB. did you figure it out ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/50717700
score: 1
answers question: http://stackoverflow.com/q/24762657
upvote count: 2
downvote count: 1
type: Answer
has body: You can do it by just adding one more dependency you Gradle compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '1.3.0.RELEASE' In you Pom.xml org.springframework.boot spring-boot-devtools 1.3.0.RELEASE

http://stackoverflow.com/comment/38480194
has text: Do you have a remote repository of your own? EG: Nexus, Artifactory?
comment on: http://stackoverflow.com/q/24792232
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24889698
tagged with: adapter
favorite count: 0
accepted answer: http://stackoverflow.com/a/24889853
has body: I have recently looked into the source code of HashSet Collection class and found out that It is backed by HashMap. HashSet is delegating all its method calls to HashMap. So I'm just wondering if this is a good example for adapter pattern .
score: 3
has title: Is HashSet implementation in Java a good example for Adapter Pattern
possible better answer: http://stackoverflow.com/a/24889781
tagged with: design-patterns
downvote count: 1
has answer: http://stackoverflow.com/a/24889781
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38683987
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/24889853

http://stackoverflow.com/comment/38436384
score: 0
comment on: http://stackoverflow.com/a/24769926
type: Comment
has text: Is there a reason you don't want to use ServletContext?
type: AnswerComment

http://stackoverflow.com/comment/38561888
score: 0
type: Comment
has text: FYI: Changed the `TWO|FOUR` example to `TWO|FOUR|SEVEN` so the dynamic nature of the regexes used is clearer to a later reader. Also expanded discussion of the approach.
type: AnswerComment
comment on: http://stackoverflow.com/a/24836676

http://stackoverflow.com/q/24883075
duplicate of: http://stackoverflow.com/q/4937180
has title: Do I really have a car in my garage?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38683672
has comment: http://stackoverflow.com/comment/38691705
has answer: http://stackoverflow.com/a/24964343
has answer: http://stackoverflow.com/a/24962993
has comment: http://stackoverflow.com/comment/38829519
has comment: http://stackoverflow.com/comment/38683856
score: 258
has answer: http://stackoverflow.com/a/24883263
has answer: http://stackoverflow.com/a/24992299
tagged with: java
has comment: http://stackoverflow.com/comment/38848484
has answer: http://stackoverflow.com/a/24915947
linked to: http://stackoverflow.com/q/4937180
has answer: http://stackoverflow.com/a/24921530
type: Question
has answer: http://stackoverflow.com/a/24883214
has answer: http://stackoverflow.com/a/24883197
downvote count: 17
linked to: http://stackoverflow.com/q/289106
has comment: http://stackoverflow.com/comment/38699468
upvote count: 275
has comment: http://stackoverflow.com/comment/38839077
has comment: http://stackoverflow.com/comment/38687577
has answer: http://stackoverflow.com/a/24892448
has answer: http://stackoverflow.com/a/24884027
tagged with: inheritance
answer count: 13
has answer: http://stackoverflow.com/a/24968446
has comment: http://stackoverflow.com/comment/38690163
has comment: http://stackoverflow.com/comment/38649968
has body: I'm a newbie to Java programming, trying to get the hang of OOP. So I built this abstract class: public abstract class Vehicle{....} and 2 subclasses: public class Car extends Vehicle{....} public class Boat extends Vehicle{....} Car and Boat also hold some unique fields and methods that aren't common (don't have the same name, so I can't define an abstract method for them in Vehicle). Now in mainClass I have setup my new Garage: Vehicle[] myGarage= new Vehicle[10]; myGarage[0]=new Car(2,true); myGarage[1]=new Boat(4,600); I was very happy with polymorphism until I tried to access one of the fields that are unique to Car, such as: boolean carIsAutomatic = myGarage[0].auto; The compiler doesn't accept that. I worked around this issue using casting: boolean carIsAutomatic = ((Car)myGarage[0]).auto; That works... but it doesn't help with methods, just fields. Meaning I can't do (Car)myGarage[0].doSomeCarStuff(); So my question is - what do I really have in my garage? I'm trying to get the intuition as well as understand what's going on "behind the scenes". for the sake of future readers, a short summary of the answers below: Yes, there's a Car in myGarage[] Being a static typed language, the Java compiler will not lend access to methods/fields that are non-"Vehicle", if accessing those through a data structure based on the Vehicle super class( such as Vehicle myGarage[]) As for how to solve, there are 2 main approaches below: Use type casting, which will ease the compiler's concerns and leave any errors in the design to run time The fact that I need casting says the design is flawed. If I need access to non-Vehicle capabilities then I shouldn't be storing the Cars and Boats in a Vehicle based data structure. Either make all those capabilities belong to Vehicle, or use more specific (derived) type based structures In many cases, composition and/or interfaces would be a better alternative to inheritance. Probably the subject of my next question... Plus many other good in…
has answer: http://stackoverflow.com/a/24883183
favorite count: 0
has answer: http://stackoverflow.com/a/24910997

http://stackoverflow.com/comment/38573903
has text: No there are no outputs with openJDK, only the exceptions. With Oracle's JDK i get the outputs.
comment on: http://stackoverflow.com/q/24843146
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38416076
has text: android.os.NetworkOnMainThreadException is related to, you are trying to perform internet related activity on your main thread. But according to android, if you stop main thread for more than 5 seconds, your will get crashed. So it is always recommended that whenever you perform network related operation try to do those on seperate thread & best way of doing this is use AsyncTask. See these links : http://developer.android.com/reference/android/os/AsyncTask.html & http://developer.android.com/guide/components/processes-and-threads.html
comment on: http://stackoverflow.com/q/24758195
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38665422
comment on: http://stackoverflow.com/a/24888055
type: Comment
has text: Well, glad that you understand the concept behind it. I'm missing a subtly - myactivity.this should not be of Context type, but should be of the type Activity, because runOnUiThread is a method of the Activity class. Try replacing it with `Registration.this` - you need to reference your Activity where the UI will appear. Also (and I'll edit my post), runnable should be capitalized to `Runnable()`, as its an instance of the Runnable class.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24869624
accepted answer of: http://stackoverflow.com/q/24869417
has body: Writing the two HYB objects to the ObjectOutputStream doesn't merge them into a single HYB object; the ObjectOutputStream still contains two HYB object, of which your code reads one. If you did a second call to readObject(), the second one would be retrieved and could be printed to the screen. So you could just wrap the readObject() and println() calls in a loop that reads/writes until there's nothing else to read from the stream.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38634684
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24869417
has comment: http://stackoverflow.com/comment/38628406
upvote count: 2
has comment: http://stackoverflow.com/comment/38630810
has comment: http://stackoverflow.com/comment/38634768
has comment: http://stackoverflow.com/comment/38630587
has comment: http://stackoverflow.com/comment/38634264

http://stackoverflow.com/q/24872732
has comment: http://stackoverflow.com/comment/38632677
accepted answer: http://stackoverflow.com/a/24872895
score: 0
tagged with: multithreading
tagged with: concurrenthashmap
answer count: 1
has comment: http://stackoverflow.com/comment/39700339
has comment: http://stackoverflow.com/comment/38634703
tagged with: java
has comment: http://stackoverflow.com/comment/38634683
has comment: http://stackoverflow.com/comment/39737325
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38634015
tagged with: java.util.concurrent
upvote count: 4
downvote count: 4
has answer: http://stackoverflow.com/a/24872895
type: AnsweredQuestion
has body: Hi i know the workings of ConcurrentHashMap before JDK 8. I also understood the code: it was pretty modular and not very hard to understand. The code of ConcurrentHashMap in JDK 8 has changed a lot from its previous implementations. Because this question was classified as too broad I will now try to be very specific. CHMv8 uses a TreeBin (a variant of RedBlackTree) for buckets rather than a linked list. So my question what is the main advantage of using TreeBin over a linked list? Source code here
has comment: http://stackoverflow.com/comment/38634660
has comment: http://stackoverflow.com/comment/38631186
favorite count: 0
has comment: http://stackoverflow.com/comment/38632814
type: Question
has comment: http://stackoverflow.com/comment/38634039
has comment: http://stackoverflow.com/comment/38631042
has comment: http://stackoverflow.com/comment/38631584
has title: ConcurrentHashMap jdk 8 Uses TreeNodes instead of List .. Why?
has comment: http://stackoverflow.com/comment/38633606
has comment: http://stackoverflow.com/comment/38630977
has comment: http://stackoverflow.com/comment/38631106

http://stackoverflow.com/q/24759596
tagged with: android
answer count: 1
tagged with: osmdroid
favorite count: 0
has answer: http://stackoverflow.com/a/24759816
has body: I have a LinearLayout with a mapView, zoomIn button, zoomOut button. the app receives touchevents and it is supposed to manage the LinearLayout children with the given information (X coordinate, Y coordinate , type of touch event) I am able to zoomIn and ZoomOut with the following code, but I am not able to move the map: @Override public boolean onTouch(View arg0, MotionEvent event) { int action = event.getAction(); switch(action) { case MotionEvent.ACTION_DOWN: savedTouchedX = event.getX(); savedTouchedY = event.getY(); break; case MotionEvent.ACTION_MOVE: doPanning(event, mapView); break; case MotionEvent.ACTION_UP: doPanning(event, mapView); savedTouchedX = -1; savedTouchedY = -1; break; default: break; } return true; } }); //move mapView private boolean doPanning(MotionEvent e, MapView mapView) { if(savedTouchedX &gt;= 0 &amp;&amp; savedTouchedY &gt;= 0) { IGeoPoint mapCenter = mapView.getMapCenter(); GeoPoint panToCenter = new GeoPoint((int)(mapCenter.getLatitudeE6() + (e.getY() - savedTouchedY) * 1E5),(int)(mapCenter.getLongitudeE6() - (e.getX() - savedTouchedX) * 1E5)); mapView.getController().setCenter(panToCenter); } savedTouchedX = e.getX(); savedTouchedY = e.getY(); return true; } .... public void lookForButton(String msg){ String[] strArray = msg.split(" "); final MotionEvent m; int x=Integer.valueOf(strArray[1]); int y=Integer.valueOf(strArray[2]); int type=Integer.valueOf(strArray[3]); switch (type){ case 2: m = MotionEvent.obtain(226707,226707,0/*ACTION_DOWN*/,x,y,0); runOnUiThread(new Runnable() { public void run() { memecontentView.dispatchTouchEvent(m); } }); break; case 3: m = MotionEvent.obtain(226707,226707,1/*ACTION_UP*/,x,y,0); runOnUiThread(new Runnable() { public void run() { memecontentView.dispatchTouchEvent(m); } }); break; case 5: m = MotionEvent.obtain(226707,226707,2/*ACTION_MOVE*/,x,y,0); runOnUiThread(new Runnable() { public void run() { memecontentView.dispatchTouchEvent(m); } }); break; } } public void ZoomInButton(View v){ mapView…
has title: how to programmatically move a mapView (osmdroid)
tagged with: touch-event
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: android-mapview
type: Question
accepted answer: http://stackoverflow.com/a/24759816
upvote count: 3

http://stackoverflow.com/q/24882424
has answer: http://stackoverflow.com/a/25494926
type: UnansweredQuestion
tagged with: tomcat7
has body: I assume that I am missing something very obvious here, but I've spend about 4 hours searching and trying and couldn't come to a solution, so maybe there is some help. I was following this guide: https://docs.jboss.org/author/display/PLINK/Standalone+Web+Applications%28All+Servlet+Containers%29 I was able to connect my SP and my IDP and perform a login. I can see a user principal in the session. However, as soon as I add tomcat security, to protect some part of the application as in the above example it doesn't work. Here are the relevant parts of the web.xml The SP Filter intersects all requests at the SP and sees if there is a need to contact the IDP. SPFilter org.picketlink.identity.federation.web.filters.SPFilter ROLES sales,manager IGNORE_SIGNATURES true SPFilter /login appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/servlet-context.xml 1 appServlet *.html <web-resource-collection> Manager command /loginarea/* </web-resource-collection> manager The role that is required to log in to the Manager Application manager Whenever I am trying to access something under /loginarea/ I get a 403 without even coming through to the SPFilter or my code. However, from my code under other urls I can read the user principal, and it contains the tomcat user (from the quickstart examples). Interestingly, if I am trying to read the roles, it always returns null: Principal userPrincipal = (Principal) request.getSession().getAttribute(GeneralConstants.PRINCIPAL_ID); <-- returns the principal with correct user name List roles = (List) request.getSession().getAttribute(GeneralConstants.ROLES_ID); <- null If I remove the security-constraint I can access the app and the controller without any problems. I am using basic redirect idp from examples. regards Leon
downvote count: 0
score: 1
tagged with: java
has title: Roles are not transmitted in picketlink SPFilter integration on tomcat7
type: Question
tagged with: picketlink
upvote count: 1
linked to: http://stackoverflow.com/q/24657169
answer count: 1
favorite count: 0
tagged with: single-sign-on

http://stackoverflow.com/q/24834051
tagged with: java
tagged with: mysql
upvote count: 1
type: Question
has body: What i tried: I am trying to setup a basic login system. After user is authenticated, how do I redirect him/her to another page? I have tried using actionRequest.sendRedirect but it does not work either. I get an error. This is my code: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String first_name = request.getParameter("first_name"); String last_name = request.getParameter("last_name"); String display_name = request.getParameter("display_name"); String email = request.getParameter("email"); String pass = request.getParameter("pass"); try{ //loading driver Class.forName("com.mysql.jdbc.Driver"); //creating connection with the database Connection con=DriverManager.getConnection ("jdbc:mysql://localhost:3306/project","root","password"); PreparedStatement ps=con.prepareStatement ("insert into User values(?,?,?,?,?)"); ps.setString(1, first_name); ps.setString(2, last_name); ps.setString(3, display_name); ps.setString(4, email); ps.setString(5, pass); int i=ps.executeUpdate(); if(i&gt;0) { System.out.println("Registration Successful on backend!"); actionResponse.sendRedirect("twitterResult.jsp"); **//GIVES ERROR** } }catch(Exception se) { se.printStackTrace(); } } Question: If user is successfully authenticated (i>0), How do I redirect to another page say home.jsp or some other page? Please kindly help!
accepted answer: http://stackoverflow.com/a/24834071
tagged with: servlets
answer count: 3
has title: How to redirect to a successful page?
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/24857289
favorite count: 0
has answer: http://stackoverflow.com/a/24836169
has comment: http://stackoverflow.com/comment/38557122
has answer: http://stackoverflow.com/a/24834071
possible better answer: http://stackoverflow.com/a/24836169
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/24759163
has answer: http://stackoverflow.com/a/24776864
accepted answer: http://stackoverflow.com/a/24776864
has body: Consider following model: public class Contact { @Required public String name; @Valid public List&lt;Information&gt; informations; } public static class Information { public String securedField; @Required public String email; @Valid public List&lt;Phone&gt; phones; public static class Phone { @Required @Pattern(value = "[0-9.+]+", message = "A valid phone number is required") public String number; } } } I don't want Information securedField to be affected by mass assignment vulnerability. So i decided to set array of allowedFields for Contact Form. As i know, play forms are based on Spring DataBinder, so is it possible to handle collection fields? I don't want to write smth like: name informations[0].email informations[0].phones* informations[1].email informations[1].phones* etc Following doesn't work: name informations.email informations.phones* Should i extend existing Spring DataBinder and Form classes and override bind method in this case?
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: playframework-2.3
tagged with: java
tagged with: spring-data
type: Question
has title: Play framework 2 (Java) form data binding with nested allowed fields
has comment: http://stackoverflow.com/comment/38533543
has comment: http://stackoverflow.com/comment/38535403
upvote count: 2
answer count: 2
tagged with: playframework
possible better answer: http://stackoverflow.com/a/25013399
has answer: http://stackoverflow.com/a/25013399
favorite count: 0

http://stackoverflow.com/comment/38542911
comment on: http://stackoverflow.com/a/24807481
score: 0
type: AnswerComment
has text: Thats your opinion, and your are entitled to it. There are people who prefer exception based coded and those who don't. The facts are questionable though: Whether this has more overhead than the other approach depends on whether you actually need the number (which you might), in this case my approach will be more efficient
type: Comment

http://stackoverflow.com/q/24903418
has title: Self-closing tag in xml parsing using java
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: xml-parsing
has body: I'm trying to parse an xml file to get news from rss feed. But self closing, empty tags are not parsed properly. Some of the items doesnt have a description tag. My xml looks like this Tata Group http://www.tata.com Tata is a rapidly growing business group based in India with significant international operations. The business operations of the Tata Group currently encompass seven business sectors: communications and information technology, engineering, materials, services, energy, consumer products and chemicals. Copyright (C) 2014 Tata Sons Ltd Tata Power commissions waste water recovery plant at power house #6, Jamshedpur http://www.tata.com/rssread.aspx?artid=tiEeXsbwZ54= Jamshedpur: Tata Power, India's largest integrated power company, has adopted several innovative technological solutions to improve the plant processes at its generation faciliti... 22 Jul 2014 12:00:00 GMT Currently what I'm getting is, I could see all the items that has non-empty description tags and all the items with empty self closing description tags are skipped. try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser xpp = factory.newPullParser(); FileReader xmlReader = new FileReader(destination); xpp.setInput(xmlReader); int eventType = xpp.getEventType(); String NodeValue; while (eventType != XmlPullParser.END_DOCUMENT) { switch (eventType) { case XmlPullParser.START_DOCUMENT: break; case XmlPullParser.START_TAG: NodeValue = xpp.getName();// Start of a Node if (NodeValue.equalsIgnoreCase("item")) { flagItem = true; } else if (NodeValue.equalsIgnoreCase("title") && flagItem) { eventType = xpp.next(); if (eventType == XmlPullParser.TEXT) { message.setTitle(xpp.getText()); } } else if (NodeValue.equalsIgnoreCase("description/") && flagItem) { message.setDescription("Description not available.."); Log.out(logFlag, logTag, "Reaching the critical point........... self closing tag reached!!!"); flagItem = false; list.add(message); message = null; message = new M…
has answer: http://stackoverflow.com/a/24903565
answer count: 1
score: 0

http://stackoverflow.com/comment/38456544
type: QuestionComment
has text: Can you or are you using jquery? It's possible to use it to monitor the status code of a resource query, but I've never tried to use jquery ajax to download a resource. With it, you could potentially set your window.location.href when the success: function on the ajax call is fired.
score: 0
comment on: http://stackoverflow.com/q/24777242
type: Comment

http://stackoverflow.com/a/24876108
has comment: http://stackoverflow.com/comment/38639375
has body: You can through this with less code by using Lambda Expression Code: public class LambdaTest { public static void main (String[] args) { List&lt;Integer&gt; objList = Arrays.asList(1,1,2,3,2,4,5,2,5); objList .forEach(i -&gt; System.out.print(" " + i)); System.out.println(); List&lt;Integer&gt; noDub =objList.stream().distinct().collect(Collectors.toList()); noDub.forEach(i -&gt; System.out.print(" " + i)); } } output: 1 1 2 3 2 4 5 2 5 1 2 3 4 5
has comment: http://stackoverflow.com/comment/38642251
has comment: http://stackoverflow.com/comment/38642203
has comment: http://stackoverflow.com/comment/38639218
type: Answer
answers question: http://stackoverflow.com/q/24875923
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/38615480
score: 0
type: QuestionComment
has text: @ManishSingh I asked about "your question", because you simply told us what your requirements are. You did not tell us what problems you have. Obviously, you got stuck at a very low language level (the `t1 - t2` part tells that). In that case let me suggest to continue learning the language basics. There are many tutorials out there.
comment on: http://stackoverflow.com/q/24864800
type: Comment

http://stackoverflow.com/comment/38596031
comment on: http://stackoverflow.com/a/24854505
type: AnswerComment
has text: I am trying to understand the logics, you made it really clear and straight to the point. +1 for you. Thank you!
score: 0
type: Comment

http://stackoverflow.com/comment/38698855
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24907914
score: 0
has text: @withparadox2 what do I need to put in context? And what is the second argument from the layoutinflater.inflate method?

http://stackoverflow.com/comment/38567145
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24839678
has text: See my answer if you're looking for something which does not depend on the key implementation.
type: AnswerComment

http://stackoverflow.com/comment/38675777
score: 1
comment on: http://stackoverflow.com/q/24895843
has text: By the way, why the "java" tag? This question doesn't appear to be about java at all.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38656433
type: Comment
comment on: http://stackoverflow.com/a/24882749
type: AnswerComment
has text: Thanks for your answer. I have read about your solution and I think is better than mine, so I have replaced. However I can't get files yet. I tried to add _header("Content-Length: ".$file['size'])_ in PHP file and _int length = connection.getContentLength();_ in Java file and length value is 0. It might be problem of BufferedInputStream?
score: 0

http://stackoverflow.com/comment/38516860
comment on: http://stackoverflow.com/q/24810336
score: 0
has text: Like i said, i made another applet to access to my printer, it worked but the font was stretched (because dot matrix need raw data, all other format are graphics)... i followed this instructions https://www.java.com/en/download/help/java_blocked.xml and it worked, but now with this new code it can't print
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24861894
type: AcceptedAnswer
score: 0
has body: The main difference is that the second one doesn't compile. printStackTrace() is a void method. Normally, when people involve printStackTrace(), they write e.printStackTrace(); instead of LOGGER.error(message, e); but don't combine these two in one line. Anyway, never use .printStackTrace() in an application which already has logging because your stack trace may not even make it to the logs, and it will appear in the System.err stream, where nothing should be written from an app which has proper logging.
type: Answer
accepted answer of: http://stackoverflow.com/q/24861826
answers question: http://stackoverflow.com/q/24861826

http://stackoverflow.com/q/24869667
linked to: http://stackoverflow.com/q/21538679
answer count: 0
has comment: http://stackoverflow.com/comment/38660891
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/38652660
tagged with: jakarta-ee
tagged with: dependency-injection
tagged with: java
has body: I have a Java web filter that does some initial processing of incoming requests. Within this filter, I'd like to be able to set a value in the CDI Session scope when certain conditions are met. I have not found any documentation that says that this is possible, however. With JBoss Seam, I was able to call Contexts.getSessionContext() and then set my scope values programmatically. Is there any equivalent within JavaEE 7 and CDI that will let me take a Java object and add it to the Session scope?
type: Question
has title: Explicitly set object in CDI Session scope?
tagged with: cdi
tagged with: scope

http://stackoverflow.com/comment/38572439
has text: If you want it to be bi-directional, maybe wrap your other list into an ObservableList also. But beware that you do not fire your own List when you do your changes.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24827390
type: AnswerComment

http://stackoverflow.com/comment/38513805
has text: More than 2^31 items consumes a lot of RAM. Load it partially. Assuming that an item is only an Integer, it's 24 bytes per item (8 for the reference, 12 bytes for the object header, 4 bytes for the int value). 2^31 such Integer items will take 48 GB of RAM.
comment on: http://stackoverflow.com/q/24810675
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24769417
downvote count: 0
has body: Generally remote web server whens ees the headers related to mobile platform, they redirect user to mobile version of app for better experience, so to solve it try faking http headers
accepted answer of: http://stackoverflow.com/q/24769107
type: Answer
answers question: http://stackoverflow.com/q/24769107
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/38652523
has text: You can design your own buttons.You can use images on buttons by using setIcon().This will help you design a calculator with enriched graphical look and feel.See this http://stackoverflow.com/questions/21270656/how-to-set-the-background-image-of-a-button-in-java-swing
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24884315

http://stackoverflow.com/q/24886529
score: 1
favorite count: 0
type: Question
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24887309
upvote count: 1
downvote count: 0
has body: Right now i try to use Akka in quite a simple, as it seems, use case. I want a specific Actor to handle messages that i get over TCP, but i can't achieve that and the documentation does not seem clear enough. Here is what i have now: Application.conf: akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { enabled-transports = ["akka.remote.netty.tcp"] netty.tcp { hostname = "127.0.0.1" port = 2552 } } } Main public class Main { public static void main(String[] args) { ActorSystem system = ActorSystem.create("Server"); ActorRef a = system.actorOf(Props.create(SampleActor.class), "Messages"); a.tell("testmessage", a); } } SampleActor public class SampleActor extends UntypedActor { private final LoggingAdapter log = Logging.getLogger(getContext().system(), this); @Override public void onReceive(Object msg) { log.info("Sample actor: " + msg.toString()); } } But i don't know hot to get SampleActor to process messages that i receive at 127.0.0.1:2552. This is the output i get when i run this app and visit 127.0.0.1:2552 in browser exactly once: [INFO] [07/22/2014 15:39:50.953] [main] [Remoting] Starting remoting [INFO] [07/22/2014 15:39:51.086] [main] [Remoting] Remoting started; listening on addresses :[akka.tcp://Server@127.0.0.1:2552] [INFO] [07/22/2014 15:39:51.087] [main] [Remoting] Remoting now listens on addresses: [akka.tcp://Server@127.0.0.1:2552] [INFO] [07/22/2014 15:39:51.092] [Server-akka.actor.default-dispatcher-3] [akka://Server/user/Messages] Sample actor: testmessage [INFO] [07/22/2014 15:39:59.796] [Server-akka.actor.default-dispatcher-3] [akka://Server/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2FServer%40127.0.0.1%3A6993-2] Message [akka.remote.transport.AssociationHandle$Disassociated] from Actor[akka://Server/deadLetters] to Actor[akka://Server/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2FServer%40127.0.0.1%3A6993-2#455049767] was not delivered. [1] dead letters encountered. This loggin…
accepted answer: http://stackoverflow.com/a/24887309
type: AnsweredQuestion
tagged with: akka
has title: How to specify the Actor to process messages from a specific port

http://stackoverflow.com/a/24764187
has body: ArrayAdapter&lt;String&gt; monthArray= new ArrayAdapter&lt;String&gt; (this, android.R.layout.simple_list_item_1,Months); final AutoCompleteTextView textView= (AutoCompleteTextView)findViewById(R.id.testAC); Button changeB = (Button) findViewById(R.id.btextC); Button changeB2= (Button) findViewById(R.id.bAC); Move these initializations to onCreate() and the findViewById() calls after setContentView(). You cannot really run any activity code before onCreate().
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24764149
downvote count: 0

http://stackoverflow.com/a/24790490
type: Answer
downvote count: 0
score: 1
has body: You are only copying the right side values to the left side values; you aren't switching the values from both sides. Instead of just copying the right side to the left side, swap their values. Replace s[x] = s[(s.length - x) -1]; with int temp = s[x]; s[x] = s[(s.length - x) -1]; s[(s.length - x) -1] = temp; Additionally, you will need to stop your for loop halfway through the array, before x reaches s.length/2, or else the second half will swap the values back to their original locations.
upvote count: 1
answers question: http://stackoverflow.com/q/24790437

http://stackoverflow.com/q/24791189
answer count: 1
has answer: http://stackoverflow.com/a/24796892
has body: I have 2 modules: GWT and Java(SPring etc). Little explanation: In Java module I have a Java Mail Sender method which I want to use in my GWT Widget. That's method has 2 parameters: java.util.List&lt;User&gt; recipients and String message. There is an example Project -GWT -Java(Spring and etc) What I need(Here you may see my attempts and below will be code what I have): 1)I want to call java method in my class which was inherited on Composite class. Then I got the following error: No source code is available for type my.packet.proj.MyClass; did you forget to inherit a required module? 2)I learned that it's not possible to call the Java code (not all) in GWT, and I used JSNI(I wrote some native methods) to realize that, but it was impossible to me, unfortunately... There is a code example that I had have. public class MyClass extends Composite{ @UiField TextBox text; @UiField Button btn; interface EmailMailingUiBinder extends UiBinder&lt;HTMLPanel, MyClass&gt; { } private static MyClassUiBinder myUiBinder = GWT.create(MyClassUiBinder.class); /*@param mailService is an object of messaging class in Java module*/ public MyClass(MailService mailService){ btn.addClickHandler( (event) -&gt;{ sendOnClick(mailService, recipients ,message); //code below }); public native void sendOnClick(MailService mailService, List&lt;User&gt; recipients, String msg)/*-{ mailService.@my.packet.proj.MailService::sendMessage(Ljava/util/List,/*and so on*/)(recipients, msg) }-*/ } There was no errors in code above when Gradle compile Gwt. But I need to call it class(because it's widget, page) in MainPanel, when I create an instance of MyClass, like this: new MyClass(new MailService()) compileGwt FAILED with compilation errors No source code is available for type my.packet.proj.MailService; did you forget to inherit a required module? Guys, do you have any idea how to pass instance as a argument? P.S. I removed some unnecessary code P.S.S I even tried like that(to create my Instance of MyClass):…
has comment: http://stackoverflow.com/comment/38477720
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38476814
tagged with: java
type: Question
tagged with: gwt
has title: compile GWT failed - No source code is available for type
score: 0

http://stackoverflow.com/q/24779281
favorite count: 0
has comment: http://stackoverflow.com/comment/38453207
downvote count: 3
has comment: http://stackoverflow.com/comment/38453174
has title: Where best to place the Java Libaries for common usage? (Best practice ?)
has comment: http://stackoverflow.com/comment/38453255
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38453178
type: Question
has answer: http://stackoverflow.com/a/24782105
has comment: http://stackoverflow.com/comment/38456234
has comment: http://stackoverflow.com/comment/38454640
tagged with: java
has body: I am new to Eclipse / Java dev We consume lots of libraries like Log4J, JDom, Apache Configuration etc in all our applications Right now I create a lib folder in Eclipse projects and add these libraries to all projects and then create JAR which includes these libraries too I don't want to copy the same libraries again and again and also bundle them as these are common to all my applications. I obviously want to reduce the foot print of my applcations Are there any best practices? Thanks
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/24781365
upvote count: 2
answer count: 2

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/24837337
tags question: http://stackoverflow.com/q/24908996
tags question: http://stackoverflow.com/q/24751691

http://stackoverflow.com/q/24772329
has answer: http://stackoverflow.com/a/24775324
type: AnsweredQuestion
has title: Spring MVC ConversionService Defaults
downvote count: 0
accepted answer: http://stackoverflow.com/a/24775324
score: 1
has answer: http://stackoverflow.com/a/24818175
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24818175
tagged with: spring
tagged with: java
answer count: 3
has body: I've written a ConversionService as below. This works in converting my String to IMRM in the controller when I have an object that contains an IMRM. However, I'm getting a bug in another place in the system. Apparently, we haven't used Spring 3 ConvertorServices before (I'm registering the first one here.) and part of the system relied on whatever was the default before. The area that has the problem looks like: And this is bound to a List java object. Before, this would be just a single object with the value "a=b,c=d" but now I'm getting two objects ["a=b", "c=d"]. This is a problem because it's not expecting this behavior and it breaks the old code here. How can I get the ConversionService to use the old (PropertyEditor? Not super sure how spring does this by default) way of doing this? Or should I just register something to override this? I'm open to ideas and I'm feeling stuck here. Thanks! Converter: final class StringToIMRM implements Converter { private static final Logger LOG = LoggerFactory.getLogger(StringToIMRM.class); @Override public IMRM convert(String source) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(source, IMRM.class); } catch (Exception e) { if (e instanceof JsonParseException || e instanceof IOException || e instanceof JsonMappingException) { LOG.error("Error converting String to IMRM object. source={}", source, e); } throw new IllegalArgumentException("Error converting String to IMRM object.", e); } } And this class: public class ConversionServiceInitializer implements WebBindingInitializer { @Autowired private ConversionService conversionService; @Override public void initBinder(WebDataBinder binder, WebRequest request) { binder.setConversionService(conversionService); } } Here's my XML setup. And:
upvote count: 1
has answer: http://stackoverflow.com/a/50142178

http://stackoverflow.com/comment/38660522
type: QuestionComment
type: Comment
has text: If it can be done with a servlet it can be done with a controller both operate on the request and response. However you cannot have the same url-mapping for 2 different servlets, map your `IndexServlet` to something else and let the `DispatcherServlet` redirect to it for requests.
comment on: http://stackoverflow.com/q/24886278
score: 0

http://stackoverflow.com/comment/38451936
type: QuestionComment
has text: Something is completely wrong. Try to re-install your environment, e.g. Netbeans. A typical Hello-World web app should start in less then 3 seconds.
comment on: http://stackoverflow.com/q/24777650
score: 0
type: Comment

jms
tags question: http://stackoverflow.com/q/24863258
tags question: http://stackoverflow.com/q/24839827
tags question: http://stackoverflow.com/q/24753170
tag name: jms
tags question: http://stackoverflow.com/q/24888788
tags question: http://stackoverflow.com/q/24820060
type: Tag
tags question: http://stackoverflow.com/q/24780155
tags question: http://stackoverflow.com/q/24773506

http://stackoverflow.com/a/24898165
has comment: http://stackoverflow.com/comment/38688388
has comment: http://stackoverflow.com/comment/38704185
has body: I finally figured it out. Apparently everything I wanted is built into java. Java has the ability to pass java objects into a javascript invocation and those objects can be used as if native java objects. I was able to set a global java.sql.Connection in the javascript invocation and read the database exactly as I would in java. Also, I was able to modify passed in objects and return them to the calling java code. Here is the code that worked. The Java source file. import java.io.FileNotFoundException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import javax.script.Invocable; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class JSTest { public static void main(String[] args) { new JSTest().go(); } public void go(){ Connection db = null; try { //Initialize all of the built in Java script parsing classes ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("javascript"); db = login("127.0.0.1", "3306", "testdb", "user", "password"); //set the database connection as a global variable for the javascript object. engine.put("g_connection",db); engine.eval(new java.io.FileReader("/home/scripts/testScript.js")); Invocable inv = (Invocable) engine; //Put together some sample data for the script to manipulate Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(0); cal.set(2014, 6, 20, 10, 30, 0); Date apptTime = cal.getTime(); TripLeg tripLeg = new TripLeg(); tripLeg.setLegSequence("A"); tripLeg.setAppointmentTime(apptTime); tripLeg.setProjectedMiles(5); Trip trip = new Trip(); trip.setClientID(5);//This is the id of the client record. I need to look it up in the script. tripLeg = (TripLeg) inv.invokeFunction("modifyTripLeg", trip, tripLeg); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (tripLe…
answers question: http://stackoverflow.com/q/24870179
score: 0
has comment: http://stackoverflow.com/comment/38704074
type: Answer

http://stackoverflow.com/q/24800544
upvote count: 0
score: -2
answer count: 1
favorite count: 0
tagged with: android-asynctask
has body: Iam doing a refresh button for Monitoring Cars App, so when i click on it it freezes the UI for secs of threads given and when i decrease the time, it won't get the data properly (zero or null data) Click Listener: refreshcount.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { runOnUiThread(new Runnable() { @Override public synchronized void run() { if (conDetector.isConnectingToInternet()) { unitsRefreshTask = new AsyncRefreshUnit( MonitoringController.usernamei, MonitoringController.passwordi); unitsRefreshTask.execute(); try { Thread.sleep(5000); //wait(11000); } catch (InterruptedException e) { e.printStackTrace(); MyApplication.Logs(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())+getClass().toString()+" refreshcount.onclick() when calling AsyncRefreshUnit"+"\n"+e.getMessage().toString()); } } else if (!conDetector.isConnectingToInternet()) { showNoNet(); } } }); source = new CarsDataSource(getApplicationContext()); source.open(); MonitoringController.cars.clear(); MonitoringController.cars = new ArrayList&lt;Car&gt;(); ArrayList&lt;Car&gt; carList = new ArrayList&lt;Car&gt;(); System.out.println("task.getResult().size(); &gt;&gt;" + unitsRefreshTask.getResult().size()); carList = (ArrayList&lt;Car&gt;) unitsRefreshTask.getResult(); System.out.println("carList &gt;&gt;" + carList.size()); for (int u = 0; u &lt; carList.size(); u++) { System.out.println("carList.size() : &gt;" + carList.size()); MonitoringController.cars.add(carList.get(u)); System.out.println("size" + MonitoringController.cars.size()); } for (int i = 0; i &lt; carList.size(); i++) { SerialExist = source.isExistRoleAndSerial(getApplicationContext(),carList.get(i).getRoute_Nmae(),carList.get(i).getSerialNumber()); if(SerialExist){ source.updateInfoByroleName(getApplicationContext(),carList.get(i)); }else if(!SerialExist){ source.createCar(carList.get(i)); } // System.out.println("update is &gt;&gt;" + update); } MonitoringController.countOfUnits = source.…
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/24800850
tagged with: java
downvote count: 2
has title: asynctask freezes UI for time of thread
type: Question

http://stackoverflow.com/q/24756134
upvote count: 1
has title: Can anyone tell me about exception in running Spring framework basic example?
has answer: http://stackoverflow.com/a/24756218
downvote count: 1
has comment: http://stackoverflow.com/comment/38409904
tagged with: exception
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24756218
favorite count: 0
type: Question
has body: Jul 15, 2014 4:10:38 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from file [E:\theBckps\theBckps\Saurabh D drive\Eclipse_workspace1\SpringHello\src\applicationContext.xml] Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [E:\theBckps\theBckps\Saurabh D drive\Eclipse_workspace1\SpringHello\src\applicationContext.xml]; nested exception is java.lang.IllegalStateException: Unable to load schema mappings from location [META-INF/spring.schemas] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.xml.XmlBeanFactory.(XmlBeanFactory.java:73) at org.springframework.beans.factory.xml.XmlBeanFactory.(XmlBeanFactory.java:61) at CheckIt.main(CheckIt.java:15) Caused by: java.lang.IllegalStateException: Unable to load schema mappings from location [META-INF/spring.schemas] at org.springframework.beans.factory.xml.PluggableSchemaResolver.getSchemaMappings(PluggableSchemaResolver.java:153) at org.springframework.beans.factory.xml.PluggableSchemaResolver.resolveEntity(PluggableSchemaResolver.java:110) at org.springframework.beans.factory.xml.DelegatingEntityResolver.resolveEntity(DelegatingEntityResolver.java:85) at org.springframework.beans.factory.xml.ResourceEntityResolver.resolveEntity(ResourceEntityResolver.java:74) at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:107) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntity(XMLEntityManager.java:1100) at com.sun.org.apache.xerces.internal.impl.xs.XMLSc…
has comment: http://stackoverflow.com/comment/38409776
tagged with: spring
answer count: 1
score: 0
tagged with: java

http://stackoverflow.com/a/24804402
has body: If the default List#toString method does not do what you want, you can get more flexibility with the Streams API: String result = list.stream().collect(Collectors.joining(", ")); In this form you can use whatever delimiter you want. If your list does not already contain strings, but the elements' default toString representation is good, then use list.stream().map(Object::toString).collect(joining(", ")); If you want custom logic for the conversion to string, just replace the mapping function, for example: points.stream().map(p -&gt; "(" + p.x + "," + p.y + ")").collect(joining(", "));
upvote count: 2
answers question: http://stackoverflow.com/q/24804185
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/24866567
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I've recently decided to rewrite one of my older android applications and I can't figure out how to convert server response like this: { "response": "SUCCESS", "data": { "0": { ... fields ... }, "1": { ... fields ... }, ... another objects } } to regular java object (or in this case list of objects). I was previously using this method: JSONObject response = new JSONObject(stringResponse); JSONObject dataList = response.getJSONObject("data"); int i = 0; while (true) { dataList.getJSONObject(String.valueOf(i)); // here I get wanted object i++; } to get relevant objects and then I can put them into List, but now I'm using Retrofit library and I'm not able to find any clean solution to parse such weird object using gson and retrofit. Thanks for any help. Edit: What I want: Send request using retrofit like this: @GET("/some params") void restCall(... another params..., Callback&lt;Response&gt; callback); and then have List of objects in Response object. What I don't know is how to declare Response object, so it can convert that weird response into normal List of objects.
tagged with: gson
has answer: http://stackoverflow.com/a/24866781
type: Question
has title: Converting Json to Pojo
has comment: http://stackoverflow.com/comment/38618733
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38618956
tagged with: retrofit
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24867010

http://stackoverflow.com/a/24895799
answers question: http://stackoverflow.com/q/24890902
type: Answer
has body: The error is CO_E_SERVER_EXEC_FAILURE. The error is raised when your code and Outlook are running in different security contexts.
upvote count: 1
has comment: http://stackoverflow.com/comment/38675305
has comment: http://stackoverflow.com/comment/38720404
score: 1
has comment: http://stackoverflow.com/comment/38678093
has comment: http://stackoverflow.com/comment/38678975
has comment: http://stackoverflow.com/comment/38720433
has comment: http://stackoverflow.com/comment/38762459
downvote count: 0
has comment: http://stackoverflow.com/comment/38700621
has comment: http://stackoverflow.com/comment/38678537

http://stackoverflow.com/q/24772447
linked to: http://stackoverflow.com/q/23355560
has comment: http://stackoverflow.com/comment/38441529
has title: Socket server using servlets
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38440829
has comment: http://stackoverflow.com/comment/38443234
tagged with: servlets
has comment: http://stackoverflow.com/comment/38440730
has answer: http://stackoverflow.com/a/24773612
has comment: http://stackoverflow.com/comment/38440793
answer count: 1
downvote count: 0
favorite count: 0
tagged with: sockets
has body: I am about to make an application that needs to have a web interface for users to interact with and a low level UDP message interface with some existing applications. Is it possible for a java servlet based application to provide both a web interface and at the same time act as a UDP socket server. Both the interfaces are actually independent, the UDP interface is for receiving messages which shall be logged to a database, while the web interface is merely for viewing data from that database. I do not require any data to be pushed to the web interface asynchronously.

http://stackoverflow.com/comment/39685823
comment on: http://stackoverflow.com/a/25436728
score: 1
has text: You should strive to always use UTF-8 without BOM. You can then use InputStreamReader/OutputStreamWriter for manipulation. With Reader/Writer you can specify encoding.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38734428
type: QuestionComment
has text: 'double A = Double.parseDouble(Password); int B = (int)A; String C = String.valueOf(B); driver.findElement(By.id("password")).sendKeys(C);'
comment on: http://stackoverflow.com/q/24908397
score: 0
type: Comment

http://stackoverflow.com/q/24809768
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I am trying to add TableRow(which is inflated from a separate layout) into TableLayout but the addView is givint NullPointerException. The TableLayout itself is in TableRow - So it's Nested Layout i.e TableLayout inside TableRow. This is all happening in custom listview Adapter that extends BaseAdapter. I'm getting NULLPointerException on this line: trackEventstable.addView(tempEventRowForTrackEventsTable) I have tried many different things but unfortunately getting same NPE error each time. And when i check inflated layout for null, it doesn't give null. (Layout files code also given at the end incase you need to view that) Here is complete code for getView method: public View getView(int arg0, View vi, ViewGroup arg2) { // TODO Auto-generated method stub ScheduleItemRecord y = scheduleItemsGeneralList.get(arg0); vi = inflater.inflate(R.layout.schedule_list_session, null); if(vi==null ){ Log.i("error", "null"); } TextView sessionTitle = (TextView) vi.findViewById(R.id.sessionTitle); int indexOfSession = y.getIndex(); SessionScheduleItem tempSession = sessionsRecordList.get(indexOfSession); sessionTitle.setText(tempSession.getTitle()); TextView sessionSubtitle = (TextView) vi.findViewById(R.id.sessionSubtitle); sessionSubtitle.setText(tempSession.getSubtitle() ); TrackScheduleItem[] tempSessionTracks = tempSession.getTracksInSession(); TableLayout table = (TableLayout)vi.findViewById(R.id.sessionTracksTable); Log.i("GCA-A-Schedule", "Session Tracks Count: " + tempSessionTracks.length); //add tracks to table for(int i=0; i<tempSessionTracks.length; i++) { Log.i("GCA-A-Schedule", "in outer Loop no: " + i); TableRow tempRow = (TableRow) inflater.inflate(R.layout.session_track_table_row, null); ((TextView)tempRow.findViewById(R.id.session_track_name)).setText(tempSessionTracks[i].getTitle()); ((TextView)tempRow.findViewById(R.id.session_track_chair)).setText("Chaired by: " + tempSessionTracks[i].getChair()); //here add events of respective track in another table EventSc…
has comment: http://stackoverflow.com/comment/38511389
has comment: http://stackoverflow.com/comment/38511342
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38511229
has comment: http://stackoverflow.com/comment/38511234
has comment: http://stackoverflow.com/comment/38511376
has comment: http://stackoverflow.com/comment/38511124
tagged with: android-layout
has comment: http://stackoverflow.com/comment/38511173
tagged with: java
has comment: http://stackoverflow.com/comment/38511163
type: Question
has comment: http://stackoverflow.com/comment/38511301
has title: NullPointerException for addView in nested TableLayout
upvote count: 1
has comment: http://stackoverflow.com/comment/38511312
answer count: 1
score: 0
tagged with: nullpointerexception
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/24817420

http://stackoverflow.com/comment/38512725
type: QuestionComment
has text: But all of the shown characters have the same byte representation in UTF-8 and ASCII (not ANSI) so it can't be that alone.
comment on: http://stackoverflow.com/q/24810028
score: 0
type: Comment

http://stackoverflow.com/q/24841172
answer count: 6
score: 11
type: Question
accepted answer: http://stackoverflow.com/a/24841234
possible better answer: http://stackoverflow.com/a/24841371
tagged with: arrays
has answer: http://stackoverflow.com/a/24841371
has comment: http://stackoverflow.com/comment/38570029
favorite count: 0
has comment: http://stackoverflow.com/comment/38571347
has answer: http://stackoverflow.com/a/52410852
linked to: http://stackoverflow.com/q/7320686
upvote count: 13
has title: Why does array indexing in Java start with 0?
has answer: http://stackoverflow.com/a/24841234
downvote count: 2
has comment: http://stackoverflow.com/comment/38570093
has comment: http://stackoverflow.com/comment/38570016
type: AnsweredQuestion
has body: Why is array indexing done with 0 and not with 1 in programming languages like Java? I am totally new to Java, any explanation is welcomed.
has answer: http://stackoverflow.com/a/57442581
has answer: http://stackoverflow.com/a/24841238
has answer: http://stackoverflow.com/a/46936088
tagged with: java

http://stackoverflow.com/a/24814447
has body: Finally, after quite long fight last night, I have managed to run Android studio and build project with Gradle... and I hope it will stay so. So, as @Eugen pointed out, this could be related to the fact that first installation of Android Studio was done for "only current user". Even I have uninstalled it and installed again it was still failing. Last night, I decided to uninstall it and also, manually, remove all remains of android stuff by simply deleting every directory with android, gradle etc. in its name ;) I have also updated java to 7.65. and installed stand alone Gradle 2.0 and add it to PATH and check it is working. After that, I done a clean install of android studio and open simple new MyApp project... and it works! Then I opened my other project - also working! I removed Gradle from PATH - still working. I have no idea what was wrong... probably first installation of Android Studio was not completely correct. And unistalling it, didn't removed everything. So, I have no clear answer for my issues, but I thought it could be helpful to describe the story. :)
answers question: http://stackoverflow.com/q/24769174
score: 0
accepted answer of: http://stackoverflow.com/q/24769174
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/53969551
type: Comment
type: QuestionComment
has text: Possible duplicate of [Fastest way to iterate through large table using JDBC](http://stackoverflow.com/questions/1080852/fastest-way-to-iterate-through-large-table-using-jdbc)
comment on: http://stackoverflow.com/q/24778648
score: 0

http://stackoverflow.com/comment/38531772
type: QuestionComment
comment on: http://stackoverflow.com/q/24820134
has text: I freely admit there may be a better way to layout this project, but it is large and complicated enough that I am not ready to try ripping out code into another project. We have 10 `pom.xml`s already, just to give an idea of the size of it. I am going home now.. on Monday I will have another look at any advice with fresh eyes..
score: 0
type: Comment

http://stackoverflow.com/comment/38598074
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24855363
type: Comment
has text: Why exactly is that better? I deleted the first one as to remove the erroneous comments. I will do whatever is better in the future, but I really did think I had done the better option.

http://stackoverflow.com/comment/38574121
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24829427
has text: I agree; but the most immediate goal is to find out why the Calendar and default locale get broken..

http://stackoverflow.com/q/24753102
tagged with: spring
has body: I am using AOP to perform logging for my servies call. Its a mven Spring MVC project. Following are my configurations: I have configured aspectj, aspectweaver and aspectjtools dependency in pom.xml Following is my application-context.xml: &lt;bean id="thirdPartyLogging" class="com.test.ThirdPartyLoggingActivity"&gt; &lt;/bean&gt; &lt;aop:config&gt; &lt;aop:aspect id="logging" ref="thirdPartyLogging"&gt; &lt;aop:pointcut id="servicesCall" expression="execution(* com.test.manager.SearchManager.getSearchData(..))"/&gt; &lt;aop:before pointcut-ref="servicesCall" method="beforeRequest"/&gt; &lt;aop:after pointcut-ref="servicesCall" method="afterRequest" arg-names = joinPoint"/&gt; &lt;aop:after-throwing pointcut-ref="servicesCall" throwing="ex" method="serviceCallException" arg-names = "joinPoint, ex"/&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; Following are my beforerequest, after request and serviceCallException methods: public void beforeRequest(){ loggingThreadLocal.get().setStartTime(System.currentTimeMillis()); System.out.println("Inside before request"); } public void afterRequest(JoinPoint joinPoint){ loggingThreadLocal.get().setEndTime(System.currentTimeMillis()); String invokingServiceName = joinPoint.getClass().toString(); loggingThreadLocal.get().setTotalTimeTaken(loggingThreadLocal.get().getEndTime() - loggingThreadLocal.get().getStartTime()); logIntegration(invokingServiceName, loggingThreadLocal.get().isSuccess(), loggingThreadLocal.get().getFailureReason(), loggingThreadLocal.get().getTotalTimeTaken()); System.out.println("Inside before request"); } public void serviceCallException(JoinPoint joinPoint, Exception ex){ loggingThreadLocal.get().setSuccess(false); loggingThreadLocal.get().setFailureReason(FailureReason.GENERIC_REMOTE_ERROR); System.out.println("Calling method: "+joinPoint.getTarget().getClass().getName()); System.out.println("Testing this obj: " + joinPoint.getThis().getClass().getName()); System.out.println("Testing source: " + joinPoint.ge…
tagged with: java
has comment: http://stackoverflow.com/comment/38404831
type: Question
has comment: http://stackoverflow.com/comment/38405723
has comment: http://stackoverflow.com/comment/38407864
tagged with: spring-aop
has title: AOP Logging not working java
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/38405836
has comment: http://stackoverflow.com/comment/38489146

izpack
tag name: izpack
type: Tag
tags question: http://stackoverflow.com/q/24885839

http://stackoverflow.com/a/24952358
score: 0
type: Answer
has body: Have you tried Spring-batch-admin module? I think your requirement can be fulfilled by spring-batch-admin. this application consists of a web UI using Spring MVC, a Java service API and a RESTful (JSON) API for managing and monitoring Spring Batch jobs.
answers question: http://stackoverflow.com/q/24872529

http://stackoverflow.com/comment/71696209
has text: `SearchType.SCAN` is no longer part of the API (at least not in 5.1.2, which is what I'm currently using)
type: AnswerComment
comment on: http://stackoverflow.com/a/24899684
score: 0
type: Comment

http://stackoverflow.com/a/24895565
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24895362
type: Answer
has comment: http://stackoverflow.com/comment/38674259
upvote count: 4
answers question: http://stackoverflow.com/q/24895362
has body: As the comments have mentioned, your program is looking for your image in a non-existent path on the windows machine (src/Icons where you execute your JAR file). To use something like an image in your java program, use a resource loader. Here is a good overview. Eventually you'll end up with something like: ImageIcon icon = new ImageIcon(this.getClass().getResource("my_photo_name.jpg"));
score: 4

http://stackoverflow.com/comment/38624084
has text: Do you have `axis2.xml` deployed?
type: Comment
comment on: http://stackoverflow.com/q/24868910
score: 0
type: QuestionComment

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/24815875
tags question: http://stackoverflow.com/q/24866737

http://stackoverflow.com/q/24836671
tagged with: regex
answer count: 4
has answer: http://stackoverflow.com/a/24836800
favorite count: 0
score: 2
accepted answer: http://stackoverflow.com/a/24836695
upvote count: 2
type: AnsweredQuestion
has title: Java string split() Regex
has body: I have a string like this, ["[number][name]statement_1.","[number][name]statement_1."] i want to get only statement_1 and statement_2. I used tried in this way, String[] statement = message.trim().split("\\s*,\\s*"); but it gives ["[number][name]statement_1." and "[number][name]statement_2."] . how can i get only statement_1 and statement_2?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24836692
tagged with: split
has answer: http://stackoverflow.com/a/24836695
downvote count: 0
tagged with: string
possible better answer: http://stackoverflow.com/a/24836746
has answer: http://stackoverflow.com/a/24836746

http://stackoverflow.com/q/24842731
linked to: http://stackoverflow.com/q/24828014
has comment: http://stackoverflow.com/comment/38576893
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38573125
has comment: http://stackoverflow.com/comment/38583989
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38573063
tagged with: calendar
has body: Yesterday I have received the answer to a question here: WEEK_OF_YEAR inconsistent on different machines (basically, learned how WEEK_OF_YEAR gets computed based on firstDayOfWeek and minimalDaysInFirstWeek) But now I have a follow-up question - what other settings could be affecting a Calendar's ability to use the default locale? Because here's the behaviour that I am observing (having a correct en_US default locale): Calendar c = Calendar.getInstance(); // should use the default locale, per docs System.out.println(c.getFirstDayOfWeek()); System.out.println(c.getMinimalDaysInFirstWeek()); c = Calendar.getInstance(Locale.getDefault()); // provide the default explicitly System.out.println(c.getFirstDayOfWeek()); System.out.println(c.getMinimalDaysInFirstWeek()); The output of running this is: 2 4 1 1 It looks even more absurd (setDefault to the results of getDefault...?!) if I run this in Clojure (a JVM language, so the behaviour is exactly the same): user=&gt; (.getFirstDayOfWeek (java.util.Calendar/getInstance)) 2 user=&gt; (Locale/setDefault (Locale/getDefault)) nil user=&gt; (.getFirstDayOfWeek (java.util.Calendar/getInstance)) 1 The examples above are run without any JVM arguments whatsoever - so, my question is, where could the setting of 2 and 4 for the firstDayOfWeek and minimalDaysInWeek be coming from? And, perhaps most importantly - how do I fix them permanently? Thanks!
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38578296
has comment: http://stackoverflow.com/comment/38573216
has title: Why would Calendar.getInstance() fail to use the default locale?
downvote count: 0
linked to: http://stackoverflow.com/q/24844982
has comment: http://stackoverflow.com/comment/38573179
tagged with: jvm
favorite count: 0

http://stackoverflow.com/comment/38527640
has text: I added @Override public String toString() { return values + " of " + suits; }
comment on: http://stackoverflow.com/a/24817854
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38570851
score: 0
type: QuestionComment
has text: @MarijanSmetko If you want to a String[][], edit your question and say it clear.
type: Comment
comment on: http://stackoverflow.com/q/24841484

http://stackoverflow.com/q/24817637
has comment: http://stackoverflow.com/comment/38526066
tagged with: java
downvote count: 3
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/38526607
has answer: http://stackoverflow.com/a/24818377
has comment: http://stackoverflow.com/comment/38526108
has title: android java Httpclient connection
has comment: http://stackoverflow.com/comment/38526107
accepted answer: http://stackoverflow.com/a/24818377
tagged with: android
has comment: http://stackoverflow.com/comment/38527445
favorite count: 0
has answer: http://stackoverflow.com/a/24818432
score: -3
has comment: http://stackoverflow.com/comment/38525981
has body: Ok, so my HttpClient call is not working in java android i tried to surround it with try and catch and it keeps on failing. Please Help!!! BufferedReader in = null; try { HttpClient client = new DefaultHttpClient(); URI ur = new URI("http://192.168.1.10/test/randomy/generate/index.php"); HttpGet request = new HttpGet(); request.setURI(ur); HttpResponse response = client.execute(request); in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); String l = ""; StringBuffer sb = new StringBuffer("test"); while((l=in.readLine())!=null){ sb.append(l); } in.close(); return sb.toString(); } catch (Exception e) { // TODO Auto-generated catch block if(in!=null){ try { in.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } return "Error"; }
possible better answer: http://stackoverflow.com/a/24818432
has comment: http://stackoverflow.com/comment/38526157
type: AnsweredQuestion

http://stackoverflow.com/comment/38620346
score: 2
comment on: http://stackoverflow.com/q/24864177
has text: You're mocking the object under test. That doesn't make sense. You have to create a real NC object instead of mocking it. Only the collaborators should be mocked.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24886125
has comment: http://stackoverflow.com/comment/38972817
has body: If you add orphan-deletion in Company: (JPA 2.0-way) @OneToMany(mappedBy="company", targetEntity = Department.class, fetch=FetchType.LAZY, cascade=CascadeType.ALL, orphanRemoval=true) private List&lt;Department&gt; departments; (Hibernate-way) @OneToMany(mappedBy="company", targetEntity = Department.class, fetch=FetchType.LAZY, cascade=CascadeType.ALL) @Cascade({ org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN }) private List&lt;Department&gt; departments; You can delete a department by doing: company.getDepartments().remove(department); and then storing the Company (or upon commiting the transaction) (given that a Department can be owned by one and only one Company. (No need to tell the EntityManager to remove the Department..)
has comment: http://stackoverflow.com/comment/38970319
type: Answer
has comment: http://stackoverflow.com/comment/38974025
answers question: http://stackoverflow.com/q/24885697
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38970132
has comment: http://stackoverflow.com/comment/38970359
upvote count: 1

http://stackoverflow.com/comment/38584978
type: Comment
has text: What about crashing of a tomcat node? all my data will be lost?
comment on: http://stackoverflow.com/a/24848922
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38645590
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24880498
has text: Please check [this](http://i1252.photobucket.com/albums/hh567/jkiran809/StackOverFlow_JavaXML_zpsa346a017.png)

http://stackoverflow.com/q/24847252
has body: I attempt to lock a file on my device's "external" storage (not removable in my case) as it's being written. After I've obtained the lock, I am able to go into a file browser (in another app) and read or delete the file as it's being written. Is there no way to prevent this? FileOutputStream fos = new FileOutputStream(fileNameOut); lock = fos.getChannel().lock(); outputStream = new BufferedOutputStream(fos);
tagged with: android
accepted answer: http://stackoverflow.com/a/24847334
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24847334
type: Question
tagged with: locking
answer count: 1
downvote count: 0
favorite count: 0
has title: FileLock on Android doesn't do anything?

http://stackoverflow.com/a/24861042
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: It's normal. When you create your table you define the first column as an Interger (with "int" properties). And apparently you are trying to insert a string in the first column. So of course if you want to insert a string you get an error.
accepted answer of: http://stackoverflow.com/q/24860854
answers question: http://stackoverflow.com/q/24860854

http://stackoverflow.com/comment/38636704
has text: OK then use with `RedirectView` view but the concept is same. store the message in session attribute.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24875563
score: 0

http://stackoverflow.com/comment/38483594
type: Comment
has text: Thank you!, it works really well. I didn't even think if just searching for numbers followed with the ms.
comment on: http://stackoverflow.com/a/24794916
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38652519
comment on: http://stackoverflow.com/q/24884165
score: 1
has text: so here when i used System.gc 100 time(for loop ) i am able to get 9/10 outputs.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24888348
tagged with: dispose
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/6309407
favorite count: 0
has body: I am working with some legacy code. During execution, that code creates multiple windows and disposes them. However, they are still reachable and i.e. calling java.awt.Window.getWindows() returns a large array of java.awt.Window, javax.swing.JFrame, javax.swing.JDialog and the like, all of which have their name starting with "dead-". This now increasingly becomes a problem. So here are my questions: Am I correct, that the 'dead-' prefix of the name is created by the System? What can I do to properly dispose old windows such that they are no longer reachable and returned by java.awt.Window.getWindows()? Thanks a lot!
has comment: http://stackoverflow.com/comment/38660131
accepted answer: http://stackoverflow.com/a/25363628
has comment: http://stackoverflow.com/comment/38660242
has comment: http://stackoverflow.com/comment/38660186
score: 2
upvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/38659845
type: Question
has comment: http://stackoverflow.com/comment/38665241
type: AnsweredQuestion
has title: How to get rid of "dead" windows in Java?
tagged with: java
has answer: http://stackoverflow.com/a/25363628

http://stackoverflow.com/q/24800136
has comment: http://stackoverflow.com/comment/38493163
type: Question
has comment: http://stackoverflow.com/comment/38493977
score: 0
tagged with: swing
has title: I want to dispose my main JFrame when I open a new JFrame of Contact by JMenuItem.
answer count: 1
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/38493209
tagged with: java
has body: I am making a project. I need about 5 JFrame but all are interrelated. this is my main frame code public void mframe(boolean b) //function for main JFrame... { JFrame.setDefaultLookAndFeelDecorated(true); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); main m=new main(); // main constructor call ... JFrame frame = new JFrame(" Demo Project submited by: Ankit "); frame.setJMenuBar(m.menuBar); // set JMenueBar in JFrame frame... try { // try to add a background pic and icon frame.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("pics/index.jpg"))))); frame.setIconImage(ImageIO.read(new File("pics/girl.png"))); } catch (IOException e) { e.printStackTrace(); } frame.setLayout(null); frame.setOpacity(0.88f); frame.setSize(510,420); frame.setResizable(false); frame.setVisible(b); if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) { frame.setJMenuBar(m.menuBar); frame.setVisible(b); frame.setSize(500,400); } frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String agr[]) { main m = new main(); m.mframe(true); } public void actionPerformed(ActionEvent e) { if(e.getSource()==exit) { System.exit(0); } else if(e.getSource()==Ankit) { Contact c = new Contact(); c.cframe(true); // dispose(); main m1 = new main(); m1.mframe(false); } } and this is my second frame , contact frame code public void cframe(boolean b) { JFrame.setDefaultLookAndFeelDecorated(true); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); Contact co=new Contact(); JFrame cframe = new JFrame(" Ankit Ujlayan (b.tech IT) "); try { cframe.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("pics/cont.jpg"))))); cframe.setIconImage(ImageIO.read(new File("pics/girl.png"))); } catch (IOException e) { e.printStackTrace(); } cframe.setLayout(null); cframe.setOpacity(0.87f); cframe.setSize(510,420); cframe.setJMenuBar…
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9554636
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/24864271

http://stackoverflow.com/comment/38529836
type: AnswerComment
comment on: http://stackoverflow.com/a/24807401
type: Comment
has text: Sorry, didn't know you are using Oracle. It seems the syntax is different for Oracle. See this doc : http://docs.oracle.com/cd/E16655_01/server.121/e17750/ch5lingsort.htm#NLSPG0051. Also I'm not sure it makes any difference but it seems that they use collation in uppercase, try with FRENCH_CI_AI in NLS_SORT. Or use ALTER SESSION SET NLS_SORT=FRENCH_CI_AI;
score: 1

http://stackoverflow.com/q/24844122
has comment: http://stackoverflow.com/comment/39730710
has title: Thread works when else statement is present, but when it's absent, thread stops working
linked to: http://stackoverflow.com/q/25425130
answer count: 3
has answer: http://stackoverflow.com/a/24844202
has answer: http://stackoverflow.com/a/24844245
has comment: http://stackoverflow.com/comment/38575585
possible better answer: http://stackoverflow.com/a/24844204
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24844204
has body: It's my first time using threads in java and I came across with weird problem. public class ServerSender implements Runnable { DatagramSocket udpSocket; DatagramPacket sendPacket; long currentTime = 0; long elapsed = 0; public ServerSender(DatagramSocket udpSocket) { this.udpSocket = udpSocket; System.out.println("Sender live!"); } public void sendToClient(byte[] bytes) throws IOException { sendPacket = new DatagramPacket(bytes, bytes.length, Server.clientIp, Server.clientPort); udpSocket.send(sendPacket); } @Override public void run() { while(true) { if(Server.isGameLive) { currentTime = System.nanoTime(); if(elapsed / 1000000 &gt;= 100) // send snapshot every 100ms { synchronized(Server.snapshot) { try { sendToClient(Server.snapshot.toByteArray()); } catch (IOException e) { e.printStackTrace(); } } elapsed = 0; System.out.println("Sending snapshot to client..."); } else { System.out.println("not elapsed"); } elapsed += System.nanoTime() - currentTime; System.out.println(elapsed / 1000000); } else { System.out.println("not live"); } } } } This code works how it should but when I remove else statements from run method it's not working... @Override public void run() { while(true) { if(Server.isGameLive) { currentTime = System.nanoTime(); if(elapsed / 1000000 &gt;= 100) // send snapshot every 100ms { synchronized(Server.snapshot) { try { sendToClient(Server.snapshot.toByteArray()); } catch (IOException e) { e.printStackTrace(); } } elapsed = 0; System.out.println("Sending snapshot to client..."); } elapsed += System.nanoTime() - currentTime; System.out.println(elapsed / 1000000); } } } Can someone explain what's wrong there?
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24844202
tagged with: multithreading
type: Question

http://stackoverflow.com/comment/38506316
score: 0
type: Comment
type: AnswerComment
has text: @JonK Yes, that's what I meant in the last sentence of the second paragraph (though your example is helpful).
comment on: http://stackoverflow.com/a/24806985

http://stackoverflow.com/a/24790057
score: 1
answers question: http://stackoverflow.com/q/24789287
has comment: http://stackoverflow.com/comment/38475817
has comment: http://stackoverflow.com/comment/38475381
type: Answer
has comment: http://stackoverflow.com/comment/38475275
has comment: http://stackoverflow.com/comment/38475540
upvote count: 1
has comment: http://stackoverflow.com/comment/38475618
has body: In other words, the claim is that in the code below, another thread could read a non-null value of a in which the value of x has not been set. Short answer is yes. Long answer : The point that underpins another thread reading a non-null a with a value of x that has not been set - is not strictly instruction re-ordering , but processor caching the values in its registers ( and L1 caches ) rather than reading these values from main memory. This may indirectly imply reordering but it is not necessary. While the caching of values in CPU registers helps speed up processing , it introduces the problem of visibility of values between different threads running on different CPUs. If the values were always read from the main program area , all threads would consistently see the same value ( because there is one copy of that value ) . In your example code , if the value of the member field x is cached into a register of CPU1 which is accessed by thread-1 , and another thread Thread-2 running on CPU-2 now reads this value from main memory and updates it , the value of this as cached in CPU-1 ( processed by Thread-1 ) is now invalid from program point of view , but Java specification itself allows virtual machines to treat this as a valid scenario.
has comment: http://stackoverflow.com/comment/38486014
downvote count: 0
has comment: http://stackoverflow.com/comment/38479489
has comment: http://stackoverflow.com/comment/38475092

http://stackoverflow.com/a/24864475
has comment: http://stackoverflow.com/comment/38616125
has comment: http://stackoverflow.com/comment/38617154
has comment: http://stackoverflow.com/comment/38614637
has comment: http://stackoverflow.com/comment/38619833
has comment: http://stackoverflow.com/comment/38616929
has comment: http://stackoverflow.com/comment/38614666
has comment: http://stackoverflow.com/comment/38614934
has comment: http://stackoverflow.com/comment/38614896
answers question: http://stackoverflow.com/q/24864381
has comment: http://stackoverflow.com/comment/38620397
has comment: http://stackoverflow.com/comment/38619293
has comment: http://stackoverflow.com/comment/38619584
upvote count: 1
has comment: http://stackoverflow.com/comment/38617210
has comment: http://stackoverflow.com/comment/38615494
has comment: http://stackoverflow.com/comment/38615032
has comment: http://stackoverflow.com/comment/38614928
has comment: http://stackoverflow.com/comment/38614679
has comment: http://stackoverflow.com/comment/38615686
has body: Just call finish() when starting the ThreadActivity: btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, ThreadActivity.class); startActivity(intent); finish(); } }); BUT there is a problem with your app. Use a Timer to set the text of the Button! By using a Thread like you do you are creating a memory leak and that is very bad. Try this: private int i = 0; private Timer timer; private final TimerTask timerTask = new TimerTask() { @Override public void run() { btn.post(new Runnable() { @Override public void run() { btn.setText("#" + i++); } }); } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.custom); btn = (Button)findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { timer = new Timer(); timer.schedule(timerTask, 300, 300); } }); } @Override public void onPause() { super.onPause(); if(timer != null) { timer.cancel(); } }
has comment: http://stackoverflow.com/comment/38617400
has comment: http://stackoverflow.com/comment/38615605
has comment: http://stackoverflow.com/comment/38615146
downvote count: 0
has comment: http://stackoverflow.com/comment/38616057
has comment: http://stackoverflow.com/comment/38620600
has comment: http://stackoverflow.com/comment/38614982
has comment: http://stackoverflow.com/comment/38614985
has comment: http://stackoverflow.com/comment/38614826
type: Answer
has comment: http://stackoverflow.com/comment/38615017
has comment: http://stackoverflow.com/comment/38619944
has comment: http://stackoverflow.com/comment/38614755
has comment: http://stackoverflow.com/comment/38615354
has comment: http://stackoverflow.com/comment/38616882
score: 1

http://stackoverflow.com/comment/38416583
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24759293
has text: May I ask if your file was already existing, or if it was created by your code? Where in your directory structure did it end up? I've tried the exact same code, but it is not working here, as far as I can tell.

http://stackoverflow.com/q/24786588
has comment: http://stackoverflow.com/comment/38468332
has comment: http://stackoverflow.com/comment/38468124
score: -3
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38468377
has comment: http://stackoverflow.com/comment/38468748
has comment: http://stackoverflow.com/comment/38468533
tagged with: java
has comment: http://stackoverflow.com/comment/38468159
has comment: http://stackoverflow.com/comment/38468832
has comment: http://stackoverflow.com/comment/38468595
has comment: http://stackoverflow.com/comment/38468863
possible better answer: http://stackoverflow.com/a/24787660
has answer: http://stackoverflow.com/a/24787240
accepted answer: http://stackoverflow.com/a/24787240
has answer: http://stackoverflow.com/a/24787660
has title: Type mismatch : cannot convert from element type Object to String
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38468376
upvote count: 1
has body: I have a dropdown list that I want to fill via a database I show code private String maValeur; private List&lt;SelectItem&gt; mesElements; public String getMaValeur() { return maValeur; } public void setMaValeur(String maValeur) { this.maValeur = maValeur; } public List getMaliste() { ArrayList&lt;String&gt; unelist = new ArrayList(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); String serverName = "localhost"; String mydatabase = "gestionticket"; String url = "jdbc:mysql://" + serverName +":3306"+ "/"+ mydatabase; // a JDBC url String user = "root"; String pass = ""; java.sql.Connection connection = DriverManager.getConnection(url, user, pass); Statement instruction = (Statement) ((java.sql.Connection) connection).createStatement(); String sql = "select * from gestionticket.client" ; ResultSet resultat = (ResultSet) instruction.executeQuery(sql); while(resultat.next()){ String nom=resultat.getString("nom").toString(); unelist.add(nom); } //session.close(); } catch (Exception e) { e.printStackTrace(); } return (List) unelist; } public List&lt;SelectItem&gt; getMesElements() { if (mesElements == null) { mesElements = new ArrayList&lt;SelectItem&gt;(); for (String val : getMaliste()) { mesElements.add(new SelectItem(val)); } } return mesElements; } by an error msg appears at line level for (String val : getMaliste() { mesElements.add(new SelectItem(val)); } Here is the msg error: Type mismatch: cannot convert from element type Object to String if you have any idea about this compilation error; help me
has comment: http://stackoverflow.com/comment/38468525
has comment: http://stackoverflow.com/comment/38467945
favorite count: 0

http://stackoverflow.com/comment/38593147
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24853170
type: AnswerComment
has text: Do you have all required libraries in order to get working properly the Hibernate Validator. http://hibernate.org/validator/documentation/getting-started/

http://stackoverflow.com/comment/38412888
has text: @Niall I assumed that it is the Operating System (default application, or similar fundamental), since anything minor would not explain, why the ATR should change as a consequence.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24757725
type: Comment

resources
tags question: http://stackoverflow.com/q/24905955
tags question: http://stackoverflow.com/q/24832398
tags question: http://stackoverflow.com/q/24760679
type: Tag
tag name: resources

http://stackoverflow.com/a/24786451
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24786284
has body: Declare your JButton outside the method, in the same place as where you are declaring your int, String, and booleans. In other words, something like class TicTacToe { //... JButton b1; //... public int TicTacToe() { b1 = new JButton(); //note that you don't need the "" } } Incidentally, I'd recommend using arrays and looping through them rather than having 9 of everything and having to copy-paste code lots of times.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38467661
has comment: http://stackoverflow.com/comment/38467560
answers question: http://stackoverflow.com/q/24786284
type: Answer
score: 3

http://stackoverflow.com/q/24817786
has title: Android Studio fails to open on Mac OS Snow Leopard - java.lang.NoClassDefFoundError: java.awt.Toolkit
has answer: http://stackoverflow.com/a/28650494
type: UnansweredQuestion
tagged with: osx-snow-leopard
score: 2
answer count: 1
downvote count: 0
tagged with: macos
favorite count: 0
type: Question
upvote count: 2
tagged with: android
has body: I'm facing this weird issue where Android Studio just doesn't open anymore. I've been using Android Studio for quite a while now and everything was working great but all of a sudden, it stopped opening for some reason. I am using the following configuration: Android Studio 0.5.9 Java version "1.6.0_51" Mac OS 10.6.8 If it helps, here's the stack trace I was able to fetch from "console": [0x0-0x67067].com.google.android.studio[2226]: Exception in thread "main" java.lang.NoClassDefFoundError: java.awt.Toolkit [0x0-0x67067].com.google.android.studio[2226]: at sun.awt.AppContext$2.run(AppContext.java:237) [0x0-0x67067].com.google.android.studio[2226]: at sun.awt.AppContext$2.run(AppContext.java:226) [0x0-0x67067].com.google.android.studio[2226]: at java.security.AccessController.doPrivileged(Native Method) [0x0-0x67067].com.google.android.studio[2226]: at sun.awt.AppContext.initMainAppContext(AppContext.java:226) [0x0-0x67067].com.google.android.studio[2226]: at sun.awt.AppContext.access$200(AppContext.java:112) [0x0-0x67067].com.google.android.studio[2226]: at sun.awt.AppContext$3.run(AppContext.java:299) [0x0-0x67067].com.google.android.studio[2226]: at java.security.AccessController.doPrivileged(Native Method) [0x0-0x67067].com.google.android.studio[2226]: at sun.awt.AppContext.getAppContext(AppContext.java:280) [0x0-0x67067].com.google.android.studio[2226]: at sun.awt.AppContext$6.getContext(AppContext.java:827) [0x0-0x67067].com.google.android.studio[2226]: at sun.misc.SharedSecrets.getJavaAWTAccess(SharedSecrets.java:144) [0x0-0x67067].com.google.android.studio[2226]: at java.util.logging.LogManager.getUserContext(LogManager.java:321) [0x0-0x67067].com.google.android.studio[2226]: at java.util.logging.LogManager.getLogger(LogManager.java:894) [0x0-0x67067].com.google.android.studio[2226]: at java.util.logging.LogManager.demandLogger(LogManager.java:369) [0x0-0x67067].com.google.android.studio[2226]: at java.util.logging.Logger.demandLogger(Logger.java:290) [0x0-0x…
tagged with: android-studio
tagged with: java

http://stackoverflow.com/comment/38528513
score: 0
type: QuestionComment
has text: Implement String toString() on Hand returning what you would like to see.
comment on: http://stackoverflow.com/q/24819037
type: Comment

http://stackoverflow.com/q/24835153
tagged with: ejb
has title: InitialContext.doLookup Invokes Bean's Constructor Twice
type: UnansweredQuestion
tagged with: jboss
has answer: http://stackoverflow.com/a/24891427
type: Question
has body: I have a SFSB called RandomBean which has a default constructor, @PostConstruct, @PreDestroy and @Remove methods. There's a simple counter in the constructor. @Stateful public class RandomBean { public static int c = 0; public static final Logger logger = Logger.getLogger(RandomBean.class); private Random r; private int cc; public RandomBean() { c += 1; cc = c; r = new Random(); logger.info("Random constructed: " + cc); } @PostConstruct public void init() { logger.info("Random started: " + cc); } public int nextInt() { logger.info("Random invoked: " + cc); return r.nextInt(); } @PreDestroy public void destroy() { logger.info("Random destroyed: " + cc); } @Remove public void remove() { logger.info("removed: " + cc); } } I also have a servlet which performs a lookup for this bean and calls its nextInt method. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.info("Doing get"); try { RandomBean r = InitialContext.doLookup("java:module/RandomBean"); logger.info("get! " + r.nextInt()); r.remove(); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } What confuses me is that the RandomBean's constructor appears to be called twice: 02:13:09,558 INFO [org.sokolas.model.HelloServlet] (http-localhost/127.0.0.1:8080-1) Doing get 02:13:09,559 INFO [org.sokolas.model.RandomBean] (http-localhost/127.0.0.1:8080-1) Random constructed: 1 02:13:09,560 INFO [org.sokolas.model.RandomBean] (http-localhost/127.0.0.1:8080-1) Random constructed: 2 02:13:09,561 INFO [org.sokolas.model.RandomBean] (http-localhost/127.0.0.1:8080-1) Random started: 2 02:13:09,561 INFO [org.sokolas.model.RandomBean] (http-localhost/127.0.0.1:8080-1) Random invoked: 2 02:13:09,562 INFO [org.sokolas.model.HelloServlet] (http-localhost/127.0.0.1:8080-1) get! -2028573462 02:13:09,562 INFO [org.sokolas.model.RandomBean] (http-localhost/127.0.0.1:8080-1) removed: 2 02:13:09,563 INFO [org.sokolas.model.Rando…
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/24842225
type: UnansweredQuestion
tagged with: sphero
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24855695
has title: An error occurred while trying to connect with the sphero
score: 0
has body: can someone can identify the error in this code, the logic of the program itself is not implemented, it should just connect with the sphero, then no error should not occur. does anyone know how to solve this Thank you in advance. public class MainActivitySimon extends Activity { private SpheroConnectionView mSpheroConnectionView; private Sphero mRobot = null; private void updateSpheroPosition(double x, double y) { } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_activity_simon); mSpheroConnectionView = (SpheroConnectionView) findViewById(R.id.sphero_connection_view); mSpheroConnectionView.addConnectionListener(new ConnectionListener() { @Override public void onConnected(Robot robot) { //SpheroConnectionView is made invisible on connect by default mRobot = (Sphero) robot; } @Override public void onConnectionFailed(Robot sphero) { // let the SpheroConnectionView handle or hide it and do something here } @Override public void onDisconnected(Robot sphero) { mSpheroConnectionView.startDiscovery(); } }); } @Override protected void onResume() { super.onResume(); mSpheroConnectionView.startDiscovery(); } @Override protected void onPause() { super.onPause(); RobotProvider.getDefaultProvider().disconnectControlledRobots(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main_activity_simon, menu); return true; } } &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/R" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#262625" android:paddingBottom="5dp" tools:context=".MainActivitySimon" &gt; &lt;Button android:id="@+id/Green" android:layout_width="140.0dip" android:layout_height="160.0dip" android:layout_alignRight="@+id/Red" android:layout_alignTop="@+id/Yellow" android:background="@drawable/customgree…
tagged with: android
tagged with: sphero-api
has answer: http://stackoverflow.com/a/28206688

http://stackoverflow.com/q/24863185
accepted answer: http://stackoverflow.com/a/24863225
possible better answer: http://stackoverflow.com/a/24863229
downvote count: 0
has answer: http://stackoverflow.com/a/56262724
has answer: http://stackoverflow.com/a/24863375
favorite count: 0
has body: In Item 2 of the "Effective Java, 2nd edition" book, there is this snippet of code, in which the author wants to forbid the empty initialization of an object. class Example { private Example() { throw new AssertionError(); } } The type of exception thrown, is what confuses me here. I don't understand if the AssertionError is thrown just because of an absence of more suited errors or because it should be this way. As I understand, this error is thrown by the framework when an assert statement fails. Also, in the javadoc it's just written [An AssertionError is] Thrown to indicate that an assertion has failed. But I don't see any assertion (true-false statement) being violated here. Of course the "You shall not instantiate an item of this class" statement has been violated, but if this is the logic behind that, then we should all throw AssertionErrors everywhere, and that is obviously not what happens. FWIW, I'd have just thrown a new IllegalStateException("Must not instantiate an element of this class") Is there something wrong with that? In which case should I throw an AssertionError in my own code? Sorry if it's just a subtle doubt but I use this pattern a lot in my code and I want to make sure I'm doing the right thing.
has comment: http://stackoverflow.com/comment/38612087
tagged with: exception
has answer: http://stackoverflow.com/a/79297751
has comment: http://stackoverflow.com/comment/69853656
upvote count: 98
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24863229
tagged with: java
linked to: http://stackoverflow.com/q/22053306
score: 98
has title: What is an AssertionError? In which case should I throw it from my own code?
tagged with: effective-java
type: Question
has answer: http://stackoverflow.com/a/46523551
answer count: 6
has answer: http://stackoverflow.com/a/24863225

redis
tags question: http://stackoverflow.com/q/24803224
type: Tag
tags question: http://stackoverflow.com/q/24850675
tag name: redis

http://stackoverflow.com/comment/38686069
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24902031
score: 1
has text: I did the same file as yours no such error

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/24800402
type: Tag

http://stackoverflow.com/a/44291257
type: Answer
has body: In my case, I was getting value of &lt;input type="text"&gt; with JQuery and I did it like this: var newUserInfo = { "lastName": inputLastName[0].value, "userName": inputUsername[0].value, "firstName": inputFirstName[0] , "email": inputEmail[0].value} And I was constantly getting this exception com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: java.io.PushbackInputStream@39cb6c98; line: 1, column: 54] (through reference chain: com.springboot.domain.User["firstName"]). And I banged my head for like an hour until I realised that I forgot to write .value after this"firstName": inputFirstName[0]. So, the correct solution was: var newUserInfo = { "lastName": inputLastName[0].value, "userName": inputUsername[0].value, "firstName": inputFirstName[0].value , "email": inputEmail[0].value} I came here because I had this problem and I hope I save someone else hours of misery. Cheers :)
answers question: http://stackoverflow.com/q/24864489
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/q/24882250
has answer: http://stackoverflow.com/a/24883601
has comment: http://stackoverflow.com/comment/38649422
score: 0
has comment: http://stackoverflow.com/comment/38649667
has body: This is my below code , where my list looks like position 1 | image1 image2 image3 ---------------------------------------- position 2 | image1 image2 image3 I mean dynamically adding my images according to number of items in list for eg if my list has 21 items , then mylist populate 3 images in each position and totally 7 position gets created. My code is working fine public class ListViewAdapter extends BaseAdapter { private static final String TAG = "Book-shelf"; private Activity activity; private int totalBooks = 0; private int bookItem = 0; private int numberOfBookRows = 0; private int extraBooks = 0; int layoutId; private int bookImage; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; dataList; private static LayoutInflater inflater = null; public ListViewAdapter(Activity a, int listRow, ArrayList&lt;HashMap&lt;String, String&gt;&gt; fileList) { super(); activity = a; dataList = fileList; layoutId = listRow; inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { // TODO Auto-generated method stub return dataList.size(); } The modified one is for the above getCountmethod @Override public Object getCount() { // TODO Auto-generated method stub return numberOfBookRows; } @Override public Object getItem(int position) { // TODO Auto-generated method stub return dataList.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } public void calculateRowsAndColms() { totalBooks = 0; bookItem = 0; numberOfBookRows = 0; extraBooks = 0; totalBooks = dataList.size(); bookItem = 3;// TODO: make it dynamic if (totalBooks &lt; bookItem &amp;&amp; totalBooks &gt; 0) { numberOfBookRows = 1; } else { numberOfBookRows = (totalBooks / bookItem); extraBooks = (totalBooks % bookItem); if (extraBooks != 0) numberOfBookRows++; } Log.d(TAG, " Total books:" + totalBooks); Log.d(TAG, " Number of books to be displayed:" + bookItem); Log.d(TAG, " Number o…
answer count: 1
has title: ArrayList Index Out Of Bound exception in android custom list view adapter
accepted answer: http://stackoverflow.com/a/24883601
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38649828
tagged with: java
has comment: http://stackoverflow.com/comment/38648623
type: Question
has comment: http://stackoverflow.com/comment/38648651

http://stackoverflow.com/comment/38505001
comment on: http://stackoverflow.com/a/24800084
type: AnswerComment
score: 0
has text: this is not a function it's a class and you can send data like this `new GetData().execute(URLTOGETDATA);`
type: Comment

akka
type: Tag
tags question: http://stackoverflow.com/q/24799507
tags question: http://stackoverflow.com/q/24886529
tags question: http://stackoverflow.com/q/24772999
tag name: akka
tags question: http://stackoverflow.com/q/24885380
tags question: http://stackoverflow.com/q/24892962
tags question: http://stackoverflow.com/q/24794785

http://stackoverflow.com/a/24878824
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Instead of creating a JOptionPane inside of each if statement, you only need a single one at the end. Your if statements are really only determining what string to display, so that's the only info you need to create inside them. You can do this by creating a string variable and determining what it contains in the if statements. Then, once your statements have executed, you create a single JOptionPane with your string included. For example: String temp; if (fnum &gt; part) { temp = fname + " krijgt €" + (fnum - part) + " terug."; } else if (fnum &lt; part) { temp = fname + " moet nog €" + (part - fnum) + " betalen."; } else { temp = fname + " heeft alles betaald."; } JOptionPane.showMessageDialog(null, temp); As per your comments - If you want strings to be placed on multiple lines you can add a "\n" character to your string anywhere you want it to move to a new line.
accepted answer of: http://stackoverflow.com/q/24878528
answers question: http://stackoverflow.com/q/24878528
type: Answer
score: 2

http://stackoverflow.com/comment/38628264
has text: Dave, I made a little "Hello World" this is the [link](https://github.com/purrox/Spring-example) and I have the same result 10.4.4 403 Forbidden in WebLogic and works fine in Tomcat. I hope you can help with that.
score: 0
comment on: http://stackoverflow.com/q/24835051
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24753992
upvote count: 2
has answer: http://stackoverflow.com/a/24754162
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24754162
score: 1
has title: How to host a java webapplication using Amazon Cloud engine?
tagged with: java
tagged with: host
type: Question
has body: We have a java web application to be hosted in internet. We heard that amazon cloud engine is good for that. Is there any idea to host that?
answer count: 1
tagged with: web
favorite count: 0

http://stackoverflow.com/q/24852247
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24852248
has body: I am a novice Java student and am trying to complete a program that uses the scanner to input students' names,marks and then to calculate grade for each student. I am stuck as I keep getting below error while printing. Any help would be greatly appreciated! Syntax error, insert "SimpleName" to complete QualifiedName - Syntax error on token ".", @ expected after this token - Syntax error, insert "Identifier (" to complete MethodHeaderName - Syntax error, insert ")" to complete MethodDeclaration The error comes in the print statment package day2.examples; import java.util.Scanner; public class inputData { /*String stdName; int mathMarks; int engMark;`enter code here` int sciMark;*/ Scanner input = new Scanner(System.in); String stdName = input.nextLine(); int mathMark = input.nextInt(); int engMark = input.nextInt(); System.out.println("Insert Name Value"); int grade () { if ((mathMark + engMark ) &lt;50) { return(1); } else return(2); } }
favorite count: 0
has answer: http://stackoverflow.com/a/24852362
type: Question
has comment: http://stackoverflow.com/comment/38591215
has comment: http://stackoverflow.com/comment/38591161
has comment: http://stackoverflow.com/comment/38591319
has answer: http://stackoverflow.com/a/24852257
tagged with: java
accepted answer: http://stackoverflow.com/a/24852248
upvote count: 1
has title: Beginner in Java..Error while using system.out
possible better answer: http://stackoverflow.com/a/24852255
has comment: http://stackoverflow.com/comment/38591134
has comment: http://stackoverflow.com/comment/38591268
has answer: http://stackoverflow.com/a/24852255
answer count: 4

mouse
tags question: http://stackoverflow.com/q/24793544
type: Tag
tags question: http://stackoverflow.com/q/24761726
tag name: mouse

http://stackoverflow.com/q/24891698
favorite count: 0
tagged with: android-studio
type: UnansweredQuestion
has body: I have a project on Android Studio with this structure: Project |-> App |-> Core Core it's a project created like a library to reuse on the other applications and have this gradle configuration. apply plugin: 'com.android.library' android { compileSdkVersion 20 buildToolsVersion "19.1.0" defaultConfig { applicationId "com.porject.core" minSdkVersion 14 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions{ exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/notice.txt' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v4:20.0.0' compile 'net.hockeyapp.android:HockeySDK:3.0.+' compile 'com.octo.android.robospice:robospice:1.4.6' compile 'org.droidparts:droidparts:2.0.5' compile 'com.octo.android.robospice:robospice-spring-android:1.4.12' compile 'com.google.code.gson:gson:1.7.2' compile 'net.sourceforge.htmlcleaner:htmlcleaner:2.2' compile 'io.segment.android:analytics:1.2.0@aar' compile "com.mixpanel.android:mixpanel-android:4.2.1@aar" } the app gradle has this configuration: apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion '19.1.0' defaultConfig { applicationId "com.project.app" minSdkVersion 14 targetSdkVersion 18 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions{ exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/notice.txt' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project (':core') } This compiles and brings all the dependencies, but when I run the app it throws this error java.lang.NoClassDefFoundError: com.project.R$string at com.project.utils.Pre…
score: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/53896510
downvote count: 0
has answer: http://stackoverflow.com/a/26933504
upvote count: 2
has title: NoClassDefFoundError R$string on Android Studio
tagged with: android
answer count: 1

http://stackoverflow.com/comment/38513738
comment on: http://stackoverflow.com/q/24792659
type: Comment
has text: @developerwjk Ok, are you able to recommend a good not to expensive host? Also would you put an answer on here for this which would include a "do this first then do that then that etc etc" I'm not asking for code but rather directions... Thanks for your help
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38689170
type: Comment
has text: Hi, and welcome. You forgot to explain what the problem is.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24903726

http://stackoverflow.com/comment/38653483
score: 0
comment on: http://stackoverflow.com/q/24884923
type: Comment
type: QuestionComment
has text: Hey I was creating baseline and saw this behaviour, it's not that I'm spending my time to measure just this example. it's simplified version for this thread.

http://stackoverflow.com/comment/38526489
type: Comment
type: QuestionComment
has text: put this two lines of code editPreference.setSummary(); & editPreference.setText(); inside if block like if (editPreference!=null){editPreference.setSummary(); editPreference.setText();}. Issue is with editPreference is not getting initialized.
comment on: http://stackoverflow.com/q/24817721
score: 0

http://stackoverflow.com/q/24830996
has answer: http://stackoverflow.com/a/24831096
has answer: http://stackoverflow.com/a/24831135
has comment: http://stackoverflow.com/comment/38551451
has answer: http://stackoverflow.com/a/24831249
tagged with: concatenation
has answer: http://stackoverflow.com/a/24831040
downvote count: 0
answer count: 7
tagged with: string
has answer: http://stackoverflow.com/a/24831049
favorite count: 0
possible better answer: http://stackoverflow.com/a/24831069
has answer: http://stackoverflow.com/a/24831069
accepted answer: http://stackoverflow.com/a/24831040
has comment: http://stackoverflow.com/comment/38551317
has comment: http://stackoverflow.com/comment/38551357
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38551257
has title: Why am I getting different outputs with .concat() and += with Java Strings?
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24831083
has body: Studying for OCAJ7 I know String objects are immutable. I know using methods like .concat() on a String object will just create a new String object with the same reference name. I'm having a hard time, however, with wrapping my head around the following: String str1 = "str1"; String str2 = "str2"; System.out.println( str1.concat(str2) ); System.out.println(str1); // ouputs // str1str2 // str1 String str3 = "fish"; str3 += "toad"; System.out.println(str3); // outputs // fishtoad If strings are immutable, why does using += to concatenate affect the original String object, but .concat() does not? If I only want a String to concatenate with using +=, is using String better than using StringBuilder, or vice versa?
type: Question

http://stackoverflow.com/a/24866362
accepted answer of: http://stackoverflow.com/q/24866057
score: 2
answers question: http://stackoverflow.com/q/24866057
has comment: http://stackoverflow.com/comment/38619640
has body: You are using runlist instead of runList
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/38511046
score: 0
type: Comment
type: QuestionComment
has text: This question appears to be off-topic because it is a profiling question not useful to anyone else.
comment on: http://stackoverflow.com/q/24809711

http://stackoverflow.com/comment/38567888
type: Comment
type: QuestionComment
has text: If you are using an IDE then launch the IDE as administrator and then test your program.
score: 0
comment on: http://stackoverflow.com/q/24840034

http://stackoverflow.com/q/24853178
answer count: 1
has comment: http://stackoverflow.com/comment/38593039
has answer: http://stackoverflow.com/a/24853203
favorite count: 0
has body: In my main class I want to check if there was a change by using a boolean variable: public class Main { private boolean change = false; public boolean getChange() { return change; } public void setChange(boolean change) { this.change = change; } private void method1() { // some command setChange(true); method1(); } If I want to get this boolean value in my second class, I always get returned "false", no matter if my method1 ran or not. public class BoolTest { Main m = new Main(); System.out.println(m.getChange()); // returns "false" }
type: UnansweredQuestion
tagged with: java
downvote count: 5
has title: Pass boolean value to another class
type: Question
tagged with: boolean
upvote count: 0
score: -5

http://stackoverflow.com/comment/38593366
comment on: http://stackoverflow.com/a/24853203
type: AnswerComment
score: 0
has text: Thanks. How do you mean I need to have two instances of Main? If I run `method1();` in my Main class, I should get returned "true" in my BoolTest class, no?
type: Comment

http://stackoverflow.com/a/24831283
type: Answer
answers question: http://stackoverflow.com/q/24828722
score: 2
has body: You are using an old version of Robotium. Please update to 5.2.1 and you will not have this problem. https://code.google.com/p/robotium/wiki/Downloads?tm=2
accepted answer of: http://stackoverflow.com/q/24828722
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38561653
upvote count: 2

http://stackoverflow.com/comment/38666072
type: QuestionComment
score: 2
has text: Remove the mouse listener in the mousePressed event handler (http://stackoverflow.com/questions/2627946/how-to-remove-mouselistener-actionlistener-on-a-jtextfield)
comment on: http://stackoverflow.com/q/24891489
type: Comment

http://stackoverflow.com/q/24751472
tagged with: java
upvote count: 1
tagged with: jboss
answer count: 1
accepted answer: http://stackoverflow.com/a/24771492
has body: I'm trying to deploy CXF JCA resource adapter on JBoss using IRONJACAMAR with following ironjacamar.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;p:ironjacamar xmlns:p="http://www.jboss.org/ironjacamar/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://www.jboss.org/ironjacamar/schema "&gt; &lt;p:connection-definitions&gt; &lt;p:connection-definition jndi-name="java:/CXFConnector" class-name="org.apache.cxf.jca.outbound.CXFConnectionFactory"&gt; &lt;p:pool&gt; &lt;p:min-pool-size&gt;10&lt;/p:min-pool-size&gt; &lt;p:max-pool-size&gt;100&lt;/p:max-pool-size&gt; &lt;/p:pool&gt; &lt;p:security&gt; &lt;p:application/&gt; &lt;/p:security&gt; &lt;/p:connection-definition&gt; &lt;/p:connection-definitions&gt; &lt;/p:ironjacamar&gt; This XML file is located inside CXFResourceAdapter.rar/META-INF, which is inside our ear. what I get is: 16:27:25,468 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.ra.deployer."OURServer.ear#CXFResourceAdapter": org.jboss.msc.service.StartException in service jboss.ra.deployer."OURServer.ear#CXFResourceAdapter": JBAS010446: Failed to start RA deployment [OURServer.ear#CXFResourceAdapter] at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService.start(ResourceAdapterDeploymentService.java:116) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55] Caused by: org.jboss.jca.de…
type: AnsweredQuestion
downvote count: 0
has title: Deploying CXF resource adaptor on JBoss 6.1
score: 1
tagged with: deployment
favorite count: 0
type: Question
tagged with: exception
tagged with: cxf
has answer: http://stackoverflow.com/a/24771492

http://stackoverflow.com/comment/38453555
comment on: http://stackoverflow.com/q/24779401
type: Comment
type: QuestionComment
has text: What is an invalid expression?
score: 0

http://stackoverflow.com/comment/38409318
has text: So you can only access already created procedure from MyBatis?
comment on: http://stackoverflow.com/q/24755724
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38570676
type: Comment
comment on: http://stackoverflow.com/q/24838198
has text: Why don't you just fork a thread for each iteration of i? You'll have accumulate separate "sums" for the inner loops.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/38611800
type: AnswerComment
score: 0
type: Comment
has text: this actually makes a great deal of sense when you really think about how the SQL tables should look like. the table of page then would include the foreign key of a person in the column of creator and owner, and a connection to a joining table for modifiers. Awesome. Thanks a lot!
comment on: http://stackoverflow.com/a/24862228

http://stackoverflow.com/q/24867666
has comment: http://stackoverflow.com/comment/38632255
has comment: http://stackoverflow.com/comment/38621546
has body: i want to test if my app can load an image using webdriver. so when i test it, it does not load the image. Here is my code: try { driver.findElement(By.cssSelector(Component._Image)).isDisplayed(); System.out.println("Choose File Button is displayed"); driver.findElement(By.cssSelector(Component._Image)).click(); driver.findElement(By.xpath("(//input[@type='text'])[5]")).clear(); driver.findElement(By.xpath("(//input[@type='text'])[5]")).sendKeys("http://website.com/images/image.png"); } catch (NoSuchElementException e) At the end of the test, the image is not loaded. EDIT: Added html snippet Choose file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38704316
has title: How to load image using webdriver?
answer count: 0
tagged with: java
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/38621972
score: 0
has comment: http://stackoverflow.com/comment/38620965

http://stackoverflow.com/a/24756393
has body: you have added the id as <generator class="increment"/> then it must be integer use integer instead of string at ,change the hibernate mapping file as shown below <?xml version="1.0" encoding="UTF-8"?> <generator class="increment"/> <property column="cost" name="cost" type="java.lang.Integer"/>
upvote count: 12
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/125095046
answers question: http://stackoverflow.com/q/24755500
accepted answer of: http://stackoverflow.com/q/24755500
score: 12
type: AcceptedAnswer

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/24898929
tags question: http://stackoverflow.com/q/24794697

http://stackoverflow.com/q/24895480
type: UnansweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24906843
downvote count: 0
linked to: http://stackoverflow.com/q/18072456
favorite count: 0
has answer: http://stackoverflow.com/a/29630411
linked to: http://stackoverflow.com/q/41034116
type: Question
answer count: 2
has body: I write some automation using selenium and java. I use build.gradle to run cucumber features. Each feature has some tests. Is there a ready made way to make the independent scripts run in parallel? They all use selenuim ChromeWebDriver. If there is none, how would you advise me to write such?
tagged with: parallel-processing
has title: Is there a ready made infra for running cucumber tests parallelly?
has comment: http://stackoverflow.com/comment/115938782
upvote count: 3
tagged with: java
tagged with: selenium
tagged with: gradle
tagged with: cucumber

http://stackoverflow.com/comment/38502769
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24805351
type: Comment
has text: `String str= strpath.replaceAll("\","\\")` won't work since you have to be able to create the `String` with backslash (you are not) at first place and then replace them. And a silly question but does the file actually exists?

http://stackoverflow.com/a/24908331
upvote count: 3
has body: Since your question is tagged Log4j2, here is how to get the root logger in Log4j2: org.apache.logging.log4j.LogManager.getRootLogger().
has comment: http://stackoverflow.com/comment/38697475
has comment: http://stackoverflow.com/comment/38726269
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24907705
has comment: http://stackoverflow.com/comment/38738143
accepted answer of: http://stackoverflow.com/q/24907705
score: 3
type: Answer

http://stackoverflow.com/comment/38564790
score: 0
type: Comment
type: QuestionComment
has text: Check `logcat` output when you run your application and when it does copy database into memory!
comment on: http://stackoverflow.com/q/24838329

http://stackoverflow.com/a/24786929
answers question: http://stackoverflow.com/q/24786867
score: 0
type: Answer
has body: You can Swipe through simple views by using a library like : https://github.com/pakerfeldt/android-viewflow You'll have to provide it an adapter that will generate Views for given list of data.

http://stackoverflow.com/q/24808075
has comment: http://stackoverflow.com/comment/38508909
tagged with: adt
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38509039
score: 0
has comment: http://stackoverflow.com/comment/38508305
has answer: http://stackoverflow.com/a/24997775
accepted answer: http://stackoverflow.com/a/24997775
answer count: 1
has comment: http://stackoverflow.com/comment/38508077
has comment: http://stackoverflow.com/comment/38509301
has comment: http://stackoverflow.com/comment/38508590
linked to: http://stackoverflow.com/q/4649562
tagged with: android
tagged with: eclipse-adt
has comment: http://stackoverflow.com/comment/38509893
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38508427
has body: I have installed latest JDK and ADT bundle package (I'm working under Windows 7, 32 bits OS) I installed all the possibly needed packages in ADT Manager. I defined ADT location in Eclipse->Window->Preferences->Android But I still have no option to start File->New->Project->Android->Android Project or File->New->Other->Android Project I have many other options like: Android Activity Android Application Project Android Icon Set Android Object Android Project from Existing Code Android Sample Project Android test Project etc.. But all these are not what I need. I already looked on existing questions here like No Android project type in Eclipse-&gt;File-&gt;New-Project and others and also on several similar questions on other forums but still did not found an answer for my problem.
tagged with: java
has comment: http://stackoverflow.com/comment/38508538
has title: No Android project type available in Eclipse->File->New-Project
has comment: http://stackoverflow.com/comment/38509150
type: Question
linked to: http://stackoverflow.com/q/2999285
has comment: http://stackoverflow.com/comment/38508807

http://stackoverflow.com/comment/38652131
comment on: http://stackoverflow.com/q/24884366
score: 3
has text: Have you tried using `HelloFreemarker.class.getResource("hello.ftl");` or `HelloFreemarker.class.getResource("/hello.ftl");`? This assumes that the `Configuration#getTemplate` accepts a `URL`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24866668
tagged with: 32bit-64bit
has comment: http://stackoverflow.com/comment/38673556
has comment: http://stackoverflow.com/comment/38619260
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38621367
score: 0
tagged with: jdbc
has title: java.sql.Exception:[Microsoft][ODBC Driver Manager] Invalid string or buffer length exception
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38621019
has comment: http://stackoverflow.com/comment/38619116
has body: I did a project in java with Database as MS-Access. While running the Application I got the following Exception in 64 bit System but it is working fine in 32 bit System. java.sql.Exception:[Microsoft][ODBC Driver Manager] Invalid string or buffer length exception. I searched for root cause of Exception but I did not get clear clarification. I tried some other scenario's but I got the same Exception. When I try to insert the data more than 100 rows. When I fetch the data even for two columns also the Exceptions is throwing When I fetch the data including String and integer the Exception is throwing but if I applied getString() for all datatypes it is working.. When I call jasper reports (I am passing the connection variable to jasper) at that time also the same Exception is throwing. Can any one help me how to solve this Exception?

http://stackoverflow.com/comment/38525529
has text: can you show us your deployment structure? (where the file you are calling from is and where the file you want is?)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24817021

http://stackoverflow.com/comment/38567362
type: AnswerComment
comment on: http://stackoverflow.com/a/24839776
type: Comment
has text: @Helena: if you divide a whole number (aka "integer") like `17` by `5`, the result is `3`, but there is a rest of `2`, because `17 = 5*3 + 2`. That "rest" is the remainder, and that is what `%` returns. In other words: `17 / 5 --> 3`, `17 % 5 --> 2`.
score: 1

http://stackoverflow.com/q/24889237
type: Question
score: 15
tagged with: spring-el
answer count: 1
has title: How to reference a constant in Spring Expression Language
favorite count: 0
has body: i am quite new to Spring and i have a bean declaration as follows. &lt;bean id="mybean" class="" scope="prototype"&gt; &lt;property name='typeOf' value='#{typeOfBuilder.getKeyFor("OPEN_DATE").getId()}'/&gt; &lt;/bean&gt; typeOf is a type of Integer which is the key of another table which typeOfBuilder builds by Key which is OPEN_DATE in this case. this code works OK but have a limitation. OPEN_DATE is a constant in a NON-MANAGE Spring Bean something like follows. public final class Constants { public final static String KEY_FOR_OPEN_DATE = "OPEN_DATE"; } and is strongly recommend to be able to reference to it!!. something like this. &lt;util:constant id="PATH_TO_CONSTANT" static-field="myPath"/&gt; &lt;property name='typeOf' value='#{typeOfBuilder.getKeyFor(PATH_TO_CONSTANT).getId()}'/&gt; any help is hugely appreciate.
tagged with: spring
upvote count: 15
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24889537
accepted answer: http://stackoverflow.com/a/24889537

http://stackoverflow.com/a/24977183
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24759446
downvote count: 0
has body: I've had the opportunity to use websockets with the Spring framework, and the best answer to your question is: it really depends what's you're trying to build. GoPivotal's done a solid job of implementing the RFC 6455 with Spring framework's Websocket API. With minimal effort you can take advantage of the STOMP and MQTT (via Eclipse Paho) messaging protocols, making tasks such as updating a browser, mobile app, or machine in real-time relatively straight forward. Standard functionality (Suspend, Resume, Broadcast, Long Polling, Http Streaming, Native Asynchronous API) was well documented on their WebsocketAPI support page and straight forward to execute. Libraries such as Atmosphere and JWebsocket are available to plug-into Spring's framework which make various features easier to implement.

http://stackoverflow.com/q/24772520
has body: I have a simple get-set interface: public interface Foo { void setBaz(String baz); String getProcessedBaz(); } This interface is a dependency of my actual class under test. I'm trying to mock out Foo to have this effective behavior: public class MockedFoo implements Foo { private String bazField; @Override public void setBaz(String baz) { bazField = baz; } @Override public String getProcessedBaz() { return "PROCESSED_" + bazField; } } So my expected result is: mockedFoo.setBaz("ABC"); assertEquals("PROCESSED_ABC", mockedFoo.getProcessedBaz()); I was able to capture the method argument using withCapture in a Verification, but how do I set up an Expectation with that same input value? It seems you can do either one or the other. Is there a way to express this in JMockIt? I'm using the latest version (1.9). NOTE: I'm aware that I can simply set up a Mockup&lt;Foo&gt; instance and put in all the code above. However, my real code is much more complex and I would prefer not to hand-craft the entire mock class.
has answer: http://stackoverflow.com/a/24785677
tagged with: jmockit
favorite count: 0
has answer: http://stackoverflow.com/a/25151791
answer count: 3
has title: Mocking simple property access with JMockIt
accepted answer: http://stackoverflow.com/a/25151791
upvote count: 2
tagged with: properties
tagged with: unit-testing
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25141474
tagged with: mocking
has answer: http://stackoverflow.com/a/25141474
downvote count: 0

http://stackoverflow.com/q/24825530
answer count: 2
has answer: http://stackoverflow.com/a/24825983
tagged with: tomcat
has body: I am trying to point a -Djava.library.path in setenv.sh file. My library is in usr/lib64 folder but when I am trying to do something like : EXPORTS JAVA_OPTS="-Dcom.site.host=site.com -Dcom.site.storage.path=/usr/hosting/site.com/db -Dcom.site.lib=/usr/lib64/mylib.so" I am getting : error : Directory separator should not appear in library name : /usr/lib64/mylib.so How to set it correctly? mylib.so is already present in usr/lib64
possible better answer: http://stackoverflow.com/a/24825983
score: 0
has answer: http://stackoverflow.com/a/24825848
type: AnsweredQuestion
tagged with: java
has title: Tomcat -Djava.library.path set
accepted answer: http://stackoverflow.com/a/24825848
type: Question

http://stackoverflow.com/q/24890116
answer count: 1
favorite count: 0
tagged with: regex
has title: Mongo find() with regex in java only return one entry
has body: I stored several articles in my mongo db and I'd like to get all of the article that contains particular words, however this code can only return one article. What should I do? this is my code: public String selectMongo(String term){ query = new BasicDBObject("content", java.util.regex.Pattern.compile(term)); cursor = coll.find(query); try{ while(cursor.hasNext()) { BasicDBObject dbObject = (BasicDBObject)cursor.next(); resultSet = dbObject.getString("content"); //System.out.println(resultSet); } }finally{ cursor.close(); } return resultSet; } Thanks in advance
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24890987
downvote count: 1
type: Question
tagged with: java
score: -1
tagged with: mongodb
upvote count: 0

authorization
tags question: http://stackoverflow.com/q/24860038
tags question: http://stackoverflow.com/q/24849116
tag name: authorization
type: Tag
tags question: http://stackoverflow.com/q/24811588

http://stackoverflow.com/q/24816076
has answer: http://stackoverflow.com/a/24816152
tagged with: java
has title: Best practice for creating a composite image output for Java Swing
upvote count: 1
tagged with: swing
type: Question
tagged with: image
accepted answer: http://stackoverflow.com/a/24816152
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: Im working on a 2d game in java swing, where a procedurally generated environment is represented by a tiled array of low-res images. Currently this is all within html tags (for line breaks) in a JLabel. On top of this, I would like to display character sprites, which will not take up an entire tile, but will have some alpha components. In the past, in JS/html and JS/canvas, I have simply made sprite tiles with alpha channels and positioned them directly above a floor tiles, using tables and/or absolute positioning. In java swing, however, absolute positioning (and most of html for that matter) doesn't seem to work so well. Since a sprite will never be between/overlapping two floor tiles, the obvious solution is to make a bunch of pre-computed image files outside the game -- one for each character over each type of floor tile, however, this would scale disk space (and work) exponentially with the number of images used, and seems like it shouldn't be necessary. From what I've seen, it looks like it should be possible to create all these images in runtime as Bufferedimages, either by pre-computing them all at startup, or making some each frame as needed. If I can do the above, I might also be able to put all the images I need into one big bitmap each frame, and display that. This could also reduce non-synchronized loading of frames if I overload the system. Of the above options, what seems like the best? or is there another obvious solution that I am completely missing? If the solution is to make composite images, could someone point me in the right direction as far as how to do that? Thanks a lot.
tagged with: http://stackoverflow.com/tag/html
tagged with: 2d-games
type: AnsweredQuestion

http://stackoverflow.com/q/24874421
has title: Nothing being sent to server via URLConnection
favorite count: 0
has answer: http://stackoverflow.com/a/24874775
answer count: 3
tagged with: ftp
has answer: http://stackoverflow.com/a/24875950
type: UnansweredQuestion
has body: So I've created a program that communicates with both a FTP and SQL server. I run my program on my Windows machine and everything is working fine. But when I run the program on my Ubuntu VM it is not working. My code is as follows: try { URL url = new URL(location); System.out.println("Created url"); URLConnection urlc = url.openConnection(); System.out.println("Created URLConnection"); urlc.setDoOutput(true); System.out.println("Set Output"); OutputStreamWriter out = new OutputStreamWriter(urlc.getOutputStream()); System.out.println("Created OutputStreamWriter"); System.out.println("Hello World."); out.write(Var.pressed); System.out.println("Wrote String"); out.close(); System.out.println("Closed OutputStreamWriter"); } catch (Exception ex) { ex.printStackTrace(); } The program creates a file on my FTP and then writes to it. The file is being created but it is empty. No errors are ever thrown my program prints the following Created url Created URLConnection Set Output And then does nothing. It doesn't throw an error, it doesn't crash, it doesn't stop. The terminal is just left open. I also tried just running the .jar but nothing happens. It seems as though the problem is created here: OutputStreamWriter out = new OutputStreamWriter(urlc.getOutputStream()); Why is nothing being written to the file? And what is wrong with my program if no errors are ever thrown?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24876650
type: Question
upvote count: 1
downvote count: 0
tagged with: urlconnection

http://stackoverflow.com/comment/85523107
type: Comment
has text: If you are asked this in an interview, don't say "it's undefined". Anyone can say that - it says nothing positive about you. Attempt to answer and explain what you know about headers, word-sizes, architectures, memory alignment, etc. Qualify the answer if you must at the end.
type: QuestionComment
comment on: http://stackoverflow.com/q/24836854
score: 0

http://stackoverflow.com/comment/125597156
has text: Works flawlessly! e.g. LocalDateTime.parse("2022-02-10T07:00:00").atZone(ZoneId.systemDefault()).toInstant();
comment on: http://stackoverflow.com/a/24808474
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24783072
has title: is there a way to store user input in an array and get reverse of it?
favorite count: 0
has comment: http://stackoverflow.com/comment/38460917
has comment: http://stackoverflow.com/comment/38461371
has body: i have wrote java function reversing user input but it nor working and i don't have any idea where is the problem and how to solve it. import java.util.Scanner; class Reverse{ public static void main(String args[]){ Scanner word = new Scanner(System.in); System.out.print("type the word here to check if it is palindrome: "); String n = word.nextLine(); char[] let = n.toCharArray(); System.out.print(revrse(i, let)); // for (int i=let.length-1; i&gt;=0; --i){ // System.out.print(let[i]); // } } public static int reverse(char[] let){ for (int i=let.length-1; i&gt;=0; --i){ return let[i]; } } } how to make this code to work.
linked to: http://stackoverflow.com/q/2137755
has answer: http://stackoverflow.com/a/24783407
score: -3
downvote count: 3
possible better answer: http://stackoverflow.com/a/24783467
has answer: http://stackoverflow.com/a/24783467
duplicate of: http://stackoverflow.com/q/2137755
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38462060
type: Question
accepted answer: http://stackoverflow.com/a/24783407
answer count: 2
has comment: http://stackoverflow.com/comment/38461160
has comment: http://stackoverflow.com/comment/38461030
upvote count: 0
tagged with: arrays

http://stackoverflow.com/q/24777867
has comment: http://stackoverflow.com/comment/38451169
has comment: http://stackoverflow.com/comment/38450839
downvote count: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/24778361
has comment: http://stackoverflow.com/comment/38450846
score: -3
has comment: http://stackoverflow.com/comment/38451112
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24778361
linked to: http://stackoverflow.com/q/3644726
tagged with: java
has comment: http://stackoverflow.com/comment/38454880
type: Question
has body: I have a file which has only two statements in it @javax.xml.bind.annotation.XmlSchema(namespace = "XXXXX", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package sample; want to create class file which has same name as filename is Package-info.java
tagged with: jakarta-ee
has title: how to create class file for a java file which has only package statement and annotations?
answer count: 1

http://stackoverflow.com/q/24885870
score: 4
has answer: http://stackoverflow.com/a/24888714
tagged with: rest
has comment: http://stackoverflow.com/comment/38655050
has comment: http://stackoverflow.com/comment/38656631
has comment: http://stackoverflow.com/comment/38658529
favorite count: 0
has comment: http://stackoverflow.com/comment/38655685
has body: I am trying to send a JSON array to my server. My JSON array looks like this ["{"sourceAccountNo":"555555555555555","sourceBankCode":"GLBBNPKA","destinationBankCode":"GLBBNPKA","destinationBankAccountNo":"123456789111111","amount":5000,"narrationOne":"txn4 by maker 1","uniqueId":"ESW-COR:1405507591784"}"] And the corresponding server side method is : @ResponseBody @ResponseStatus(value = HttpStatus.OK) @RequestMapping(value = "/xxx", method = RequestMethod.POST) public ResponseEntity&lt;BulkCorporatePaymentResponse&gt; xxx(@RequestBody BulkCorporatePaymentRequest corporatePaymentRequestList) { BulkCorporatePaymentResponse response = null; try { response = corporateApi.processBulkFundTransfer(corporatePaymentRequestList); } catch (Exception e) { } return new ResponseEntity&lt;BulkCorporatePaymentResponse&gt;(response, HttpStatus.OK); } Now my BulkCorporatePaymentResponse and BulkCorporatePaymentRequest look like this public class BulkCorporatePaymentResponse implements Serializable { private static final long serialVersionUID = -2026566288888889L; List&lt;CorporatePaymentResponse&gt; paymentResponseList; public List&lt;CorporatePaymentResponse&gt; getPaymentResponseList() { return paymentResponseList; } public void setPaymentResponseList(List&lt;CorporatePaymentResponse&gt; paymentResponseList) { this.paymentResponseList = paymentResponseList; } } public class BulkCorporatePaymentRequest implements Serializable { private static final long serialVersionUID = -202656628880099889L; private List&lt;CorporatePaymentRequest&gt; paymentRequestlist; public List&lt;CorporatePaymentRequest&gt; getPaymentRequestlist() { return paymentRequestlist; } public void setPaymentRequestlist(List&lt;CorporatePaymentRequest&gt; paymentRequestlist) { this.paymentRequestlist = paymentRequestlist; } } And my CorporatePaymentRequest looks liks this public class CorporatePaymentRequest implements Serializable { private static final long serialVersionUID = 1346864799470440670L; private String s…
has comment: http://stackoverflow.com/comment/38655780
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38656228
tagged with: spring
has comment: http://stackoverflow.com/comment/38656007
has title: What does this error 'org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance' mean?
tagged with: java
linked to: http://stackoverflow.com/q/19333106
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38655822
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24781516
score: 3
has comment: http://stackoverflow.com/comment/38486886
has title: Spring Data Rest Field converter
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38489404
has comment: http://stackoverflow.com/comment/38461495
type: Question
has comment: http://stackoverflow.com/comment/38484471
answer count: 1
downvote count: 0
has body: I am having a hard time using my custom converters on spring data REST project (controller free application and strictly java configuration). I have two Entities, an Employee and a State. The relationship is @ManyToOne, I am sure we all know that. Anyway, the problem is converting the state field (field name is state) from String to a State object and setState() in the Employee class for persistence to a database. package com.hr.domain; @Entity public class Employee implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "state_id", nullable = true) private Long id; private String firstname; private State state; @StateConverter @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "employee_state_id_fk", nullable = false, insertable = true, updatable = true) private State state; //GETTERS AND SETTERS public String getFirstname() { return firstname(); } public void setFirstname(String firstname) { this.firstname = firstname; } public String getState() { return state(); } public void setState(State state) { this.state = state; } //HASHCODES AND EQUALS } package com.hr.domain; @Entity public class State implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "state_id", nullable = true) private Long id; private String state_name; //GETTERS AND SETTERS //TO STRING @Override public String toString() { return "State [id=" + id + ", state_name=" + state_name + "]"; } } I have registered my converter with the conversion service but still cant get the String to be converter to State object on form submit. @Bean//(name="conversionService") public ConversionService getConversionService() { ConversionServiceFactoryBean bean = new ConversionServiceFactoryBean(); bean.setConverters(getConverters()); bean.afterPropertiesSet(); ConversionService object = bean.getObject(); System.out.println(object); retur…
has comment: http://stackoverflow.com/comment/38492126
has comment: http://stackoverflow.com/comment/38492180
tagged with: rest
has comment: http://stackoverflow.com/comment/38493869
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24783002
has comment: http://stackoverflow.com/comment/38489620
has comment: http://stackoverflow.com/comment/38507504
tagged with: spring-mvc

http://stackoverflow.com/comment/44327458
comment on: http://stackoverflow.com/a/24904018
type: Comment
has text: The [latest Spring (4.1.x) documentation for ThreadPoolTaskExecutor](http://docs.spring.io/spring/docs/4.1.x/javadoc-api/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.html) has no reference to Java 5.
score: 5
type: AnswerComment

http://stackoverflow.com/comment/38679045
type: Comment
comment on: http://stackoverflow.com/q/24898375
type: QuestionComment
score: 0
has text: I am not familiar so much, but it should be an json parser for that?

http://stackoverflow.com/comment/38525006
type: Comment
comment on: http://stackoverflow.com/q/24817014
score: 0
has text: @MitchWheat Hi, i have not benchmarked, neither do i know if tis way is innefficient, i mostly want to know if there is a better way of doing this tan using ifs and elseifs
type: QuestionComment

http://stackoverflow.com/q/24750572
has comment: http://stackoverflow.com/comment/38399747
has comment: http://stackoverflow.com/comment/38399667
answer count: 1
has title: Image Servlet can access other files also
favorite count: 0
accepted answer: http://stackoverflow.com/a/24750677
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/1154254
has body: I wanted to display the images inside servlets, there were many complex methods like first dumping images in Database, then using it reading from disk and converting to byte array then having separate servlet for each image Then finally I found this very easy. I used Image Servlet from this tutorial changed the web.xml Image com.jsos.image.ImageServlet dir C:/Users/myName/Desktop/myName/workspace_j2ee/myServlet/WebContent/images expires 86400 I can successfully display image using /Myservlet/Image?fileName.png but the problem is this is actually security hole, as I tried /Myservlet/Image?../../src/maJavafiles.java And to my surprise the java files were downloaded. So how can I restrict the user to put this kind of url i mean going on level up in the directory structure
tagged with: java
has comment: http://stackoverflow.com/comment/38399608
has answer: http://stackoverflow.com/a/24750677
tagged with: servlets
score: 0

http://stackoverflow.com/a/24795099
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24795060
has comment: http://stackoverflow.com/comment/38483944
has body: Just Edit your context.xml as below. WEB-INF/web.xml <Manager pathname="" /> Knowledge is inside comment. :D
downvote count: 0
has comment: http://stackoverflow.com/comment/38483906
has comment: http://stackoverflow.com/comment/38483990
upvote count: 2

http://stackoverflow.com/comment/38417668
type: QuestionComment
comment on: http://stackoverflow.com/q/24756874
score: 0
type: Comment
has text: @Tony sorry that was a typo, I meant "other debug information", i.e. line numbers etc. which might be removed by the compiler if told so.

http://stackoverflow.com/comment/38566671
comment on: http://stackoverflow.com/a/24833631
has text: discover more if you find any one then please post an answer here.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24773939
answers question: http://stackoverflow.com/q/24773272
score: 1
has body: You have two versions of the expression language in you classpath. The one loaded by your app is not compatible to your servers one. Have a look at a file called javax.el-api, commons-el, or jboss-el-api, etc. Try to remove that from your app, since Tomcat shipps with its own.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/24837702
has title: Spring MVC configuration with java
answer count: 0
has body: I'm using Apache Tomcat 7.0.54 and Spring MVC 4.0.1 and trying to configure DispatcherServlet with Java: I've written the config class: public class AppInitializer extends AbstractDispatcherServletInitializer{ @Override protected WebApplicationContext createServletApplicationContext() { XmlWebApplicationContext context = new XmlWebApplicationContext(); context.setConfigLocation("/WEB-INF/her-servlet.xml"); return context; } @Override protected String[] getServletMappings() { return new String[] {"*.her"}; } @Override protected WebApplicationContext createRootApplicationContext() { return null; } } and it doesn't work. But if I write the follwoing: public class AppInitializer implements WebApplicationInitializer{ @Override public void onStartup(ServletContext sc) throws ServletException { XmlWebApplicationContext context = new XmlWebApplicationContext(); context.setConfigLocation("/WEB-INF/her-servlet.xml"); ServletRegistration.Dynamic registration = sc.addServlet("her", new DispatcherServlet(context)); registration.setLoadOnStartup(1); registration.addMapping("*.her"); } } It'll work fine. I don't understand the problem. Could you help me to solve?
score: 0
type: UnansweredQuestion
tagged with: spring
type: Question
has comment: http://stackoverflow.com/comment/38564576
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/38563977

http://stackoverflow.com/comment/38417009
type: AnswerComment
comment on: http://stackoverflow.com/a/24749758
type: Comment
has text: Thank you for the links. Yes, the closed streams were the cause of the trouble.
score: 0

http://stackoverflow.com/comment/76533430
type: Comment
score: 13
comment on: http://stackoverflow.com/a/24861409
type: AnswerComment
has text: @Peter Perháč you can disable the setting 'Honor "CamelHumps" words settings when selecting on double click' under Settings | Editor | General. Then a double click select the whole variablename

http://stackoverflow.com/comment/38474877
type: QuestionComment
comment on: http://stackoverflow.com/q/24790158
type: Comment
score: 2
has text: don't include a ? for the PK id argument. you should have only 5 question marks in your insert sql.

http://stackoverflow.com/q/24872995
score: 28
favorite count: 0
tagged with: linux
upvote count: 28
has answer: http://stackoverflow.com/a/24996416
has comment: http://stackoverflow.com/comment/38631724
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30167825
has answer: http://stackoverflow.com/a/26687325
has answer: http://stackoverflow.com/a/25774418
tagged with: java-8
type: Question
has answer: http://stackoverflow.com/a/25153671
answer count: 8
tagged with: java
possible better answer: http://stackoverflow.com/a/25090747
tagged with: eclipse
has answer: http://stackoverflow.com/a/25090747
has answer: http://stackoverflow.com/a/24873368
has body: I have Debian GNU/Linux 7.4 (wheezy) OS installed on Oracle VirtualBox and: java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode) I downloaded Eclipse Luna 4.4. When I was trying to run Eclipse an error occurred: A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007f9e8a42173f, pid=10942, tid=140319582553856 JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode linux-amd64 compressed oops) Problematic frame: C [libgdk-x11-2.0.so.0+0x5173f] gdk_display_open+0x3f Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java So I issued a command in the terminal: $ ulimit -c unlimited $ ./eclipse But the next error occurred: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 (java:11276): GLib-GObject-WARNING **: cannot register existing type `GdkDisplayManager' (java:11276): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed (java:11276): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed (java:11276): GLib-GObject-WARNING **: invalid (NULL) pointer instance (java:11276): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (java:11276): GLib-GObject-WARNING **: invalid (NULL) pointer instance (java:11276): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (java:11276): GLib-GObject-WARNING **: cannot register existing type `GdkDisplay' (java:11276): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed (java:11276): GLib-GObject-CRITICAL **: g_type_register_static: assertion `parent_type &gt; 0' failed (java:11276): GLib-CRITICAL **: g_once_init_leave: assertion `result !…
downvote count: 0
has answer: http://stackoverflow.com/a/27130646
has title: Why does my Eclipse Luna 4.4 crash on Debian Wheezy 7.4 with Oracle JDK8 64bit?
accepted answer: http://stackoverflow.com/a/25153671

http://stackoverflow.com/q/24803847
has answer: http://stackoverflow.com/a/24804063
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: concurrency
type: Question
tagged with: blockingqueue
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/24804063
favorite count: 0
has body: [JAVA] I am having a use case and I am wondering the best way to approach it. I have a current implementation in the following manner (pseudo-code), but it takes a lot of time to process: Func (File) // Called when a file is uploaded { 1.doSomething() 2.Result=LongRunningTask(File) 3.WriteToFS(Result) } Now I want to take out 2, &amp; 3 and execute them in background and return quickly. If multiple calls are made to Func() , it should Queue and execute them one by one so the writing to FS is not affected. How should I go about it?
has title: Java asynchronous method call / background processing
possible better answer: http://stackoverflow.com/a/24804207
tagged with: multithreading
has answer: http://stackoverflow.com/a/24804207

http://stackoverflow.com/comment/38629121
has text: 300 will be the height and width, if you wish to load the lower version of you image the above approach would work, but if you wish to load the Hi Resolution image (from the resource folder or some other source), it is not guaranteed that it will load properly on all device ( high chances of OutOfMemory Exceptions may occur).
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24871408

http://stackoverflow.com/q/24822860
has title: Application crashes when i try to save scroll position
has body: My application has an activity which contains many textviews which are used to display a very long block of text so i have divided the text into many textviews. The problem occurs when i try to save the scroll position of the text for orientation changes and to retain the position when the application goes into the background. But when i change the orientation of the screen the application crashes. Below is the code: Chapter1.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scrollChapter1"&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/Chapter1" android:textSize="17sp" android:padding="10px" android:id="@+id/txtChapter1Title" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:width="0dip" android:textSize="16sp" android:padding="10px" android:text="@string/Chapter1ContentA" android:id="@+id/txtChapter1A" android:maxLength="9000" android:layout_below="@+id/txtChapter1Title" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="0dip" android:width="0dip" android:textSize="16sp" android:padding="10px" android:text="@string/Chapter1ContentB" android:id="@+id/txtChapter1B" android:maxLength="9000" android:layout_below="@+id/txtChapter1A" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="0dip" android:width="0dip" android:textSize="16sp" android:padding="10px" android:text="@string/Chapter1ContentC" android:id="@+id/txtChapter1C" android:maxLength="9000" android:layout_below="@+id/txtChapt…
type: Question
has answer: http://stackoverflow.com/a/24822971
has comment: http://stackoverflow.com/comment/38535456
score: 0
has answer: http://stackoverflow.com/a/24822932
has answer: http://stackoverflow.com/a/24822899
type: UnansweredQuestion
tagged with: android
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24822946
tagged with: java

http://stackoverflow.com/a/24827694
has body: What you need is matches operator and you should probably write your drl like when: Person( firstName matches "[^A-Za-z]" ) then: // .. end The doc for contains says The operator contains is used to check whether a field that is a Collection or array contains the specified value. So it cannot be used for a String
has comment: http://stackoverflow.com/comment/38544929
type: Answer
answers question: http://stackoverflow.com/q/24827560
has comment: http://stackoverflow.com/comment/38545350
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/38504601
type: AnswerComment
type: Comment
has text: use this and you are fine: `String str= strpath.replace("\\\\","\\")`
comment on: http://stackoverflow.com/a/24805469
score: 0

http://stackoverflow.com/comment/38462188
type: Comment
comment on: http://stackoverflow.com/a/24783598
score: 0
type: AnswerComment
has text: Ahh, well that explains why I couldn't find anything on the subject! I guess I'll follow your advice and set up hidden fields then, thank you for the suggestion and quick answer!

http://stackoverflow.com/comment/38496269
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24797339
has text: `scores` is a collection of objects? implement a loop, that iterates over this collection and builds a string using StringBuilder or StringBuffer class instance.
type: AnswerComment

http://stackoverflow.com/q/24835084
type: Question
has title: Spring @Resource not loading list of beans
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24836744
has comment: http://stackoverflow.com/comment/38560365
has comment: http://stackoverflow.com/comment/38560114
tagged with: spring
has body: When I try to load a resource, it never gets loaded and instead comes back as null. My code is as follows: Controller.java @Controller @Path("/users") public class UsersAPI { @Resource(name = "dataLoaderList") private List&lt;DataLoader&gt; dataLoaderList; } spring.xml &lt;context:component-scan base-package="com.my.package" /&gt; &lt;import resource="classpath:spring/commons.xml" /&gt; &lt;import resource="spring-dataloader.xml" /&gt; &lt;import resource="spring-security.xml" /&gt; spring-dataloader.xml &lt;bean id="dataLoaderList" class="org.springframework.beans.factory.config.ListFactoryBean"&gt; &lt;property name="sourceList"&gt; &lt;list&gt; &lt;ref bean="dataLoader1" /&gt; &lt;ref bean="dataLoader2" /&gt; &lt;ref bean="dataLoader3" /&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; What could I be missing? EDIT: I tried loading the resource in a JUnit Test, and it worked. So I have no idea why it wouldn't work in my Controller. junit @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:spring/spring.xml") @ActiveProfiles("dev") public class Test { @Resource(name = "dataLoaderList") private List&lt;DataLoader&gt; dataLoaderList; }
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24836744
has comment: http://stackoverflow.com/comment/38560150
has comment: http://stackoverflow.com/comment/38560352

http://stackoverflow.com/comment/38542578
comment on: http://stackoverflow.com/q/24823065
has text: You can run executable on Android. It's not even necessary to make file.so with JNI. But you should use a compatible NDK toolchain.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24815339
upvote count: 1
answers question: http://stackoverflow.com/q/24811796
has body: &lt;p:column filterBy="#{filtroBean.getEstado(persona.estado)}" headerText="Estado" footerText="contains" filterMatchMode="contains"&gt; filterBy needs a bean Property for Filtering like public class foo { private String filterMe; //getter and setter } In getEstado you return the String "Ninguno" and Ninguno is not an property. &lt;p:column filterBy="#{persona.estado}" .....&gt; For mapping int to String u need to write a converter, in PF5 u can use filterFunction in p:column
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/24783044
has title: Copy all maven dependencies from children pom to directory
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38467295
upvote count: 2
tagged with: maven
has comment: http://stackoverflow.com/comment/38469835
has body: I'm trying to copy all the dependencies of a project and its sub-modules to a specific folder (lets say parent/target/lib) the project is something like this: parent |- module1 |- module2 |- module3 |- module3.1 |- module3.2 |- module4 in my understanding the only way to do so is by using maven copy-dependency in each sub-module as so: copy-dependencies package copy-dependencies runtime ${parent.dir}/target/lib false false true xerces junit,testng,easymock I'm having multiple issues with this however: the lib folder will contain all versions of an artifact (i want only latest) for each include/exclude rule all the poms need to be updated (there are a lot) Isn't there something that works together with dependency:list to get all dependencies, keep the latest and copy them to my /lib folder?
accepted answer: http://stackoverflow.com/a/24911313
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38465586
tagged with: maven-dependency-plugin
has comment: http://stackoverflow.com/comment/38470778
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24911313

http://stackoverflow.com/a/24749757
has comment: http://stackoverflow.com/comment/38398353
answers question: http://stackoverflow.com/q/24749602
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24749602
type: Answer
has comment: http://stackoverflow.com/comment/38398597
upvote count: 1
has comment: http://stackoverflow.com/comment/38398522
has body: I'm 99% sure the problem is your input encoding (when you read the data). You're decoding it as ISO-8859-1 when it's probably ISO-8859-7 instead. This would cause the symptoms you see. The simplest way to check would be to open the HTML in a hex editor and examine the character encodings directly. If the Greek characters take up one byte each then it's almost definitely ISO-8859-7 (not -1). If they take up 2 bytes each then it's UTF-8. From what you posted it looks like ISO-8859-7. In that character set, the lower-case sigma σ is 0xF3, while in ISO-8859-1 that same code maps to ó, which matches the data you showed. I'm sure if you mapped all the remaining characters you'd see a 1-to-1 match in the codes. Maybe your Windows system's default codepage is ISO-8859-7?
has comment: http://stackoverflow.com/comment/38398259
score: 1

http://stackoverflow.com/q/24791298
has answer: http://stackoverflow.com/a/24794799
has body: All I want is to generate a simple pdf report using JasperReport+Maven+Eclipse. I have been browsing for a simple example for some time but not able to find any. The JasperReport site doesn’t seem to have any tutorial with Maven The Maven 2 JasperReports Plugin gives the following error in Eclipse Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:jasperreports-maven-plugin:1.0- beta-2:compile-reports Most of the examples on other sites are with Ant and Jasper
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has title: JasperReports with Maven and Eclipse example
score: 4
tagged with: java
downvote count: 1
type: Question
tagged with: jasper-reports
upvote count: 5
answer count: 1

http://stackoverflow.com/a/24810786
accepted answer of: http://stackoverflow.com/q/24810701
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/38513556
has comment: http://stackoverflow.com/comment/38513194
has comment: http://stackoverflow.com/comment/38513542
answers question: http://stackoverflow.com/q/24810701
upvote count: 4
has body: you can probably just use flip, like so. textureRegion.flip(false, true); for every TextureRegion you have. Since Sprites extend TextureRegions, this should work for them too

http://stackoverflow.com/comment/38581022
type: Comment
has text: It is in the language specification section 14.14.2 In brief, if the collection (small c) is an array then the compiler converts the code to a standard for loop with an int counter and if the collection (small c) is an Iterable (which includes the Collection classes) then it calls the iterator.
comment on: http://stackoverflow.com/a/24845348
score: 4
type: AnswerComment

http://stackoverflow.com/q/24801699
tagged with: ccd
tagged with: java
has answer: http://stackoverflow.com/a/24802340
type: Question
answer count: 1
score: 0
tagged with: hl7
has title: generate exact clock time in seconds and express time zone offset as well
has body: I am generating Continuity Of Care document that requires effective time. The document states: CONF-9: ClinicalDocument / effectiveTime SHALL be expressed with precision to include seconds. CONF-10: ClinicalDocument / effectiveTime SHALL include an explicit time zone offset. Well, I can get current time in seconds: long timeMillis = System.currentTimeMillis(); long timeSeconds = TimeUnit.MILLISECONDS.toSeconds(timeMillis); But I have no idea what the second part says about having time zone. A example of correct effective time would be 20000407130000+0500. It is from one of the sample.
type: UnansweredQuestion

http://stackoverflow.com/comment/38698970
comment on: http://stackoverflow.com/a/24902946
has text: The simplification helped a lot, but it still seems to be skipping the filer. I've edited my original question.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38507911
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24806672
has text: @JonathanDrapeau Method cascading should work on the existing instance.
score: 0

http://stackoverflow.com/q/24775815
tagged with: java
type: Question
has title: JAX-RS resource error: Couldn't find JAX-B element for class java.lang.String and some more exceptions
tagged with: glassfish
has answer: http://stackoverflow.com/a/29934140
answer count: 2
downvote count: 0
tagged with: jersey-2.0
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/38498605
has body: When I do an OPTIONS call on the rest resource 'queue' from the Java EE 7 SDK example 'async-chat', I get many exceptions, when the log level for jersey is set to FINE (org.glassfish.jersey.level=FINE). The same exceptions happen in my code, given below. Both applications run correctly. Are these exceptions irrelevant (just thrown when the logging level is on FINE)? If not, why are they thrown? I tested several GlassFish 4 installations and also GlassFish 4.0.1. They all show the same behavior. Exceptions: Many of those entries: FINE: Couldn't find JAX-B element for class java.lang.String FINE: Couldn't find JAX-B element for class javax.ws.rs.core.Response Also many of those (there are between 10 and 20 such error blocks): FINE: java.lang.NoSuchMethodException: javax.ws.rs.container.ContainerRequestContext.<init>() at java.lang.Class.getConstructor0(Class.java:2800) at java.lang.Class.getDeclaredConstructor(Class.java:2043) at org.glassfish.jersey.server.wadl.internal.generators.WadlGeneratorJAXBGrammarGenerator$6.resolve(WadlGeneratorJAXBGrammarGenerator.java:418) at org.glassfish.jersey.server.wadl.WadlGenerator$ExternalGrammarDefinition.resolve(WadlGenerator.java:179) at org.glassfish.jersey.server.wadl.internal.ApplicationDescription.resolve(ApplicationDescription.java:82) at org.glassfish.jersey.server.wadl.internal.generators.WadlGeneratorJAXBGrammarGenerator.attachTypes(WadlGeneratorJAXBGrammarGenerator.java:481) at org.glassfish.jersey.server.wadl.internal.WadlBuilder.generate(WadlBuilder.java:122) at org.glassfish.jersey.server.wadl.internal.WadlApplicationContextImpl.getApplication(WadlApplicationContextImpl.java:131) at org.glassfish.jersey.server.wadl.internal.WadlApplicationContextImpl.getApplication(WadlApplicationContextImpl.java:150) at org.glassfish.jersey.server.wadl.processor.WadlModelProcessor$OptionsHandler.apply(WadlModelProcessor.java:134) at org.glassfish.jersey.server.wadl.processor.WadlModelProcessor$OptionsHandler.apply(WadlModelProcessor…
tagged with: netbeans

http://stackoverflow.com/comment/38609907
has text: ajax pop up alerts and browser controlled alerts are used in this application
score: 0
comment on: http://stackoverflow.com/q/24861733
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24784139
score: 9
has comment: http://stackoverflow.com/comment/38462989
has comment: http://stackoverflow.com/comment/38463355
answers question: http://stackoverflow.com/q/24784008
downvote count: 1
has comment: http://stackoverflow.com/comment/38463395
has body: It depends. Return null so the caller can check The keyword here is "can". The caller can completely ignore the null value. If this is completely fine, then returning null is fine. Throw an exception so the caller must check The keyword is "must". This is the option to take if you think the caller needs to handle the situation. Throw an unchecked exception so the caller can check If you do this, then you must have done it very deliberately. Basically, this lets the caller know exactly what went wrong if it does go wrong, but you don't necessarily think they need to (or will even be able to) handle the problem.
has comment: http://stackoverflow.com/comment/38463358
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/38463228
has comment: http://stackoverflow.com/comment/38463067
has comment: http://stackoverflow.com/comment/38463099

http://stackoverflow.com/comment/38559703
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24832887
has text: @Riverside That suggestion is nonsense. readLine() returns null, not "NULL", at end of stream. And it is checked with ==, not .equals(). And coded the way you suggest, you will lose every second line of input.

http://stackoverflow.com/comment/38584213
type: QuestionComment
comment on: http://stackoverflow.com/q/24848404
score: 0
has text: I suspect that the error messages aren't from that ant target definition. "Bachelor_Thesis" occurs twice in the error messages, but isn't in that ant XML.
type: Comment

http://stackoverflow.com/q/24907121
has comment: http://stackoverflow.com/comment/38695359
has body: Hy guys, I would like to know how convert date with timezone like 2013-08-22T10:47:12+02:00 to another date 2013-08-22 10:47:12. I try to do that with SimpleDateFormat object, but I have the same exception: java.text.ParseException: Unparseable date: "2013-08-22T10:47:12+02:00" Can you help me? thanks UPDATE I show here my failing code: String CURRENT_TIME_PATTERN ="yyyy-MM-dd'T'HH:mm:yyX"; String NEW_TIME_PATTERN ="yyyy-MM-dd HH:mm:ss"; String data="2013-08-22T10:47:12+02:00"; SimpleDateFormat sdf = new SimpleDateFormat(CURRENT_TIME_PATTERN); SimpleDateFormat output = new SimpleDateFormat(NEW_TIME_PATTERN); Date d = sdf.parse(data); String formattedTime = output.format(d); System.out.println(formattedTime); In this manner I will have exception over invalid parameter 'X'. If I use this pattern String CURRENT_TIME_PATTERN ="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";, I'll get unparsable date exception.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38695121
has comment: http://stackoverflow.com/comment/38695130
tagged with: simpledateformat
tagged with: date
has comment: http://stackoverflow.com/comment/38695127
has comment: http://stackoverflow.com/comment/38695785
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38695661
has title: convert date from 2013-08-22T10:47:12+02:00 to 2013-08-22 10:47:12
has answer: http://stackoverflow.com/a/24907704
has answer: http://stackoverflow.com/a/24908286
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24907251
tagged with: datetime

http://stackoverflow.com/a/52834713
answers question: http://stackoverflow.com/q/24856501
upvote count: 5
score: 5
has body: Once the library is added, you can set the Native Library Location as follows: Make sure the library is selected (highlighted). In my case, there only is one Library called lwjgl. On the right panel, select the little + Symbol (below "Name" and above "Classes") Select the directory you want to specify as Native Library Location and confirm Select Native Library Location in the next dialog.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38522429
type: AnswerComment
type: Comment
has text: For your last edit, The tomcat will still require private key after adding the certificate. Its more like customer is trying to configure the product's tomcat server to use his own certificate. Thats the reason he needs to upload private key. The other option would be to upload pkcs#12 certificate directly.
comment on: http://stackoverflow.com/a/24810054
score: 0

http://stackoverflow.com/q/24845141
type: UnansweredQuestion
downvote count: 2
type: Question
linked to: http://stackoverflow.com/q/5205339
score: -2
tagged with: java
has body: I want to extract fully qualified classnames from Java / JSP source code with a regular expression. There are already some threads about this, esp. Regular expression matching fully qualified class names Though I'm very close to solving the problem, I can't get rid of false positives. Here are some examples. At the end of the line I have attached the expected value. Logger l = LoggerFactory.getLogger("test"); // not a FQN, because it starts with an uppercase letter ("LoggerFactory") if(!com.db.TFSec.isPermitted("test") return; // should return "com.db.TFSecurity" new java.util.concurrent.BrokenException(); // java.util.concurrent.BrokenException java.util.Set&lt;Log&gt; ls = new java.util.HashSet&lt;&gt;(); // java.util.Set, java.util.HashSet java.awt.Component c1d2 = new java.awt.List(); // java.awt.Component, java.awt.List com.de.tfsecurity.TFUser u; // com.de.tfsecurity.TFUser I've tried these 3 regexes: // Own try. Only one false positive in line1: [oggerFactory.getLogger("test")] ([a-z]\\w*\\.\\w+(\\.\\w+)*)[&lt;\\( ;] // The following two regexes are the "correct" answers from the thread mentioned above. But I get false positives. ([a-zA-Z_$][a-zA-Z\\d_$]*\\.)*[a-zA-Z_$][a-zA-Z\\d_$]* // false positives: [Logger, LoggerFactory.getLogger, test, if, return, new, c1d2] etc. ([a-z][a-z_0-9]*\\.)*[A-Z_]($[A-Z_]|[\\w_])* // false positives: the same as in the previous example Here's my source code: public class FileUsageScanner { // This is my own try. Works for most of the time, but we have false positives with LoggerFactory.getLogger, which is not a FQN private final Pattern fqnPatternOwnTry = Pattern.compile("([a-z]\\w*\\.\\w+(\\.\\w+)*)[&lt;\\( ;]"); // Solutions from https://stackoverflow.com/questions/5205339/regular-expression-matching-fully-qualified-java-classes // Lots of false positives like: [Logger, LoggerFactory.getLogger, test, if, return, new, c1d2] etc. private final Pattern fqnPatternThr = Pattern.compile("([a-zA-Z_$][a-zA-Z\\d_$]*\\.)*[a-zA-Z_$][a…
has title: Regex for fully qualified java classname
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24846057
tagged with: regex
has comment: http://stackoverflow.com/comment/38579632
has comment: http://stackoverflow.com/comment/38579413

http://stackoverflow.com/a/24839949
answers question: http://stackoverflow.com/q/24839057
has comment: http://stackoverflow.com/comment/38569621
type: Answer
has body: You can use any of the following method :- public class Test { public static void main(String[] args) { public static void main(String[] args) { String url = "/demoapi/api/user/123"; String newurl = "/user/?user=$1"; String s1 = newurl.replaceAll("\\$1", Matcher.quoteReplacement("123")); System.out.println("s1 : " + s1); // OR String s2 = newurl.replaceAll(Pattern.quote("$1"),Matcher.quoteReplacement("123")); System.out.println("s2 : " + s2); // OR String s3 = newurl.replaceAll("\\$1", "123"); System.out.println("s3 : " + s3); // OR String s4 = newurl.replace("$1", "123"); System.out.println("s4 : " + s4); } } Explanation of Methods Used : Pattern.quote(String s) : Returns a literal pattern String for the specified String. This method produces a String that can be used to create a Pattern that would match the string s as if it were a literal pattern. Metacharacters or escape sequences in the input sequence will be given no special meaning. Matcher.quoteReplacement(String s) : Returns a literal replacement String for the specified String. This method produces a String that will work as a literal replacement s in the appendReplacement method of the Matcher class. The String produced will match the sequence of characters in s treated as a literal sequence. Slashes ('\') and dollar signs ('$') will be given no special meaning. String.replaceAll(String regex, String replacement) : Replaces each substring of this string that matches the given regular expression with the given replacement. An invocation of this method of the form str.replaceAll(regex, repl) yields exactly the same result as the expression Pattern.compile(regex).matcher(str).replaceAll(repl) Note that backslashes () and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher.replaceAll. Use Matcher.quoteReplacement(java.lang.String) to suppress the special meaning of these characters, if desired. String.repla…
score: 0

http://stackoverflow.com/a/24902718
upvote count: 1
has body: As an alternative to constructing your own cylinder figure geometrically, you can use the GeoShapeCylinderFigure class from the org.eclipse.gmf.runtime.diagram.ui.geoshapes.internal.draw2d.figures package.
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24889677
type: Answer
answers question: http://stackoverflow.com/q/24889677

http://stackoverflow.com/comment/38542307
type: Comment
comment on: http://stackoverflow.com/q/24826040
has text: Are all your Objects used in WorkerMessageToMaster serializable, as well as WorkerMessageToMaster itself? Every Object you want to send with ObjectStreams have to implement serializable, and all children of it have to have it implemented. String, as well as primitive datatypes (int, float etc) are serializable without you needing to do anything. But if you use your own classes, they have to implement serializable.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38586674
type: Comment
type: QuestionComment
has text: Have a look at [GridBagLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html) that might help you to specify the size in percentage.
comment on: http://stackoverflow.com/q/24849691
score: 0

http://stackoverflow.com/q/24893597
favorite count: 0
has comment: http://stackoverflow.com/comment/38670689
has body: Given this situation where a lambda is inside a for loop I would expect the counter i to be effectively final. The compiler complains that i is not effectively final so I had to use i2. for (int i = 0; i &lt; x.getBooks().size(); i++){ //The compiler needs i to be effectively final. int i2 = i; List&lt;Book&gt; books = bookstore.stream() .filter(c -&gt; c.getAuthors().get(i2).equals("xxx")) .collect(Collectors.toList()); } So the question is why i is not effectively final inside the scope of the for loop and is this the simplest workaround.
linked to: http://stackoverflow.com/q/20938095
answer count: 4
downvote count: 0
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/24894705
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/38671618
has comment: http://stackoverflow.com/comment/121439280
has comment: http://stackoverflow.com/comment/38670806
has comment: http://stackoverflow.com/comment/38671635
has title: Java lambda - for loop counter is not effectively final
tagged with: java
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/24911577
has answer: http://stackoverflow.com/a/24947740
has answer: http://stackoverflow.com/a/24907787
upvote count: 6

http://stackoverflow.com/comment/57604670
comment on: http://stackoverflow.com/a/29630411
score: 0
type: AnswerComment
has text: That's the same approach I came up with after looking at different alternatives that were for Maven, required handcrafted and customized code, or required third-party code that wasn't mature enough. Although I didn't think about using tags. I know it's late, but hope that people looking for this, find your post useful.
type: Comment

http://stackoverflow.com/q/24845158
tagged with: boolean
has answer: http://stackoverflow.com/a/24845203
has comment: http://stackoverflow.com/comment/38577590
has body: The following code: boolean continue = false; Returns the following error: error: not a statement boolean continue = false; ^ Why is this happening? I am pretty familiar with booleans.
has comment: http://stackoverflow.com/comment/38577695
answer count: 3
downvote count: 1
possible better answer: http://stackoverflow.com/a/24845178
has answer: http://stackoverflow.com/a/24845178
favorite count: 0
has title: Error: not a statement when declaring a boolean in Java
has comment: http://stackoverflow.com/comment/38577654
has answer: http://stackoverflow.com/a/24845177
accepted answer: http://stackoverflow.com/a/24845177
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38577586
has comment: http://stackoverflow.com/comment/38577661
score: 1
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/q/24842204
has title: Jersey POJOMappingFeature to convert null to empty string?
has answer: http://stackoverflow.com/a/25002099
has comment: http://stackoverflow.com/comment/38751551
has answer: http://stackoverflow.com/a/24952370
possible better answer: http://stackoverflow.com/a/25002099
score: 1
has body: I'm using Jersey 1.18 and I have POJOMappingFeature enabled. I would like all incoming & outgoing JSON values to be converted from null to an empty string. How to configure the mapping? I've searched web but was unable to find what I'm looking for. from my web.xml: Jersey REST Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.abc.restControllers com.sun.jersey.api.json.POJOMappingFeature true 1 and an example of a controller: package com.abc.restControllers; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import com.abc.restModals.Place.Place_descInfo_Request; import com.abc.restModals.Place.Place_descInfo_Response; @Path("/place") public class PlaceController { @POST @Path("/place_descInfo") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Place_descInfo_Response place_descInfo(Place_descInfo_Request req) { return new Place_descInfo_Response(req); } } // End class
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/24952370
answer count: 3
tagged with: jersey
downvote count: 0
has answer: http://stackoverflow.com/a/25016993
favorite count: 0

http://stackoverflow.com/a/24818253
answers question: http://stackoverflow.com/q/24818172
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You can not have a thread be in a different runtime without putting each thread in a different process as that goes against the definition of a thread. What you want instead is to create multiple processes Threads by definition take place in a single process. (or a single runtime) Description of differences here: What is the difference between a process and a thread? The answer is shown here: How to create a process in Java

http://stackoverflow.com/q/24888070
answer count: 1
has answer: http://stackoverflow.com/a/24888185
has comment: http://stackoverflow.com/comment/38712731
has comment: http://stackoverflow.com/comment/38665757
tagged with: jlabel
has title: Label above JSlider Thumb
tagged with: jslider
type: UnansweredQuestion
tagged with: swing
has body: i am trying to add a Label above the JSlider Thumb within the slider Component (coordinate-wise). Therefore I have tried to do the following in the Parent Component of the slider: this.setLayout(null); this.add(slider, 0); slider.setLocation(0, 0); JLabel label = new JLabel("test"); label.setLocation(1000,0); label.setOpaque(false); this.setOpaque(false); this.add(label); revalidate(); repaint(); Unfortunately the label is always visibly at x:0, y:0, but label.getLocation() returns x:1000, y:0 (the Parent Component is big enough for the given coordinates). Does anybody know whats causing this or how i can fix it? Or maybe another suggestions to add a Labels above a JSlider Thumb?
tagged with: java
type: Question
score: 0
tagged with: location

http://stackoverflow.com/q/24883822
tagged with: hector
upvote count: 0
type: UnansweredQuestion
type: Question
tagged with: java
score: -1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24884016
tagged with: cassandra
has title: "INFO me.prettyprint.cassandra.connection.CassandraHostRetryService - Downed Host Retry service started with queue size -1 and retry delay 10s" Error
downvote count: 1
has body: 17 [main] INFO me.prettyprint.cassandra.connection.CassandraHostRetryService - Downed Host Retry service started with queue size -1 and retry delay 10s Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/transport/TTransportException at me.prettyprint.cassandra.connection.ConcurrentHClientPool.&lt;init&gt;(ConcurrentHClientPool.java:48) at me.prettyprint.cassandra.connection.LeastActiveBalancingPolicy.createConnection(LeastActiveBalancingPolicy.java:59) at me.prettyprint.cassandra.connection.HConnectionManager.&lt;init&gt;(HConnectionManager.java:65) at me.prettyprint.cassandra.service.AbstractCluster.&lt;init&gt;(AbstractCluster.java:69) at me.prettyprint.cassandra.service.AbstractCluster.&lt;init&gt;(AbstractCluster.java:65) at me.prettyprint.cassandra.service.ThriftCluster.&lt;init&gt;(ThriftCluster.java:17) at me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:176) at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:155) at Test.main(Test.java:68) Caused by: java.lang.ClassNotFoundException: org.apache.thrift.transport.TTransportException at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) ... 9 more I got above error. Please specify what went wrong?

http://stackoverflow.com/a/24902727
score: 1
answers question: http://stackoverflow.com/q/24902561
has body: How about adding your modified jbox2d as a module then using Gradle to build it by referring to the module? compile project(':CustomJbox2d') For instance, my Android project builds with Gradle, and I have a facebook library that is built with this section of my build.gradle in teh module that depends on it. dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':libraries:facebook') } My file structure is something like this: project/ libraries/ facebook/ build.gradle my_module/ build.gradle (this is the one I took the above Gradle code from) build.gradle settings.gradle
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38687291
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24902561

http://stackoverflow.com/a/24791905
score: 6
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/24791823
accepted answer of: http://stackoverflow.com/q/24791823
has body: Your input String needs to match your DateFormat pattern String UTCinput = "2014-07-16T21:00:00.000+0000"; //2:00PM PST ^--- was ":"
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38510899
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24805682
has text: There are several close votes on the grounds that this is opinion-based. I don't agree - in strict crypto terms, either it is safe to do this, or it is not.
score: 0

http://stackoverflow.com/q/24780989
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38459842
has comment: http://stackoverflow.com/comment/38457156
downvote count: 0
favorite count: 0
tagged with: interceptor
has body: I'm trying to figure out how to encrypt different methods in different ways. For example I've got a test-service with two methods. I want one of these methods accessible without authentication, encryption or anything. Just anyone shall be able to use it. The second method on the other hand should have a signated and an encrypted body and only those clients known to the server shall be able to access that second method. My Problem now is that I can do either one these. I can encrypt the soap-messages of all methods or of none. So what I need is something that would probably look pretty much like this: <entry key="action" value="Timestamp Signature Encrypt"/> <!-- Use this action spec for WCF clients <entry key="action" value="Signature Encrypt Timestamp"/> --> <entry key="signaturePropFile" value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/fiverx.link.trust.properties"/> <entry key="decryptionPropFile" value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/fiverx.link.properties"/> <entry key="passwordCallbackClass" value="de.narz.apacheCXFTest.helloWorld.passwordHandling.PasswordCallbackHandler"/> ... is it possible to do it? I did not find anything after hours of research...
tagged with: ws-security
has title: Apache CXF - bind interceptor to service method
answer count: 0
tagged with: cxf
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
type: Question

hql
tag name: hql
tags question: http://stackoverflow.com/q/24865998
type: Tag
tags question: http://stackoverflow.com/q/24840049
tags question: http://stackoverflow.com/q/24830021
tags question: http://stackoverflow.com/q/24907092

http://stackoverflow.com/a/24891167
has body: When downcasting (e.g. from Throwable to Exception) compiler doesn't and shouldn't give warning. A failed downcast (e.g. trying to cast an Error declared as Throwable to Exception) will simply result to ClassCastException, just like dereferencing null will cause NPE, accessing array beyond bounds will cause ArrayIndexOutOfBoundsException and all the other RuntimeExceptions. Still, this cast is safe, since at runtime JVM can tell that the cast failed (unlike casting generic instances).
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24890669

http://stackoverflow.com/q/24894621
has answer: http://stackoverflow.com/a/55587557
has comment: http://stackoverflow.com/comment/93155232
upvote count: 2
has comment: http://stackoverflow.com/comment/93065219
tagged with: unmarshalling
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/22462300
type: UnansweredQuestion
has title: Maintain whitespace in JAXB with xs:any and mixed content
score: 2
downvote count: 0
tagged with: java
tagged with: jaxb
type: Question
has body: I have a schema with an xs:any element. This element may contain other elements that have mixed content. I'm trying to use JAXB to unmarshall it into Java objects (with the 'any' as an Element). From the schema: <xs:element name="a"> <xs:complexType> <xs:sequence> <xs:any processContents="lax"/> </xs:sequence> </xs:complexType> </xs:element> In general, this works. But when handling elements with mixed content, whitespace between nested nodes is lost. test.xml: Hello World Unmarshalling like this: JAXBContext jc = JAXBContext.newInstance(A.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); InputStream inputStream = this.getClass().getResourceAsStream("/data/test.xml"); A a = (A) unmarshaller.unmarshal(inputStream); Marshaller marshaller = jc.createMarshaller(); marshaller.marshal(a, System.out); Results in this: HelloWorld I lose the space between the child tags of the element. I'm certain that it's the unmarshal step that takes the whitespace out here, but I do need it to survive the round trip. Note that it's only whitespace-only text content that's removed. This works as desired: Hello to you World I tried adding xml:space="preserve" (see, for example, JAXB: How to keep consecutive spaces as they are in source XML during unmarshalling), but that has no effect on whitespace between elements. I've tried with processContents set to each of strict, lax, and skip, none of which helped.
has comment: http://stackoverflow.com/comment/92214721

notnull
type: Tag
tag name: notnull
tags question: http://stackoverflow.com/q/24853094

http://stackoverflow.com/a/40296622
score: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/90394906
type: Answer
has comment: http://stackoverflow.com/comment/69659179
has body: Creating a separate class for the Mixin, public abstract class MixinClass extends OriginalClass { //`datamember` is the datamember required to create instance of OriginalClass @JsonCreator MixinClass(@JsonProperty("item") datamember item) { super(item); } } In the mapper class add this, objectMapper.addMixInAnnotations(OriginalClass.class, MixinClass.class); This will resolve the issue. Make sure that the MixinClass is a separate .java file and not an inner class.
answers question: http://stackoverflow.com/q/24795488
upvote count: 9

http://stackoverflow.com/a/24820607
has body: Unfortunately, on most devices it's not possible to get the snapshot of the device outside your application. This, obviously, for security reasons. This could be achieved accessing the frame buffer at /dev/graphics/fb0, but normally you don't have the permissions to read that.
type: Answer
answers question: http://stackoverflow.com/q/24820544
score: 0

http://stackoverflow.com/q/24882380
answer count: 1
tagged with: jax-rs
favorite count: 0
has answer: http://stackoverflow.com/a/24882514
has body: Using Jersey 1.8 I have a request as follow: @DELETE @Path("{itemids: [A-Fa-f0-9]+}") public void deleteInstance(@PathParam("itemids") final PathSegment itemIdsPath) { .... } If I send an http request with path /delete/1;2;3 then it works. If however the semicolons are escaped, so the path looks like /delete/1%3B2%3B3 then Jersey returns a 404 error. Should Jersey be rejecting these latter requests or should it be decoding the path prior to matching the matrix parameter?
has title: Jersey @matrixparam and escaped semicolon in request
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: jersey
upvote count: 2
accepted answer: http://stackoverflow.com/a/24882514

http://stackoverflow.com/comment/38462674
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24780122
has text: Great idea! I get a NPE on this line, however: doc.select("td:contains(10110)").first().siblingElements(), more specifically on .siblingElements(). I'm parsing the document directly from a URL this time, not from HTML code as you did. Could this be the problem? (the URL loads without issues in my browser)
type: AnswerComment

http://stackoverflow.com/a/24763332
has comment: http://stackoverflow.com/comment/38423368
upvote count: 3
answers question: http://stackoverflow.com/q/24763245
has body: You are not using the substring method correctly. To get the first character as a substring, you need to use the two-argument version of substring, to supply a beginning index (inclusive) and an ending index (exclusive). The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Parameters: beginIndex - the beginning index, inclusive. endIndex - the ending index, exclusive. (The one-argument version of substring takes a substring from the given index through the rest of the string.) The substring begins with the character at the specified index and extends to the end of this string. Replace card.substring(0).equals("4") with card.substring(0, 1).equals("4") or just compare the character there. card.charAt(0) == '4' Next, to get the first two characters, again take into account the fact that the ending index is exclusive. Replace card.substring(0,1).equals("37") with card.substring(0,2).equals("37")
score: 3
accepted answer of: http://stackoverflow.com/q/24763245
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/50675771
has comment: http://stackoverflow.com/comment/102607372
type: Answer
score: 3
answers question: http://stackoverflow.com/q/24787751
upvote count: 3
has body: In Android Studio 3.1.2 this setting is under: File -> Other Settings -> Default Settings... -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Additional command line parameters Update For more recent versions of Android Studio [tested on Android Studio 3.5 but probably starting from 3.4 according to Joel's comment] this setting is under: File -> Other Settings -> Settings for New Projects... -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Additional command line parameters For existing projects it seems to me that the only option is to implement the solution described in these two answers A1 and A2, modifying the build.gradle file wrapping around allprojects or not based on your needs: allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs &lt;&lt; "-Xlint:unchecked" &lt;&lt; "-Xlint:deprecation" } } } More details about Gradle's Multi-Project Builds can be found here on their official website
has comment: http://stackoverflow.com/comment/101682079
has comment: http://stackoverflow.com/comment/101693423
has comment: http://stackoverflow.com/comment/102541426
downvote count: 0

http://stackoverflow.com/comment/38624441
type: QuestionComment
has text: "..the count of the number of child nodes underneath a parent tag." Is my terminology incorrect? I just need to know how to get the child node count under a parent - specifically under <test> as in this example. I'm sure the solution can then be applied to a scenario where there are x children, if needed. many thanks
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24759710

http://stackoverflow.com/comment/38522705
score: 0
type: QuestionComment
has text: @user3656530 Where exactly do those methods get called from? I for sure could be missing it. The only methods I see being called in your JPanel class are `super();` `setPreferredSize(new Dimension(500,500));` `setFocusable(true);` and `requestFocus();`
type: Comment
comment on: http://stackoverflow.com/q/24815660

http://stackoverflow.com/a/24771944
score: 0
has body: You can't run java code in jquery, jquery is a library for javascript and java is a programming language. also jquery is more for UI, animation and other web related things, your code seems to be logic code.
answers question: http://stackoverflow.com/q/24771788
type: Answer

http://stackoverflow.com/comment/38413752
type: QuestionComment
has text: Yes, I the command lsof | grep tomcat | grep -v grep | wc -l
comment on: http://stackoverflow.com/q/24757430
score: 0
type: Comment

http://stackoverflow.com/q/24814928
has answer: http://stackoverflow.com/a/24815088
has answer: http://stackoverflow.com/a/24814999
has title: call methods of subclass in main
has answer: http://stackoverflow.com/a/24814979
upvote count: 0
has answer: http://stackoverflow.com/a/24814955
has body: i have a class called "Student" as parent and 2 Subclasses (Undergraduate and Postgraduate) ... Student[] student; student=new Student[10]; and i need to set values in an array inside a subclass .. so my question is how to call that method from main ?? this is the method i want to call public void setInternship(boolean Internship){ this.Internship=Internship;} and its inside undergraduate class
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24815017
downvote count: 1
type: Question
tagged with: object
tagged with: java
score: -1

http://stackoverflow.com/q/24787530
tagged with: osx-yosemite
tagged with: macos
has title: Error trying to installing JDK8 U11 OSX 10.10 Yosemite
possible better answer: http://stackoverflow.com/a/25042589
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24787531
has body: Today was the release of Oracle JDK8 U11. When I try to install the .pkg in OSX yosemite 10.10 I get this error and can't continue.
upvote count: 4
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25042589
score: 4
has answer: http://stackoverflow.com/a/24787531
favorite count: 0

http://stackoverflow.com/a/24812414
has comment: http://stackoverflow.com/comment/76126649
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/114272777
has comment: http://stackoverflow.com/comment/38517076
has body: Exclude those 2 tests in the original test phrase and then create a new execution with those 2 classes running in single thread? :) org.apache.maven.plugins maven-surefire-plugin path/to/your/class/badtestclass1.java path/to/your/class/badtestclass2.java classes single-thread-test test test path/to/your/class/badtestclass1.java path/to/your/class/badtestclass2.java 1
answers question: http://stackoverflow.com/q/24811430
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24811430
type: Answer

http://stackoverflow.com/q/24783163
tagged with: sharedpreferences
score: 0
has body: I am creating an app that has a couple of SharedPreferences that are saved to the device. My issue is that I would like to delete these preferences from a Preference inside a PreferenceScreen (an android settings page). Is there any xml-based android intent that will reset the shared preferences? Using the intent tag? If not, is there a way to create my own intents programmatically and reference them in the xml?
has comment: http://stackoverflow.com/comment/38462080
has comment: http://stackoverflow.com/comment/38461785
has title: Intent to Reset Android Application, xml
tagged with: android
has comment: http://stackoverflow.com/comment/38461966
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has comment: http://stackoverflow.com/comment/38461767
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38461426
tagged with: android-intent
has comment: http://stackoverflow.com/comment/38461713
type: Question
tagged with: java

http://stackoverflow.com/comment/38441837
type: Comment
has text: I wanted to test my flow as well as the comparator in the single flow. If my list is getting sorted out properly using my comparator for a series of test cases I would not be required to test the comparator as a unit again.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24756615

http://stackoverflow.com/comment/38498381
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24802155
has text: Does your `Circle` extend `Shape`? If not it should.

http://stackoverflow.com/comment/38539628
type: Comment
has text: The managed beans need to be declared in each nsf. Of course when you build your own library you can design your own global objects. The XPages Extension Library book also explains how to make your own library
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24822527

http://stackoverflow.com/a/79390058
answers question: http://stackoverflow.com/q/24751116
score: 0
has comment: http://stackoverflow.com/comment/140008876
type: Answer
has body: Use android 4.2 and API 19 to avoid these kind of errors and change:

http://stackoverflow.com/a/24801068
score: 0
has comment: http://stackoverflow.com/comment/38494880
answers question: http://stackoverflow.com/q/24800657
type: Answer
has comment: http://stackoverflow.com/comment/38494697
has comment: http://stackoverflow.com/comment/38494765
has body: You need to specify the type in the instantiation: DefineObjectForm&lt;UserDefined&gt; dof = new DefineObjectForm&lt;UserDefined&gt;();

http://stackoverflow.com/a/24879462
has comment: http://stackoverflow.com/comment/42284110
has comment: http://stackoverflow.com/comment/42284353
accepted answer of: http://stackoverflow.com/q/24752485
has comment: http://stackoverflow.com/comment/51244012
type: AcceptedAnswer
downvote count: 0
has body: It is possible to make HttpClient get around the checks of SSL certificate validity. This code can be used to obtain an instance of HttpClient: import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import java.security.SecureRandom; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; ...... private static HttpClient getHttpClient() { try { SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, new TrustManager[]{new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted( X509Certificate[] certs, String authType) { } public void checkServerTrusted( X509Certificate[] certs, String authType) { } }}, new SecureRandom()); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext,SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); HttpClient httpClient = HttpClientBuilder.create().setSSLSocketFactory(socketFactory).build(); return httpClient; } catch (Exception e) { e.printStackTrace(); return HttpClientBuilder.create().build(); } } The exception will no longer be thrown, when the certification is expired, the browser will issues a warning about an expired certificate and let user confirm.
answers question: http://stackoverflow.com/q/24752485
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/comment/82015599
comment on: http://stackoverflow.com/a/24933117
has text: I've nothing against using Rx, on the countrary. But creating a new `View.OnClickListener` for every bind / view you create is highly inefficient, I wish this wasn't the most voted answer / accepted answer. Teach a bad practice to users! Also, Rx is a plus to the problem of handling the click, which is Android only issue.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38618053
comment on: http://stackoverflow.com/a/24866122
score: 0
has text: No, the only main method is in the Tester class. I could email you all of the classes in the project if you have the time to take a look for me? I'd really appreciate it.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24874949
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/13858876
has answer: http://stackoverflow.com/a/24896823
has comment: http://stackoverflow.com/comment/38635146
type: AnsweredQuestion
has body: This answer clearly describes how to set a Restriction to compare where 2 properties are equal. Given these 2 entities in that answer: @Entity public class Professor{ K id; List&lt;Student&gt; students; } @Entity public class Student{ K profid; String name; } How would I write the following Restriction: where professor.students.name is "Kevin"? I tried something like: Criteria criteria = createCriteria(Professor.class); criteria.add(Restrictions.eq("students.name", "Kevin") but that failed with: org.hibernate.QueryException: could not resolve property: 'students.name' of: Professor
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38659560
accepted answer: http://stackoverflow.com/a/24896823
type: Question
has title: Comparing a Collection's Field - org.hibernate.QueryException: could not resolve property:

http://stackoverflow.com/comment/38464805
comment on: http://stackoverflow.com/q/24784811
has text: I just added the code where RunGenerator is initialized.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24899827
has title: what to put for a menu item?
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24900157
tagged with: http://stackoverflow.com/tag/xml
has body: I want to write a program that has a menu on the top and that menu has an item. I want it when the user clicks on the item, one Dialog box appears, something like the code in this page:http://www.mkyong.com/android/android-custom-dialog-example/ but in this page there's a button instead of menu and an item on it. for the lines : final Context context; private Button button; button = (Button) findViewById(R.id.buttonShowCustomDialog); I wrote both final Context context; private Menuitem menuitem; menuitem = (MenuItem) findViewByID(R.id.addmenu1); and this one: final Context context; private Menu menu; menu = (Menu) findViewByID (R.id.addmenu1); but i get "suppling wrong type of resource identifier" What should i put here in this case?! here is my addmenu1.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/add" android:icon="@drawable/plus" android:title="Adding" android:orderInCategory="100" android:showAsAction="always" /&gt; &lt;/menu&gt;
score: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/38594498
comment on: http://stackoverflow.com/q/24853816
type: Comment
type: QuestionComment
score: 2
has text: You have to add the java mail to the classpath, not to the Path.

http://stackoverflow.com/comment/38536402
type: Comment
type: QuestionComment
has text: you should look at running your portlet in websphere portal, or define a context root for your portlet war, and the portlet will run
comment on: http://stackoverflow.com/q/24821614
score: 0

http://stackoverflow.com/q/24872972
tagged with: swing
has comment: http://stackoverflow.com/comment/38631670
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24873001
type: AnsweredQuestion
has title: How to stop Java Result: 1 error? Why is that happening?
type: Question
has body: I'm working on java swing on netbeans 8.0. I'm having repeated messages when I run this code. And finally I commented it. After that System doesn't stop working. Finally I used Task Manager and stop the whole system. Then I'm having Java Result: 1 error. Here is my source code. public void SaveDamage(JTextField txtItID, JTextField txtInID, JTextField txtQty, JTextField txtTotal) { try { ResultSet rs1 = JDBC.getData("select inid from damage where inid='" + txtInID.getText() + "'"); if (rs1.next()) { JOptionPane.showMessageDialog(null, "This invoice is already finalized", "Error", JOptionPane.ERROR_MESSAGE); } else { try { boolean bool = JDBC.putData("insert into damage(itid, qty,total, inid) values('" + txtItID.getText() + "' , '" + txtQty.getText() + "' ,'"+txtTotal.getText()+"' , '" + txtInID.getText() + "')"); if (bool) { JOptionPane.showMessageDialog(null, "damaged saved"); try { ResultSet rs = JDBC.getData("select avqty from item where itid='" + txtItID.getText() + "' "); while (rs.first()) { int newqty = rs.getInt("avqty") - Integer.valueOf(txtQty.getText()); try { boolean bool1 = JDBC.putData("update item set avqty = '" + newqty + "' where itid = '" + txtItID.getText() + "' "); if (bool1) { // JOptionPane.showMessageDialog(null, txtItID.getText()); // JOptionPane.showMessageDialog(null, "item updated"); } } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } This is my JDBC class. package Model; //import static Model.JDBC.con; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.JOptionPane; public class JDBC { static String driver = "com.mysql.jdbc.Driver"; static String url = "jdbc:mysql://localhost/cat"; static Connection con; static boolean b ; public static void setCon() { try { Class.forName(driver); co…
tagged with: netbeans
has answer: http://stackoverflow.com/a/24873001
score: 0

http://stackoverflow.com/comment/38471445
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24786639
has text: @user3371223 - In the problem you linked to, you cannot only take the first node to be a root. Consider the diagram in the Explanations section. You must be able to compute the sums of the subtrees (5,4,6) and (2,1,3). The sum for the subtree (2,1,3) will not be obtained when you begin traversing at node 1. But if you *really* want to go down that path - *warning: wrong path* - you would need to do a post-order traversal rather than pre-order. Peek at the top of the stack. If the top node has unvisited children, push those children onto the top of the stack, so that you'll process them first.

http://stackoverflow.com/comment/38653239
has text: i have a doubt public TrackService(Context context) { super("Trackservice"); this.context = context; } and context = getapplicatoncontext are doing same thing right???
score: 0
comment on: http://stackoverflow.com/a/24884784
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24762662
favorite count: 0
answer count: 3
has body: In the first try and catch it works exactly how I need it to however in the other two they don't and I am not sure why. First One: It asks for a difficulty 1 - 3 if it isn't 1,2, or 3 it loops till they enter 1,2 or 3 and if they put anything but an int it will say "Invalid Difficulty" and ask for them to input again. Issue: None (that I know of) try { System.out.println("What would you like the difficulty to be?"); System.out.println("Easy = 1, Medium = 2, Hard = 3"); difficulty = userInput.nextInt(); while((difficulty &lt; 1 || difficulty &gt; 3)){ System.out.println("Invalid Difficulty. \n"); difficulty = userInput.nextInt(); } } catch(InputMismatchException exception) { System.out.println("Invalid Difficulty.\n"); difficulty = selctDifficulty(); } Second One: Should do the same as above just without the loop to male sure it falls between 2 numbers. Issue: If they don't enter an int it says Invalid amount then crashes with Exception in thread "main" java.util.InputMismatchException try { System.out.println("How many pitchers would you like to buy?"); amountOfPitchers = userInput.nextInt(); } catch(InputMismatchException exception) { System.out.println("Invalid Amount.\n"); amountOfPitchers = userInput.nextInt(); } Third One: Should work exactly as the first. Issue: If I enter a string it crashes with Exception in thread "main" java.util.InputMismatchException try { System.out.println("How much do you want to charge per cup?"); System.out.println("Between $0.05 and $2.00"); pricePerCup = userInput.nextDouble(); while((pricePerCup &lt; 0.05 || pricePerCup &gt; 2.00)){ System.out.println("Invalid Amount. \n"); pricePerCup = userInput.nextDouble(); } } catch(InputMismatchException exception) { System.out.println("Invalid Amount.\n"); pricePerCup = userInput.nextDouble(); }
has answer: http://stackoverflow.com/a/24762960
tagged with: user-input
has answer: http://stackoverflow.com/a/24762962
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/24762960
possible better answer: http://stackoverflow.com/a/24762962
type: Question
tagged with: try-catch
score: 3
tagged with: java
has title: Need help getting a try and catch to work
tagged with: crash
downvote count: 0
has answer: http://stackoverflow.com/a/24762719

http://stackoverflow.com/a/24856832
answers question: http://stackoverflow.com/q/24852697
score: 0
has body: I can set scope="prototype" in context.xml than spring will create new Frame, but old frame still existing resulting many same frames. How it is possible to destroy object? When you use prototype-scope, it is up to you to dispose of the object. Spring will not and cannot dispose of prototype-scoped beans for you. When you call getBean to retrieve a prototype-scoped bean, you need to retain a reference to that object and dispose of it correctly.
type: Answer

http://stackoverflow.com/comment/38650732
type: QuestionComment
comment on: http://stackoverflow.com/q/24883339
type: Comment
has text: nevermind, i thought that there was a problem during if statement. Sorry, my bad.
score: 0

http://stackoverflow.com/q/24770198
has title: defined var is null when use abstract method
type: Question
has comment: http://stackoverflow.com/comment/38436659
has body: I have class A with anabstract method, and class B which extends class A. abstract method is called when creating new class object. In class B I have defined a global variable, but when I try to use this variable it appears to be null. In theory this var is defined and initialized. My code: public abstract class A{ public abstract void someMethod(); public A(){ someMethod(); } } public class B extends class A{ Rectangle[] mPathDots=new Rectangle[30]; //initialized array with 30 nulled items @Override someMethod(){ int x = mPathDots.length; //error! mPathDots is null, but in theory lenght must be 30 !? } } creating: B b = new B(); why is mPathDots null? I tried to create a class B object without the abstract method and it works without any problem, but with abstract method this var is nulled.
has comment: http://stackoverflow.com/comment/38436650
tagged with: class
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/24770269
favorite count: 0
tagged with: abstract
has comment: http://stackoverflow.com/comment/38436656
has comment: http://stackoverflow.com/comment/38436670
tagged with: android
has answer: http://stackoverflow.com/a/24770269
has answer: http://stackoverflow.com/a/24770240
accepted answer: http://stackoverflow.com/a/24770240
has answer: http://stackoverflow.com/a/24775842
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/38436583
has comment: http://stackoverflow.com/comment/38436672
tagged with: methods

http://stackoverflow.com/a/71492700
answers question: http://stackoverflow.com/q/24772179
score: 0
type: Answer
has body: '''python numbers=[] for x in range(100,1000): for y in range (100,1000): pro = str(x*y) if pro[0]==pro[-1] and pro[1]==pro[-2] and pro[2]==pro[-3]: numbers.append(int(pro)) numbers.sort() print(numbers[-1])'' I've simply created an empty list. Then looping over 2 variables x&amp;y in the range provided by the problem. Convert x*y to str, to access individual elements. Then I'll throw in the conditions for a palindrome and voila. Simple yet effective code.

http://stackoverflow.com/comment/38525730
comment on: http://stackoverflow.com/a/24808034
type: Comment
has text: @HotLicks Yes, you are right. I missed it. I will update my answer though
score: 0
type: AnswerComment

http://stackoverflow.com/q/24899312
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/24899452
possible better answer: http://stackoverflow.com/a/34382733
downvote count: 1
has answer: http://stackoverflow.com/a/34382733
has title: Simple spring utility project?
has answer: http://stackoverflow.com/a/24899452
has comment: http://stackoverflow.com/comment/38681034
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: spring-tool-suite
tagged with: eclipse
answer count: 2
upvote count: 1
has body: I am using a spring 3 book to learn Spring. But I am using the latest Eclipse for Spring or STS. The book tells me to make a spring utility project (screenshot below) or SUP , but I don't see that anywhere in my list of "items". I tried - projects pane > right click > new > other > wizard: search for utility. Nothing shows up. So, what is the equivalent of SUP in today's STS eclipse ?

http://stackoverflow.com/comment/38582440
type: AnswerComment
has text: @jeemster, Can you please elaborate a little, is it useful to take this path?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24840718

http://stackoverflow.com/comment/38657571
comment on: http://stackoverflow.com/q/24886717
score: 0
type: Comment
type: QuestionComment
has text: Hi @David, Will it not be the same? That is the "great circle" distance and the "rope" distance? If I'm correct the the great circle distance is the shortest distance between 2 points, but if i restrict myself moving along the same latitude , wont that be the same thing, or could there be an even shorter distance?

http://stackoverflow.com/a/24845107
has body: Try this - webView.setWebViewClient(new WebViewClient() { ProgressDialog progressDialog; //If you will not use this method url links are opeen in new brower not in webview public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } //Show loader on url load @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); if (progressDialog == null) { // in standard case YourActivity.this progressDialog = new ProgressDialog(WebActivity.this); progressDialog.setMessage("Loading..."); progressDialog.show(); } } public void onPageFinished(WebView view, String url) { try{ if (progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } }catch(Exception exception){ exception.printStackTrace(); } } });
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24844753

http://stackoverflow.com/comment/38672389
has text: maybe you could add some code of how you are calling the intent and how you would like to get the image in you app. I don't think you will get much help without showing your initiative. After all I can imagine that there are many ways to get your image – one would be to read it again from storage and delete the original file, although this could eat quite some memory if you don't compress the image directly
comment on: http://stackoverflow.com/q/24892835
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24843148
answers question: http://stackoverflow.com/q/24842585
score: 0
has body: You may want to use an algorithm in which you use secondary arrays to accumulate the counts for individual marks, and then search through those secondary arrays for the mark with the highest frequency with largest value. Consider: package com.example.mode; public class Mode { public static void main(String[] args) { int[] marks = { 99, 95, 97, 92, 80, 95, 73, 80, 95, 80}; //One algorithm .. insert marks and add occurances, keeping in order int[] unique = new int[marks.length]; int[] count = new int[marks.length]; int maxUnique = 0; for (int i=0; i &lt; marks.length ; i++) { int loc = -1; for (int j=0; j &lt; maxUnique; j++) { if (marks[i] == unique[j]) { loc = j; break; } } if (loc == -1) { loc = maxUnique; unique[loc] = marks[i]; count[loc] = 0; maxUnique++; } count[loc] = count[loc]+1; } int maxValue = unique[0]; int maxCount = count[0]; for (int j=1; j &lt; maxUnique; j++) { if (count[j] &gt; maxCount || (count[j] == maxCount &amp;&amp; maxValue &lt; unique[j]) ) { maxValue = unique[j]; maxCount = count[j]; } } System.out.println("Mode = " + maxValue + ", frequency = " + maxCount); } }
type: Answer

http://stackoverflow.com/a/58852521
upvote count: 0
has body: Check whether joda-time*.jar exists in your classpath/buildpath If it is not mentioned, add it. Else, copy that jar into your lib directory and add it into your classpath.
has comment: http://stackoverflow.com/comment/103977393
score: -1
answers question: http://stackoverflow.com/q/24781932
downvote count: 1
type: Answer

drawing
tags question: http://stackoverflow.com/q/24810701
tags question: http://stackoverflow.com/q/24795368
type: Tag
tags question: http://stackoverflow.com/q/24814827
tag name: drawing
tags question: http://stackoverflow.com/q/24839644

http://stackoverflow.com/comment/38598535
has text: Thank you Dave Syer! I will look into that :-)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24841894

http://stackoverflow.com/a/24893009
answers question: http://stackoverflow.com/q/24892965
downvote count: 0
has body: Your proble; is in TestScoresTwo class: public TestScoresTwo(double[] scores ,int sizE) { double[] tScore = scores; size = sizE; } tScore is local to the constructor. So you're assigning the passed variable to a local variable, which is lost once the end of the constructor is reached. So when you call avgGrade() to calculate the average, the array it,s calculating the average from is empty. Replace it by: public class TestScoresTwo { int size = 0; double[] tScore; // no need to create it here, it's already created and filled in outside double sum = 0; public TestScoresTwo(double[] scores ,int sizE) { this.tScore = scores; // "this." added for clarity this.size = sizE; // "this." added for clarity }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/24887724
tagged with: xsd
tagged with: java
upvote count: 1
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/24891801
answer count: 1
tagged with: c#
has body: I've an XSD file containing this: &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc" elementFormDefault="qualified" targetNamespace="http://example.org/"&gt; &lt;xsd:complexType name="Certificate"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="certificate" type="xsd:base64Binary"&gt; &lt;xsd:annotation&gt; &lt;xsd:appinfo&gt; &lt;xjc:javaType name="java.security.cert.X509Certificate" adapter="adapters.X509CertificateAdapter" /&gt; &lt;/xsd:appinfo&gt; &lt;/xsd:annotation&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:schema&gt; and when I generate java code with xjc, it produces this: public class Certificate { @XmlElement(required = true, type = String.class) @XmlJavaTypeAdapter(X509CertificateAdapter.class) @XmlSchemaType(name = "base64Binary") protected X509Certificate certificate; .... } and the adapter works fine. My question is what will happen when I will give my xsd to a no-java client? What will the Certificate C# class (for example) look like?
type: AnsweredQuestion
downvote count: 0
tagged with: adapter
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24891801
linked to: http://stackoverflow.com/q/24903790
type: Question
has title: XSD javaType adapter result in other languages

word-count
tags question: http://stackoverflow.com/q/24787781
tag name: word-count
tags question: http://stackoverflow.com/q/24789906
type: Tag

http://stackoverflow.com/a/24863028
score: 0
has comment: http://stackoverflow.com/comment/38647504
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24862780
has comment: http://stackoverflow.com/comment/38614858
type: Answer
has comment: http://stackoverflow.com/comment/38623549
accepted answer of: http://stackoverflow.com/q/24862780
has body: Your XXXLocalServiceUtil will only available withing the Portlet A. To make your services available to both portlets, make them available globally on the server level. In Tomcat you should put the services.jar file to /tomcat/lib/ext, and don't forget to remove that JAR from the portlet itself. Server must be restarted after this change.

http://stackoverflow.com/a/24905966
has body: According to the Javadoc of ConcurrentModificationException: For example, it is not generally permissible for one thread to modify a Collection while another thread is iterating over it. In general, the results of the iteration are undefined under these circumstances. Some Iterator implementations (including those of all the general purpose collection implementations provided by the JRE) may choose to throw this exception if this behavior is detected. Iterators that do this are known as fail-fast iterators, as they fail quickly and cleanly, rather that risking arbitrary, non-deterministic behavior at an undetermined time in the future. This has nothing to do with unsynchronized access. Some examples of problematic operations: the current element of the iteration is removed from the collection, what would be the next element in that case? Some element that was already iterated over is removed and re-inserted later in the collection. Should the iterator show it again when it reaches the new position?
type: Answer
answers question: http://stackoverflow.com/q/24905624
score: 0

http://stackoverflow.com/comment/38665471
has text: In many cases its easier to config in build.gradle and use Eclipse plugin to generate Eclipse project with dependencies correctly linked.
comment on: http://stackoverflow.com/q/24891104
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/50586667
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27254191
has text: The solution in @Android007's answer is the best one I have found. Other solutions have caused weird problems preventing the app from building.

http://stackoverflow.com/comment/38634308
type: QuestionComment
comment on: http://stackoverflow.com/q/24874331
has text: So you've implemented a custom ClassLoader, you're having a problem with class loading, and you don't post any of your class-loading code (neither the custom ClassLoader nor the code that uses it, including the code that builds the TCPServer object in the first place)...
score: 0
type: Comment

http://stackoverflow.com/q/24883536
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38652320
has title: How can i send an attachment through mail in android app?
score: 0
tagged with: email-attachments
has answer: http://stackoverflow.com/a/24883722
answer count: 1
has comment: http://stackoverflow.com/comment/38650932
tagged with: android
has comment: http://stackoverflow.com/comment/38650912
has body: Hi I am sending a mail through android app. I import the mail library and activation library in my app. When i send the mail has been sent successfully but the attachment is didn't. Can any tell me how can i send that also. Here is my code: public synchronized void sendMail(String body, String recipients) throws Exception { try{ MimeMessage message = new MimeMessage(session); DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain")); message.setSender(new InternetAddress("shankar.uclid@gmail.com")); message.setSubject("Request For Claim"); MimeBodyPart messageBodyPart2=new MimeBodyPart(); // creating new MimeBodyPart object and setting DataHandler to this object String filename="file:///android_asset/code.js"; //you can change according to your choice DataSource source=new FileDataSource(filename); messageBodyPart2.setDataHandler(new DataHandler(source)); messageBodyPart2.setFileName(filename); Multipart multipart=new MimeMultipart(); multipart.addBodyPart(messageBodyPart2); message.setContent(multipart); message.setDataHandler(handler); showLog("recepetent is "+recipients); if (recipients.indexOf(',') &lt; 0) message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("shankar.uclid@gmail.com")); else message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients)); Transport.send(message); }catch(Exception e){ e.printStackTrace(); } } I don't why my attachment not getting. Thank You
tagged with: sendmail
tagged with: attachment

http://stackoverflow.com/a/38502514
has body: your ant script should look like this:- <property environment="env" /> BUILD_NUMBER: ${env.BUILD_NUMBER}
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24820204

http://stackoverflow.com/q/24791932
has comment: http://stackoverflow.com/comment/38478417
has comment: http://stackoverflow.com/comment/38488910
has comment: http://stackoverflow.com/comment/38478177
answer count: 2
has comment: http://stackoverflow.com/comment/38478389
has comment: http://stackoverflow.com/comment/38478356
has comment: http://stackoverflow.com/comment/38478173
has answer: http://stackoverflow.com/a/24792189
has answer: http://stackoverflow.com/a/24792115
score: 0
tagged with: file-io
has comment: http://stackoverflow.com/comment/38478157
has comment: http://stackoverflow.com/comment/38478180
possible better answer: http://stackoverflow.com/a/24792115
has comment: http://stackoverflow.com/comment/38478530
has comment: http://stackoverflow.com/comment/38478495
has title: Using PrintWriter for file IO
tagged with: file
accepted answer: http://stackoverflow.com/a/24792189
has comment: http://stackoverflow.com/comment/38478388
has body: Ok so I'm about to start pulling my hair out. I thought file input was a little tricky, but oh man then there is file output. I am trying to write an array of coordinates stored in an object to a file. In C++ this was easy peasy, but for the love of God I cannot figure this out. public static void outFile(int intersectionsIndex, Coordinate arg[], Coordinate avgPoint) { File file = new File("resource/result.txt"); file.getParentFile().mkdirs(); PrintWriter writer = new PrintWriter(file); int i = 0; while (i &lt; intersectionsIndex) { writer.print(arg[i].getX()); writer.print(" "); writer.println(arg[i].getY()); i++; } writer.print("Predicted Coordinate: "); writer.print(avgPoint.getX()); writer.print(" "); writer.println(avgPoint.getY()); writer.close(); return; } I am constantly getting the same error no matter what method of IO I use. I followed some posts on here with similar problems but to no avail. Any suggestions or other methods? I am probably missing something basic. Edit: sorry error is Error:(83, 30) java: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown Which is the "PrintWriter writer = newPrintWriter(file); line. UPDATE: Problem solved. Working code below: public static void outFile(int intersectionsIndex, Coordinate arg[], Coordinate avgPoint) throws Exception{ File file = new File("resource/result.txt"); file.getParentFile().mkdirs(); PrintWriter writer = new PrintWriter(file); int i = 0; while (i &lt; intersectionsIndex) { writer.print(arg[i].getX()); writer.print(" "); writer.println(arg[i].getY()); i++; } writer.print("Predicted Coordinate: "); writer.print(avgPoint.getX()); writer.print(" "); writer.println(avgPoint.getY()); writer.close(); return; }
type: Question
has comment: http://stackoverflow.com/comment/38478975
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24844971
has comment: http://stackoverflow.com/comment/38965866
has title: Getting binary data directly off the windows clipboard
tagged with: clipboard
score: 9
linked to: http://stackoverflow.com/q/13094723
has comment: http://stackoverflow.com/comment/38966485
has comment: http://stackoverflow.com/comment/39007868
has comment: http://stackoverflow.com/comment/38964097
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/38689021
type: AnsweredQuestion
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38991510
tagged with: binary-data
favorite count: 0
type: Question
has body: I've been beating my head against the desk for about an hour now just trying to find some way of getting say... an array of bytes off the clipboard. Instead, all I can seem to find is information on how to get plain text from the clipboard... that's not helpful at all. I've tried following this: Java getting bytes of clipboard I've also tried following this: http://mrbool.com/manipulating-clipboard-content-with-java/24758 Every time I run into the silly DataFlavor being "unsupported". Surely there's just something simple that I'm missing here... I mean... how can it support plain text, images, and java objects, but NOT have the basic functionality that just has to be under the hood of all this? Sorry if I sound sarcastic and pissed off here... Java seems to have that effect on me. :(
has answer: http://stackoverflow.com/a/25082454
tagged with: windows
accepted answer: http://stackoverflow.com/a/25082454

http://stackoverflow.com/q/24808297
tagged with: grizzly
has comment: http://stackoverflow.com/comment/38508962
tagged with: java
has title: Jersey Test + Grizzly testing a POST method
type: Question
has comment: http://stackoverflow.com/comment/38508708
tagged with: jersey
has comment: http://stackoverflow.com/comment/38509029
has body: Assuming I have a REST method which has @Path("/Customers/Add") @POST @Produces({MediaType.APPLICATION_JSON}) @Consumes(MediaType.APPLICATION_JSON) public JSONResponse addCustomer(Customer customer){ //Post method } and I have a grizzly container + jersey test. WebResource webResource = client().resource(getBaseURI()); JSONResponse response = webResource .path("/Customers/Add") .type(MediaType.APPLICATION_JSON_TYPE) .post(hypo); my own JSONResponse class public class JSONResponse{ private boolean success; private Customer customer; public JSONResponse(){} //getters and setters } How do i write the response for a POST REST method?
score: 0
has comment: http://stackoverflow.com/comment/38509456
tagged with: junit
has comment: http://stackoverflow.com/comment/38508370
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38510309
has comment: http://stackoverflow.com/comment/38508722
has comment: http://stackoverflow.com/comment/38508637
has comment: http://stackoverflow.com/comment/38509213

http://stackoverflow.com/comment/38401836
type: Comment
score: 0
type: AnswerComment
has text: Then it is almost guaranteed that in a future version of the game the level-up criteria will be changed. I think you should find some good names for constants.
comment on: http://stackoverflow.com/a/24751772

http://stackoverflow.com/comment/38508219
type: Comment
comment on: http://stackoverflow.com/a/24789279
has text: k it is clear what u want now, so I'll edit my answer for u latter cuz I'm at work
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38645111
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24880316
score: 0
has text: (I like to avoid thinking about "memory locations" or "pointers".. leave those in C. At the low-level case, simply consider that a reference *value* is an *opaque identifier* representing an object.)

http://stackoverflow.com/q/24806299
has title: Getting userid from apache webserver after pubcookie authentication
tagged with: cookies
score: 0
tagged with: java
tagged with: session-cookies
accepted answer: http://stackoverflow.com/a/30375577
has body: I am working on an application which will use pubcookie authentication. My application runs on JBoss server and is front ended by Apache webserver which has the pubcookie setup. I have been able to setup the pubcookie module and the user authentication happens fine whenever a user tries to access a resource from my application. However, I am unable to pass the logged in user's id from apache webserver to my application running on JBoss server. I need this information in my application in order for my application to lookup its datastore and determine the users permissions. How does this information flow happen?
tagged with: apache
has comment: http://stackoverflow.com/comment/38775621
tagged with: jboss
type: AnsweredQuestion
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/30375577

http://stackoverflow.com/a/24761460
has comment: http://stackoverflow.com/comment/38420173
has comment: http://stackoverflow.com/comment/38422501
has body: Based off of Andrey's answer: public class App extends Application { private static App INSTANCE; @Override public void onCreate() { super.onCreate(); INSTANCE = this; } public static App getInstance() { return INSTANCE; } } then, in CreepsID: public class CreepIDs { public static Context context = App.getInstance(); public static enum CreepId { ROBODEE(0, resourceString(R.creeps.robodee)); public final int id; public final String name; CreepId(int id, String name){ this.id = id; this.name = name; }; }; public static String resourceString(int id){ return context.getResources().getString(id); } } You're calling a static method to get the context of App, thus giving your static class access to the resources of the Activity.
has comment: http://stackoverflow.com/comment/38420706
score: 0
answers question: http://stackoverflow.com/q/24760679
has comment: http://stackoverflow.com/comment/38420948
type: Answer

http://stackoverflow.com/q/24778058
has body: This question has been asked many times but I couldn't find the answer that fixes my issue. I'm trying to convert nested JSON format to CSV format like this : The JSON structure is arbitrary and could be anything, nested or not. I'm not suppose to know it, it's a database answer and I need to export this JSON answer into CSV file. Here is an example Input : { "_id": 1, "name": "Aurelia Menendez", "scores": [ { "type": "exam", "score": 60.06045071030959 }, { "type": "quiz", "score": 52.79790691903873 }, { "type": "homework", "score": 71.76133439165544 } ] } The output I'm looking for : _id,name,scores.type,scores.score,scores.type,scores.score,scores.type,scores.score 1,Aurelia Menendez,exam,60.06...,quiz,52.79...,homework,71.76.. This is an example, it could be any other JSON document. The idea here is to use dot notation in the CSV column name. I've already used CDL but the output is not what I want : _id scores name 1 "[{score:60.06045071030959,type:exam},{score:52.79790691903873,type:quiz},{score:71.76133439165544,type:homework}]" Aurelia Menendez So how can I convert nested JSON to CSV with dot notation and in a generic way ? Edits Deserialisation of the JSON with Jackson : ObjectMapper mapper=new ObjectMapper(); JsonNode jsonNode=mapper.readValue(new File("C:\\...\\...\...\\test.json"), JsonNode.class); Ismail
has comment: http://stackoverflow.com/comment/38451160
has comment: http://stackoverflow.com/comment/38450992
has comment: http://stackoverflow.com/comment/38457301
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38486855
has title: Convert nested arbitrary JSON to CSV in Java
has answer: http://stackoverflow.com/a/24797339
answer count: 3
has comment: http://stackoverflow.com/comment/38456678
has comment: http://stackoverflow.com/comment/38488031
has comment: http://stackoverflow.com/comment/38455853
favorite count: 0
has comment: http://stackoverflow.com/comment/38457607
has comment: http://stackoverflow.com/comment/38456549
has answer: http://stackoverflow.com/a/25863493
upvote count: 8
tagged with: http://stackoverflow.com/tag/csv
tagged with: converters
has answer: http://stackoverflow.com/a/41080726
has comment: http://stackoverflow.com/comment/38466652
has comment: http://stackoverflow.com/comment/38487141
has comment: http://stackoverflow.com/comment/38456927
linked to: http://stackoverflow.com/q/7172158
linked to: http://stackoverflow.com/q/24799457
type: UnansweredQuestion
downvote count: 1
type: Question

http://stackoverflow.com/q/24797478
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/38488288
has comment: http://stackoverflow.com/comment/38488694
has answer: http://stackoverflow.com/a/24797967
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/24797630
has body: I am trying to create table in MySql through Java program. There seems to be a error in the database query for creating table which I am not able to figure out. This is my java program package Registration; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; public class StartBatch { public void startBatch(String batch) { Connection connection=null; String connectionURL = "jdbc:mysql://localhost:3306/Batches"; Statement stmt; ResultSet rs1; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(connectionURL, "root", ""); stmt=connection.createStatement(); rs1=stmt.executeUpdate("CREATE TABLE IF NOT EXISTS `"+batch+"` (\n" +" `id` int(11) NOT NULL AUTO_INCREMENT,\n" +" `student` text NOT NULL,\n" +" `fees` bigint(20) NOT NULL,\n" +" PRIMARY KEY (`id`)\n" +") ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;"); //The error is in above query } catch(ClassNotFoundException e){ e.printStackTrace(); } catch(SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } finally { // Always close the database connection. try { if (connection != null) connection.close(); } catch (SQLException ignored){ } } } } Error: java.lang.RuntimeException: Uncompilable source code - incompatible types: int cannot be converted to java.sql.ResultSet at Registration.StartBatch.startBatch(StartBatch.java:39) at org.apache.jsp.CreatedBatch_jsp._jspService(CreatedBatch_jsp.java:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilter…
tagged with: java
has comment: http://stackoverflow.com/comment/38488270
tagged with: mysql
type: Question
has title: Error in database query
has comment: http://stackoverflow.com/comment/38488345
has comment: http://stackoverflow.com/comment/38488297
score: 0

http://stackoverflow.com/comment/38557639
has text: @AndrewStubbs It returned directories that didn't exist because(as said in the answer i got) it was trying to open a file in my working directory. I expected it to give me the directory of file.jar but it gave me the directory of file.jar where it was trying to open it(my working directory) and file.jar wasn't in my working directory.
comment on: http://stackoverflow.com/q/24807920
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24840344
score: 1
has body: In Java, generics is implemented using type erasure which means generic type information is erased at compile time. This means that the information for constructing the object isn't available at runtime.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24840307
downvote count: 0

http://stackoverflow.com/comment/38572957
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24842600
has text: Just copy and paste, it's not difficult at all, same as copying text. I really don't get why so many people have trouble with that.

http://stackoverflow.com/comment/38744707
score: 0
type: QuestionComment
type: Comment
has text: I changed the model to use a home-grown solution for performing the same authentication. It was all background authentication necessary for automated processing. I just added a pre-approval process to load the OAuth2 information I needed.
comment on: http://stackoverflow.com/q/24813303

http://stackoverflow.com/comment/38471920
comment on: http://stackoverflow.com/q/24788718
has text: The answer obviously involves lowering your CPU's clock speed.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24790860
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38476523
has comment: http://stackoverflow.com/comment/38477295
has body: The following code uses binary search on a sorted char array to efficiently check, if all characters of the string exist in the char[]. Note that binary search on an array is pretty fast due to cache locality. public String longest(char[] chars, List&lt;String&gt; strings) { char[] sorted = Arrays.copyOf(chars, chars.length); Arrays.sort(sorted); String result = null; for (String string : strings) { if (containsAll(sorted, string) &amp;&amp; (result == null || string.length() &gt; result.length())) { result = string; } } return result; } public boolean containsAll(char[] sorted, String string) { int length = string.length(); for (int i = 0; i &lt; length; ++i) { if (Arrays.binarySearch(sorted, string.charAt(i)) &lt; 0) { return false; } } return true; }
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/38476862
has comment: http://stackoverflow.com/comment/45704594
score: 2
answers question: http://stackoverflow.com/q/24790557
has comment: http://stackoverflow.com/comment/38476235
accepted answer of: http://stackoverflow.com/q/24790557

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/24854811
tags question: http://stackoverflow.com/q/24872531
tags question: http://stackoverflow.com/q/24903658
tags question: http://stackoverflow.com/q/24875676
tags question: http://stackoverflow.com/q/24778220
tags question: http://stackoverflow.com/q/24766184
tags question: http://stackoverflow.com/q/24751706
tags question: http://stackoverflow.com/q/24872732
tags question: http://stackoverflow.com/q/24904855
tags question: http://stackoverflow.com/q/24905624
tags question: http://stackoverflow.com/q/24781402
tags question: http://stackoverflow.com/q/24850530
type: Tag
tags question: http://stackoverflow.com/q/24803847
tags question: http://stackoverflow.com/q/24777920
tags question: http://stackoverflow.com/q/24810744
tags question: http://stackoverflow.com/q/24842180
tags question: http://stackoverflow.com/q/24848463
tags question: http://stackoverflow.com/q/24830515

http://stackoverflow.com/q/24792867
tagged with: android
has answer: http://stackoverflow.com/a/24792938
score: 2
type: AnsweredQuestion
has title: Null Pointer Exception in a Fragment
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24792938
tagged with: null
answer count: 2
tagged with: nullpointerexception
has body: So I'm currently learning Android and things are going well. However, after attempting to build a fragment, I am running into a Null Pointer Exception. I declared my Views in OnCreateView and that did nothing. Posted below is my code. private String TotalMoney; private BigDecimal BigDecimalTotalMoney; private SharedPreferences settings; private SharedPreferences.Editor prefEditor; @SuppressLint("SimpleDateFormat") private SimpleDateFormat ft = new SimpleDateFormat ("E MM.dd.yyyy 'at' hh:mm a"); private TextView totalMoneyTextView; private EditText Submission; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.wallettracker, container, false); TextView totalMoneyTextView = (TextView) v.findViewById(R.id.TotalMoneyTextView); EditText Submission = (EditText) v.findViewById(R.id.editTextMoney); Button submitButton = (Button) v.findViewById(R.id.submitButton); TextView dateTextView = (TextView) v.findViewById(R.id.dateTextView); Button subtractButton = (Button) v.findViewById(R.id.subtractButton); return v; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); settings = this.getActivity().getSharedPreferences("Money Data", 0); TotalMoney = settings.getString("TotalMoney", "0.00"); totalMoneyTextView.setText(DecimalFormat.getCurrencyInstance().format(Double.parseDouble(TotalMoney)).toString()); The final line, while long and very unsightly, is where the error is thrown. This code worked quite well when it was a standalone activity and I'm getting frustrated.
possible better answer: http://stackoverflow.com/a/24792945
downvote count: 0
has answer: http://stackoverflow.com/a/24792945
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/126556290
type: QuestionComment
has text: Had this same effect. Came from multiple surrounding instances: One queue was pushed, the other one consumed.
comment on: http://stackoverflow.com/q/24767438
score: 0
type: Comment

http://stackoverflow.com/q/24829831
has answer: http://stackoverflow.com/a/51464183
answer count: 4
tagged with: freebsd
has body: We have a server running FreeBSD 9.1-p17 and Jenkins. I interact with it via PuTTY. We upgraded from Jenkins 1.458 to 1.570, via FreeBSD's ports collection. Due to this problem with starting, we decided to reinstall. First we uninstalled Jenkins, then we moved the main Jenkins folder (/usr/local/eweru-dev/jenkins) to a backup location, and reinstalled (again, from the ports collection). When we reinstalled, we kept the user 'jenkins' from the last install. Now, when we try to start Jenkins, we get an error. The error below is from when we try to start it by navigating to /usr/local/share/jenkins and typing java -jar jenkins.war. When we try to run it as a service (with service jenkins onestart), we get a very similar message. The exception looks similar to the one from this blog, but I have tried connecting Jenkins to openjdk 7 and 8 to no avail. Is information from our old Jenkins install finding its way into this one, breaking stuff? Or maybe there's some compatibility issue with FreeBSD 9.1. Running from: /usr/local/share/jenkins/jenkins.war webroot: $user.home/.jenkins Jul 18, 2014 10:53:51 AM winstone.Logger logInternal INFO: Beginning extraction from war file Jul 18, 2014 10:53:51 AM org.eclipse.jetty.util.log.JavaUtilLog info INFO: jetty-8.y.z-SNAPSHOT Jul 18, 2014 10:53:55 AM org.eclipse.jetty.util.log.JavaUtilLog info INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet Jenkins home directory: /homes/maxerdwien/.jenkins found at: $user.home/.jenkins Jul 18, 2014 10:53:55 AM hudson.util.BootFailure publish SEVERE: Failed to initialize Jenkins hudson.util.AWTProblem: java.lang.NullPointerException at hudson.WebAppMain.contextInitialized(WebAppMain.java:182) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler…
score: 6
has comment: http://stackoverflow.com/comment/38556854
has comment: http://stackoverflow.com/comment/38709288
has answer: http://stackoverflow.com/a/24846112
has comment: http://stackoverflow.com/comment/38554081
has comment: http://stackoverflow.com/comment/38553954
type: AnsweredQuestion
has title: Jenkins Fails to Start
favorite count: 0
has comment: http://stackoverflow.com/comment/38626079
possible better answer: http://stackoverflow.com/a/25009830
tagged with: jenkins
type: Question
has answer: http://stackoverflow.com/a/25009830
accepted answer: http://stackoverflow.com/a/24846112
has answer: http://stackoverflow.com/a/26138073
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/38552154
downvote count: 1
has comment: http://stackoverflow.com/comment/38549150

http://stackoverflow.com/q/24749962
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24763120
tagged with: java-7
answer count: 1
downvote count: 0
has body: I am facing issue with Hibernate. Using Hibernate 3.2.6 and JDK 1.7.0_21 Is this issue coming due to JDK compatibility with Hibernate version? This issue is random. I still unable to find steps to reproduce. 2014-07-14 06:09:10,661 [DEBUG] EventExpenseAreaService.getEventSummary:654 - Revenue Value (Hari) --&gt; 1166.15 2014-07-14 06:09:18,665 [ERROR] EventSetupService.getEventById:1451 - java.lang.Boolean cannot be cast to java.lang.String java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String at org.hibernate.type.StringType.toString(StringType.java:44) at org.hibernate.type.NullableType.nullSafeToString(NullableType.java:93) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:140) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:107) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2002) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2376) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2312) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2612) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:96) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at com.sibisoft.northstar.events.service.EventSetupService.getEventById(E…
tagged with: java-6
has comment: http://stackoverflow.com/comment/38398625
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/38398699
has title: Hibernate issue java.lang.Boolean cannot be cast to java.lang.String Using JDK 1.7
score: 6
has answer: http://stackoverflow.com/a/24763120

http://stackoverflow.com/q/24878911
has comment: http://stackoverflow.com/comment/38642434
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38642907
has comment: http://stackoverflow.com/comment/38642470
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38642522
has comment: http://stackoverflow.com/comment/38642585
has comment: http://stackoverflow.com/comment/38643125
score: 1
has answer: http://stackoverflow.com/a/24880706
tagged with: java
has title: I am not getting the reason why post method is not executed
has comment: http://stackoverflow.com/comment/38642571
upvote count: 1
has comment: http://stackoverflow.com/comment/38643144
has comment: http://stackoverflow.com/comment/38642535
type: Question
tagged with: jsp
tagged with: tomcat
has body: public class ExtractProduct extends HttpServlet { private static final long serialVersionUID = 1L; public ExtractProduct() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("bye"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("hiiiii"); } } JSP Page : <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here web.xml file : <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID"> adsfa ExtractProduct ExtractProduct controller.ExtractProduct ExtractProduct /ExtractProduct.do index.html index.htm index.jsp default.html default.htm default.jsp When I have clicked the submit button the url pattern is changed and it redirects it to Extractproduct.do but "hii" is not printed to console.can anyone help me. I am not getting the reason why post method is not executed. And then I have tried to create new servlet and when I have tried to run the servelet it is showing me a error : HTTP status 500 internal server error. Though my all old servelet program run correctly.
has comment: http://stackoverflow.com/comment/38642551

http://stackoverflow.com/a/35554575
answers question: http://stackoverflow.com/q/24882927
has body: Can we try this. public static void main(String []args){ List&lt;String&gt; stringList = new ArrayList&lt;&gt;(); for(int i=0;i&lt; 10;i++){ stringList.add(""+i); } String stringConcated = String.join(",", stringList); System.out.println(stringConcated); }
score: -1
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/123086511
type: Answer

http://stackoverflow.com/a/24847347
answers question: http://stackoverflow.com/q/24847288
type: Answer
score: 1
has body: Use below layout, i think its help you <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0" android:gravity="center" android:text="cow" android:textAppearance="?android:attr/textAppearanceLarge" />
accepted answer of: http://stackoverflow.com/q/24847288
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24874396
answers question: http://stackoverflow.com/q/24873725
has body: After constant trial and error, found a solution. try { FileInputStream fis = new FileInputStream("C:\\sample\\sample.pptx"); XMLSlideShow pptxshow = new XMLSlideShow(fis); XSLFSlide[] slide2 = pptxshow.getSlides(); for (int i = 0; i &lt; slide2.length; i++) { System.out.println(i); try { XSLFNotes mynotes = slide2[i].getNotes(); for (XSLFShape shape : mynotes) { if (shape instanceof XSLFTextShape) { XSLFTextShape txShape = (XSLFTextShape) shape; for (XSLFTextParagraph xslfParagraph : txShape.getTextParagraphs()) { System.out.println(xslfParagraph.getText()); } } } } catch (Exception e) { } } } catch (IOException e) { }
score: 8
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/136596494
accepted answer of: http://stackoverflow.com/q/24873725
has comment: http://stackoverflow.com/comment/47357205

http://stackoverflow.com/q/24794104
accepted answer: http://stackoverflow.com/a/24794510
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24794510
type: AnsweredQuestion
tagged with: java
has title: upgrade JDK from 32 bit to 64 bits
has comment: http://stackoverflow.com/comment/38482381
type: Question
possible better answer: http://stackoverflow.com/a/24794303
has answer: http://stackoverflow.com/a/24794303
has body: I have a program using JDK 1.7 running on Windows Server 2008 (32 bits). If I want to re-deploy the program to the latest Windows Server (64 bits), do I need to rewrite the program or just minor change is ok? Thanks a lot!

http://stackoverflow.com/comment/38688800
type: AnswerComment
has text: Gotcha. Corrected my answer.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24901625

http://stackoverflow.com/comment/38416720
score: 0
type: Comment
type: QuestionComment
has text: @Amir Thanks, you're right. The stream was closed after the main thread goes out of the try block. And your version blow works.
comment on: http://stackoverflow.com/q/24749550

http://stackoverflow.com/comment/38587185
comment on: http://stackoverflow.com/q/24850125
score: 0
type: QuestionComment
type: Comment
has text: are you trying to upload image?

weblogic8.x
tag name: weblogic8.x
tags question: http://stackoverflow.com/q/24875521
type: Tag

http://stackoverflow.com/comment/38625488
type: QuestionComment
score: 1
has text: `if (myArray[j] == search){` use .equals()
comment on: http://stackoverflow.com/q/24870074
type: Comment

soap
tags question: http://stackoverflow.com/q/24888788
tags question: http://stackoverflow.com/q/24757834
type: Tag
tags question: http://stackoverflow.com/q/24754267
tags question: http://stackoverflow.com/q/24826166
tags question: http://stackoverflow.com/q/24825964
tags question: http://stackoverflow.com/q/24863725
tags question: http://stackoverflow.com/q/24884124
tags question: http://stackoverflow.com/q/24861321
tags question: http://stackoverflow.com/q/24754722
tags question: http://stackoverflow.com/q/24827401
tags question: http://stackoverflow.com/q/24905697
tags question: http://stackoverflow.com/q/24905615
tags question: http://stackoverflow.com/q/24864865
tags question: http://stackoverflow.com/q/24783840
tags question: http://stackoverflow.com/q/24906685
tag name: soap
tags question: http://stackoverflow.com/q/24895549
tags question: http://stackoverflow.com/q/24779373
tags question: http://stackoverflow.com/q/24858464
tags question: http://stackoverflow.com/q/24759707

http://stackoverflow.com/comment/38669951
type: Comment
has text: In the message starting "OK my project directory" you give a series of commands which are completely different from the commands I had just given you in the previous message beginning "let's start again". You're trying everything *except* what I'm telling you. It's pointless to continue with this.
comment on: http://stackoverflow.com/a/24797053
type: AnswerComment
score: 0

http://stackoverflow.com/a/24835379
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38589716
has comment: http://stackoverflow.com/comment/38595058
score: 1
answers question: http://stackoverflow.com/q/24835281
has body: You are running the command from the lab001 directory. The path student/Student.java isn't valid from that location. You either need to move the makefile to the toplevel directory (and add lab001 to the Human.java and Human.class entries) or use ../student/Student.java and ../student/Student.class. There are plenty of other things that could be done to improve this makefile as well but those are the root of your problem.

http://stackoverflow.com/comment/38560352
type: QuestionComment
comment on: http://stackoverflow.com/q/24835084
score: 0
has text: Is profiling set properly for your development access?
type: Comment

http://stackoverflow.com/comment/99379384
score: 0
comment on: http://stackoverflow.com/a/24756057
type: AnswerComment
type: Comment
has text: @oberlies: you are right. I modified my answer: use `ConfigurableApplicationContext` instead of `ConfigurableWebApplicationContext`

http://stackoverflow.com/q/24875113
downvote count: 0
has body: I have been searching for hours and cannot find the answer. CyanogenMOD ROM lets you dump the heap of ANY process, DDMS shows EVERY process when you plug the device in. How can I make a stock rom hold the same power? I have root on the device, and I have to hide it from the apps in a special way, otherwise I would flash a custom ROM. What makes a device spill its guts to DDMS when loaded with a custom ROM? I could set debug flag on app and rebuild, but I don't want to trip the tamper detection, and mitigate that protection measure. Example: I plug in my stock device (Galaxy Tab 2 7") and not one process shows up in DDMS. Plug in cyanogen (Galaxy S3) device and it shows everything and allows heap dumps.
has answer: http://stackoverflow.com/a/24875613
tagged with: ddms
favorite count: 0
tagged with: android
has title: What makes CyanogenMod in DDMS allow heap dumps regarless of their debug flag?
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/34907629
score: 1
tagged with: java
tagged with: heap-dump
tagged with: debugging
answer count: 2

http://stackoverflow.com/comment/38469234
comment on: http://stackoverflow.com/a/24786639
has text: Thanks, it is much better now, but can you write where I have to update the `res` array?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38428401
type: Comment
has text: @Andrew_CS 1st how do i use the chat? here is some more info Array<Rectangle> chickens; chickens = new Array<Rectangle>(); pls c http://stackoverflow.com/questions/24763379/controlling-and-creating-multiple-sprites-array-java-libgdx?noredirect=1#comment38425579_24763379 another question which should provide more info
comment on: http://stackoverflow.com/q/24764968
score: 0
type: QuestionComment

http://stackoverflow.com/q/24895403
has answer: http://stackoverflow.com/a/24895443
has comment: http://stackoverflow.com/comment/38673595
tagged with: android-activity
tagged with: http://stackoverflow.com/tag/xml
has body: I'm trying to achieve a search activity where when the search button is clicked from the action bar, a list is shown with possible products. I'm trying to connect my search button with my list view but have been unsuccessful. MainActivity.java private ListView lv; // Listview Adapter ArrayAdapter&lt;String&gt; adapter; // Search EditText EditText inputSearch; // ArrayList for Listview ArrayList&lt;HashMap&lt;String, String&gt;&gt; productList; @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); // Listview Data String products[] = {"A", "B", "C", "D", "fdsafds", "fdsavds", "fdsafdsafsd", "greadgfd", "F", "thrgefargra"}; lv = (ListView) findViewById(R.id.list_view); inputSearch = (EditText) findViewById(R.id.inputSearch); // Adding items to listview // adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, R.id.product_name, products); // lv.setAdapter(adapter); return true; } menu.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/inputSearch" android:title="Search places" android:hint="Search places..." android:layout_width="match_parent" android:layout_height="wrap_content" android:icon="@drawable/ic_action_search" android:showAsAction="collapseActionView|ifRoom" android:actionViewClass="android.widget.SearchView" /&gt; &lt;ListView android:id="@+id/list_view" android:layout_width="fill_parent" android:layout_height="29dp"/&gt; list_item.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;!-- Single ListItem --&gt; &lt;ListView android:id="@+id/list_item" android:layout_width="fill_parent" android:layout_height="150dp" android:padding="10dip" android:textSize="16dip" android:textStyle="bold"/&gt; &lt;!-- Product Name --&gt; &lt;TextVie…
type: UnansweredQuestion
tagged with: java
has title: Why doesnt the listview show up when search is clicked?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24895558
score: 0
tagged with: android

http://stackoverflow.com/a/24764516
has body: Try this EditText ed = (EditText) findViewById(R.id.ediText); String temp = ed.getText().toString(); boolean status = myArrayList.contains(temp); or EditText ed = (EditText) findViewById(R.id.ediText); String s = ed.getText().toString(); for(String temp: myArrayList){ if(temp.equals(s)){ return true; } return false; }
type: Answer
answers question: http://stackoverflow.com/q/24764328
score: 0

http://stackoverflow.com/q/24879353
type: Question
has answer: http://stackoverflow.com/a/24879670
has comment: http://stackoverflow.com/comment/38643187
answer count: 2
has answer: http://stackoverflow.com/a/24880498
has title: I want to change value of XML tag in java
has body: Here is my XML: infadf tcslkvcvo@123 dbo OLD 600687 first I want to change value of tag "status" to "NEW". Below is my java code: DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = null; try { dBuilder = dbFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(new File(path).exists()) { Document doc = null; try { doc = dBuilder.parse(path); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("Connection"); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); Element eElement = (Element) nNode; if (nNode.getNodeType() == Node.ELEMENT_NODE) { } if(eElement.getElementsByTagName("status").item(0).getTextContent().equalsIgnoreCase("OLD")) { eElement.getElementsByTagName("status").item(0).setTextContent("NEW"); } } } The value of status tag is not getting changed in XML. Please help.
linked to: http://stackoverflow.com/q/4412848
has comment: http://stackoverflow.com/comment/38643154
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38643153
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/38673623
score: 0
comment on: http://stackoverflow.com/q/24894571
type: Comment
type: QuestionComment
has text: You can certainly `select` and `insert`; it just doesn't have a connection to the file on disk. `insert` modifies a graph in the dataset. Using SPARQL updates you can create (and delete) graphs, and those wouldn't correspond to files on disk. That said, I'm not all that familiar with Fuseki's implementation; it may well be possible to add a hook or something that *would* write changes to a graph down to a corresponding file on disk.

http://stackoverflow.com/q/24837831
type: UnansweredQuestion
has title: Storing files to MySQL using jdbc code
has comment: http://stackoverflow.com/comment/38563885
answer count: 1
linked to: http://stackoverflow.com/q/1194990
has answer: http://stackoverflow.com/a/24837875
has comment: http://stackoverflow.com/comment/38565145
type: Question
tagged with: jdbc
has body: I am unable to store image into MySQL database through the jdbc code below: package com.jlcindia.jdbcfiles; import java.sql.*; import java.io.*; public class Test1 { public static void main(String []args){ Connection con=null; PreparedStatement ps=null; try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/jlcstudents","root","garima"); ps=con.prepareStatement("insert into filetest (cno,file) values(1,?)"); File image=new File("C:\\html images\\MickeyMouse.jpg"); FileInputStream fis=new FileInputStream(image); ps.setBinaryStream(2, fis); ps.execute(); System.out.println("Record Inserted"); } catch (Exception e) { e.printStackTrace(); } finally{ try { if(ps!=null) ps.close(); if(con!=null) con.close(); } catch (Exception e2) { e2.printStackTrace(); } } } } Error in console is as: Exception in thread "main" java.lang.AbstractMethodError: com.mysql.jdbc.PreparedStatement.setBinaryStream(ILjava/io/InputStream;)V at com.jlcindia.jdbcfiles.Test1.main(Test1.java:19)
score: 0
has comment: http://stackoverflow.com/comment/38563805
has comment: http://stackoverflow.com/comment/38563803
tagged with: java

http://stackoverflow.com/a/24796258
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24796229
has body: Try this.. Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.HOUR_OF_DAY, 4); SimpleDateFormat dataFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); String strTime = dataFormat.format(calendar.getTime());
accepted answer of: http://stackoverflow.com/q/24796229
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/38622475
score: 1
has text: The line ```if (!memoized.containsKey(n))``` seems unnecessary, since if n wasn't in the memoized data structure at the start of the function, it wouldn't be in it at that point (unless you have multiple threads changing the structure).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24867140

swing
tags question: http://stackoverflow.com/q/24906226
tags question: http://stackoverflow.com/q/24798893
tags question: http://stackoverflow.com/q/24815413
tags question: http://stackoverflow.com/q/24888482
tags question: http://stackoverflow.com/q/24807274
tags question: http://stackoverflow.com/q/24760176
tags question: http://stackoverflow.com/q/24847213
tags question: http://stackoverflow.com/q/24824686
tags question: http://stackoverflow.com/q/24828676
tags question: http://stackoverflow.com/q/24832657
tags question: http://stackoverflow.com/q/24855191
tags question: http://stackoverflow.com/q/24790117
tags question: http://stackoverflow.com/q/24840860
tags question: http://stackoverflow.com/q/24843861
tags question: http://stackoverflow.com/q/24848314
tags question: http://stackoverflow.com/q/24889282
tags question: http://stackoverflow.com/q/24840122
tags question: http://stackoverflow.com/q/24853317
tags question: http://stackoverflow.com/q/24852223
tags question: http://stackoverflow.com/q/24876778
tags question: http://stackoverflow.com/q/24859212
tags question: http://stackoverflow.com/q/24844066
tags question: http://stackoverflow.com/q/24754450
tags question: http://stackoverflow.com/q/24850292
tags question: http://stackoverflow.com/q/24846285
tags question: http://stackoverflow.com/q/24844108
tags question: http://stackoverflow.com/q/24835638
tags question: http://stackoverflow.com/q/24824383
tags question: http://stackoverflow.com/q/24785353
tags question: http://stackoverflow.com/q/24830075
tags question: http://stackoverflow.com/q/24866220
tags question: http://stackoverflow.com/q/24908569
tags question: http://stackoverflow.com/q/24772268
tags question: http://stackoverflow.com/q/24844559
tags question: http://stackoverflow.com/q/24815892
tags question: http://stackoverflow.com/q/24814474
tags question: http://stackoverflow.com/q/24813686
tags question: http://stackoverflow.com/q/24802523
tags question: http://stackoverflow.com/q/24751157
tags question: http://stackoverflow.com/q/24783935
tags question: http://stackoverflow.com/q/24837771
tags question: http://stackoverflow.com/q/24904060
tags question: http://stackoverflow.com/q/24770777
tags question: http://stackoverflow.com/q/24811428
tags question: http://stackoverflow.com/q/24838585
tags question: http://stackoverflow.com/q/24855448
tags question: http://stackoverflow.com/q/24826808
tags question: http://stackoverflow.com/q/24801447
tags question: http://stackoverflow.com/q/24760005
tags question: http://stackoverflow.com/q/24771356
tags question: http://stackoverflow.com/q/24879701
tags question: http://stackoverflow.com/q/24863391
tags question: http://stackoverflow.com/q/24835682
tags question: http://stackoverflow.com/q/24807952
tags question: http://stackoverflow.com/q/24875697
tags question: http://stackoverflow.com/q/24853447
tags question: http://stackoverflow.com/q/24825841
tags question: http://stackoverflow.com/q/24849691
tags question: http://stackoverflow.com/q/24855827
tags question: http://stackoverflow.com/q/24901347
tags question: http://stackoverflow.com/q/24858259
tags question: http://stackoverflow.com/q/24884169
tags question: http://stackoverflow.com/q/24840596
type: Tag
tags question: http://stackoverflow.com/q/24888901
tags question: http://stackoverflow.com/q/24778185
tags question: http://stackoverflow.com/q/24905775
tags question: http://stackoverflow.com/q/24860389
tags question: http://stackoverflow.com/q/24816652
tags question: http://stackoverflow.com/q/24856918
tags question: http://stackoverflow.com/q/24781625
tags question: http://stackoverflow.com/q/24844628
tags question: http://stackoverflow.com/q/24799301
tags question: http://stackoverflow.com/q/24854245
tags question: http://stackoverflow.com/q/24836693
tags question: http://stackoverflow.com/q/24782145
tags question: http://stackoverflow.com/q/24899854
tags question: http://stackoverflow.com/q/24753817
tags question: http://stackoverflow.com/q/24836853
tags question: http://stackoverflow.com/q/24901320

http://stackoverflow.com/q/24879303
tagged with: java
has comment: http://stackoverflow.com/comment/38645733
score: 24
downvote count: 1
has answer: http://stackoverflow.com/a/24881306
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38643039
linked to: http://stackoverflow.com/q/5291041
has comment: http://stackoverflow.com/comment/38664639
has comment: http://stackoverflow.com/comment/38644020
has comment: http://stackoverflow.com/comment/38643089
has title: Making a Thread to Sleep for 30 minutes
tagged with: thread-sleep
favorite count: 0
has comment: http://stackoverflow.com/comment/38643052
upvote count: 25
has comment: http://stackoverflow.com/comment/38643141
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38643093
tagged with: multithreading
has body: I want to make my thread to wait for 30 minutes. Are there any problems of doing this?
has comment: http://stackoverflow.com/comment/38643166
has comment: http://stackoverflow.com/comment/38645698
has comment: http://stackoverflow.com/comment/38643074
has answer: http://stackoverflow.com/a/24879869

http://stackoverflow.com/comment/38650061
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/24866702
has text: Hi Thanks for reply , What happening here is when I call BeanUtils.copyProperties(b, destination); the properties which are copied by BeanUtils.copyProperties(a, destination); are getting overridden and getting null values for some properties
type: Comment

http://stackoverflow.com/q/24853417
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24853550
score: 0
answer count: 2
has body: I extended class View to create a custom view (at the moment the class might not make any practical sense - please ignore it ;>): package com.example.splittheisland; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.TextView; public class BoardView extends View { private Paint mPaintGrid = new Paint(); private Paint mPaintContour = new Paint(); public BoardView(Context c) { super(c); init(); } public BoardView(Context c, AttributeSet attrs) { super(c, attrs); init(); } public BoardView(Context c, AttributeSet attrs, int defStyles) { this(c, attrs); init(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawLine(100,100,200,200+counter*100,mPaintContour); } private void init() { mPaintGrid.setColor(Color.BLACK); mPaintGrid.setStrokeWidth(2); mPaintContour.setColor(Color.BLACK); mPaintContour.setStrokeWidth(8); mPaintGrid = new Paint(); mPaintContour = new Paint(); } static int counter = 0; @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: counter++; invalidate(); break; case MotionEvent.ACTION_MOVE: TextView textView = (TextView) findViewById(R.id.textView1); textView.setText(Integer.toString(counter++)); break; case MotionEvent.ACTION_UP: counter--; invalidate(); break; } return true; } } and my activity_board.xml: <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:textColor="#FFFFFF" android:textSize="30dp" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:textColor="#FFFFFF" android:textSize="30dp" /> <com.example.splittheisland.BoardView android:id="@+id/BoardView1" android:layout_width="matc…
has comment: http://stackoverflow.com/comment/38593629
type: UnansweredQuestion
tagged with: android
has title: Android how to get a TextView reference id from within a custom created view?
has answer: http://stackoverflow.com/a/24853553

http://stackoverflow.com/comment/63861028
has text: @ThiagoKronig Is the link broken? I don't see any BiMultimap in Guava in the source, wiki or javadocs.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24850359
type: Comment

http://stackoverflow.com/comment/38906831
comment on: http://stackoverflow.com/a/24819143
has text: I have mis-import the Type framework. Seems to be 'import java.lang.reflect.Type;'. Solved. Thank you for everyone who gave answers on this question.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38687172
type: QuestionComment
has text: Use a [`JTable`](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html) for displaying the CSV content.
score: 2
comment on: http://stackoverflow.com/q/24902673
type: Comment

http://stackoverflow.com/comment/51273633
score: 0
type: AnswerComment
type: Comment
has text: Like I mentioned above, I only managed a workaround involving the low-level HttpServletRequest.
comment on: http://stackoverflow.com/a/25051912

http://stackoverflow.com/a/24797423
score: 0
downvote count: 2
answers question: http://stackoverflow.com/q/24797238
type: Answer
has body: Unity uses 2 or 3 languages main being C# and javascript If you are good at C++ and Java .. I would recommend you either (http://www.cocos2d-x.org) which is an open source C++ based game engine or try (libgdx) which is a java based game engine!
upvote count: 2

http://stackoverflow.com/a/24805904
answers question: http://stackoverflow.com/q/24805682
type: AcceptedAnswer
score: 5
type: Answer
has body: It is absolutely not safe to embed sensitive strings into your code. Proguard obfuscates the class and method names, but any defined strings remain completely unchanged. Here's an example from an app that I've run through Proguard. You can see that the method and class names are obfuscated, but the strings (as they must be) are unchanged. Here is the original code: public void shutdown() { if (logger.logDebug()) { logger.logDebug(LOGTAG, "Queuing shutdown message ..."); } queueMessage(new BaseMessage(true)); } And the obfuscated code, easily obtained by JD-GUI: public void c() { if (c.logDebug()) c.logDebug("MsgRouter", "Queuing shutdown message ..."); a(new a(true)); } If you embed sensitive data in a String in your app, it can and will be decompiled.
upvote count: 6
has comment: http://stackoverflow.com/comment/54219229
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24805682

http://stackoverflow.com/comment/38517149
type: QuestionComment
has text: The **javax.persistence.Entity** is a class of the library **javaee.jar**. Do you have this jar in your project classpath?
comment on: http://stackoverflow.com/q/24812730
score: 0
type: Comment

http://stackoverflow.com/a/24902687
has comment: http://stackoverflow.com/comment/45312710
has comment: http://stackoverflow.com/comment/38712099
downvote count: 0
has comment: http://stackoverflow.com/comment/38706720
accepted answer of: http://stackoverflow.com/q/24768377
has comment: http://stackoverflow.com/comment/38719842
has comment: http://stackoverflow.com/comment/38718843
answers question: http://stackoverflow.com/q/24768377
has body: UPDATE: There is a bug in Tomcat's (at least as of 8.0.9) jsp-api.jar. According to the change log, it is fixed in Tomcat version 8.0.15. As a workaround, in the apache-tomcat-8.0.9\lib folder replace jsp-api.jar with javax.servlet.jsp-api-2.3.2-b01.jar. Refresh the project in eclipse and you will see the output for Testing: ${Boolean.TRUE} as: Testing: true This was identified as a bug in GLASSFISH as well here. In order to access static fields or methods outside of the java.lang package, those specific packages or classes must be added to the EL context (also discussed by BalusC here). Here's an example allowing static access to classes in the java.time package for all jsp files in your web application: @WebListener public class Config implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent event) { JspFactory.getDefaultFactory().getJspApplicationContext(event.getServletContext()).addELContextListener((ELContextEvent e) -&gt; { e.getELContext().getImportHandler().importPackage("java.time"); }); } @Override public void contextDestroyed(ServletContextEvent event) {} } And now from the jsp, to return the current LocalDate, for example: ${LocalDate.now()} Note that ${java.time.LocalDate.now()} does not work.
score: 7
has comment: http://stackoverflow.com/comment/38719613
has comment: http://stackoverflow.com/comment/38722004
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38704860
has comment: http://stackoverflow.com/comment/38721182
type: Answer

http://stackoverflow.com/comment/38578344
comment on: http://stackoverflow.com/a/24844672
score: 0
type: AnswerComment
type: Comment
has text: @MadProgrammer sorry I didn't get your point. `new JScrollPane(area)` adds the area in the viewport of scroll pane.

http://stackoverflow.com/comment/38629040
comment on: http://stackoverflow.com/q/24871683
type: Comment
score: 0
has text: @GriffeyDog yeah, I realize that. However I think it's bad design to be dealing with those exceptions (checked or unchecked) that are thrown from the data layer at the REST layer. The Business Services layer should translate them (somehow)
type: QuestionComment

http://stackoverflow.com/a/24855342
upvote count: 1
has body: Try it again after removing below line from your code. background.setLayout(new GridBagLayout()); and simply add main panel in background panel. background.add(main); For further reading, please follow Swing Tutorial on How to Use Various Layout Managers Is this what you want?
answers question: http://stackoverflow.com/q/24855191
type: Answer
has comment: http://stackoverflow.com/comment/38603081
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38602991

http://stackoverflow.com/comment/38483584
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24794876
has text: You have two options: put encoding into your text file which is a bit tricky because of ESC character or read your file line by line and do encoding on the fly. The latter I think will be easier. `Scanner` class is good at reading lines from text files.
type: AnswerComment

http://stackoverflow.com/a/24895678
has body: I would urge you to study how the XStreams library works instead of copying existing (badly implemented code) and try to modify it to your needs. What you could do is to add a root class, which holds collection of your items. static class Root{ List&lt;Item&gt; item = new ArrayList&lt;Item&gt;(); public List&lt;Item&gt; getitem() { return item; } public void setBeans(List&lt;Item&gt; item) { this.item = item; } } in your process method, you then set the following properties to xStream. xstream.alias("root", Root.class); xstream.alias("item", Item.class); //I renamed the bean class to item here. xstream.addImplicitCollection(Root.class, "item"); and in your while loop, you would then add the items to the root class and write out the XML after the loop. while (line != null) { String[] split = line.split(","); Item item = new Item(new Integer(split[0]),split[1]); root.getitem().add(item); line = br.readLine(); } createBeanFile(root); Hopefully this will get your started.
accepted answer of: http://stackoverflow.com/q/24894108
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24894108
type: Answer

http://stackoverflow.com/a/24934278
type: Answer
has comment: http://stackoverflow.com/comment/41328690
has body: This was finally solved but required multiple changes. I updated the jdk to 7 on the node running Jenkins. I updated the android sdk tools I added the following to proguard: -dontwarn com.facebook.android.BuildConfig -dontwarn rx.** -dontwarn okio.** -dontwarn com.squareup.okhttp.* -dontwarn retrofit.appengine.UrlFetchClient -keepattributes *Annotation* -keep class retrofit.** { *; } -keepclasseswithmembers class * { @retrofit.http.* &lt;methods&gt;; } -keepattributes Signature
upvote count: 18
downvote count: 0
score: 18
answers question: http://stackoverflow.com/q/24871219

http://stackoverflow.com/comment/129327608
comment on: http://stackoverflow.com/a/24921670
has text: Ip address is optional on the original request that created the tgt
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24781398
type: Question
linked to: http://stackoverflow.com/q/94361
has title: Java using Comparator
linked to: http://stackoverflow.com/q/4108604
tagged with: comparator
answer count: 2
has answer: http://stackoverflow.com/a/24781479
favorite count: 0
has body: I am implementing Comparator and Comparable in my class Employee to sort an arraylist. I am sorting on 2 parameters name and ID. While sorting with ID using Collections.sort(Employee ob1, Employee ob2) it doesn't work. I get the compilation error that the class is not declared abstact and i am not overriding compare(), although i am doing it as: public int compare(Employee ob1, Employee ob2) { return ob1.id-ob2.id; } it works fine if i use public int compare(Object ob1, Object ob2) { return ((Employee)ob1).id-((Employee)ob2).id; } My doubt is why does't the earlier one work since Employee is also an Object. The same issue is with compareTo(Object ob) as well, While overriding why can't i use Employee directly and why do i need to use Object there and later need to cast it to Employee class.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24781608
has comment: http://stackoverflow.com/comment/38457485
score: 2
upvote count: 3
tagged with: java
tagged with: comparable
has comment: http://stackoverflow.com/comment/38457457
downvote count: 1

http://stackoverflow.com/q/24902760
has answer: http://stackoverflow.com/a/25763753
type: Question
has answer: http://stackoverflow.com/a/25500375
tagged with: java
downvote count: 0
tagged with: progressdialog
favorite count: 0
tagged with: android-internet
answer count: 3
has title: How to set time limit for waiting internet Connection in android AsyncTask?
has body: I have use The AsyncTask For connecting Internet. a Progress dialog can show at onPreExecute() and i check is Online of that mobile if yes means it will execute the http connections code also dismiss the progress dialog at onPostExecute() and its work as good. But i have problem if net connection is available at time of Request and connection closed before get Response means the Progress dialog showing always. Now i want solve this if interconnect disconnect before get Response mean it's alert me as No internet connection and dismiss the progress dialog (may set loading time limit for 30 seconds). below is my code. can any one help? public class SubjectTask extends AsyncTask&lt;Void, Void, Integer&gt; { @Override protected void onPreExecute() { progressDialog = ProgressDialog.show(Login.this, "Loading", "Please wait..."); //checkConnection(); } @Override protected Integer doInBackground(Void... arg0) { if (isOnline()) { //using ConnectivityManager And Network Info try { //Http Request connections } catch (Exception e) { e.printStackTrace(); } return 1; } else { alert("Check your internet connection"); return 0; } } protected void onPostExecute(Integer result) { super.onPostExecute(result); if (progressDialog.isShowing()) { progressDialog.dismiss(); } } }
has answer: http://stackoverflow.com/a/25499570
tagged with: android-asynctask
score: 2
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/24885382
has comment: http://stackoverflow.com/comment/38664786
type: AcceptedAnswer
downvote count: 0
has body: If you rename your Authenticator class to SMTPAuthenticator, you should also change the line: Authenticator authenticator = new Authenticator(); to SMTPAuthenticator authenticator = new SMTPAuthenticator(); The reason you get the error is that only the SMTPAuthenticator class contains the getPasswordAuthentication() method, not the base Authenticator class
has comment: http://stackoverflow.com/comment/38657561
has comment: http://stackoverflow.com/comment/38657652
has comment: http://stackoverflow.com/comment/38664514
type: Answer
has comment: http://stackoverflow.com/comment/38653895
answers question: http://stackoverflow.com/q/24885134
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24885134
score: 2

http://stackoverflow.com/comment/38549809
score: 0
type: Comment
type: QuestionComment
has text: Write this code in IDE and play around. See where do we have add() implementation ...
comment on: http://stackoverflow.com/q/24830205

http://stackoverflow.com/a/24768081
has body: Smaller values comes first before the greater ones. Change your Comparator as below class CustomComparator implements Comparator&lt;String&gt; { @Override public int compare(String a, String b) { if(a.contains("-") &amp;&amp; !b.contains("-")) return -1; else if(!a.contains("-") &amp;&amp; b.contains("-")) return 1; return a.compareTo(b); } }
answers question: http://stackoverflow.com/q/24767022
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/26529164
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24799162
has body: Update JBoss Tools with the last release : http://tools.jboss.org/downloads/jbosstools/luna/4.2.0.Final.html#update_site
downvote count: 0
type: Answer

http://stackoverflow.com/q/24890914
has title: Is there a recursive version of BeanUtils.populate?
upvote count: 4
downvote count: 0
favorite count: 0
type: Question
has body: org.apache.commons.beanutils.BeanUtils: BeanUtils.populate(Object bean, Map&lt;String,? extends Object&gt; properties); Populate the JavaBeans properties of the specified bean, based on the specified name/value pairs. Is there a recursive version of BeanUtils.populate? class Person { String name; Address address; } class Address { String street; int number } so that calling populate on Person, it would also populate address (assuming Address has a default constructor).
score: 4
has answer: http://stackoverflow.com/a/24891941
answer count: 1
tagged with: apache-commons
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/24834449
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/60214113
has comment: http://stackoverflow.com/comment/38624197
score: 4
tagged with: playframework
tagged with: amazon-ec2
answer count: 1
tagged with: amazon-web-services
has body: I am runnung Java Play on an ec2. When I started up my Play on prod, everything works great. However, after running it about a day, I will start seeing UnknownHostException when connecting to RDS instance. This prevents any transaction between ec2 and rds. If I restart the app again, it works fine again. I already checked the connection pool and I am pretty sure it works fine. Also, I already tested this with networkaddress.cache.ttl = 0 and networkaddress.cache.negative.ttl = 0. However, I am still getting the error. Anyone has thoughts on this?
favorite count: 0
has title: AWS EC2 Interminent UnknownHostException when trying to connect to RDS
type: UnansweredQuestion
tagged with: dns
has comment: http://stackoverflow.com/comment/39049813
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/39073098

http://stackoverflow.com/q/24865280
accepted answer: http://stackoverflow.com/a/24867001
answer count: 2
has body: I am creating an app that you can use to design custom buttons easily by setting all the settings in the app and immediatly being able to see a preview. For the button, I use a shape and I have set that shape as the background. In the shape I have the normal android:width="" and android:color="" codes but I need to be able to change these in the app itself. I already have this for other aspects such as the corners using a drawable (see my question about that (solved) here.) I already tried things like drawable.setStroke() but this doesn't seem to work.
possible better answer: http://stackoverflow.com/a/24865653
has title: Set stroke width and color of a shape in java
score: 0
tagged with: android
favorite count: 0
upvote count: 1
downvote count: 1
tagged with: stroke
has answer: http://stackoverflow.com/a/24865653
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24867001

http://stackoverflow.com/q/24787958
has comment: http://stackoverflow.com/comment/38473462
has comment: http://stackoverflow.com/comment/38474335
has comment: http://stackoverflow.com/comment/38473658
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38473355
tagged with: android
has comment: http://stackoverflow.com/comment/38473582
tagged with: android-intent
has comment: http://stackoverflow.com/comment/38473686
has body: I have a picture stored in my internal application storage, and I want to open it with android default application (gallery or any other). So I'm using a FileProvider, my code works fine on android 4.3, but on some versions (2.3.6 for example), it doesn't work, the application open itself but then blackscreen, nothing. My app needs to be API-10 compatible I read many topics relating this problem, nothing seems to fix it. The code is probably not wrong since it works on 4.3... Any thought? My code to launch the activity : File file = getMyFile(); Uri contentUri = FileProvider.getUriForFile(getContext(), &lt;full-path-to-my-activity&gt;, file); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(contentUri, "image/*"); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent = Intent.createChooser(intent, "Open with"); startActivity(intent); in my manifest : &lt;provider android:name="android.support.v4.content.FileProvider" android:authorities="&lt;full-path-to-my-activity&gt;" android:exported="false" android:grantUriPermissions="true"&gt; &lt;meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider"/&gt; &lt;/provider&gt; my provider.xml : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;paths&gt; &lt;files-path name="pictures" path=""/&gt; &lt;/paths&gt;
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38473777
has comment: http://stackoverflow.com/comment/38474891
has comment: http://stackoverflow.com/comment/38473482
has comment: http://stackoverflow.com/comment/38473419
type: Question
tagged with: android-contentprovider
has comment: http://stackoverflow.com/comment/38475262
has title: Open image (InternalStorage) with android default application using FileProvider
score: 0

http://stackoverflow.com/a/25222315
score: 1
has body: The layout of your tweetstream-archive.tar.gz does not match the one of an OpenShift deployment archive. For WildFly the correct layout would be: build_dependencies/ dependencies/ jbosseap/ deployments/ tweetstream.war repo/ .openshift/ # optional That is the WAR file has to be in the directory dependencies/jbosseap/deployments and the binary-deployment directory must not be part of the archive. See also: https://www.openshift.com/kb/kb-e1088-how-to-deploy-pre-compiled-java-applications-war-and-ear-files-onto-your-openshift-gear
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24856603
accepted answer of: http://stackoverflow.com/q/24856603
downvote count: 0

http://stackoverflow.com/q/24782145
answer count: 2
has answer: http://stackoverflow.com/a/24782808
has comment: http://stackoverflow.com/comment/38459198
has comment: http://stackoverflow.com/comment/38459041
linked to: http://stackoverflow.com/q/22744920
has comment: http://stackoverflow.com/comment/38458805
possible better answer: http://stackoverflow.com/a/24782808
tagged with: imageicon
has comment: http://stackoverflow.com/comment/38458811
downvote count: 0
has answer: http://stackoverflow.com/a/24782639
linked to: http://stackoverflow.com/q/9864267
has body: I know that the method returns -1 when it couldn't get the width or height of the image, but I hope you can tell me why it can't manage to do that. Here I create a few ImageIcons and save them in an Image Array: for(int x = 0; x &lt; playerSprites.length; x++){ playerSprites [x] = new ImageIcon("player" + x + ".png").getImage() } Later I create an instance of the class which only creates this Array at the moment. When I then want to get the images from the Array in the other class I check their height and width and I always get -1 on both: public Image nextImage(String name){ Image image = null; if(name.equals("player")){ if(counter == animationImageManager.getPlayerSprites().length-1){ counter = 0; } image = animationImageManager.getPlayerSprites()[counter]; counter++; } return image; }
has title: Java swing Image always has height and width of -1
favorite count: 0
has comment: http://stackoverflow.com/comment/38459327
has comment: http://stackoverflow.com/comment/38458905
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38458907
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24782639
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38460333
type: Question

http://stackoverflow.com/comment/38573230
type: Comment
type: QuestionComment
has text: Maybe check if the server your testing/using this on has a plugin that ops everybody... Also double-check the tester isn't an op (I know, it sounds stupid, but that may be the problem), and maybe delete the `ops.json`/`ops.txt` file if you need to
score: 1
comment on: http://stackoverflow.com/q/24838008

http://stackoverflow.com/comment/38615176
score: 0
comment on: http://stackoverflow.com/q/24864416
type: Comment
type: QuestionComment
has text: Without further insight, I would guess that 'bill.jpg' is not in the root folder, which is served by your server. Perhaps it lives in a subdirectory. Maybe http://stackoverflow.com/questions/15071517/path-for-images-folder-in-gwt-project is of value.

http://stackoverflow.com/q/24813110
score: 5
tagged with: android
has answer: http://stackoverflow.com/a/24813253
has answer: http://stackoverflow.com/a/24813172
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/38518088
has answer: http://stackoverflow.com/a/55411385
has comment: http://stackoverflow.com/comment/38517662
has comment: http://stackoverflow.com/comment/42477610
has comment: http://stackoverflow.com/comment/38517702
has comment: http://stackoverflow.com/comment/38517591
has body: I want to execute a piece of code (say, for example, display a Toast) every time that the app is opened. So far I have managed to do this every time the app is launched by putting the code into my MyApp.java file that extends Application. However, if I press the homescreen or back out of the app and then go into it, the message doesn't reappear. It only does when I relaunch the app. Any idea how to do this? EDIT: basically im asking how to execute code everytime the whole APP is brought to foreground (this can be first time open, after another app was used, after user backed out of app, etc). Where would I place onResume code? It wouldn't be in a particular activity, would it, since I want it to apply when entire app appears in foreground, not just particular activity.
upvote count: 5
type: UnansweredQuestion
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/2166961
type: Question
linked to: http://stackoverflow.com/q/4436035
has title: How to execute code everytime app opens Android

http://stackoverflow.com/q/24880316
linked to: http://stackoverflow.com/q/40480
type: Question
has comment: http://stackoverflow.com/comment/38645079
duplicate of: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/38645111
has body: I am writing a static analysis tool for Java programs. And during analysis of assignment operators, for example, I want to know if underlying objects are using copy-by-value or copy-by-reference. In case of primitive data types, I know, variables use copy-by-value. int x = 5; int y = x; // Both are pointing to independent memory locations. In case of objects, usually they copy reference value of other objects. For example, MyClass obj1 = new MyClass(); MyClass obj2 = obj1; // Both instances pointing to the same memory location. However, in special cases, such as String str1 = "myString"; String str2 = str1; // Both pointing to independent memory locations. str1 = null; // Only str1 gets null Objects use copy-by value, in my opinion. Please correct me if I am wrong. Similarly, StringBuilder and other java/lang/* classes that are declared with final keyword, their objects/instances behave like that. However, when being passed as parameter to a method, their reference values are passed. So my question is that is there any way to find all such special cases where objects always use copy-by-value behavior? How can I find all such classes? This may not be an easy task, any kind of suggestion is welcome. Thanks.
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24880367
has title: Differentiating between copy-by-value and copy-by-reference instances/objects
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/38645119
has comment: http://stackoverflow.com/comment/38645098
accepted answer: http://stackoverflow.com/a/24880367
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38609101
comment on: http://stackoverflow.com/q/24861249
score: 0
type: Comment
has text: put the sqljdbc.jar into the \libs folder and also include it in your project build path and set it to be exported
type: QuestionComment

http://stackoverflow.com/comment/92191001
comment on: http://stackoverflow.com/q/24788431
score: 0
has text: @CommonsWare: Do we get any Broadcast receiver or some state checker method that will let know simply whether Phone is connected to any miracast device or not?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24862676
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38619702
has title: Ignoring implemented methods from an interface?
has body: I have an input processor interface that listens on the screen and gives feedback to a button class, I have no control over the methods created in the interface. Now I'm trying to write a button class so that I can declare it within the class and call touchUp and touchDown only so I've not got code pollution. Here's what I'm trying to cut down: Button button = new Button(); button.setInputListener(new InputProcessor() { @Override public boolean keyDown(int keycode) { return false; } @Override public boolean keyUp(int keycode) { return false; } @Override public boolean keyTyped(char character) { return false; } @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { return false; } @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { return false; } @Override public boolean touchDragged(int screenX, int screenY, int pointer) { return false; } @Override public boolean mouseMoved(int screenX, int screenY) { return false; } @Override public boolean scrolled(int amount) { return false; } } ); Within the button class I have the following code: public void setInputListener(InputProcessor inputProcessor){ this.inputProcessor = inputProcessor; }
downvote count: 2
has comment: http://stackoverflow.com/comment/38611369
upvote count: 1
has comment: http://stackoverflow.com/comment/38611408
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38611247
has comment: http://stackoverflow.com/comment/38611202
tagged with: libgdx
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/24862891
accepted answer: http://stackoverflow.com/a/24862891
answer count: 1

http://stackoverflow.com/comment/38643706
score: 0
type: Comment
has text: @EJP "the JVM 'pins' a JNI argument object or an object created by a JNI method to the same address for the duration of the method." -- This is absolutely wrong when talking about HotSpot JVM. As I told you earlier, HotSpot does not support object pinning. Instead it updates `jobject` handles whenever a corresponding object is moved by GC.
comment on: http://stackoverflow.com/a/24876078
type: AnswerComment

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/24759596

http://stackoverflow.com/a/24874106
score: 2
has comment: http://stackoverflow.com/comment/39004815
has comment: http://stackoverflow.com/comment/39002764
upvote count: 2
has comment: http://stackoverflow.com/comment/38640993
has comment: http://stackoverflow.com/comment/38634544
has comment: http://stackoverflow.com/comment/38634215
has comment: http://stackoverflow.com/comment/38636165
has body: Check out Table Button Column. It shows how to use a JButton as a renderer and editor for a column. All you need to do is write the custom Action for the editor. The link gives a simple example of a Delete Action that deletes a row from the TableModel. You would need to modify the Action to remove the row from the Database.
has comment: http://stackoverflow.com/comment/38633594
downvote count: 0
has comment: http://stackoverflow.com/comment/38641460
has comment: http://stackoverflow.com/comment/38634518
answers question: http://stackoverflow.com/q/24873671
has comment: http://stackoverflow.com/comment/38640005
has comment: http://stackoverflow.com/comment/38634389
type: Answer

http://stackoverflow.com/q/24803930
has comment: http://stackoverflow.com/comment/38526064
tagged with: traceroute
has comment: http://stackoverflow.com/comment/38536676
has comment: http://stackoverflow.com/comment/38541033
downvote count: 0
has comment: http://stackoverflow.com/comment/38536595
favorite count: 0
has title: How to programmatically find the external IP address of a device without using external host?
type: Question
score: 9
tagged with: android
has answer: http://stackoverflow.com/a/26223830
has comment: http://stackoverflow.com/comment/38535119
has comment: http://stackoverflow.com/comment/38540979
tagged with: nat-traversal
has comment: http://stackoverflow.com/comment/38499773
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/38536842
upvote count: 9
has body: When I read the IP address of the device I always get the local IP address. I use the following code snippet to do that. public String getIpAddress() { try { for (Enumeration&lt;NetworkInterface&gt; en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration&lt;InetAddress&gt; enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { String ip = Formatter.formatIpAddress(inetAddress.hashCode()); Log.d("VPNConnected",ip); return ip; } } } } catch (Exception ex) { Log.d("exception", ex.toString()); } return "EMPTY"; } But I need to read the external IP address without using any external host or web apis such as http://jsonip.com
type: UnansweredQuestion
tagged with: android-networking

http://stackoverflow.com/q/24750846
has comment: http://stackoverflow.com/comment/38400406
has title: Magic numbers in formulas
has answer: http://stackoverflow.com/a/24750888
has answer: http://stackoverflow.com/a/24751242
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38400161
has comment: http://stackoverflow.com/comment/38400143
has answer: http://stackoverflow.com/a/24751772
type: Question
score: 4
has comment: http://stackoverflow.com/comment/38400144
has answer: http://stackoverflow.com/a/24750932
has answer: http://stackoverflow.com/a/24751112
answer count: 7
has comment: http://stackoverflow.com/comment/38400289
has comment: http://stackoverflow.com/comment/38400582
has body: It's a well established convention that magic numbers should be avoided. But what about magic numbers in complex, conditional formulas? For example: int result = 0; if (level &lt;= 50) { result = (int) (Math.pow(level, 3) * (100 - level) / 50); } else if (level &lt;= 68 &amp;&amp; level &gt; 50) { result = (int) (Math.pow(level, 3) * (150 - level) / 100); } else if (level &lt;= 98 &amp;&amp; level &gt; 68) { result = (int) (Math.pow(level, 3) * ((1911 - 10 * level) / 3) / 500); } else if (level &lt; 100 &amp;&amp; level &gt; 98) { result = (int) (Math.pow(level, 3) * (160 - level) / 100); } return result; In this case, would it be better to just say "avoid magic numbers when possible"? I am also using CheckStyle in eclipse to help show me where I may have missed an actual magic number. However, there is no way to disable the check for some numbers and not others.
has answer: http://stackoverflow.com/a/24750966
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24751093
has comment: http://stackoverflow.com/comment/38401056
upvote count: 4

http://stackoverflow.com/a/24893806
answers question: http://stackoverflow.com/q/24893213
type: Answer
has comment: http://stackoverflow.com/comment/38670661
has comment: http://stackoverflow.com/comment/38670475
has comment: http://stackoverflow.com/comment/38670539
has comment: http://stackoverflow.com/comment/38706578
has comment: http://stackoverflow.com/comment/38706619
has comment: http://stackoverflow.com/comment/38709025
has comment: http://stackoverflow.com/comment/38670303
score: 0
has body: An InputStream is binary data, bytes. It must be converted to text by giving the encoding of those bytes. Java uses internally Unicode to represent all text scripts. For text it uses String/char/Reader/Writer. For binary data, byte[], InputStream, OutputStream. So you could use a bridging class, like InputStreamReader: String encoding = "UTF-8"; // Or "Windows-1252" ... BufferedReader in = new BufferedStream( new InputStreamReader(fileItem.getInputStream(), encoding)); Or if you read the bytes: String s = new String(bytes, encoding); The encoding is often an option parameter (there then exists an overloaded method without encoding).

http://stackoverflow.com/comment/38549149
has text: sometimes it moves string to next line (method with a lot of parameters). I want to have this at one line for much better readability.
comment on: http://stackoverflow.com/a/24826828
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24908920
has comment: http://stackoverflow.com/comment/38741854
score: 2
has body: Try this regex: [0-9][0-9]?[0-9]?([0-9][0-9][0-9](,)?)* This matches numbers that are seperated by a comma for each 1000. So it will match 10,000,000 but not 10,1,1,1
upvote count: 2
has comment: http://stackoverflow.com/comment/38699002
has comment: http://stackoverflow.com/comment/38736326
has comment: http://stackoverflow.com/comment/38701534
downvote count: 0
answers question: http://stackoverflow.com/q/24908793
has comment: http://stackoverflow.com/comment/38701606
type: Answer
has comment: http://stackoverflow.com/comment/38733480

http://stackoverflow.com/comment/38630107
type: Comment
type: AnswerComment
has text: Thanks for your reply. I've been looking at JMS using ActiveMQ and have the publishing working (i.e. adding the orders to a queue). I'm moving onto the consumer now and am using SimpleThreadPool, but given my app is a webapp (no Main entry point), how would I ensure this thread pool runs at startup?
comment on: http://stackoverflow.com/a/24864708
score: 0

http://stackoverflow.com/q/24869820
has answer: http://stackoverflow.com/a/25155175
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/19876763
has title: Running android lint
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25155175
possible better answer: http://stackoverflow.com/a/24870033
answer count: 2
has answer: http://stackoverflow.com/a/24870033
downvote count: 4
favorite count: 0
tagged with: android
score: -3
linked to: http://stackoverflow.com/q/11855352
has body: I have a issue after update the Java SDK and Android SDK. My Eclipse says Running Android Lint" has encountered a problem. Details: Failed java.lang.NullPointerException There is not any error in the IDE, only some warnings. So then, when i try to run any application, the IDE show me a panel with this text: Unable to execute dex: GC overhead limit exceeded GC overhead limit exceeded

http://stackoverflow.com/comment/38404768
comment on: http://stackoverflow.com/q/24753146
score: 0
has text: Try this. create three local checkBoxes variables out side onclick find your check boxes id's in onCreate or OncreateView method and assign that checkBoxes reference in onclick method instead of calling findViewById in onclick.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/38498605
has body: Might be the issue is because of CORS(Cross Origin ResourceSharing).Try to add CORS plugin for your browser or you can add CORS header in Response like Object obj=your response Object; return Response.ok(obj).header("Access-Control-Allow-Origin", "*").build();
score: 1
answers question: http://stackoverflow.com/q/24775815
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/24890562
has body: Put a comma after each cell value you print. System.out.print(cell.getNumericCellValue() + "t,"); and System.out.print(cell.getStringCellValue() + ",");
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24890513
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24890513

http://stackoverflow.com/a/24753203
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24753146
type: Answer
answers question: http://stackoverflow.com/q/24753146
has body: You're calling findViewById() on the view v that was clicked. It doesn't have the checkboxes as children and nulls will be returned, and calling a method on null causes the NPE. Call findViewById() on a view hierarchy that actually contains the checkboxes. In a fragment it's likely getView().
has comment: http://stackoverflow.com/comment/38404747

http://stackoverflow.com/q/24754299
tagged with: nanotime
downvote count: 0
tagged with: jvm
favorite count: 0
tagged with: operators
linked to: http://stackoverflow.com/q/18414059
has answer: http://stackoverflow.com/a/24754456
has title: How can the "<" or ">" operators overflow?
has comment: http://stackoverflow.com/comment/38406443
possible better answer: http://stackoverflow.com/a/24754671
type: AnsweredQuestion
score: 3
tagged with: overflow
upvote count: 3
tagged with: java
has body: I am intrigued with the following statement found in the documentation of the System.nanoTime() method in Java: long t0 = System.nanoTime(); ... long t1 = System.nanoTime(); One should use t1 - t0 &lt; 0, not t1 &lt; t0, because of the possibility of numerical overflow. Source: http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime() Why is it that t1 &lt; t0 might "overflow"? This is in the Javadocs, but I guess it applies to any language.
type: Question
has answer: http://stackoverflow.com/a/24754671
accepted answer: http://stackoverflow.com/a/24754456
answer count: 2
duplicate of: http://stackoverflow.com/q/18414059

http://stackoverflow.com/comment/38417743
type: Comment
comment on: http://stackoverflow.com/a/24760187
has text: I added a little more explanation. Replace the SOP with what you want to happen on the Action. The Override ensures that you are actually implementing a *super* method. If you get the signature wrong and don't implement the correct method that's what's known as a bad thing.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38522681
type: Comment
comment on: http://stackoverflow.com/a/24815540
score: 0
has text: @user3135757 I wonder what the difference was. I'm guessing Spring EL wasn't being loaded, which caused the expression not to resolve in the configuration file, so the Spring IOC container read the value for the property as a String literal. I'll adjust the answer with this information.
type: AnswerComment

http://stackoverflow.com/q/24852922
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38592647
has comment: http://stackoverflow.com/comment/38592643
has comment: http://stackoverflow.com/comment/38592659
downvote count: 0
answer count: 0
type: UnansweredQuestion
has title: Is it a limitation of the JDK that I cannot view, in the debugger, lambda-captured reference values?
tagged with: lambda
tagged with: java-8
type: Question
tagged with: debugging
score: 1
tagged with: java
has body: Is it possible to view the values of lambda-captured values (whether primitive or reference) in a Java debugger? (If so, which one(s)?) (It is apparently not possible in IntellJ IDEA. Obviously I can see those values by copying to a local variable in the lambda, but I'm trying to learn if it is a missing feature of IDEA or of the Oracle JDK; I'm not trying to rag on JetBrains.) (I'm hoping this isn't considered an inappropriate product-related question. Let me know how to ask it properly if you think so, so I can learn how to use SO.)

http://stackoverflow.com/q/24866237
type: Question
upvote count: 1
tagged with: parameters
tagged with: java
answer count: 1
type: UnansweredQuestion
tagged with: struts2
has body: I want to call the Action class with some parameters, but I am not able to do this. Please, suggest me how to pass parameters with mapping struts.xml file in application. I am using Struts2 framework in my application. My Struts file action mapping is below: <interceptor-ref name="accessRequired"/> <interceptor-ref name="scope" /> {1} views/createSHBehaviourView.jsp / and URL that used to call action class: http://localhost:8080/pro/createSHBehaviour/123 Here createSHBehaviour is a method of CreateSHBehaviourAction class: public class CreateSHBehaviourAction extends ActionSupport implements SessionAware,Parameterizable { /** * */ private static final long serialVersionUID = 1L; private SessionMap<String, Object> sessionMap = null; private Map<String, String> params = new HashMap<String, String>(); public String execute() { System.out.println("param1 = " + this.params.get("param1")); sessionMap = (SessionMap<String, Object>) ActionContext.getContext() .getSession(); sessionMap.put("idSoftHumanS", "hhhh"); sessionMap.put("fix_behaviour_mode", true); return Action.SUCCESS; } public void setSession(Map<String, Object> map) { sessionMap = (SessionMap<String, Object>) map; } @Override public void addParam(String key, String value) { // TODO Auto-generated method stub this.params.put(key, value); } @Override public Map<String, String> getParams() { // TODO Auto-generated method stub return this.params; } @Override public void setParams(Map<String, String> params) { // TODO Auto-generated method stub this.params = params; } } Please, give me a suggestion how to solve this.
has answer: http://stackoverflow.com/a/24866374
downvote count: 0
score: 1
favorite count: 0
has title: How to pass parameters with action name dynamically in Struts 2

http://stackoverflow.com/q/24788651
has answer: http://stackoverflow.com/a/24788708
has answer: http://stackoverflow.com/a/24788825
tagged with: java
has body: In my app when onCreate occurs I call a static method of another class. E.g. ClassName.method(). This second class contains a static block which is also executed when the method is called. This is exactly what I want to happen. However when I press the back button and return to the app, onCreate is again called (back caused onDestroy to execute) and that other method is called but the static block is not. This isn't the case when I manually close the app from running in the background (the swipe technique) and then reopen it. In that particular case the static block is called. Why is the static block of the class not called when the app restarts after onBackPressed? Thank you. Update: It seems to me that the class is not removed from memory even after onDestroy when back is pressed. I was under the impression that everything would reinitialise when onCreate is called again. However this does not seem to be the case. Is there a way to remove the class on calling onDestroy?
has title: Static blocks of classes not called onCreate after onBackPressed
tagged with: static
possible better answer: http://stackoverflow.com/a/24788701
accepted answer: http://stackoverflow.com/a/24788708
score: 0
answer count: 3
tagged with: ondestroy
has answer: http://stackoverflow.com/a/24788701
tagged with: android
type: AnsweredQuestion
type: Question
tagged with: oncreate

http://stackoverflow.com/a/24793144
has comment: http://stackoverflow.com/comment/38480649
type: Answer
has comment: http://stackoverflow.com/comment/38480659
has comment: http://stackoverflow.com/comment/38480759
upvote count: 2
has comment: http://stackoverflow.com/comment/38480528
has comment: http://stackoverflow.com/comment/38480609
has comment: http://stackoverflow.com/comment/38480627
has comment: http://stackoverflow.com/comment/38480687
score: 2
has comment: http://stackoverflow.com/comment/38480750
has comment: http://stackoverflow.com/comment/38480793
has comment: http://stackoverflow.com/comment/38480715
has body: It's worth reading Loading Images Using getResource where it's explained in detail along with loading images from jar as well. You can try any one based on image location. // Read from same package ImageIO.read(getClass().getResourceAsStream("b.png")); // Read from src/images folder ImageIO.read(getClass().getResource("/images/b.png")) // Read from src/images folder ImageIO.read(getClass().getResourceAsStream("/images/b.png")) Read more...
has comment: http://stackoverflow.com/comment/38480691
has comment: http://stackoverflow.com/comment/38480832
downvote count: 0
answers question: http://stackoverflow.com/q/24793129
has comment: http://stackoverflow.com/comment/38480594
has comment: http://stackoverflow.com/comment/38480724
has comment: http://stackoverflow.com/comment/38480774
has comment: http://stackoverflow.com/comment/38480670

http://stackoverflow.com/q/24765039
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/24765289
has body: I have this json string which I need to get deserialized into a map: Map "players_test": [ { "54231f85f8e049c7bd8ac0aba3d1caf7": { "uuid": "54231f85f8e049c7bd8ac0aba3d1caf7", "name": "TomShar", "signup_time": "2014-07-04 16:27:16" } }, { "54231f85f8e049c7bd8ac0aba3d1caf7": { "uuid": "54231f85f8e049c7bd8ac0aba3d1caf7", "name": "TomShar", "signup_time": "2014-07-04 16:27:16" } }, { "54231f85f8e049c7bd8ac0aba3d1caf7": { "uuid": "54231f85f8e049c7bd8ac0aba3d1caf7", "name": "TomShar", "signup_time": "2014-07-04 16:27:16" } } ] So the Strings should be the keys and then the value should be of the object it represents. I have a custom deseriaziler written for the UUID object and that is tested and works (so that isn't the problem). EDIT: I found a better JSON structure I can use for my problem that works exactly how I want it to. "players": { "54231f85-f8e0-49c7-bd8a-c0aba3d1caf7": { "uuid": "54231f85-f8e0-49c7-bd8a-c0aba3d1caf7", "name": "TomShar", "kills": 0, "assists": 0, "damage_dealt": 0, "time_alive": 0, "dead": false }, "KEY": { "uuid": "KEY", "name": "Name", "kills": 0, "assists": 0, "damage_dealt": 0, "time_alive": 0, "dead": false }, "KEY": { "uuid": "KEY", "name": "Name", "kills": 0, "assists": 0, "damage_dealt": 0, "time_alive": 0, "dead": false } }
accepted answer: http://stackoverflow.com/a/24765289
answer count: 1
upvote count: 11
has comment: http://stackoverflow.com/comment/38426731
tagged with: deserialization
has title: Gson deserialize into map
favorite count: 0
downvote count: 0
tagged with: dictionary
score: 11
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/24884371
tagged with: web-services
type: Question
type: AnsweredQuestion
tagged with: bidirectional
upvote count: 1
answer count: 1
favorite count: 0
has title: Bi-directional Netty Server
accepted answer: http://stackoverflow.com/a/24898776
tagged with: sockets
tagged with: netty
has body: I have a server which needs to have bi-directional connection to clients and provide web services for few websites. In fact, webservice is a dealer which roots requests of web sites to clients. The Scenario is: Dealer starts it's web service and at the same time, listening on port 12345. Client-A sends its username to port 12345 of dealer and keeps on listening on same port. Dealer receives username, validates user and keep a connection to user. Website-1 invokes doOperation(operation-X,User-A) from dealer's web service. Dealer checks if user-A exists and send a request of "operation-X" to it. User-A invokes "Operation-X" and sends back the result to dealer. Dealer sends back the result to Website. As you see in scenario, server needs to send unsolicited messages to clients and gets the respond immediately to serve web sites. Firstly, I implemented a multi-threaded bidirectional socket solution, which worked fine for few clients but got performance problems and unfortunately we have more than 10k concurrent users. Then, I found netty. It looks like a very promising solution. But it's asynchronous and event driven nature makes me worry. Some more, it seems to be unidirectional. http://apache-avro.679487.n3.nabble.com/Writing-Unsolicited-Messages-to-a-Connected-Netty-Client-td3675163.html So the question is how to have an asynchronous handshaking ( something like : http://biasedbit.com/handshaking-tutorial-with-netty/ ) and then send the requests from dealer and get the result? ** Any feedback, advice and knowledge sharing is highly appreciated
downvote count: 0
has answer: http://stackoverflow.com/a/24898776
score: 1
tagged with: java

http://stackoverflow.com/q/24848606
has comment: http://stackoverflow.com/comment/38584771
answer count: 1
has body: I had been trying to make gridlayout to give the same columns as i had specified in the code instead i got 3 times amount of my specification, any idea on why it is like this and how to solve this problem will be appreciated. I have an ArrayList of type string with size of 150 string object an each of string is a text on JButton and then the JButton added to a JPanel with gridLayout Manager i wanted to create 15 rows and 10 colomns. Here is the code JPanel panel = new JPanel(); Gridlayout gridlayout = new GridLayout(); gridlayout.setRows(15); gridlayout.setColumns(10); gridlayout.setHgap(2); gridlayout.setVgap(6); panel.setLayout(gridlayout); // now arraylist of type string, each string on Jbutton for(ArrayList string: strings){ panel.add(new JButton (string)); }
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/38584250
favorite count: 0
has comment: http://stackoverflow.com/comment/38590161
has title: How to make GridLayout to respect columns setting?
has comment: http://stackoverflow.com/comment/38829463
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/25022729
has comment: http://stackoverflow.com/comment/38590099
tagged with: swing
has comment: http://stackoverflow.com/comment/38584830
type: Question
has comment: http://stackoverflow.com/comment/38584570
has comment: http://stackoverflow.com/comment/38584543
has comment: http://stackoverflow.com/comment/38585290
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/38585013
has comment: http://stackoverflow.com/comment/38584549
tagged with: grid-layout
upvote count: 0

http://stackoverflow.com/q/24821015
has answer: http://stackoverflow.com/a/24821379
has comment: http://stackoverflow.com/comment/38532147
favorite count: 0
has comment: http://stackoverflow.com/comment/38532044
has answer: http://stackoverflow.com/a/24821382
type: UnansweredQuestion
has title: How to implement an interface at runtime iin Java?
has answer: http://stackoverflow.com/a/24821081
has body: Lets say I have class: class A { } by any means I can make the class implements an interface on the runtime? This is what I'm trying to achieve, when some one creates object of class A, I need to intercept the calls to that object. Very new to Java, thanks.
has answer: http://stackoverflow.com/a/24835192
has comment: http://stackoverflow.com/comment/38532657
answer count: 4
has comment: http://stackoverflow.com/comment/38532077
tagged with: java
has comment: http://stackoverflow.com/comment/38532264
has comment: http://stackoverflow.com/comment/38532224
has comment: http://stackoverflow.com/comment/38532592
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38532102
downvote count: 4
has comment: http://stackoverflow.com/comment/38532068
has comment: http://stackoverflow.com/comment/38532378
has comment: http://stackoverflow.com/comment/38532090
score: 0

http://stackoverflow.com/comment/38489115
type: QuestionComment
has text: That's the start of it. It tells you that you dereferenced a null pointer. The data below it tells you where.
comment on: http://stackoverflow.com/q/24796341
score: 0
type: Comment

http://stackoverflow.com/comment/38414887
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24758638
has text: So go to your server, double click on it and on the right side of the panel you will see the port that that Tomcat is using. The eclipse has an embedded tomcat installation and that is the one you are starting. See on this image: http://telestax.wpengine.netdna-cdn.com/wp-content/uploads/2013/02/Eclipse_tomcat_installation_server_settings.png just searched on google.
score: 0

http://stackoverflow.com/comment/38496636
type: QuestionComment
comment on: http://stackoverflow.com/q/24802155
has text: If you don't get help soon, consider creating and posting a [Minimal, Complete, and Verifiable Example Program](http://stackoverflow.com/help/mcve) where you condense your code into the smallest bit that still compiles and runs, has no outside dependencies (such as need to link to a database or images), has no extra code that's not relevant to your problem, but still demonstrates your problem.
score: 0
type: Comment

http://stackoverflow.com/comment/38419118
type: QuestionComment
has text: To get logs via usb cable, use the command `adb logcat`. That should get you your error.
comment on: http://stackoverflow.com/q/24760775
score: 0
type: Comment

http://stackoverflow.com/comment/38632278
has text: Thanks @camickr, I'll update my answer with your suggestions as soon as I can. Yours is a great example (as usual), +1 for that!
comment on: http://stackoverflow.com/a/24866789
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24966609
downvote count: 0
has comment: http://stackoverflow.com/comment/38926760
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38828868
answers question: http://stackoverflow.com/q/24898684
has body: According to Oracle's installation notes, you should download/install JDK for the correct system. For your convenience, I have linked to it from the sentence above. If you still encounter problems, leave a comment. I have written some quick code that will tell you if your JVM is 64 or 32-bit, below. I'd suggest you run this class and leave a comment as to its output: public class CheckMemoryMode { public static void main(String[] args) { System.err.println(System.getProperty("sun.arch.data.model")); } }
has comment: http://stackoverflow.com/comment/38826241

http://stackoverflow.com/q/24874817
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38635237
answer count: 1
downvote count: 1
tagged with: arrays
tagged with: string
favorite count: 0
has body: I am quite new to this android eclipse programing. i have spent days searching the web for an answer but have not been able to find one yet. i have managed to get a listview working using fragments but the string data is hard coded and i would like to use a string from the resources xml file. this is the hard coded data public static final String[] message1 = new String[] { "Strawberry", "Banana", "Orange", "Mixed" }; this is my string //String array data to display for row data message1 String[] message1 = getResources().getStringArray(R.array.main_page_list_string); from my strings.xml file Instruments Capasiters Resisters Ohms Law IP Ratings Thermostats Converters RJ 45 A and B plugs Calculators every time i replace public static final String[] message1 = new String[] { "Strawberry", "Banana", "Orange", "Mixed" }; with String[] message1 = getResources().getStringArray(R.array.main_page_list_string); my app crashes and the error message is null point exception. can anyone tell me how to do this?enter code here thanks This is the java class file import android.app.Activity; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class ImageTextListBaseAdapterActivity extends Activity implements OnItemClickListener { *********************************************************************************** This is the code i am trying to use //String array data to display for row data message1 String[] myStringData=getResources().getStringArray(R.array.main_page_list_string); This is the code that i am trying to replace ******************************************************************************** // public static final String[] message1 = new String[] { "Strawberry", // "Banana", "Orange", "Mixed" }; ****************************************…
linked to: http://stackoverflow.com/q/12506045
tagged with: android
accepted answer: http://stackoverflow.com/a/24875076
has comment: http://stackoverflow.com/comment/38635066
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24875076
type: Question
has title: How to change a hard coded String Array to a String[] myString = getResources().getStringArray(R.array.myStringArray);
tagged with: java
score: -1

http://stackoverflow.com/comment/38441294
has text: these are oracle 11g database config files and i am sure they have .ora extension
comment on: http://stackoverflow.com/q/24765937
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/76867722
has text: I am looking for any annotation based sample project which makes use of RedisMessageBus to achieve concurrency in processing the messages received
comment on: http://stackoverflow.com/a/24766809
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24838447
upvote count: 2
has answer: http://stackoverflow.com/a/24839979
answer count: 2
favorite count: 0
tagged with: multiset
has body: I am facing trouble in deciding on better design pattern for the following usecase. There are two modules in our project, Moduel1, Moduel2 For a user to access each module, there are two sets of four entitlements: one set for Module 1 &amp; the other for Module2. Now, depending on the correct combination of the user role, I need to perform the logic specific to each module. I have four user roles for module 1, Module1UserRole1, Module1UserRole2, Module1UserRole3, Module1UserRole4 Different combinations for this is 15. For each of this combination i need to perform relevant logic. Each logic is completely different from one another. I am indecisive whether it is a good approach to put each combination logic in a separate class which gives readability instead of cramming up one single class with tons of if and else conditions. This gives me total 15 classes. (each class represents one combination of userrole) Each of these classes will implement following interface viz. Module1UserRoles . Given the above scenario, Define Module1UserRoles interface public interface Module1UserRoles { executeModule1Logic(); } Lets say I am entitled to Module1UserRole1 &amp;&amp; Module1UserRole2 Then the logic for the union of the above two roles will be written in Moudle1UserRole1AndUserRole2Impl . public class Moudle1UserRole1AndUserRole2Impl Module1UserRoles { public void executeModule1Logic() { /// implement the logic relevant userrole1 and userrole2. } } I am looking at various options. Any advice is highly appreciated.
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24842259
tagged with: design-patterns
type: Question
tagged with: java
has title: Desing pattern for multiple combinations of a multiset (user roles)

http://stackoverflow.com/q/24847025
tagged with: angularjs
type: Question
has comment: http://stackoverflow.com/comment/38589960
tagged with: spring
upvote count: 2
has comment: http://stackoverflow.com/comment/38591096
has comment: http://stackoverflow.com/comment/38583296
tagged with: java
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39442873
answer count: 0
downvote count: 0
has body: I'm new to Spring Security and Angularjs. I'm trying to configure a login page in Spring security which is an Angular view. I run into a recursive loop with the below exception. I'm not sure how I can point Spring Security to recognize AngularJS view as a login page. FYI: the view has a HashBang. Any help would be much appreciated. 2014-07-19 23:08:20.343 INFO 2037 --- [bio-8080-exec-5] o.s.b.a.audit.listener.AuditListener : AuditEvent [timestamp=Sat Jul 19 23:08:20 EDT 2014, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={type=org.springframework.security.access.AccessDeniedException, message=Access is denied}] I'm configuring security using Java configuration. My class looks like: public class ApplicationSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserService userService; @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/").permitAll() .anyRequest().authenticated(); http .formLogin() .loginPage("/#/login").permitAll() .and() .logout() .permitAll(); } @Override public void configure(WebSecurity web) throws Exception { web .ignoring() .antMatchers("/fonts/**") .antMatchers("/images/**") .antMatchers("/scripts/**") .antMatchers("/styles/**") .antMatchers("/views/**"); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); auth.userDetailsService(userService).passwordEncoder(passwordEncoder); } }
tagged with: spring-security
favorite count: 0
has title: Spring security login page in AnguarJS app

http://stackoverflow.com/comment/38674110
comment on: http://stackoverflow.com/q/24895727
score: 0
type: Comment
type: QuestionComment
has text: This must be a duplicate of some question, but of course searching for "java default constructor" only finds questions with that in the title. Can someone more familiar with the Java tag find a dupe to point this at?

http://stackoverflow.com/comment/38414376
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24758128
type: AnswerComment
has text: Hi Thanks , that sure worked for me ..actually I was using the "entity.datasource" which might be some keyword that resolved it forme

http://stackoverflow.com/a/24783585
has body: float[] array = new float[]{null,null}; Cannot compile, float is a primitive type thus can not be null Float[] array = new Float[]{null,null}; Compile, Float is an object, thus can be null.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24783488
score: 2
upvote count: 2

aide-ide
tag name: aide-ide
type: Tag
tags question: http://stackoverflow.com/q/24847936

http://stackoverflow.com/comment/38637364
score: 1
has text: I've seen there's always a possibility to have collision. I'm just wondering in my case is it worth to implement this "failsafe" so I at least try a few times to get a unique name, just in case of a collision.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24876188

http://stackoverflow.com/comment/38631584
has text: @dkatzel Obviously, but they don't add to the complexity of the code. It's not 6KLoC.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24872732

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

http://stackoverflow.com/a/24832257
accepted answer of: http://stackoverflow.com/q/24832177
answers question: http://stackoverflow.com/q/24832177
score: 4
has comment: http://stackoverflow.com/comment/38553992
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38554337
type: Answer
has body: I don't see any trace of the Singleton pattern here. It mostly resembles the Builder pattern, but isn't it, either. It just implements a fluent API. Your approach seems very nice and practical. I would perhaps advise not using fromRoot() but instead constructing a new instance each time. The instance is quite lightweight since all the heavyweight stuff resides in the Document instance it wraps. You could even go immutable all the way, returning a new instance from withEle(). This buys you many cool properties, like the freedom to share the object around, each code path being free to use it as a starting point to fetch something specific relative to it, share it across threads, etc. The underlying Document is mutable, but usually this doesn't create real-life problems when the code is all about reading.
has comment: http://stackoverflow.com/comment/38554286
has comment: http://stackoverflow.com/comment/38554555
has comment: http://stackoverflow.com/comment/38554036

http://stackoverflow.com/q/24868174
favorite count: 0
has title: Liferay: How to make enctype="multipart/form-data" and method="post" work together?
accepted answer: http://stackoverflow.com/a/24869137
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38623249
tagged with: liferay
tagged with: jsp
linked to: http://stackoverflow.com/q/6536947
tagged with: servlets
has answer: http://stackoverflow.com/a/24869137
answer count: 1
downvote count: 0
has body: I'm developing a web app using liferay portal server 6.2 JSP code - <form id="mainForm" action="<portlet:actionURL/>" method="post" enctype="multipart/form-data" > Please upload a file Servlet code - @Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { System.out.println("myPortlet.processAction() >> " + request.getParameter("varImport")); //... rest of the code. } If I remove enctype from jsp form, I get the value of varImport in my servlet. But if i keep it, it returns null. What am i missing?

gson
tags question: http://stackoverflow.com/q/24801288
tags question: http://stackoverflow.com/q/24880260
tags question: http://stackoverflow.com/q/24869708
tags question: http://stackoverflow.com/q/24755676
tags question: http://stackoverflow.com/q/24830699
tags question: http://stackoverflow.com/q/24769981
tags question: http://stackoverflow.com/q/24860255
tags question: http://stackoverflow.com/q/24866567
tags question: http://stackoverflow.com/q/24751275
tags question: http://stackoverflow.com/q/24780233
tags question: http://stackoverflow.com/q/24850675
tags question: http://stackoverflow.com/q/24814420
tags question: http://stackoverflow.com/q/24898168
tags question: http://stackoverflow.com/q/24785695
tags question: http://stackoverflow.com/q/24818617
tag name: gson
tags question: http://stackoverflow.com/q/24750287
tags question: http://stackoverflow.com/q/24820389
tags question: http://stackoverflow.com/q/24765039
type: Tag

http://stackoverflow.com/comment/38423287
has text: My Question is that if its our own framework based on plain JDBC to access our database then does the DAO do that processing generally? Thanks for the answers btw
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24762878
type: AnswerComment

http://stackoverflow.com/a/24878594
answers question: http://stackoverflow.com/q/24878513
score: 0
has body: It may be inefficient, and I'm sure the idea can be improved upon, but you could create a method that loops through the string, building a buffer of each character that is not punctuation. private String replacePunctuation(String s){ String output = ""; for(int i = 0; i &lt; s.Length(); i++){ if(s.charAt(i) != '.' &amp;&amp; s.charAt(i) != ',' &amp;&amp; s.charAt(i) != '!') // Add other punctuation values you're concerned about. Perhaps the Regex class would be useful here, but I am not as familiar with it as I would like. output += s.charAt(i); } } } Again, probably not the cleanest or most efficient, but it's the best I can come up with at the moment.
type: Answer

http://stackoverflow.com/comment/44919671
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24884527
score: 2
has text: If that solved, should you post it as answer?

http://stackoverflow.com/q/24886468
has answer: http://stackoverflow.com/a/25886367
answer count: 8
has comment: http://stackoverflow.com/comment/39269705
upvote count: 37
tagged with: windows-8
tagged with: java
has answer: http://stackoverflow.com/a/25213651
tagged with: eclipse
type: Question
has body: After installing ADT Plugin for Eclipse, I tried to make a new Hello world Android app. But I met with the following error when I tried to open a new Android Application. I'm working with JDK 7.0 and JRE 7.0. I initially worked with JDK 6.0, but met with the same error, hence I uninstalled it and installed JDK 7.0 and changed the path settings respectively. The error clearly is: Loading data for Android L(Preview) has encountered a problem. Parsing data for Android L failed.Unsupported major.minor version 51.0. My compliance levels are also changed to JDK 1.7 only. And I also changed my JRE compliance to 1.7.
has answer: http://stackoverflow.com/a/30114606
has title: Parsing data for Android L failed.Unsupported major.minor version 51.0
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26081748
has answer: http://stackoverflow.com/a/25840666
tagged with: android
tagged with: eclipse-adt
linked to: http://stackoverflow.com/q/10382929
has comment: http://stackoverflow.com/comment/38656332
has answer: http://stackoverflow.com/a/27046257
has answer: http://stackoverflow.com/a/25324340
score: 37
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24886966
has comment: http://stackoverflow.com/comment/42701210
linked to: http://stackoverflow.com/q/24483406

http://stackoverflow.com/comment/38626415
has text: @captainmonk can you use GridBag?
comment on: http://stackoverflow.com/q/24870206
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38591079
score: 0
has text: what you are getting in `Log.e("Entity Response: ", entityResponse);` line ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24852184

http://stackoverflow.com/a/24806869
answers question: http://stackoverflow.com/q/24801609
has body: Instead of <arg line="...">, use <arg value="..."> <arg value="-firefoxProfileTemplate"/> <arg value="/home/local/seleniumFirefox"/> <arg value="-htmlSuite"/> <arg value="*firefox"/> <arg value="http://127.0.0.1:8083/"/> <arg value="${apl.dir}/SeleniumTests/suiteTest.html"/> <arg value="FirefoxResult.html"/>
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38650489

http://stackoverflow.com/comment/73331865
comment on: http://stackoverflow.com/a/24933117
type: AnswerComment
type: Comment
has text: Sure the *tl: w(on't)r;* is _cool_, but it's terrible _general_ advice for copy-paste SO users. Please don't add RxJava to your project just for this, and please seriously consider the overhead and maintainability burden this incurs if you don't actually know what you're doing or can't justify why you'd want RxJava to wrap input event generation. It's a pretty deep stack to dive through just for a callback. It's certainly not a _bad idea_, but please be careful.
score: 7

http://stackoverflow.com/comment/38561489
has text: You can find more information by reading the css. This way you can do further research yourself.
comment on: http://stackoverflow.com/a/24764338
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38631675
type: AnswerComment
has text: Yes, but if OP was trying to assign a hex value to an integer they might have tried `test1 = "b"` after `test1 = b` failed. However from the rest of OP's code it seems like they probably want to read `String` and `char` values from the input stream but are reading `int` instead.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24873104

http://stackoverflow.com/q/24859083
has answer: http://stackoverflow.com/a/24861561
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: jquery
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24861561
has body: I need to implement a service like whenever a next or previous is clicked in pagination the browser should save the state so that while doing browser back it goes back to last accessed page. Currently it is happening like when I enter any url in new tab page and in pagination if I click on next button, further I click browser back button it is going to new tab page. Anybody please suggest how to achieve this. I have tried following public class ShortenLastPagePager extends SimplePager implements ValueChangeHandler&lt;String&gt; { private int pageSize; public ShortenLastPagePager( TextLocation location, Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton, int pageSize ) { super( location, resources, showFastForwardButton, fastForwardRows, showLastPageButton ); this.pageSize = pageSize; } @Override public void setPageSize( int pageSize ) { this.pageSize = pageSize; } @Override public void setPageStart( int index ) { if ( getDisplay() != null ) { Range range = getDisplay().getVisibleRange(); int myPageSize = 0; index = Math.min( index, getDisplay().getRowCount() ); index = Math.max( 0, index ); myPageSize = Math.min( pageSize, getDisplay().getRowCount() - index ); if ( index != range.getStart() || myPageSize != range.getLength() ) { getDisplay().setVisibleRange( index, myPageSize ); } } } @Override public void nextPage() { if ( getDisplay() != null ) { Range range = getDisplay().getVisibleRange(); setPageStart( range.getStart() + range.getLength() ); } } @Override public void previousPage() { if ( getDisplay() != null ) { Range range = getDisplay().getVisibleRange(); setPageStart( range.getStart() - pageSize ); } } @Override public void lastPage() { int remainder = getDisplay().getRowCount() % pageSize; if ( remainder &gt; 0 ) { setPageStart( getDisplay().getRowCount() - remainder ); } else { if ( getDisplay().getRowCount() / pageSize &gt; 0 ) { setPageStart( getDisplay().getRowCount() - pageSize ); } else { setPageStart(…
has comment: http://stackoverflow.com/comment/38604949
has comment: http://stackoverflow.com/comment/38606842
tagged with: java
answer count: 1
tagged with: gwt
has comment: http://stackoverflow.com/comment/38608142
has title: GWT SimplePager - Add History for every next and previous
tagged with: javascript

http://stackoverflow.com/q/24905774
upvote count: 5
tagged with: java
tagged with: initialization-block
has comment: http://stackoverflow.com/comment/38692713
has body: In context to my previous question Java classes and static blocks what if I changed my code from static block and variables to normal Instance Initialization Block and instance variables. Now how would the code be executed? class extra3 { public static void main(String string[]) { Hello123 h = new Hello123(); System.out.println(h.a); } } class Hello123 { { a=20; } int a=158; } Here I am getting output as 158. I am not able to understand the reason here.And the other code being this: class extra3 { public static void main(String string[]) { Hello123 h = new Hello123(); System.out.println(h.a); } } class Hello123 { int a=158; { a=20; } } Here the output is 20 which is acceptable because when object is created Instance block is executed first. But why is the output in first code coming as 158?
has title: Java Instance Initialization Block and instance variables
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/24905845
answer count: 3
tagged with: instance-variables
linked to: http://stackoverflow.com/q/24895489
possible better answer: http://stackoverflow.com/a/24905834
downvote count: 1
has answer: http://stackoverflow.com/a/24905834
has answer: http://stackoverflow.com/a/24905850
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24905845

http://stackoverflow.com/comment/38402368
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24751944
type: AnswerComment
has text: @Shafu : Then you can use composition. See my edits to this answer.

http://stackoverflow.com/q/24840122
tagged with: events
duplicate of: http://stackoverflow.com/q/1629961
has title: Is it Possible to undo a typed character into a JText area?
score: 0
has answer: http://stackoverflow.com/a/24840181
tagged with: swing
answer count: 1
tagged with: java
has body: Is it possible to remove the character typed into a JTextArea in Java Swing? Or block certain characters from being added? I am not talking about a replace, I specifically want to remove / block the character added by a key event. Here's some example code to illustrate what I want to do: input.addKeyListener(new KeyListener(){ @Override public void keyTyped(KeyEvent e){ //Nothing to do here } @Override public void keyPressed(KeyEvent e){ if(condition == true){ e.undo(); //I want to remove the key that character that was inserted with this action } } @Override public void keyReleased(KeyEvent e){ //Nothing to do here } }); Thanks in advance!
accepted answer: http://stackoverflow.com/a/24840181
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38567951
linked to: http://stackoverflow.com/q/1629961
type: Question

http://stackoverflow.com/q/24833004
downvote count: 0
answer count: 1
tagged with: jax-rs
favorite count: 0
tagged with: resteasy
has body: I'm building something of a relay server, using JAX-RS. I need to be able to extract any query parameters from a GET request and then re-wrap them into another request, to pass along to another server. I'm unfamiliar with MultivaluedMap, but I just figured out what is happening. The UriInfo class's getQueryParameters method returns a MultivaluedMap<String, String>. What bit me, unexpectedly, is that the values of each parameter are List values, even though they purport to be String values (by the way I read the JavaDoc). In other words, if I have a key-value pair of foo=bar, in the URL query string, when I extract the parameter, it comes out as foo=[bar]. This totally throws me for a loop (a 500 Server Error, actually) when I try to re-wrap the parameter and send it along to the other server. Is there another way to handle unpacking the query string from a Request, and then re-packing it for another Request? I'm including some code to illustrate my issue: @GET @Path("parameters") public Response showParameters(@Context UriInfo uriInfo) { MultivaluedMap<String, String> parameters = uriInfo.getQueryParameters(); StringBuffer sb = new StringBuffer(); sb.append(" Parameters: "); if (parameters != null) { sb.append(" "); Iterator it = parameters.keySet().iterator(); while (it.hasNext()) { String key = (String)it.next(); sb.append(" ") .append(key) .append(": ") .append(parameters.get(key)) .append(" "); } sb.append(" "); } else { sb.append(" None "); } return Response.ok(sb.toString()).build(); } So, in summary, what gets printed out from the code above, if the request has query parameters, is something like this: Parameters: key1: [value1] key2: [value2] key3: [value3] Is there another way to unpack/re-pack, and maybe avoid this whole issue altogether? Thanks. Complete answer @Jack deserves credit for pointing me in the right direction, and I am marking his answer as correct, but here is what I got working. Client client = ClientBuilder.newClient(); // Assume instance v…
has comment: http://stackoverflow.com/comment/98120125
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/24833458
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/24833458
has comment: http://stackoverflow.com/comment/38559850
has title: MultivaluedMap in RESTEasy and square brackets
tagged with: java
has comment: http://stackoverflow.com/comment/38556334
has comment: http://stackoverflow.com/comment/38560025
has comment: http://stackoverflow.com/comment/38560108

http://stackoverflow.com/comment/38640331
has text: Let's start again. You must have `./com/multitek/ipintercomflatunit/I2CInterface.java`, where `.` is your current directory. Compile that: `javac com/multitek/ipintercomflatunit/I2CInterface.java`. Then: `javah -jni com.multitek.ipintercomflatunit.I2CInterface.`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24797053
score: 0

http://stackoverflow.com/q/24840801
has title: Implements Behaving Like Polymorphic Inheritance
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38569248
has comment: http://stackoverflow.com/comment/38569307
tagged with: inheritance
has answer: http://stackoverflow.com/a/24841111
score: 0
has comment: http://stackoverflow.com/comment/38569338
answer count: 1
accepted answer: http://stackoverflow.com/a/24841111
tagged with: implements
has body: BACKGROUND AND SET UP Okay, let's see if I can get this question to "make sense". The following code examples are meant to communicate the principles and reflect the ideas behind the code. If the code in detail is of interest to you, you can find the code, here. I have read the basics, consulting the Java Tutorials (which is a wonderful resource), good ol' Dietel, and the documentation. To clarify: I am a beginner programmer. I have three (3) classes: ClassThatImplements ClassThatIsInterface ClassThatDoesSmthg Here are their definition(s): The Interface Simpe stuff really: public interface ClassThatIsInterface { public void doSomething(type variable); } The Class that Implements the Interface public class ClassThatImplents implements ClassThatIsInterface { // Here's the bit I hope to ask about, pt. 1 of 2: ClassThatDoesSmthg instance = new ClassThatDoesSmthg(this, appropriateVariable); } The Class that Does Something public class ClassThatDoesSmthg { // And the second bit, pt. 2 of 2: public ClassThatDoesSmthg (ClassThatIsInterface variableOne, type appropriateVariable) { } QUESTION The above code fragments should give you enough information for the question, I think. Really, the focus of the question is the latter two classes: ClassThatImplements and ClassThatDoesSmthg. ClassThatDoesSmthg expects as a part of its constructor an object of type interface class ClassThatIsInterface; however, what is sent to the constructor is an object of type ClassThatImplements which implements ClassThatIsInterface. Obviously, without the implementation, the new ClassThatDoesSmthg(this, appropriateVariable) statement would fail (generate an error). What is interesting to me; however, is that when a class implements an interface the implementing class is - in this case - considered an is-a ClassThatIsInterface (at least, that is how it appears). Consequently, the statement succeeds. So, here is my question: conceptually, what is happening to ClassThatImplements to where it is recogni…
type: AnsweredQuestion

http://stackoverflow.com/comment/38489645
has text: i cant post again question :( you have email? please help me ... i can't run my application in normal, tomorrow my project must be submitted to my lecture @Slyzz
type: Comment
comment on: http://stackoverflow.com/a/24797729
score: 0
type: AnswerComment

http://stackoverflow.com/comment/64824890
score: 0
type: AnswerComment
type: Comment
has text: Hi, RedisMessageBus does have `CompositeRedisQueueMessageDrivenEndpoint` but how does it achieve the mentioned scenario. In my case the only option is to use Redis @GaryRussell
comment on: http://stackoverflow.com/a/24766809

http://stackoverflow.com/q/24882772
has body: In C, C++ and C# there's #error directive which makes the compiler stop compilation and emit a specified error message. #error "Ouch!" causes VC++9 to emit the following: 1&gt;Source.cpp(10) : fatal error C1189: #error : "Ouch!" and stop compilation. I can't find anything equivalent for Java. Does Java have anything like #error directive that makes the compiler stop compilation and emit a specific error message?
upvote count: 2
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/24882859
accepted answer: http://stackoverflow.com/a/24882859
possible better answer: http://stackoverflow.com/a/24884944
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/24884944
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Can I make Java compiler emit a specific error message and stop compilation?
type: Question

http://stackoverflow.com/comment/38556914
comment on: http://stackoverflow.com/a/24833150
type: Comment
has text: @DavidConrad yes you right its saving all this in one record. Its basically a order taking app now i need to sync these records to web using web service and don,t need to normalize it because its the demand of the customer. All the records will further manage on web. By the way thanks for your this great help ... I really appreciate it :)
score: 0
type: AnswerComment

http://stackoverflow.com/q/24775113
has title: Using Locale from Resource Bundle in Java Spring
type: Question
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/24776006
tagged with: locale
has body: I'm learning to use resouce bundle for printing locale-dependent messages in my project. application.xml: &lt;bean class="org.springframework.context.support.ResourceBundleMessageSource"&gt; &lt;property name="basename" value="ru.bpc.svat.svnr.integration.banking.messages" /&gt; &lt;/bean&gt; &lt;bean class="ru.bpc.svat.svnr.integration.banking.application.SpringContextMessageFactory" /&gt; Directory src\main\resources\ru\bpc\svat\svnr\integration\banking contains files: messages.properties messages_ru.properties messages_ru_RU.properties each having line: test = testmessage In my test class I get an instance of message factory and try to get a message: @Autowired private MessageFactory messageFactory; ... messageFactory.getMessage("test", new Object[]{}, Locale.getDefault()); And then I get an exception: No message found under code 'test' for locale 'ru_RU'. What's wrong with it? This might be a foolish question, but it's my first experience. Thank you for your answers.
has answer: http://stackoverflow.com/a/24776148
answer count: 3
has answer: http://stackoverflow.com/a/24775199
tagged with: spring
has comment: http://stackoverflow.com/comment/38448530
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24775199
has answer: http://stackoverflow.com/a/24776006

http://stackoverflow.com/comment/38667799
comment on: http://stackoverflow.com/a/24889262
type: AnswerComment
has text: Thanks for your reply but don't think that is the problem, see my edit above.
score: 0
type: Comment

http://stackoverflow.com/comment/38674259
type: Comment
has text: Friend thanks for the answer ... I will try it and I will tell what happend !!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24895565

http://stackoverflow.com/q/24819573
has answer: http://stackoverflow.com/a/24819641
type: Question
type: AnsweredQuestion
tagged with: java
has body: I am fetching data from database in method BillnAmountFetch and getting value in main method I want to assign fetched velue to arrayList ar. My code to fetch data from database public List&lt;Object[]&gt; BillnAmountFetch(long cid) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); List&lt;Object[]&gt; obj = null; try { String hql = "select count(billNo), sum(total), invoiceDate from BillDetails " + "where client.id=:cid " + "group by invoiceDate " + "order by invoiceDate DESC"; Query query = session.createQuery(hql); query.setParameter("cid", cid); obj = query.list(); tx.commit(); } catch (HibernateException e) { if (tx != null) { e.printStackTrace(); tx.rollback(); } } finally { session.close(); } return obj; } Following is my code to print data received from above method public static void main(String[] args) { BillDAO bdo = new BillDAO(); List&lt;Object[]&gt; lst = bdo.BillnAmountFetch(1); BillDetails bd = new BillDetails(); ArrayList&lt;BillDetails&gt; ar = new ArrayList&lt;BillDetails&gt;(); Object[] count = lst.get(0); Object[] amount = lst.get(1); Object[] invoice_dts = lst.get(2); System.out.println("-----------Total Bills---------- "); for (int x = 0; x &lt; count.length; x++) { System.out.println("Total bills " + count[x]); } System.out.println("-------Total Amount--------- "); for (int x = 0; x &lt; amount.length; x++) { System.out.println("Amount " + amount[x]); } System.out.println("----------Total Invoice date---------- "); for (int x = 0; x &lt; invoice_dts.length; x++) { System.out.println("dates " + invoice_dts[x]); } } Output of the above program is -----------Total Bills---------- Total bills 3 Total bills 7281.00 Total bills 2014-07-15 -------Total Amount--------- Amount 7 Amount 14841.00 Amount 2014-07-12 ----------Total Invoice date---------- dates 3 dates 1294.00 dates 2014-07-11 BillDetails.java public class BillDetails implements java.io.Serializable { private Date invoiceDate; …
has answer: http://stackoverflow.com/a/24926996
accepted answer: http://stackoverflow.com/a/24926996
answer count: 3
possible better answer: http://stackoverflow.com/a/24819641
has title: Not able to assign values List<Object[]> values to ArrayList of specific type
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/24819744

http://stackoverflow.com/a/24751659
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24751275
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38401579
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38401666
has body: Don't use shared preference for this. Its not made for it, and the purpose of shared preference isn't to store everything. You already have it as JSON, just save the json as a file
has comment: http://stackoverflow.com/comment/38401878
accepted answer of: http://stackoverflow.com/q/24751275

http://stackoverflow.com/a/24795469
answers question: http://stackoverflow.com/q/24795388
score: 0
has body: You can achieve this task by using hibernate criteria query language as follows:- Crietria c=session.createCriteria(XYZ.class); c.setFirstResult(1); c.setMaxResult(500);
type: Answer

http://stackoverflow.com/q/24830205
type: UnansweredQuestion
downvote count: 2
has title: Another way for fill a ArrayList
tagged with: java
tagged with: fill
upvote count: 1
type: Question
has body: Why does it work? Could explain me how and why, please! List&lt;String&gt; list = new ArrayList&lt;String&gt;() { { add("one"); add("two"); add("three"); } }; for ( String element : list ) System.out.println(element);
linked to: http://stackoverflow.com/q/1958636
tagged with: arraylist
duplicate of: http://stackoverflow.com/q/1958636
has comment: http://stackoverflow.com/comment/38549809
answer count: 1
has comment: http://stackoverflow.com/comment/38549671
has answer: http://stackoverflow.com/a/24830254
favorite count: 0
score: -1

http://stackoverflow.com/a/24807668
has comment: http://stackoverflow.com/comment/38508311
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24807136
score: 1
has comment: http://stackoverflow.com/comment/38508553
has comment: http://stackoverflow.com/comment/38508835
has body: The advantage and disadvantage of using Maven is they tend to have a very restricted way of doing things based on what a group of people has deemed proper. Personally I do prefer the Maven way, but if I have to deal with migrations of an existing app which wasn't mavenized in thinking to begin with, I would start with the ant run plugin to just import stuff to ant and use the maven assembly plugin to set up which parts to release. Another approach would be to start with Gradle if you prefer the programming approach. I personally would avoid it because it makes things harder to ramp up for others in the future as it becomes very project specific even though it is easier for the first person to do it. Client JARs would generally be in its own project separate from the EJB and WAR modules. Though if this was a Java EE 6 and above project, I would eliminate the EJB modules and merge them into the WAR when applicable. However, that would require a more detailed analysis on what your project is like. If the client code is "generated" from the server code, the project should be simpler, in my case I had used a separate project that just uses the plugin and no versioned source aside from tests.
has comment: http://stackoverflow.com/comment/38508791
has comment: http://stackoverflow.com/comment/38508864
downvote count: 0

http://stackoverflow.com/q/24870467
has body: I have a lotus notes hava agent that retrieves slide data from powerpoint files attached in lotus notes documents with the help of Apache POI. Sometimes it works and sometimes it doesn't, and if it doesn't work, here's the common error stack trace. Java Console: Start blahblahblah.pptx File has pptx extension Reading embedded object... Read existing presentation org.apache.poi.POIXMLException: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException at org.apache.poi.xslf.usermodel.XMLSlideShow.&lt;init&gt;(XMLSlideShow.java:91) at org.apache.poi.xslf.usermodel.XMLSlideShow.&lt;init&gt;(XMLSlideShow.java:96) at JavaAgent.NotesMain(JavaAgent.java:98) at lotus.domino.AgentBase.runNotes(Unknown Source) at lotus.domino.NotesThread.run(Unknown Source) Caused by: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException at org.apache.poi.xslf.usermodel.XSLFFactory.createDocumentPart(XSLFFactory.java:66) at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:426) at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155) at org.apache.poi.xslf.usermodel.XMLSlideShow.&lt;init&gt;(XMLSlideShow.java:89) ... 4 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) at java.lang.reflect.Constructor.newInstance(Constructor.java:527) at org.apache.poi.xslf.usermodel.XSLFFactory.createDocumentPart(XSLFFactory.java:64) ... 7 more Caused by: java.lang.OutOfMemoryError: Java heap space at org.apache.xmlbeans.impl.store.Cur.createElementXobj(Cur.java:257) at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.startElement(Cur.java:2992) at org.apache.xmlbeans.impl.store.Locale$SaxHandler.startElement(Locale.java:3198) at org.apache.xmlbeans.impl.piccolo.xml.Piccol…
has comment: http://stackoverflow.com/comment/38626900
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24870944
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38659666
type: Question
has comment: http://stackoverflow.com/comment/38626458
has comment: http://stackoverflow.com/comment/38626597
answer count: 1
tagged with: lotus-notes
has answer: http://stackoverflow.com/a/24870944
has comment: http://stackoverflow.com/comment/38626389
tagged with: apache-poi
has title: InvocationTargetException when trying to read powerpoint file attachment from lotus notes documents

http://stackoverflow.com/q/24777549
tagged with: http://stackoverflow.com/tag/pdf
answer count: 4
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: itext
has answer: http://stackoverflow.com/a/24822063
type: Question
has title: How to add external CSS while generating PDF?
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/38451506
favorite count: 0
has answer: http://stackoverflow.com/a/24781441
has answer: http://stackoverflow.com/a/24777765
has body: Currently i am using following code to generate PDF in a JSP file: response.setContentType("application/force-download"); response.setHeader("Content-Disposition", "attachment;filename=reports.pdf"); Document document = new Document(); document.setPageSize(PageSize.A1); PdfWriter writer = null; writer = PdfWriter.getInstance(document, response.getOutputStream()); document.open(); ByteArrayInputStream bis = new ByteArrayInputStream(htmlSource.toString().getBytes()); XMLWorkerHelper.getInstance().parseXHtml(writer, document, bis); document.close(); With this am able to generate PDF. But i would like to add CSS file while generating PDF. Please Help me...
has answer: http://stackoverflow.com/a/24777672

http://stackoverflow.com/a/24773569
has comment: http://stackoverflow.com/comment/38442741
score: 0
has comment: http://stackoverflow.com/comment/38442699
answers question: http://stackoverflow.com/q/24773416
type: Answer
has body: I like to create a different method for every scenario. You've tested the "empty list" scenario. Here are some others: // The happy path @Test public void testMultipleCompanies() { Transact instance = new Transact(); List&lt;Company&gt; companies = instance.retrieveData("firstCompany,secondCompany"); assertTrue(companies.size() == 2); assertEquals(companies.get(0).getId().equals("firstCompany"); assertEquals(companies.get(0).getName().equals("firstCompany"); assertEquals(companies.get(1).getId().equals("secondCompany"); assertEquals(companies.get(1).getName().equals("secondCompany"); } // The null string scenario @Test(expected=NullPointerException.class) public void testNull() { Transact instance = new Transact(); instance.retrieveData(null); }
has comment: http://stackoverflow.com/comment/38442810

http://stackoverflow.com/comment/38801424
type: AnswerComment
has text: Thanks, David. Did you test it ? It seems similar to what I pasted. Thanks much for spending your time on this. Appreciate it.
type: Comment
comment on: http://stackoverflow.com/a/24854094
score: 0

http://stackoverflow.com/comment/103166894
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24760984
has text: My suggestion is that you use a library for this instead. A lot of alternatives are listed here: http://jsapar.blogspot.com/p/links.html and https://github.com/org-tigris-jsapar/jsapar is one suggestion but there are a lot of alternatives.

http://stackoverflow.com/comment/38405836
has text: Actually, the service client is a jar that I imported in my project. Does that have any implications that AOP will not work in this.
score: 0
comment on: http://stackoverflow.com/q/24753102
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38570134
score: 0
type: Comment
type: QuestionComment
has text: but as per title you want to add text in JFrame that can be achieved by JLabel.
comment on: http://stackoverflow.com/q/24841177

http://stackoverflow.com/comment/38691957
has text: It would be nice to know what test 9 is. By the way have you considered Files.newBufferedReader() available in Java 7? You can find more info on reading files at http://docs.oracle.com/javase/tutorial/essential/io/file.html.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24905332
type: Comment

http://stackoverflow.com/q/24782335
type: UnansweredQuestion
has body: I am using the 64bit jdk8 on win7. But I found an apparent bug when loading big data and binding it with tabview.itemsProperty().bind(service.valueProperty()) When I execute service.restart after dragging down the vertical scroll bar on the TableView, the TableView items doesn't change. This is my code: 1)task import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.concurrent.Task; public class TestTask extends Task&lt;ObservableList&lt;Person&gt;&gt; { @Override protected ObservableList&lt;Person&gt; call() throws Exception { ObservableList&lt;Person&gt; data = FXCollections.observableArrayList(); for (int i = 0; i &lt; 100000; i++) { data.add(new Person("Jacob" + i, "Smith" + i, "jacob.smith@example.com")); } return data; } } 2)Person import javafx.beans.property.SimpleStringProperty; public class Person { private final SimpleStringProperty firstName; private final SimpleStringProperty lastName; private final SimpleStringProperty email; Person(String fName, String lName, String email) { this.firstName = new SimpleStringProperty(fName); this.lastName = new SimpleStringProperty(lName); this.email = new SimpleStringProperty(email); } public String getFirstName() { return firstName.get(); } public void setFirstName(String fName) { firstName.set(fName); } public String getLastName() { return lastName.get(); } public void setLastName(String fName) { lastName.set(fName); } public String getEmail() { return email.get(); } public void setEmail(String fName) { email.set(fName); } } 3) controller public class FXMLDocumentController implements Initializable { @FXML private TableView&lt;Person&gt; tv_table; @FXML private TableColumn tc_firstName; @FXML private TableColumn tc_lastName; @FXML private TableColumn tc_email; TestServer ts = new TestServer(); ObservableList&lt;Person&gt; data = FXCollections.observableArrayList(); @Override public void initialize(URL url, ResourceBundle rb) { tc_firstName.setCellValueFactory(new PropertyValue…
answer count: 0
tagged with: javafx
has comment: http://stackoverflow.com/comment/38524779
has comment: http://stackoverflow.com/comment/38485595
type: Question
has title: Javafx8 use TableView and Service load big data items bug
has comment: http://stackoverflow.com/comment/38470605
tagged with: java
score: 0
tagged with: javafx-8
tagged with: tableview

http://stackoverflow.com/q/24756615
favorite count: 0
has title: Mocking the sort method from Collections
tagged with: powermock
has comment: http://stackoverflow.com/comment/38420008
has comment: http://stackoverflow.com/comment/38418112
has comment: http://stackoverflow.com/comment/38446841
has answer: http://stackoverflow.com/a/24764022
score: 2
linked to: http://stackoverflow.com/q/22981048
has body: I have a code that I want to unit test. The code uses Collections.sort method providing it with our own sweet comparator something like : List&lt;Something&gt; something = somethingService.doSomething(someParameter); Collections.sort(something, somethingComparator); Now while testing the function I am mocking the somethingService and stubbing the doSomething method like : List&lt;Something&gt; mockList = Mockito.mock(List.class); Mockito.when(somethingService.doSomething(anyInt())).thenReturn(mockList); and I am mocking the Collections as : PowerMockito.mockStatic(Collections.class); PowerMockito.doNothing().when(Collections.class, "sort", anyListOf(Something.class), anyOf(Comparator.class)); But it is giving me : org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Misplaced argument matcher detected You cannot use argument matchers outside of verification or stubbing. Now I do know that if we are using argument matchers in any param of a function we need to provide matchers to all the params. But here is it possible to do the same and if not then what is the existing workaround?
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38419026
has comment: http://stackoverflow.com/comment/38446018
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/38414620
tagged with: java
has comment: http://stackoverflow.com/comment/38441837
tagged with: mockito
has comment: http://stackoverflow.com/comment/38445715
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/38413776
downvote count: 0

http://stackoverflow.com/a/24852841
upvote count: 2
has body: You pass an instance of type DataOut to tah.handle, however, it expects some subtype of it - for example, it should be clear that the following code should not compile: interface DataOut { } interface SomeDataOut extends DataOut { } class TranslatorAndHandler&lt;T extends DataOut&gt; { public void handle(T t) { } } public class Main { public static void main(String[] args) { TranslatorAndHandler&lt;SomeDataOut&gt; tah = null; DataOut t = null; tah.handle(t); } } And it indeed causes a compilation error: incompatible types: DataOut cannot be converted to SomeDataOut A possible fix is making Wrapper class generic like this: public class Wrapper&lt;T extends DataOut&gt; { private final TranslatorAndHandler&lt;T&gt; tah = getCorrectTAH(); private T savedData; public Wrapper(DataIn dataIn) { savedData = tah.translate(dataIn); } public void handleData() { tah.handle(savedData); } } However, in this case tah field can't be static, since it's not possible to refer to type parameters from static members.
has comment: http://stackoverflow.com/comment/38592413
downvote count: 0
answers question: http://stackoverflow.com/q/24852410
has comment: http://stackoverflow.com/comment/38592491
has comment: http://stackoverflow.com/comment/38592506
type: Answer
score: 2

http://stackoverflow.com/q/24752580
accepted answer: http://stackoverflow.com/a/24753111
favorite count: 0
has comment: http://stackoverflow.com/comment/38403697
has body: it just simple Android code like this there was a textview and a list view. public class MaintActivity extends Activity { private TextView text = (TextView)super.findViewById(R.id.text); //cause android application crash public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); super.setContentView(R.layout.main); //when I write this.text = (TextView) super.findViewById(R.id.text); here, I get rid of crashing } }
tagged with: android
has answer: http://stackoverflow.com/a/24753570
possible better answer: http://stackoverflow.com/a/24752676
has title: Can I use super.someMethod to init a member variable in Java?
has answer: http://stackoverflow.com/a/24752676
type: AnsweredQuestion
tagged with: oop
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/24753111
type: Question
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/38403740
has comment: http://stackoverflow.com/comment/38403305
has comment: http://stackoverflow.com/comment/38403413
answer count: 3

http://stackoverflow.com/comment/38690545
type: QuestionComment
comment on: http://stackoverflow.com/q/24903881
score: 0
has text: I have KVNO set on 3 in keytab and wating on keytab with kvno 0 maybe this will help.
type: Comment

http://stackoverflow.com/comment/38637535
type: Comment
type: QuestionComment
has text: Yes that's what I've done. You can also write some JavaScript wrappers of your own, and then from the Java side you can "inject" them into the global context that subsequent JavaScript code will see.
score: 0
comment on: http://stackoverflow.com/q/24876087

http://stackoverflow.com/q/24847413
tagged with: vb.net
has comment: http://stackoverflow.com/comment/59264770
has title: ErrorProvider like in VB.net for Java
has body: Is there any component in java that behaves like the Error Provider in Vb.net? Or what can you suggest for an alternative? I don't want to use a JOptionPane just to show the error. Thank you.
tagged with: java
has answer: http://stackoverflow.com/a/78058100
type: Question
has comment: http://stackoverflow.com/comment/38581922
score: 0
has comment: http://stackoverflow.com/comment/38581897
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/38579447
type: Comment
type: QuestionComment
has text: @AmitChotaliya it happens all the time, I can connect to jdbc:mysql://localhost:3306/test and jdbc:mysql://127.0.0.1:3306/test without issue at command line, ports are open
comment on: http://stackoverflow.com/q/24835592
score: 0

http://stackoverflow.com/comment/38422696
has text: I also use IntelliJ to do application development and run the application (Run as Application) if it helps any. I've been thinking that maybe the problem is running the application with an embedded Tomcat is the problem. Should I run it in a real Tomcat when in development(to get refresh working properly) and deploy the final application with embedded Tomcat? I haven't found any recommendations in the Spring guides yet that says what is the best way to do this kind of development which bums me out.
comment on: http://stackoverflow.com/q/24762657
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/38654767
has text: @StephenC: If so, by what mechanism does the thread get dumped? How do I intercept/debug/analyze to find the cause?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24885418
score: 0

http://stackoverflow.com/a/52806589
type: Answer
has body: Old question! But I was looking for a solution to just this problem. I was having problems dealing with the IHTTPSession input stream. Turns out the stream would prematurely run empty when reading it, and you have to go back for more. This occurred when I was sending application/octet-stream data larger than around 500k (I didn't profile for an exact figure). My solution is to open the IHTTPSession input stream, and iteratively read the input stream until it is FULLY exhausted: public Response post_upload(IHTTPSession session) { System.out.println("received HTTP post with upload body..."); int streamLength = Integer.parseInt(session.getHeaders().get("content-length")); System.out.println("Content length is: " + streamLength); byte[] fileContent = new byte[streamLength]; try { InputStream input = session.getInputStream(); int bytesRead = 0; int iterations = 0; while (bytesRead &lt; streamLength) { int thisRead = input.read(fileContent, bytesRead, streamLength-bytesRead); bytesRead += thisRead; iterations++; } System.out.println("Read " + bytesRead + " bytes in " + iterations + " iterations."); } catch (Exception e) { System.out.println("We have other problems..."); } return newFixedLengthResponse(Response.Status.OK, "application/json", "[\"no prob\"]"); } I hope this helps.
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/24867734
downvote count: 0
has comment: http://stackoverflow.com/comment/117339797

http://stackoverflow.com/a/24812631
has body: Yes, it's illegal for a local variable to have any access modifier: public, protected, or private. The JLS, Section 14.4, defines what can be a part of a local variable declaration, and it doesn't include access modifiers: only an annotation and/or final. LocalVariableDeclaration: {VariableModifier} UnannType VariableDeclaratorList and VariableModifier: Annotation final Also, local variables' scopes are already limited to the block in which they're declared.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24812532

http://stackoverflow.com/comment/38492987
score: 0
has text: have you tried to add a new JPanel to the CENTER element and set its layout to gridlayout? If you make it with 0 lines and 1 column that should do the trick for any number of buttons (I haven't tested it) After that you just need to add the scroll...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24799301

http://stackoverflow.com/q/24847353
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38581848
has comment: http://stackoverflow.com/comment/38582204
accepted answer: http://stackoverflow.com/a/24847696
tagged with: java
has comment: http://stackoverflow.com/comment/38581874
has comment: http://stackoverflow.com/comment/38581960
has body: I have a vendor application which is deployed in Tomcat 6 on a Windows 2008 server. This application is not working in that server but when I copied the Tomcat to another machine which runs Windows 7 it is working. When I analysis the logs that ClassLoader.getResourceAsStream is returning null in the Windows 2008 server but not in the Windows 7 machine. I checked the windows file permission the tomcat webapp folder full control has given to the user wihr runs the tomcat server. What could be the reason for this. PS: This is a vendor application so i don't have control over the code.
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38581921
has title: Loading resources using ClassLoader.getResourceAsStream is not working in a particular machine
tagged with: tomcat
score: 0
has answer: http://stackoverflow.com/a/24847696
answer count: 1
tagged with: classloader
has comment: http://stackoverflow.com/comment/38583357
has comment: http://stackoverflow.com/comment/38582433

http://stackoverflow.com/comment/38660357
score: 0
has text: Removing class path references from manifest file did not help !!!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24859975

http://stackoverflow.com/comment/38581703
has text: They are vertical because you have `android:orientation="vertical"` on the LinearLayout. Change that to horizontal.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24847288

http://stackoverflow.com/q/24851150
has comment: http://stackoverflow.com/comment/38589131
answer count: 2
upvote count: 0
has title: Java not compiling changes in my code
has comment: http://stackoverflow.com/comment/38589164
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
downvote count: 2
has body: I have this problem with both Netbeans 8.0 and Eclipse. In Eclipse when I can write a Java program and it will compile and run fine. Then I can make a change to the source and when I run it again sometimes the old version of the code without the change in the one that is run. If I hit run a second time the new version is run. In NetBeans I get a different error the second time I try to run updated code. "Could not find or load main class". This happens sometimes when I make changes to the source. I think this might have a similar cause to what is going on in Eclipse. In both cases the problems are intermittent and difficult to reliably reproduce. I am using JDK 7 but before I was using JDK 8 and had the same problem.
has answer: http://stackoverflow.com/a/24851230
has comment: http://stackoverflow.com/comment/38589059
score: -2
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24851220

http://stackoverflow.com/comment/38892723
type: QuestionComment
comment on: http://stackoverflow.com/q/24804704
has text: I have already seen that , but I need the communication over wi fi ..and above that the parsing of incoming data using OBD II protocol.
score: 0
type: Comment

http://stackoverflow.com/q/24856923
answer count: 1
accepted answer: http://stackoverflow.com/a/24856979
favorite count: 0
has comment: http://stackoverflow.com/comment/38600685
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38600794
tagged with: java
downvote count: 3
has body: I want to scan 20 integers from the user. Once the user enters a negative value, the scan stops. After that, how can I add the positive values that the user entered into an array? System.out.println("\nEnter up to 20 non-negative numbers:"); for(i = 0; i &lt;= list20.length; i++) { System.out.print("Number " + (i+1) + ": "); input = scan.nextInt(); if(input &gt; 0) { input = input.list20[i] // How to add positive integer here?? } else break; }
has answer: http://stackoverflow.com/a/24856979
type: Question
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/38600690
tagged with: variables
has comment: http://stackoverflow.com/comment/38601193
has title: How do I add an evaluated scan object into an array?
has comment: http://stackoverflow.com/comment/38600717
has comment: http://stackoverflow.com/comment/38604413
has comment: http://stackoverflow.com/comment/38600779

python
tags question: http://stackoverflow.com/q/24872557
tags question: http://stackoverflow.com/q/24901178
tag name: python
tags question: http://stackoverflow.com/q/24864788
tags question: http://stackoverflow.com/q/24902240
tags question: http://stackoverflow.com/q/24908276
tags question: http://stackoverflow.com/q/24891412
type: Tag
tags question: http://stackoverflow.com/q/24877200
tags question: http://stackoverflow.com/q/24833297
tags question: http://stackoverflow.com/q/24845926
tags question: http://stackoverflow.com/q/24814827
tags question: http://stackoverflow.com/q/24854175
tags question: http://stackoverflow.com/q/24789310
tags question: http://stackoverflow.com/q/24902919

http://stackoverflow.com/comment/38460112
comment on: http://stackoverflow.com/q/24772041
has text: That sounds like bad design. When you release and close a socket properly it becomes reusable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38541764
score: 0
type: Comment
type: QuestionComment
has text: GameLoop() is working properly coz when i call newGame() method from within the Framework class it is accessible. My problem is how to call newGame() method through jButton1 in WindowForm class ?
comment on: http://stackoverflow.com/q/24809436

http://stackoverflow.com/a/24869636
has body: You are writing two HYB objects to the stream, but only reading one out. You need to readObject() twice.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24869417

http://stackoverflow.com/comment/38399616
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24750362
has text: Can you confirm that the data has been commited by means of the HSQL Database Manager? In short, can you query your data outside of your app scope?

http://stackoverflow.com/comment/38442492
has text: what exactly is `cellValue`? and any specific reasons for using [`404`](http://en.wikipedia.org/wiki/HTTP_404) for success?
type: QuestionComment
comment on: http://stackoverflow.com/q/24771278
score: 0
type: Comment

http://stackoverflow.com/q/24754954
type: Question
downvote count: 0
has body: I want to have multiply database schema in hibernate. I try with many Spring context on single Tomcat application (one context for each test scenario): AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(LocalBankConfig.class); Map&lt;String, Object&gt; myProps = new HashMap&lt;&gt;(); myProps.put("simulationId", simulationId); ctx.getEnvironment().getPropertySources().addFirst(new MapPropertySource("simulation.properties", myProps)); ctx.refresh(); and I use Spring annotation in business model: @PersistenceContext private EntityManager em; … @Transactional method But this approach doesn't seem to work. Only EntityManager from the last created String context is injected. Any ideas of how can i solve it out are welcome.
answer count: 1
favorite count: 0
has title: Multiply database schema in single Spring application
has answer: http://stackoverflow.com/a/24755344
type: UnansweredQuestion
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1

http://stackoverflow.com/comment/38536788
type: QuestionComment
has text: See: http://stackoverflow.com/questions/16597303/extract-string-between-two-strings-in-java
comment on: http://stackoverflow.com/q/24823422
score: 0
type: Comment

http://stackoverflow.com/a/24863760
answers question: http://stackoverflow.com/q/24863577
score: 0
type: Answer
has body: Try this Java Deep-Cloning Library Cloner cloner = new Cloner(); MyClass other = ...; MyClass clone = cloner.deepClone(other);

http://stackoverflow.com/q/24865329
tagged with: size
has title: Create a custom collection which can store millions of entries
has answer: http://stackoverflow.com/a/24865516
tagged with: list
tagged with: java
tagged with: collections
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38648485
has body: I currently have a specific need with Tables/ArrayList/Collections. Indeed, I have to store up to 15 000 000 (fifteen millions) instances of a custom class into a table/List/Collection. It seems that the generic collection classes and tables are not able to store this amount of entries. Actually, my need is to be able to handle the table index with a Long. I made somes searches, and have found many tutorials showing me how to create a custom collection. The problem is the fact that all those examples have the same size limit. Do you know any way for me to be able to create something like that? Thank you in advance! PS: Sorry for my english writing mistakes.
has comment: http://stackoverflow.com/comment/38616347
score: 0
has answer: http://stackoverflow.com/a/24865410
type: UnansweredQuestion

http://stackoverflow.com/comment/38632162
type: QuestionComment
comment on: http://stackoverflow.com/q/24873321
score: 2
has text: I would also point out that you look at the difference between `mousePressed()` and `mouseClicked()`. If you want it to be when the mouse is pressed and released (as opposed to only when the button is pressed down), take a look at the latter method.
type: Comment

http://stackoverflow.com/q/24833296
has answer: http://stackoverflow.com/a/24833445
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38556137
tagged with: linux
tagged with: android
has body: This is my scenario: -) I have a shared library called libpsp.so generated by ndk-build. This lib was generated using around 30 .c files. Android.mk used: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Here we give our module name and source file(s) LOCAL_MODULE := psp LOCAL_SRC_FILES := (My .c files) include $(BUILD_SHARED_LIBRARY) -) ndk-build automatically put the libpsp.so in the dir /libs/armeabi -) On my Java code I have: private native int calculateCoefficient(double w, double v_st_e_prev, double c_l); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); **//Loads successfully System.loadLibrary("psp");** if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } TextView lv = (TextView)findViewById(R.id.textView); **//Returns an error: unsatisfiedlinkerror native method not found lv.setText(Integer.toString(calculateCoefficient(1,1,1)));** } -) One of the .c files used to build the shared library has the calculateCoefficient method with the signature: sint32_t calculateCoefficient(double_t w, double_t v_st_e_prev, double_t *c_l); So if the calculateCoefficient method is present in the .so library, why can't Android find it? I just started working with NDK so sorry if I missed something to obvious, but I've done some research and I can't find the answer to this. UPDATE1: I don't have access to the actual code, the library was generated by someone else, all I have are the .h files with the methods signatures. So I can't edit the .c files used to create the library.
type: UnansweredQuestion
tagged with: android-ndk
downvote count: 0
score: 1
tagged with: java
has title: Error loading existing shared library (.so) on Android app (unsatisfiedlinkerror native method not found)
tagged with: http://stackoverflow.com/tag/c
type: Question

http://stackoverflow.com/q/24840600
has answer: http://stackoverflow.com/a/24841828
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24841828
score: 1
has title: Default naming policy for columns - is it possible? (JPA)
tagged with: java
tagged with: hibernate
type: Question
has body: JPA newbie here. Here's my question: Say we have an entity like this: @Entity @Table(name="thingies") public class Thingy implements Serializable { private Long thingyId; private String thingyName; private Integer thingyPrice; // Constructor, getters, setters } Mapped to a table like this: create table thingies ( thingy_id serial primary key, thingy_name text, thingy_price smallint ); Is there a way to make the provider aware of the attribute naming policy instead of needing to explicitly provide a @Column annotation on each getter? In other words, can we automatically map all underscored names to the corresponding camelcased names without using @Column? (I know I can quote names, that is not an answer to my question above.)
answer count: 2
tagged with: configuration
tagged with: jpa
possible better answer: http://stackoverflow.com/a/24840782
tagged with: database
has answer: http://stackoverflow.com/a/24840782
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24816852
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38524745
score: 7
has body: I think you want to use a Map&lt;Integer, Integer&gt; instead of a List. You should probably move that collection outside of your method (so it can cache the results) - private static Map&lt;Integer, Integer&gt; results = new HashMap&lt;&gt;(); public static int fasterFib(int n) { if (n == 0) { return 0; } else if (n &lt;= 2) { // if return 1; } if (results.get(n) != null) { return results.get(n); } else { int v = fasterFib(n - 1) + fasterFib(n - 2); results.put(n, v); return v; } } This optimization is called memoization, from the Wikipedia article - In computing, memoization is an optimization technique used primarily to speed up computer programs by keeping the results of expensive function calls and returning the cached result when the same inputs occur again.
type: Answer
has comment: http://stackoverflow.com/comment/38525179
answers question: http://stackoverflow.com/q/24816735
accepted answer of: http://stackoverflow.com/q/24816735
upvote count: 7

http://stackoverflow.com/a/24836910
accepted answer of: http://stackoverflow.com/q/24836853
score: 2
has body: For real-time filteration of text components, you should be using a DocumentFilter. Take a look at Implementing a DocumentFilter and these examples. The likely cause is you are getting a concurrent modification error, where you are trying to modify the underlying fields document while it is been modified.
answers question: http://stackoverflow.com/q/24836853
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38570146
type: Answer

http://stackoverflow.com/q/24751922
has title: How to set a breakpoint in a setter method in IntelliJ IDEA that is generated with Lombok?
has answer: http://stackoverflow.com/a/64861277
accepted answer: http://stackoverflow.com/a/24753067
tagged with: intellij-idea
downvote count: 0
possible better answer: http://stackoverflow.com/a/34963918
has answer: http://stackoverflow.com/a/34963918
favorite count: 0
upvote count: 30
answer count: 5
score: 30
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24753067
has answer: http://stackoverflow.com/a/24752363
type: Question
tagged with: lombok
has answer: http://stackoverflow.com/a/48005095
tagged with: java
tagged with: hibernate
has body: Is there a way in IntelliJ IDEA to set a breakpoint in a setter method that is generated by Lombok? This would be very useful in certain debugging scenarios, e.g. to see when the setter is called from a framework like Hibernate. In fact, the generated setter methods are displayed in the structure view of IntelliJ IDEA (Lombok plugin in use). But I've not found a way to set a breakpoint via the context menu or such.

http://stackoverflow.com/a/24779696
type: Answer
has body: add the src folder to your classpath javac -cp ./src src/tries.java or step into src and call javac -cp ./ tries.java
downvote count: 0
has comment: http://stackoverflow.com/comment/38454208
has comment: http://stackoverflow.com/comment/38454128
score: 1
accepted answer of: http://stackoverflow.com/q/24779627
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24779627

http://stackoverflow.com/comment/38601280
comment on: http://stackoverflow.com/a/24857277
type: Comment
has text: Not the [dreaded Applet!!!](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38402587
type: Comment
comment on: http://stackoverflow.com/a/24751345
score: 0
type: AnswerComment
has text: it is showing 404 exception while fetching files through ajax cmnctn(it shd fetch n display those files in web page)..

http://stackoverflow.com/a/24885913
has body: Do separate try-catch blocks inside the sections of the if or use a finally block for code you always want to execute. You have two separate issues, the first is the findElement within the conditional. To handle that you need to do the find separately then do the if. Element elem = null try { elem = driver.findElement(By.xpath("/html/body/form/div[4]/div[3]/div[1]/div[1]/div[1]/span[1]")); } catch (org.openqa.selenium.NoSuchElementException e) { System.out.println("No Such Element Exception."); } Then after that you need to handle it within the else if (elem != null &amp;&amp; elem.isDisplayed()){ System.out.println("Critical Error Occured."); driver.close(); } else{ try { String msg = driver.findElement(By.xpath("/html/body/form/div[4]/div[3]/div[1]/div[1]/div/div/div[1]/div/div[2]/div/div[1]/span")).getText(); if (msg.equals("User already registered")){ driver.findElement(By.name("dnn$ctr5995$View$btnOk")).click(); System.out.println(msg); driver.close(); } else if (msg.equals("Admission number already exist.")) { driver.findElement(By.name("dnn$ctr5995$View$btnOk")).click(); System.out.println(msg); System.out.println("Please change the admission number."); driver.quit(); } else if (msg.equals("Saved Successfully.")){ driver.findElement(By.name("dnn$ctr5995$View$btnOk")).click(); System.out.println(msg); } } catch ( org.openqa.selenium.NoSuchElementException e){ } }
has comment: http://stackoverflow.com/comment/38655450
answers question: http://stackoverflow.com/q/24885837
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24885837
has comment: http://stackoverflow.com/comment/38657153
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38656896
type: Answer
score: 4

http://stackoverflow.com/q/24777987
type: Question
has title: iText RTF - Text leading on footer doesn't work
has body: I want to have text inside footer with leading -1, but my code doesen't work (If I add same phrase inside body of word and footer, text leading on body shows correctly but text leading on footer not). Here my code: BaseFont hbf = BaseFont.createFont("/Fonts/arial.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED); Font fontArialHeaderFooter = new Font(hbf, 8, Font.NORMAL, Color.BLACK); Phrase foot = new Phrase( "_________________________________________________________________________________________________________", fontArialHeaderFooter); //Position of page number with \t Phrase textFoot = new Phrase( "Carrer de la XXXX, 2\r\nXXXXX Barcelona\r\nTel. XX XXX XX XX\r\nFax. XX XXX XX XX\t\t\t\t\t\t\t\t\t\t\t ", fontArialHeaderFooter); foot.setLeading(-1); textFoot.setLeading(-1); foot.add(textFoot); //Add Phrase on footer with page number (attribute "true") HeaderFooter footer = new HeaderFooter(foot, true); word.setFooter(footer); //Add same Phrase inside body of word document to compare body with footer word.add(foot); Result here: Why doesn't the footer show leading correctly, and how can I fix it?
downvote count: 0
tagged with: footer
favorite count: 0
has comment: http://stackoverflow.com/comment/38457453
answer count: 0
type: UnansweredQuestion
tagged with: itext
upvote count: 1
tagged with: rtf
score: 1
tagged with: java

http://stackoverflow.com/comment/119374640
comment on: http://stackoverflow.com/a/24868568
type: AnswerComment
has text: `printf '000b3030303041303030303255' | xxd -r -p | nc localhost 9998` /0000A100UD380C66E7D96F2B36592FA8EFFE9A5AFFD9184 with `vmantek/thales-sim`
score: 0
type: Comment

http://stackoverflow.com/comment/38689996
has text: There's not `setText` method in your example
comment on: http://stackoverflow.com/a/24903021
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24901356
has comment: http://stackoverflow.com/comment/38685245
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24901320
has comment: http://stackoverflow.com/comment/38685442
score: 1
has comment: http://stackoverflow.com/comment/38685213
has comment: http://stackoverflow.com/comment/38684986
has body: static is not your friend here... public static JTextField percentLine = null; private static String DEFAULT_PERCENT = "90.0"; private static float percentage; private static JFrame errorWindow; private static JButton enterPercent; This means that only a single instance of each of the fields will be shared across all instances of your StatVisualizerAddOn object. Remove the static reference, for example public JTextField percentLine = null; private String DEFAULT_PERCENT = "90.0"; private float percentage; private JFrame errorWindow; private JButton enterPercent;
answers question: http://stackoverflow.com/q/24901320
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38684930
has comment: http://stackoverflow.com/comment/38685417
type: Answer

http://stackoverflow.com/q/24804581
has comment: http://stackoverflow.com/comment/38501237
downvote count: 0
possible better answer: http://stackoverflow.com/a/24804960
answer count: 3
has comment: http://stackoverflow.com/comment/38501871
tagged with: string
favorite count: 0
has body: I am currently using the static String method String.format(String, Object) to format a string which represents a number. I am truncating the string so that there is only two digits after the decimal place. if (!firstString[2].replaceAll("[^\\d.]", "").equals("")) secondString = String.format("%.2f", Float.valueOf(firstString[2].replaceAll("[^\\d.]", ""))); I would like to know how to go about getting the formatted string to have exactly two decimal places even if it is a whole number or doesn't have a tens significant digit.
has answer: http://stackoverflow.com/a/24806417
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24804960
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24804759
accepted answer: http://stackoverflow.com/a/24804759
has title: Convert a number to a String with exactly 2 decimal places
linked to: http://stackoverflow.com/q/8553672
type: Question

http://stackoverflow.com/comment/38558607
type: AnswerComment
has text: @IndranilBanerjee: re `"what should I do"` -- better define your current problem if you're still having them.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24832750

http://stackoverflow.com/comment/38494719
comment on: http://stackoverflow.com/a/24800828
score: 0
type: Comment
type: AnswerComment
has text: Platform.getPlatform() didn't exist

http://stackoverflow.com/a/25545591
answers question: http://stackoverflow.com/q/24880698
score: 0
has body: Yes i got same issue finally resolve this gotcha. In controller you have to change authorize admin url '/admin/oAuth_authorize' to '/admin/oauth_authorize'. Its a case sensitive.
type: Answer

http://stackoverflow.com/a/24886874
has comment: http://stackoverflow.com/comment/38664979
type: Answer
has comment: http://stackoverflow.com/comment/38667900
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38669271
has comment: http://stackoverflow.com/comment/38666398
has body: IMHO You should use static methods when there is no arguments (rare) there is no way to extend the class of interest e.g. you want to add a method for a String. you want to add a method to an interface (pre Java 8) Otherwise a static method is much the same as an instance method where you are taking the first argument implicitly. i.e. you can simply transform one into the other. Consider these recursive method calls. class Type { static ReturnType staticMethod(Type type, Object arg) { return type.method(arg); } ReturnType method(Object arg) { return staticMethod(this, arg); } } IMHO you should use instance methods for clarity as much as possible, and leave static methods to the rare cases you have no alternative. Note: you can use functional programming whether you use static method or not. The main principle to remember is a) always return what you create/change as a return value b) don't change any of the arguments, including this for instance methods. This gives you the flexibility to break this a little to; only change this rather than one of the arguments (and only if you have to)
has comment: http://stackoverflow.com/comment/38656994
answers question: http://stackoverflow.com/q/24886563
upvote count: 1

http://stackoverflow.com/a/24812766
answers question: http://stackoverflow.com/q/24812265
score: 0
has body: As of Java 8.0 the keyword "constant" does not exist. If you mean "const": This keyword is in the known keywords in Java (from the beginning until today - 8.0), but it has no use and any compiler shouldn't compile if it find's this keyword. Enumerations: Use them when you have specific logical values and don't want to handle them in String, like: public enum AcceptableColours { BLACK, WHITE, GREY } It's much safer during development time to match enum values AcceptableColours currentColour = object.getColour; if (currentColour == acceptableColours.BLACK) { // do something } else if (currentColour == acceptableColours.WHITE) { // do something different } than to match string values AcceptableColours currentColor = object.getColour; if (currentColor.equals("black")) { // do something } else if (currentColor.equals("white")) { // do something different } ... imagine huge applications with much more variations on enum values (like banking software, insurance software, ...), where it's much easier to misspell some string values, and voilà, happy debugging...
type: Answer

http://stackoverflow.com/comment/38520391
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24814420
type: QuestionComment
has text: @azurefrog Could you provide an example an an answer? As a really new user to Java, this is already over my head. Looks like I have some more learning to do.

http://stackoverflow.com/q/24894342
favorite count: 0
has answer: http://stackoverflow.com/a/24973807
has answer: http://stackoverflow.com/a/24977692
has comment: http://stackoverflow.com/comment/38824971
has comment: http://stackoverflow.com/comment/38825084
has title: Deserializing fails for a class implementing Collection with Jackson
linked to: http://stackoverflow.com/q/21278811
score: 11
downvote count: 1
has comment: http://stackoverflow.com/comment/38823726
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24973807
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38824985
type: Question
answer count: 2
upvote count: 12
accepted answer: http://stackoverflow.com/a/24977692
has body: I have the following JSON: { "item": [ { "foo": 1 }, { "foo": 2 } ] } This is basically an object that contains a collection of items. So I made a class to deserialize that: public class ItemList { @JsonProperty("item") List&lt;Item&gt; items; // Getters, setters &amp; co. // ... } Everything is working nicely up to this point. Now, To make my life easier somewhere else, I decided that it would be nice to be able to iterate on the ItemList object and let it implement the Collection interface. So basically my class became: public class ItemList implements Collection&lt;Item&gt;, Iterable&lt;Item&gt; { @JsonProperty("item") List&lt;Item&gt; items; // Getters, setters &amp; co. // Generated all method delegates to items. For instance: public Item get(int position) { return items.get(position); } } The implementation works properly and nicely. However, the deserialization now fails. Looks like Jackson is getting confused: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.example.ItemList out of START_OBJECT token I have tried to add @JsonDeserialize(as=ItemList.class) but it did not do the trick. What's the way to go?
tagged with: jackson
has comment: http://stackoverflow.com/comment/38823316

http://stackoverflow.com/a/24897360
accepted answer of: http://stackoverflow.com/q/24897276
has body: Returning values based on a key is precisely what maps are for. To retrieve your value you can simply do: short returnVal = map.get("String2");
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24897276

http://stackoverflow.com/comment/38514374
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24810686
has text: Try this : <Your_Class>.class.getResourceAsStream("/sample.xml")

http://stackoverflow.com/comment/38501187
score: 0
type: Comment
has text: Call it a co-incident... I applied the same approach with PreapredStatement by setting Resultset as Type_forward and Concor_read. I tried ScrollableResults too with StatelessSession but it felt like forcing myself to use Hibernate, so I settled for generic JDBC. To avoid any memory issues I'm getting the records in bunches say 20 thousand at a time and then doing the IO operation. It's a little slow but eliminates the risk of OutOfMemeoyError
type: AnswerComment
comment on: http://stackoverflow.com/a/24800526

http://stackoverflow.com/q/24774142
has comment: http://stackoverflow.com/comment/38561203
has comment: http://stackoverflow.com/comment/38445396
type: Question
answer count: 2
has title: error in using getAbsolutePath function in java
has answer: http://stackoverflow.com/a/24774383
score: 0
has comment: http://stackoverflow.com/comment/38443919
has answer: http://stackoverflow.com/a/24774787
has body: My xml file is place in this path "C/users/input/abc.xml". I am executing code from "c/users/prg/abc.java" Using getAbsolutePath function on Xml file object but i am getting this"c/users/prg/abc.xml" as result. i have already tried using the below code: File file = new File("C:\\users\\Input\\abc.xml"); String absPath = file.getAbsolutePath(); System.out.print(absPath); output: C\users\prg\abc.xml is it Classpath issue? or Am i doing something wrong?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38443975
tagged with: java
has comment: http://stackoverflow.com/comment/38444232
has comment: http://stackoverflow.com/comment/38445870

http://stackoverflow.com/comment/38670674
score: 0
type: Comment
type: AnswerComment
has text: no, you need to change your topology definition. I updated the answer to reflect the correct definition
comment on: http://stackoverflow.com/a/24841003

http://stackoverflow.com/comment/38644533
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24879818
has text: How should I do that? Should I use invokeLater() in the main method or something?.
type: AnswerComment

fips
tags question: http://stackoverflow.com/q/24847742
type: Tag
tag name: fips

http://stackoverflow.com/a/24838005
type: Answer
has body: Have your keyRows start with the name of the test method in the first cell and the following fields will be used for parameter name mapping. All test-data containing rows will have to start with a empty cell in the first column. Just see the source at ExcelDataLoader.loadFromSpreadsheet() and ExcelDataLoader.initializeRowData() or the Documentation.
score: 0
answers question: http://stackoverflow.com/q/24837351

http://stackoverflow.com/comment/38581579
score: 0
comment on: http://stackoverflow.com/a/24847176
type: Comment
has text: @cursayer: but if your goal is to call multiple methods within an if block, then yes, this is possible. That is why we have *code blocks* in Java. Please edit and clarify your question if at all possible.
type: AnswerComment

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/24759191
tags question: http://stackoverflow.com/q/24841588
type: Tag
tags question: http://stackoverflow.com/q/24762086
tags question: http://stackoverflow.com/q/24845064

http://stackoverflow.com/q/24870088
type: UnansweredQuestion
score: -3
tagged with: java
has comment: http://stackoverflow.com/comment/38625558
has answer: http://stackoverflow.com/a/24870194
downvote count: 3
has comment: http://stackoverflow.com/comment/38625544
has title: What variable needs to be identified?
type: Question
upvote count: 0
tagged with: variables
has comment: http://stackoverflow.com/comment/38625597
answer count: 1
has body: I am a beginner in java. There is an error which appears 15 times in lines 24, 27, 29, 30, 35, 36, 37, 42, 43 and 46, saying: //Tokens cannot be resolved to a variable And: // i cannot be resolved to a variable What variables do these errors want to identify? Because I thought I identified everything and I don't understand what variables my code still needs. Here is my code: import java.util.Scanner; public class Jo_code { public static int wordFrequency(String s) { String tokens[] = s.split(" ");// splits the words int count = tokens.length; return count; } public static void main(String args[]) { System.out.println("Write your sentence or type END to quit the program:");// prints out the first instruction. Scanner scan = new Scanner(System.in); //object initialisation. String line = " ";//declaration for letters(String) characters. int max = 20; //declaration for number(int) characters. while ((line = scan.nextLine()) != null) { //scanner instruction, get a line from the key board. if (line.equals("END")) { break;// if you are happy with the code, then type "END", and the code will stop running. } else { // if you decide not to type "END" the program will continue to allow you to type sentences. String[] array = line.split(" ");// splits the words System.out.println("your sentence is " + line);//prints out what you have typed. System.out.println("The total of words for the line is " + tokens.length);// prints out the total of words that you have typed. int maxTokensLength = 0; int tokensLength = 0; for (int i = 0; i &lt; tokens.length; i++) {// this line of code checks for what must be true to carry on. array[i] = array[i].replaceAll("a-zA-Z]", ""); } tokensLength = array[i].length(); tokensLength = tokens[i].length(); if (tokensLength &gt; maxTokensLength) { maxTokensLength = tokensLength; } } } int[] intArray = new int[maxTokensLength + 1]; for (int i = 0; i &lt; tokens.length; i++) { // this line of code checks for what must be true to carry on. intArray[array[…
favorite count: 0

http://stackoverflow.com/comment/38587479
score: 0
has text: Paste your code and then explain it properly
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24850165

http://stackoverflow.com/a/24814634
has comment: http://stackoverflow.com/comment/68425547
has comment: http://stackoverflow.com/comment/38520906
accepted answer of: http://stackoverflow.com/q/24814577
upvote count: 76
has comment: http://stackoverflow.com/comment/38520786
answers question: http://stackoverflow.com/q/24814577
has body: Quick Answer You should use the equals method since this is implemented to perform the comparison you want. toString() itself uses an iterator just like equals but it is a more inefficient approach. Additionally, as @Teepeemm pointed out, toString is affected by order of elements (basically iterator return order) hence is not guaranteed to provide the same output for 2 different maps (especially if we compare two different maps). Note/Warning: Your question and my answer assume that classes implementing the map interface respect expected toString and equals behavior. The default java classes do so, but a custom map class needs to be examined to verify expected behavior. See: http://docs.oracle.com/javase/7/docs/api/java/util/Map.html boolean equals(Object o) Compares the specified object with this map for equality. Returns true if the given object is also a map and the two maps represent the same mappings. More formally, two maps m1 and m2 represent the same mappings if m1.entrySet().equals(m2.entrySet()). This ensures that the equals method works properly across different implementations of the Map interface. Implementation in Java Source (java.util.AbstractMap) Additionally, java itself takes care of iterating through all elements and making the comparison so you don't have to. Have a look at the implementation of AbstractMap which is used by classes such as HashMap: // Comparison and hashing /** * Compares the specified object with this map for equality. Returns * true if the given object is also a map and the two maps * represent the same mappings. More formally, two maps m1 and * m2 represent the same mappings if * m1.entrySet().equals(m2.entrySet()) . This ensures that the * equals method works properly across different implementations * of the Map interface. * * This implementation first checks if the specified object is this map; * if so it returns true . Then, it checks if the specified * object is a map whose size is identical to the size of this map; if *…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38521193
has comment: http://stackoverflow.com/comment/38520855
type: Answer
has comment: http://stackoverflow.com/comment/38520805
has comment: http://stackoverflow.com/comment/38520834
score: 76
has comment: http://stackoverflow.com/comment/38520911
has comment: http://stackoverflow.com/comment/38520754

http://stackoverflow.com/comment/38460701
has text: Here is a pic representing a part of the job https://www.dropbox.com/s/bya3za07dsit2c8/000013.png
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24769699
score: 0

http://stackoverflow.com/q/24847591
tagged with: java
has comment: http://stackoverflow.com/comment/38582573
has comment: http://stackoverflow.com/comment/38582513
accepted answer: http://stackoverflow.com/a/24847660
has comment: http://stackoverflow.com/comment/38582522
type: Question
has comment: http://stackoverflow.com/comment/38582310
has comment: http://stackoverflow.com/comment/38582285
tagged with: javascript
has comment: http://stackoverflow.com/comment/38582479
has body: I made a program for the question: Write a program in Java to input first name, middle name and last name. Validate the digital signature that contains first name and last name. If the signature doesn't contain any of these, print "Invalid Signature". Also, print his full name in a single line. The program that I wrote for this is: import java.io.*; import java.io.*; public class TaskPE_4 { public static void main(String args[])throws IOException { BufferedReader read= new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter your first name"); String fn=read.readLine(); System.out.println("Enter your middle name"); String mn=read.readLine(); System.out.println("Enter your last name"); String ln=read.readLine(); System.out.println("Enter your digital signature"); String ds=read.readLine(); ds+=" "; if(fnCheck(fn, ds)&amp;&amp;lnCheck(ln, ds)) System.out.println("Valid Digital Signature"); else System.out.println("Invalid Digital Signature"); System.out.println("Your full name is "+fn+" "+mn+" "+ln+"."); } private static boolean fnCheck(String fn, String ds) { int fnl=fn.length(); int dsl=ds.length(); for(int i=0; i&lt;=(dsl-fnl); i++) if((ds.substring(i, (i+fnl))).equals(fnl)) return true; return false; } private static boolean lnCheck(String ln, String ds) { int lnl=ln.length(); int dsl=ds.length(); for(int i=0; i&lt;=(dsl-lnl); i++) if((ds.substring(i, (i+lnl))).equals(lnl)) return true; return false; } } The output shown is: Enter your first name Rachit Enter your middle name Rachit Enter your last name Bhargava Enter your digital signature Rachit Bhargava Invalid Digital Signature Your full name is Rachit Rachit Bhargava. Please help me debug this program.
has answer: http://stackoverflow.com/a/24847660
tagged with: bluej
has comment: http://stackoverflow.com/comment/38582499
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/1046809
has title: Digital Signature BlueJ Error
favorite count: 0
has comment: http://stackoverflow.com/comment/38582537
has comment: http://stackoverflow.com/comment/38582408
has comment: http://stackoverflow.com/comment/38582364
has comment: http://stackoverflow.com/comment/38582489
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38582437
downvote count: 0
has comment: http://stackoverflow.com/comment/38582580
has comment: http://stackoverflow.com/comment/38582386
score: 1

http://stackoverflow.com/comment/38572300
type: Comment
comment on: http://stackoverflow.com/a/24842298
type: AnswerComment
score: 0
has text: yes t1.setBounds(#,#,#,#)is xposition ypos and width and height of JTextField And this x,y position is taken as referance Left upper cornerof your pc as(0,0)

http://stackoverflow.com/comment/38496518
has text: This should be added to the question, not as an answer.
type: Comment
comment on: http://stackoverflow.com/a/24801229
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38510398
score: 0
comment on: http://stackoverflow.com/q/24808996
type: Comment
type: QuestionComment
has text: @ajb yes it is a typo

http://stackoverflow.com/q/24751197
has title: How to download files from Dropbox with integrity checking?
tagged with: file
score: 2
downvote count: 0
tagged with: dropbox
tagged with: java
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/59682569
tagged with: dropbox-api
has answer: http://stackoverflow.com/a/24753372
has answer: http://stackoverflow.com/a/42935342
has body: In my application I download video files(.mp4 and .avi) from dropbox folder to folder in sdcard. I need to play file with videoview. How I can check files integrity (equality of files from sdcard and DropBox).
linked to: http://stackoverflow.com/q/304268
tagged with: android
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/24781497
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24781196
has body: I assume the parameters you are passing are supposed to represent client and clientID. You simply need to build the URL your passing to HttpPut from your parameters. If these are your parameters url = "http://localhost:80/api/"; newValue = "client"; newValue2 = "clientID"; then your HttpPut initialization would look like this HttpPut putRequest = new HttpPut(url + newValue + "/include/" + newValue2); Also see: How do I concatenate two strings in Java?

http://stackoverflow.com/q/24863258
type: Question
has title: dynamic name for broker in ActiveMQ to run 2 or more instances in same machine
accepted answer: http://stackoverflow.com/a/24872028
linked to: http://stackoverflow.com/q/1841857
score: 0
answer count: 1
tagged with: jms
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24872028
tagged with: activemq-classic
tagged with: java
has body: I need run 2 instances of a standalone application which uses JMS with a local ActiveMQ in the same machine. I have a jms-context configuration file that is loaded when the application starts. I use KahaDB as persistence adapter File jms-context of both instances is the same, so property "brokerName" of the localBroker has the same name. &lt;bean id="broker" class="org.apache.activemq.xbean.XBeanBrokerService"&gt; &lt;property name="useJmx" value="true"/&gt; &lt;property name="brokerName" value="fileProcessorLocalBroker"/&gt; &lt;property name="persistent" value="true"/&gt; &lt;property name="destinationPolicy" ref="destinationPolicy"/&gt; &lt;property name="managementContext" ref="managementContext"/&gt; &lt;property name="persistenceAdapter" ref="persistenceAdapter"/&gt; ... &lt;/bean&gt; When I run the second instance of my application I get the following: 2014-07-21 12:37:04,377 INFO [org.apache.activemq.store.SharedFileLocker] - &lt;Database activemq-data\fileProcessorLocalBroker\KahaDB\lock is locked... waiting 10 seconds for the database to be unlocked. Reason: java.io.IOException: File 'activemq-data\fileProcessorLocalBroker\KahaDB\lock' could not be locked.&gt; Is there anyway of use a dynamic name for the property brokerName of localbroker? Regards

http://stackoverflow.com/a/24760143
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24760039
type: Answer
has body: You're trying to package too many methods into a single android application. You'll need to refactor some of your code into plugins, or remove methods you don't use.
has comment: http://stackoverflow.com/comment/38420185

http://stackoverflow.com/comment/38496571
score: 0
comment on: http://stackoverflow.com/q/24802091
type: Comment
type: QuestionComment
has text: O(n) algorithm to find number of pairs in an sorted Array where A[i]*A[j] > A[i] + A[j]

http://stackoverflow.com/comment/38538082
has text: Nowhere did you state that you specified `jvm2.lib` in your project. You only stated that you have a path, specified the path in your project, and that you placed your lib file there. Again, that is *not* enough -- you must specify `jvm2.lib` *in your project settings*. According to this link: http://docwiki.embarcadero.com/RADStudio/XE6/en/Using_DLLs_in_RAD_Studio_%28C%2B%2B%29 you go to the "Project Manager" and choose "Add".
comment on: http://stackoverflow.com/q/24823133
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24841801
has answer: http://stackoverflow.com/a/24841847
type: UnansweredQuestion
has title: not able to use jsp variable in java
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38571373
has answer: http://stackoverflow.com/a/24845216
tagged with: java
answer count: 2
has body: We want to access a variable from jsp inside a java class in same file. Can someone pls suggest how to use it ? Below is the code. In this we are using data variable in jsp tags &amp; we want to access the value of data inside DummyDB class of java. JSP File: &lt;%@page import="java.util.ArrayList"%&gt; &lt;%@page import="java.util.List"%&gt; &lt;%@page import="java.util.StringTokenizer"%&gt; &lt;%@ page import="java.sql.*" %&gt; &lt;%@ page import="java.io.*"%&gt; &lt;%@ page import="java.util.*"%&gt; &lt;%@ page import="java.net.*" %&gt; &lt;% HttpSession Session = request.getSession(true); String data = Session.getAttribute("data").toString(); %&gt; &lt;%! public class DummyDB { private int totalCountries; RequestDispatcher rd = request.getRequestDispatcher("include.jsp"); rd.include(request, response); private List&lt;String&gt; countries; public DummyDB() { countries = new ArrayList&lt;String&gt;(); StringTokenizer st = new StringTokenizer(data, ","); while(st.hasMoreTokens()) { countries.add(st.nextToken().trim()); } totalCountries = countries.size(); } public List&lt;String&gt; getData(String query) { String country = null; query = query.toLowerCase(); List&lt;String&gt; matched = new ArrayList&lt;String&gt;(); for(int i=0; i&lt;totalCountries; i++) { country = countries.get(i).toLowerCase(); if(country.startsWith(query)) { matched.add(countries.get(i)); } } return matched; } } %&gt;
upvote count: 1

http://stackoverflow.com/comment/38564169
has text: The hostname message is just for info. The 404 suggests the URL is invalid, so how does it work when you call it from python or the browser? Are you sure the URL you're using is the same in all cases?
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24833297

http://stackoverflow.com/q/24873403
score: 1
tagged with: java
tagged with: grails
tagged with: groovy
answer count: 1
downvote count: 0
has body: In my bootstrap.groovy I'm adding: TimeZone.setDefault(TimeZone.getTimeZone('America/Detroit')) This works just fine when running my app locally; it changes the timezone correctly. But when I deploy my app to my VPS, which is running CentOS Linux 6.5, the time is offset by three hours. Note: It is increased by three hours. Also, I am running my app on Tomcat 7. I've tried adding: export JAVA_OPTS="-Duser.timezone=America/Detroit" to my setenv.sh file but this does not seem to work. My server's system time and hardware time is correctly set and working. So I have NO idea why Tomcat is adding three hours to my dates! Any help or guidance is appreciated!
tagged with: tomcat
favorite count: 0
has title: Grails TimeZone 3 hour offset when deployed on server
linked to: http://stackoverflow.com/q/24898020
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24883642
type: Question

http://stackoverflow.com/comment/38562637
type: Comment
comment on: http://stackoverflow.com/a/24788701
type: AnswerComment
has text: No I am using onDestroy as a verb. I know it's a method.
score: 0

http://stackoverflow.com/q/24858514
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/38604207
linked to: http://stackoverflow.com/q/1478295
has comment: http://stackoverflow.com/comment/38604292
tagged with: ajax
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38603835
has body: I want to pass in few string to servlet using AQuery, by calling for loop to pass each string to my servlet. Below is my code: String str = "st1-st2-st3"; String delimiter = "-"; String[] temp; temp = str.split(delimiter); for(int i =0; i &lt; temp.length ; i++){ System.out.println("temp[i]-&gt;"+temp[i]); params.put("myValue", temp[i]); aq.ajax(url, params, String.class, new AjaxCallback&lt;String&gt;() { @Override public void callback(String url, String html, AjaxStatus status) { //prodStr = html; //showList1(prodStr, sortingAsc); System.out.println("Show return"); } }); } Servlet code String myValue = request.getParameter("myValue"); System.out.println("Show myValue-&gt;"+myValue); I want my result become: temp[i]-&gt;st1 Show return temp[i]-&gt;st2 Show return temp[i]-&gt;st3 Show return But my code run the result as: temp[i]-&gt;st1 temp[i]-&gt;st2 temp[i]-&gt;st3 Show return I want it to call three times to the servlet, instead of once. In my print out servlet code is always show the last string value st3, st1 and st2 is missing. Is this possible? Please help, thanks.
has comment: http://stackoverflow.com/comment/38604401
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38604376
has comment: http://stackoverflow.com/comment/38604578
has title: Aquery Ajax call within a For loop
linked to: http://stackoverflow.com/q/13241668
has comment: http://stackoverflow.com/comment/54234781
has comment: http://stackoverflow.com/comment/38603917
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/38452165
score: 3
type: Comment
comment on: http://stackoverflow.com/q/24778648
type: QuestionComment
has text: Well Hibernate will need to go through the result set to build that list, so what do you think? However it's more likely that your query is the thing you should concentrate on, not the iterating of the results.

http://stackoverflow.com/comment/38413907
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24758062
has text: catalina.setCatalinaHome("../tomcat6/");catalina.start();

http://stackoverflow.com/a/35254940
has comment: http://stackoverflow.com/comment/65320574
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24818649
upvote count: 3
has body: You are using: import android.support.v7.widget.SearchView; which that comes from Support Library and if you take look at the logcats, says: at com.example.trashed.MainActivity.onCreateOptionsMenu(MainActivity.java:55) The problem is coming from MainActivity and this method onCreateOptionsMenu. Replace your search menu with this: from documentation guide &lt;item android:id="@+id/action_search" android:title="@string/action_search" android:icon="@drawable/ic_search" app:showAsAction="ifRoom|collapseActionView" app:actionViewClass="android.support.v7.widget.SearchView" /&gt; If you are using v7 in your imports, you can't use it like this:(android:actionViewClass="android.widget.SearchView") &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" app:showAsAction="always" android:actionViewClass="android.widget.SearchView"/&gt; Just replace it like documentation guide. Also, ActionBarActivity is deprecated, use AppCompatActivity instead. Instead of: @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search) .getActionView(); searchView.setSearchableInfo(searchManager .getSearchableInfo(getComponentName())); return super.onCreateOptionsMenu(menu); } Try to use it like this: Instead: SearchView searchView = (SearchView) menu.findItem(R.id.action_search) .getActionView(); Use: SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); The important thing is: MenuItemCompat because you are using v7 library. Check this question too: Android - NullPointerException on SearchView in Action Bar
type: Answer

http://stackoverflow.com/q/24890845
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38665709
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38664856
has comment: http://stackoverflow.com/comment/38664767
has answer: http://stackoverflow.com/a/24890890
has title: How to pause the threads?
has body: I have many threads (SwingWorker, Timer, Thread..) in different parts of the application. I need to call one method which pause all these threads. What is the best approach to do this? Thanks Additional Info I have a notepad in the app and it can paste images, draw arrow, lines, type text, you can write with stylus etc.. At the same time in the background this app does different things: check login time, check messages, updates something, works with database. So when you try to write with stylus and app does all these things in the background, writing with stylus becomes a little bit slow. So I decided to pause all these threads in the background. I think this should help and I wonder what is the best way to pause these threads. They should continue to work after I finish to write with stylus.
has comment: http://stackoverflow.com/comment/38671218
tagged with: java
has comment: http://stackoverflow.com/comment/38664798
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/24891038
duplicate of: http://stackoverflow.com/q/671049
linked to: http://stackoverflow.com/q/671049
score: 0
answer count: 2

http://stackoverflow.com/q/24887133
upvote count: 2
score: 0
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/24892632
answer count: 1
has title: Switch layout android using Intent and Models Getter and Setters
has comment: http://stackoverflow.com/comment/38657396
has comment: http://stackoverflow.com/comment/38657394
has comment: http://stackoverflow.com/comment/38657922
has comment: http://stackoverflow.com/comment/38658199
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38657518
has comment: http://stackoverflow.com/comment/38657519
has comment: http://stackoverflow.com/comment/38657410
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38657322
has answer: http://stackoverflow.com/a/24892632
has comment: http://stackoverflow.com/comment/38658943
favorite count: 0
tagged with: android-volley
type: Question
has body: I'm trying to view the "enderecos" values in another layout, I'm parsing a json and using volley adapter, I was following this tutorial and trying to adapt the onClick function used in that. But when I switch to the new layout it shows me nothing What am I missing? I'm very new to android development. public class MainActivity extends Activity { private String TAG = this.getClass().getSimpleName(); private ListView lstView; private RequestQueue mRequestQueue; private ArrayList&lt;ClientesModel&gt; arrNews ; private ArrayList&lt;ClientesContatosModel&gt; arrContatos ; private LayoutInflater lf; private VolleyAdapter va; private ProgressDialog pd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lf = LayoutInflater.from(this); arrNews = new ArrayList&lt;ClientesModel&gt;(); arrContatos = new ArrayList&lt;ClientesContatosModel&gt;(); va = new VolleyAdapter(); lstView = (ListView) findViewById(R.id.listView); lstView.setAdapter(va); mRequestQueue = Volley.newRequestQueue(this); String url = "http://192.168.1.17/mais-api/api/clientes/index.php"; pd = ProgressDialog.show(this,"Please Wait...","Please Wait..."); JsonObjectRequest jr = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { Log.i(TAG,response.toString()); try { parseJson(response); } catch (JSONException e) { e.printStackTrace(); } va.notifyDataSetChanged(); pd.dismiss(); ; } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d(TAG, "Error: " + error.getMessage()); error.printStackTrace(); pd.hide(); } }) { @Override public Map&lt;String, String&gt; getParams() throws com.android.volley.AuthFailureError{ Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("email", "rm@.com.br"); params.put("senha", "xxx"); return params; } }; mRequestQueue.ad…
tagged with: android
has comment: http://stackoverflow.com/comment/38657766
has comment: http://stackoverflow.com/comment/38660701

http://stackoverflow.com/q/24905212
tagged with: android-layout
has comment: http://stackoverflow.com/comment/38691692
tagged with: java
has answer: http://stackoverflow.com/a/24906203
type: Question
has title: Create another res subfolder to layout files
answer count: 2
possible better answer: http://stackoverflow.com/a/24906203
has comment: http://stackoverflow.com/comment/38691651
linked to: http://stackoverflow.com/q/1077357
has comment: http://stackoverflow.com/comment/38691688
score: 0
has answer: http://stackoverflow.com/a/24905258
tagged with: android
has body: I wanna organise my code with subfolder into res folder for layout. I know we cannot create subfolder into layout folder but i can create subfolder into res folder. Now how can i SetContentView with my new folder. -res/ ---subfolder1_layout -----sub1_layout.xml ---layout -----layout.xml And setcontentView (getClass().getResources("/res/subfolder1_layout/sub1_layout.xml")); does not work. How can i do that please ?
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24905258
linked to: http://stackoverflow.com/q/4930398
type: AnsweredQuestion

vb6
type: Tag
tag name: vb6
tags question: http://stackoverflow.com/q/24843037

http://stackoverflow.com/q/24826276
tagged with: sftp
has answer: http://stackoverflow.com/a/24865181
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24865181
score: 0
has title: Is there a way to set permissions of a remote folder via VFS in Java?
type: Question
tagged with: java
has body: I create a XML and a ZIP file and upload them via SFTP to a server. The folder structure looks something like this: / | |--/incoming | |--/&lt;hash&gt; | |-- file.xml |-- file.zip The folder &lt;hash&gt; is created when I upload both XML and ZIP and I need this folder to have the permissions 777. As far as I can tell there is no way for me to change the permissions of an already created folder via VFS within Java. What I tried then was to create that folder locally, give it 777 and upload it with the XML and the ZIP inside. My code looks like this: File fUploadDir = new File(uploadDir); fUploadDir.mkdir(); fUploadDir.setReadable(true, false); fUploadDir.setWritable(true, false); fUploadDir.setExecutable(true, false); // Create and add ZIP and XML files... // ... StandardFileSystemManager manager = new StandardFileSystemManager(); // Initializes the file manager manager.init(); File file = new File(pathToFolder); // Setup our SFTP configuration FileSystemOptions opts = new FileSystemOptions(); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no"); SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); SftpFileSystemConfigBuilder.getInstance().setTimeout(opts, 10000); String sftpUri = "sftp://" + userId + ":" + password + "@" + serverAddress + "/" + remoteDirectory; // Create local file object FileObject localFile = manager.resolveFile(fUploadDir.getAbsolutePath()); // Create remote file object FileObject remoteFile = manager.resolveFile(sftpUri, opts); // Copy local file to sftp server remoteFile.copyFrom(localFile, Selectors.SELECT_SELF_AND_CHILDREN); When I execute this code the XML and the ZIP will be uploaded, but not the directory, so the structure on the SFTP server looks like this: / | |--/incoming | |-- file.xml |-- file.zip How can I achieve to get the folder with permissions 777 up there?
tagged with: apache-commons-vfs

http://stackoverflow.com/comment/38613880
type: Comment
type: QuestionComment
has text: @tobias_k You're right, I didn't think OP might have this.
comment on: http://stackoverflow.com/q/24864042
score: 0

http://stackoverflow.com/comment/38638090
score: 0
type: AnswerComment
has text: Well not having to strip anything, this is more efficient. Plus Strings are NOT my forte.
type: Comment
comment on: http://stackoverflow.com/a/24876401

http://stackoverflow.com/q/24798014
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38489666
accepted answer: http://stackoverflow.com/a/24800354
tagged with: maven
has title: "mvn test" gives different errors in console
tagged with: pom.xml
type: AnsweredQuestion
has body: I have been facing these three errors: Users.java:[8,40] error: cannot find symbol Users.java:[5,25] error: package com.project.tests does not exist listeners class not found. I went to these lines and found that line 8,40 has this error because it couldn't found the variable(symbol)at this line.For 2nd error I went to the line and it is import com.project.tests.Repo;. There are two packages import com.project.tests in source folder src/test/java and import com.project.live in src/main/java. So it is able to find import com.project.live but not the import com.project.tests and com.project.tests.Repo; lies in package import com.project.tests, and that's why it is giving error. On reading different posts on stackoverflow.com and on other forums, I found that first two errors can be fixed by updating maven-compiler-plugin to version 3.1 and updating testng to latest. Yesterday I made both the changes and tested, so both errors were removed and it started giving #3 error. But today when I do mvn test, followed by mvn clean, it sometimes gives errors 1 and 2 together and sometimes error 3 alone. I don't understand what's happening. To get rid of this I deleted .m2 and get it again using mvn install but no change, it kept on behaving weird. I have pasted pom.xml below: 4.0.0 com.project.tests project 0.0.1-SNAPSHOT jar project http://maven.apache.org src/test/resource **/*.java org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 true ${JAVA_HOME}/bin/javac UTF-8 ch.fortysix maven-postman-plugin 0.1.6 send a mail test send-mail false myofficial@emailid.com Test Results true myofficial2@emailid.com /var/lib/jenkins/jobs/Testing/workspace/target/surefire-reports/emailable-report.html org.apache.maven.plugins maven-surefire-plugin 2.14.1 0 /home/ubuntu/automation/projectAutomate/Chrome.xml true listener org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter target/ org.apache.maven.plugins maven-surefire-report-plugin 2.16 org.testng.xslt testng-x…
has comment: http://stackoverflow.com/comment/38493233
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38490399
type: Question
has answer: http://stackoverflow.com/a/24800354

http://stackoverflow.com/comment/38436861
score: 0
type: Comment
has text: I know that but he wants getTime comparison not date?
comment on: http://stackoverflow.com/a/24770031
type: AnswerComment

http://stackoverflow.com/q/24773208
accepted answer: http://stackoverflow.com/a/24773348
has comment: http://stackoverflow.com/comment/38442188
upvote count: 1
has title: JSTL get serial number in a table
has comment: http://stackoverflow.com/comment/38442166
has body: I am using JSTL for each loop for iteration over a list &amp; display that data in a table. I would like to know how to display the serial number in that table. &lt;c:forEach items="${item.getApps()}" var="app"&gt; &lt;tr&gt;&lt;td&gt;....&lt;/td&gt; //need to display serial number here &lt;td&gt;&lt;c:out value="${app.getApp()}"&gt;&lt;/c:out&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/c:forEach&gt; TIA.
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24773348
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24773363
type: Question
tagged with: jstl
has comment: http://stackoverflow.com/comment/38442238
downvote count: 0
has answer: http://stackoverflow.com/a/49151918
has comment: http://stackoverflow.com/comment/38442003
answer count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/24773363
has comment: http://stackoverflow.com/comment/38442329

http://stackoverflow.com/a/24749978
has body: Instead try like this public AllMetricsResultSet SPDataList (String alldata) { String sSQL1 = "query1"; String sSQL2 = "query2"; String sSQL3 = "query3"; try { PreparedStatement stm1 = dbConnection.prepareStatement(sSQL1); PreparedStatement stm2 = dbConnection.prepareStatement(sSQL2); PreparedStatement stm3 = dbConnection.prepareStatement(sSQL3); if (stm1.execute()) top10Files = stm1.getResultSet(); if (stm2.execute()) top10FilesForUsage = stm2.getResultSet(); if (stm3.execute()) top10DataSet = stm3.getResultSet(); while (top10Files.next()) { //get the resultset1 data } while (top10FilesForUsage.next()) { //get the resultset2 data } while (top10DataSet.next()) { //get the resultset3 data } // dont know why as you want to return the classType //create an object of the class initialize it the the data you obtained //and return it } catch(SQLException e) { e.printStackTrace(); } finally { //resultsetobject close //statementObject close //connection object close } }
score: 0
answers question: http://stackoverflow.com/q/24749724
type: Answer

http://stackoverflow.com/comment/38439023
comment on: http://stackoverflow.com/a/24771299
type: Comment
score: 0
type: AnswerComment
has text: just below the textarea where you define the code. I do have IntelliJ 13.3.1. If you have different version it might be somewhere else.

http://stackoverflow.com/comment/38499910
type: Comment
has text: Guessing `s`is meant to be referring to `String sentence`? You need to use the same variable name in both places...
comment on: http://stackoverflow.com/q/24804011
score: 2
type: QuestionComment

http://stackoverflow.com/comment/38679917
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24895829
has text: You try something? or you are asking only for best practiques?
score: 0

http://stackoverflow.com/comment/38630880
type: AnswerComment
score: 0
type: Comment
has text: I tried for a while now to intergrate my array in your sample tutorial i found some difficulties how to write 2D array. i understand the example but the problem is to print the repsective values from my array as shown in the code above. Please help @ Girish
comment on: http://stackoverflow.com/a/24862864

http://stackoverflow.com/comment/38682973
has text: You have the rowItems ArrayList, you can modify the any of those items whenever you want to. If you've changed the data you can clear it and add them again, or call notifyDataSetChanged(). See this post: http://stackoverflow.com/a/21862750/1323014 As long as the AsyncTask has access to rowItems, or returns a new list for you to use that should solve your problem.
type: Comment
comment on: http://stackoverflow.com/q/24889499
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38653659
has text: https://netbeans.org/bugzilla/show_bug.cgi
score: 0
comment on: http://stackoverflow.com/q/24885169
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24776970
has answer: http://stackoverflow.com/a/24777025
linked to: http://stackoverflow.com/q/2721546
has body: Will ArrayList&lt;int&gt;(20); create a maximum of 20 array or is it an illegal syntax?
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24777056
downvote count: 7
type: Question
has answer: http://stackoverflow.com/a/24776991
has answer: http://stackoverflow.com/a/24777031
has answer: http://stackoverflow.com/a/24777039
tagged with: arrays
has title: ArrayList construct and array of capacity?
answer count: 6
linked to: http://stackoverflow.com/q/7036552
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38449111
score: -6
has answer: http://stackoverflow.com/a/24779476
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38550541
type: Comment
has text: If that's the case use AtomicInteger.increment for the request count and success count and AtomicLong.getAndAdd(duration) for the total duration.
comment on: http://stackoverflow.com/a/24816297
type: AnswerComment
score: 0

http://stackoverflow.com/q/24872517
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33946414
tagged with: android
tagged with: samsung-mobile
has answer: http://stackoverflow.com/a/24969831
has title: Proguard issue with SAAgent(Samsung Accessory) java.lang.NoSuchMethodException: <init> []
tagged with: java
type: Question
score: 5
tagged with: samsung-mobile-sdk
upvote count: 5
has answer: http://stackoverflow.com/a/50960545
answer count: 3
has body: I am trying to use proguard with my android app and am using the samsung accesory sdk which keeps giving be trouble. No matter what I try in the proguard configuration I can't seem to get past this runtime exception: 07-21 13:44:12.851: E/SAAgent(3563): &lt;init&gt; [] 07-21 13:44:12.851: E/SAAgent(3563): java.lang.NoSuchMethodException: &lt;init&gt; [] ... 07-21 13:44:12.851: E/AndroidRuntime(3563): Caused by: java.lang.RuntimeException: Invalid implemetation of SASocket. Provider a public default constructor. ... Does anyone have any idea on what to try?
downvote count: 0
tagged with: proguard
favorite count: 0

http://stackoverflow.com/comment/38599611
score: 0
type: AnswerComment
has text: Also your attributes should not be static in your Complex class
type: Comment
comment on: http://stackoverflow.com/a/24856278

http://stackoverflow.com/a/24797447
type: Answer
answers question: http://stackoverflow.com/q/24790955
has body: Maybe try: def l = ['Monterey', 'CA'] assert URLEncoder.encode(l.join(', ')).replaceAll('\\+','%20') == 'Monterey%2C%20CA' When it comes to replacing + sign, please see here
score: 0

http://stackoverflow.com/a/25383615
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24848686
accepted answer of: http://stackoverflow.com/q/24848686
downvote count: 0
type: AcceptedAnswer
has body: Collection name is specified in class in @NoSql anotation as value of dataType. Example: @Entity @NoSql(dataType="USstates", dataFormat=DataFormatType.MAPPED) public class UsStatesClass { ... }

http://stackoverflow.com/a/24814565
upvote count: 2
answers question: http://stackoverflow.com/q/24814420
has body: The problem is that you are trying to access a non-static member of Data in your main method, without having actually a reference to a Data object. The easiest way I can think of to fix this is to change Net#returnIp() to return the Data it creates when parsing the json: //Net.java static Data returnIp() throws UnsupportedEncodingException, MalformedURLException, IOException { //Ommited code, all it does is do a GET request to get response String responseString = new Scanner(response,"UTF-8").useDelimiter("\\A").next(); return new Gson().fromJson(responseString, Data.class); } Then you can use the Data object you have created: //DDNS.java public static void main(String[] args) throws Exception { Data data = Net.returnIp(); System.out.println(data); // this will automatically call data's toString() and format its origin } The concepts of Objects and Classes are very fundamental to the Java language. You will need to understand them to get very far. I would recommend reading oracle's Object-Oriented Programming Concepts, starting with the "What is an Object?" and "What is a Class?" links.
accepted answer of: http://stackoverflow.com/q/24814420
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/24788483
answers question: http://stackoverflow.com/q/24788435
upvote count: 1
has body: Create different method for each one public int getDay(Date date){ return date.get(Calendar.DAY_OF_MONTH); } public int getMonth(Date date){ return date.get(Calendar.MONTH); } public int getYear(Date date){ return date.get(Calendar.YEAR); }
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/24768712
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38461008
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24768694
has body: In order to load a class with the Class.forName() method, you must specify a fully qualified package name. In this case it must be Demo.NewClass0, for example.
accepted answer of: http://stackoverflow.com/q/24768694

http://stackoverflow.com/comment/38567835
has text: I don't think so. Do I need to run Eclipse as administrator or just the program ?
score: 0
comment on: http://stackoverflow.com/q/24840034
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38562017
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24836663
has text: From your output, we see "Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread Thread-0". If so, why do you say that the exception is ignored when thrown from a non-main thread?
type: AnswerComment

hudson
type: Tag
tags question: http://stackoverflow.com/q/24820204
tag name: hudson

http://stackoverflow.com/comment/38601406
score: 0
type: AnswerComment
has text: Favor `paintComponent` over `paint`, as this could produce paint artifacts and or affect other components which are management by the container...
type: Comment
comment on: http://stackoverflow.com/a/24857317

http://stackoverflow.com/comment/38666125
comment on: http://stackoverflow.com/q/24890639
type: Comment
type: QuestionComment
has text: ok i have managed to add the image for each tab using: actionBar.addTab(actionBar.newTab().setIcon(R.Drawable.ic_1).setTabListener(this)); now i just need the Fragment thing, thanks vefthym for the advice!
score: 0

variables
tag name: variables
tags question: http://stackoverflow.com/q/24887110
tags question: http://stackoverflow.com/q/24870088
tags question: http://stackoverflow.com/q/24750149
tags question: http://stackoverflow.com/q/24842666
tags question: http://stackoverflow.com/q/24856923
tags question: http://stackoverflow.com/q/24892137
type: Tag
tags question: http://stackoverflow.com/q/24873000
tags question: http://stackoverflow.com/q/24857171
tags question: http://stackoverflow.com/q/24862179
tags question: http://stackoverflow.com/q/24877867
tags question: http://stackoverflow.com/q/24764968
tags question: http://stackoverflow.com/q/24855448
tags question: http://stackoverflow.com/q/24771241
tags question: http://stackoverflow.com/q/24853763
tags question: http://stackoverflow.com/q/24822116

http://stackoverflow.com/q/24842224
has comment: http://stackoverflow.com/comment/50777663
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41094255
tagged with: spring
linked to: http://stackoverflow.com/q/25830503
has answer: http://stackoverflow.com/a/31440875
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am having a problem uploading files using ExtJS with Spring 4.0.5 with RepositoryRestMVC functionality. Briefly, I have a form created by ExtJS and submits the POST request to Spring MVC backend. I have setup Spring using java config, no xml files. Here is my ApplicationInitializer.class in Spring: public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { private int maxUploadSizeInMb = 5 * 1024 * 1024; // 5 MB @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class&lt;?&gt;[]{RootConfig.class}; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class&lt;?&gt;[]{}; } @Override protected String[] getServletMappings() { return new String[]{"/"}; } @Override protected Filter[] getServletFilters() { return new Filter[]{new HiddenHttpMethodFilter(), new MultipartFilter()}; } @Override protected void customizeRegistration(ServletRegistration.Dynamic registration) { File uploadDirectory = RootConfig.APP_STORAGE_UPLOADS_DIRECTORY; MultipartConfigElement multipartConfigElement = new MultipartConfigElement( uploadDirectory.getAbsolutePath(), maxUploadSizeInMb, maxUploadSizeInMb * 2, maxUploadSizeInMb / 2); registration.setMultipartConfig(multipartConfigElement); } } Here is my WebMvcConfig.class: @Configuration @EnableWebMvc @ComponentScan(basePackages = "com.app.controller") public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/").setCachePeriod(31556926); registry.addResourceHandler("/js/**").addResourceLocations("/js/"); } @Bean public InternalResourceViewResolver getInternalResourceViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF…
has title: Spring + ExtJS File Upload Required MultipartFile parameter 'file' is not present
tagged with: extjs
tagged with: spring-data-rest
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/38722563
score: 0
type: Comment
type: QuestionComment
has text: Please read my [answer here](http://stackoverflow.com/a/24125677/589259). Help my fight against `getRawKey` and vote up!
comment on: http://stackoverflow.com/q/24908826

http://stackoverflow.com/a/33957813
has body: I know this question is old, but here is a answer for this problem. You should use the ObjectFactory and use createENGiven method, example: ObjectFactory objectFactory = new ObjectFactory(); PN pn = new PN(); EnGiven enGiven = new EnGiven(); enGiven.setPartType("Hnery"); JAXBElement&lt;EnGiven&gt; jaxbeGiven = objectFactory.createENGiven(enGiven); pn.getContent().add(jaxbeGiven);
answers question: http://stackoverflow.com/q/24756207
score: 0
type: Answer

http://stackoverflow.com/comment/38579933
type: AnswerComment
has text: One more question, then: where do I put this line?
type: Comment
comment on: http://stackoverflow.com/a/24846370
score: 0

http://stackoverflow.com/comment/38594520
comment on: http://stackoverflow.com/a/24815203
has text: IMHO this all seems a bit too much: generating Java source files which need to be compiled... Also, in ANTLR 4, you have visitor and listener classes to keep your grammar clean from target specific code. Imagine that the language will be extended: this would mean that the grammar *and* Java code will have to be edited in the same file (very error prone!). And what if there needs to be support for C# as well: this would mean stripping all Java code from the grammar and adding the C# code. Now you have 2 grammar files you need to keep in sync. In short: don't mix target code with the grammar.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38401696
comment on: http://stackoverflow.com/a/24751066
type: Comment
type: AnswerComment
has text: @ScaryWombat well, in that case you got a point. +1 from me ;)
score: 0

http://stackoverflow.com/comment/38539898
comment on: http://stackoverflow.com/q/24825010
score: 0
type: Comment
type: QuestionComment
has text: Without more code we can only guess, maybe the `flush`was there to prevent OOM, maybe `someName` is changed as a side effect of `process`and you are creating 10 new entities... maybe this is just a bad sample of you you should not write retries. When `someName`is not a `final` member and is changed somewhere, then most likely the result of your query will change.

http://stackoverflow.com/comment/38408214
type: Comment
has text: @user3742929 - Where have you defined the `Runnable` that `robot` refers to? Maybe your Runnable's `run()` method is not a valid override or something along those lines.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24754532

http://stackoverflow.com/a/49749297
downvote count: 0
type: Answer
has body: Bellow code is used and tested. private Response sendExcelFile(Locale locale, Optional&lt;List&lt;List&lt;String&gt;&gt;&gt; consumersReportData) { XSSFWorkbook workBook = ExportToExcelUtils.prepareWorkBook(consumersReportData.get(), "data"); String DisplayFileName = "Consumers-Report-" + DateUtils.getLocalDateInString(DateUtils.now()); String fileName = "/tmp/fileName.xlsx"; // Created file object here File file = new File(fileName); try { FileOutputStream outputStream = new FileOutputStream(file); workBook.write(outputStream); } catch (FileNotFoundException e) { LOGGER.error("File not found : fileName {} Exception details:{} ", fileName, e); } catch (IOException e) { LOGGER.error("IO exception : fileName {} Exception details:{} ", fileName, e); } ResponseBuilder responseBuilder = Response.ok((Object) file); responseBuilder.header("Content-Disposition", "attachment; filename=" + DisplayFileName + EXCEL_FILE_EXTENSTION); return responseBuilder.build(); }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24827571

http://stackoverflow.com/comment/38581575
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24847192
has text: How does this differ from your [previous question](https://stackoverflow.com/questions/24846610/how-to-find-final-coordinatesx-y-of-the-objects-position-in-japplet-and-writ)? It seems quite similar, even though you added a bunch of stuff at the beginning
score: 1

multithreading
tags question: http://stackoverflow.com/q/24795158
tags question: http://stackoverflow.com/q/24815028
tags question: http://stackoverflow.com/q/24754469
tags question: http://stackoverflow.com/q/24898547
tags question: http://stackoverflow.com/q/24789741
tags question: http://stackoverflow.com/q/24819538
tags question: http://stackoverflow.com/q/24867912
type: Tag
tags question: http://stackoverflow.com/q/24820099
tags question: http://stackoverflow.com/q/24749550
tags question: http://stackoverflow.com/q/24762024
tags question: http://stackoverflow.com/q/24810802
tags question: http://stackoverflow.com/q/24854382
tags question: http://stackoverflow.com/q/24879303
tags question: http://stackoverflow.com/q/24810236
tags question: http://stackoverflow.com/q/24818823
tags question: http://stackoverflow.com/q/24872009
tags question: http://stackoverflow.com/q/24775931
tags question: http://stackoverflow.com/q/24754297
tags question: http://stackoverflow.com/q/24777920
tags question: http://stackoverflow.com/q/24859421
tags question: http://stackoverflow.com/q/24869645
tags question: http://stackoverflow.com/q/24849927
tags question: http://stackoverflow.com/q/24810744
tags question: http://stackoverflow.com/q/24827812
tags question: http://stackoverflow.com/q/24813676
tags question: http://stackoverflow.com/q/24872531
tags question: http://stackoverflow.com/q/24799497
tags question: http://stackoverflow.com/q/24813255
tags question: http://stackoverflow.com/q/24785800
tags question: http://stackoverflow.com/q/24860874
tags question: http://stackoverflow.com/q/24873968
tags question: http://stackoverflow.com/q/24844122
tags question: http://stackoverflow.com/q/24830515
tags question: http://stackoverflow.com/q/24795291
tags question: http://stackoverflow.com/q/24855398
tags question: http://stackoverflow.com/q/24784933
tags question: http://stackoverflow.com/q/24771092
tags question: http://stackoverflow.com/q/24749745
tags question: http://stackoverflow.com/q/24771850
tags question: http://stackoverflow.com/q/24806458
tags question: http://stackoverflow.com/q/24855683
tags question: http://stackoverflow.com/q/24766422
tags question: http://stackoverflow.com/q/24885829
tags question: http://stackoverflow.com/q/24849840
tags question: http://stackoverflow.com/q/24906778
tags question: http://stackoverflow.com/q/24804900
tags question: http://stackoverflow.com/q/24786496
tags question: http://stackoverflow.com/q/24784339
tags question: http://stackoverflow.com/q/24839061
tags question: http://stackoverflow.com/q/24780409
tags question: http://stackoverflow.com/q/24761631
tags question: http://stackoverflow.com/q/24831636
tags question: http://stackoverflow.com/q/24799038
tags question: http://stackoverflow.com/q/24883729
tags question: http://stackoverflow.com/q/24865762
tags question: http://stackoverflow.com/q/24817506
tags question: http://stackoverflow.com/q/24899211
tags question: http://stackoverflow.com/q/24766184
tags question: http://stackoverflow.com/q/24803322
tags question: http://stackoverflow.com/q/24794570
tags question: http://stackoverflow.com/q/24825100
tags question: http://stackoverflow.com/q/24780096
tags question: http://stackoverflow.com/q/24794812
tags question: http://stackoverflow.com/q/24823697
tags question: http://stackoverflow.com/q/24845402
tags question: http://stackoverflow.com/q/24903694
tags question: http://stackoverflow.com/q/24872732
tags question: http://stackoverflow.com/q/24813091
tags question: http://stackoverflow.com/q/24816170
tags question: http://stackoverflow.com/q/24843282
tags question: http://stackoverflow.com/q/24833533
tags question: http://stackoverflow.com/q/24800982
tags question: http://stackoverflow.com/q/24904765
tags question: http://stackoverflow.com/q/24854345
tags question: http://stackoverflow.com/q/24890098
tags question: http://stackoverflow.com/q/24841090
tags question: http://stackoverflow.com/q/24758596
tags question: http://stackoverflow.com/q/24900614
tags question: http://stackoverflow.com/q/24796334

http://stackoverflow.com/comment/38417147
comment on: http://stackoverflow.com/a/24759695
type: AnswerComment
score: 0
type: Comment
has text: Could be a multitude of things. Changes in the program/API from 2.3 to 4.0+, hardware, etc. Again, I strongly suggest to further develop for 4.0 and above.

http://stackoverflow.com/comment/137451626
type: Comment
score: 1
comment on: http://stackoverflow.com/a/77966655
type: AnswerComment
has text: Change it to what? From what? Why?

http://stackoverflow.com/a/24812251
has comment: http://stackoverflow.com/comment/38516910
has comment: http://stackoverflow.com/comment/38515993
score: 0
has comment: http://stackoverflow.com/comment/38516656
type: Answer
answers question: http://stackoverflow.com/q/24812155
has comment: http://stackoverflow.com/comment/38516401
has body: If you have an IDE (like Eclipse or Netbeans), you could put a breakpoint in method D, and then have a look at the stack at that point in the Debug view. In Eclipse for example, there will be a panel that looks something like this: Image from Eclipse Help You can see in the stack that main() has been called. In your example it might look something like this: ClassZ.D() line: P ClassY.C() line: O ClassX.B() line: N ClassW.A() line: M

http://stackoverflow.com/a/24950722
downvote count: 0
has comment: http://stackoverflow.com/comment/38938735
accepted answer of: http://stackoverflow.com/q/24884528
has comment: http://stackoverflow.com/comment/38860872
score: 4
type: AcceptedAnswer
has body: JBoss can not close all leaked connection. You need to find leaked connection by checking logs after enabling JCA logging. I resolved connection leak by this way. &lt;logger category="org.jboss.jca"&gt; &lt;level name="DEBUG"/&gt; &lt;/logger&gt; You will get entries like below in logs DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (MSC service thread 1-4) {JNDI_NAME}: getConnection(null, null) [1/100] --&gt; It means taking connection from pool. DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (MSC service thread 1-4) {JNDI_NAME}: returnConnection(607e334, false) [1/99] --> It means returning connection to pool You can check which query is not returning connetion to pool and check your application from where that query is being executed. Fix it.
has comment: http://stackoverflow.com/comment/38859192
has comment: http://stackoverflow.com/comment/38860598
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/24884528

http://stackoverflow.com/comment/38424808
score: 0
type: Comment
has text: Near as I can tell, an extra parameter not an option for StringEntity. I appreciate your suggestions, but would you mind looking them up before posting them to make sure the Java API actually allows them?
type: QuestionComment
comment on: http://stackoverflow.com/q/24762641

http://stackoverflow.com/q/24772828
linked to: http://stackoverflow.com/q/5710059
type: AnsweredQuestion
tagged with: java
has body: I am trying to parse HTML using jsoup. This is my first time working with jsoup and I read some tutorial on it as well. Below is my HTML table which I am trying to parse - If you see my below table, it has three tr as of now (I have shorten it down to have three table rows just for understanding purpose but in general it will be more). Now I would like to extract Cluster Name from my below table and it's corresponding host name so for example - I would extract Titan as cluster name and all its hostname whose status are down. As you can see below for Titan cluster name, I have two hostnames machineA.abc.com and machineB.abc.com in which machineA status is up but machineB status is down. So I will print out Titan as cluster name and print out machineB.abc.com as the hostname since it is down. Is this possible to do using jsoup? &lt;table border=1&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;Alert&lt;/td&gt; &lt;td&gt;Cluster Name&lt;/td&gt; &lt;td&gt;IP addr&lt;/td&gt; &lt;td&gt;Host Name&lt;/td&gt; &lt;td&gt;Type&lt;/td&gt; &lt;td&gt;Status&lt;/td&gt; &lt;td&gt;Free&lt;/td&gt; &lt;td&gt;Version&lt;/td&gt; &lt;td&gt;Restart Time&lt;/td&gt; &lt;td&gt;UpTime(Days)&lt;/td&gt; &lt;td&gt;Last probed&lt;/td&gt; &lt;td&gt;Last up&lt;/td&gt; &lt;/tr&gt; &lt;tr bgcolor="ffffff"&gt; &lt;td&gt;&lt;a href=showlog?ip_addr=127.0.0.1&gt;Hist&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href=http://127.0.0.1:8080/test?full=y&gt;VI&lt;/a&gt;&lt;/td&gt; &lt;td bgcolor="ffffff"&gt;&amp;nbsp&lt;/td&gt; &lt;td&gt;Titan&lt;/td&gt; &lt;td&gt;10.100.111.77&lt;/td&gt; &lt;td&gt;machineA.abc.com&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td bgcolor="ffffff"&gt;up&lt;/td&gt; &lt;td bgcolor="ffffff" align=right&gt;88%&lt;/td&gt; &lt;td bgcolor="ffffff"&gt;2.0.5-SNAPSHOT&lt;/td&gt; &lt;td bgcolor="ffffff"&gt;2014-07-04 01:49:08,220&lt;/td&gt; &lt;td bgcolor="ffffff" align=right&gt;381&lt;/td&gt; &lt;td&gt;07-14 20:01:59&lt;/td&gt; &lt;td&gt;07-14 20:01:59&lt;/td&gt; …
has answer: http://stackoverflow.com/a/24773413
has answer: http://stackoverflow.com/a/61292206
type: Question
tagged with: jsoup
downvote count: 0
possible better answer: http://stackoverflow.com/a/24773207
has title: How to parse HTML table using jsoup?
has answer: http://stackoverflow.com/a/24773207
favorite count: 0
upvote count: 39
answer count: 3
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/24773413
has comment: http://stackoverflow.com/comment/109545165
tagged with: parsing
score: 39

mybatis
tags question: http://stackoverflow.com/q/24841581
tags question: http://stackoverflow.com/q/24764989
tags question: http://stackoverflow.com/q/24755724
tags question: http://stackoverflow.com/q/24779906
type: Tag
tag name: mybatis

http://stackoverflow.com/q/24863376
tagged with: android-adapter
has answer: http://stackoverflow.com/a/24863657
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38613071
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38612670
has comment: http://stackoverflow.com/comment/38612762
has body: I have a list view which is populated asynchronously from http responses Even using CopyOnWriteArrayList and calling runOnUiThread, I am still getting this exception 07-21 16:20:56.390: E/AndroidRuntime(2003): FATAL EXCEPTION: main 07-21 16:20:56.390: E/AndroidRuntime(2003): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131034172, class android.widget.ListView) with Adapter(class android.widget.ArrayAdapter)] The code I am using is, onRandomAddEventFromRemoteEnd(){ if (!deviceNames.contains(name)) { deviceNames.add(name); runOnUiThread(notifyAdapterDataChanged); } } where deviceNames is a CopyOnWriteArrayList and notifyAdapterDataChanged is the Runnable Runnable notifyAdapterDataChanged = new Runnable() { @Override public void run() { dummyAdapter.notifyDataSetChanged(); } };
has comment: http://stackoverflow.com/comment/38612536
type: Question
has comment: http://stackoverflow.com/comment/38613228
tagged with: android-listview
tagged with: android-adapterview
has title: Exception on notifyDataSetChanged even using runonuihread
tagged with: android

http://stackoverflow.com/comment/38604203
comment on: http://stackoverflow.com/q/24858454
type: QuestionComment
type: Comment
has text: @pandagrammer: I very much doubt it, as now you haven't even declared `phoneBook`. Please show a short but *complete* program demonstrating the problem.
score: 1

http://stackoverflow.com/a/24842181
has body: It looks like inheritance works quite different for methods then for variables. More precisely, inheritance does not make variables polymorphic. When you declare an identical method, a method in the derived class overrides the method in the base. When you declare an identical variable, the variable in the base class is hidden by the variable in the derived class. In your example, Bar has two variables a, but only one method addFive(). Essentially, each Bar object holds two integers - Foo.a and Bar.a. These two are separate variables. However, the addFive method is the one defined in Bar, because it overrides (replaces) addFive from Foo. Note that Java lets Bar access Foo.addFive by calling super.addFive(), but users of Bar lack this possibility.
upvote count: 3
answers question: http://stackoverflow.com/q/24842116
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24842116
type: Answer

http://stackoverflow.com/q/24842211
has body: I am undertaking a course in software development, at the moment I am working through Java. The program I am working on (which don't worry, I am allowed to get external help with) has given me a problem, well more so the problem is I don't understand how they have worded the task at hand. Here's where I am at. What I am required to do is create a constructor with two variables, then pass one of the parameters to a method. The class and constructor are called Order(), the method is called testQuantity. This is what I do not understand. The first parameter productName has it's value assigned to an instance variable productName by the code this.productName = productName; but for the second parameter quantity it doesn't ask me to assign the value to the instance variable quantity but rather "The quantity parameter is to be passed to the testQuantity method." Ok, here's the code I have so far, it's far from complete and there are four other classes I haven't began yet. Also feel free to point out any issues you spot along the way. Thanks in advance for any help. package JaveGUIPrototype; import java.util.Arrays; /** * * @author User */ public class Order { private String productName; private double price; private int discount; private int quantity; private double total; private String message; private boolean isDiscounted; private boolean isValidOrder; private static int orderNum = 0; public Order() { // sets validity to false, sets message, increments orderNum by 1 isValidOrder = false; message = "**ERROR**: Order number cannot be totalled as no details have been supplied"; orderNum = orderNum + 1; } public Order(String productName, int quantity) { // sets productName variable to productName parameter value this.productName = productName; this.quantity = quantity; } public void testQuantity() { // tests the value of the quantity variable // quantity is 0 or less, order isn't valid, message explains why if(quantity &lt;=0){ isValidOrder = false; message = "**ERROR**: Inv…
score: 0
answer count: 2
tagged with: constructor
tagged with: parameters
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24842236
has answer: http://stackoverflow.com/a/24842246
tagged with: java
tagged with: methods
accepted answer: http://stackoverflow.com/a/24842236
type: Question
possible better answer: http://stackoverflow.com/a/24842246
has title: Passing constructor parameter to method JAVA

http://stackoverflow.com/q/24890105
type: AnsweredQuestion
has body: I'm using dialog box from ControlFx in my JavaFX app. but on clicking Cancel button it close the application. package testing; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.Event; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.Stage; import org.controlsfx.control.action.Action; import org.controlsfx.dialog.Dialog; import org.controlsfx.dialog.Dialogs; public class NewFXMain extends Application { @Override public void start(Stage primaryStage) { Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); primaryStage.setOnCloseRequest(new EventHandler() { public void handle(Event t) { Action response = Dialogs.create() .owner(new Stage()) .title("Exit ??") .masthead("Do you want to Exit ??") .actions(Dialog.Actions.OK, Dialog.Actions.CANCEL) .showConfirm(); if (response == Dialog.Actions.OK) { primaryStage.hide(); System.exit(0); // ... user chose OK } else if (response == Dialog.Actions.CANCEL){ } } }); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } } Am i implementing it the wrong way or is it a bug in the conrolfx ? tried warning dialog also same happens there too. I also tried other dialogs with YES, NO and cancel actions. I'm using netbeans 8.0 with jdk 8 on ubuntu 14.04.
tagged with: java
accepted answer: http://stackoverflow.com/a/24931300
type: Question
answer count: 1
tagged with: controlsfx
score: 0
tagged with: javafx-8
has title: JAVAFX-8 CANCEL ACTION Close the stage, using Dialog from controlfx in Javafx?
tagged with: user-interface
has answer: http://stackoverflow.com/a/24931300

http://stackoverflow.com/comment/38566710
has text: @user3158988: If `setVisible()` alone is enough, then you must be wrong in thinking that way. The advice in the answer is worth to be noted down and remembered by heart :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/24839303
score: 0
type: Comment

http://stackoverflow.com/q/24768076
has body: im are suppose to make a histogram using hash map. we are to construct some junit testing but my tests come back null. is it not sort of the same as testing for an empty string in an ArrayList? also my first two tests should be expecting an illegal Argument, but even those fail.. usually we create an new object of that class and test the methods on it BUT when i create a histogram object i cant relate it to my hashmap logically or for testing. i done j unit testing multiple times but im drawing a blank here for hash map because its my first time using it. any suggestion? thx in advance. public class Histogram{ private HashMap&lt;String, Integer&gt; map; /** * constructor for Histogram * * @precondition map cannot contain null or empty string values * @postcondition sets map to new Hashmap * @param none * */ public Histogram() { if ((this.map.containsValue("") || this.map.containsKey(null)) { throw new IllegalArgumentException( "there cannot be an empty string an String cannot be null"); } this.map = new HashMap&lt;String, Integer&gt;(); } /** * attempts to find the parameter in map. * * @param add * the string to find * */ public void add(String add) { for (int count = 1; count &gt;= 1; count++) { if (this.map.containsKey(add)) { count++; } if (!this.map.containsKey(add)) { this.map.put(add, 1); } } } /** * finds the count associated with the parameter and returns it. * * @param count * the count/number relevant to the key in the hashmap * @return countb, the count converted into a integer */ public int getCount(String count) { this.map.get(count); int countb = Integer.parseInt(count); if (!this.map.containsKey(count)) { return 0; } else { return countb; } } /** * sorts the words in the list returned * * @return keys a sorted list of keys in the hashmap maps */ public ArrayList&lt;String&gt; getSortedKeys() { ArrayList&lt;String&gt; keys = null; keys = new ArrayList&lt;String&gt;(this.map.keySet()); Collections.sort(keys); return keys; } j uint testing class public …
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/38434482
has answer: http://stackoverflow.com/a/24768293
has comment: http://stackoverflow.com/comment/38434494
has comment: http://stackoverflow.com/comment/38434297
tagged with: hashmap
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24768211
type: Question
has comment: http://stackoverflow.com/comment/38432783
has comment: http://stackoverflow.com/comment/38434495
has comment: http://stackoverflow.com/comment/38432642
answer count: 2
has title: why does my j-unit testing for hashmap return 'expecting null pointer exception'?
tagged with: logic
upvote count: 1
favorite count: 0
tagged with: constructor
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38434338

http://stackoverflow.com/comment/38595649
type: QuestionComment
has text: Please don't use StringBuffer, it was replaced by StringBuilder ten years ago.
comment on: http://stackoverflow.com/q/24854406
score: 0
type: Comment

slidingmenu
tag name: slidingmenu
type: Tag
tags question: http://stackoverflow.com/q/24860470

http://stackoverflow.com/comment/38478817
type: QuestionComment
has text: replace all your spaces(" ") with ".", you will something interesting
comment on: http://stackoverflow.com/q/24792250
score: 0
type: Comment

http://stackoverflow.com/comment/38487055
type: QuestionComment
comment on: http://stackoverflow.com/q/24796743
has text: What's the problem/error message with your second attempt? I think you should try [`Statement.executeUpdate()`](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29) instead of trying to `getResultList()`.
score: 0
type: Comment

http://stackoverflow.com/q/24800309
has answer: http://stackoverflow.com/a/24800374
upvote count: 15
answer count: 4
favorite count: 0
tagged with: static
score: 13
has answer: http://stackoverflow.com/a/36648208
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38493346
tagged with: java
has answer: http://stackoverflow.com/a/37552197
type: Question
has body: Since static methods can be called directly from the class (i.e. ClassName.methodName), why it is required to call a static method with the object of the class? If someone knows then, elaborate with example. public static void methodA(){ }
has answer: http://stackoverflow.com/a/24800356
accepted answer: http://stackoverflow.com/a/24800356
has comment: http://stackoverflow.com/comment/38567386
has comment: http://stackoverflow.com/comment/38493363
has title: Can we call a static method with a null object in Java? If so, how?
has comment: http://stackoverflow.com/comment/38493329
possible better answer: http://stackoverflow.com/a/24800374
downvote count: 2

http://stackoverflow.com/comment/38415297
type: Comment
has text: It simply won't. The server settings used via eclipse overrides the default settings in the `server.xml`
comment on: http://stackoverflow.com/a/24758874
score: 0
type: AnswerComment

http://stackoverflow.com/a/24890829
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Each entry in the eclipse.ini file must be on a separate line. So you need -vm and C:\Program Files\Java\jdk1.7.0_60\bin on separate lines. They must also come before the -vmargs line since everything after that is taken to be a VM argument.
accepted answer of: http://stackoverflow.com/q/24890088
answers question: http://stackoverflow.com/q/24890088

http://stackoverflow.com/q/24809825
downvote count: 0
answer count: 1
has title: Value of IPC_CREAT when used in JNA
accepted answer: http://stackoverflow.com/a/24810141
favorite count: 0
tagged with: jna
upvote count: 2
has answer: http://stackoverflow.com/a/24810141
type: AnsweredQuestion
has body: I need to communicate a java application and a c process via posix message queue, and I am using JNA in java application. In C process, when create message queue I am using: key_t key = 112233; int msgflg = IPC_CREAT | 0666; msqid = msgget(key, msgflg ) What is the value of IPC_CREAT to use in Java application? I found in ipc.h : /usr/include/sys/ipc.h:#define IPC_CREAT 0001000 /* create entry if key doesn't exist */ May I safety assume that I can use 512? (decimal) ? Thanks.
tagged with: java
has comment: http://stackoverflow.com/comment/38511478
has comment: http://stackoverflow.com/comment/38511648
type: Question
score: 2

http://stackoverflow.com/q/24843117
type: UnansweredQuestion
has body: I have following directory hierarchy $ ls -R a b c a/b: x.db y.db a/b/x.db: p0.txt p1.txt a/b/y.db: a/c: m.db a/c/m.db: I need foo(FIle rootDir){ .... } which outputs ["a/b/x.db", "a/b/y.db", "a/c/m.db"] for foo(new File("a")) I have tried using org.apache.commons.io.FileUtils unsuccessfully! Following is what I tried private static Collection&lt;File&gt; foo(File rootDir) { return FileUtils.listFilesAndDirs(rootDir, FalseFileFilter.INSTANCE, new DirectoryFileFilter() { @Override public boolean accept(File file) { if (file.getName().endsWith("db")) { return true; } return false; } } ); } This outputs [&lt;parent_dir&gt;/a] Can someone help me out? Thanks in advance!!
tagged with: directory-listing
has comment: http://stackoverflow.com/comment/38574352
tagged with: java
has comment: http://stackoverflow.com/comment/38573698
type: Question
score: 0
answer count: 2
tagged with: directory
has answer: http://stackoverflow.com/a/24843182
has title: Recursively list subdirectories/files while applying a filter
has comment: http://stackoverflow.com/comment/38573667
has comment: http://stackoverflow.com/comment/38574305
has answer: http://stackoverflow.com/a/24844511

http://stackoverflow.com/a/24871551
upvote count: 2
has body: exclude javax.servlet:servlet-api from jcaptcha dependency, jcaptcha should be able to work with 3.0 com.octo.captcha jcaptcha 1.0 javax.servlet servlet-api
score: 2
has comment: http://stackoverflow.com/comment/38629006
has comment: http://stackoverflow.com/comment/38642550
answers question: http://stackoverflow.com/q/24870730
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38632295
has comment: http://stackoverflow.com/comment/38629075
type: Answer
accepted answer of: http://stackoverflow.com/q/24870730

http://stackoverflow.com/a/24865447
score: 1
answers question: http://stackoverflow.com/q/24865347
downvote count: 0
type: Answer
upvote count: 1
has body: The expression ^([^()]*)\((.*)\)([^()]*)$ Will split the input string into three captures. Explanation: The ^ and $ anchor the match to the whole input string. The ([^()]*) part finds zero or more characters that are not round brackets and save them in the first capture group, the outer round brackets denote a capture group. The \( matches the first real bracket. The (.*) captures the middle section. The \) matches the last bracket. The ([^()]*) finds zero or more characters that are not round brackets. Regular expression checked with Notepad++ 6.6.7. Do not have access to Java to say how to make use of the captured values.

http://stackoverflow.com/comment/38510092
has text: Use the constructor `new MyAttribute(post.text, postPicture, post.date)`
type: AnswerComment
comment on: http://stackoverflow.com/a/24808722
score: 0
type: Comment

http://stackoverflow.com/q/24907280
tagged with: loops
has answer: http://stackoverflow.com/a/24907379
has title: Nested do-while loop in if-else: variable not initialized
has answer: http://stackoverflow.com/a/24907361
has answer: http://stackoverflow.com/a/24907385
type: Question
tagged with: syntax-error
tagged with: nested-loops
has body: I'm stuck with a error I repedeatly got in Eclipse. I think that this error shouldnt exist. Given ist the following nested loop: String conditionlogic; if(matcher.find()) { do conditionogic += matcher.group(); while(matcher.find()); } else conditionogic = null; The error is The local variable conditionlogic may not have been initialized. It is my understanding, that since do-while will be executed at least once conditionlogic is actually initialized with one or more values of matcher.group() or else null. How can I fix this?
score: 0
has comment: http://stackoverflow.com/comment/38695746
accepted answer: http://stackoverflow.com/a/24907361
tagged with: initialization
has answer: http://stackoverflow.com/a/24907408
answer count: 4
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24907379

http://stackoverflow.com/q/24826617
tagged with: c++
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24862765
type: Question
has body: I am doing some work in opengl and java/android. I have some code in c++ and am using JNI to interface between the two. I get the results: D/App ( 2966): eglGetCurrentDisplay() 1 D/App ( 2966): thread id from c++ 2920 D/dalvikvm( 2966): threadid=11: interp stack at 0x613c5000 D/dalvikvm( 2966): init ref table D/dalvikvm( 2966): init mutex D/dalvikvm( 2966): create JNI env D/dalvikvm( 2966): create fake frame D/dalvikvm( 2966): threadid=11: adding to list (attached) D/dalvikvm( 2966): threadid=11: attached from native, name=(null) D/App ( 2966): thread id 2920 D/App ( 2966): EGL.eglGetCurrentDisplay is com.google.android.gles_jni.EGLDisplayImpl@0 From the code below. Which means the current display is changing when I go into JNI. Why does this happen? The thread is not changing and I believe thread local storage is where the driver will store this information. c++ code: printf("eglGetCurrentDisplay() %x\n", eglGetCurrentDisplay()); printf("thread id from c++ %d\n", (int)gettid()); int ret = Call_Java&lt;int&gt;("JNITest", "(I)I", 0 ); template&lt;typename T&gt; T Call_Java(const char* sMethodName, const char* sMethodArgs, ...) { JavaVM *g_javaVMcached; va_list argp; jint res; jobject obj; getJavaCache(&amp;obj, &amp;g_javaVMcached); assert(obj != 0); JNIEnv * env = 0; res = g_javaVMcached-&gt;AttachCurrentThread( &amp;env, 0 ); assert( res == 0 &amp;&amp; env != 0 ) jclass clazz = 0; clazz = env-&gt;GetObjectClass( obj ); assert( clazz != 0 ) jmethodID methodID = env-&gt;GetMethodID( clazz, sMethodName, sMethodArgs ); // Name + Args assert( methodID != 0 ) va_start(argp, sMethodArgs); T result=0; result = callJNIMethod&lt;T&gt;(obj, env, methodID, argp); va_end(argp); env-&gt;DeleteLocalRef( clazz ); return result; } template &lt;&gt; int callJNIMethod(const jobject &amp; obj, JNIEnv *env, jmethodID methodID, va_list args) { return env-&gt;CallIntMethodV(obj, methodID, args); } Java code: int JNITest(int test) { Log.d(TAG, "thread id " + (int)android.os.Process.myTid…
answer count: 2
tagged with: java-native-interface
has title: Why does my call to an EGL function change when running it in Java code through JNI?
possible better answer: http://stackoverflow.com/a/24829480
has answer: http://stackoverflow.com/a/24829480
score: 0
tagged with: egl
has answer: http://stackoverflow.com/a/24862765
tagged with: android

http://stackoverflow.com/comment/62101435
type: Comment
has text: Nor is this option present in Ultimate 2016.1, I can't seem to find a way to make IntelliJ automatically refresh my static resources (JavaScript files) for a Sprint Boot application. I have to restart the entire app.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27830852

http://stackoverflow.com/q/24873523
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24873653
downvote count: 3
has title: From string convert to list of list
tagged with: list
tagged with: java
has body: I have list of lists like this: [[foo, bar], [foo, bar]]. And created like this: List&lt;String&gt; listOfString = new ArrayList&lt;String&gt;(); listOfString.add("foo"); listOfString.add("bar"); String value = listOfString.get(0); List&lt;List&gt; listOfArray = new ArrayList&lt;List&gt;(); listOfArray.add(listOfString); listOfArray.add(listOfString); Then I converting that list to string and send to server. Then I get response also in string I want to convert that string back to list of lists. Ho I could solve it?
has comment: http://stackoverflow.com/comment/38632519
type: Question
has comment: http://stackoverflow.com/comment/38633739
upvote count: 0
answer count: 1
score: -3
favorite count: 0
tagged with: android

http://stackoverflow.com/a/29811355
answers question: http://stackoverflow.com/q/24766591
upvote count: 72
downvote count: 4
has comment: http://stackoverflow.com/comment/64917667
type: Answer
has comment: http://stackoverflow.com/comment/92914509
score: 68
has body: For IntelliJ14 you may have to change the bytecode version w.r.t. the JDK you are using (in the global settings):

http://stackoverflow.com/comment/38564546
comment on: http://stackoverflow.com/a/24836676
type: AnswerComment
score: 0
type: Comment
has text: +1 as always a detailed analysis with good alternative approaches.

http://stackoverflow.com/comment/38579815
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24845811
type: Comment
has text: you did put the java jdk in a directory with no spaces instead of Program Files, right?

http://stackoverflow.com/q/24886563
has comment: http://stackoverflow.com/comment/38659302
has comment: http://stackoverflow.com/comment/38656567
has title: Habit of making private methods static to increase functional programming
tagged with: static
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24886874
linked to: http://stackoverflow.com/q/538870
tagged with: oop
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/38667135
has comment: http://stackoverflow.com/comment/38657159
has comment: http://stackoverflow.com/comment/38669046
tagged with: static-methods
score: 0
has comment: http://stackoverflow.com/comment/38656439
has body: I got in touch with the functional programming paradigm (haskell, scala) and like the concept. I'm trying to incorporate these functional principles in my every day work. Here an example public class Functional { private final Object o1; private final Object o2; public Functional(Object o1, Object o2) { this.o1 = o1; this.o2 = o2; } /* * method has side effects */ private void method() { // o1.someChange(); // ... // o2.someChange(); } /* * method has no side effects - it only uses its parameters */ private static void method(Object o1, Object o2) { // o1.someChange(); // ... // o2.someChange(); } public void work() { method(o1, o2); } public static void main(String[] args) { Functional f = new Functional(new Object(), new Object()); f.work(); } } I find the static method easier to maintain, also for people who did not write the code, since they just have to look at the method parameters - which can be an advantage in big classes. Another minor advantage is performance, because after compilation static methods get called with invokestatic which is slightly faster. The public methods are still kept non static, since I don't want to discard OOP/encapsulation. I'm only talking about private static methods. QUESTION So what do you think of this apprach? Esp. what are the negativ sides my new habit of making all private methods static - within reason, as long as I don't need more than 3, 4 parameters?
tagged with: functional-programming

http://stackoverflow.com/comment/38663936
has text: Hiding is done. But any issue with reading & writing on a hidden file?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24886798
type: QuestionComment

http://stackoverflow.com/comment/38692212
has text: your index are false :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24905505

http://stackoverflow.com/a/50361738
type: Answer
has body: There are two setting.xml in windows. %MAVEN_HOME%\conf\ %userprofile%\.m2\ If %userprofile%\.m2\setting.xml takes effect, maven will not access %MAVEN_HOME%\conf\setting.xml.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24830610
downvote count: 0

http://stackoverflow.com/comment/38597985
has text: Nashorn should really check the interrupted status of the thread, which should be set by the `Future.cancel(true)` call, but it seems it doesn't do this. You may be able to submit this as a bug.
type: QuestionComment
comment on: http://stackoverflow.com/q/24855182
score: 0
type: Comment

http://stackoverflow.com/a/73701760
score: 2
upvote count: 2
has body: A clean way to do this is by mapping the elements of the list to string and then using the joining operation in Collectors class. List&lt;Integer&gt; ls = new ArrayList&lt;Integer&gt;(); ls.add(1); ls.add(2); ls.add(3); String s = ls.stream().map(Object::toString).collect(Collectors.joining(&quot;,&quot;));
has comment: http://stackoverflow.com/comment/130285438
answers question: http://stackoverflow.com/q/24882927
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38715115
type: Comment
has text: try { mapper.writeValue(wr,content); } catch (JsonMappingException e) { e.printStackTrace(); } this give an error in the line "(JsconMappingException e)". Where it says Incompatible types. Required: Java.lang.Throwable. Found:com.fasterxml.jackson.databind.JsonMappingException. Hope this helped to clarify the problem
comment on: http://stackoverflow.com/q/24889998
score: 0
type: QuestionComment

http://stackoverflow.com/q/24807662
has answer: http://stackoverflow.com/a/42420648
downvote count: 0
has comment: http://stackoverflow.com/comment/38507383
has comment: http://stackoverflow.com/comment/38534742
answer count: 2
has body: I want to pack the dependencies of my maven tycho eclipse-plugin project into the jar file like described here but with an manifest-first project like the eclipse-plugin projects. I don't want to list all eclipse-plugin dependencies in the pom.xml, is there a way to let the assembly-plugin or shade-plugin work with a MANIFEST.MF file? I want to use the eclipse-plugin in an other project and therefore the plugin should be packed into a jar with its dependencies (eclipse plug-in dependencies). maven-assembly-plugin: org.apache.maven.plugins maven-assembly-plugin 2.4 jar-with-dependencies false true make-assembly package single only collects dependencies in pom file, not from manifest -> jar-with-dependencies equals normal jar except the manifest file from the jar-with-dependencies is a new simple one instead of the original manifest from the project. mvn assembly:assembly fails with: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:assembly (default-cli) on project parent: Error reading assemblies: No assembly descriptors found. Tycho deps: mvn assembly:assembly has identic beginning as mvn install: Computing target platform Resolving dependencies Resolving class path ...for every module
has title: Pack dependencies of manifest-first maven project into jar
tagged with: jar
tagged with: eclipse-plugin
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/35221653
type: UnansweredQuestion
score: 2
tagged with: tycho
tagged with: java
tagged with: maven-assembly-plugin
type: Question
has comment: http://stackoverflow.com/comment/38534645

http://stackoverflow.com/q/24813087
type: Question
accepted answer: http://stackoverflow.com/a/24813335
tagged with: java
has body: My app has a Multiple Choice ListView where multiple elements may be selected. I have created a SparseBooleanArray to store whether or not the different elements were clicked, but am unsure how to implement an OnClickListener to this. public class ListOfMajors extends Activity { public static boolean aerospace, agricultural, biomed, chem, civil, computer, electrical, physics, environment, industrial, materials, mechanical; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.majorslist); ListView mylist = (ListView) findViewById(R.id.majorslist); String[] list={"Aerospace Engineering","Agricultural Engineering","Biomedical Engineering","Chemical Engineering","Civil Engineering", "Computer Engineering","Electrical Engineering","Engineering Physics","Environmental Engineering","Industrial Engineering", "Materials Engineering","Mechanical Engineering"}; ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(ListOfMajors.this,android.R.layout.simple_list_item_multiple_choice,list); mylist.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); mylist.setAdapter(adapter); SparseBooleanArray checkedItems = mylist.getCheckedItemPositions(); if (checkedItems!= null){ for(int i=0; i&lt;checkedItems.size();i++){ if(checkedItems.valueAt(0)){ aerospace = true; } if(checkedItems.valueAt(1)){ agricultural = true; } if(checkedItems.valueAt(2)){ biomed = true; } if(checkedItems.valueAt(3)){ chem = true; } if(checkedItems.valueAt(4)){ civil = true; } if(checkedItems.valueAt(5)){ computer = true; } if(checkedItems.valueAt(6)){ electrical = true; } if(checkedItems.valueAt(7)){ physics = true; } if(checkedItems.valueAt(8)){ environment = true; } if(checkedItems.valueAt(9)){ industrial = true; } if(checkedItems.valueAt(10)){ materials = true; } if(checkedItems.valueAt(11)){ mechanical = true; } } } } } I know there are quite a few questions on here with a similar question, but I am still uncertain what to do for my case. What s…
tagged with: listview
tagged with: onitemclicklistener
has answer: http://stackoverflow.com/a/24813335
answer count: 1
has title: Adding OnClickListener to Multiple Choice ListView
score: 0
tagged with: android
type: AnsweredQuestion
tagged with: onclicklistener

http://stackoverflow.com/comment/109325534
type: AnswerComment
comment on: http://stackoverflow.com/a/24820718
score: 0
type: Comment
has text: I would like to do the same, just programmatically.

http://stackoverflow.com/a/24864167
has body: Ok, I found that the problem was related with the TrustManager, the solution is described here
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24830314
accepted answer of: http://stackoverflow.com/q/24830314

http://stackoverflow.com/comment/38407026
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24753226
has text: I didn't notice that you had String to begin with. I updated the code snippet

http://stackoverflow.com/a/24829910
score: 0
answers question: http://stackoverflow.com/q/24766922
has body: No need to create buildDir manually, it has default value and refer to /build folder that place in same folder as build.gradle file. Did you run follow command? gradle writeNewPom after run it I got newpom.xml file in projectroot/build folder, BUT it contains no dependencies however I have dependencies in build.gradle file.
type: Answer
has comment: http://stackoverflow.com/comment/40771628

http://stackoverflow.com/comment/86883220
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24856333
has text: just click on run and then you'll find Something like Skip all break Points. please uncheck Skip all BreakPoints. then Start your Debug by adding break point. It will work fine for eclipse user.

http://stackoverflow.com/comment/38621837
has text: before to start secondactivity, you must release firstactivity mediaPlayer with release() method. try it
type: Comment
comment on: http://stackoverflow.com/a/24867278
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38636946
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24875923
type: QuestionComment
has text: @jack while that would work it defeats the point of learning algorithms to remove duplicates as the `Set` Does the work.

http://stackoverflow.com/comment/38732165
type: Comment
comment on: http://stackoverflow.com/q/24901178
score: 0
has text: @gaganbm : but atleast my 'Enter numbers' message should be printed at outputstream , right?
type: QuestionComment

http://stackoverflow.com/comment/38677821
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24897670
has text: Btw, I have a loose policy of "toString() for human-readable representation, another method for machine-parseable." So I may have for instance a `toString()` that I intend to read in a debugger, and a `toJsonString()` for when I want to serialize it (well, in real life I'd probably use jackson or some other library to json-ify it for me, but you get the point).

http://stackoverflow.com/comment/38668171
has text: Why are you using a URL and not a File ?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24892419

http://stackoverflow.com/comment/38434494
type: QuestionComment
type: Comment
has text: im new to the site, so im trying to figure my way around around it. thx again
score: 0
comment on: http://stackoverflow.com/q/24768076

http://stackoverflow.com/comment/38446213
score: 1
has text: A simple google search would have told you that `Splitter.fixedLength` is part of the Google Guava libraries ... https://code.google.com/p/guava-libraries/wiki/StringsExplained. The project home is at https://code.google.com/p/guava-libraries/
comment on: http://stackoverflow.com/q/24775271
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24821583
type: Question
tagged with: jsp
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/24822074
tagged with: css
has answer: http://stackoverflow.com/a/24822074
has title: Show progress bar in a application showing db records
type: AnsweredQuestion
has body: I have a application where i accept a number as input .and then use that to show up results on another page. The input number is used to hit multiple tables from an oracle db via sequential jdbc queries and it takes a huge amount of time(1-2 min) for results page to load. I would assure that time is needed as i am fetching huge chunks of memo records , however i want a progress bar which would represent the progress by linking to no of jdbc queries done or maybe a simple generic loading screen until the results page loads
tagged with: java

http://stackoverflow.com/a/24911356
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: Even if Fetch is not a Join type, you can cast it. You need to have the joins defined up-front, to avoid joining the same association twice Since you need those two additional joins for the "orderBy" clause you can use INNER instead of LEFT: CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery&lt;School&gt; criteriaQuery = builder.createQuery(School.class); Root root = criteriaQuery.from(EducationDistrictBundle.class); criteriaQuery.distinct(true); Join schoolJoin = root.join("schoolList", JoinType.LEFT); Join addressJoin = ((Join) schoolJoin.fetch("address", JoinType.INNER)); Join fullAddressJoin = addressJoin.fetch("fullAddress", JoinType.INNER); criteriaQuery = criteriaQuery.where(builder.and(predicates.toArray(new Predicate[predicates.size()]))); criteriaQuery.orderBy(builder.desc(fullAddressJoin)); criteriaQuery.select(schoolJoin);
has comment: http://stackoverflow.com/comment/115636388
has comment: http://stackoverflow.com/comment/115637259
answers question: http://stackoverflow.com/q/24908130

http://stackoverflow.com/comment/38472223
comment on: http://stackoverflow.com/q/24788718
type: Comment
type: QuestionComment
has text: Is there a way i could slow down without using Thread.Sleep(); ?
score: 0

http://stackoverflow.com/comment/38507160
score: 0
type: AnswerComment
has text: While this is a good answer, I guess you solved a homework exercise there =\
type: Comment
comment on: http://stackoverflow.com/a/24807680

http://stackoverflow.com/a/24892989
answers question: http://stackoverflow.com/q/24892789
type: AcceptedAnswer
score: 0
has body: It looks like your probably want to create your own ArrayAdapter that is typed to a simple class that holds an image resource (int) and your quote (String). public class QuoteListAdapter extends ArrayAdapater&lt;QuotedImage&gt; { // check link for examples } static class QuotedImage { int imageResource; String quote; } Check here for examples.
type: Answer
accepted answer of: http://stackoverflow.com/q/24892789

http://stackoverflow.com/q/24772981
answer count: 1
has body: I am trying to load google calender into an iframe in my application. When i am logged into gmail i can access the google calender. However if i i am not logged into my gmail there is an error in the console Load denied by X-Frame-Options:+ the src + does not permit framing What i want is when this error comes up i want an error message shown to the user which reminds them to log into their gmail before accessing the feature. How to catch the error ? Here is my iframe `var link = " "; `
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24953872
has title: Error message : load denied X-Frame-Options
tagged with: x-frame-options
tagged with: java
tagged with: iframe
tagged with: error-handling
type: Question
tagged with: javascript
score: 0

oracle-database
tags question: http://stackoverflow.com/q/24908968
tags question: http://stackoverflow.com/q/24786562
tags question: http://stackoverflow.com/q/24890690
tags question: http://stackoverflow.com/q/24820218
tags question: http://stackoverflow.com/q/24858758
tag name: oracle-database
tags question: http://stackoverflow.com/q/24852782
tags question: http://stackoverflow.com/q/24772851
tags question: http://stackoverflow.com/q/24797688
tags question: http://stackoverflow.com/q/24792692
tags question: http://stackoverflow.com/q/24858624
tags question: http://stackoverflow.com/q/24755724
type: Tag
tags question: http://stackoverflow.com/q/24776554
tags question: http://stackoverflow.com/q/24753096
tags question: http://stackoverflow.com/q/24909125
tags question: http://stackoverflow.com/q/24773187
tags question: http://stackoverflow.com/q/24864579
tags question: http://stackoverflow.com/q/24801447
tags question: http://stackoverflow.com/q/24866491
tags question: http://stackoverflow.com/q/24878130
tags question: http://stackoverflow.com/q/24815292
tags question: http://stackoverflow.com/q/24823903
tags question: http://stackoverflow.com/q/24822396
tags question: http://stackoverflow.com/q/24902849
tags question: http://stackoverflow.com/q/24765937
tags question: http://stackoverflow.com/q/24873595
tags question: http://stackoverflow.com/q/24805479
tags question: http://stackoverflow.com/q/24868256

http://stackoverflow.com/q/24801372
has comment: http://stackoverflow.com/comment/38496877
score: 0
has comment: http://stackoverflow.com/comment/38496893
upvote count: 1
downvote count: 1
has body: I am a beginner in Java Web Applications and I read some information here on how to start use primefaces and as a result I added PrimeFaces components to my page as xmlns:p="http://primefaces.org/ui" and also added the primefaces-5.0.jar to my classpath: MyProject-&gt;Java_Resources-&gt;Libraries-&gt;primefaces-5.0.jar I read that I had to add primefaces-5.0.jar to WEB-INF-&gt;lib-&gt;primefaces-5.0.jar and I did it, but I couldn't work with primefaces. I ran my project and neither of primefaces didn't show and also I didn't see any warnings and errors. Do you know any solutions to my problem?
answer count: 1
has answer: http://stackoverflow.com/a/24807956
has title: PrimeFaces in Eclipse Java EE IDE for Web Developers
tagged with: jsf
tagged with: primefaces
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38495360
favorite count: 0
has comment: http://stackoverflow.com/comment/38495654
type: Question
has comment: http://stackoverflow.com/comment/38497029

http://stackoverflow.com/comment/38465246
has text: I think it's because you keep loading all your data into the default model, and then adding the default model as a named model. All your models end up being the same because of your loadModel implementation.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24783705

http://stackoverflow.com/comment/38481383
comment on: http://stackoverflow.com/a/24793684
score: 0
type: AnswerComment
has text: can you explain how it is O(n)??? because BFS() takes O(n) and for every node(total n nodes) we have to calculate distance between them and new node which take n.O(h),(h=height) ie n.O(logn)=O(nlog(n)). Right???
type: Comment

http://stackoverflow.com/comment/38521014
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24814794
score: 0
has text: And what is exactly your problem?

http://stackoverflow.com/a/24851481
type: Answer
has comment: http://stackoverflow.com/comment/38589742
has comment: http://stackoverflow.com/comment/38589729
has comment: http://stackoverflow.com/comment/38589713
score: 0
has body: It worked after I enclosed it in a try catch finally block.Changed the code as given below public List&lt;String&gt; getStores() throws SQLException{ List&lt;String&gt; store_id=new ArrayList&lt;&gt;(); Connection con=ConnectDatabase.getDb2ConObj(); try{ String query="select distinct(store_id) from stores"; Statement stmt=con.createStatement(); java.sql.ResultSet rsResultSet=stmt.executeQuery(query); while(rsResultSet.next()){ store_id.add(rsResultSet.getString(1)); } }catch(Exception e){ }finally{ con.close(); } return store_id; } Thanks.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24851444
answers question: http://stackoverflow.com/q/24851444

http://stackoverflow.com/a/24885430
has comment: http://stackoverflow.com/comment/38655081
has body: Try to use servletContext.getRealPath method like this: PdfReader reader = new PdfReader(getServletContext().getRealPath("/Salary/pivot.pdf")); Check details in the Documentation
accepted answer of: http://stackoverflow.com/q/24884347
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24884347
has comment: http://stackoverflow.com/comment/38680366
type: Answer
has comment: http://stackoverflow.com/comment/38699438
upvote count: 1
has comment: http://stackoverflow.com/comment/38698926

http://stackoverflow.com/comment/38571342
has text: You code does not match the description? where is solve()?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24840762

http://stackoverflow.com/q/24809035
has title: How to make JTable in applet accessible only for one user in particular time?
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38509886
type: Question
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/38514985
tagged with: applet
has comment: http://stackoverflow.com/comment/38525396
has body: I'm coding an applet based on JTable. Users will be able to change values of some cells. I'm trying to make JTable editable only for one user in particular time and I got stacked. Could you give me some tips, please?

http://stackoverflow.com/comment/38480073
has text: If you are working from command line, type `java -version` and let me know the output. If you are using an IDE, some IDEs have 1.7+ syntax switched off by default, even if they are using a 1.7+ compiler. If you are using an IDE please post which one.
score: 7
comment on: http://stackoverflow.com/q/24792970
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38474853
score: 0
type: Comment
type: QuestionComment
has text: Is the difference in your pronounciation notation significant?
comment on: http://stackoverflow.com/q/24788527

http://stackoverflow.com/comment/38609541
comment on: http://stackoverflow.com/a/24861479
has text: if I do it like this I get in response only [], when I was testing my function on normal java class it is working good
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24873911
upvote count: 5
has comment: http://stackoverflow.com/comment/38633189
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38633206
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24873879
answers question: http://stackoverflow.com/q/24873879
score: 5
type: Answer
has body: You can use String#matches(regex) method with .*?b.b.* regex pattern to match the text. System.out.println("gjsdng".matches(".*?b.b.*")); //false System.out.println("bob".matches(".*?b.b.*")); //true System.out.println("bab".matches(".*?b.b.*")); //true System.out.println("gdfgbUbfg".matches(".*?b.b.*")); // true Pattern explanation: .*? any character except \n (0 or more times (matching the least amount possible)) b 'b' . any character except \n b 'b' .* any character except \n (0 or more times (matching the most amount possible))

http://stackoverflow.com/a/50972632
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/88942230
answers question: http://stackoverflow.com/q/24830610
has body: I was dealing with this running Artifactory version 5.8.4. The "Set Me Up" function would generate settings.xml as follows: ${security.getCurrentUsername()} ${security.getEscapedEncryptedPassword()!"AP56eMPz8L12T5u4J6rWdqWqyhQ"} central ${security.getCurrentUsername()} ${security.getEscapedEncryptedPassword()!"AP56eMPz8L12T5u4J6rWdqWqyhQ"} snapshots After using the mvn deploy -e -X switch, I noticed the credentials were not accurate. I removed the ${security.getCurrentUsername()} and replaced it with my username and removed ${security.getEscapedEncryptedPassword()!""} and just put my encrypted password which worked for me: username AP56eMPz8L12T5u4J6rWdqWqyhQ central username AP56eMPz8L12T5u4J6rWdqWqyhQ snapshots Hope this helps!
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38438301
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24771178
has text: Why don't you use some FTP library?

http://stackoverflow.com/comment/38588541
type: Comment
type: QuestionComment
has text: @ThomasJungblut I have rechecked and I am able to make a MaxHeap implementing this method.The idea is to take a node and swap it with it's larger children if it is smaller than it's children.
comment on: http://stackoverflow.com/q/24849838
score: 0

http://stackoverflow.com/comment/38439787
comment on: http://stackoverflow.com/q/24771938
score: 0
type: Comment
has text: Use regex or direct string manipulation and give a try
type: QuestionComment

http://stackoverflow.com/comment/102607372
has text: @meghraj27 I just updated the answer again, let me know if it solves your issue or not
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/50675771
type: Comment

http://stackoverflow.com/comment/38654577
type: AnswerComment
type: Comment
has text: You may well be right. By the way, it may be worth editing your answer to mention that the array is in fact initialised to zeroes, as you hinted at in the comments.
score: 1
comment on: http://stackoverflow.com/a/24885598

http://stackoverflow.com/q/24885829
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25821907
has answer: http://stackoverflow.com/a/24888774
score: 0
tagged with: lejos-nxj
has title: Briefly taking control of an object owned by another thread
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2536692
tagged with: multithreading
has body: I hava a Java-controlled robot. It has an ultrasonic sensor that is rotated back and forth by Motor B. Normally, I have a separate thread that scans the environment and sends the collected data to another machine in order to draw a map. However, sometimes the main thread needs to briefly use the sensor to look in a specific direction. Here's my scanner thread: public void run() { while (!stop) { Motor.B.forward(); while (Motor.B.getTachoCount() &lt; 90 &amp;&amp; !stop) { try{Thread.sleep(20);} catch (InterruptedException ex) {ex.printStackTrace();} Mapperbot.sendCommand("S US "+sonic.getDistance()+" "+Motor.B.getTachoCount()); } Motor.B.backward(); while (Motor.B.getTachoCount() &gt; -90 &amp;&amp; !stop) { try{Thread.sleep(10);} catch (InterruptedException ex) {ex.printStackTrace();} } } Motor.B.stop(); } And here's the "tell me the direction now" function, it belongs to the same class: public synchronized int getDistanceInDirection(int direction) { Motor.B.rotateTo(direction); return sonic.getDistance(); } The required behavior: Whenever "getDistanceInDirection" is called, it must briefly stop scanning and turn to the given direction, return the distance, and continue scanning. What is the correct way to tell my scanner thread for the time it takes to execute the second function?
has comment: http://stackoverflow.com/comment/38667342
tagged with: java

http://stackoverflow.com/comment/38622576
type: AnswerComment
score: 0
type: Comment
has text: what about version 3.1.0, is this version is also compatible with 12c ? Thanks
comment on: http://stackoverflow.com/a/24855562

http://stackoverflow.com/q/24796248
has comment: http://stackoverflow.com/comment/38486005
has title: Behavior of ArrayList<>().contains(Object obj)
has answer: http://stackoverflow.com/a/24796310
tagged with: arraylist
answer count: 3
downvote count: 0
favorite count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/24796310
has answer: http://stackoverflow.com/a/24796370
type: AnsweredQuestion
has body: It's not actual problem it's more like a question. How exactly method contains(Object obj) checks if object exists in collection? I have simple sample that made me kind of confused. I have two lists, first list oldList = new ArrayList&lt;FtpFileInfo&gt;() and second list newList = new ArrayList&lt;FtpFileInfo&gt;() oldList contains something like that: newone.txt test.txt test2.txt and newList contains: newone.txt test.txt test2.txt test3.txt In simple for-each loop I check if any object from newList exists in oldList, and if not I put it to new list called outputList: for(FtpFileInfo newFile : newList) { if(!oldList.contains(newFile)) { outputList.add(newFile.getFilename()); } } And I suspect the output of this list should be: test3.txt but I get: newone.txt test.txt test2.txt test3.txt I've tried the same example but with String objects and everything works as I thought, so what is wrong with my example, or this behavior is caused by FtpFileInfo object?
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24796308
accepted answer: http://stackoverflow.com/a/24796308

http://stackoverflow.com/comment/38589774
type: AnswerComment
type: Comment
has text: I prefer you answer more than mine.
comment on: http://stackoverflow.com/a/24851502
score: 0

http://stackoverflow.com/a/24867317
has comment: http://stackoverflow.com/comment/38620432
answers question: http://stackoverflow.com/q/24867173
has comment: http://stackoverflow.com/comment/38620282
has comment: http://stackoverflow.com/comment/38620492
type: Answer
has comment: http://stackoverflow.com/comment/38620611
upvote count: 3
has comment: http://stackoverflow.com/comment/38620733
has body: You can't. What you can do is to check for the sdk version if (Build.VERSION.SDK_INT &gt;= 9) { // Constructor with charset } else { // Constructor without charset, providing the charset as string } Froyo devices are something like 0.7%
score: 3
has comment: http://stackoverflow.com/comment/38620537
has comment: http://stackoverflow.com/comment/38620779
downvote count: 0

http://stackoverflow.com/q/24907705
accepted answer: http://stackoverflow.com/a/24908331
answer count: 4
tagged with: log4j
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/38696962
tagged with: log4j2
tagged with: logging
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38696648
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24907928
has answer: http://stackoverflow.com/a/24908331
possible better answer: http://stackoverflow.com/a/24907920
has answer: http://stackoverflow.com/a/24907920
downvote count: 0
has title: log4J causes error: The method getRootLogger() is undefined for the type Logger
has answer: http://stackoverflow.com/a/32434608
has body: I created a sample dynamic web project to test log4j. The code highlighed with bold shows error and says : 'Error: The method getRootLogger() is undefined for the type Logger' The servlet snippet is as follows: private Logger logger = null; logger = Logger.getLogger(); BasicConfigurator.configure(); How to resolve this error.

http://stackoverflow.com/a/24920540
answers question: http://stackoverflow.com/q/24908711
upvote count: 1
has body: The pattern in the publish task should match a that is created locally in your build. Additionally the publish section of the ivy file must match the files your attempting to upload. Hopefully some examples will help: good ivy tutorial for local repository? Issues using ivy:publish task Convert ivy.xml to pom.xml how to publish 3rdparty artifacts with ivy and nexus
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/38779559
has comment: http://stackoverflow.com/comment/38800695
accepted answer of: http://stackoverflow.com/q/24908711

http://stackoverflow.com/a/24809830
upvote count: 4
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24809513
answers question: http://stackoverflow.com/q/24809513
type: Answer
has body: Passing the selected position from the Activity to the FragmentActivity can be done with Bundle Your Intent should look like this: Intent intent = new Intent(Activity.this, FragmentActivity.class); intent.putExtra("idforthevalue",selectedPOsition); startActivity(intent); Then on your FragmentActivity you can retrieve the value: Bundle extras = getIntent().getExtras(); int position = 0; if(extras != null) { position = extras.getInt("idforthevalue"); } And the depending on how you are adding your fragments you can also pass this value to them with Bundle from the FragmentActivity in a FragmentTransaction FragmentManager fragmentManager = getFragmentManager(); // or getSupportFragmentManager() if you are using compat lib FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); FragmentX fragmentX = new FragmentX(); Bundle bundle = new Bundle(); bundle.putInt("idforthevalue", position); fragmentX.setArguments(bundle); fragmentTransaction.replace(id_of_container, fragmentX).commit(); And again you can retrieve the value in the fragment Bundle bundle = getArguments(); if(bundle != null) { position = bundle.getInt("idforthevalue", 0); } You can do the same for the three Fragments.

http://stackoverflow.com/q/24870179
has body: I work on a web app designed for helping transportation companies manage non-emergency trips. The server side is Jboss Web, which is a modified version of Tomcat 6. The company that I work for has recently been tasked with adding some custom functionality for specific customers. The app is capable of importing a CSV file from a 3rd party company. The CSV contains a listing of trips that the company can import into our software and then manage the trips from there. What some of our customers have been asking for is a feature to default a scheduled pickup and scheduled drop-off time based on the appointment time in the CSV, per record. However, all of our customers have different methods of estimating these times. I'm thinking that I can achieve this custom functionality with some short scripts added per company. However, I would like to be able to have database access from the script. What I would really like is the ability to pass the existing connection object from the java servlet to the script itself. If I could do it this way then I eliminate the need to open/close a connection per record in the CSV. I wouldn't be setting any data in the database from the script itself. I would just be looking up values in the database to aid in the calculations. So, after explaining all that, this is what I want to know. Is there scripting language out there that allows me to pass in and return native java objects from a java servlet?
tagged with: scripting
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24870235
tagged with: java
tagged with: servlets
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24898165
has title: Scripting and Java Servlets

http://stackoverflow.com/a/24778783
has comment: http://stackoverflow.com/comment/38464665
has comment: http://stackoverflow.com/comment/38460929
has comment: http://stackoverflow.com/comment/38452248
has comment: http://stackoverflow.com/comment/38452354
has comment: http://stackoverflow.com/comment/38464512
score: 0
answers question: http://stackoverflow.com/q/24778613
has body: I didn't fully analyze your code nor do I know what It it sometimes work. actually means (e.g. in which circumstances doesn't it work?) but you're using a bounding sphere for detecting whether the object has been clicked or not. Assuming your calculations are correct (as I said, I didn't check them in depth) you still can have false positives or negatives since the only shape which is perfectly represented by a bounding sphere is ... well... a sphere. That might be the source for click detection to work "sometimes". If that is the case and you want more accurate detection you should either use different bound volumes, bounding volumne hierarchies or a rendering based approach (i.e. render the object id into some buffer, which would allow for pixel perfect selection). UPDATE: From your post update it seems that bounding spheres are not the problem here, since they should not overlap, unless your data is wrong - which you should check/debug. So the problem might actually lie in your calculations. From the documentation it looks like the ray you get is projected into the scene (i.e. into world space) so you'd need to transform your objects' center into worldspace as well. You're currently only applying the position but ignore rotation and scale thus the resulting position might be wrong. I'm sure there's some built-in transform code, so instead of transforming manually you should use that. Please check the docs on how to do that.
type: Answer

http://stackoverflow.com/comment/38681187
comment on: http://stackoverflow.com/q/24899410
score: 0
type: QuestionComment
type: Comment
has text: What's the difference between `nPlayer` and `Player`?

http://stackoverflow.com/q/24903146
upvote count: 1
has answer: http://stackoverflow.com/a/24903383
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24904229
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: database
has title: Approach Suggestion Required : Database insert from 1 db to another
type: Question
has body: I have two database on two different machines. Let say DB1 and DB2 DB1 - JDBC connection - Select Query DB2 - Through Hibernate - Insert Query In DB1, there is one table user in which 35K records are present. I need to fetch this data from Java JDBC and store the data in the hibernate entity object. Now My question is : Should I fetch the 35K records in 1 go like ( Select * from User ) and create 35 K entity obj and store one by one in DB2. In this case...my concern point is memory and how to handle if exception occur like db connection failed with DB2. What I feel is if there is any approach in which I select 200 records and store that 200 records and so on. Plz suggest.
answer count: 2
linked to: http://stackoverflow.com/q/1318354

http://stackoverflow.com/comment/38496818
type: QuestionComment
comment on: http://stackoverflow.com/q/24802152
score: 1
has text: If your vision is that you want a piece of what's on the touchscreen to be mirrored to the `Presentation`, my [CWAC-Presentation](https://github.com/commonsguy/cwac-presentation) library has [classes dedicated for that scenario](https://github.com/commonsguy/cwac-presentation#usage-mirroring-presentation-classes).
type: Comment

http://stackoverflow.com/q/24858259
tagged with: graphics
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24858285
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/13457237
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/24026743
has title: The point of origin in my GUI is off by about 25/26 pixels
favorite count: 0
linked to: http://stackoverflow.com/q/17157956
has answer: http://stackoverflow.com/a/24858285
tagged with: paint
has body: My point of origin (0,0) on my GUI is moved up by about 25/26 pixels. So the very top-left corner of my GUI seems to represent 0,25 or 0,26. I am using a double buffer to draw in things. Basically, whenever I try to draw something in my buffer at 0,0, it appears off-screen. For example, below is a screenshot of a checkerboard pattern I attempted to generate, starting from 0,0. Although it seems fine horizontally, notice the chopped checkerboard at the top. The height is 480, which is divisible by 32 keep in mind, so the checkerboard pattern should fill in perfectly. And here is my code (Snipped in irrelevant parts): public class Dekari_gameGUI extends JFrame implements KeyListener { // Resources private final String imagePath = "Resources/Images/"; private final String spriteSheetPath = imagePath + "Sprite Sheets/"; private final String soundPath = "Resources/Sounds/"; private final String dataPath = "Resources/Data/"; private BufferedImage[][] sprites; private Timer playerMovementTimer = new Timer(); //Game variables private int pX = 0, pY = 0; private short pDir = -1, pLastDir = 0, pAniStage = 0, counter = 0; //Graphics and paint variables private Graphics buffer; private Image offscreen; private Dimension dim; //Internal variables, used for loops and placeholders private int a, b, c, d; /* ____ _ _ / ___|___ _ __ ___| |_ _ __ _ _ ___| |_ ___ _ __ | | / _ \| '_ \/ __| __| '__| | | |/ __| __/ _ \| '__| | |__| (_) | | | \__ \ |_| | | |_| | (__| || (_) | | \____\___/|_| |_|___/\__|_| \__,_|\___|\__\___/|_| */ public Dekari_gameGUI() { // Declaring GUI setup setResizable(false); setTitle("Dekari RPG Indev v1.0"); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setSize(640, 480); setBackground(Color.GREEN); setLocationRelativeTo(null); //Centers the window splitSpriteSheets(); //Sets up resources dim = getSize(); offscreen = createImage(dim.width, dim.height); buffer = offscreen.getGraphics(); *snip* setVisible(true); } *snip* /* ____ _ _ | _ \ __ _(_)_ __ | |_ | |_) …
tagged with: jframe
linked to: http://stackoverflow.com/q/13734069
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/38657524
comment on: http://stackoverflow.com/q/24887196
type: Comment
score: 0
has text: I doubt it is possible to get an "applied" method reference, but you could create the lambda prior and merely supply it as an argument.
type: QuestionComment

http://stackoverflow.com/comment/38491275
comment on: http://stackoverflow.com/q/24799068
score: 0
has text: Have you debugged this code and verified the value of url before the URL constructor is invoked?
type: Comment
type: QuestionComment

wamp
tag name: wamp
type: Tag
tags question: http://stackoverflow.com/q/24792659

http://stackoverflow.com/q/24781533
type: Question
has answer: http://stackoverflow.com/a/24781663
has comment: http://stackoverflow.com/comment/38457889
score: 0
tagged with: window
answer count: 1
tagged with: processbuilder
type: UnansweredQuestion
has title: Change process' window size in Java
tagged with: java
has comment: http://stackoverflow.com/comment/38457955
tagged with: process
has body: I have a Java program that launches another Java application via ProcessBuilder. My program also retains a Process object after launching the other application. ProcessBuilder launcher = new ProcessBuilder(argArray); Process processHandle = launcher.start(); In my program, I have 'user preferences' where the user can specify the on-screen size and location of the other application that is being started. I need my program to be able to change the size and location of the other application's window in pixels, preferably without utilizing P/Invoke, as this is meant to be a cross-platform application. Does anyone know how to change a Process' window size and location programmatically in Java?

http://stackoverflow.com/comment/38402358
comment on: http://stackoverflow.com/q/24751897
score: 2
has text: Have you checked that the database file is really in /databases folder? Based on your code, the database file will be created if it fails to open it, resulting in empty database (no tables).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38540382
has text: Listening on javadebug Not able to submit breakpoint LineBreakpoint Customer_Bills.java : 11, reason: The breakpoint is set outside of any class. Invalid LineBreakpoint Customer_Bills.java : 11 User program running User program finished
comment on: http://stackoverflow.com/a/24824507
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/24838842
tag name: csv
tags question: http://stackoverflow.com/q/24761621
tags question: http://stackoverflow.com/q/24789291
tags question: http://stackoverflow.com/q/24758944
tags question: http://stackoverflow.com/q/24799457
tags question: http://stackoverflow.com/q/24902673
tags question: http://stackoverflow.com/q/24905569
tags question: http://stackoverflow.com/q/24864749
tags question: http://stackoverflow.com/q/24849799
tags question: http://stackoverflow.com/q/24778058
tags question: http://stackoverflow.com/q/24787047

http://stackoverflow.com/q/24777073
type: Question
has comment: http://stackoverflow.com/comment/38460973
answer count: 1
has comment: http://stackoverflow.com/comment/38461523
upvote count: 1
tagged with: windows
has comment: http://stackoverflow.com/comment/38568005
favorite count: 0
type: UnansweredQuestion
has body: First of all sorry for my poor English. I want to know how the windows will do auto java update check behind the User Interface ? The UI will just react based on our input which is in the link , http://java.com/en/download/help/java_update.xml#howto . But , how windows checks the updates programmatically. I wrote a small program in java , public class JavaLatestVersion { public static void main(String[] args){ try { BufferedReader br = new BufferedReader(new InputStreamReader(new URL( "http://java.com/applet/JreCurrentVersion2.txt").openStream())) ; String fullVersion = br.readLine(); System.out.println("fullVersion : "+fullVersion); String version = fullVersion.split("_")[0]; String revision = fullVersion.split("_")[1]; System.out.println("Version " + version + " revision " + revision); } catch (IOException e) { e.printStackTrace(); } } } My questions : 1. Is the above program is the reliable way to get the latest java version ? Or any other standard way to get the latest java version (Not in the computer) ? 2. Is windows use the same way to determine the latest java version ? 3. Is windows use this link for updates http://java.com/applet/JreCurrentVersion2.txt ? Any one know the secret code behind how windows will check for latest java updates? Thanks in advance.
has answer: http://stackoverflow.com/a/33609925
downvote count: 0
score: 1
tagged with: java
tagged with: updates
has title: how windows will do auto java update checks?

http://stackoverflow.com/a/28215965
downvote count: 0
upvote count: 5
type: Answer
has body: I had similar problem and this article helped me: https://looksok.wordpress.com/2014/09/06/spring-4-soap-request-with-http-basic-authentication/
answers question: http://stackoverflow.com/q/24779373
score: 5

http://stackoverflow.com/comment/38703376
type: QuestionComment
comment on: http://stackoverflow.com/q/24894784
has text: the problem was the Avast firewall. I turned off avast and everything is fine now. Thanks to everyone!
score: 0
type: Comment

http://stackoverflow.com/a/30828046
has comment: http://stackoverflow.com/comment/80747579
score: 0
type: Answer
has body: to compile more than one file having different package name in same folder use javac -d . *.java
answers question: http://stackoverflow.com/q/24847436

http://stackoverflow.com/a/24893362
upvote count: 3
downvote count: 1
has body: I'd do it like this: Remove the getHostTypeCreate method from the abstract class since not all of the connections have this property. Then add a new interface IHostTypeProvider(you might pick a better name though): public interface IHostTypeProvider { int getHostType(); } Now, make some of the sub-classes implement this interface: public SqlServerConnection extends Connection implements IHostTypeProvider { .... public int getHostType() { return 5060; } } When you actually need access to the property, you fist need to check if it's available for this type of connection: Connection con = ...; //Check if host type is available if (connection instanceof IHostTypeProvider) { System.out.println(((IHostTypeProvider)con).getHostType()); } Hope that helps.
answers question: http://stackoverflow.com/q/24778774
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38815604

http://stackoverflow.com/a/27254191
has comment: http://stackoverflow.com/comment/45515624
upvote count: 24
has comment: http://stackoverflow.com/comment/48382787
type: Answer
has comment: http://stackoverflow.com/comment/53571530
has comment: http://stackoverflow.com/comment/50586667
has comment: http://stackoverflow.com/comment/45534981
answers question: http://stackoverflow.com/q/24809580
score: 23
has comment: http://stackoverflow.com/comment/43537702
downvote count: 1
has comment: http://stackoverflow.com/comment/43328005
has comment: http://stackoverflow.com/comment/43328838
has body: On which device you are facing this problem ? (Samsung/HTC etc.) If it is Samsung, Various Samsung phones are included older versions of the android support library in the framework or classpath. If you use the new material support library, you'll see this crash on those Samsung devices: java.lang.NoClassDefFoundError: android.support.v7.internal.view.menu.MenuBuilder To fix this, you must rename that class. Easiest way to do that is by running proguard. If you don't want to obfuscate, here's a 1 liner to rename just the offending classes: -keep class !android.support.v7.internal.view.menu.**,** {*;} There's an issue tracking this problem, but since it's really a Samsung bug, it's never going to get fixed on their end. Only way to fix it on the Google/AOSP side is to rename these internal classes. https://code.google.com/p/android/issues/detail?id=78377
has comment: http://stackoverflow.com/comment/48457584

http://stackoverflow.com/comment/38697008
score: 0
comment on: http://stackoverflow.com/q/24907725
type: Comment
type: QuestionComment
has text: If the root of 1st tree is taken and placed in the 2nd tree in its proper place, it takes logN compares on an average. So for all the keys in the 1st tree (N keys) to be in the 2nd tree in takes linearithmic (NlogN) comapres and thus time.

http://stackoverflow.com/tag/rdf
tags question: http://stackoverflow.com/q/24786035
tags question: http://stackoverflow.com/q/24783486
type: Tag
tags question: http://stackoverflow.com/q/24756738
tags question: http://stackoverflow.com/q/24773616
tags question: http://stackoverflow.com/q/24769468
tag name: rdf

http://stackoverflow.com/comment/38526683
type: QuestionComment
has text: In your SportsAction class are you getting value in pic byte[] ?
score: 0
comment on: http://stackoverflow.com/q/24817594
type: Comment

http://stackoverflow.com/comment/38662210
type: QuestionComment
has text: @ElliottFrisch The form sends parameters fine. I checked this by changing the conditional statement to `==` and it works.
comment on: http://stackoverflow.com/q/24889381
score: 0
type: Comment

http://stackoverflow.com/comment/38608071
type: QuestionComment
has text: Any help from DB side, as the connections are are idle at most of the time , not running any sql, why cant Oracle DB has option of closing connection after some time(session time or default time say 30 min ? Please let me know if any such option.
comment on: http://stackoverflow.com/q/24858624
score: 0
type: Comment

http://stackoverflow.com/q/24854175
tagged with: python
has comment: http://stackoverflow.com/comment/38595485
answer count: 0
type: UnansweredQuestion
tagged with: django
has comment: http://stackoverflow.com/comment/38595893
tagged with: java
has title: Django webpage with offline manager
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38595450
tagged with: ajax
has comment: http://stackoverflow.com/comment/38595622
has comment: http://stackoverflow.com/comment/38595284
has body: I'd like to create a Django webpage, and an offline "manager" program for it. For example a weblog with an offline editor for PCs (I'd prefer Java), but I'd like to store the entries both offline and online. And create the offline "manager" for it, and provide online admin page for it. When i modify something in the offline program, I can send an AJAX (or something like AJAX) message to the site. But I'd like to create push-notifications in my offline app, to notify the offline user, if I modify something on the online admin page. What's the best way to do it securely? I did run itno Websockets, but Django do not support websockets. The "from offline to online" way can be implemented somehow with AJAX, or something similar. How to do this securely? And the "from online to offline". If it's possible, I'd like to avoid the "ask the server for changes in every 5 minutes" way. Thanks!

http://stackoverflow.com/comment/38612906
type: Comment
type: QuestionComment
has text: yes its a single column grid as i am basically adding an entire mini panel on click of plus button
comment on: http://stackoverflow.com/q/24861983
score: 0

http://stackoverflow.com/q/24823892
has answer: http://stackoverflow.com/a/24871744
has comment: http://stackoverflow.com/comment/38537922
favorite count: 0
has comment: http://stackoverflow.com/comment/38537954
has comment: http://stackoverflow.com/comment/38537855
has comment: http://stackoverflow.com/comment/38537757
has answer: http://stackoverflow.com/a/24824156
linked to: http://stackoverflow.com/q/7651221
answer count: 4
downvote count: 4
type: AnsweredQuestion
has title: Current month count monday?
has comment: http://stackoverflow.com/comment/38537581
tagged with: java
possible better answer: http://stackoverflow.com/a/24824156
has comment: http://stackoverflow.com/comment/38537659
type: Question
has answer: http://stackoverflow.com/a/24824507
upvote count: 2
has answer: http://stackoverflow.com/a/24824453
has comment: http://stackoverflow.com/comment/38537677
accepted answer: http://stackoverflow.com/a/24824453
has comment: http://stackoverflow.com/comment/38537600
score: -2
has comment: http://stackoverflow.com/comment/38537555
linked to: http://stackoverflow.com/q/8040790
has body: How do you find the total number of Mondays (e.g. 4 or 5) in a particular month ??? Calendar c = Calendar.getInstance(); int mon = c.getActualMaximum(Calendar.MONDAY); is this right way ??

http://stackoverflow.com/comment/38571391
score: 1
has text: http://stackoverflow.com/questions/3881/illegalargumentexception-or-nullpointerexception-for-a-null-parameter It's a bug in both the caller as well as the library.
type: AnswerComment
comment on: http://stackoverflow.com/a/24833674
type: Comment

http://stackoverflow.com/comment/38440581
type: Comment
type: QuestionComment
has text: It doesn't recognizes getSupportActionBar() :The method getSupportActionBar() is undefined for the type MainActivity
comment on: http://stackoverflow.com/q/24772360
score: 0

http://stackoverflow.com/q/24831857
answer count: 0
tagged with: java
has title: Passing numerical data between EditText and Variables, and vice versa
type: Question
has comment: http://stackoverflow.com/comment/38553282
has comment: http://stackoverflow.com/comment/38553231
score: 0
has comment: http://stackoverflow.com/comment/38553693
has comment: http://stackoverflow.com/comment/38553131
has body: In the following code, I'm trying to pass numerical data from two EditText fields to two variables, perform a computation (multiplication), then have the result displayed in a third EditText field. I have tried two different scenarios but whenever I try running the code, the the program crashes. Below is the first scenario: package edu.arizona.uas.fonji.bmicalculator; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.text.DecimalFormat; public class BmiCalculator extends ActionBarActivity { Button reset_button, calculate_button; EditText height_text; EditText weight_text; EditText bmi_text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bmi_calculator); EditText height_text = (EditText)findViewById(R.id.height); //get value from height text box String height_string = height_text.getText().toString(); //convert to string final float height_value = Integer.parseInt(height_string); //convert to number EditText weight_text = (EditText)findViewById(R.id.weight); //get value from weight text box String weight_string = weight_text.getText().toString(); //convert to string final float weight_value = Integer.parseInt(weight_string); //convert to number calculate_button.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { DecimalFormat df = new DecimalFormat("#.0"); double adouble = weight_value*height_value; bmi_text.setText("Number is " + df.format(adouble)); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.bmi_calculator, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action ba…
type: UnansweredQuestion
tagged with: android
tagged with: android-edittext

http://stackoverflow.com/q/24862433
has answer: http://stackoverflow.com/a/24862550
has answer: http://stackoverflow.com/a/24862508
tagged with: database
score: 0
has body: I understand some might simply answer this question with "Why didn't you just Google it"... But I did, and the more I researched this the more confused I got. I'm trying to query my database with Hibernate, the query has a 'where' clause. Now creating a database entry is easy enough, in the case where I have a 'User' class, I simply do this: // Gets a new session Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); // Creates a new User object User user = new User("John", "p@55w0rd*", "john@doe.com"); // Save and commit session.save(user); session.getTransaction().commit(); But what do I do when I what to for instance select * from Users where id = '3'; My Google searches pointed to something called HQL, which makes me wonder why I couldn't of just used straight JDBC then. Also it doesn't seem very object oriented. And then there's something like session.createCriteria(....... But I'm not sure how to use this.. Any help? Thanks guys.
has answer: http://stackoverflow.com/a/24862855
has comment: http://stackoverflow.com/comment/38640614
answer count: 4
has title: How to query a database using Hibernate?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24862604
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38610838
type: Question
has comment: http://stackoverflow.com/comment/38611183
has comment: http://stackoverflow.com/comment/38643554

http://stackoverflow.com/q/24848314
score: 5
has answer: http://stackoverflow.com/a/24849600
linked to: http://stackoverflow.com/q/17157915
has title: Change background color of JTable row based on column value
answer count: 1
has comment: http://stackoverflow.com/comment/38583760
favorite count: 0
linked to: http://stackoverflow.com/q/3548986
upvote count: 5
has comment: http://stackoverflow.com/comment/38584245
has comment: http://stackoverflow.com/comment/38584833
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38584864
tagged with: swing
tagged with: tablecellrenderer
has body: hi i am new in java jtable cellrendered. I am looking for a way that works in my program but i dont have any luck finding it. Here is my Jtable Employee ID | Name | Status | Position 00565651 Roger Active Manager 00565652 Gina Active Crew 00565652 Alex Inactive Crew 00565652 Seph Active Manager the data came from ms access database but i want to change the background/foreground of the rows which has a value of "inactive" in status column. I found many examples in the internet but all of it is not possible in my program. Can someone help me? This is my model String[] columnNames = {"Employee ID","Name", "Status", "Position"}; DefaultTableModel model = new DefaultTableModel(columnNames, 0); and this is the way to create my table and how i am fetching data from database public MyList(){//my constructor frame(); loadListFromDB(); } public void frame(){// //codes for frame setsize,titles etc... tblList = new JTable(); tblList.getTableHeader().setPreferredSize(new Dimension(100, 40)); tblList.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 25)); tblList.setAutoCreateRowSorter(true); tblList.setModel(model); scrollPane.setViewportView(tblList); loadListFromDB(); } public void loadListFromDB(){ String sql = "SELECT emp_id,lname,fname,positional_status from tblEmployee"; try{ PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while (rs.next()){ Vector row = new Vector(); for (int i = 1; i &lt;= 4; i++){ row.addElement( rs.getObject(i) ); } model.addRow(row); } }catch(Exception err){ //for error code } } How am i suppose to add the tableredered in this way?Can anyone give simple example to change the color of row? Thanks in advance.. My program stop in this problem.
has comment: http://stackoverflow.com/comment/38584852
tagged with: java
type: Question
tagged with: jtable

http://stackoverflow.com/q/24774478
duplicate of: http://stackoverflow.com/q/8197250
tagged with: java
tagged with: eclipse
type: Question
has body: When I run JSF web application from Eclipse IDE, I cannot find directory(myjsfapp). I know that application will deploy at &lt;tomcat home&gt;/webapps directory. That's why, I print out the real-path from my program as below. Object context = FacesContext.getCurrentInstance().getExternalContext().getContext(); String systemPath = ((ServletContext) context).getRealPath("/"); System.out.println(systemPath); Real Path is &lt;my-workspace&gt;\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myjsfapp\ Why myjsfapp don't deploy at &lt;tomcat home&gt;/webapps? How can I do to deploy at that directory
has title: Deployment directory missing at Tomcat 7 by running from Eclipse IDE
linked to: http://stackoverflow.com/q/8197250
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24774760
has answer: http://stackoverflow.com/a/24774760
tagged with: tomcat7
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/comment/38415908
type: AnswerComment
type: Comment
has text: Yup, in the second case, the result of `nf_ant / nf` (which is an integral type) will be promoted to floating point. But by then the precision will be lost.
comment on: http://stackoverflow.com/a/24759025
score: 0

game-loop
tag name: game-loop
type: Tag
tags question: http://stackoverflow.com/q/24883018

jframe
tags question: http://stackoverflow.com/q/24850304
tags question: http://stackoverflow.com/q/24824686
tags question: http://stackoverflow.com/q/24889282
tags question: http://stackoverflow.com/q/24809436
tags question: http://stackoverflow.com/q/24895179
tags question: http://stackoverflow.com/q/24908569
tag name: jframe
tags question: http://stackoverflow.com/q/24853845
tags question: http://stackoverflow.com/q/24809434
tags question: http://stackoverflow.com/q/24797774
tags question: http://stackoverflow.com/q/24851719
tags question: http://stackoverflow.com/q/24858259
tags question: http://stackoverflow.com/q/24760176
tags question: http://stackoverflow.com/q/24847213
tags question: http://stackoverflow.com/q/24860389
tags question: http://stackoverflow.com/q/24891821
tags question: http://stackoverflow.com/q/24853317
tags question: http://stackoverflow.com/q/24754450
tags question: http://stackoverflow.com/q/24836541
tags question: http://stackoverflow.com/q/24813686
tags question: http://stackoverflow.com/q/24825841
tags question: http://stackoverflow.com/q/24799301
tags question: http://stackoverflow.com/q/24841177
tags question: http://stackoverflow.com/q/24905662
tags question: http://stackoverflow.com/q/24802461
tags question: http://stackoverflow.com/q/24888853
tags question: http://stackoverflow.com/q/24849966
tags question: http://stackoverflow.com/q/24837919
tags question: http://stackoverflow.com/q/24875059
tags question: http://stackoverflow.com/q/24791874
type: Tag
tags question: http://stackoverflow.com/q/24862878
tags question: http://stackoverflow.com/q/24836058
tags question: http://stackoverflow.com/q/24786047

http://stackoverflow.com/comment/38572493
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24842426
has text: What are you doing currently?
score: 0

http://stackoverflow.com/comment/38640243
score: 0
has text: Ok so adding the new scan=new Scanner(system.in) will allow for the questions to be asked separately? Also, why the i + 1 in the print statements? won't the i++ in the for loop handle that? Also, is this the only time you would need to use scan.close();? Thanks so much for the help too, all of you!
type: Comment
comment on: http://stackoverflow.com/a/24876638
type: AnswerComment

http://stackoverflow.com/q/24862086
has answer: http://stackoverflow.com/a/24868636
has answer: http://stackoverflow.com/a/38298214
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24868636
has answer: http://stackoverflow.com/a/49017384
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/75900196
score: 16
type: Question
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/38612654
has comment: http://stackoverflow.com/comment/38616103
upvote count: 16
has body: With the following pom dependencies: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.springframework.boot spring-boot-starter-parent 1.1.4.RELEASE test.actuator actuator-load-testing-webapp 1.0.0-SNAPSHOT <main.basedir>${basedir}/../..</main.basedir> org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-jetty org.springframework.boot spring-boot-starter-security org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin The following application.properties file located at classpath root: management.address: 127.0.0.1 management.port: 8081 endpoints.shutdown.enabled: true security.require_ssl: false shell.ssh.enabled: false spring.jmx.enabled: false And the following application main/config: @Configuration @EnableAutoConfiguration @EnableConfigurationProperties @ComponentScan public class SampleJettyApplication { public static void main(String[] args) throws Exception { SpringApplication.run(SampleJettyApplication.class, args); } } I was expecting the management facilities to be available on 127.0.0.1:8081 i.e. http://127.0.0.1:8081/health But nothing loads on the endpoint, what have I done wrong? Updated: Startup logs /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java -Dorg.eclipse.jetty.servlet.Default.dirAllowed=true -Didea.launcher.port=7538 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/j…
has answer: http://stackoverflow.com/a/65942247
favorite count: 0
has comment: http://stackoverflow.com/comment/38621793
answer count: 5
has title: Spring Boot Actuator Not Working
has comment: http://stackoverflow.com/comment/38621927
tagged with: jetty
tagged with: maven
tagged with: spring
possible better answer: http://stackoverflow.com/a/38298214

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/24751922

http://stackoverflow.com/q/24769988
tagged with: arraylist
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38436842
tagged with: collections
has comment: http://stackoverflow.com/comment/38436852
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24770031
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38436652
has comment: http://stackoverflow.com/comment/38436500
type: Question
has answer: http://stackoverflow.com/a/24770031
has title: Sorting ArrayList<CustomObject>
has body: I'm facing problem while trying to sort an ArrayList of custom object. In fact, after the sorting, nothing has change in my ArrayList. Is something wrong with my method? Here's my Artist custom object property : public class Artist { String mNickname; String mName; String mDescription; String mScene; String mDay; String mTime; String mImageURL; Date mDate; // getters and setters below like getDate() for mDate... And here's the method use to sort : static public ArrayList&lt;Artist&gt; sortArrayByDate(ArrayList&lt;Artist&gt; list) { Collections.sort(list, new Comparator&lt;Artist&gt;() { @Override public int compare(Artist lhs, Artist rhs) { if (lhs.getDate().getTime() &lt; rhs.getDate().getTime()) return -1; else if (lhs.getDate().getTime() == rhs.getDate().getTime()) return 0; else return 1; } }); return list; } I know this topic as been discuss many time on StackOverflow, but I can't find why I'm not able to make it work properly. Thanks for your understanding EDIT : Dates (java.util.date) are create using SimpleDateFormatter SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CANADA_FRENCH);
has comment: http://stackoverflow.com/comment/38436663
tagged with: sorting

http://stackoverflow.com/comment/38627842
type: QuestionComment
has text: I'm leaning toward keeping it, since other people using crawler4j could have this problem.
comment on: http://stackoverflow.com/q/24807637
type: Comment
score: 1

http://stackoverflow.com/comment/38457974
has text: Have you checked that your select element has `id="yearId"`, and used the console to confirm whether there are any javascript errors?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24781259
score: 1

http://stackoverflow.com/comment/38571333
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24841821
has text: You probably have a version of Eclipse which does not have the Java Development Tools installed.
score: 0

http://stackoverflow.com/comment/38828868
has text: Please compile/run the code I just added in and let me know what it says.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24966609
type: Comment

http://stackoverflow.com/q/24855448
tagged with: exception
tagged with: swing
has comment: http://stackoverflow.com/comment/38597800
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38597918
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24855580
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/38597925
tagged with: variables
accepted answer: http://stackoverflow.com/a/24855580
duplicate of: http://stackoverflow.com/q/218384
score: 0
has body: when I try to run this program the following error message appears: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Quiz1.<init>(Quiz1.java:21) at Opening_Screen.jButton1ActionPerformed(Opening_Screen.java:138) at Opening_Screen.access$000(Opening_Screen.java:16) at Opening_Screen$1.actionPerformed(Opening_Screen.java:57) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain…
answer count: 1
has title: Exception in thread "AWT-EventQueue-0" - Java
linked to: http://stackoverflow.com/q/19073803
has comment: http://stackoverflow.com/comment/38598053

http://stackoverflow.com/q/24840849
has comment: http://stackoverflow.com/comment/38569310
has title: SetOnClickListener cause unable to start acitivity component
tagged with: onclicklistener
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24842409
has answer: http://stackoverflow.com/a/24841010
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/24841383
answer count: 3
has comment: http://stackoverflow.com/comment/38569910
type: UnansweredQuestion
tagged with: android
has body: I currently making a application however, I'm faced unable to start the activity componentsInfo. I found a lots of solutions on the net, but none of them is works for me. I try to clean my project file and restart Eclipse, errors still occur. I try to debug with DDBS, and find a 'setOnClickListener' had something wrong. I try to edit it. But error still occur. Note: Implements view.OnClickListener didn't works for me also. public class MainActivity extends Activity{ private Button mBreakfast; private Button mLunch; private Button mDinner; private Button mSnack; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } mBreakfast = (Button) findViewById(R.id.btn_breakfast); mLunch = (Button) findViewById(R.id.btn_lunch); mDinner = (Button) findViewById(R.id.btn_dinner); mSnack = (Button) findViewById(R.id.btn_snack); mBreakfast.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(MainActivity.this,RestInfoFragment.class); startActivity(intent); } }); } }

http://stackoverflow.com/a/24866374
has body: Use ParameterAware instead of Parametrizable or get parameters directly from the action context. Map&lt;String, Object[]&gt; parameters = ActionContext.getContext().getParameters();
answers question: http://stackoverflow.com/q/24866237
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/38658592
has text: @T-Rex Absolutely not! There are cases where a base class stands fine on it's own, but you might also want to inherit from it. Continuing with the `Vehicle` example, you may have a `Boat` in your garage that has all the information you need to operate your boat. But your neighbor may have a `SkiBoat`, which might also have a method for the length of ski rope, among other things.
score: 1
comment on: http://stackoverflow.com/a/24884027
type: AnswerComment
type: Comment

swt
tags question: http://stackoverflow.com/q/24890804
tags question: http://stackoverflow.com/q/24849840
tags question: http://stackoverflow.com/q/24841539
tags question: http://stackoverflow.com/q/24765166
tags question: http://stackoverflow.com/q/24782509
tags question: http://stackoverflow.com/q/24889677
tags question: http://stackoverflow.com/q/24773965
tags question: http://stackoverflow.com/q/24882840
tags question: http://stackoverflow.com/q/24781716
type: Tag
tags question: http://stackoverflow.com/q/24842000
tags question: http://stackoverflow.com/q/24840762
tags question: http://stackoverflow.com/q/24858468
tags question: http://stackoverflow.com/q/24757422
tags question: http://stackoverflow.com/q/24830706
tags question: http://stackoverflow.com/q/24857387
tags question: http://stackoverflow.com/q/24815892
tags question: http://stackoverflow.com/q/24871181
tag name: swt
tags question: http://stackoverflow.com/q/24861995
tags question: http://stackoverflow.com/q/24849927
tags question: http://stackoverflow.com/q/24807338

http://stackoverflow.com/comment/38698408
has text: Thank you @adekock11 for providing a complete reference.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24908294
type: Comment

http://stackoverflow.com/q/24884155
upvote count: 1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24884241
has comment: http://stackoverflow.com/comment/38651788
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38651953
tagged with: java
has title: How to encapsulate multiple class in java?
type: Question
has body: I have the following scenario. public void foo() throws BadFooException, IOException{ try{ .......... } catch(ArrayIndexOutOfBoundException e) { throw new BadFooException(e); } catch(ArithmeticException e) { throw new BadFooException(e); } } Here BadFooException is a class that extends Exception. But to my desire BadFooException shall only catch ArrayIndexOutOfBoundException and ArithmeticException not the other exceptions. I am always catching those two exception and throwing my desired exception. But is there any way, so that my desired exception will be thrown automatically in case of only these two exceptions but other exceptions will be thrown separately? Thanks in advance.
has comment: http://stackoverflow.com/comment/38651818
score: 0

http://stackoverflow.com/a/45997670
has comment: http://stackoverflow.com/comment/85304869
score: 1
has body: The Java version of @viator 's answer: @Configuration class WebMvcConfigurer extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/dist/*.js").addResourceLocations( "file:src/main/typescript/dist/" ); } }
answers question: http://stackoverflow.com/q/24762657
downvote count: 0
has comment: http://stackoverflow.com/comment/85225756
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/85254096

http://stackoverflow.com/comment/38675474
has text: Entered URL with project name i.e. response.sendRedirect("/SalesPoliticalMapping/CampaignMaint?campaign=Treasury"); and it now works. Many thanks
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24889180

absolute-path
tags question: http://stackoverflow.com/q/24882515
type: Tag
tag name: absolute-path
tags question: http://stackoverflow.com/q/24828042

http://stackoverflow.com/q/24863864
has answer: http://stackoverflow.com/a/24863994
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8354168
has comment: http://stackoverflow.com/comment/38613959
tagged with: java
has answer: http://stackoverflow.com/a/24864015
type: Question
has comment: http://stackoverflow.com/comment/38614008
has answer: http://stackoverflow.com/a/24865493
tagged with: string
answer count: 6
has answer: http://stackoverflow.com/a/24866202
has answer: http://stackoverflow.com/a/24863907
favorite count: 0
has body: Is it possible to add this symbol " to a String or print to console? I'm using it for my ImageIcon! file path thanks!
score: 0
accepted answer: http://stackoverflow.com/a/24863884
duplicate of: http://stackoverflow.com/q/8354168
upvote count: 6
has comment: http://stackoverflow.com/comment/38614404
has answer: http://stackoverflow.com/a/24863884
has title: How to add symbol " to a String?
has comment: http://stackoverflow.com/comment/38613805
possible better answer: http://stackoverflow.com/a/24863907
downvote count: 6

http://stackoverflow.com/q/24804011
has comment: http://stackoverflow.com/comment/38499875
tagged with: java
has comment: http://stackoverflow.com/comment/38500072
type: Question
has comment: http://stackoverflow.com/comment/38500034
has body: I am a beginner with a weak understanding of Java. I use Dr.Java and I get this error: "S cannot be resolved" With this Java program: import java.util.Scanner; public class HDtest5 { public static int countWords(String str) { String words[] = str.split(" "); int count = words.length; return count; } public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a sentence: "); String sentence = in.nextLine(); System.out.print("Your sentence has " + countWords(sentence) + " words."); } { while (true) // have created infinite loop { if (s.equals("quit")) // if enterd value is "quit" than it comes out of loop { String[] words = s.split(" "); // get the individual words System.out.println("#words = " + words.length); for (int i = 0; i &lt; words.length; i++) System.out.println(s + "word[" + i + words[i] + " nchars = " + words[i].length()); } System.out.println(s); // to Print string System.out.println(s.length()); // to print Entered string's length } } } What causes this error message? I thought all the strings called 's' should work together without any problems. Could you please help me to find out what is wrong with it? Thank you very much for any help, its much appreciated! Ps. Just to be more clear, the purpose of my program is to output total number of characters, characters of each word and a number of words of the text entered in text window (scanner). The code should work perfectly, except this 's' string problem which makes the chunks of code not work together.
has title: ''s cannot be resolved'' How can i solve this error?
has comment: http://stackoverflow.com/comment/38500060
accepted answer: http://stackoverflow.com/a/24804210
has comment: http://stackoverflow.com/comment/38500044
has answer: http://stackoverflow.com/a/24804066
has answer: http://stackoverflow.com/a/24804062
score: 0
has answer: http://stackoverflow.com/a/24804180
has comment: http://stackoverflow.com/comment/38500619
tagged with: string
has answer: http://stackoverflow.com/a/24804210
answer count: 5
has comment: http://stackoverflow.com/comment/38499892
has comment: http://stackoverflow.com/comment/38499881
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24804062
has answer: http://stackoverflow.com/a/24804308
has comment: http://stackoverflow.com/comment/38499910

http://stackoverflow.com/comment/38695127
type: QuestionComment
comment on: http://stackoverflow.com/q/24907121
has text: So you just want to turn the T into a space, and drop everything from the + onwards?
score: 0
type: Comment

http://stackoverflow.com/comment/38416936
score: 0
type: AnswerComment
has text: @Sripremrookie Add `hibernate-validator` to your lib, here is the link: http://hibernate.org/validator/downloads/
type: Comment
comment on: http://stackoverflow.com/a/24757907

http://stackoverflow.com/a/24883523
upvote count: 2
has comment: http://stackoverflow.com/comment/38652190
accepted answer of: http://stackoverflow.com/q/24882840
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38651779
has body: Your problem is caused by the fact, that your method to determine the source and target IFigures is flawed. You store the top left corner for the lookup. That works just fine for the RectangleFigure, since that rectangle actually contains the top left corner. The Ellipse, however, doesn't (which is why the source and target of the PolylineConnection is their parent). Best illustrated with an image: If you instead store the center of the figure you'll end up with this:
answers question: http://stackoverflow.com/q/24882840

http://stackoverflow.com/q/24892748
score: 14
tagged with: jgit
has title: Check out specific revision from Git repository with JGit
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/10228760
has body: I am trying to use jGit to clone a repository and checkout a particular commit. Assuming the commit hash is: 1e9ae842ca94f326215358917c620ac407323c81. My first step is: // Cloning the repository Git.cloneRepository() .setURI(remotePath) .setDirectory(localPath) .call(); I then found another question which suggested this approach: git.checkout(). setCreateBranch(true). setName("branchName"). setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK). setStartPoint("origin/" + branchName). call(); But I'm unsure how to link the two together? Any thoughts?
has answer: http://stackoverflow.com/a/24893404
type: AnsweredQuestion
upvote count: 14
tagged with: java
accepted answer: http://stackoverflow.com/a/24893404
linked to: http://stackoverflow.com/q/24055688
type: Question

http://stackoverflow.com/a/77404075
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/24865588
type: Answer
has body: I faced the following error: Caused by: java.lang.IllegalStateException: In the composition of all global method configuration, no annotation support was actually activated at org.springframework.util.Assert.state(Assert.java:76) ~[spring-core-6.0.11.jar:6.0.11] at org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration.methodSecurityMetadataSource(GlobalMethodSecurityConfiguration.java:366) ~[spring-security-config-6.1.3.jar:6.1.3] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) ~[spring-beans-6.0.11.jar:6.0.11] ... 49 common frames omitted To fix this, I added: @EnableGlobalMethodSecurity(prePostEnabled = true)
upvote count: 0

http://stackoverflow.com/comment/38446152
score: 0
type: AnswerComment
has text: really what's the difference ??? oh yeah it really works now, can you explain it pleas
type: Comment
comment on: http://stackoverflow.com/a/24775230

http://stackoverflow.com/a/24778361
type: Answer
accepted answer of: http://stackoverflow.com/q/24777867
answers question: http://stackoverflow.com/q/24777867
score: 0
type: AcceptedAnswer
has body: package-info.java is not meant to be compilable. It is used by javadoc. See http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javadoc.html#packagecomment for more info: Package Comment Files Each package can have its own documentation comment, contained in its own "source" file, that the Javadoc tool will merge into the package summary page that it generates. You typically include in this comment any documentation that applies to the entire package. To create a package comment file, you have a choice of two files to place your comments: package-info.java - Can contain a package declaration, package annotations, package comments and Javadoc tags. This file is generally preferred over package.html. package.html - Can contain only package comments and Javadoc tags, no package annotations. A package may have a single package.html file or a single package-info.java file but not both. Place either file in the package directory in the source tree along with your .java files. package-info.java - This file can contain a package comment of the following structure -- the comment is placed before the package declaration: File: java/applet/package-info.java /** * Provides the classes necessary to create an * applet and the classes an applet uses * to communicate with its applet context. * &lt;p&gt; * The applet framework involves two entities: * the applet and the applet context. * An applet is an embeddable window (see the * {@link java.awt.Panel} class) with a few extra * methods that the applet context can use to * initialize, start, and stop the applet. * * @since 1.0 * @see java.awt */ package java.lang.applet;

http://stackoverflow.com/q/24814577
tagged with: dictionary
has answer: http://stackoverflow.com/a/67624059
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38538465
tagged with: java
has comment: http://stackoverflow.com/comment/38520985
has answer: http://stackoverflow.com/a/24814634
score: 80
has comment: http://stackoverflow.com/comment/38541484
type: Question
upvote count: 80
has comment: http://stackoverflow.com/comment/38521418
has comment: http://stackoverflow.com/comment/38551439
has body: I have two maps declared as Map&lt;String, Object&gt;. The Object here could be another Map&lt;String, Object&gt; (and so on). I want to check if two maps are exactly the same without knowing their depth. Instead of using recursion can I compare the output of the toString() called on each map? Or is there a simpler way to compare the maps?
linked to: http://stackoverflow.com/q/4082416
has comment: http://stackoverflow.com/comment/38525782
downvote count: 0
has comment: http://stackoverflow.com/comment/38522034
has comment: http://stackoverflow.com/comment/38520723
linked to: http://stackoverflow.com/q/17901933
answer count: 3
accepted answer: http://stackoverflow.com/a/24814634
has comment: http://stackoverflow.com/comment/38531297
has comment: http://stackoverflow.com/comment/38863856
has title: Comparing two maps
possible better answer: http://stackoverflow.com/a/24814631
favorite count: 0
has answer: http://stackoverflow.com/a/24814631

http://stackoverflow.com/comment/38572129
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24841623
type: AnswerComment
has text: 1, 3, 4 solved. For 2, I add "static" at beginning. Does that work?

http://stackoverflow.com/q/24852423
has title: Java - Constants and where to hold them
answer count: 4
has answer: http://stackoverflow.com/a/24852647
type: AnsweredQuestion
tagged with: constants
tagged with: libgdx
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24852516
has answer: http://stackoverflow.com/a/24852451
type: Question
has body: Ok so I've been reading up on good practices for using constants and enums but I still am confused as to what should I do. Basically I need to store strings with paths to assets like "/assets/sprites/ball.png" and then i need simple name strings like "ball" and I want them to be related to each other. Those strings will be used very often and in different files/packages all across my game's code. I have a TextureAtlas class that given the name ("ball") already provides me with the actual resource (graphics ready to draw etc). But when I need to load the resource i need to give actual path, not just name. I want to have 1 place where I will have all the constants declared and it would be nice if both the "name" constant and "path" constant were related somehow. So that I don't have to put actual path to the file whenever I want something to use that graphic, instead I want to use constant with the name String. I hope you can understand what I mean. Well, I think I could use a map, where key would be the name ("ball") and value would be path ("/assets/ball.png") but I still want to be able to just lets say, write something like this Assets.GetSprite(Assets.BALL); and get an actual resource, or even better Assets.GetSprite(BALL); So there is this problem of constants, that I need to define name and corresponding path for my graphics in 1 place and be able to use it from anywhere in the program if I need it. It all needs to be in one place so that whenever I add new resource, like new sound or new sprite to the game I won't have to look all over my program to find the place where it should be manually typed, I want to have that 1 file that I will go over and just add new constant or something like that for that 1 file. Cheers, Pablo.
downvote count: 0
has answer: http://stackoverflow.com/a/24852491
has comment: http://stackoverflow.com/comment/38591620
possible better answer: http://stackoverflow.com/a/24852451
favorite count: 0
accepted answer: http://stackoverflow.com/a/24852647

http://stackoverflow.com/q/24820389
has body: I want to convert a sqlResult mapped to a very complex Object to JSON in order to save it to a redis database a value. Now I'm a getting Error java.lang.IllegalArgumentException: class 'xx' declares multiple JSON fields named 'XX' How can I solve this problem without chaging the classes as mentioned in the error 'xx'? Or are other libs avaiable, that are supporting converting object to and from JSON with supporting of multiple JSON fields names e.g. json-io? I updated my project with the following suggestedd class class A declares multiple JSON fields in order to avoid multiple JSON fields. But now I have got a another problem nested exception is: java.lang.StackOverflowError Any suggestions for that problem? Because I am using a very large collection/object for the convertion.
has comment: http://stackoverflow.com/comment/38532338
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/16476513
favorite count: 0
has answer: http://stackoverflow.com/a/25402645
has title: GSON java.lang.IllegalArgumentException: class 'xx' declares multiple JSON fields named 'XX' AND StackOverflowError
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question

http://stackoverflow.com/a/24891059
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/38665315
answers question: http://stackoverflow.com/q/24890801
score: 2
accepted answer of: http://stackoverflow.com/q/24890801
has comment: http://stackoverflow.com/comment/38665343
has body: You should rather use ServletContext#getRealPath(...) to determine the file system path of your web application: String absolutePath = request.getServletContext().getRealPath("/images/uploaded"); // File uploaded to this directory will be accessible via // `http://&lt;yourserver&gt;/&lt;web-app&gt;/images/uploaded/` But be careful! The servlet specification does not guarantee, that getRealPath will return a path to a writable directory. And it may return null in case the virtual path cannot be translated to a real path! If you want to be sure, that the destination is a writable directory, and you just want to upload files into a temporary directory for processing, consider using the web application's private temp directory: File tempDir = (File)request.getServletContext().getAttribute(ServletContext.TEMPDIR); // Files uploaded to that directory will NOT be automatically published to WWW. Note that this directory is temporary only and may not survive a server restart! So it is not thought for durable persistance. The most sensible and durable solution is to write the file into a database, or any other repository (e.g. JCR like Jackrabbit), or into a file directory that is NOT controlled by your web server (and is specified from outside, e.g. via system property or in web.xml).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38665473

http://stackoverflow.com/comment/38646521
has text: There is nothing wrong with it, I just think that executing a simple command from console (running CLI script) is better than messing up with files on the server on editing XML manually if something goes wrong. Also you automate it more easily (like I said, one command).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24881123

http://stackoverflow.com/q/24778740
has body: Note: Please refer to the attached image for better understanding. I need to have a particular pattern of falling objects for a particular level, therefore I want to know if I should use tiled map with objects drawn or use code to create pattern for each level? Should I use Tiled map or write in code for moving object patterns Please note: Each falling object falls at fix x-axis, Only three objects falling: rectangle, circle and square. *Currently using Math.random x-axis.
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24790921
has title: Pattern of falling objects for a particular level
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: box2d
downvote count: 1
type: Question
tagged with: game-physics
score: -1
tagged with: tiled

http://stackoverflow.com/comment/38459515
has text: but in that case i think u should user invokelater i mean swingutilities because it wont let user to start any other thread before it execute current one
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24781402

http://stackoverflow.com/comment/38618408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24832784
has text: Thanks for all these responses. @CameronGregor - I have buttons trying just a partial refresh and a full refresh. I'm fairly certain I was using java.util.Date.
score: 0

http://stackoverflow.com/q/24906685
tagged with: soapui
type: UnansweredQuestion
tagged with: soap
tagged with: icmp
tagged with: web-services
has comment: http://stackoverflow.com/comment/38695466
has title: Invoking Soap service fails in java, works in soapui
has comment: http://stackoverflow.com/comment/38695555
answer count: 0
tagged with: java
type: Question
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/38694478
upvote count: 4
has body: I'm trying to consume a soap service in java. If I import the wsdl url in SOAPUI, I get the :java.net.ConnectException connection timed out exception. I saved the WSDL to a file and successfully inported it into SOAPUI. In SOAPUI, I'm able to consume it. In java however, i still get the java.net.ConnectException connection timed out exception when trying to consume it, having tried with a number of different libraries that work on other webservices in the same network. I've also tried putting my entreprise proxy in java with no effect. However, if i put a local proxy, like Fiddler, in front of java, I cat invoke the webservice successfully. The server where it's hosted has ping (ICMP) blocked. Event if I make a simple get for the WSDl address I get the java.net.ConnectException connection timed out exception. Does anyone have any suggestions on how to troubleshoot this?
has comment: http://stackoverflow.com/comment/38695412
has comment: http://stackoverflow.com/comment/38695174
has comment: http://stackoverflow.com/comment/38695786
favorite count: 0

http://stackoverflow.com/q/24904746
answer count: 1
has body: So i was wondering if there is a way to save my data into a file ,such as a txt file or excel spreedsheatform? (xml parsing?) Because i want row for date, time ,size etc.
has title: Save Data into a file in spreedsheat form
has comment: http://stackoverflow.com/comment/38691050
has answer: http://stackoverflow.com/a/24904891
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24904891
has comment: http://stackoverflow.com/comment/38690873
linked to: http://stackoverflow.com/q/8006087

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/24762397
type: Tag

groovy
tags question: http://stackoverflow.com/q/24876197
tags question: http://stackoverflow.com/q/24789362
tags question: http://stackoverflow.com/q/24757103
tags question: http://stackoverflow.com/q/24793498
type: Tag
tags question: http://stackoverflow.com/q/24858352
tags question: http://stackoverflow.com/q/24790955
tags question: http://stackoverflow.com/q/24866057
tags question: http://stackoverflow.com/q/24885385
tags question: http://stackoverflow.com/q/24889972
tags question: http://stackoverflow.com/q/24849807
tags question: http://stackoverflow.com/q/24873403
tags question: http://stackoverflow.com/q/24826062
tags question: http://stackoverflow.com/q/24906646
tags question: http://stackoverflow.com/q/24824387
tags question: http://stackoverflow.com/q/24780392
tag name: groovy

http://stackoverflow.com/comment/38555766
comment on: http://stackoverflow.com/a/24833150
type: AnswerComment
has text: I have added the DatabaseHandler class ... Please have a look at it
score: 0
type: Comment

http://stackoverflow.com/q/24892957
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/24896584
has body: A colleague has written two sessionFactory definitions in a servlet.xml file for the same class. They do not, however, qualify which one to use every time they autowire a property of that type. When they want to use the second version, they add @Qualifier, but in all other instances they just @Autowire, and it seems to use the first definition. I have tried to do the same, for another class where I have a special case, and I want it built in a different way. However, I get: NoSuchBeanDefinitionException: No unique bean ... is defined: expected single matching bean but found 2 Other people have the same problem, and the answer seems to be to be explicit everywhere (that is a lot of places in the code I am working on), for example here: Problem with Autowiring & No unique bean but am I missing something? Is there some default behaviour? Thanks edit AnnotationSessionFactoryBean is defined twice. ${hibernate.format_sql} true true true ${hibernate.cache.provider_class} ${hibernate.memcached.servers} ${hibernate.format_sql} true true ${hibernate.cache.provider_class} ${hibernate.memcached.servers} In code, sometimes this is written: @Autowired @Qualifier("sessionFactoryWritable") private SessionFactory sessionFactory; other times this: @Autowired protected SessionFactory sessionFactory; more information SessionFactory actually refers to an interface (org.hibernate.SessionFactory), but the bean definitions of course refer to an actual class. In my case I was auto-wiring a class, with no interface, and nothing actually defined in the config. Once I added an entry in the config (to define a second set up with some different properties), I got the error. related? The class I was trying to create had the following attribute: org.springframework.stereotype.Repository I am not sure why it had this, but I would like confirmation that having this is at least equivalent to writing a bean definition in the config file (the documentation does not state so as far as I can understand, …
has answer: http://stackoverflow.com/a/24929645
favorite count: 0
has comment: http://stackoverflow.com/comment/38669065
has title: Why do I get a "No unique bean is defined" in one place, but not another?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38669408
tagged with: spring
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38671773
has comment: http://stackoverflow.com/comment/38670926
has comment: http://stackoverflow.com/comment/38668754
type: Question
has answer: http://stackoverflow.com/a/24910543
linked to: http://stackoverflow.com/q/2699608

http://stackoverflow.com/q/24823321
has comment: http://stackoverflow.com/comment/38537081
downvote count: 1
accepted answer: http://stackoverflow.com/a/24825076
has answer: http://stackoverflow.com/a/24824494
linked to: http://stackoverflow.com/q/8511063
has comment: http://stackoverflow.com/comment/38539217
tagged with: java
has comment: http://stackoverflow.com/comment/38537086
possible better answer: http://stackoverflow.com/a/24824494
tagged with: eclipse
has title: Launch executable jar file
has comment: http://stackoverflow.com/comment/38536442
has comment: http://stackoverflow.com/comment/38536547
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38538760
score: 1
has comment: http://stackoverflow.com/comment/38539907
has answer: http://stackoverflow.com/a/24825076
type: Question
has comment: http://stackoverflow.com/comment/38539091
has comment: http://stackoverflow.com/comment/38537802
favorite count: 0
has comment: http://stackoverflow.com/comment/38538766
has comment: http://stackoverflow.com/comment/38539244
upvote count: 2
has body: I have a problem with an executable jar file. When I launch my jar file with Windows command line, all is good : java -jar updater.jar When I double click on my jar file, nothing happens. This problem appeared when I added graphic support to my application (org.eclipse.jface and org.eclipse.swt). My MANIFEST.MF : Main-Class: Updater Class-Path: libs/ Thank you in advance
answer count: 2

http://stackoverflow.com/comment/38670150
type: Comment
comment on: http://stackoverflow.com/a/24770205
score: 0
type: AnswerComment
has text: I ended up doing something very similar to what you said.

http://stackoverflow.com/q/24845875
type: Question
answer count: 2
has title: Cannot start settings from action bar
score: 0
possible better answer: http://stackoverflow.com/a/24846094
has body: Starting to learn about creating the settings page, but my app crashes when I select 'settings' from the action bar, and I get this error in logcat: Caused by: java.lang.ClassCastException: com.myexamlpe.thing.Preference cannot be cast to android.app.Activity Here's how I call it from my main class: public class RCs extends FragmentActivity implements rcfrequency.ToolbarListener, RCButtons.ToolbarListener { . . . @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_settings: Intent myIntent = new Intent(this, Preference.class); startActivity(myIntent); return true; default: return super.onOptionsItemSelected(item); } } Here's my Preference class: public class Preference extends PreferenceFragment implements OnSharedPreferenceChangeListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); }
accepted answer: http://stackoverflow.com/a/24845949
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24845949
tagged with: java
has answer: http://stackoverflow.com/a/24846094

http://stackoverflow.com/q/24754096
type: Question
has title: Java resolve dns via proxy when using custom ProxySelector
score: 5
downvote count: 0
tagged with: proxy
answer count: 1
accepted answer: http://stackoverflow.com/a/25197524
has body: I'm in need to develop a java library which allows a traffic to be directed via proxy only for specified hosts. The library is almost ready and working, but there is problem with resolving dns addresses via proxy. In short words I extended CustomProxySelector class which has following logic: public class CustomProxySelector extends ProxySelector { public List&lt;Proxy&gt; select(URI uri) { if (customProxyDefinedFor(uri)) { return getCustomProxyFor(uri); } else { // use direct connection } } } All works fine if local dns can resolve host given as "uri" parameter (for example if I want stackoverflow.com to go via proxy it will work because my local dns can resolve stackoverflow.com). The problem comes when there is a host which is not known to my local dns. For example the dns behind proxy knows how to resolve address like "host1.private.dmz" because this is special host only known behind proxy (the proxy acts really as reverse proxy here). JVM seems to first try to resolve "host1.private.dmz" to ip, and when it fails it ends with folowing stacktrace: Caused by: java.net.UnknownHostException: host1.private.dmz at java.net.InetAddress.getAllByName0(InetAddress.java:1259) at java.net.InetAddress.getAllByName(InetAddress.java:1171) at java.net.InetAddress.getAllByName(InetAddress.java:1105) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:247) (...) Because it fails to resolve the ip, my Custom ProxySelector is never used. Is there any option to force java not to resolve ip via localdns but via proxy? If I give the ip address of host1.private.dmz (for example 10.100.12.13) all works ok. The communication is directed to my Custom Proxy Selector and the traffic goes via custom proxy without problem.
favorite count: 0
has answer: http://stackoverflow.com/a/25197524
tagged with: dns
type: AnsweredQuestion
upvote count: 5
tagged with: java

http://stackoverflow.com/a/24895132
downvote count: 0
has body: It doesn't have to be compressed, but saving them uncompressed is a very, very bad practice unless you have a specific reason not to. The one advantage of Bitmaps - and the reason Android apps use them - is that they are completely uncompressed, essentially just an bunch of bits describing an image. Now, this means the format is incredibly simple and fast to decode, which is what makes them great for anything UI-oriented, including Android apps. If you were drawing, say, a PNG or a JPEG instead of a Bitmap, your app would be much slower. However, this simplicity and complete lack of compression also makes it by far the biggest image format in terms of storage space used. Simply passing your Bitmap through even the least intrusive JPEG or PNG compressor will reduce the size by multiple orders of magnitude, at the cost of basically no quality (JPEG) or absolutely no loss of quality (PNG). This makes it pretty easy to understand why everyone does it, even if they don't have to. :)
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24894830

http://stackoverflow.com/q/24780016
tagged with: spring
tagged with: regex
linked to: http://stackoverflow.com/q/1842681
has title: Remove request parameter from query string
has comment: http://stackoverflow.com/comment/38454705
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38454723
tagged with: java
has answer: http://stackoverflow.com/a/24780153
type: Question
has answer: http://stackoverflow.com/a/24780150
accepted answer: http://stackoverflow.com/a/24780150
has body: I have a query string that could be: /fr/hello?language=en or /fr/welcome?param1=222&amp;param2=aloa&amp;language=en or /it/welcome?param1=222&amp;language=en&amp;param2=aa I would like to remove from each query string the parameter language with its value, therefore the results would be: /fr/hello and /fr/welcome?param1=222&amp;param2=aloa and /it/welcome?param1=222&amp;param2=aa EDIT: The length of the value of the parameter could be more than 2 Does anybody know any good regex expression to use in String.replaceAll([regex],[replace]) ?
has answer: http://stackoverflow.com/a/67677238
has answer: http://stackoverflow.com/a/24780219
answer count: 6
has answer: http://stackoverflow.com/a/24780078
upvote count: 1
tagged with: string
possible better answer: http://stackoverflow.com/a/24780153
favorite count: 0
has answer: http://stackoverflow.com/a/46279382

http://stackoverflow.com/q/24885738
score: 0
has body: I have a checklist of items, represented as a Java class. E.g. public class CheckList { private boolean firstItem; private boolean secondItem; private boolean thirdItem; public boolean isFirstItem() { return firstItem; } public void setFirstItem(boolean firstItem) { this.firstItem = firstItem; } public boolean isSecondItem() { return secondItem; } public void setSecondItem(boolean secondItem) { this.secondItem = secondItem; } public boolean isThirdItem() { return thirdItem; } public void setThirdItem(boolean thirdItem) { this.thirdItem = thirdItem; } } Now I want to "calculate" a score (percentage) of how many items in a checklist are checked. My naïve way of doing that would be the following method. private static final int NR_OF_ITEMS = 3; public double getScore() { double score = 0; if (firstItem) { score += 1; } if (secondItem) { score += 1; } if (thirdItem) { score += 1; } return score / NR_OF_ITEMS; } This is however somehow unpractical and seems to be weird (especially if the checklist gets longer). Another approach could be to have a list of items which could be iterated over but this does mean cannot limit the items that easily and it also has it flaws. What could be a good solution to represent a checklist with Java? Thank you for your ideas.
answer count: 1
has comment: http://stackoverflow.com/comment/38654744
tagged with: architecture
has comment: http://stackoverflow.com/comment/38654688
type: AnsweredQuestion
tagged with: oop
accepted answer: http://stackoverflow.com/a/24885834
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24885834
has title: Represent a checklist with a score with a Java class

http://stackoverflow.com/comment/38558734
type: AnswerComment
type: Comment
score: 0
has text: pls see the edit. I'm also using `lp3.addRule(RelativeLayout.ALIGN_RIGHT);` but there's no difference.
comment on: http://stackoverflow.com/a/24834890

http://stackoverflow.com/q/24843008
favorite count: 0
has comment: http://stackoverflow.com/comment/38573722
has comment: http://stackoverflow.com/comment/38573523
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38575748
type: Question
has comment: http://stackoverflow.com/comment/38574332
has comment: http://stackoverflow.com/comment/38573823
has title: Project Euler Program 5 takes too much time in Java
score: 3
has comment: http://stackoverflow.com/comment/38573757
tagged with: java
has comment: http://stackoverflow.com/comment/38574144
has answer: http://stackoverflow.com/a/24843543
has body: The question is: What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? I write the following program which gives the correct output, but it took very long to execute. What can I do to fasten my program? public class ep5 { public static void main(String[] args) { int n=100,k=0; boolean check=true; while(check) { k=0; n++; for (int i=2;i&lt;21;i++) if(n%i!=0) k=1; if (k!=1) check=false; } System.out.println(n); } }
answer count: 2
has answer: http://stackoverflow.com/a/24843062
downvote count: 0

http://stackoverflow.com/comment/38640625
has text: There are several and you should do some research, [Apache POI](http://poi.apache.org/) is probably one of the better open source, but there are others, like JExcelAPI
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24877885
type: Comment

http://stackoverflow.com/comment/38617311
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24865759
has text: We need more details in order to help. What graphics library are you using?
type: Comment

http://stackoverflow.com/a/24839664
type: Answer
answers question: http://stackoverflow.com/q/24839332
has body: I need to pass the SelectedImageUri to another activity as bundle => FYI, Uri class itself implement Parcelable, so you can add and get value into/from Intent directly. // Add a Uri instance to an Intent intent.putExtra("SelectedImageUri", SelectedImageUri); // Get a Uri from an Intent Uri uri = intent.getParcelableExtra("SelectedImageUri");
score: 0

http://stackoverflow.com/comment/38559905
has text: nice feature but if user enter more than 5 for example, it does not show any error to him or her?
type: AnswerComment
comment on: http://stackoverflow.com/a/24835506
type: Comment
score: 0

http://stackoverflow.com/a/24751158
score: 0
answers question: http://stackoverflow.com/q/24751032
type: Answer
has body: Eclipse includes its own compiler and doesn't depend on the JDK compiler. But indeed, the JRE is just the runtime environment and doesn't include the compiler or other development tools.

http://stackoverflow.com/a/24909027
type: Answer
has body: Not only your CREATE TABLE is wrong, as correctly pointed out by others (a reversed bracket and a missing space): db.execSQL("CREATE TABLE" + TABLE_CARS + ")" + KEY_ID + "INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_ADDRESS + " TEXT,"+ KEY_POSTCODE + " TEXT," + KEY_IMAGE + " TEXT)"); should be db.execSQL("CREATE TABLE " + TABLE_CARS + "(" + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_ADDRESS + " TEXT,"+ KEY_POSTCODE + " TEXT," + KEY_IMAGE + " TEXT)"); You have another issue here (missing a space): Cursor cursor = db.rawQuery("SELECT * FROM" + TABLE_CARS, null); should be Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_CARS, null);
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24908797
upvote count: 1

http://stackoverflow.com/q/24751087
tagged with: jdbc-odbc
has comment: http://stackoverflow.com/comment/38404589
tagged with: odbc
has title: Error in loading MS Access drivers for Java application
score: 0
has body: I have created a Swing application for company which connects to an Access database locally stored in the computer. The application works just fine in my computer and some other local computers, but when I was asked to deploy it on server I got this exception: java.sql.SQLException : Specified driver could not be loaded due to system error 193: (Microsoft Access Driver (*.mdb, *.accdb), C:\PROGRA^2\COMMON^1\MICROS^1\OFFICE12\ACEODBC.DLL How can I get around this error?
tagged with: ms-access
has comment: http://stackoverflow.com/comment/38404647
answer count: 0
type: UnansweredQuestion
tagged with: jdbc
linked to: http://stackoverflow.com/q/7662478
has comment: http://stackoverflow.com/comment/38404631
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38402233

http://stackoverflow.com/comment/38444399
type: AnswerComment
has text: Ok. Thanks to you all.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24774249

http://stackoverflow.com/a/24764838
answers question: http://stackoverflow.com/q/24764817
score: 0
has comment: http://stackoverflow.com/comment/38426316
type: Answer
has comment: http://stackoverflow.com/comment/38428467
has comment: http://stackoverflow.com/comment/38426361
has comment: http://stackoverflow.com/comment/38426415
has body: You should first call ResultSet#next before attempting to retrieve any data: ResultSet rs = jdbcStmt.executeQuery(jdbcSelect); if (rs.next()) { //just an example String foo = rs.getString(1); }
has comment: http://stackoverflow.com/comment/38468215
has comment: http://stackoverflow.com/comment/38426260
has comment: http://stackoverflow.com/comment/38467455

http://stackoverflow.com/a/24903520
type: Answer
has comment: http://stackoverflow.com/comment/38716860
answers question: http://stackoverflow.com/q/24903430
has comment: http://stackoverflow.com/comment/38695684
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24903430
has body: Yes, it is possible. It should look something like String sql = "insert into tbl1(id,catagory) values(?, ?)"; PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, a); ps.setString(2, b); ps.executeUpdate(); If you must use Statement you should probably use something like StringEscapeUtils because otherwise you might be vulnerable to SQL Injection, String sql="insert into tbl1(id,catagory) values('" + a + "','" + b + "')"; st.executeUpdate(sql);
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/a/24793399
has comment: http://stackoverflow.com/comment/38481321
has comment: http://stackoverflow.com/comment/38480800
has comment: http://stackoverflow.com/comment/38481265
answers question: http://stackoverflow.com/q/24793357
type: Answer
has comment: http://stackoverflow.com/comment/38481105
has body: While adding element to the list mention position of the element. Only this can order the list in proper order. Format: list.add(position, item); Example. collegeLists.add(1, michigan);
has comment: http://stackoverflow.com/comment/38480927
has comment: http://stackoverflow.com/comment/38481092
has comment: http://stackoverflow.com/comment/38481026
has comment: http://stackoverflow.com/comment/38480986
score: 0
has comment: http://stackoverflow.com/comment/38481120
has comment: http://stackoverflow.com/comment/38480816

http://stackoverflow.com/q/24817594
has comment: http://stackoverflow.com/comment/38526809
has comment: http://stackoverflow.com/comment/38526694
has comment: http://stackoverflow.com/comment/38526338
has comment: http://stackoverflow.com/comment/38526683
has body: I am trying to get image from database and i am able to get image , now i wanted to display that image to jsp page . I am using hibernate and struts. I have action class and one hibernate persistent class(POJO). Action class is SportsAction package action; @Result(location="sports-success.jsp") public class SportsAction extends ActionSupport{ public List<SportsSetterAndGetter> l; public List<SportsSetterAndGetter> getL() { return l; } public void setL(List<SportsSetterAndGetter> l) { this.l = l; } private byte[] pic; public byte[] getPic() { return pic; } public void setPic(byte[] pic) { this.pic = pic; } @Action(value="sports") @Override public String execute() throws Exception { Session session= new AnnotationConfiguration().configure().buildSessionFactory().openSession(); Transaction t= session.beginTransaction(); l=session.createCriteria(SportsSetterAndGetter.class).list(); Iterator itr1=l.iterator(); SportsSetterAndGetter s=new SportsSetterAndGetter(); while (itr1.hasNext()) { s=(SportsSetterAndGetter)itr1.next(); System.out.println("values are"+s.getSid()); System.out.println(s.getName()); System.out.println(s.getRate()); System.out.println(s.getStatus()); System.out.println(s.getStype()); pic=s.getImage(); } return "success"; } } In Jsp page <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="/struts-tags" prefix="s" %> Insert title here <s:iterator value="l"> <s:property value="sid" /> <s:property value="name" /> <s:property value="rate" /> <s:property value="status" /> <s:property value="stype" /> <img src="<s:property value="image" />" /> </s:iterator> I am getting this values from database but I am Unable to get image . What should I write to get image .
tagged with: java
tagged with: hibernate
type: Question
tagged with: struts2
score: 0
linked to: http://stackoverflow.com/q/10054958
answer count: 1
tagged with: jsp
has title: Unable to show image in jsp from database using hibernate and struts
has answer: http://stackoverflow.com/a/24825428
has comment: http://stackoverflow.com/comment/38526552
type: UnansweredQuestion

http://stackoverflow.com/q/24756863
upvote count: 0
has body: I have a query around handling errors with File Endpoints I have a scenario where I need to pull a file from an Endpoint, do some processing and then put the result of that processing onto a queue. If the processing throws an error, I want the original to be placed into a configurable error directory. If the processing succeeds, then I want the result to be placed onto a queue. If this fails then I want the original file to be placed in a different directory. Is this even possible? ... My onException seems to be ignoring the file endpoint I have configured for it to be sent to
tagged with: apache-camel
answer count: 1
has comment: http://stackoverflow.com/comment/38411358
favorite count: 0
type: UnansweredQuestion
score: -3
has title: Apache Camel Error Handling With File Endpoints
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24778232
type: Question

http://stackoverflow.com/a/24890258
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24770961
has body: We do this in our project by using a assembly.xml with the maven-assembly-plugin. In the POM we have: org.apache.maven.plugins maven-assembly-plugin 2.4 src/main/resources/assembly.xml package-jar-with-dependencies package single jar-with-dependencies Then there is a assembly.xml in src/main/resources which tells how to build that assembly: bin jar true true
type: Answer
score: 2

http://stackoverflow.com/a/24878763
downvote count: 0
upvote count: 4
answers question: http://stackoverflow.com/q/24878513
score: 4
has body: replace a-zA-Z in regex string with \p{L} (any kind of letter from any language) while (input.hasNext()){ String phrase = input.nextLine(); String[] words = phrase.split(" "); for(String word: words){ String strippedInput = word.replaceAll("[^0-9\\p{L}\\s]", ""); } }
type: Answer

http://stackoverflow.com/comment/38441337
comment on: http://stackoverflow.com/q/24772789
has text: Won't it be better to commit after less than 1tr rows,say 1000, 5000 ? You don't want to lose time and effort due to lost connections and such, right ? I am assuming that those tr rows are not considered as a single transaction per business rules.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/38433317
score: 0
has text: The code you've posted does not produce the error you're talking about. What do you mean by "it works incorrect"? What *does* it do, and what did you *expect* it to do?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24767786

http://stackoverflow.com/comment/38601295
type: AnswerComment
has text: Yep I know Swing should be used, but as the OP had imported `awt` so I used applets
score: 0
comment on: http://stackoverflow.com/a/24857277
type: Comment

http://stackoverflow.com/comment/38485732
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24791320
has text: Wrapping is controled by an implementation of the `SplitCharacter` interface. As far as I know, there is a `DefaultSplitCharacter` class that takes into account Chinese characters in iText since iText 5. Which version of iText are you using? If the `DefaultSplitCharacter` doesn't work for your text, you can always provide your own `SplitCharacter` implementation.
type: Comment

http://stackoverflow.com/comment/38452314
score: 0
comment on: http://stackoverflow.com/q/24778827
type: Comment
has text: The JDBC version you use depends on the Java version. If you are talking about the Connector/J version: the latest, of course.
type: QuestionComment

http://stackoverflow.com/comment/112534714
has text: Even though this setting solved the issue, there is a slight misconception, let me clarify that. MetaspaceSize does not increase the Metaspace size, what it does is "telling" the JVM the Metaspace size threshold after which a full GC is triggered.
comment on: http://stackoverflow.com/a/24848524
type: AnswerComment
type: Comment
score: 3

http://stackoverflow.com/a/24753699
answers question: http://stackoverflow.com/q/24753219
score: 0
type: Answer
has body: NO need of for loop if you not getting array if you are getting jsonarray fist take out object of json form jsonarray and thane parse it you can also use gson for that using gson create pojo of your object and then Gson gson = new Gson(); use method fromJson

http://stackoverflow.com/comment/38432825
score: 0
comment on: http://stackoverflow.com/q/24766605
type: Comment
type: QuestionComment
has text: You probably meant `split("\\.")`. The regular expression "." refers to any character, so you will not be splitting the file name into period-delimited parts as you seem to expect.

http://stackoverflow.com/comment/38542796
comment on: http://stackoverflow.com/q/24810153
score: 0
has text: @DonRoby The class can be changed, its published methods cannot. I've kept the code fairly abstract to keep the focus on the technical problem, without semantical distraction and also for brevity. You could imagine the first delegated method to result in a key that in the second delegated method needs to be used to get a value from a Map for instance.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24864424
has comment: http://stackoverflow.com/comment/38618399
has body: I have a xml file with table of content. The problem is, that it contains not escaped quotes. How can I load the file and repair this quotes? &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?NLS TYPE="org.eclipse.help.toc"?&gt; &lt;topic label="Main Topic" href="0.2.1.html#0.2.5"&gt; &lt;topic label="Topic "Sales"" href="0.2.1.html#2.12.3.6"/&gt; &lt;/topic&gt; I know that in the standard stays: In the content of elements, character data is any string of characters which does not contain the start-delimiter of any markup The source doesn't escape the quotes and I cannot change the source. How can I repair the xml file locally?
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38627077
has comment: http://stackoverflow.com/comment/38620900
has comment: http://stackoverflow.com/comment/38614596
tagged with: tableofcontents
tagged with: java
has comment: http://stackoverflow.com/comment/38614739
has comment: http://stackoverflow.com/comment/38616280
has title: Load xml file with not escaped quotes
has answer: http://stackoverflow.com/a/24867630
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38626487
has comment: http://stackoverflow.com/comment/38615124
has comment: http://stackoverflow.com/comment/38615271
score: 0
has comment: http://stackoverflow.com/comment/38626153
has comment: http://stackoverflow.com/comment/38614791
answer count: 1
accepted answer: http://stackoverflow.com/a/24867630
tagged with: parsing

http://stackoverflow.com/comment/38691530
has text: @MikeM. yeah, but if i move it to own class i can't get data from that class
comment on: http://stackoverflow.com/q/24903894
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24810686
tagged with: android
has comment: http://stackoverflow.com/comment/38514374
has comment: http://stackoverflow.com/comment/38514976
has comment: http://stackoverflow.com/comment/38514944
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38515252
has comment: http://stackoverflow.com/comment/38514810
has comment: http://stackoverflow.com/comment/38514529
score: 0
has comment: http://stackoverflow.com/comment/38514252
has comment: http://stackoverflow.com/comment/38514506
has title: ClassLoader.getSystemResourceAsStream giving null exception
answer count: 1
has comment: http://stackoverflow.com/comment/38512911
has comment: http://stackoverflow.com/comment/48440074
has comment: http://stackoverflow.com/comment/38514647
has answer: http://stackoverflow.com/a/30161539
has body: So I have this: parser.parse(ClassLoader.getSystemResourceAsStream("/XML64_Decoded/res/sample.xml"), handler); and I am getting this error: Exception in thread "main" java.lang.IllegalArgumentException: InputStream cannot be null at javax.xml.parsers.SAXParser.parse(Unknown Source) at vms.main(vms.java:26)

http://stackoverflow.com/comment/38465675
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24780101
has text: It would be easier to go to the Project Structure dialog, choose your module from the list, go to the Dependencies tab, click the + button, choose "Library", and add a dependency on the v4 support library from the list that appears. Then you don't have to go mucking around in Gradle files, and there's no possibility that you will make edits in the wrong one (there's more than one build.gradle file in your project).

http://stackoverflow.com/a/36782136
has body: You should add these parameters to java virtual machine: System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); System.setProperty("javax.net.ssl.trustStoreType", "JKS"); System.setProperty("javax.net.ssl.trustStore", "../path/yourtruststore.jks"); System.setProperty("javax.net.ssl.trustStorePassword", "yourpasswordfortruststore"); If you need Mutual Authentication: System.setProperty("javax.net.ssl.keyStore","../path../yourkeystore.jks"); System.setProperty("javax.net.ssl.keyStorePassword","yourpasswordforkeystore"); System.setProperty("javax.net.ssl.keyStoreType", "JKS");
type: Answer
answers question: http://stackoverflow.com/q/24856560
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/38648436
type: AnswerComment
type: Comment
has text: I have never had to create a `RangeChangeHandler` directly - I have always used `AbstractDataProvider#addDataDisplay(HasData<T> display)` to bind the pager to the data provider. This in turn creates and adds a `RangeChangeHandler` and calls `onRangeChanged()` to handle the initial case.
comment on: http://stackoverflow.com/a/24861561
score: 0

http://stackoverflow.com/q/24759463
has comment: http://stackoverflow.com/comment/38418852
has comment: http://stackoverflow.com/comment/38416740
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38416543
has comment: http://stackoverflow.com/comment/38417429
tagged with: libgdx
tagged with: math
tagged with: java
has body: I need to have a sprite face the cursor/touch point. The vector of the touch point is calculated as follows: game.getCamera().unproject( new Vector3().set(Gdx.input.getX(), Gdx.input.getY(), 0) , 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()) And then I calculate the degrees the sprite needs to turn with the following method: public void rotateTo(Vector3 vector) { double angle = Math.atan2(vector.y - position.y, vector.x - position.x); rotation = (float) Math.toDegrees(angle) - 90; sprite.setRotation(rotation); } The problem is that there is a small offset in some rotations for example(The red dot indicates the touch position and the arrow is the sprite that needs to be rotated), in the first picture its roughly where it should be but in the others its way off, what could be causing this bug?: As you can see in the first 2 pictures with a small change in the X axis the accuracy decreases dramatically. More examples:
score: 4
type: Question
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38417945
tagged with: android
has title: Small offset when calculating rotation based on touch point
accepted answer: http://stackoverflow.com/a/24761474
upvote count: 4
has comment: http://stackoverflow.com/comment/38416461
has comment: http://stackoverflow.com/comment/38417152
downvote count: 0
has comment: http://stackoverflow.com/comment/38417886
has comment: http://stackoverflow.com/comment/38420046
has answer: http://stackoverflow.com/a/24761474

http://stackoverflow.com/q/24750871
tagged with: web-services
type: Question
has body: I have created a .NET WCF service described by a hand-written platform-agnostic WSDL file. The service is secured by an STS and this is expressed in the WSDL by an EndorsingSupportingTokens security policy element. I need to create a Java example client (preferably in NetBeans) for my service and it's a lot harder than I expected. I've just tried working through the entire section 12.9.7 "STS Issued Token" of https://metro.java.net/2.3/guide/user-guide.pdf in hopes that I could get this working in a pure Java environment and then incrementally change it to work with my situation, but it doesn't work for me. I find that by fiddling with various settings I can get a variety of different error messages, but it never quite works. So I can work out for sure that this is supported, is there any example of the following in NetBeans+Metro that I can just download and use? I've followed a number of step-by-step guides but something always goes wrong^. Client authenticates with STS using an X509 certificate STS sends client an encrypted SAML Assertion Client sends request to Service, with SAML Assertion in headers ^ I'm happy to get a tentative "No" answer, so I can begin the process of raising specific questions about all the things that have gone wrong.
tagged with: java
upvote count: 2
has title: STS-Secured Service EndorsingSupportingTokens support in java/metro
tagged with: java-metro-framework
favorite count: 0
tagged with: netbeans-8
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: glassfish-4

http://stackoverflow.com/a/45514016
type: Answer
answers question: http://stackoverflow.com/q/24908251
has body: if we suppose that el is your element then: from lxml import etree el.text = etree.CDATA('a string') ref: http://lxml.de/api/lxml.etree.CDATA-class.html
score: 0

http://stackoverflow.com/comment/38524375
comment on: http://stackoverflow.com/q/24816253
score: 1
has text: you cannot do this in a single classloader. you _can_ load 2 different versions of the same library in _separate_ classloaders, but you would have to do a lot of tricky things to make it work. i would try to figure out how to make things work with _one_ version of the library.
type: Comment
type: QuestionComment

easymock
tags question: http://stackoverflow.com/q/24819337
tags question: http://stackoverflow.com/q/24751611
tags question: http://stackoverflow.com/q/24864177
tags question: http://stackoverflow.com/q/24773592
tag name: easymock
tags question: http://stackoverflow.com/q/24757899
tags question: http://stackoverflow.com/q/24808346
type: Tag
tags question: http://stackoverflow.com/q/24790562

http://stackoverflow.com/comment/38704860
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24902687
has text: I tried what you recommended (using 8.0.3 does that matter) and I get a `Provider com.sun.el.ExpressionFactoryImpl not found`

http://stackoverflow.com/comment/38662955
score: 5
comment on: http://stackoverflow.com/a/24889561
type: AnswerComment
has text: Nope. As the forum entry says, there is no way to search 'a portion of' multiple categories. So either create an additional view, or use viewnavigator and scan all subcategories on a loop.
type: Comment

http://stackoverflow.com/q/24819037
has comment: http://stackoverflow.com/comment/38528601
has body: I'm not sure why I am getting this output. when I try to print a hand of cards for my poker program. I know there are lots of things I could use to make this more efficient like enums. but this is for a class so I am limited on what I can use. I have never worked with the Collections.Shuffle in my Deck class, so I'm not sure that I did it right. Same with the override in my card class. Any suggestions on how to get this program to print out 5 cards? Card: public class Card { String suits; String values; public Card(int suit, int value) { if (suit == 0) { suits = "Spades"; } else if (suit == 1) { suits = "Clubs"; } else if (suit == 2) { suits = "Hearts"; } else { suits = "Diamonds"; } if (value == 0) { values = "2"; } else if (value == 1) { values = "3"; } else if (value == 2) { values = "4"; } else if (value == 3) { values = "5"; } else if (value == 4) { values = "6"; } else if (value == 5) { values = "7"; } else if (value == 6) { values = "8"; } else if (value == 7) { values = "9"; } else if (value == 8) { values = "10"; } else if (value == 9) { values = "Jack"; } else if (value == 10) { values = "Queen"; } else if (value == 11) { values = "King"; } else { values = "Ace"; } } @Override public String toString() { return values + " of " + suits; } } Deck: import java.util.Arrays; import java.util.Collections; public class Deck { Card[] deck = new Card[52]; public Deck() { int element; for(int iSuit = 0; iSuit &lt; 4; iSuit++) { for(int iValue = 0; iValue &lt; 13; iValue++) { element = iSuit * 13 + iValue; deck[element] = new Card(iSuit, iValue); } } } public void shuffle() { Card[] newDeck = new Card[52]; int element = (int) (Math.random()*52); Collections.shuffle(Arrays.asList(deck[element])); public Card dealCard(int card) { return deck[card]; } } Hand: public class Hand { Card[] hand = new Card[5]; public Hand(Deck deck) { int element; for(int card = 0; card &lt; 4; card++) { hand[card]=deck.dealCard(card); } } } Main: public class FiveCardPoker { public static vo…
tagged with: arrays
tagged with: poker
has answer: http://stackoverflow.com/a/24819135
has answer: http://stackoverflow.com/a/24819104
has comment: http://stackoverflow.com/comment/38528513
has answer: http://stackoverflow.com/a/24819184
score: 0
accepted answer: http://stackoverflow.com/a/24819104
possible better answer: http://stackoverflow.com/a/24819094
answer count: 5
linked to: http://stackoverflow.com/q/13498179
has answer: http://stackoverflow.com/a/24819094
has comment: http://stackoverflow.com/comment/38528493
has title: Why do I get this strange output Hand@2802cf63?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24819073
type: Question
duplicate of: http://stackoverflow.com/q/13498179

http://stackoverflow.com/comment/38538703
comment on: http://stackoverflow.com/a/24824156
type: Comment
has text: If there are 31 days in the month, then there are 4 mondays unless the first day of the month was a monday, tuesday or wednesday.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24844108
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/24844135
accepted answer: http://stackoverflow.com/a/24844135
score: 0
has body: i got the following Code, which is a shortened Version of the actual problem i have: import javax.swing.*; import java.awt.*; public class Circle { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub JFrame frame = new JFrame(); Painter panel = new Painter(); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(panel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } import javax.swing.*; import java.awt.*; public class Painter extends JPanel{ /** * */ private static final long serialVersionUID = 5663520834139683160L; /** * @param args */ Painter() { } public void drawPlayer(Graphics g) { g.setColor(Color.GREEN); g.fillOval(0, 0, 200, 30); //g.setColor(Color.GREEN); //g.drawRect(0, 0, 80, 50); //g.setColor(Color.BLUE); //g.fillRect(0, 0, 80/2, 50/2); //g.setColor(Color.BLACK); //g.drawString("BOB", 10/2+10, 5/2); } @Override public void printComponent(Graphics g) { super.paintComponent(g); this.drawPlayer(g); } } When I execute it, the JPanel doesnt show up and I just can't find the mistake. Don't know if this is important, but in the actual problem I initialize the JFrame with its JPanels in the constructor but it doesnt work either. If necessary I can post the original code. The actual task is to provide a GUI for a ConnectFour game where the Frame is divided up into a JPanel drawing the discs and another JPanel providing player information like name etc. . The first part is working fine but the last part just won't work. (Don't get confuse by this code i posted drawing a circle. I wanted to post the structure of the solution i'm considering for the players information Panel.)
answer count: 1
has title: Why does the JPanel not display on the Frame?

http://stackoverflow.com/comment/38536745
type: QuestionComment
comment on: http://stackoverflow.com/q/24823420
score: 0
type: Comment
has text: a char is a primitive type and a Character is an object, see http://stackoverflow.com/questions/8790809/whats-the-difference-between-primitive-and-reference-types

http://stackoverflow.com/comment/38566070
has text: @GreenFox that is just a texture, it doesn't have 9 patch in it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24838883

http://stackoverflow.com/comment/38520891
comment on: http://stackoverflow.com/q/24814747
type: Comment
type: QuestionComment
has text: Please be more specific. What have you tried and it's not working?
score: 1

http://stackoverflow.com/q/24839193
tagged with: swing
has answer: http://stackoverflow.com/a/24841246
tagged with: line
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24841246
type: Question
score: 0
answer count: 1
tagged with: applet
has body: I would like to insert one line between "total charges"and "Thank you..." Here is the code I have made so far: JOptionPane.showMessageDialog(null, "Total Charges : RM" + dollar.format(totalCharges) + "Thank you please come again"); How can I do this? Thank You
has title: How to insert one line in Applet?
tagged with: joptionpane

http://stackoverflow.com/comment/46048140
score: 0
type: AnswerComment
has text: This works. Thanks. Can you provide a link which explains the algorithm of this ? Or it has a name ?
type: Comment
comment on: http://stackoverflow.com/a/24772207

http://stackoverflow.com/comment/38580041
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24817563
has text: I added this in my explanation. I did it using strings instead.
type: AnswerComment

http://stackoverflow.com/q/24823073
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24823276
score: 1
tagged with: java
has title: tagsoup breaks good xml
has body: Cleaning an xml file I have obtained unexpected results: tagsoup has orphaned some properties closing the parent tag too soon. It also downcases the parent tag's name. Before tagsoup: &lt;Objects&gt; &lt;Object&gt; &lt;ObjectID&gt;240&lt;/ObjectID&gt; [...] &lt;Status&gt;Not Ready&lt;/Status&gt; &lt;Title&gt;Some description which includes word/word, 22,000&lt;/Title&gt; &lt;Url&gt;http://example.com/withquerystring?id=240&amp;amp;other=1&amp;amp;url=http%3A%2F%2Fredirected.example.com%2F40&lt;/Url&gt; [...] &lt;Owner&gt; &lt;Name&gt;JOHN MARSHALL, MR&lt;/Name&gt; &lt;/Owner&gt; &lt;/Object&gt; &lt;Object&gt; &lt;ObjectID&gt;122&lt;/ObjectID&gt; [...] After tagsoup: &lt;Objects&gt; &lt;object&gt; &lt;ObjectID&gt;240&lt;/ObjectID&gt; [...] &lt;Status&gt;Not Ready&lt;/Status&gt; &lt;/object&gt; &lt;Title&gt;Some description which includes word/word, 22,000&lt;/Title&gt; &lt;Url&gt;http://example.com/withquerystring?id=240&amp;amp;other=1&amp;amp;url=http%3A%2F%2Fredirected.example.com%2F40&lt;/Url&gt; [...] &lt;Owner&gt; &lt;Name&gt;JOHN MARSHALL, MR&lt;/Name&gt; &lt;/Owner&gt; &lt;object&gt; &lt;ObjectID&gt;122&lt;/ObjectID&gt; [...] I'm in a java project that uses this libraries: import org.ccil.cowan.tagsoup.Parser; import org.ccil.cowan.tagsoup.XMLWriter; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; I'm using Java 6. Any clues for that? The desired output of a valid xml file would be the same file (maybe just changing details, but not the structure), wouldn't it?
type: Question
tagged with: tag-soup
has answer: http://stackoverflow.com/a/24823276
downvote count: 0
answer count: 1

http://stackoverflow.com/a/24828320
has comment: http://stackoverflow.com/comment/38546352
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24828020
has comment: http://stackoverflow.com/comment/38547336
answers question: http://stackoverflow.com/q/24828020
score: 1
has comment: http://stackoverflow.com/comment/38548564
type: AcceptedAnswer
has body: You're loading the wrong JDBC driver. MySQLs JDBC driver is com.mysql.jdbc.Driver. Your code should look like: package database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; public class DbConnect { /** * Static method for user authentication * Test method * @param username - Username already striped from illigal chars (XSS safe) * @param pass - password */ public static void connect(String username,String pass)//Consider changing void to boolean { Connection con; PreparedStatement st; ResultSet rs; try { //Register JDBC driver Class.forName("com.mysql.jdbc.Driver");//Loading DB Driver } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } //Open a connection // Database credentials final String USER = "root"; final String PASS = ""; final String DB_URL = "jdbc:mysql://localhost:3306/imf_jsp"; try { con = DriverManager.getConnection(DB_URL,USER,PASS); st = con.prepareStatement("SELECT * FROM user WHERE signum = ? AND pass_hash = ?"); //Find user with given username &amp; pass st.setString(1, username);//Bind param (Should prevent SQL Injection? Not sure but it is working in PHP with PDO) st.setString(2, pass);//Bind param (Should prevent SQL Injection? Not sure but it is working in PHP with PDO) st.execute();//statemant execution System.out.println("In Database?: " + st.toString());//If not then check in LDAP } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38546283

http://stackoverflow.com/comment/38523638
has text: why would you even want to do this?
score: 0
comment on: http://stackoverflow.com/q/24816238
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38711882
comment on: http://stackoverflow.com/a/24910672
score: 0
type: AnswerComment
type: Comment
has text: Yeah, I don't think it's very ambiguous. If I say "everyone gets a new car except for Bob and Mary, who get each get a new bike" then I unambiguously establish (a) that everyone who isn't Bob or Mary gets a new car and (b) that Bob and Mary each get a new bike. But that aside, the section of 8.8.1, and particularly bullets 2-3 in it, talk about local and anonymous classes. There's nothing saying why a private inner class (that isn't local or anonymous) is closer to local/anon classes than it is to non-private classes.

http://stackoverflow.com/comment/38639030
has text: I think Matty only meant to say that he downloaded the third version down this list http://www.eclipse.org/downloads/ which opens the Java perspective by default (obviously, the version of Eclipse for Java developers has nothing to do with the Kepler name itself, as Kepler doesn't prevent you from using other languages).
type: Comment
comment on: http://stackoverflow.com/a/24876986
score: 0
type: AnswerComment

http://stackoverflow.com/q/24800318
type: Question
has comment: http://stackoverflow.com/comment/38493650
has body: package connection; public class NewTask extends AsyncTask<String, String, String> implements ActivitySorter{ private XMPPClient MainActivity; private XMPPConnection setConnection; public static XMPPConnection connection; private Context context; public String payload = "<question id='56 'text='Favorite Food'> chinese indian thai "; private Activity activity; public static String payload_data = ""; public NewTask(Context context) { this.context=context; } @Override protected String doInBackground(String... params) { ServiceProviders.Register_Providers(ProviderManager.getInstance()); String host = "web.vlivetech.com"; //getText(R.id.host); String port = "5222"; String service = "web.vlivetech.com"; // getText(R.id.service); String username ="has12345"; // getText(R.id.userid); String password = "123"; // getText(R.id.password); // Create a connection ConnectionConfiguration connConfig = new ConnectionConfiguration(host, Integer.parseInt(port), service); connection = new XMPPConnection(connConfig); ServiceProviders.Register_Providers(ProviderManager.getInstance()); try { connection.connect(); Log.i("XMPPClient", "[SettingsDialog] Connected to " + connection.getHost()); connection.login(username, password); Log.i("XMPPClient", "Logged in as " + connection.getUser()); // Set the status to available Presence presence = new Presence(Presence.Type.available); connection.sendPacket(presence); } catch (XMPPException ex) { Log.e("XMPPClient", "[SettingsDialog] Failed to connect to " + connection.getHost()); //MainActivity.setConnection(null); } // CustomIQ iq=new CustomIQ(" "); // // CustomIQ iq=new CustomIQ(" "); // // set the type // iq.setType(IQ.Type.GET); // iq.setTo("web.vlivetech.com"); // //iq.setFrom("test@hassaan/Smack"); // // // connection.sendPacket(iq); // CustomIQ iq=new CustomIQ(" "); // CustomIQ iq=new CustomIQ(" "); // CustomIQ iq=new CustomIQ(" "); // set the type iq.setType(IQ.Type.GET); iq.setTo("web.vlivetech.com"); //iq.setFrom("test@hassaan/Smack"); co…
score: 0
has answer: http://stackoverflow.com/a/24801229
answer count: 1
has comment: http://stackoverflow.com/comment/38493583
has comment: http://stackoverflow.com/comment/38494003
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: noclassdeffounderror this is error

http://stackoverflow.com/a/24757489
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38424408
has comment: http://stackoverflow.com/comment/38441969
has comment: http://stackoverflow.com/comment/38412163
has comment: http://stackoverflow.com/comment/38441163
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/38485935
answers question: http://stackoverflow.com/q/24756443
has comment: http://stackoverflow.com/comment/38441173
has body: EDIT : First answer was stupid because of @LazyCollection(LazyCollectionOption.FALSE) I could reproduce and fix but I cannot understand what actually happens under the hood ... First what happens (spyed under debugger): As avatars collection is eager, profile.getAvatars() is fully populated and is a Hibernate collection (in my own tests, it is a PersistentBag) When profile is evicted, all its avatars are also evicted (at least with Hibernate 4.1.9 Final). On currentSession.save(profile) all is marvelous, a new Profile is inserted and also a new Avatar. But on following transaction commit, Hibernate decides to do the famous update Avatar set profile_id = null where profile_id = 1; :-( Next the fix : I supposed that Hibernate is surprised to find a new entity already having a PersistentBag to carry a collection. So I created a simple ArrayList, appended current Avatars to it, and put it into profile : List&lt;Avatar&gt; avatars = new ArrayList&lt;Avatar&gt;(); for (Avatar a : profile.getAvatars()) { currentSession.evict(a); // in fact useless but harmless a.setId(null); avatars.add(a); } profile.setAvatars(avatars); And ... all is fine, Hibernate no longer emits the offending update ! So the cause seems to be a PersistentBag in a new entity, but i cannot imagine what actually happens in Hibernate internals.

http://stackoverflow.com/q/24774917
has comment: http://stackoverflow.com/comment/38445562
has body: I'm having problem to add two objects (BigDecimals) which supposed to be taken from the user, i.e. user inputs two bigdecimals, on the output program should show the exact result with all decimals considered. Sample of I/O Input: 3.14 3.143111 Output: 6.283111 I'm trying to use objects called BigDecimals, but I can't use typical scanner function since the object BigDecimal has to be 'initiated' by some value, and I would like to leave it empty so that user will be able to type in the exact floating point. I would like to use BigDecimal instead of float type since it's more accurate. Here is just an example how to add two BigDecimals types but I can't figure out how to input the value of above mentioned objects. import java.math.*; import java.util.Scanner; public class home { public static void main(String[] args) { BigDecimal bg1,bg2,bg3; Scanner scan = new Scanner(System.in); bg1 = new BigDecimal(3.14); bg2 = new BigDecimal(3.143111); MathContext mc = new MathContext(7); bg3=bg1.add(bg2,mc); System.out.println("Result is " + bg3); } } How can I possibly determine the value of MathContext by user ? Should I just add some int variable in brackets() while creating new object MathContext which will be determined by user ?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24775108
tagged with: java
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24774947
favorite count: 0
has answer: http://stackoverflow.com/a/24774947
has title: Adding BigDecimals with user input
has comment: http://stackoverflow.com/comment/38445353
has answer: http://stackoverflow.com/a/24775108
score: 1
upvote count: 1

http://stackoverflow.com/comment/38537814
has text: Thank you for help. But will you please suggest me other than spring-data-mongodb
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24819613
type: Comment

http://stackoverflow.com/comment/38593104
type: Comment
has text: @WorldSEnder Right, there's absolutely nothing you can do about `?`, it expresses that you don't know and don't care what type it is. Note that even if you could, it would still fail because `savedData` is declared as a `DataOut`, while your `handle` method expects a specific subtype. Basically, this _catch-all_ design won't work.
comment on: http://stackoverflow.com/a/24852999
score: 0
type: AnswerComment

http://stackoverflow.com/q/24757555
linked to: http://stackoverflow.com/q/1444227
type: UnansweredQuestion
tagged with: lazy-loading
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38412318
has title: Lazy loading in One to One Mapping in hibernate
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24757791
favorite count: 0
has body: I have a data model class Account.In Account class I have one one property Contact(Custom class) and this is having one to one mapping.So I am using like this in Account class: @OneToOne(mappedBy = "account", cascade = CascadeType.ALL, fetch = FetchType.LAZY) public Contact getContact() { return contact; } After doing this contact property is not lazy loading.I have tried optional=false and @LazyToOne (LazyToOneOption.NO_PROXY).But no luck. Could you please help me?

http://stackoverflow.com/q/24757067
upvote count: 0
favorite count: 0
has title: rotating for loop in a cyclic process in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24757487
has comment: http://stackoverflow.com/comment/38533842
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/25738034
has comment: http://stackoverflow.com/comment/38411480
downvote count: 1
has answer: http://stackoverflow.com/a/24757466
type: Question
score: -1
has answer: http://stackoverflow.com/a/24757589
has body: Here is my question: my for loop should rotate in cyclic process and the when it reaches to the value 7, it should start form 1. and my newcost value should always be in increasing value. here is my code: import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import org.joda.time.DateTime; import org.joda.time.Days; public class PayCalculation { int cost,cost1=0; private String fromdate, todate, npersons, nrooms, rooms; long newcost; public String execute() throws Exception{ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date1 = dateFormat.parse(fromdate); //Date date2 = dateFormat.parse(todate); Calendar c = Calendar.getInstance(); c.setTime(date1); // c.setTime(date2); int dayOfWeek1 = c.get(Calendar.DAY_OF_WEEK); // int dayOfWeek2 = c.get(Calendar.DAY_OF_WEEK); Date past = dateFormat.parse(fromdate); Date today = dateFormat.parse(todate); int days = Days.daysBetween(new DateTime(past), new DateTime(today)).getDays(); System.out.println(dayOfWeek1 + " day of the week"); System.out.println(days + " no of days"); int i; for(i=0 ; i&lt;=days ; i++){ System.out.println(i); if(i==1 || i==7){ System.out.println("sun or sat"); cost1=1500; // newcost=cost1; } if(i==2 || i==3 || i==4 || i== 5|| i==6){ System.out.println(" other days"); cost=1000; // newcost=cost; } /*if(i==7){ System.out.println("i==7"); i=1; } */ newcost=0+cost+cost1; System.out.println(newcost+" new cost"); } System.out.println(newcost); return "success"; }
tagged with: for-loop

http://stackoverflow.com/comment/38479364
has text: can you try dumping classpath at runtime `System.out.println(System.getProperty"java.class.path"));` and see if one of those path has this xml file ?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24792477

http://stackoverflow.com/comment/38675438
comment on: http://stackoverflow.com/a/24895425
score: 0
type: AnswerComment
type: Comment
has text: but i tried using a if statement if(cur_index == -1) show alert and terminate function.

http://stackoverflow.com/q/24896711
tagged with: pdfclown
type: Question
has title: PDFClown Hello World not working
score: 0
has comment: http://stackoverflow.com/comment/38694904
has comment: http://stackoverflow.com/comment/38679261
answer count: 1
has comment: http://stackoverflow.com/comment/38689407
has answer: http://stackoverflow.com/a/26075619
has comment: http://stackoverflow.com/comment/38680320
has comment: http://stackoverflow.com/comment/38694418
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38690198
tagged with: java
has body: I'm trying to run the first PDFClown java example but i'm unable to run it. Sample cannot be found, as well as the serialize method. Also, the run Overriding seems to have any sense at the moment. Can you help me? Thank you

http://stackoverflow.com/comment/38652651
type: AnswerComment
comment on: http://stackoverflow.com/a/24881434
score: 0
type: Comment
has text: That is not completely true, after you tap the back button, the previous one will be started, but the previous one will only be started after you tap the back button. You can try this, 1.run the two startActivity. 2.tap the recent apps button, now you can see the last app only. 3.select the started app. 4.tap the back button. then the result is that the previous one will not be started. While I want all app will be actually started after run the program.

http://stackoverflow.com/a/39112741
downvote count: 0
answers question: http://stackoverflow.com/q/24798529
type: Answer
upvote count: 2
score: 2
has body: You should include qualifiers: List&lt;Annotation&gt; qualifierList = new ArrayList(); for (Annotation annotation: C.class.getAnnotations()) { if (annotation.annotationType().isAnnotationPresent(Qualifier.class)) { qualifierList.add(annotation); } } javax.enterprise.inject.spi.CDI.current() .select(C.class, qualifierList.toArray(new Annotation[qualifierList.size()]) .get()

http://stackoverflow.com/q/24773074
tagged with: object
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24773282
tagged with: file-io
type: UnansweredQuestion
tagged with: sockets
has body: I want sends and receive an object and file the order is client -> server by ObjectOut(In)putStream client -> server String(file name) by DataIn(Out)putStrean writeUTF client -> server by BufferedIn(Out)putStream server -> client by ObjectOut(In)putStream but when the code reaches on 3 writing file takes forever (I think...it is waiting) the critical code is byte[] data = new byte[BUFFER_SIZE]; while ((length = bis.read(data)) != -1) { bos.write(data, 0, length); System.out.println(length); } bis(BufferedInputStream).read() do not proceed when I print the length the output is 4096 4096 879 then just wait... is there anyone who knows what is the problem or solution? Server thread public void run() { System.out.println("\n New FileUploadServer thread started"); msg = (Message) objComm.recvObject(clientSocket); System.out.println("server get message"); if (checkState(msg.getState())) System.out.println(clientAddr + " session over"); System.out.println(""); } private boolean checkState(int _state) { switch (_state) { case ST_EXCEL_FILE: return receiveExcel(); default: return false; } } private boolean receiveExcel() { Message sendMsg = receiveStr(); System.out.println("receiveStr() success"); BufferedInputStream bis; DataOutputStream dos; DataInputStream dis; FileOutputStream fos; BufferedOutputStream bos; VoteInfo sendVoteInfo = (VoteInfo) msg.getObj(); try { dis = new DataInputStream(clientSocket.getInputStream()); dos = new DataOutputStream(clientSocket.getOutputStream()); // check file name extension is "xls" or "xlsx" String fName = dis.readUTF(); int idx = fName.lastIndexOf("."); String extension = fName.substring(idx + 1, fName.length()); if (!excelFileCheck(extension)) return false; dos.writeUTF("read_ok"); dos.flush(); System.out.println("File name: " + fName); File f = new File(EXCEL_FILE_DIR + fName); fos = new FileOutputStream(f); bos = new BufferedOutputStream(fos); bis = new BufferedInputStream(clientSocket.getInputStream()); int length; byte[] data = new …
tagged with: datainputstream
has answer: http://stackoverflow.com/a/24774021
has title: java DataInputStream read() stop and do not proceed
type: Question

http://stackoverflow.com/comment/38458233
type: QuestionComment
score: 0
has text: Because those requests coming through an infrastructure, done in Java. Those are not HTTP requests!
comment on: http://stackoverflow.com/q/24780240
type: Comment

http://stackoverflow.com/a/24855366
has body: As Eran noted in his answer, you want to split at approximately the line length divided by the desired number of lines, but have to adjust for that being in the middle of a word. I think his solution won't quite always give the best solution though, as it might sometimes be best to split before the word instead of after as he's doing. A divide-and-conquer approach would be a recursive algorithm roughly as follows: Let N be the desired number of lines and LENGTH be the number of characters in the input string (normalizing to single-spaces first). If the character at LENGTH/N is a space, make the first cut there, and recursively call to split the remainder into N-1 lines, otherwise find the spaces at each end of the word containing this character and make trial cuts at both points with recursive calls again tom complete both cuts. Score the results somehow and choose the better. I have implemented this as follows. For the scoring function, I chose to minimize the maximum length of lines in the split. A more complex scoring function might possibly improve the results, but this seems to work for all your cases. public class WordWrapper { public String wrapWords(String input, int lines) { return splitWords(input.replaceAll("\\s+", " "), lines); } private String splitWords(String input, int lines) { if (lines &lt;= 1) { return input; } int splitPointHigh = findSplit(input, lines, 1); String splitHigh = input.substring(0, splitPointHigh).trim() + "\n" + splitWords(input.substring(splitPointHigh).trim(), lines - 1); int splitPointLow = findSplit(input, lines, -1); String splitLow = input.substring(0, splitPointLow).trim() + "\n" + splitWords(input.substring(splitPointLow).trim(), lines - 1); if (maxLineLength(splitLow) &lt; maxLineLength(splitHigh)) return splitLow; else return splitHigh; } private int maxLineLength(String split) { return maxLength(split.split("\n")); } private int maxLength(String[] lines) { int maxLength = 0; for (String line: lines) { if (line.length() &…
has comment: http://stackoverflow.com/comment/43449027
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43448701
score: 4
accepted answer of: http://stackoverflow.com/q/24854113
answers question: http://stackoverflow.com/q/24854113
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/24864348
has body: I have a Multimap which saves custom objects multiple times (Places and Events) under the key values of "place" and "event", within those objects I have the place name and the event name (getters). How can I access these values when iterating through the Multimap.
answer count: 1
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/11852535
tagged with: multimap
has answer: http://stackoverflow.com/a/24864639
tagged with: java
tagged with: collections
has title: Iterating through Multimap (Guava)
type: Question
score: 0

http://stackoverflow.com/q/24861321
type: AnsweredQuestion
tagged with: cxf
tagged with: java
has answer: http://stackoverflow.com/a/24861395
has title: application-context Spring configuration file not found
type: Question
has comment: http://stackoverflow.com/comment/38654183
score: 0
accepted answer: http://stackoverflow.com/a/24861395
has body: I'd like to create a simple soap webservice with Spring and CXF. But my application-context.xml configuration file is not found: webapp/WEB-INF/web.xml: <?xml version="1.0" encoding="UTF-8"?> org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:application-context.xml CXFServlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /* webapp/WEB-INF/application-context.xml: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <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" 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"> <import resource="classpath:META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> </beans> Result: Caused by: java.io.FileNotFoundException: class path resource [application-context.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:329) ... 21 more Why? What am I missing here?
answer count: 1
tagged with: soap
has comment: http://stackoverflow.com/comment/85045777
tagged with: spring
has comment: http://stackoverflow.com/comment/38608983

http://stackoverflow.com/a/24837469
downvote count: 0
score: 1
has body: As you are doing file I/O, you should bear in mind that the I/O operations are likely to be very much slower than any work done by the CPU in your code. But there are other considerations. Optimisations tend to make code more complicated and harder to understand. To understand your MappedByteBuffer code a reader needs to understand how a MappedByteBuffer works in addition to everything they need to understand for file input. File reading is commonly done. So it should not surprise you that Java already provides code to help you. That code will have been written by experts, tested and debugged. Unless you have special requirements you should always use such code rather than writing your own. That is, I recommend using BufferedReader (your first approach).
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24837232

ssdp
tag name: ssdp
type: Tag
tags question: http://stackoverflow.com/q/24823816

http://stackoverflow.com/q/24872107
tagged with: reflection
possible better answer: http://stackoverflow.com/a/24872367
upvote count: 3
accepted answer: http://stackoverflow.com/a/24872162
type: AnsweredQuestion
score: 3
has body: I have this odd case which I'd like to handle through reflection or some library, if possible. Is there a way to check if a class has a method and then invoke it on an already existing instance of the object? For example, let's say I have: Foo foo = new Foo(); Foo has a close() method. Let's say I know that a lot of the classes will have a close() method but since they were poorly devised and are legacy that I cannot re-write, I would like to find out a generic solution to invoke a method I know they all have, despite them not inheriting from a base class or interface. I would like to have a method in my FooHandling class that accepts initialized objects and invokes their close() method. The objects will by no means inherit from the same base class, so they're totally different in nature, but all have a method with the same name. So, in FooHandler I'd like to have something like this: void coolGenericClosingMethod(Object o) { // 1) Check via reflection if the class `o` represents contains a `close()` // 2) Invoke the method, if it exists, but on the passed in object `o`. } So is there some neat trick I could use on an already instantiated object and still do that?
tagged with: java
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/24873434
has comment: http://stackoverflow.com/comment/38629612
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24872162
has answer: http://stackoverflow.com/a/24872367
has title: Is there a way to check if a class has a method and then invoke it on an already existing instance of the object?

http://stackoverflow.com/a/24853784
type: Answer
has body: This is what i see public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jOptionPane1 = new javax.swing.JOptionPane(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("&gt;:D"); setResizable(false); addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() { public void ancestorMoved(java.awt.event.HierarchyEvent evt) { formAncestorMoved(evt); } public void ancestorResized(java.awt.event.HierarchyEvent evt) { } }); jButton1.setText("Press Me :D"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 353, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(0, 45, Short.MAX_VALUE) .addComponent(jOptionPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 46, Short.MAX_VALUE))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) .addGroup(layout.createP…
has comment: http://stackoverflow.com/comment/45960603
score: 0
answers question: http://stackoverflow.com/q/24847213

http://stackoverflow.com/a/24870890
answers question: http://stackoverflow.com/q/24853949
score: 0
has body: Well, one way to do it is to store it in "session". I say put quotes around that because I don't necessarily mean servlet session (which may or may not work across multiple nodes, depending on your server setup). It could be anything that performs the function of session, such as (perhaps) a Redis key-value store. Of course, once you fetch it from "session", you'll also want to clean it out. Spring MVC supports flash attributes directly for this purpose. See http://docs.spring.io/spring/docs/4.0.6.RELEASE/spring-framework-reference/htmlsingle/#mvc-flash-attributes. Also, it strikes me that you're writing your own controller to do the OAuth dance with Twitter, but Spring Social's ConnectController already exists for that purpose. See https://github.com/spring-projects/spring-social-samples/tree/master/spring-social-showcase for an example of how ConnectController is used.
type: Answer

http://stackoverflow.com/a/24949889
has body: You can use a for loop and get the values. for(int i=0; i&lt;x.asInteger(); i++){ System.out.println(x.asStrings[i]); }
accepted answer of: http://stackoverflow.com/q/24797274
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24797274
score: 1

http://stackoverflow.com/q/24902248
tagged with: java
possible better answer: http://stackoverflow.com/a/24902512
downvote count: 1
has body: I want to use custom SearchView in menu of my App but I'm encountering a NullPointerException in android while using actionLayout in menu.xml I have custom layout for menu : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;Button android:id="@+id/search_btn" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:background="@android:drawable/ic_menu_search"/&gt; &lt;EditText android:id="@+id/search_et" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBottom="@+id/search_btn" android:layout_toLeftOf="@+id/search_btn" android:ems="10" android:inputType="none" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; and my menu.xml is : &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@+id/search_view" android:icon="@android:drawable/ic_menu_search" android:actionLayout="@layout/search_menu" android:showAsAction="collapseActionView|ifRoom" android:title="@string/search_title"/&gt; &lt;/menu&gt; Now I want to add OnClickListener on _search_btn_ So I did that likewise : @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); searchButton = (Button) menu.findItem(R.id.search_btn); searchButton.setOnClickListener(new OnClickListener() { // SEE HERE I'M GETTING NullPointerException @Override public void onClick(View v) { Toast.makeText(MainActivity.this, ((EditText) findViewById(R.id.search_et)).getText().toString(), Toast.LENGTH_LONG).show(); } }); return true; } but I'm getting my NullPointerException on above mentioned line. How can I add ClickListener to that button???
has answer: http://stackoverflow.com/a/24902512
linked to: http://stackoverflow.com/q/7479992
type: Question
has comment: http://stackoverflow.com/comment/38686402
has comment: http://stackoverflow.com/comment/38686685
has comment: http://stackoverflow.com/comment/38686377
score: 0
tagged with: nullpointerexception
answer count: 3
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/24902449
has title: NullPointerException in android while using actionLayout in menu.xml
has answer: http://stackoverflow.com/a/24902399
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/24902399
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38686612

http://stackoverflow.com/comment/38432415
comment on: http://stackoverflow.com/q/24767852
type: Comment
type: QuestionComment
has text: Your form looks good. You have to place `enctype="multipart/form-data"` Attribute in the ` ` tag.
score: 0

http://stackoverflow.com/comment/38692960
comment on: http://stackoverflow.com/q/24901178
has text: That pretty much explains. Your python script is expecting some user inputs. And the process never completes, as the script proceeds. If you use a script, w/o any user interaction, this will work. If you must need user input in your script, you need to get pr.getOutputStream, like you do for pr.getInputStream. You can refer here : http://stackoverflow.com/questions/3643939/java-process-with-input-output-stream
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/24940980
has body: With a starting helper from Reuben, here's what I cane up with: VirtualMachine vm = (VirtualMachine) new \ InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", guestName); VirtualMachineConfigInfo vmci = vm.getConfig(); VirtualDevice [] devices = vmci.getHardware().getDevice(); VirtualDisk theDisk = null; for ( int i=0; devices!=null &amp;&amp; i&lt;devices.length; i++) { if ( devices[i].getDeviceInfo().getLabel().equals("Hard disk 1")) { theDisk = (VirtualDisk)devices[i]; } } if ( theDisk == null ) { return "False - disk not found"; } theDisk.setCapacityInKB(Long.parseLong(diskSize)*1024*1024); VirtualDeviceConfigSpec vdcs = new VirtualDeviceConfigSpec(); vdcs.setDevice(theDisk); vdcs.setOperation(VirtualDeviceConfigSpecOperation.edit); VirtualMachineConfigSpec vmcs = new VirtualMachineConfigSpec(); vmcs.setDeviceChange(new VirtualDeviceConfigSpec[]{vdcs}); Task task = vm.reconfigVM_Task(vmcs);
upvote count: 1
answers question: http://stackoverflow.com/q/24890978
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/38539630
has text: @TNT Here are the errors I'm getting - Exception in thread "Thread-1" java.lang.NullPointerException at helicopterbattle.Framework.GameLoop(Framework.java:148) at helicopterbattle.Framework.access$000(Framework.java:18) at helicopterbattle.Framework$1.run(Framework.java:84)
comment on: http://stackoverflow.com/q/24809436
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/107233949
has text: `Field entityManager in com.myapp.api.config.context.security.RepositoryRestConfig required a bean of type 'javax.persistence.EntityManager' that could not be found. `
type: AnswerComment
comment on: http://stackoverflow.com/a/49344988
score: 0
type: Comment

http://stackoverflow.com/comment/38634343
type: Comment
has text: @user2559503 Look-behind in Java is indeed strange creature. Sometimes it can't figure out max length even if it is obvious (like in this case) and sometimes it lets use unlimited regex (like in [this answer](http://stackoverflow.com/questions/16485687/extracting-pairs-of-words-using-string-split/16486373#16486373)).
type: AnswerComment
comment on: http://stackoverflow.com/a/24874476
score: 0

http://stackoverflow.com/q/24873879
has title: Matching a pattern in String
tagged with: java
has answer: http://stackoverflow.com/a/24874690
has comment: http://stackoverflow.com/comment/38633632
type: Question
has comment: http://stackoverflow.com/comment/38633064
accepted answer: http://stackoverflow.com/a/24873911
has comment: http://stackoverflow.com/comment/40496698
score: 0
has comment: http://stackoverflow.com/comment/38633055
answer count: 3
tagged with: string
has comment: http://stackoverflow.com/comment/38633359
has body: Dont know how to ask more correctly, so will try as I can. There is one example string where we are searching and another pattern String: it's length == 3, first character is 'b', third character is also 'b'. I need some way to figure out if example contains pattern (it comes to my mind something like example.indexOf(pattern) > - 1) Pattern = "b*b" Example = "gjsdng" - false; Example = "bob" - true; Example = "bab" - true; Example = "gdfgbUbfg" - true;
possible better answer: http://stackoverflow.com/a/24873991
has answer: http://stackoverflow.com/a/24873991
tagged with: regex
has answer: http://stackoverflow.com/a/24873911
type: AnsweredQuestion

http://stackoverflow.com/a/24782105
has body: First thing i will suggest is started using maven it handles the dependency problem very well or Just you can define a "User Library" like windows -&gt; preferences -&gt; java -&gt;User Libraries -&gt;new and then select the library created and add jars add all the jars in it. Next time just add that user library to the desired project instead of all the jars.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24779281

http://stackoverflow.com/comment/38624149
has text: I can't test it right now, but `ps -x | grep zimbraconnector.jar` (should also work without the `-x` option) should give you the exact information for your jar. You may then extract the pid and kill it
type: QuestionComment
comment on: http://stackoverflow.com/q/24869054
score: 0
type: Comment

http://stackoverflow.com/comment/38583471
comment on: http://stackoverflow.com/a/24848172
type: Comment
has text: This is basically a duplicate of [this answer](http://stackoverflow.com/a/24847761/616460), and also the OP specified that `a` should be a `double`.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24838284
has comment: http://stackoverflow.com/comment/38564715
has comment: http://stackoverflow.com/comment/38564549
answer count: 3
tagged with: spring
has comment: http://stackoverflow.com/comment/38565159
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24839543
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24839151
has title: Getting servlet exception in Spring 3.0
has body: trying to learn spring from this link : http://viralpatel.net/blogs/spring-3-mvc-create-hello-world-application-spring-3-mvc/ but getting following error: type Exception report message Servlet execution threw an exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet execution threw an exception org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:723) Getting above error repeating multiple times on browser and eclipse console. The file contents are : web.xml <?xml version="1.0" encoding="UTF-8"?> Spring3MVC index.jsp spring org.springframework.web.servlet.DispatcherServlet spring / spring-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:compo…
type: Question
has comment: http://stackoverflow.com/comment/38564548
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38564599
tagged with: java
has answer: http://stackoverflow.com/a/29937461
has comment: http://stackoverflow.com/comment/38564588
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/38565384

http://stackoverflow.com/comment/38427452
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24765433
has text: Yes, but actually I have an application in wich this is possible and I want to build something like that to.

http://stackoverflow.com/comment/38446976
comment on: http://stackoverflow.com/a/24775677
has text: Indeed @tucuxi : that's the reason why I wrote "field". :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38656994
comment on: http://stackoverflow.com/a/24886874
type: AnswerComment
has text: I'm talking **only** about private methods, so it's useless to mention extension here. My main point is, that static method have no access to non static instance fields, which makes it easier to get an overview of what the method does, because of the limited possibilitiy of side effects.
score: 0
type: Comment

oop
tags question: http://stackoverflow.com/q/24840217
tags question: http://stackoverflow.com/q/24790764
tags question: http://stackoverflow.com/q/24819334
tags question: http://stackoverflow.com/q/24844042
tags question: http://stackoverflow.com/q/24768929
tags question: http://stackoverflow.com/q/24815737
tag name: oop
tags question: http://stackoverflow.com/q/24885738
tags question: http://stackoverflow.com/q/24749426
tags question: http://stackoverflow.com/q/24860857
tags question: http://stackoverflow.com/q/24771575
tags question: http://stackoverflow.com/q/24892504
tags question: http://stackoverflow.com/q/24801288
tags question: http://stackoverflow.com/q/24784685
tags question: http://stackoverflow.com/q/24752580
tags question: http://stackoverflow.com/q/24877818
tags question: http://stackoverflow.com/q/24847036
tags question: http://stackoverflow.com/q/24848507
tags question: http://stackoverflow.com/q/24806959
tags question: http://stackoverflow.com/q/24856677
tags question: http://stackoverflow.com/q/24754712
tags question: http://stackoverflow.com/q/24838989
tags question: http://stackoverflow.com/q/24873071
tags question: http://stackoverflow.com/q/24825135
tags question: http://stackoverflow.com/q/24886563
type: Tag
tags question: http://stackoverflow.com/q/24895843

http://stackoverflow.com/comment/38642342
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24878815
has text: @BoratSagdiyev I just answered that.
score: 0

http://stackoverflow.com/q/24819402
answer count: 4
tagged with: build
tagged with: netbeans
tagged with: java
has answer: http://stackoverflow.com/a/24863826
type: Question
has answer: http://stackoverflow.com/a/24819468
score: 0
has answer: http://stackoverflow.com/a/24819552
has body: I have written a java program in Netbeans. In this program I've used extra libraries like iTextPDF. When I click the "clean and build button, the program's jar file is created in the specified path. Everything works well when I open the jar file on the path it was created. But when I copy it to another place like desktop, one of my JFrames doesn't show up when I click on the defined button. How can I solve it? It's really wired.
has title: unsuccessful build of a java program with netbeans
has answer: http://stackoverflow.com/a/24819495
type: UnansweredQuestion

http://stackoverflow.com/a/24858711
has comment: http://stackoverflow.com/comment/38606578
has body: The experienced behaviour might depend on the Java version and vendor that was used to run the application, because since the general contract of Object.hashcode() is violated, the result is implementation dependent. A possible explanation (taking one possible implementation of HashMap): The HashMap class in its internal implementation puts objects (keys) in different buckets based on their hashcode. When you query an element or you check if a key is contained in the map, first the proper bucket is looked for based on the hashcode of the queried key. Inside the bucket objects are checked in a sequencial way, and inside a bucket only the equals() method is used to compare elements. So if you do not override Object.hashcode() it will be indeterministic if 2 different objects produce default hashcodes which may or may not determine the same bucket. If by any chance they "point" to the same bucket, you will still be able to find the key if the equals() method says they are equal. If by any chance they "point" to 2 different buckets, you will not find the key even if equals() method says they are equal. hashcode() must be overriden to be consistent with your overridden equals() method. Only in this case it is guaranteed the proper, expected and consistent working of HashMap. Read the javadoc of Object.hashcode() for the contract that you must not violate. The main point is that if equals() returns true for another object, the hashcode() method must return the same value for both of these objects.
type: Answer
has comment: http://stackoverflow.com/comment/38604259
has comment: http://stackoverflow.com/comment/38605432
accepted answer of: http://stackoverflow.com/q/24858454
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24858454
has comment: http://stackoverflow.com/comment/38605921
has comment: http://stackoverflow.com/comment/38604298
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/38520034
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24791992
type: QuestionComment
has text: Thanks Mark for your comment. Unfortunately, this didn't solve the problem even if I feel we're really close to it. Just to add infos on top of that, even the JS files in the app folder aren't loaded (same for css files)... I'll update my question right away to add infos on my config

http://stackoverflow.com/a/24893404
has body: You will have to clone the repository first, thus your first step was right: Git.cloneRepository().setURI(remotePath).setDirectory(localPath).call(); To just checkout a commit by its id you can call checkout like this: git.checkout().setName("&lt;id-to-commit&gt;").call(); But note that this will result in a detached HEAD. To avoid this, you can tell checkout to create a new branch first that points to the commit and then checkout this branch. git.checkout().setCreateBranch(true).setName("new-branch").setStartPoint("&lt;id-to-commit&gt;").call(); The API isn't very intuitive, but it does what it should.
has comment: http://stackoverflow.com/comment/121899259
has comment: http://stackoverflow.com/comment/105920054
type: AcceptedAnswer
downvote count: 0
upvote count: 21
type: Answer
has comment: http://stackoverflow.com/comment/105917696
accepted answer of: http://stackoverflow.com/q/24892748
answers question: http://stackoverflow.com/q/24892748
has comment: http://stackoverflow.com/comment/121898170
score: 21

http://stackoverflow.com/a/24759849
upvote count: 6
answers question: http://stackoverflow.com/q/24758888
accepted answer of: http://stackoverflow.com/q/24758888
downvote count: 0
has comment: http://stackoverflow.com/comment/123658698
has body: Hibernate can take care of the cascade deletes if you always use it to perform the deletes. So removing a SubTable entity will succeed and it will remove both the subclass table record and the associated base class row as well. If you want to use SQL level deletes, assuming you are using hbm2ddl (which you shouldn't do since you should use Flyway), then you need to annotate the SubTable with the @OnDelete annotation: @Entity @Table @OnDelete(action = OnDeleteAction.CASCADE) public class SubTable extends Table { ... }
type: AcceptedAnswer
type: Answer
score: 6

http://stackoverflow.com/q/24876819
has title: File not recognized in the given path
has comment: http://stackoverflow.com/comment/38638569
has comment: http://stackoverflow.com/comment/38638566
tagged with: file-io
has answer: http://stackoverflow.com/a/24876975
has comment: http://stackoverflow.com/comment/38679180
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38638523
favorite count: 0
accepted answer: http://stackoverflow.com/a/24876975
has comment: http://stackoverflow.com/comment/38638567
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: file
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38638507
has body: String inXSL="src/main/resources/abc.xslt"; Here am trying to get the file from the path name and process it but the file is never getting recognized from the given path(JAVA).FYI,the system is MAC. The file is located inside src/main/resources inside the project. Please provide inputs on this.

http://stackoverflow.com/comment/38431470
score: 0
type: Comment
type: QuestionComment
has text: Would this also allow multi-row inserts? (e.g., insert 10 objects as a bulk? One Transaction per object sounds like big overhead or are I am wrong?
comment on: http://stackoverflow.com/q/24766184

http://stackoverflow.com/q/24807222
answer count: 1
has comment: http://stackoverflow.com/comment/38506346
has comment: http://stackoverflow.com/comment/38506914
favorite count: 0
has comment: http://stackoverflow.com/comment/38506507
linked to: http://stackoverflow.com/q/4158028
downvote count: 5
has title: what does return this do in this code?
has comment: http://stackoverflow.com/comment/38506568
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19325512
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38506382
type: Question
has body: In this code class Parent { void show() { System.out.print("parent"); } Parent a() { return this; } } class Child extends Parent { void show() { System.out.print("child"); } public static void main(String arg[]) { Parent a = new Child(); Parent b = a.a(); b.show(); } } What does return this; do? b.show() is invoking the child method show. So does this return reference to its child class? If not then how is the show() method of child being called?
has comment: http://stackoverflow.com/comment/38506467
has comment: http://stackoverflow.com/comment/38506488
upvote count: 6
has answer: http://stackoverflow.com/a/24807418
accepted answer: http://stackoverflow.com/a/24807418
has comment: http://stackoverflow.com/comment/38506330
has comment: http://stackoverflow.com/comment/38506405
has comment: http://stackoverflow.com/comment/38506619

http://stackoverflow.com/comment/38654250
type: QuestionComment
has text: What problem? You haven't told us what the problem is.
score: 0
comment on: http://stackoverflow.com/q/24885555
type: Comment

http://stackoverflow.com/comment/38613947
type: AnswerComment
type: Comment
has text: The first official source I can find is: http://docs.oracle.com/javase/tutorial/java/data/characters.html
score: 3
comment on: http://stackoverflow.com/a/24863884

http://stackoverflow.com/comment/38695962
has text: Eg: If a single user logins in, let's assume get data from different tables to show data in different widgets. in that case, open the session in first method querying and close the session in last method query execution.. This is for a single user only.. It is not realted to user login and logout. When you need to fetch the data from database open the connection and close it before you are serving the request.
comment on: http://stackoverflow.com/a/24907052
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38420396
has text: if you got the answer, please feel free to accept the correct one.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24758128
type: Comment

opencv
type: Tag
tags question: http://stackoverflow.com/q/24811274
tags question: http://stackoverflow.com/q/24773153
tags question: http://stackoverflow.com/q/24848073
tags question: http://stackoverflow.com/q/24909096
tags question: http://stackoverflow.com/q/24813032
tags question: http://stackoverflow.com/q/24885303
tags question: http://stackoverflow.com/q/24843181
tag name: opencv
tags question: http://stackoverflow.com/q/24868501
tags question: http://stackoverflow.com/q/24848059
tags question: http://stackoverflow.com/q/24868362
tags question: http://stackoverflow.com/q/24856501
tags question: http://stackoverflow.com/q/24806938

http://stackoverflow.com/a/24867701
accepted answer of: http://stackoverflow.com/q/24806992
has body: The problem turned out to be me expecting something not really possible. I was making a request to non-existent static resource. I still expected some data to go through filter, because http client was getting bunch of headers and my filter was reporting 0 bytes which simply felt wrong. However, it turned out that filters only do see raw data produced by servlet (or in case of static content and jetty - handler). They can't see headers as they are added later by the server, when all of the app code was already executed. While I'd like to have total response size (headers and content) it appears I have to settle down with only content beng measured.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24806992
type: AcceptedAnswer

http://stackoverflow.com/comment/38397553
has text: Implement Comparator or Comparable interface. check http://www.mkyong.com/java/java-object-sorting-example-comparable-and-comparator/.
comment on: http://stackoverflow.com/q/24749282
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24882872
tagged with: generics
tagged with: wildcard
has answer: http://stackoverflow.com/a/24882924
has answer: http://stackoverflow.com/a/24883330
type: UnansweredQuestion
tagged with: java
has title: how to deal with type in java bounded wildcards
type: Question
score: 0
answer count: 2
has body: I've following question: Is it possible to do something like that: class Sample { public static void main(String[] args) { List&lt;Fruit&gt; fruits = new ArrayList&lt;&gt;(); fruits.add(apple); fruits.add(orange); List&lt;Apple&gt; apples = new ArrayList&lt;&gt;(); copyToSubType(fruits, apples, Apple.class); } private &lt;T&gt; void copyToSubType(List&lt;T&gt; source, List&lt;? extends T&gt; target, Class cls) { for (T element : source) { if (element.getClass() == cls) { target.add(element); } } } } I'm trying to find some kind of general method that allows me to copy elements from concrete type to the list that contains only such types. I was thinking if it is possible to use the wildcards... but it seems that my approach isn't correct.

http://stackoverflow.com/q/24883102
score: 0
answer count: 1
tagged with: maven-2
has comment: http://stackoverflow.com/comment/38650266
tagged with: maven
has comment: http://stackoverflow.com/comment/38650017
type: AnsweredQuestion
has body: I'm trying to made a clean install for a Maven project but I found a problem. The console displays this error: [INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-enforcer-plugin:1.0 Cause: Class 'org.apache.maven.enforcer.rule.api.EnforcerRule' cannot be instantiated It's the same error for the command line: mvn release:prepare -Dresume=false This is the pom of all the project: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.sonatype.oss oss-parent 7 org.aperteworkflow aperteworkflow-core 2.1 pom Aperte Workflow Aperte Workflow is a compilation of well-known, stable and mature frameworks into a complete BPM solution developed by BlueSoft sp. z o.o. - Polish independent software vendor. Project home page is available at http://www.aperteworkflow.org/ core plugins utils samples vaadin-addons GNU Lesser General Public License, Version 2.1 http://www.gnu.org/licenses/lgpl-2.1.txt repo scm:git:https://github.com/bluesoft-rnd/aperte-workflow-core.git scm:git:https://github.com/bluesoft-rnd/aperte-workflow-core.git https://github.com/bluesoft-rnd/aperte-workflow-core.git <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.compiler.source>1.6</project.build.compiler.source> <project.build.compiler.target>1.6</project.build.compiler.target> <jbpm.version>4.4</jbpm.version> <spring.version>3.0.5.RELEASE</spring.version> <vaadin.version>6.8.3</vaadin.version> <hibernate.version>3.6.10.Final</hibernate.version> <postgres.version>8.4-702.jdbc4</postgres.version> <junit.version>4.8.2</junit.version> <liferay.version>6.1.1</liferay.version> pl.net.bluesoft util 2.0 commons-beanutils commons-beanutils 1.8.3 org.apache.commons commons-lang3 3.1 junit junit ${junit.version} test postgresql postgresql ${postgres.version} test net.htmlparser.jericho jericho-html 3.1 provided org.apache.maven.plugins maven-source-plugin jar test-jar org.apache.maven.plugins maven-war-plugin 2.1.1 maven-compiler-plugin ${project.build.compiler.…
accepted answer: http://stackoverflow.com/a/24883724
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24883724
has comment: http://stackoverflow.com/comment/38650609
has title: Maven clean install issue: Failed to configure plugin parameters

http://stackoverflow.com/comment/38615656
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24864964
has text: Additionally, a more detailed problem description, the expected and the actual behavior, would also help.

http://stackoverflow.com/a/24822706
type: Answer
has comment: http://stackoverflow.com/comment/38535439
has comment: http://stackoverflow.com/comment/38536201
accepted answer of: http://stackoverflow.com/q/24822389
answers question: http://stackoverflow.com/q/24822389
has body: When java program sends data to hardware, at that time, java program is the client and hardware is the server. When the hardware sends data to java program, the hardware is the client and your java program is the server. So, in your java program, you need to have two threads, one client thread (with a Socket to send bytes) and a server thread (with a ServerSocket, lets say for example, on port 8999) to receive bytes. For the hardware to send you the bytes, it needs the following details. 1. IP Address or host name of the device on which your java program runs. 2. The port in which the ServerSocket is listening (8999 in our case). If your hardware manual says it can send data to you, then, I am sure you can configure these details somewhere. (I am not sure what your hardware is. So, look at your hardware manual about how to configure these details). Sometimes, the device can send response on the same Socket you opened. (Again, I am at a loss how it is done in your hardware. Refer your hardware manual). In such case, keep your socket open and read from it in a separate thread.
has comment: http://stackoverflow.com/comment/38536086
has comment: http://stackoverflow.com/comment/38535936
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/38536947
has comment: http://stackoverflow.com/comment/38535350
has comment: http://stackoverflow.com/comment/38535706
has comment: http://stackoverflow.com/comment/38536599
has comment: http://stackoverflow.com/comment/38538474
has comment: http://stackoverflow.com/comment/38536339
has comment: http://stackoverflow.com/comment/38536692

http://stackoverflow.com/comment/38408977
type: Comment
has text: I've checked my code and that was a problem. I've got one main activity and wanted show calendar on fragmentactivity. Starting new activity by intend did the trick :) Thanks all for help :) Happy coding!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24752640

http://stackoverflow.com/a/24830452
type: Answer
has body: The == operator only works for Integer values between -128 and 127. That is why it doesn't work for 220 but does for 20. In general it is best to always use .equals() when comparing Integers and you should never rely on the == operator. More information can be found here: https://www.owasp.org/index.php/Java_gotchas#Immutable_Objects_.2F_Wrapper_Class_Caching
downvote count: 0
answers question: http://stackoverflow.com/q/24830420
accepted answer of: http://stackoverflow.com/q/24830420
score: 2
type: AcceptedAnswer
upvote count: 2

http://stackoverflow.com/comment/38611434
has text: @Diyang hey thanks :) sorry forgot to ask, does this mean i have to use ListView? i just edited my question. u can see my XML file now.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24851696
type: Comment

http://stackoverflow.com/a/24886076
downvote count: 2
answers question: http://stackoverflow.com/q/24857931
upvote count: 0
type: Answer
score: -2
has body: When you use Robot utility the x axis and y axis has to be metioned appropriately however it will differ system to system instead we can use AUTO IT. You can refer here http://www.autoitscript.com/forum/forum/9-example-scripts/

http://stackoverflow.com/q/24887877
tagged with: android
has comment: http://stackoverflow.com/comment/38659221
has comment: http://stackoverflow.com/comment/38666665
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24888019
upvote count: 1
has body: I'm pretty new android developer and I'm facing a weird problem. I'm trying to create a simple validation test to define whether an input is valid and username is not in us, or the opposite. I tried al kinds of thing like creating a static bollean 'isValid' variable and assign it or to use methods like setValid() to assign it but nothing seems to do the job. I am certain the the code is being processed (debug it) but nothing changes, it's stuck on false. Please share your wisdom with me. public class Registration extends Fragment { public boolean isValid=false; public Registration() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View rootView = inflater.inflate(R.layout.registration, container, false); return rootView; } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); Button bDone = (Button) getActivity().findViewById(R.id.bDone); bDone.setOnClickListener(new View.OnClickListener() { // pressed when finished entering personal details @Override public void onClick(View v) { final EditText fName = (EditText) getActivity().findViewById(R.id.etFirstName); final EditText lName = (EditText) getActivity().findViewById(R.id.etLastName); final EditText id = (EditText) getActivity().findViewById(R.id.etID); final EditText email = (EditText) getActivity().findViewById(R.id.etEmail); final EditText uName = (EditText) getActivity().findViewById(R.id.etRegUsername); final EditText pWord = (EditText) getActivity().findViewById(R.id.etRegPassword); ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("Account"); String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+"; String emailAddress; ParseObject dsAccount = new ParseObject("Account"); dsAccount.put("firstName", fName.getText().toString()); dsAccount.put("lastName", lName.getText().toString()); dsAccount.put("ID", id.getTe…
has title: Unable to assign value to variable
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24888055
downvote count: 0
favorite count: 0
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/38661731

http://stackoverflow.com/comment/85993852
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24824472
has text: @Patrick i found many examples using Service layer into MVC pattern,but i still confused about service interface, if our model share the same operations could we implement same interface to many service models classes ? second thing could we create share instance out side of controller ,i mean in other class to make controller independent to model data ?

http://stackoverflow.com/comment/38494335
comment on: http://stackoverflow.com/a/24800356
score: 0
has text: If i change static method to instance method above, then it will throw NullPointerException.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/79704563
comment on: http://stackoverflow.com/q/24885223
type: QuestionComment
has text: Wish someone actually took out the time to answer the `QUESTION`
type: Comment
score: 4

http://stackoverflow.com/comment/38633859
comment on: http://stackoverflow.com/q/24874203
score: 1
has text: Can you tell us which one is the line 72 in the `Checkout` class?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24779974
upvote count: 1
has body: I agree with Kayaman's comment above. Your service/business tier should be interfacing with multiple DAOs to perform CRUD operations on different entities e.g. Student, Teacher. public class MyService { private StudentDao studentDao; private TeacherDao teacherDao; // Daos injected public Student findStudent(Long id) { return this.studentDao.find(id); } // Other methods involving students or teachers } Trying to have one generic DAO is cumbersome and not good design in my opinion. If you have a base DAO and base entity classes, you can still push a lot of the boilerplate CRUD code into the base classes. When I first started using DAOs, I found the following article very useful: Don't repeat the DAO!
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24779704

http://stackoverflow.com/a/24859657
has comment: http://stackoverflow.com/comment/38607898
downvote count: 0
answers question: http://stackoverflow.com/q/24851618
score: 2
has body: The problem is that you are trying to access userName field of a null Login object. As I can see, if username is not in DB you are returning null from your DAO, but you are not checking return value in your Service. So, before creating a new User instance check if returned Login is not null. If it's null you should throw a UsernameNotFoundException.
upvote count: 2
type: Answer

http://stackoverflow.com/comment/38570146
type: AnswerComment
score: 0
type: Comment
has text: Sounds like exactly what I was looking for. Thank you!
comment on: http://stackoverflow.com/a/24836910

http://stackoverflow.com/comment/38410708
type: Comment
score: 0
has text: The error message states that the DTD found at http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd is not valid. Did you have a look at it?
type: QuestionComment
comment on: http://stackoverflow.com/q/24756326

http://stackoverflow.com/comment/38653231
has text: Just to note here for anyone who might be interested: a similar thing can be achieved for stubborn 3rd party servlets using `ServletWrappingController`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24882965
score: 0

http://stackoverflow.com/comment/38453178
has text: Use Maven, Ivy, or some other dependency manager.
comment on: http://stackoverflow.com/q/24779281
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24849599
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38606436
tagged with: main-activity
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24849680
favorite count: 0
tagged with: android
has title: Why does my App crush?
linked to: http://stackoverflow.com/q/23653778
has body: Can someone point me out the error in this code. I am learning to code and I was trying to run my first app from tutorial I saw, until I found this message "Unfortunately, The New Boston has stopped". This the message I get when every time I tried to open it after installation. I even tried on three different phone and in my Emulator and the same thing happened. I looked at my code and I found no error on any line of code. And then I tried to debug it. Here is the entire code and the logcat report respectively. import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import android.os.Build; public class MainActivity extends ActionBarActivity { int counter; Button add,sub; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); add = (Button) findViewById(R.id.bAdd); add = (Button) findViewById(R.id.sSub); display = (TextView) findViewById(R.id.tvDisplat); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter++; display.setText("Your total is" + counter); } }); sub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter--; display.setText("Your total is" + counter); } }); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle acti…
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38586145
score: -1

http://stackoverflow.com/comment/38670943
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24893953
has text: No, it prints the correct number, i just tried. Each client i add registers into "clients" and its size increases consequentially. I also tried to put simply some text inside the function fullComboBox, but it didn't work. That's the reason why i'm wondering why changes after initialize() have no effect :/

http://stackoverflow.com/comment/38540192
comment on: http://stackoverflow.com/a/24825076
has text: That depends. I use, in my application, `org.eclipse.swt.win32.win32.x86_64_3.102.1.v20130827-2048.jar`. According to his name, this jar seems platform dependent. No ? When I transform my application to don't use this jar, my application works fine on 32 bits and 64 bits JRE.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38596588
has text: Package statement in Main.java: "package com.company;"
comment on: http://stackoverflow.com/q/24854679
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38642234
comment on: http://stackoverflow.com/q/24878528
type: Comment
type: QuestionComment
has text: Good luck to you. Happy coding!
score: 0

http://stackoverflow.com/comment/38477868
comment on: http://stackoverflow.com/a/24790538
type: Comment
score: 1
has text: camickr is right that the cleanest separation of concerns here would be to write a self-contained layout manager that lays out each button 50 pixels above and 40 pixels right of the previous one, so that each time you call add() the layout manager can automatically figure out where to place the element. Is it worth the trouble? I say no in this limited case, even though that's the cleanest separation of concerns. But I'd break the inner for loop into a helper method (to which you'd pass children[i]), to make that part of it more modular.
type: AnswerComment

http://stackoverflow.com/comment/38500083
type: Comment
comment on: http://stackoverflow.com/a/24803785
type: AnswerComment
score: 0
has text: there is no diffrence between select("div[id=result_52]"); and select("div#result_52"); but of course .get(0) makes a difference. If you don't use this, it will bring all the elements which id=result_52. But if you use get(0) it will bring the first one.

http://stackoverflow.com/comment/38407637
score: 0
comment on: http://stackoverflow.com/a/24754720
type: Comment
has text: So do you mean that service layer should be only one and it is a responsibility of DAO implementations to provide all and fully qualified data to the service? What could be a proper use case in my situation to create another implementation of interface defining service?
type: AnswerComment

http://stackoverflow.com/a/24912366
has comment: http://stackoverflow.com/comment/38766182
score: 0
has comment: http://stackoverflow.com/comment/38781434
answers question: http://stackoverflow.com/q/24895549
type: Answer
has comment: http://stackoverflow.com/comment/38794030
has body: By using the TransportContext. See here: http://docs.spring.io/spring-ws/docs/2.2.x/reference/html/common.html#transport-context

http://stackoverflow.com/q/24854552
tagged with: php
has comment: http://stackoverflow.com/comment/38595924
has body: I use PHP to generate the front-end, rendering the HTML, running some SQL queries on the database, etc. The SQL queries are becoming slower and slower and the only way to improve them is to make requests non-stateless. Currently, request causes some query to fetch data and return it via JSON to the client, but the improved query (no group by, barely any joins and sorting) would need to hold an object with the results of the previous requests: objects returned, their order, some of their attributes. Knowing what the previously returned objects were, any requests after that can be handled much faster and queries would become much simpler. The question is: what is the most reliable way of running a Java service, which accepts the request from PHP and returns the results (JSON) synchronously, so that PHP can immediately parse the data and render the page? Would I be safe using JSON REST API over HTTP(S)? Should I look towards sockets? Could I create persistent connections from PHP without having to make a separate module in C? P.S. The requests will happen between front-end server and Java server. They can be on the same machine or separate machines. Request might need to be load balanced in the future over a Java cluster.
has comment: http://stackoverflow.com/comment/38596009
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/38633510
has title: How to send data between Java and PHP (synchronously)
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/38633655
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38596356

http://stackoverflow.com/q/24885555
score: 0
has body: I have a Maven project. I can upload image in my database, but i want to bring this image in my xhtml page. My Java Code; private StreamedContent secilenMusteriResimi; public StreamedContent getSecilenMusteriResimi() { return secilenMusteriResimi; } public void setSecilenMusteriResimi(StreamedContent secilenMusteriResimi) { this.secilenMusteriResimi = secilenMusteriResimi; } public void showImage() { RequestContext.getCurrentInstance().update("panel"); imagesPath = selectedImages.getPath(); try { InputStream inputStream = new ByteArrayInputStream(selectedImages.getProfilresmi()); BufferedImage resimData = ImageIO.read(inputStream); ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageIO.write(resimData, "jpg", os); secilenMusteriResimi = new DefaultStreamedContent(new ByteArrayInputStream(os.toByteArray()), "image/jpg"); // secilenMusteriResimi = new DefaultStreamedContent(inputStream); } catch (Exception e) { e.printStackTrace(); } } My xhtml Code; &lt;h:form&gt; &lt;p:dataTable id="table" var="img" value="#{musteriBean.musteriTanimlariListesi}" style="width: 500px;" selectionMode="single" selection="#{musteriBean.selectedImages}" rowKey="#{img.id}"&gt; &lt;p:ajax event="rowSelect" listener="#{musteriBean.showImage()}" update=":panel" /&gt; &lt;p:column headerText="ID"&gt; &lt;h:outputText value="#{img.id}" /&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;/h:form&gt; &lt;br /&gt; &lt;h:form id="panel"&gt; &lt;p:panelGrid columns="1"&gt; &lt;p:graphicImage value="#{musteriBean.secilenMusteriResimi}"/&gt; &lt;/p:panelGrid&gt; &lt;/h:form&gt; When i run the program; http: //hizliresim.com/Y3lky6 How can i fix this problem? I am waiting for your help. Thank you.
answer count: 1
has comment: http://stackoverflow.com/comment/38654548
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/38654250
tagged with: java
has answer: http://stackoverflow.com/a/24886199
type: Question
has title: How can i bring the image in my xhtml page?

http://stackoverflow.com/comment/38606677
type: QuestionComment
comment on: http://stackoverflow.com/q/24860063
has text: well I've managed to print the receipt and open the cash drawer which is connected to the printer I just wanted to know if I will still have to change my code if I will be connecting it directly to the computer 'DrawerOptions()' ? hmm none I think all I need is to open it :D
score: 0
type: Comment

http://stackoverflow.com/comment/38421354
has text: In BuildConfig.groovy: grails.project.target.level = 1.7
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24757103

linux-mint
type: Tag
tags question: http://stackoverflow.com/q/24835316
tag name: linux-mint

http://stackoverflow.com/comment/38723647
comment on: http://stackoverflow.com/a/24876945
score: 0
type: AnswerComment
type: Comment
has text: Thanks for the help I am now making progress

http://stackoverflow.com/comment/38512234
score: 1
comment on: http://stackoverflow.com/q/24810287
has text: why not use `pq.add(p)` in your registerPatient method?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/51867820
answers question: http://stackoverflow.com/q/24885223
has comment: http://stackoverflow.com/comment/129506516
has comment: http://stackoverflow.com/comment/113009172
type: Answer
upvote count: 16
has body: RecyclerView doesn't have an onItemClickListener because RecyclerView is responsible for recycling views (surprise!), so it's the responsibility of the view that is recycled to handle the click events it receives. This actually makes it much easier to use, especially if you had items that can be clicked in multiple places. Anyways, detecting click on a RecyclerView item is very easy. All you need to do is define an interface (if you're not using Kotlin, in which case you just pass in a lambda): public class MyAdapter extends RecyclerView.Adapter&lt;MyViewHolder&gt; { private final Clicks clicks; public MyAdapter(Clicks clicks) { this.clicks = clicks; } private List&lt;MyObject&gt; items = Collections.emptyList(); public void updateData(List&lt;MyObject&gt; items) { this.items = items; notifyDataSetChanged(); // TODO: use ListAdapter for diffing instead if you need animations } public interface Clicks { void onItemSelected(MyObject myObject, int position); } public class MyViewHolder extends RecyclerView.ViewHolder { private MyObject myObject; public MyViewHolder(View view) { super(view); // bind views view.setOnClickListener((v) -&gt; { int adapterPosition = getBindingAdapterPosition(); if(adapterPosition &gt;= 0) { clicks.onItemSelected(myObject, adapterPosition); } }); } public void bind(MyObject myObject) { this.myObject = myObject; // bind data to views } } } Same code in Kotlin: class MyAdapter(val itemClicks: (MyObject, Int) -&gt; Unit): RecyclerView.Adapter&lt;MyViewHolder&gt;() { private var items: List&lt;MyObject&gt; = Collections.emptyList() fun updateData(items: List&lt;MyObject&gt;) { this.items = items notifyDataSetChanged() // TODO: use ListAdapter for diffing instead if you need animations } inner class MyViewHolder(val myView: View): RecyclerView.ViewHolder(myView) { private lateinit var myObject: MyObject init { // binds views myView.onClick { val adapterPosition = getBindingAdapterPosition() if(adapterPosition &gt;= 0) { itemClicks.invoke(myObject…
score: 16
has comment: http://stackoverflow.com/comment/113043535
downvote count: 0

function
tags question: http://stackoverflow.com/q/24902849
tag name: function
tags question: http://stackoverflow.com/q/24808000
type: Tag

http://stackoverflow.com/q/24894428
tagged with: java
has title: Java7u65/Java8u11 - %20 is illegal in any URL contained in the JNLP file?
tagged with: java-web-start
upvote count: 2
favorite count: 0
has body: I have an application that worked perfectly fine with all of the Java 7 and Java 8 releases prior to the latest updates (Java7u65 and Java8u11). The problem seems to be that I escape a space in the URL and replace it with "%20" which is the correct replacement for a space charater in a URL but Java Web Start is complaining about it and just removing the URL entirely from the parsed JNLP file. For some reason the latest version of Java spits out the following message when parsing the JNLP file: security: Rejecting argument with illegal chars: http://www.somewebitenamehere.net/path%20with%20spaces/ What could have changed in the latest update that is now causing this message? Any help would be appreciated. Thanks.
type: UnansweredQuestion
score: 2
answer count: 0
downvote count: 0
type: Question

http://stackoverflow.com/a/24766942
answers question: http://stackoverflow.com/q/24766860
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24766860
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The why is simple and straightforward: because when a class is loaded, all the classes referenced by it are loaded too. (In fact they are loaded first.) Avoiding it isn't too complicated either, although the code won't look nice: you need to load the class with reflection, using Class.forName(), find the constructor you want from the array returned by Class.getConstructors() and then create an instance using Constructor.newInstance(). Note that while if it only happens a few times in your code, this solution is fine, if you find yourself doing this a lot then you should probably look for a dependency injection framework that will do the heavy lifting for you.
type: Answer

http://stackoverflow.com/comment/104303033
type: Comment
comment on: http://stackoverflow.com/a/59001641
type: AnswerComment
has text: I don't remember how I've resolved it, but anyway thanks for your answer!
score: 0

http://stackoverflow.com/a/24768458
upvote count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/42323147
type: Answer
answers question: http://stackoverflow.com/q/24768114
score: -5
has body: executing queries manually usually leads into many different problems - all of which are platform-specific and DB-specific. I think your best answer will be : "switch to ORM". This framework has proven to be exceptionally good, wrappig all your SQL-data into Entities and transactions (if required) will resolve most of your problems at the same time - you will only need to annotate your entities and relationships correctly. Database-queries can be executed via JPA-"criteria"s which are platform-independent AND allow you to avoid a lot of problems as well as making your code READABLE. Tutorial : http://www.vogella.com/tutorials/JavaPersistenceAPI/article.html SO-question : https://stackoverflow.com/questions/743065/what-is-the-fastest-way-to-learn-jpa With JPA, you wont need to care about statements or queries anymore (well, at least most of the time) and your mentioned problem will disappear - PLUS : it only takes 30-60min to implement. Additional tip : use Maven &amp; Eclipselink (JPA2 implementation) - thats a very powerful, portable combination
has comment: http://stackoverflow.com/comment/38526732
has comment: http://stackoverflow.com/comment/38465321

http://stackoverflow.com/a/26641388
has comment: http://stackoverflow.com/comment/42940775
has comment: http://stackoverflow.com/comment/54126985
has comment: http://stackoverflow.com/comment/51508695
has comment: http://stackoverflow.com/comment/42027250
has comment: http://stackoverflow.com/comment/63866674
has comment: http://stackoverflow.com/comment/63737288
has comment: http://stackoverflow.com/comment/53928273
has comment: http://stackoverflow.com/comment/55137901
score: 100
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/62633837
downvote count: 0
upvote count: 100
has body: EDIT: The solution that worked for me was (Using Proguard) to replace this: -keep class android.support.v4.** { *; } -keep interface android.support.v4.** { *; } -keep class android.support.v7.** { *; } -keep interface android.support.v7.** { *; } with this: # Allow obfuscation of android.support.v7.internal.view.menu.** # to avoid problem on Samsung 4.2.2 devices with appcompat v21 # see https://code.google.com/p/android/issues/detail?id=78377 -keep class !android.support.v7.internal.view.menu.**,android.support.** {*;} Credit goes to the google group, #138. Old answer (Temporary Workaround): It happens in a project where I use an spinner in the ActionBar. My solution was to check for those conditions and change the app flow: public static boolean isSamsung_4_2_2() { String deviceMan = Build.MANUFACTURER; String deviceRel = Build.VERSION.RELEASE; return "samsung".equalsIgnoreCase(deviceMan) &amp;&amp; deviceRel.startsWith("4.2.2"); } Then in the activity's onCreate method: if (isSamsung_4_2_2()) { setContentView(R.layout.activity_main_no_toolbar); } else { setContentView(R.layout.activity_main); } As pointed out this is not a definitive solution, it is just a way to allow users to have access to limited functionality while a more permanent solution is found.
has comment: http://stackoverflow.com/comment/51405296
has comment: http://stackoverflow.com/comment/58216935
has comment: http://stackoverflow.com/comment/41923670
has comment: http://stackoverflow.com/comment/44129031
has comment: http://stackoverflow.com/comment/83548556
type: Answer
accepted answer of: http://stackoverflow.com/q/24809580
answers question: http://stackoverflow.com/q/24809580
has comment: http://stackoverflow.com/comment/43454886
has comment: http://stackoverflow.com/comment/64794041
has comment: http://stackoverflow.com/comment/43415674
has comment: http://stackoverflow.com/comment/58874361
has comment: http://stackoverflow.com/comment/92239997
has comment: http://stackoverflow.com/comment/55709003
has comment: http://stackoverflow.com/comment/43413618
has comment: http://stackoverflow.com/comment/58218425
has comment: http://stackoverflow.com/comment/56360103
has comment: http://stackoverflow.com/comment/46666316
has comment: http://stackoverflow.com/comment/51647881
has comment: http://stackoverflow.com/comment/64793966
has comment: http://stackoverflow.com/comment/54119483
has comment: http://stackoverflow.com/comment/48384479
has comment: http://stackoverflow.com/comment/43638570
has comment: http://stackoverflow.com/comment/42021141

http://stackoverflow.com/comment/61131210
comment on: http://stackoverflow.com/a/25066565
type: AnswerComment
has text: And don't forget to support now getter and setter for the id in the entity class!.. (I forgot it and was searching much time for that)
type: Comment
score: 4

http://stackoverflow.com/a/33744513
answers question: http://stackoverflow.com/q/24897750
has body: I resolved this by redeploying the application. In NetBeans, right-click the project and select Clean and Build. Run your application and voila!
type: Answer
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/93809868
upvote count: 8

http://stackoverflow.com/comment/38591760
type: Comment
has text: Thank you Will, I only can thanks for that because I dont have engouh reputation to vote up your answer.
comment on: http://stackoverflow.com/a/24831660
type: AnswerComment
score: 0

header
type: Tag
tags question: http://stackoverflow.com/q/24761293
tag name: header

http://stackoverflow.com/q/24821682
answer count: 3
upvote count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/24823739
favorite count: 0
has title: Getting Error While using Hibernate 4.0.1 + Spring 3.2.5 in java
possible better answer: http://stackoverflow.com/a/24823739
tagged with: spring
has answer: http://stackoverflow.com/a/24825873
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24822641
accepted answer: http://stackoverflow.com/a/24822641
downvote count: 0
score: 1
type: Question
tagged with: java
tagged with: hibernate
has body: I am trying to make Simple Crud Application using Spring hibernate. code is working but its not just Redirecting page. and its giving 404 Error and i have check that file is in same path. Here my Controller is import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.verve.Model.EmployeeEntity; import com.verve.service.EmployeeManager; @Controller public class EditEmployeeController { @Autowired private com.verve.service.EmployeeManager employeeManager; @RequestMapping(value = "/", method = RequestMethod.GET) public String listEmployees(ModelMap map) { map.addAttribute("employee", new EmployeeEntity()); map.addAttribute("employeeList", employeeManager.getAllEmployees()); return "editEmployeeList"; } @RequestMapping(value = "/add", method = RequestMethod.POST) public String addEmployee(@ModelAttribute(value="employee") EmployeeEntity employee, BindingResult result) { employeeManager.addEmployee(employee); return "redirect:/"; } @RequestMapping("/delete/{employeeId}") public String deleteEmplyee(@PathVariable("employeeId") Integer employeeId) { employeeManager.deleteEmployee(employeeId); return "redirect:/"; } public void setEmployeeManager(EmployeeManager employeeManager) { this.employeeManager = employeeManager; } } and threw that my Method is called. and my index.jsp is &lt;html&gt; &lt;body&gt; &lt;h2&gt;Hello World!&lt;/h2&gt; &lt;jsp:forward page="/"&gt;&lt;/jsp:forward&gt; &lt;/body&gt; &lt;/html&gt; my web.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"…

http://stackoverflow.com/q/24863959
tagged with: java
has answer: http://stackoverflow.com/a/24874267
answer count: 2
linked to: http://stackoverflow.com/q/4371505
has title: Quartz Scheduler throws java.lang.OutOfMemoryError: GC overhead limit exceeded
score: 0
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/24868462
type: UnansweredQuestion
has body: Quartz Scheduler throws java.lang.OutOfMemoryError: GC overhead limit exceeded Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded at com.mysql.jdbc.SingleByteCharsetConverter.toString(SingleByteCharsetConverter.java:327) at com.mysql.jdbc.ResultSetRow.getString(ResultSetRow.java:819) at com.mysql.jdbc.ByteArrayRow.getString(ByteArrayRow.java:70) at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5816) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5693) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5733) Our application has 1.5GB of heap space, But it still throws it. I did profiling and couldn't find any leak in our code. Please help me to resolve this
tagged with: quartz-scheduler
tagged with: garbage-collection
type: Question

http://stackoverflow.com/comment/38476948
has text: Thank you. I feel like an idiot that I didn't see it but I really appreciate the help.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24791245

http://stackoverflow.com/comment/38405891
has text: @Mayur, also include what the rendered output looks like (view page source) and copy the script part
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24752529
type: Comment

http://stackoverflow.com/q/24765731
has title: Why isEnable is not called to handler?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24766281
type: Question
tagged with: eclipse-rcp
score: 0
accepted answer: http://stackoverflow.com/a/24766281
has body: I have command with button on toolbar. I have logic for the visibility button. In some cases the logic is not trigger by eclipse. It occurred when I move to new Eclipse ( luna ) this is the manifest </extension The Handler that doesn't called all the time public class RunObjectHandler extends AbstractActionHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { ............. } @Override public boolean isEnabled() { } } maybe I need to add some logic to the manifest ??
answer count: 1
tagged with: eclipse-plugin

http://stackoverflow.com/q/24823065
has comment: http://stackoverflow.com/comment/38752567
tagged with: java
has comment: http://stackoverflow.com/comment/38536130
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/38752658
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/38542578
has comment: http://stackoverflow.com/comment/38538915
has comment: http://stackoverflow.com/comment/38536181
has title: import file.exe into Android
answer count: 0
score: 0
type: UnansweredQuestion
has body: I have an exe file generated from a C library using Visual Studio. I want to call it from Android. is that possible? If i can generate a ready file.so and add it as a jni project into android, without the need to change the C code.

http://stackoverflow.com/q/24844987
tagged with: design-patterns
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38577286
has answer: http://stackoverflow.com/a/24853161
type: Question
accepted answer: http://stackoverflow.com/a/24853161
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24845054
has comment: http://stackoverflow.com/comment/38577371
has title: What code design should I use in this case?
has body: Let's suppose I have following code (two almostly similar methods is the API requirement): method1() { ... internalMethod(); ... } method2() { ... internalMethod(); ... } internalMethod() { ... internalMethodHelper(); ... } internalMethodHelper() { ... } And suppose I need to add new one method3(), which implementation requires another signature for internalMethod() and internalMethodHelper(). So, as I think, there is only one way to resolve this situation: method1() { ... internalMethod(sign1); ... } method2() { ... internalMethod(sign1); ... } method3() { ... internalMethod(sign2); ... } internalMethod(sign1) { ... internalMethodHelper(sign1); ... } internalMethod(sign2) { ... internalMethodHelper(sign2); ... } internalMethodHelper(sign1) { ... } internalMethodHelper(sign2) { ... } Am I right ? Or it's a very bad code design to overload methods in this case? Thanks for all of your answers!
has answer: http://stackoverflow.com/a/24845054

http://stackoverflow.com/comment/38508833
type: Comment
comment on: http://stackoverflow.com/q/24805540
has text: @Gimby I've worked with Node.js, how would I go approaching it? For example, something simple like just retrieving a file from the tomcat server?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38577969
type: Comment
type: AnswerComment
has text: @bradc14 a drive-by downvoter, or probably someone holding a grudge. Unfair, but who cares...
score: 0
comment on: http://stackoverflow.com/a/24845177

http://stackoverflow.com/comment/43937889
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24867010
type: AnswerComment
has text: Did you even read the question? it's JSON to POJO, not the other way round!

http://stackoverflow.com/comment/38693093
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24905988
has text: Are you saying to not create custom swing components by etending them, but to create instances of them and then add functionality?
score: 0

http://stackoverflow.com/comment/38731812
comment on: http://stackoverflow.com/a/24871114
score: 0
type: AnswerComment
has text: yes exactly. but i don't have the TIFF images but fileinputstream of those images. Is there any way to do this? I am able to create two TIFF images from the inputstreams and save them to a outputstream and then merge them but I want to avoid the saving of the images and then merging.
type: Comment

http://stackoverflow.com/comment/38495417
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24801054
score: 0
has text: return Response.status(Status.OK).entity(JaxbObject).build();

http://stackoverflow.com/q/24908157
has title: ERROR"class,interface or enum expected"
has comment: http://stackoverflow.com/comment/38697166
has answer: http://stackoverflow.com/a/24908259
type: UnansweredQuestion
score: -4
duplicate of: http://stackoverflow.com/q/21699574
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/38697140
tagged with: java
has comment: http://stackoverflow.com/comment/38697799
type: Question
has comment: http://stackoverflow.com/comment/38697091
linked to: http://stackoverflow.com/q/17887093
linked to: http://stackoverflow.com/q/21699574
has body: I want to know that what does the error " class,interface or enum expected" means and how to resolve this error?
has answer: http://stackoverflow.com/a/24908198
answer count: 2
has comment: http://stackoverflow.com/comment/38697102
favorite count: 0

http://stackoverflow.com/comment/38565649
comment on: http://stackoverflow.com/a/24838389
has text: Thanks for your time, we have profiled, identified XML unmarshalling is the bottleneck, now I am investigating alternatives
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24872165
answers question: http://stackoverflow.com/q/24872009
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38630593
upvote count: 3
score: 3
has body: You can wrap the code to be executed in a separate thread in your own code that has a try/ finally block, and call the run method of the "real" Runnable from the try, like this: final Runnable realRunnable = ... // This is the actual logic of your thread (new Thread(new Runnable() { public void run() { try { realRunnable.run(); } finally { runCleanupCode(); } } })).start(); The code of runCleanupCode() will be executed in the same thread that was used to run the logic of your actual thread.
accepted answer of: http://stackoverflow.com/q/24872009

http://stackoverflow.com/comment/38440617
type: AnswerComment
has text: String str = "12 . 12 is a float number." target: "12,12 is a float number."
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24772286

http://stackoverflow.com/a/24892512
has body: Unknown keywords in JSON Schema are ignored, so your schema will still be perfectly functional, and all tools should support it. The new functionality/keywords can just be added to whatever tools you need. If you're making a custom extension, it would be best-practice to document your extensions in a meta-schema (which extends from http://json-schema.org/draft-04/schema#) and reference that in $schema.
type: Answer
accepted answer of: http://stackoverflow.com/q/24879668
score: 0
answers question: http://stackoverflow.com/q/24879668
type: AcceptedAnswer

http://stackoverflow.com/q/24834327
upvote count: 0
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/24834939
type: Question
has comment: http://stackoverflow.com/comment/38557678
has body: I'm trying to use the items of one array within a for loop that is looping through another array. For example, I want to display the item name (an array that already exists) when asking for the price of each of these items. "What price is item[i]". I don't think you can use item[i] in this instance. I've also tried using a get method and using a counter variable, but I must be doing something wrong. The readPrice portion isn't working - specifically the item[i]. Does anyone have a suggestion how to accomplish the same thing without using item[i]? I'm new to java, so I'm sorry if this is an obvious answer, but I would really appreciate the help! Here is my code: private String[] items; private int[] priority; private double[] price; public void readInput() { Scanner keyboard = new Scanner(System.in); System.out.println("You will need to enter seven shopping items."); items = new String[7]; for (int i = 0; i &lt; items.length; i++) { System.out.println("Enter an item: "); items[i] = keyboard.nextLine(); } } **public void readPrice()** { price = new double[7]; Scanner keyboard = new Scanner(System.in); for(int i = 0; i &lt; price.length; i++) { System.out.println("Enter the price for " + **items[i]**); price[i] = keyboard.nextDouble(); } }
has answer: http://stackoverflow.com/a/24834491
has answer: http://stackoverflow.com/a/24834559
has title: reference array in another array loop
answer count: 3
tagged with: for-loop
tagged with: arrays
has comment: http://stackoverflow.com/comment/38557654
favorite count: 0
has comment: http://stackoverflow.com/comment/38557695
type: UnansweredQuestion
downvote count: 4

http://stackoverflow.com/q/24889972
has comment: http://stackoverflow.com/comment/38664009
tagged with: range
has body: While I'm trying to edit groovy.lang.Range with subscript operator I have an error java.lang.UnsupportedOperationException whilst for java.util.List all goes fine. There're no sign in the Groovy Range API that the collection is immutable. Have you any ideas what's wrong with Range\with my code? The code is below: def list = "a".."c" assert list instanceof java.util.List assert list.size() == 3 list[2] = "d" The console output: Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.set(AbstractList.java:132) at org.codehaus.groovy.runtime.DefaultGroovyMethods.putAt(DefaultGroovyMethods.java:6607) &lt;6 internal calls&gt; at Hello.run(Hello.groovy:4) &lt;15 internal calls&gt; at Hello.main(Hello.groovy) &lt;5 internal calls&gt; Update: Groovy Version: 1.8.6 JVM: 1.6.0_45 Vendor: Sun Microsystems Inc. OS: Linux
score: 2
type: AnsweredQuestion
tagged with: list
tagged with: java
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/38663382
has comment: http://stackoverflow.com/comment/38665534
accepted answer: http://stackoverflow.com/a/24890479
has title: Why does Range throw UnsupportedOperationException?
upvote count: 3
has comment: http://stackoverflow.com/comment/38665840
tagged with: groovy
downvote count: 1
has answer: http://stackoverflow.com/a/24890479
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38638041
comment on: http://stackoverflow.com/a/24876372
type: Comment
has text: This is no doubt helpful, `System.out.println(newBigInteger(int radix).toString(2));` however this is a String input that I want to write as text and then put into a new binary file. Not something confusing for the consumer of the software I want to make.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38555815
has text: It sounds like a single image being rotated, not a set of images, so that wouldn't apply... Have you tried not using any of the animation objects and manually handling the rotation via the View's onDraw method (ie. using canvas to rotate the drawable being displayed) and then having a separate Thread handle the "animation" (ie. increment the animation speed by reducing the sleep time between invalidation calls)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24833024
score: 0

http://stackoverflow.com/comment/38561599
has text: Just to understand where you're coming from... Is this question out of intellectual curiosity, or are you actually worried that evaluating each branch of the OR is too slow for you?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24836588

http://stackoverflow.com/q/24838008
answer count: 3
has answer: http://stackoverflow.com/a/24839138
has body: For some reason a piece of my code only works with OPs. And this piece of code is probably one of the only ones that is meant to NOT work with OPs. My code is at: http://pastebin.com/sQeeXRNN Now, the bit that isn't working is the @EventHandler public void onInventoryClick(InventoryClickEvent event) { if(!event.getWhoClicked().isOp()) { //rest of it Which as the if(!event.getWhoClicked().isOp()) { is clearly stating as only working for people who aren't Op. I have tried without the if statement and it still only works for OPs. Any ideas? Thanks, Jay
has comment: http://stackoverflow.com/comment/38564176
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38573230
has title: Bukkit - Why does a certain piece of code only work on OPs?
tagged with: java
tagged with: bukkit
has answer: http://stackoverflow.com/a/24843393
type: Question
has answer: http://stackoverflow.com/a/31195996
score: 0

http://stackoverflow.com/a/24878637
score: 0
has body: You can also use apache commons ListUtils ListUtils.union(existingIDS ,newIDSToWrite ); You can find the documentation here. For the second part of the question you can use the same logic as the question you has asked earlier but a little modification delete intersecting values in an arraylist (1, 3) (2, 4) (5, 6) curmax = -inf curmax = 3 2 &lt; 3 - mark first and second as "bad". curmax = 4 Update value of 2 to (3+1) 5 > 4 - do nothing. curmax = 6. (5,6) - is the only good segment.
has comment: http://stackoverflow.com/comment/38641978
answers question: http://stackoverflow.com/q/24878589
type: Answer

http://stackoverflow.com/comment/38491043
has text: Mr Java O'Reilly.. I want to meet this guy.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24798961

http://stackoverflow.com/a/24853637
answers question: http://stackoverflow.com/q/24853071
upvote count: 1
has body: Use the following method private String getFileName(Part p){ String header=p.getHeader("content-disposition"); String filename = header.substring(header.indexOf("filename=\"")).split("\"")[1]; //getting filename return filename; } The snippet is taken from my blog here
has comment: http://stackoverflow.com/comment/38604878
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24853071

http://stackoverflow.com/comment/38436386
type: QuestionComment
has text: It shows 3 instead of 3.00
score: 1
comment on: http://stackoverflow.com/q/24770080
type: Comment

http://stackoverflow.com/a/24964343
has body: If you are on Java, could use reflections to check if a function is available and execute it, too
upvote count: 3
answers question: http://stackoverflow.com/q/24883075
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/38804356
type: Answer

http://stackoverflow.com/q/24774373
type: Question
has comment: http://stackoverflow.com/comment/38444407
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38445854
has comment: http://stackoverflow.com/comment/38444280
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24775228
tagged with: java
has body: I am trying to download a image from url and converting it to Bitmap The corresponding code is: Bitmap pinbit=ImageDownloader.DownloadImage(URL_image+s.category+".png"); pinbit=Bitmap.createScaledBitmap(pinbit,75,56,false); marker.icon(BitmapDescriptorFactory.fromBitmap(pinbit)); The class i used for downloading image is: package com.igloo.classes; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class ImageDownloader { public static InputStream OpenHttpConnection(String urlString) throws IOException { InputStream in = null; int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); if (!(conn instanceof HttpURLConnection)) throw new IOException("Not an HTTP connection"); try{ HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET"); httpConn.connect(); response = httpConn.getResponseCode(); if (response == HttpURLConnection.HTTP_OK) { in = httpConn.getInputStream(); } } catch (Exception ex) { throw new IOException("Error connecting"); } return in; } public static Bitmap DownloadImage(String URL) { Bitmap bitmap = null; InputStream in = null; try { in = OpenHttpConnection(URL); bitmap = BitmapFactory.decodeStream(in); in.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } return bitmap; } } The code works on older devices like android 2.6 but when i ran on a new samsung tablet , the line: Bitmap pinbit=ImageDownloader.DownloadImage(URL_image+s.category+".png");' shows NullPointerException. Please help!
has title: Downloading bitmap image from URL in android not working

http://stackoverflow.com/comment/38637600
score: 0
type: Comment
has text: @user2559503 You probably shouldn't accept my answer because it doesn't explain your problem, but just provides way around (which I am not sure why even works while code from your question doesn't). I would leave this question without acceptance mark until someone will actually provide confirmed logical explanation of your problem. Give it a few days maybe, I can try to add bounty to this question later so maybe someone will figure it out.
comment on: http://stackoverflow.com/a/24874476
type: AnswerComment

http://stackoverflow.com/comment/75858933
type: AnswerComment
score: 0
type: Comment
has text: Referring to your update: You can now use `@ControllerAdvice` to define define global exception handlers.
comment on: http://stackoverflow.com/a/24812151

http://stackoverflow.com/a/24876273
has body: It is tough to answer this question without more detail on the specifics, and/or seeing the code being used. That said, the issue you describe does sound like a cookie issue since that is what is generally used to maintain web application state. As I see it, there are four possibilities: You are not correctly retrieving and setting the cookie necessary to maintain a session with Amazon. The login is failing, so no cookie is even sent or set, and thus this is the reason the login page is being returned again. The url you are attempting to access with your failing get includes a CSRF token which you are not correctly parsing from a prior page. Other technical issues to do with session management are not being met (perhaps cross domain related issues, or perhaps Amazon has implemented protections to prevent automated access).
has comment: http://stackoverflow.com/comment/38910213
answers question: http://stackoverflow.com/q/24875982
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24875982

http://stackoverflow.com/a/24789846
has comment: http://stackoverflow.com/comment/38474405
answers question: http://stackoverflow.com/q/24789755
has body: You can add a Component like JLabel/JTextField and use setVisible(false). That object can hold strings. note: Only for Buttons. You could use setAtionCommand() but it is indented for something very specific. It would be horrible practice for anything else.
upvote count: 1
downvote count: 1
score: 0
type: Answer

http://stackoverflow.com/comment/38737314
comment on: http://stackoverflow.com/a/24828356
has text: You might have other action mapping. You didn't post `struts.xml`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38521129
type: Comment
comment on: http://stackoverflow.com/a/24814733
has text: @cgon No new memory is allocated beyond the few bytes needed for a reference, because only the reference itself is copied -- not the object itself. Using `final` should not affect whether you have any open connections, because `final` only affects the reference to the object, and does not change the object itself. As for closing it, just treat the `Connection` normally. `final` shouldn't make a difference as to when you close your connection.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24842754
has comment: http://stackoverflow.com/comment/38573365
has answer: http://stackoverflow.com/a/24848802
tagged with: javascript
tagged with: jquery
type: UnansweredQuestion
has title: jQuery js file not loading
tagged with: servlets
has comment: http://stackoverflow.com/comment/38573246
has comment: http://stackoverflow.com/comment/38573401
has body: Why my custom js is loading but jquery-1.11.1.js is not loading, tried placing it in same folder as my custom js(StartPage.js), but still on firebug console its showing not found. title <%@ include file="/html/StartPage.html"%>
has answer: http://stackoverflow.com/a/24842983
has comment: http://stackoverflow.com/comment/38573078
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38573222
tagged with: spring
has comment: http://stackoverflow.com/comment/38573891
score: 0
tagged with: java

http://stackoverflow.com/q/24848979
tagged with: java
linked to: http://stackoverflow.com/q/7759948
has comment: http://stackoverflow.com/comment/38585061
accepted answer: http://stackoverflow.com/a/24849064
answer count: 1
tagged with: minecraft
score: 0
tagged with: batch-file
tagged with: client
has title: Separating a Client and Server into different cores in a batch script
has answer: http://stackoverflow.com/a/24849064
type: Question
type: AnsweredQuestion
has body: I'm trying to find a way to make two processes; java and javaw separate over a set of cores (0-1 and 6-7) to make the programme I'm running go faster as I am using a client and server and both will only use a maximum of two cores, no more each. I can do this manually, but would like to find a less time taking method of getting it done.

http://stackoverflow.com/q/24786962
score: 5
tagged with: locale
answer count: 1
favorite count: 0
upvote count: 5
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24807860
accepted answer: http://stackoverflow.com/a/24807860
downvote count: 0
has title: Define default locale and treat exceptions for Spring Locale Interceptor
tagged with: spring
type: Question
tagged with: spring-mvc
has body: Is it possible to define a default locale that should be loaded in case the user sets ?lang=unknownlang ? In my spring-servlet.xml i have: <property name="paramName" value="lang" /> <property name="defaultLocale" value="pt" /> Also if i specify invalid characters in my url param like ?lang=p@t, spring throws an exception that should be handled, how would i go about that ? Error 500: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Locale part "'" contains invalid characters
tagged with: java

http://stackoverflow.com/q/24818614
upvote count: 0
has title: Which MongoDB framework is best to use with java and spring?
answer count: 1
favorite count: 0
has body: I am new to the MongoDb will any one please tell me that which framework is best to use with java and spring. Also please suggest me the links to refer that how to design DB and relation between document. Thanks for the help.
type: UnansweredQuestion
tagged with: spring
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24819613
tagged with: java
score: -1

tesseract
tags question: http://stackoverflow.com/q/24799038
type: Tag
tag name: tesseract

http://stackoverflow.com/comment/44093667
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24864724
has text: this didnt work for me, still geting Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

sqlite
tags question: http://stackoverflow.com/q/24858791
tags question: http://stackoverflow.com/q/24817098
tags question: http://stackoverflow.com/q/24853677
tags question: http://stackoverflow.com/q/24751897
tags question: http://stackoverflow.com/q/24751846
tags question: http://stackoverflow.com/q/24781713
tags question: http://stackoverflow.com/q/24757983
type: Tag
tags question: http://stackoverflow.com/q/24899987
tags question: http://stackoverflow.com/q/24835008
tags question: http://stackoverflow.com/q/24909106
tags question: http://stackoverflow.com/q/24797635
tags question: http://stackoverflow.com/q/24838329
tags question: http://stackoverflow.com/q/24787517
tags question: http://stackoverflow.com/q/24857193
tags question: http://stackoverflow.com/q/24869445
tags question: http://stackoverflow.com/q/24806919
tags question: http://stackoverflow.com/q/24797303
tags question: http://stackoverflow.com/q/24832956
tags question: http://stackoverflow.com/q/24884032
tags question: http://stackoverflow.com/q/24826509
tags question: http://stackoverflow.com/q/24872548
tags question: http://stackoverflow.com/q/24831647
tags question: http://stackoverflow.com/q/24879996
tags question: http://stackoverflow.com/q/24901978
tags question: http://stackoverflow.com/q/24791901
tags question: http://stackoverflow.com/q/24756362
tag name: sqlite

http://stackoverflow.com/q/24853763
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38594260
accepted answer: http://stackoverflow.com/a/24853780
type: Question
upvote count: 4
has title: Assigning values in JAVA
downvote count: 4
tagged with: variables
has body: I have this line of code from a tutorial while((line = bufferedReader.readLine()) != null) It worked fine but i don't get the concept. Does Java asign a value to the operation itself line = bufferedReader.readLine()? After that looks like: line and line = bufferedReader.readLine() has the same value?. Trying to get it i tested String a = "Not null"; String b; System.out.println( (b = a) ); The output was: Not null. The question is. The operaton of assigning itself has (At least for an instant) the same value of whatever is at the right of "="?.
score: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24853782
has answer: http://stackoverflow.com/a/24853780
has answer: http://stackoverflow.com/a/24853880
answer count: 5
has answer: http://stackoverflow.com/a/24853824
has answer: http://stackoverflow.com/a/24853782
has answer: http://stackoverflow.com/a/24853843
has comment: http://stackoverflow.com/comment/38594293

http://stackoverflow.com/a/24775405
type: Answer
answers question: http://stackoverflow.com/q/24775271
upvote count: 1
has body: Splitter is a class from the Guava library: javadoc here. Once you have Guava available on your classpath you just need to usecom.google.common.base.Splitter
score: 1
downvote count: 0

http://stackoverflow.com/q/24821983
score: 9
type: Question
has body: My code is like below @Test public void testMyMethod(){ MyClass mc = new MyClass(); String exeVal="sometext some text"; String x=mc.exampleMethod(); // Assertion type 1 Assert.assertEquals(exeVal,x); //Assertion Type 2 Assert.assertTrue(exeVal.equals(x)); } I want to know which is the best approach.
has comment: http://stackoverflow.com/comment/38533914
answer count: 2
has comment: http://stackoverflow.com/comment/38533972
has comment: http://stackoverflow.com/comment/38533960
tagged with: junit
possible better answer: http://stackoverflow.com/a/58832884
favorite count: 0
has answer: http://stackoverflow.com/a/24822058
accepted answer: http://stackoverflow.com/a/24822058
has title: JUnit which is recommended assertTrue() or assertEquals() for String?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/58832884
upvote count: 10
downvote count: 1

http://stackoverflow.com/a/24859006
type: Answer
has comment: http://stackoverflow.com/comment/38604717
has comment: http://stackoverflow.com/comment/38604691
accepted answer of: http://stackoverflow.com/q/24858978
answers question: http://stackoverflow.com/q/24858978
has comment: http://stackoverflow.com/comment/38604785
score: 4
upvote count: 4
type: AcceptedAnswer
has body: There's a spelling mistake... public void paintCompent(Graphics g) { should be public void paintComponent(Graphics g) { This is why you should use the @Override annotation, as it will give you a compile time error when you try to override a method that doesn't exist within the parent hierarcy. You should also be calling super.paintComponent(g); before performing any custom painting
downvote count: 0

http://stackoverflow.com/a/24820787
answers question: http://stackoverflow.com/q/24820443
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The Java specification says that the right hand expression is not evaluated if the left hand one is true. Same seems to be true of C#. If you look into C and C++ specifications presumably they'd say the same thing.
has comment: http://stackoverflow.com/comment/38532222

http://stackoverflow.com/a/24792625
upvote count: 1
has body: Define your class like this: public abstract class TouchableSpan extends ClickableSpan { private Object mTag; public void setTag(Object tag) { mTag = tag; } public Object getTag() { return mTag; } @Override public void onClick(View widget) { this.setPressed(true); // GET TAG INFO HERE. BUT HOW? // Just access mTag here } private boolean mIsPressed; public void setPressed(boolean isSelected) { mIsPressed = isSelected; } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(Color.BLACK); ds.bgColor = mIsPressed ? selectedHlColor : 0xffeeeeee; ds.setUnderlineText(false); } } Then create your TouchableSpan like this: TouchableSpan touchableSpan = new TouchableSpan(); touchableSpan.setTag("tag"); // you can use any Object here, e.g. a String spannablesstringbuilder.setSpan(touchableSpan, index+2, index2, 0); You can use your original approach too and extend ClickableSpan twice but this is probably cleaner and you can re-use your TouchableSpan class in other Activities or projects.
answers question: http://stackoverflow.com/q/24792353
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/24903771
score: 0
answer count: 1
tagged with: javascript
favorite count: 0
has comment: http://stackoverflow.com/comment/38689650
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/24904054
has body: How to implement windows authentication in spring based Java-application? I have created authentication using spring security,But i want to use windows credential while user login to my application.
tagged with: java
has title: How to implement windows authentication in spring based Java-application?

http://stackoverflow.com/q/24849257
tagged with: java
type: Question
tagged with: thumbnails
downvote count: 0
has title: Arbitrary file preview in Node-Webkit using JS, Java and/or Ruby
tagged with: preview
favorite count: 0
tagged with: ruby
upvote count: 2
type: UnansweredQuestion
tagged with: node-webkit
score: 2
answer count: 0
has body: I want to develop a file-previewer for Node-Webkit. It should be able to handle most file types like .pdf, .pptx, .txt, .docx, .png +++ Some file types are trivial, like images, but others are harder. I have been digging around a lot and found a few things that could work. I found crocodoc which does something similar to what I am thinking of. I also found pdf.js, but as the name suggests, it only does PDFs. I have considered an approach where I generate image thumbnails of the files before previewing. It is simply a previewer, not a full reader. For this I found the java library thumbnailer which seems to do the trick, but it is in beta and is very inactive. The tools that I have at my disposal for this project are Javascript (in Node-Webkit), Java and Ruby. Are there any existing projects that dose this that I can use without paying a license to Crocodoc &amp; Co.? If not, are there any good and active libraries for file-to-thumbnail conversion?

http://stackoverflow.com/a/24840717
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38569444
has comment: http://stackoverflow.com/comment/38569605
answers question: http://stackoverflow.com/q/24840534
has body: Your error indicates that your code is not recompiled after change in dependencies. Just perform Maven update dependencies and then run mvn clean install and redeploy your artifacts.
has comment: http://stackoverflow.com/comment/38570161
has comment: http://stackoverflow.com/comment/38588614

http://stackoverflow.com/comment/38604155
comment on: http://stackoverflow.com/q/24853949
type: Comment
type: QuestionComment
has text: see this http://stackoverflow.com/questions/21426519/spring-mvc-pass-same-object-between-controller
score: 1

http://stackoverflow.com/comment/38485717
type: QuestionComment
score: 3
has text: This has nothing to do with Hibernate, you don't have Log4J on your classpath, and Hibernate expects Log4J to be available.
comment on: http://stackoverflow.com/q/24796112
type: Comment

http://stackoverflow.com/comment/38480068
comment on: http://stackoverflow.com/q/24792970
has text: what IDE do you use, if you use Netbeans in project properties set the JDK to 8
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24791122
has title: Making both BufferedImages overlap and transparent
tagged with: bufferedimage
type: Question
has answer: http://stackoverflow.com/a/24804303
has body: So I have searched this question and got many hits and therefore I was able to come up with the code shown below. I am taking images from ImageStack (ImageJ) and I want to overlap two images which are in dicom format (.dcm). My problem is I want both images to be transparent as they overlap each other. I have checked that the images are different when passing to the overlap function and I have tried many things but I can't seem to make the images transparent, they overlap but they are not transparent. Any help would be greatly appreciated. public BufferedImage overlay(BufferedImage bii, BufferedImage biii){ BufferedImage combined = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); Graphics2D go = combined.createGraphics(); image.setSlice(5); ImagePlus hello = new ImagePlus(); hello.setImage(image.getImage()); BufferedImage bello = hello.getBufferedImage(); go.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); go.drawImage(bii,0, 0, null); go.drawImage(biii,98, 98, null); go.setComposite(AlphaComposite.Clear); go.setComposite(AlphaComposite.Src); //go.fillRect(0, 0, 256, 256); go.dispose(); return combined; } Main function: ImageStack stack = image.getStack(); Calibration cal = image.getCalibration(); ImagePlus newImp = new ImagePlus( ); stack.getSliceLabel(5); stack.getProcessor(5); newImp.setCalibration( cal ); ImageProcessor ip = stack.getProcessor(1); // specify number of slice newImp.setProcessor(ip); ImagePlus no3 = new ImagePlus(); no3.setImage(newImp.getImage()); BufferedImage bii= no3.getBufferedImage(); ImagePlus bob = new ImagePlus( ); stack.getSliceLabel(33); stack.getProcessor(33); bob.setCalibration( cal ); ImageProcessor bobp = stack.getProcessor(22); // specify number of slice bob.setProcessor(bobp); ImagePlus hello = new ImagePlus(); hello.setImage(bob.getImage()); BufferedImage bello = hello.getBufferedImage(); BufferedImage overlayy = overlay(bii, bello); frame2 = new NFrame(image.getTitle(), image, save);…
tagged with: imagej
tagged with: java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24804303
type: AnsweredQuestion
tagged with: overlap

http://stackoverflow.com/a/70392991
score: 0
type: Answer
has body: I stuck into similar problem recently. The only solution I've found is to write a full SQL with all conditions which you need and retrieve all IDs of A (if we're creating a filter in the A entity) which matches your requirements and then in the filter check, whether ID is in those IDs or not. It would be something like @FilterDef(name = "filterName", parameters = {@ParamDef(name = "param", type = "string")}, defaultCondition = "id in (select a.id from A a join B b on a.b_id = b.id join C c on b.c_id = c.id where c.some_property = 2)") However, I'm not sure this is a good solution for some large queries.
answers question: http://stackoverflow.com/q/24864099

http://stackoverflow.com/q/24874577
has title: ant-junit 1.5.3 jar is not available
upvote count: 0
answer count: 1
tagged with: junit
favorite count: 0
has comment: http://stackoverflow.com/comment/38634788
tagged with: ant-junit
score: -1
type: UnansweredQuestion
downvote count: 1
has body: I'm working on very old system, we have ant 1.5.3 running and we need to add unit tests to the environment. As far as i have researched, there is no available ant-junit 1.5.3 jar version. did it had a different name before ant-junit-1.7.0? My application says that JUnitTask is not available when compiling. (because ant and ant-junit.jar should be of same version)
tagged with: ant
tagged with: java
has answer: http://stackoverflow.com/a/24876338
type: Question

http://stackoverflow.com/q/24813686
possible better answer: http://stackoverflow.com/a/24813855
tagged with: jpanel
has title: JPanel with FlowLayout not Appearing
upvote count: 2
has answer: http://stackoverflow.com/a/24813697
answer count: 2
has body: I am using the following code for placing labels inside a JPanel, but the JPanel is not appearing (instead, only a blank JFrame is appearing). Below is the class creating a JFrame instance. import java.awt.FlowLayout; import javax.swing.JFrame; public class Main { public static void main(String[] args){ WindowContents window = new WindowContents(); window.setSize(600, 400); window.setVisible(true); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } Below is the class for setting the contents of the JFrame. import javax.swing.*; import java.awt.*; public class WindowContents extends JFrame { JLabel label1; JLabel label2; JLabel label3; JPanel panel1; public WindowContents(){ super("Label Display 2.0"); panel1 = new JPanel(); panel1.setLayout(new FlowLayout(FlowLayout.CENTER, 40, 40)); panel1.setVisible(true); label1 = new JLabel("Label1"); panel1.add(label1); label2 = new JLabel("Label2"); panel1.add(label2); label3 = new JLabel("Label3"); panel1.add(label3); } } Are there any ideas how to make the JPanel contents appear? Thank you.
favorite count: 0
tagged with: jframe
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24813855
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/24813697

http://stackoverflow.com/comment/38477217
comment on: http://stackoverflow.com/a/24789579
score: 0
type: Comment
has text: OH YEAH! And in the future if you post code, it's actually really easy. You can just copy paste in the class(es) and then select it and click ctrl + k. It looks normal now, but before when I copied and pasted it to get a good look at it, i got pretty confused xD
type: AnswerComment

http://stackoverflow.com/q/24796225
has comment: http://stackoverflow.com/comment/38486048
type: Question
tagged with: criteria
tagged with: database
linked to: http://stackoverflow.com/q/4483576
score: 0
accepted answer: http://stackoverflow.com/a/24797021
has title: Nested Query in Hibernate using Criterion
has comment: http://stackoverflow.com/comment/38486336
answer count: 1
has comment: http://stackoverflow.com/comment/38485956
has body: I have a following query where I have to select rows from temporary table created by subquery. select x, y, x from (select x, y, z from some_table where x between x1 and x2) where y like 'y1' order by z by desc I have to use Criteria for fetching result from database I have gone through several examples and documentation for handling subqueries using criteria and detached criteria. I have used Detached query but it is not serving the purpose or I am missing something. I have used following code DetachedCriteria subCriteria = DetachedCriteria.forClass(SomeClass.class) .add(Restrictions.between("x","x1","x2")) .setProjection(Projections.projectionList() .add(Projections.property("x")) .add(Projections.property("y")) .add(Projections.property("z")); List&lt;Object[]&gt; results = session .createCriteria(Program.class) .add(Subqueries.exists(subCriteria)) .add(Restrictions.like("y", "y1")) .addOrder(Order.desc("z")).list();
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: hibernate-criteria
has answer: http://stackoverflow.com/a/24797021

http://stackoverflow.com/q/24813430
tagged with: regex
tagged with: parsing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38520407
type: Question
accepted answer: http://stackoverflow.com/a/24813630
score: 14
has answer: http://stackoverflow.com/a/24813568
tagged with: java
has answer: http://stackoverflow.com/a/24813572
upvote count: 14
has comment: http://stackoverflow.com/comment/38519001
has answer: http://stackoverflow.com/a/24813630
has body: Given a String containing a comma delimited list representing a proper noun &amp; category/description pair, what are the pros &amp; cons of using String.split() versus Pattern &amp; Matcher approach to find a particular proper noun and extract the associated category/description pair? The haystack String format will not change. It will always contain comma delimited data in the form of PROPER_NOUN|CATEGORY/DESCRIPTION Common variables for both approaches: String haystack="EARTH|PLANET/COMFORTABLE,MARS|PLANET/HARDTOBREATHE,PLUTO|DWARF_PLANET/FARAWAY"; String needle="PLUTO"; String result=null; Using String.split(): for (String current : haystack.split(",")) if (current.contains(needle)) { result=current.split("\\|")[1]); break; // *edit* Not part of original code - added in response to comment from Pshemo { Using Pattern &amp; Matcher: Pattern pattern = pattern.compile("(" +needle+ "\|)(\w+/\w+)"); Matcher matches = pattern.matcher(haystack); if (matches.find()) result=matches.group(2); Both approaches provide the information I require. I'm wondering if any reason exists to choose one over the other. I am not currently using Pattern &amp; Matcher within my project so this approach will require imports from java.util.regex And, of course, if there is an objectively 'better' way to parse the information I will welcome your input. Thank you for your time! Conclusion I've opted for the Pattern/Matcher approach. While a little tricky to read w/the regex, it is faster than .split()/.contains()/.split() and, more importantly to me, captures the first match only. For what it is worth, here are the results of my imperfect benchmark tests, in nanoseconds, after 100,000 iterations: .split()/.contains()/.split 304,212,973 Pattern/Matcher w/ Pattern.compile() invoked for each iteration 230,511,000 Pattern/Matcher w/Pattern.compile() invoked prior to iteration 111,545,646
has comment: http://stackoverflow.com/comment/59794977
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38520373
has comment: http://stackoverflow.com/comment/38519264
has title: Java - Parsing strings - String.split() versus Pattern & Matcher
answer count: 3
possible better answer: http://stackoverflow.com/a/24813568

http://stackoverflow.com/q/24788677
upvote count: 2
tagged with: scrollpane
tagged with: javafx
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24789423
type: UnansweredQuestion
score: 2
has body: I'm trying to put a text box (custom rendered) into a ScrollPane except when I hit space to put a space into the text box, space is also the hotkey to scroll down in the scroll pane so it enters the space and than scrolls down in the scroll pane. How do i remove the hotkey that space scrolls down in the ScrollPane? I've been searching through ScrollPane looking for anything relating to vertical scroll bar or hotkey but didn't find anything.
downvote count: 0
favorite count: 0
type: Question
has title: Removing JavaFX Scroll Pane Hotkeys
linked to: http://stackoverflow.com/q/19625218

http://stackoverflow.com/comment/38502484
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24805191
has text: @sbat, I also think that, but what I can change to verify it?
score: 0

http://stackoverflow.com/comment/38451726
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57393/discussion-between-sumeet-sharma-and-muthu-kader).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24778139

http://stackoverflow.com/comment/38411119
type: Comment
comment on: http://stackoverflow.com/a/24752542
has text: Sorry, but I copied an file persistence.xml that is member to a composite persistence unit for this reason there was <property name="eclipselink.composite-unit.member" value="true"/>. Instead the shared-cache-mode disable the second level cache and it work only if you are using eclipseLink like persistence provider. What persistence provider are you using? Anyway good job
score: 0
type: AnswerComment

http://stackoverflow.com/a/24812763
has comment: http://stackoverflow.com/comment/135053060
has comment: http://stackoverflow.com/comment/38517001
score: 1
has comment: http://stackoverflow.com/comment/38516976
has comment: http://stackoverflow.com/comment/38517116
accepted answer of: http://stackoverflow.com/q/24811496
answers question: http://stackoverflow.com/q/24811496
has comment: http://stackoverflow.com/comment/38516915
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/135921870
has body: The problem is due to this phrase: when I run my project's jar If you are using java's standard jar mechanism, it doesnt jar up dependencies. So you still need to add dependencies to the class path. IntelliJ's feature is mostly for running using intelliJ's run option. If you instead run the jar through a command line, you will need to add the dependency to the class path. If you are jaring with intelliJ, the jar is considered an artifact. You need to add the library to your build artifact. Go to Build > Build Artifacts. Hover over the jar and select Edit. You should see the library in the "Available Elements" section. Just double click it so that it gets added to your jar. Then click ok.
has comment: http://stackoverflow.com/comment/135920393
type: Answer

http://stackoverflow.com/a/24866243
has comment: http://stackoverflow.com/comment/38931602
has comment: http://stackoverflow.com/comment/40779372
answers question: http://stackoverflow.com/q/24864595
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38931773
has body: This is happening because the additivity property of the logger is true by default. When this property is true the log messages are propagated to the parent loggers, in your case the ROOT one, I think. Set the additivity property in the logger to false and you will get the desired output. More details here http://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity.
upvote count: 1

http://stackoverflow.com/q/24810655
has answer: http://stackoverflow.com/a/24813144
has comment: http://stackoverflow.com/comment/38512720
downvote count: 0
has title: Having trouble sending JavaMail over company domain
tagged with: smtp
favorite count: 0
tagged with: jakarta-mail
has body: I am using JavaMail to automate a process at work. I want to send the email with JavaMail with both emails ending with @business.com. Here's a snippet: String host = "smtp.fakename.com"; Properties props = new Properties(); props.put("mail.debug", "true"); props.put("mail.smtp.host", host); try { Session session = Session.getDefaultInstance(props, null); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("fakename@business.com")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress("anotherfakename@business.com", "Name")); msg.setSubject("Test E-Mail through Java"); Transport.send(msg); System.out.println("Sent message successfully..."); } I'm confused why it isn't working. I figured that I wouldn't need to do any sort of authentication because the email is sending over the same domain, but I have tried to use authentication also. I have tried going through ports 25, 110, 143, 465, and 587. I was able to use this same code with the addition of password authentication to send an email over gmail. The most common error I see is "could not connect to SMTP host: ...". Any insight would be greatly appreciated.
answer count: 3
has comment: http://stackoverflow.com/comment/38513464
has answer: http://stackoverflow.com/a/47566980
upvote count: 2
type: UnansweredQuestion
tagged with: dns
has comment: http://stackoverflow.com/comment/38512916
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/63152073

http://stackoverflow.com/comment/38661862
score: 0
type: Comment
type: QuestionComment
has text: @JohnB This makes complete sense. You may want to pen the same as an answer and I would accept it.
comment on: http://stackoverflow.com/q/24888444

http://stackoverflow.com/comment/136182886
score: 0
type: AnswerComment
has text: Oracle's Swing tutorials are normally excellent, but this one was an absolute stinker on an otherwise excellent track record. They should really rework that tutorial completely.
type: Comment
comment on: http://stackoverflow.com/a/24835935

http://stackoverflow.com/comment/38674156
type: QuestionComment
has text: Do you have Datasource jdbc/affablebean correctly set up on your server? This problem might be related to that. Try injecting just data source, and see if you can get connection.
comment on: http://stackoverflow.com/q/24892866
score: 0
type: Comment

http://stackoverflow.com/comment/38428964
comment on: http://stackoverflow.com/a/24763789
score: 0
type: AnswerComment
has text: Downvoted due to the pointless accumulation of backslashes. See comments elsewhere.
type: Comment

http://stackoverflow.com/comment/38413260
comment on: http://stackoverflow.com/q/24757857
has text: findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object[] values)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38519707
score: 0
type: Comment
type: QuestionComment
has text: Domino/workspace/logs/error-log-0.xml on the serrver.
comment on: http://stackoverflow.com/q/24786318

http://stackoverflow.com/comment/38522683
type: Comment
comment on: http://stackoverflow.com/q/24815737
has text: haha I'm guessing I'm pushing it. Maybe just knowing what it is mainly used for would suffice :) Simplicity? Hiding code? Maybe both of these?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/81425605
type: Comment
comment on: http://stackoverflow.com/a/25066565
type: AnswerComment
has text: coudnt find `RepositoryRestConfigurerAdapter ` in `org.springframework.data.rest.webmvc.config`
score: 3

http://stackoverflow.com/q/24826616
tagged with: java
has answer: http://stackoverflow.com/a/24826747
has answer: http://stackoverflow.com/a/24826743
has comment: http://stackoverflow.com/comment/38545195
linked to: http://stackoverflow.com/q/23914287
type: Question
answer count: 2
score: 8
has body: I'm trying to get an instance of Date with UTC time using the following code: Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); Date now = cal.getTime(); that looks so simple, but if I check the values at IntelliJ's debugger, I get different dates for cal and now: cal:java.util.GregorianCalendar[time=1405690214219,areFieldsSet=true,lenient=true,zone=GMT,firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2014,MONTH=6,WEEK_OF_YEAR=29,WEEK_OF_MONTH=3,DAY_OF_MONTH=18,DAY_OF_YEAR=199,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=30,SECOND=14,MILLISECOND=219,ZONE_OFFSET=0,DST_OFFSET=0] now:Fri Jul 18 10:30:14 BRT 2014 as you can see, cal is 3 hours ahead of now... what am I doing wrong? Thanks in advance. [EDIT] Looks like TimeZone.setDefault(TimeZone.getTimeZone("UTC")); before the code above does the job...
downvote count: 0
has title: Getting UTC time with Calendar and Date
upvote count: 8
tagged with: android
favorite count: 0
tagged with: android-calendar
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21349475
duplicate of: http://stackoverflow.com/q/21349475

http://stackoverflow.com/q/24826910
has answer: http://stackoverflow.com/a/24826952
type: UnansweredQuestion
score: 0
has body: Can someone explain how this piece of code works: enum MyStringComparator implements Comparator&lt;String&gt; { INSTANCE; @Override public int compare(String s1, String s2) { int n1 = Integer.parseInt(s1.split("\\.")[2]); int n2 = Integer.parseInt(s2.split("\\.")[2]); return Integer.compare(n1, n2); } } I am trying to sort "7.0.x", "14.0.x", "13.0.x-version_4", So from my understanding I would want to split at the x and see what is before that? Therefore I have tried the following: enum MyStringComparator implements Comparator&lt;String&gt; { INSTANCE; @Override public int compare(String s1, String s2) { int n1 = Integer.parseInt(s1.split("\\.\\.x")[5]); int n2 = Integer.parseInt(s2.split("\\.\\.x")[5]); return Integer.compare(n1, n2); } } Which did not work since I got a number format exception. I believe I am just not understanding what the code does.
has title: Understanding a piece of code to use for a different scenario
tagged with: java
type: Question
answer count: 1
tagged with: sorting

http://stackoverflow.com/comment/38510553
comment on: http://stackoverflow.com/a/24809363
type: Comment
type: AnswerComment
has text: Ι agree, It is not the best way. I just fix the code.
score: 0

http://stackoverflow.com/comment/38518159
type: Comment
type: QuestionComment
has text: There is nothing wrong with the code you have shared, see [this demo](http://ideone.com/yxda1V). The problem must lie elsewhere.
comment on: http://stackoverflow.com/q/24813255
score: 0

http://stackoverflow.com/a/24768213
answers question: http://stackoverflow.com/q/24767702
has comment: http://stackoverflow.com/comment/38469882
has comment: http://stackoverflow.com/comment/38471668
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38453920
has comment: http://stackoverflow.com/comment/38449086
type: Answer
has comment: http://stackoverflow.com/comment/38436183
score: 1
has comment: http://stackoverflow.com/comment/38469789
accepted answer of: http://stackoverflow.com/q/24767702
upvote count: 1
has body: Reading In case you use the org.apache.hadoop.mapreduce.lib.input.TextInputFormat, you can simply use a String#split in the Mapper. @Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String[] keyValue = value.toString().split("-"); // would emit John -&gt; 23 as a text context.write(new Text(keyValue[0]), new Text(keyValue[1])); } Writing In case you output it that way: Text key = new Text("John"); LongWritable value = new LongWritable(23); // of course key and value can come from the reduce method itself, // I just want to illustrate the types context.write(key, value); Yes, the TextOutputFormat takes care of writing that in your desired format: John-23 The only trap that I came across in Hadoop 2.x (YARN) and already answered here is that the property was renamed to mapreduce.output.textoutputformat.separator.

http://stackoverflow.com/comment/38446498
type: Comment
comment on: http://stackoverflow.com/a/24775230
score: 0
type: AnswerComment
has text: Do you have any ideas of solving the same problem using Arrays

http://stackoverflow.com/comment/38662646
type: Comment
comment on: http://stackoverflow.com/a/24889561
has text: your problem in that case is most likely the view columns not being set up to handle it. I suggest 1. update your question to include the question you are going for. 2. Checking the formulas for your columns in the view to make use of strings/integers instead of simple @day(dateTime). This can be problematic, give @Text(@Year(dateTime)) a try if you are not already doing this.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24842201
downvote count: 0
has body: Variables are not polymorphic. only methods are. However you can access them from the parent class if they are declared protected or public or through setters and getters
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24842116
score: 2

http://stackoverflow.com/q/24909020
has answer: http://stackoverflow.com/a/24909132
possible better answer: http://stackoverflow.com/a/34046326
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/34046326
tagged with: layout
downvote count: 1
tagged with: layout-manager
favorite count: 0
upvote count: 0
has title: Element placement with null layout
tagged with: null-layout-manager
tagged with: swing
has comment: http://stackoverflow.com/comment/38698678
accepted answer: http://stackoverflow.com/a/24909132
has body: I have a problem with null layout. Programm have a structure like this: Window (JFrame) &nbsp;&nbsp;&nbsp;&nbsp;- Tabbed Pane (JTabbedPane) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- .. Some tabs .. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Overridden JPanel wrapped in JScrollPane (class Table) Also I have a overriden JLabel (class Kanban). I try add in Table some instance of Kanban and have nothing. If I change layout of Table from null to BorderLayout(for example), element appears and works good. Oracle documentation says about 3 steps: 1) set null layout, 2) call setBounds() on child elements and 3) call repaint() on element with null layout. It isn't work for me(very strage, really). Table placement code (constructor of Window): Table table = new Table(); JScrollPane panel = new JScrollPane(table); tabbedPanel.addTab("New tab", panel); tabbedPanel.setSelectedIndex(tabbedPanel.getTabCount() - 1); table.setPreferredSize(new Dimension(600, 400)); table.setSize(600, 400); Table constructor: setDoubleBuffered(true); setLayout(null); setBounds(0,0,600,400); Kanban kanban = new Kanban("Label text"); kanban.setBounds(10, 10, kanban.getWidth(), kanban.getHeight()); add(kanban); What's wrong? Why elements don't draw in null layout? --- Add I need a null layout because I need point location of labels.
has comment: http://stackoverflow.com/comment/38698578
type: AnsweredQuestion
tagged with: java
score: -1

http://stackoverflow.com/comment/38650132
type: QuestionComment
has text: You mean Webservices ??
comment on: http://stackoverflow.com/q/24883154
score: 0
type: Comment

http://stackoverflow.com/comment/38676436
score: 0
type: Comment
type: QuestionComment
has text: no it does not. Copy the whole stacktrace, edit your question and paste into
comment on: http://stackoverflow.com/q/24896405

http://stackoverflow.com/q/24794785
has body: I am reading akka specification paragraph A Word About ClassLoaders. In several places of the configuration file it is possible to specify the fully-qualified class name of something to be instantiated by Akka. This is done using Java reflection, which in turn uses a ClassLoader. Getting the right one in challenging environments like application containers or OSGi bundles is not always trivial, the current approach of Akka is that each ActorSystem implementation stores the current thread’s context class loader (if available, otherwise just its own loader as in this.getClass.getClassLoader) and uses that for all reflective accesses. This implies that putting Akka on the boot class path will yield NullPointerException from strange places: this is simply not supported. What this exatclty means? Does this mean that using classloaders in akka configuration is not safe? And when and why I should configure custome classloader?
tagged with: java
type: Question
score: 0
has title: What "putting Akka on the boot class" means?
tagged with: akka
answer count: 1
has answer: http://stackoverflow.com/a/24795433
tagged with: classloader
tagged with: scala
type: UnansweredQuestion

http://stackoverflow.com/comment/38596763
has text: You had a good question, but with your latest addition of overriding `finalize()`, you've made it into two separate questions. I'd say keep the resource part of the question and look around to see if you can find another question that deals with `finalize()` (I'm sure there are some around here).
comment on: http://stackoverflow.com/q/24854927
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38455656
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24776340
score: 0
has text: I tried that before. `testfun(function(){that});` seems to work since I don't get any error in firebug, but printing `arguments.toString()` shows only `{}`

http://stackoverflow.com/q/24795161
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 6
tagged with: java
has title: How to use a java 8 library with android?
has answer: http://stackoverflow.com/a/24795811
type: Question
has body: I'm trying to use a library that uses java 8 in my android project. I cannot find a way to make this work. I've tried to use retro lambda but it has not helped. I keep getting the error: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version(0034.0000) I've researched this and learned it's because there is java 8 syntax in the included library. I've been compiling with java 8 sdk and am using android studio 08.2. Help! The library is:https://github.com/robrua/Orianna
has comment: http://stackoverflow.com/comment/38484144
score: 6

http://stackoverflow.com/q/24751495
upvote count: 1
has comment: http://stackoverflow.com/comment/38401331
has comment: http://stackoverflow.com/comment/38401266
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24752684
has body: I am doing a code for my "intro to java" programming course and I ran into an error I don't really know how to fix. I keep having an error that says: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown Scanner fileIn = new Scanner(hours); This is the code: import java.util.Scanner; import java.io.File; public class program2{ public static void main(String[] args) { int[][] array = new int [8][7]; int[] total = new int [array.length]; int[] finalTotal = new int[array.length]; int[] employees = {0,1,2,3,4,5,6,7}; File hours = new File("prog2.dat"); //read file Scanner fileIn = new Scanner(hours);//assign hours to array while(fileIn.hasNext()){ for(int i = 0; i &lt; 8; i++) { for (int a = 0; a &lt; 7; a++) { int num =fileIn.nextInt(); array[i][a] = num; } } } fileIn.close(); //Closes file // takes employees hour total for(int i=0; i &lt; 8; i++) { total[i] = array[i][0] + array[i][1] + array[i][2] + array[i][3] + array[i][4] + array[i][5] + array[i][6]; } // takes the hours and sorts from greatest to least for(int i= 0; i &lt; 7; i++) { int greatest = total[i]; for(int b = i+1; b &lt; 8; b++) { if(total[b] &gt; greatest) { int employeeTemp = employees[i]; employees[i] = employees[b]; employees[b] = employeeTemp; int tempNum = greatest; greatest = total[b]; total[i] = greatest; total[b] = tempNum; } } } // print employee number and worked hours for(int i = 0; i &lt; 8; i++) { System.out.println(" Employee #" + employees[i] + ": " + total[i]); } } } Please help in any way you can.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24751630
has comment: http://stackoverflow.com/comment/38411910
type: Question
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/24751615
has answer: http://stackoverflow.com/a/24751534
has answer: http://stackoverflow.com/a/24751548
possible better answer: http://stackoverflow.com/a/24751548
favorite count: 0
linked to: http://stackoverflow.com/q/24751438
has comment: http://stackoverflow.com/comment/38401304
tagged with: multidimensional-array
answer count: 5
has title: Java coding issue
accepted answer: http://stackoverflow.com/a/24751534

http://stackoverflow.com/comment/38541303
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24825547
has text: You haven't ended up in a deadlock situation, where both client and server are waiting for input? It might be a good idea to add some logging to both server and client, so you can see what they are doing.

http://stackoverflow.com/q/24757017
has body: I have a input text. When I am writing some text into input text suddenly focus is disabled. Example : I want to write Playmate, but when I have written Pla my focus is disabled and I cant to continue other letters (exactly : ymate), my focus is dissapeared. Maybe anyone have encountered with my bug ? GWT 2.4.0 Browser : Internet Explorer 8
tagged with: java
linked to: http://stackoverflow.com/q/497094
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24757479
type: UnansweredQuestion
tagged with: input
has title: GWT input text focus is automatic disabled
tagged with: text
has comment: http://stackoverflow.com/comment/38411913
type: Question
tagged with: gwt

http://stackoverflow.com/comment/38673595
comment on: http://stackoverflow.com/q/24895403
type: Comment
has text: Where is the listener to the button? how do you handle the search click? if you dont you need to add one...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39019295
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24866181
has text: Hi Calon, Thanks for your reply. your suggestion can help if we are creating the tool bar our own by usinsg ToolBar bar = new ToolBar(frame, SWT.BORDER);. but in my case I'm not doing this. I'm creating tool bar using the extension point as shown below. <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:main">. So please suggest if any way we can get the control of these Toolbar Items when we create the these through extension points.
score: 0

http://stackoverflow.com/q/24769742
has title: Java - True/False per Enum value
has comment: http://stackoverflow.com/comment/38435954
favorite count: 0
possible better answer: http://stackoverflow.com/a/24769812
upvote count: 8
has body: I'm trying to figure out what is the best solution for my problem. I have an object where the status may be one of three possibilities but it can change during run time. I have three status flags that the object can be. I have no experience with ENUM and trying to figure out if this is the best way. I want to be able to set a specific flag to true or false and then be able to set another one. I need to be able to get the status of each flag as well for when I iterate through a list of these objects within a array list. class Patient { //REST OF the object public enum Status { INPATIENT(false), OUTPATIENT(false), EMERGENCY(false); private final boolean isStatus; Status(boolean isStatus) { this.isStatus = isStatus; } public boolean isStatus() { return this.isStatus; } } }
has answer: http://stackoverflow.com/a/24769791
type: AnsweredQuestion
tagged with: enums
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/38436186
downvote count: 1
has comment: http://stackoverflow.com/comment/38435869
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24769791
has answer: http://stackoverflow.com/a/24769812

http://stackoverflow.com/comment/78913579
score: 0
has text: It should be done in onCreateViewHolder method and not onBindViewHolder method. Also, no such comments ('All other answers are lame') on other answers
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/45262503

http://stackoverflow.com/comment/38570907
score: 1
has text: Could you post a sample session, with the expected output vs the actual output ?
comment on: http://stackoverflow.com/q/24841563
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38645141
score: 1
has text: I need to ensure that during db access across threads, the program didn't crash because of database busy
type: AnswerComment
comment on: http://stackoverflow.com/a/24880293
type: Comment

http://stackoverflow.com/comment/38400161
comment on: http://stackoverflow.com/q/24750846
score: 1
has text: Voting to close as opinion-based. IMO though, if the magic numbers are integral to business logic, then it should be fine to let it be. Check this for a more elaborate discussion of the topic: http://thedailywtf.com/Articles/Soft_Coding.aspx
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38552323
score: 1
comment on: http://stackoverflow.com/q/24815492
type: Comment
type: QuestionComment
has text: Looks like a bug in creating a sub query over the companyBean relationship, though I don't know why it would have broken in 2.5. What happens if you specify the join outside of the size function? ie: "SELECT e FROM Emp e join e.companyBean companyBean WHERE SIZE(companyBean.emps) > 0"

http://stackoverflow.com/q/24887580
tagged with: collision
answer count: 0
has comment: http://stackoverflow.com/comment/38659266
tagged with: java
has comment: http://stackoverflow.com/comment/38660401
has body: I am making my first game in LibGdx and it's going well. Atleast I think it is. But I want to implement a better collision system... My current collision looks like this: List&lt;Rectangle&gt; bounds= new ArrayList&lt;Rectangle&gt;(); for (int i = 0; i &lt; 250; i++) { for (int j = 0; j &lt; 250; j++) { TiledMapTileLayer cur = (TiledMapTileLayer) map.getLayers().get(1); Cell cell3 = new Cell(); if (cur.getCell(i, j) != null) { cell3 = cur.getCell(i, j); System.out.println("Found a chest detector at: " + i + ", " + j + ", " + cell3.getTile().getId()); bounds.add(new Rectangle(i * 64, j * 64, 64, 64)); } } } // CHECKING FOR TREES for (int i = 0; i &lt; bounds.size(); i++) { if (bounds.get(i).overlaps(player.getBounds())) { int x = (int) bounds.get(i).x / 64; int y = (int) bounds.get(i).y / 64; TiledMapTileLayer cur = (TiledMapTileLayer) map.getLayers() .get(1); Cell cell = cur.getCell(x, y); if (cell.getTile().getProperties().containsKey("Green")) { if (Gdx.input.isKeyPressed(Keys.SPACE)) { System.out.println("You've cut down a tree!"); } } if (cell.getTile().getProperties().containsKey("Gray")) { player.reAdjust(); } } } As you can see when the player OVERLAPS with a tree that has a property of "Gray" a method called reAdjust is called; That method is in the player class: First I define a String movement and set it to ""; String movement = ""; After that I add the movement code: if (Gdx.input.isKeyPressed(Keys.W)) { if (curEnergy &gt; 0) { if (Gdx.input.isKeyPressed(Keys.SHIFT_LEFT)) { position.y += 2.5f; movement = "up"; curEnergy--; currentFrame = animation.getKeyFrame(12 + stateTime); } } else { allowRegen = true; checkIfEnergyIsZero(); } position.y += 2f; movement = "up"; currentFrame = animation.getKeyFrame(12 + stateTime); } if (Gdx.input.isKeyPressed(Keys.A)) { if (curEnergy &gt; 0) { if (Gdx.input.isKeyPressed(Keys.SHIFT_LEFT)) { position.x -= 2.5f; movement = "left"; curEnergy--; currentFrame = animation.getKeyFrame(4 + stateTime); } } else { allowRegen = tr…
has comment: http://stackoverflow.com/comment/38660596
type: Question
has comment: http://stackoverflow.com/comment/38658958
tagged with: libgdx
has title: Libgdx Collision System Different way
has comment: http://stackoverflow.com/comment/38658514
linked to: http://stackoverflow.com/q/24651403
has comment: http://stackoverflow.com/comment/38660352
has comment: http://stackoverflow.com/comment/38658892
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38658691
has comment: http://stackoverflow.com/comment/38659101

http://stackoverflow.com/q/24903430
has answer: http://stackoverflow.com/a/24903520
has comment: http://stackoverflow.com/comment/38688570
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24903601
has body: I have a code like this, import java.sql.*; import java.util.*; public class Connectivity { public static void main(String[] ar){ /*Scanner s=new Scanner(System.in); String a=s.nextLine(); String b=s.nextLine(); // Connectivity c=new Connectivity(a,b);*/ try{ Class.forName("com.mysql.jdbc.Driver"); System.out.println("connecting to databse"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/example","pic","picadmin"); Statement st=con.createStatement(); String sql="insert into tbl1(id,catagory) values('102','medicines')"; st.executeUpdate(sql); System.out.println("Successfully Inserted"); ResultSet rs=st.executeQuery("select * from tbl1"); while(rs.next()){ System.out.println(rs.getInt(1)+" " + rs.getString(2)); } con.close(); } catch(Exception e) { System.out.println(e.getMessage()); } } } I know it is possible through PreparedStatement. But can anyone help me is this possible with scanner object
possible better answer: http://stackoverflow.com/a/24903601
accepted answer: http://stackoverflow.com/a/24903520
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38688580
type: Question
answer count: 2
tagged with: jdbc
has title: can we use scanner input for inserting values into database in jdbc program

http://stackoverflow.com/comment/38675752
type: QuestionComment
comment on: http://stackoverflow.com/q/24896405
has text: you are right... it never gets called but why?
score: 0
type: Comment

http://stackoverflow.com/comment/38608983
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24861321
has text: add webapp to classpath
score: 0

http://stackoverflow.com/a/24878334
has body: This is probably possible, but it's ugly. You need to recognize that it's not enough to start a new login session on the other two servers; you also have to let the browser know about those sessions somehow. If all three apps are in the same domain, and login sessions are implemented using cookies, then the first app will need to capture the login cookies it receives from the other two and relay them back to the browser. If login sessions are implemented using URL query parameters (e.g. jsessionid), the first app will need to parse the HTML responses it receives from the other two logins, extract the session ID parameter from a link in each one, and incorporate those session IDs into the links it sends back to the real user.
answers question: http://stackoverflow.com/q/24878118
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/24842068
has comment: http://stackoverflow.com/comment/38579440
has comment: http://stackoverflow.com/comment/38572064
has comment: http://stackoverflow.com/comment/38571806
has comment: http://stackoverflow.com/comment/38571889
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38572103
upvote count: 1
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/38572054
has title: Set Position of Text Field in Java?
has comment: http://stackoverflow.com/comment/38572211
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24842298
has comment: http://stackoverflow.com/comment/38579367
has body: I'm currently writing a program that requires user input within the Frame. Is there a simple way to set the position of an input text field (in X and Y coordinates)? The constructor and mutator methods of the JTextField doesn't seem to be able to do this. This is the code: import java.awt.image.*; import java.io.*; import java.util.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.net.*; class labMain extends Frame implements KeyListener, MouseListener, MouseMotionListener { String screenState; Color bfi = new Color(155, 48, 255); Color bfh = new Color(155, 48, 255, 200); Color bfs = new Color(155, 48, 255, 200); Color bbi = new Color(255, 255, 255); Color bbh = new Color(5, 12, 15); Color bbs = new Color(220, 20, 60); quadButton startSession, gotoUser, gotoInventory, gotoCalendar, gotoProcedures, gotoResults, gotoEmergencies; quadButton addUsers, findUsers; int mouseX, mouseY; javax.swing.Timer mainT; BufferedImage imageBuffer; Graphics2D graphicsBuffer; boolean[] keys = new boolean[525]; public labMain() { setTitle("uwDNA Lab Pro"); setSize(new Dimension(1365, 765)); this.addWindowListener ( new WindowAdapter() { public void windowClosing(WindowEvent e) { labMain.this.windowClosed(); } } ); setFocusable(true); addKeyListener(this); addMouseListener(this); addMouseMotionListener(this); } protected void windowClosed() { System.exit(0); } public void runLab() throws IOException { imageBuffer = (BufferedImage) createImage(getWidth(), getHeight()); graphicsBuffer = (Graphics2D) imageBuffer.getGraphics(); screenState = "Main"; mainScreenInit(); usersScreenInit(); addUsersScreenInit(); ActionListener mainS = new ActionListener() { public void actionPerformed(ActionEvent evt) { detectMouseHover(); paint(getGraphics()); } }; mainT = new javax.swing.Timer(1, mainS); mainT.start(); } public void detectMouseHover() { if (startSession.intersects(mouseX, mouseY)) { startSession.setState(aButton.isHover); } else { startSession.setState(aButton.is…
has comment: http://stackoverflow.com/comment/38579431
has comment: http://stackoverflow.com/comment/38572291
answer count: 1
downvote count: 0
favorite count: 0
tagged with: position

http://stackoverflow.com/q/24907708
downvote count: 1
type: Question
has title: Flex convert xmllistcollection object into xml
tagged with: flash-builder
tagged with: java
score: -1
has body: I have my existing flex project that use flex XML object to populate UI components that XML object I was creating from response received from a URLLoader. But in a new requirement I am not using URLLoader and my proxy layer returning XMLListCollection object from back end. Is there any way to convert flex XMLListCollection object into flex XML object?
has answer: http://stackoverflow.com/a/24910270
upvote count: 0
answer count: 1
favorite count: 0
tagged with: adobe
type: UnansweredQuestion
tagged with: apache-flex

http://stackoverflow.com/comment/38510900
score: 1
comment on: http://stackoverflow.com/a/24771173
type: AnswerComment
type: Comment
has text: @MikeM.: thanks, you're right & my java is very rusty

http://stackoverflow.com/a/24827602
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24827446
downvote count: 0
has comment: http://stackoverflow.com/comment/38592064
has comment: http://stackoverflow.com/comment/38545844
has body: If it doesn't have to be automated, try using built-in Developer tools to measure the response each upload/download takes: IE 8: http://msdn.microsoft.com/en-us/library/dd565628(v=vs.85).aspx Firefox 3.6 (using Firebug): https://addons.mozilla.org/en-US/firefox/addon/firebug/ These work similarly to the Chrome browser Developer Tools, and can help track response times of live sites
type: Answer
has comment: http://stackoverflow.com/comment/38545072

http://stackoverflow.com/a/40351038
upvote count: 2
has body: I use intellij and gradle to build my java projects. This will be very easy by following these simple steps: First at the same level as your src directory add a "directory" with the name of "libs". Add your jar files to this directory "libs", (this makes your code portable). Follow the steps: Click Project Structure from File menu. Select Modules that you want to add the new jars at the left panel. Dependencies tab. '+' → JARs or directories and add the jar files in the \libs. In the gradle.build file in the dependencies section add: dependencies { compile files('libs/"nameOfJarFile".jar') } Although not necessary, it is a good practice to invalidate cache and restart at some point.
answers question: http://stackoverflow.com/q/24765193
has comment: http://stackoverflow.com/comment/97327752
downvote count: 1
type: Answer
score: 1

http://stackoverflow.com/a/24823617
score: 0
answers question: http://stackoverflow.com/q/24823422
type: Answer
has body: Using regular expression It may helps you : String str = " I only want this content I don't want this content random content"; final Pattern pattern = Pattern.compile(" (.+?) "); final Matcher matcher = pattern.matcher(str); matcher.find(); System.out.println(matcher.group(1)); // Prints String I want to extract Output : I only want this content

http://stackoverflow.com/q/24788098
tagged with: java
score: -1
type: Question
tagged with: genexus
answer count: 1
favorite count: 0
tagged with: shell
tagged with: web
has title: java in command line not working in genexus
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has body: I have a problem with this: C:\Proyectos\ReciboElectronico\JavaRE\web&gt;"C:\Program Files (x86)\Java\jdk1.6.0_45\bin\java.exe" -cp gxclassd.zip;.;iText.jar;./drivers/ojdbc6.jar arecibonom param1 param2 This command works perfectly fine directly in the command line but it doesn´t work in Genexus. I use it like this in Genexus: &amp;comando = 'C:\Proyectos\ReciboElectronico\JavaRE\web "C:\Program Files (x86)\Java\jdk1.6.0_45\bin\java.exe" -cp gxclassd.zip;.;iText.jar;./drivers/ojdbc6.jar arecibonom param1 param2' &amp;resshell = shell(&amp;comando,1) MSG(&amp;resshell.ToString()) &amp;comando in varchar(500) &amp;resshell is Numeric(10,0) The MSG output is 1, so it means is not working. I hope someone can help me please. What is wrong with the sentence in Genexus? Thanks,
has answer: http://stackoverflow.com/a/24794744

http://stackoverflow.com/q/24838298
has answer: http://stackoverflow.com/a/24838420
has answer: http://stackoverflow.com/a/57928782
has answer: http://stackoverflow.com/a/41368174
has answer: http://stackoverflow.com/a/72682798
downvote count: 0
answer count: 10
favorite count: 0
type: UnansweredQuestion
has title: java.sql.SQLException: Access denied for user 'root@localhost'@'localhost' (using password: YES)
has answer: http://stackoverflow.com/a/44628632
tagged with: jdbc
has answer: http://stackoverflow.com/a/62535233
has answer: http://stackoverflow.com/a/24838375
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/59114686
has answer: http://stackoverflow.com/a/53363295
tagged with: mysql
has comment: http://stackoverflow.com/comment/38564559
upvote count: 7
has comment: http://stackoverflow.com/comment/38564556
type: Question
has answer: http://stackoverflow.com/a/51382054
has body: I am connecting Java using Eclipse with MySQL db CODE import java.sql.*; import java.io.*; public class DbDemo { public static void main(String args[]) throws ClassNotFoundException, SQLException { String s; String uname="root@localhost"; String url="jdbc:mysql://localhost:3306/student"; String password="Hsun123"; int i; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con=DriverManager.getConnection(url,uname,password); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from student_detail"); if(rs.next()) { i=rs.getInt(1); s=rs.getString(2); System.out.println(i+"/t"+s); } rs.close(); st.close(); con.close(); } catch(Exception e) { e.printStackTrace(); } } } ERROR java.sql.SQLException: Access denied for user 'root@localhost'@'localhost' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:935) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4101) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1300) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:792) at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381) at com.mysql.jdbc.NonRegisteringDriver.conn…

http://stackoverflow.com/a/24856401
has comment: http://stackoverflow.com/comment/38599767
has comment: http://stackoverflow.com/comment/38599801
type: Answer
accepted answer of: http://stackoverflow.com/q/24856355
has body: Java ArrayList is indexable from 0 to size() - 1, when you access the element at index size() you are out of bounds. for (int i = 0; i &lt; quiz1Answers.size(); i++) // not &lt;= From the ArrayList.get(int index) JavaDoc (bold added), Throws: if the index is out of range (index &lt; 0 || index >= size()) Also, your if condition appears incorrect and you should test that the index isn't outside second collection's range, if (quiz1UserAnswers.size() &lt; i &amp;&amp; quiz1UserAnswers.get(i).equals(quiz1Answers.get(i)))
has comment: http://stackoverflow.com/comment/38599727
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38599731
downvote count: 0
has comment: http://stackoverflow.com/comment/38599842
answers question: http://stackoverflow.com/q/24856355
type: AcceptedAnswer

http://stackoverflow.com/a/24847334
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24847252
accepted answer of: http://stackoverflow.com/q/24847252
type: AcceptedAnswer
downvote count: 0
has body: Is there no way to prevent this? There is no way to prevent this ... short of rewriting the other application. The Android platform has a Linux-based kernel, and on Linux / Unix systems file locking is discretionary. An application will only notice that a file is "locked" if it attempts to acquire a lock on the file for itself. They typically don't, and if they don't there is nothing you can do about it. FileLock on Android doesn't do anything? Not correct. It does something, but not what you expected. Read the "Platform Dependencies" section of the javadoc.

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/24898407
tags question: http://stackoverflow.com/q/24811033
type: Tag
tags question: http://stackoverflow.com/q/24846000

http://stackoverflow.com/comment/38472321
comment on: http://stackoverflow.com/q/24788776
score: 0
type: Comment
type: QuestionComment
has text: I start tom cat server. Jenkins war file is in the webapps. I just go the URL locahost:8080\Jenkins. It is not as a windows service @Salem

http://stackoverflow.com/comment/38650252
has text: Ah didn't see that `tClass` was available...will have a hack around soon - thanks.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24799327

http://stackoverflow.com/comment/38562942
type: Comment
comment on: http://stackoverflow.com/q/24837169
type: QuestionComment
has text: Change `out.print("error connecting to database");` to `out.print(e.getMessage());` and you'll likely discover the cause of your problem.
score: 0

http://stackoverflow.com/comment/38478081
has text: I am not saying that you are wrong but how does using getter and settings result in greater performance? I agree with the usage of getters and setters in nearly all context for the sake of code readability but never had I heard that its actually **faster** despite the overhead of a function call. Would you kindly elaborate on what you mean?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24791417

http://stackoverflow.com/q/24829111
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24829227
has body: There is a program which handles many lists of many types (Person, Cat, Chairs etc..). The following code appears many times in the code. The code fills a given list with instances of type Cat until the list has a given number of instances. int howMany = max - cats.size(); for(int i = 0; i &lt; howMany; ++i) { cats.add(new Cat()); } Since this code appears many time we want to create a method to replace it. The method will accept the List that we want to add instances to and the max number of instances. It can accept more parameters if needed. This seems simple at first but then I remembered it's not possible to write new T() because of type erasure. What other way is there to achieve this?
score: 0
tagged with: generics
has title: How to add new instances to a generic list?
linked to: http://stackoverflow.com/q/75175
has comment: http://stackoverflow.com/comment/38547617
possible better answer: http://stackoverflow.com/a/24829758
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24829758
tagged with: java
accepted answer: http://stackoverflow.com/a/24829227

http://stackoverflow.com/a/26741992
answers question: http://stackoverflow.com/q/24856904
type: Answer
score: 2
upvote count: 2
has body: There is nothing to test in your scenario. If you insist on test that you're testing the guava framework (guava development team already do that well) not your application.
downvote count: 0

http://stackoverflow.com/comment/38664136
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24823595
has text: Is it possible that the GC f*cks up something?
score: 0

http://stackoverflow.com/a/24942185
accepted answer of: http://stackoverflow.com/q/24753150
answers question: http://stackoverflow.com/q/24753150
score: 12
upvote count: 12
type: AcceptedAnswer
downvote count: 0
has body: I did some research and some more with @ekabanov and here are the findings. The effect you are seeing only happens with Java 8 and not with Java 7. The extra line triggers a different JIT compilation/optimisation The assembly code of the faster version is ~3 times larger and quick glance shows it did loop unrolling The JIT compilation log shows that the slower version successfully inlined the runCollatz while the faster didn't stating that the callee is too large (probably because of the unrolling). There is a great tool that helps you analyse such situations, it is called jitwatch. If it is assembly level then you also need the HotSpot Disassembler. I'll post also my log files. You can feed the hotspot log files to the jitwatch and the assembly extraction is something that you diff to spot the differences. Fast version's hotspot log file Fast version's assembly log file Slow version's hotspot log file Slow version's assembly log file
type: Answer

http://stackoverflow.com/a/40824937
has comment: http://stackoverflow.com/comment/77453319
answers question: http://stackoverflow.com/q/24769296
upvote count: 7
has comment: http://stackoverflow.com/comment/77452879
score: 7
downvote count: 0
has body: As variant you may work with synthetic property. Lets name it as 'productName': nameColumn.setCellValueFactory(new PropertyValueFactory("productName")); In your ProductStockDto class have something like this: public String getProductName() { return product.getName(); }
type: Answer

http://stackoverflow.com/comment/38615258
type: Comment
has text: Font names are being fetched by using x service. "The FreeBSD server is a headless server." this is a wrong argument. You can configure to use it if you have any video card available to your os:http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/x-config.html
comment on: http://stackoverflow.com/a/24846112
type: AnswerComment
score: 0

http://stackoverflow.com/a/24809447
score: 0
type: Answer
has body: hashmap does not preserve the insertion order.So it is better to use a LinkedHashMap to achieve what you are looking for .Please check out this article if you waant to know more http://java.dzone.com/articles/hashmap-vs-treemap-vs
answers question: http://stackoverflow.com/q/24805664

http://stackoverflow.com/comment/64195924
type: Comment
score: 1
has text: @RobinJonsson I think your problem was related to missing `<?import javafx.scene.layout.HBox?>` directive. Seems like in this case the Scene Builder just ignore `HBox.hgrow="ALWAYS"` attribute and doesn't show warning or error.
comment on: http://stackoverflow.com/a/24905704
type: AnswerComment

jenkins
tags question: http://stackoverflow.com/q/24829831
tag name: jenkins
tags question: http://stackoverflow.com/q/24888009
tags question: http://stackoverflow.com/q/24774722
tags question: http://stackoverflow.com/q/24871219
tags question: http://stackoverflow.com/q/24890556
tags question: http://stackoverflow.com/q/24898825
tags question: http://stackoverflow.com/q/24826164
tags question: http://stackoverflow.com/q/24788776
tags question: http://stackoverflow.com/q/24878614
tags question: http://stackoverflow.com/q/24876773
tags question: http://stackoverflow.com/q/24815366
tags question: http://stackoverflow.com/q/24798922
tags question: http://stackoverflow.com/q/24820204
tags question: http://stackoverflow.com/q/24783453
type: Tag

http://stackoverflow.com/q/24796907
tagged with: cassandra
upvote count: 1
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/78003006
favorite count: 0
has answer: http://stackoverflow.com/a/47725889
has comment: http://stackoverflow.com/comment/77959081
tagged with: titan
type: UnansweredQuestion
has title: Why is Titan creating duplicate vertex keys which are configured unique?
score: 1
tagged with: java
tagged with: graph-databases
type: Question
has body: Brief summary Using latest Titan-0.5 snapshot. Our code creates vertices in concurrent threads. We are ending up in a state where we have multiple vertices with the same key. We expect this not to occur due to our constraints. Configuring keys with following: PropertyKey name = management.makePropertyKey(keyName) .dataType(String.class) .cardinality(Cardinality.SINGLE) .make(); TitanGraphIndex nameIndex = management.buildIndex(keyName, Vertex.class) .indexKey(name) .unique() .buildCompositeIndex(); management.setConsistency(nameIndex, ConsistencyModifier.LOCK); Full Story We have a Titan DB configured with unique vertex property keys. When writing to the DB within concurrent threads, we find Titan persisting multiple vertices with the same key. I've distilled the issue down to a single test file: https://gist.github.com/ubit-ee/8520304273cd2024af29 This was built against the latest from 0.5 branch. The code spawns three threads, which are synchronized to start concurrently (as much as can be) via a countdown latch. The threads then: create vertex with key "KEY_VALUE_A" create vertex with key "KEY_VALUE_B" creates a label between the two If the threads were to run sequentially, one would expect exceptions due to duplicate keys. I've been able to force this case. When the threads run concurrently, I would expect at least one thread to succeed and any number fail. Regardless, I expect the final state of the graph to be two vertices and a single edge between the two. Unfortunately, when I run this, the DB is repeatedly left in a state with more that 2 vertices and edges. There are vertices with duplicate keys. The tests dumps the graph to XML. Example: https://gist.github.com/ubit-ee/d5530e4fa4b87c752294 The test code in configured for berkeleydb, but I've repeated the issue against Cassandra as well. Questions Have I configured the schema correctly, such that the vertex key should be unique? Should I be doing anything different with transactions? Am I misunderstanding …
has comment: http://stackoverflow.com/comment/78083471
tagged with: berkeley-db-je

transactions
tags question: http://stackoverflow.com/q/24755600
tags question: http://stackoverflow.com/q/24806909
tags question: http://stackoverflow.com/q/24772126
tags question: http://stackoverflow.com/q/24796241
tags question: http://stackoverflow.com/q/24776450
tag name: transactions
tags question: http://stackoverflow.com/q/24901118
tags question: http://stackoverflow.com/q/24847786
tags question: http://stackoverflow.com/q/24762811
tags question: http://stackoverflow.com/q/24903118
type: Tag
tags question: http://stackoverflow.com/q/24900849
tags question: http://stackoverflow.com/q/24852752

http://stackoverflow.com/comment/38673643
comment on: http://stackoverflow.com/a/24895001
type: Comment
has text: Error : The method getJSONArray(String) is undefined for the type JSONObject public class JsonSimpleExample { public static void main(String[] args) { JSONParser parser = new JSONParser(); Object obj = parser.parse(new FileReader("C:\\Downloads\\_har\\www.facebook.com+2014-07-21+21-08-43.json")); JSONObject jsonObject = (JSONObject) obj; JSONObject innJsonObject = jsonObject.getJSONArray("entries").getJSONObject(0); System.out.println(innJsonObject.get("pageref")); // page_0 System.out.println(innJsonObject.get("time")); } }
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38591215
type: Comment
score: 1
has text: @m0skit0: he is learning. None of us are born knowing this stuff, and most all of us trip a bit early on (and later) as we learn the language.
type: QuestionComment
comment on: http://stackoverflow.com/q/24852247

http://stackoverflow.com/q/24834193
has title: Unable to form POJO from json string using Jackson: Java
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
upvote count: 1
answer count: 1
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/24834284
accepted answer: http://stackoverflow.com/a/24834284
score: 0
has comment: http://stackoverflow.com/comment/38700705
has body: I have the following string: {"networks":[["divakar","64:66:",4,1,-37,-98],["OPTUSA202B26","00:1e:2a:",3,2,-40,-98],["Mantri","00:1e:a6:1",5,6,-41,-98],["belkin.5D7","08:86:3",5,6,-38,-98]]} and I am using the following objects: public static class Network{ private ArrayList&lt;SoftAPInfo&gt; networks; public Network(ArrayList&lt;SoftAPInfo&gt; networks) { this.networks = networks; } public Network(){ } public ArrayList&lt;SoftAPInfo&gt; getNetworks() { return networks; } public void setNetworks(ArrayList&lt;SoftAPInfo&gt; networks) { this.networks = networks; } } public static class SoftAPInfo { private ArrayList&lt;String&gt; list; public ArrayList&lt;String&gt; getList() { return list; } public void setList(ArrayList&lt;String&gt; list) { this.list = list; } public SoftAPInfo() { } } and the following jackson command: TypeReference&lt;Network&gt; typeRef = new TypeReference&lt;Network&gt;() {}; ObjectMapper mapper = new ObjectMapper(); try { Object jsonObject = mapper.readValue(response, typeRef); callback.onSuccess(jsonObject); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } but i keep getting an exception: cannot deserialize object out of start_array token could someone please help me figure out the issue here? Thanks, Sunny
downvote count: 1

http://stackoverflow.com/a/24870194
score: 2
type: Answer
upvote count: 2
has body: For one thing, your very first for loop has no open and close brackets. This means only the first statement is considered part of the for loop. so the statement 'tokensLength = array[i].length();' can't reach the variable i because it is not in the for loop. I believe adding open and close brackets around everything you want in the first for loop should fix it
downvote count: 0
answers question: http://stackoverflow.com/q/24870088

http://stackoverflow.com/comment/38417796
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24760037
has text: @laune - In one sense, you couldn't define a more efficient hash function than this :-)

http://stackoverflow.com/comment/38493073
comment on: http://stackoverflow.com/a/24795987
type: AnswerComment
has text: just code like following public String LangArray[] array; //.......code..........// doInBackground() { //...code...... for loop { array[i] = your latitude; } publishProgress(array); } @Override protected void onProgressUpdate(Integer... array) { super.onProgressUpdate(array); _percentField.setText(array[0]+" "); _percentField.setTextSize(array[1]+" "); .. .. } onPostExecute() { //do same heare also _percentField.setText(array[6]+" "); }
score: 0
type: Comment

http://stackoverflow.com/comment/85308702
type: AnswerComment
has text: Thank you for this code snippet, which might provide some limited short-term help. A proper explanation [would greatly improve](//meta.stackexchange.com/q/114762) its long-term value by showing *why* this is a good solution to the problem, and would make it more useful to future readers with other, similar questions. Please [edit] your answer to add some explanation, including the assumptions you've made.
type: Comment
comment on: http://stackoverflow.com/a/49151918
score: 1

http://stackoverflow.com/comment/38592521
type: Comment
comment on: http://stackoverflow.com/a/24848913
has text: @Stephan, maybe i'm wrong, this is what i understand: the OP will make use of it from a java program, accessing the underlying OS (windows in this case) to retrieve the information. Once the OS has done its work giving the string to the calling program, removing the dots is trivial. Anyway, to fulfill with the indicated sample, code has been updated.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24819683
has comment: http://stackoverflow.com/comment/38536793
favorite count: 0
has answer: http://stackoverflow.com/a/24819917
type: Question
upvote count: 2
answer count: 2
tagged with: spring-annotations
tagged with: spring
has body: I have an complex object that I want to test. Lets call this object rest resource. This resource depends on a servie object, injected via @autowired and the service object has further dependencies, also injected via @autowired. I got my junit test class in the way I want with one single exception. The only problem I have is that I do not know how to replace a deep level dependency with a mocking. There is @InjectMocks for example. That replace only direct dependencies, not nested. The other way could be via setters. The Problem is that the rest resource is not recreated for the next junit testcase. So if I change a certain dependency it will be used for the next test case. I hope for someone who can help. The code is like followed @Controller public class AccountCommandsController { @Autowired private LogoutService service; } @Service public class LogoutService { @Autowired private AccountsRepository repository; @Autowired private MailService mailService; @Autowired private HashService hashService; } @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = TestConfiguration.class) @Transactional @TransactionConfiguration(defaultRollback = true) public class AccountCommandsControllerTest { private MockMvc mockMvc; @Autowired private AccountCommandsController controller; @Autowired private AccountsRepository repository; @Autowired private ApplicationContext applicationContext; @Mock private MailService mailService; @Mock private HashService hashService; @Before public void setup() { MockitoAnnotations.initMocks(this); controller.getService().setMailService(mailService); //problem issue controller.getService().setHashService(hashService); mockMvc = standaloneSetup(controller).build(); } } To put it in the nutshell. I want junit to use the original dependencies (no mockings) except in certain junit test cases where certain dependencies should be replaced by certain mocking objects like mailService or hashService. Edit: Here is a test case @RunWi…
has answer: http://stackoverflow.com/a/40639464
tagged with: java
has title: Replace deep level autowired dependencies with mockings in spring
tagged with: spring-java-config
type: UnansweredQuestion
tagged with: spring-transactions
has comment: http://stackoverflow.com/comment/38530170
has comment: http://stackoverflow.com/comment/38601416
score: 2
downvote count: 0

http://stackoverflow.com/comment/38511211
type: QuestionComment
has text: try/catch has very little "overhead". There is generally no executable code added along the main path, and the only impact on performance is that certain optimizations must be "killed" at the boundaries of the try, catch, and finally clauses.
comment on: http://stackoverflow.com/q/24809711
score: 0
type: Comment

http://stackoverflow.com/q/24802852
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/24803632
upvote count: 5
has comment: http://stackoverflow.com/comment/38498637
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24803632
tagged with: maven
type: AnsweredQuestion
tagged with: java
tagged with: jboss
has title: How to run JBoss 6.2 EAP server using maven and jboss-as-maven-plugin?
has body: I am trying to deploy a simple web application maven project to jboss eat 6.2 and I want to start the server and deploy the project from inside maven. Here is my pom.xml file : <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.skiabox.webapps Tmt-Project2 1.0-SNAPSHOT junit junit 4.11 test javax.servlet javax.servlet-api 3.0.1 provided org.jboss.as.plugins jboss-as-maven-plugin 7.5.Final pre-integration-test run deploy /Users/Administrator/Servers/jboss-eap-6.2/bin localhost user1 password1 10001 The error I am getting after mvm install is the following : [ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.5.Final:run (default) on project Tmt-Project2: Modules path 'null' is not a valid directory. It seems that maven cannot see the directory of the server that I give in the configuration tag.

http://stackoverflow.com/comment/38404463
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24753146
has text: @suitianshi no offense but unless you let me in on your suspicions, I wont be able to do that. I am not allowed to.

http://stackoverflow.com/q/24856603
has body: What I did? Created application rhc app create map https://cartreflect-claytondev.rhcloud.com/reflect?github=openshift-cartridges/openshift-wildfly-cartridge Configure it to be binary deployment rhc app configure -a &lt;your application's name&gt; --deployment-type binary Then I did mkdir binary-deployment &amp;&amp; cd binary-deployment/ &amp;&amp; mkdir -p build-dependencies/.m2 repo/deployments dependencies/jbosseap/deployments Copied war file cp ~/code/IdeaProjects/others/tweetstream/target/tweetstream.war repo/deployments created tar.gz tar -zcvf tweetstream-archive.tar.gz binary-deployment which can be seen as drwxr-xr-x 5 harith Y\Domain Users 170 Jul 20 18:26 binary-deployment -rw-r--r-- 1 harith Y\Domain Users 6124729 Jul 20 18:27 tweetstream-archive.tar.gz Now when I deploy it, I see Deployment of file '/Users/harith/Downloads/tmp/tweetstream-archive.tar.gz' in progress for application map ... Starting deploy for binary artifact Stopping gear Stopping wildfly cart Creating new deployment directory Preparing deployment Preparing build for deployment /bin/tar: Ignoring unknown extended header keyword `SCHILY.dev' /bin/tar: Ignoring unknown extended header keyword `SCHILY.ino' /bin/tar: Ignoring unknown extended header keyword `SCHILY.nlink' /bin/tar: Ignoring unknown extended header keyword `SCHILY.dev' /bin/tar: Ignoring unknown extended header keyword `SCHILY.ino' /bin/tar: Ignoring unknown extended header keyword `SCHILY.nlink' /bin/tar: Ignoring unknown extended header keyword `SCHILY.dev' /bin/tar: Ignoring unknown extended header keyword `SCHILY.ino' /bin/tar: Ignoring unknown extended header keyword `SCHILY.nlink' /bin/tar: Ignoring unknown extended header keyword `SCHILY.dev' /bin/tar: Ignoring unknown extended header keyword `SCHILY.ino' /bin/tar: Ignoring unknown extended header keyword `SCHILY.nlink' /bin/tar: Ignoring unknown extended header keyword `LIBARCHIVE.creationtime' /bin/tar: Ignoring unknown extended header keyword `SCHILY.dev' /bin/tar…
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25222315
favorite count: 0
tagged with: openshift
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: OpenShift: Can not deploy binary application on wildfly
tagged with: wildfly-8
accepted answer: http://stackoverflow.com/a/25222315

http://stackoverflow.com/a/24873077
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24854837
accepted answer of: http://stackoverflow.com/q/24854837
has comment: http://stackoverflow.com/comment/38636574
has body: You are getting the String rather than the SpannableString from the TextView, so you are losing your formatting. Currently you have something like: String storyText = story.getText().toString(); // ... storyText = storyText + " " + "&lt;b&gt;" + field[y] + "&lt;/b&gt;" + " "; storyText.replaceAll("\n", "&lt;br /&gt;"); spanned = Html.fromHtml(storyText); story.setText(spanned); But you might want to try something like: SpannableString spannedStoryText = new SpannableString(story.getText()); // ... String additionalStoryText = " " + "&lt;b&gt;" + field[y] + "&lt;/b&gt;" + " "; additionalStoryText.replaceAll("\n", "&lt;br /&gt;"); // assuming you only want this for the appended text. spannedStoryText = new SpannableString(TextUtils.concat(spannedStoryText, Html.fromHtml(additonalStoryText))); story.setText(spannedStoryText);
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/40546038
answers question: http://stackoverflow.com/q/24809387
has body: ... @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { } ...
has comment: http://stackoverflow.com/comment/68331114
score: 0
type: Answer

http://stackoverflow.com/comment/38576939
type: QuestionComment
comment on: http://stackoverflow.com/q/24844855
score: 2
has text: Try changing `compileSdkVersion 'android-L'` to `compileSdkVersion 19`.
type: Comment

http://stackoverflow.com/q/24823373
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38541970
tagged with: pie-chart
tagged with: intellij-idea
tagged with: jar
has comment: http://stackoverflow.com/comment/38546551
answer count: 0
type: UnansweredQuestion
tagged with: javafx
has comment: http://stackoverflow.com/comment/38538266
has title: Intelli j Java fx Artifacts jar doesnt work
has body: Im currently working on a projekt were i have made some JFX Piecharts and integrating them with Swing Jpanels. Im using Intelli j Idea and when i try to run the code using intelli j it works fine. But when i make a jar file out of it using the artifacts option, it bugs. what happens is that it cant execute the piechart.class which is using JFX. så the application stops. what the piechart class does is that it creates a piechart using JFX and by using JFXPanel i import it to a Swing JPanel. chart->JFXPanel->Jpanel->display panel any suggestions? EDIT: Here is the error Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel at ov_panel.setupcharts(ov_panel.java:142) at ov_panel.&lt;init&gt;(ov_panel.java:37) at userpanel.&lt;init&gt;(userpanel.java:52) at panels.swap(panels.java:33) at login.pass_check(login.java:96) at login$2.keyPressed(login.java:125) at java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:250) at java.awt.Component.processKeyEvent(Component.java:6463) at javax.swing.JComponent.processKeyEvent(JComponent.java:2828) at java.awt.Component.processEvent(Component.java:6282) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727) at java.awt.Component.dispatchEventImpl(Component.java:4731) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Windo…
has comment: http://stackoverflow.com/comment/38562244
tagged with: java

pointers
tags question: http://stackoverflow.com/q/24875840
type: Tag
tag name: pointers

http://stackoverflow.com/comment/40271838
comment on: http://stackoverflow.com/a/24867362
type: AnswerComment
score: 0
type: Comment
has text: @GrandAdmiral you can't find it because it has not been released yet (as of the time of this comment). You probably wont see it until its released on a device, and then sometime within a few weeks after that

http://stackoverflow.com/q/24818617
tagged with: gson
upvote count: 1
type: Question
type: AnsweredQuestion
has title: Parsing json by using Gson.fromJson() method into class< T > model is not working
tagged with: http://stackoverflow.com/tag/json
has body: My problem is, I can't parse json by using Gson.fromJson() method into class&lt; T > model. In my PageOutput.java public class PageOutput&lt;T&gt; { @SerializedName("TotalItemCount") public int totalItemCount; @SerializedName("Items") private T[] items; public final T[] getItems() { return items; } } In Property.java public class Property { @SerializedName("Id") public String id; @SerializedName("Title") public String title; @SerializedName("Price") public BigDecimal price; .... } In Main.java, PageOutput&lt;Property&gt; output = new Gson.fromJson(jsonString, new TypeToken&lt;PageOutput&lt;Property&gt;&gt;(){}.getType()); When project is compiled, I get null in Items. But when I use PageOutput&lt;Property&gt; output = new Gson.fromJson(jsonString, PageOutput.class); I will get the result in generic object type for T[] items, by the meantime I should get Property type. (Line 18) output = {com.myapp.PageOutput@830048974608} items = {java.lang.Object[17]@830048616120} //Line 18 [0] = {com.google.gson.internal.LinkedTreeMap@830048777632} size = 16 [1] = {com.google.gson.internal.LinkedTreeMap$Node@830047149712}"Id" -&gt; "2936918.0" [2] = {com.google.gson.internal.LinkedTreeMap$Node@830047452528}"Title" -&gt; "Valdor, Penang" [3] = {com.google.gson.internal.LinkedTreeMap$Node@830047985896}"Price" -&gt; "7.5698E9" And when I cast this object, Property[] properties = output.getItems(); //Return error I will get error: java.lang.ClassCastException: java.lang.Object[] cannot be cast to com.myapp.model.Property[] How can I solve the problem? Please help and thank you very much.
answer count: 2
tagged with: types
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24818691
tagged with: android
has answer: http://stackoverflow.com/a/24819143
possible better answer: http://stackoverflow.com/a/24818691
accepted answer: http://stackoverflow.com/a/24819143
score: 1
tagged with: java

http://stackoverflow.com/comment/38520324
score: 0
type: QuestionComment
type: Comment
has text: possible duplicate of [What's the advantage of a Java enum versus a class with public static final fields?](http://stackoverflow.com/questions/9969690/whats-the-advantage-of-a-java-enum-versus-a-class-with-public-static-final-fiel) or [this](Static String constants VS enum in Java 5+) or [this](https://stackoverflow.com/questions/2229297/java-enumerations-vs-static-constants).
comment on: http://stackoverflow.com/q/24812265

http://stackoverflow.com/q/24803697
answer count: 1
has title: cocos2dx: Multithreading with pthread and JNI calls crashs with “native thread exited without detaching”
has body: in my cross-platform cocos2dx game I want to async load some images from web and save them to the local storage. For the Android part I use JNI calls to download and save the image to storage with native java code. It works perfect. But when I try to do this in a seperated pthread to prevent my game from freezing I get the error: "native thread exited without detaching" after "ThreadFunction(void *arg)" is finished. here is my c++ code: //c++ code void MyClass::loadImages(){ pthread_t thread; SimpleStructure* args = new SimpleStructure(); args-&gt;s_url = url; args-&gt;s_savename = savename; pthread_create(&amp;thread, NULL, &amp;ThreadFunction, args); } void* ThreadFunction(void * arg) { SimpleStructure * args = (SimpleStructure * ) arg; std::string localImagePath; #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) localImagePath = getImageFilePathJNI(args-&gt;s_url.c_str(), args-&gt;s_savename.c_str()); #endif #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) localImagePath = URLSpriteHelper::getUrlSprite(args-&gt;s_url, args-&gt;s_savename); #endif pthread_mutex_lock(&amp;mutex); loadedImages.push_back(localImagePath); pthread_mutex_unlock(&amp;mutex); return NULL; } here is my JNI code: extern "C" { std::string getImageFilePathJNI(const char* urlStr, const char* saveName) { std::string ret; JniMethodInfo t; if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/cpp/AppActivity", "saveImageFromURLtoInternalStorage", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;")) { jstring StringArg1 = t.env-&gt;NewStringUTF(urlStr); jstring StringArg2 = t.env-&gt;NewStringUTF(saveName); jstring retFromJava = (jstring)t.env-&gt;CallStaticObjectMethod(t.classID, t.methodID, StringArg1, StringArg2); const char* str = t.env-&gt;GetStringUTFChars(retFromJava, 0); ret = str; t.env-&gt;ReleaseStringUTFChars(retFromJava, str); t.env-&gt;DeleteLocalRef(StringArg1); t.env-&gt;DeleteLocalRef(StringArg2); t.env-&gt;DeleteLocalRef(t.classID); } return ret; } } Any ideas what I'm doing wrong…
score: 0
tagged with: android
tagged with: c++
type: AnsweredQuestion
tagged with: multithreading
type: Question
tagged with: java-native-interface
tagged with: java
has answer: http://stackoverflow.com/a/24819373
accepted answer: http://stackoverflow.com/a/24819373

http://stackoverflow.com/comment/38549444
score: 0
comment on: http://stackoverflow.com/q/24830002
type: Comment
type: QuestionComment
has text: You could start by closing all your ` ` and ` ` tags. Also, you are eating up any exception thrown so you'll never know if it is failing or why.

http://stackoverflow.com/q/24758807
has answer: http://stackoverflow.com/a/24759336
has title: How to get Content Location in Response?
tagged with: java
tagged with: post
type: Question
tagged with: mongodb
answer count: 2
tagged with: jersey
has body: I am using a java REST service for storing data in Mongodb using POST method in response it will return me an id which will be used to retrieve the data back. I want to get the id in contentLocation how can i do so?? Here is my POST method for which I need contentLocation @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) throws FileNotFoundException, URISyntaxException { filePath = SERVER_UPLOAD_LOCATION_FOLDER + fileDetail.getFileName(); // save the file to the server Mongodb_storage location =new Mongodb_storage(); location.store_in_db(uploadedInputStream, FilenameUtils.getExtension(filePath)); String output = "File saved to server location " + filePath; return Response.status(200).contentLocation(new URI("/53c5ac66796029898a5197d4")).entity(output).build();//here I have used content location }
score: 0
has answer: http://stackoverflow.com/a/24763206
type: UnansweredQuestion

http://stackoverflow.com/q/24780517
favorite count: 0
has answer: http://stackoverflow.com/a/24780688
has comment: http://stackoverflow.com/comment/38456599
accepted answer: http://stackoverflow.com/a/24780584
possible better answer: http://stackoverflow.com/a/24780688
score: 2
downvote count: 0
tagged with: inner-classes
has answer: http://stackoverflow.com/a/24780584
has title: How to check ownership of inner classes in Java
has comment: http://stackoverflow.com/comment/38455608
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38455557
tagged with: class
type: Question
upvote count: 2
answer count: 2
has body: I have the following structure: public class Outer { public /*non-static*/ final class Inner { // to prevent instantiating other than in method `create` private Inner(/* ... */) { /* ... */ } /* ... */ } Inner create(/* ... */) { return new Inner(/* ... */); } void operateOn(Inner inner) { // TODO check if inner for this Outer instance } } and usage like this: Outer manager = new Outer(); Inner state = manager.create(/* ... */); and somewhere else manager.operateOn(state); I want to create a fool-proof utility class, meaning Outer.operateOn would only accept Inner instances owned by itself I know that all non-static inner classes have a reference to (all) outer classes via Outer.this inside their class body. I'm wondering if there's a better method for checking this than adding any method to Inner like isOwnedBy(Outer outer) { return outer == Outer.this; } or getOwner() { return Outer.this }.
has comment: http://stackoverflow.com/comment/38456665

http://stackoverflow.com/q/24815892
answer count: 3
possible better answer: http://stackoverflow.com/a/24816012
downvote count: 0
has answer: http://stackoverflow.com/a/24816012
accepted answer: http://stackoverflow.com/a/24914293
has answer: http://stackoverflow.com/a/24816335
favorite count: 0
has body: I've been experiencing with SWT (GUI lib Eclipse uses) and I'm wanting to create the following using Swing. The previous screenshot is done by the following code using SWT public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display, SWT.RESIZE); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } I was wondering, how could I possible emulate this in Swing? P.S The border around this Shell is currently the native border for my windows color scheme, I don't wanna just create a MatteBorder and emulate the color, I'd like to use the native border for windows.
has comment: http://stackoverflow.com/comment/38523602
tagged with: swt
tagged with: swing
type: AnsweredQuestion
has title: Emulate This SWT Shell in Swing
tagged with: java
has comment: http://stackoverflow.com/comment/38523621
has comment: http://stackoverflow.com/comment/38523107
has comment: http://stackoverflow.com/comment/38523451
type: Question
has comment: http://stackoverflow.com/comment/38523718
has comment: http://stackoverflow.com/comment/38701629
has comment: http://stackoverflow.com/comment/38523775
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/38523786
has answer: http://stackoverflow.com/a/24914293
tagged with: border

http://stackoverflow.com/q/24861603
has answer: http://stackoverflow.com/a/24862001
tagged with: counter
has answer: http://stackoverflow.com/a/24861764
score: 0
answer count: 2
has body: I am trying to make an applet for a site, and this log in applet it's what I started today to "play" with. It's in a project state, I have much more to work on it, but the log in attempts counter doesn't seem to be incremented as I want to, and I don't know why (the System.out.println(counter); is there only for showing me that the counter remains 1), any thoughts? Also, can you point me into a direction(links, examples) of log in applets, a place where I could learn more and try to apply things for my own site? Thank you. Here is the code: import java.applet.Applet; import java.awt.Button; import java.awt.Graphics; import java.awt.Label; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /* &lt;applet code = "Login" width= 200 height = 200&gt; &lt;/applet&gt; */ public class Login extends Applet implements ActionListener { Label lblUser, lblPassword; TextField txtUser, txtPassword; Button bLogin; boolean blnCorrect; public void init() { lblUser = new Label("UserName"); add(lblUser); txtUser = new TextField(20); txtUser.setText("Username"); add(txtUser); lblPassword = new Label("Password"); add(lblPassword); txtPassword = new TextField(20); txtPassword.setText("Password"); add(txtPassword); bLogin = new Button("Login"); add(bLogin); bLogin.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(txtUser.getText().equals("demo") &amp;&amp; txtPassword.getText().equals("demopassword")) blnCorrect = true; else blnCorrect = false; repaint(); } public void paint(Graphics g) { int counter=0; if(txtUser.getText().equals("Username") &amp;&amp; txtPassword.getText().equals("Password")) g.drawString("Please enter your username and password ", 50, 100); if(blnCorrect) g.drawString("Successfully Logged in.", 50, 100); else while(txtUser.getText().equals("demo") &amp;&amp; !txtPassword.getText().equals("demopassword")){ counter=counter++; System.out.println(counter); txtUser.setText(" "); txtPassword.setText(" ")…
tagged with: applet
type: UnansweredQuestion
tagged with: java
tagged with: authentication
type: Question
has title: Java applet log in attempts counter not working properly

http://stackoverflow.com/q/24814794
has comment: http://stackoverflow.com/comment/38521014
has comment: http://stackoverflow.com/comment/38521269
possible better answer: http://stackoverflow.com/a/24818137
answer count: 2
has answer: http://stackoverflow.com/a/24818137
has comment: http://stackoverflow.com/comment/38527247
downvote count: 0
has comment: http://stackoverflow.com/comment/38521172
favorite count: 0
has title: Java database interaction pattern
has answer: http://stackoverflow.com/a/24817622
tagged with: jdbc
tagged with: lambda
has body: I am building essentially a java app to handle and respond to RPC events. I am finding myself doing something along the lines of the following all the time and my java knowledge is hitting a brick wall. PreparedStatement preparedStatement = null; try { preparedStatement = conn.prepareStatement(removeFollowersStmt); preparedStatement.setLong(1, Long.parseLong(conversation) ); preparedStatement.setLong(2, Long.parseLong(userId) ); preparedStatement.executeUpdate(); return true; } catch (SQLException e) { e.printStackTrace(); return false; } finally { try { assert preparedStatement != null; preparedStatement.clearParameters(); preparedStatement.close(); } catch (SQLException e) { e.printStackTrace(); } } Ideally I would only do the try/catch/finally a single time and be able some how invoke the various database interactions from within the try. I am not familiar enough with java to do this but my thought was possibly I could create a function that accepted a closure which would be invoked inside the try?
tagged with: java-8
accepted answer: http://stackoverflow.com/a/24817622
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: try-with-resources
type: Question

http://stackoverflow.com/q/24842268
score: -1
has body: I would like to receive information from a current item of the view through a button external, as it shows the image, the button is outside of the adapter. Can anyone help me? Image : https://www.dropbox.com/s/ikdcjp7zmhyc1hm/image.png MainActivity.class SimpleCardStackAdapter adapter = new SimpleCardStackAdapter(MainActivity.this); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.mainlayout); new JSONParse().execute(); } private class JSONParse extends AsyncTask&lt;String, String, JSONObject&gt; { @Override protected void onPreExecute() { super.onPreExecute(); mCardContainer = (CardContainer) findViewById(R.id.layoutview); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage("Obteniendo datos ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected JSONObject doInBackground(String... args) { JSONParser jParser = new JSONParser(); JSONObject json = jParser.getJSONfromURL(url); return json; } @Override protected void onPostExecute(JSONObject json) { if(json != null){ pDialog.dismiss(); try { // Getting JSON Array user = json.getJSONArray(TAG_USER); for (int i = 0; i &lt; user.length(); i++) { JSONObject c = user.getJSONObject(i); id = c.getString(TAG_ID); String image = c.getString(imagen); adapter.add(new CardModel(id, "Sevilla", image)); } //T lovebtn = (Button) findViewById(R.id.lovebtn); lovebtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), ""+item, Toast.LENGTH_SHORT).show(); } });*/ mCardContainer.setAdapter(adapter); } catch (JSONException e) { e.printStackTrace(); } }else{ pDialog.dismiss(); Toast.makeText(getApplicationContext(), "Compruebe su conexión e inténtelo de nuevo más tarde", Toast.LENGTH_SHORT).show(); //No hay datos } } } SimpleCardStackAdapter.class public …
answer count: 1
tagged with: button
tagged with: adapter
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24842329
tagged with: java
has title: Get adapter info via an external button on Android
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/4709870
upvote count: 0

http://stackoverflow.com/comment/38833710
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24877673
has text: @adcom I can give you the files for the custom array list if you want them

http://stackoverflow.com/q/24752615
tagged with: xslt
type: Question
has comment: http://stackoverflow.com/comment/38403574
has comment: http://stackoverflow.com/comment/38447739
has comment: http://stackoverflow.com/comment/38443751
score: 0
has title: How to send a string array as parameter to Java from xslt?
type: UnansweredQuestion
has body: I am calling a java function from xslt which has a string array as a parameter. I tried to convert the string to array using : <xsl:variable name="strArr"> abc@tdm.com xyz@tdm.com </xsl:variable> I get this error: could not find method com.techm.ump.applicationServices.Email.postMail([ExpressionContext,] #RTREEFRAG, #RTREEFRAG, #STRING, #STRING)" When I try to convert using : document('')/*/xsl:variable[@name='FMail']/* I get this error: could not find method com.techm.ump.applicationServices.Email.postMail([ExpressionContext,] #NODESET, #NODESET, #STRING, #STRING)" Please let me know if there is a way to convert string into a string array in xslt.
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38609854

http://stackoverflow.com/q/24812770
type: Question
has body: It's so hard to find out why this isn't working, my research indicates it should work. I'm try to do this logical match - start of line has from: then any amount of characters then start of line has sent: . Please see code, I would think it would print match found but doesn't: import java.util.regex.Matcher; import java.util.regex.Pattern; public class Test2 { public static void main(String[] args) { Pattern lineDividerGuessMatchPattern = Pattern.compile("(?m)(?i)(^from:)(.*?)(^sent:)"); String testString = "cheese \n" + "from: cheese\n" + "sent: bacon"; Matcher m = lineDividerGuessMatchPattern.matcher(testString); if(m.find()) System.out.println("Match found"); } }
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has title: Can't figure out why this regex doesn't work (multiple lines of text with "starts with" qualifier)
has answer: http://stackoverflow.com/a/24812825
tagged with: regex
accepted answer: http://stackoverflow.com/a/24812825
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24812900
has answer: http://stackoverflow.com/a/24812900
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/38454334
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24779581
has text: I dont know why it got downvoted , question is perfectly valid(just that i did not add i tried X and Y) , Anyways adding that i tried X an Y :)

http://stackoverflow.com/comment/38533553
type: Comment
comment on: http://stackoverflow.com/a/24819169
type: AnswerComment
has text: It's inside the same package as the above class.
score: 0

http://stackoverflow.com/comment/38865366
comment on: http://stackoverflow.com/a/24995900
type: AnswerComment
score: 0
type: Comment
has text: Nop. I have seen your code so far and asked what you are trying to do, but I have the feeling things are still not clear, for both of us. Your code shows `HttpServletRequest` but anything else is not proving you want this tested in a web environment. If you are, though, take a look at [this testing class](https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java) from Spring itself.

http://stackoverflow.com/q/24886058
type: AnsweredQuestion
upvote count: 1
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/24886996
score: 1
tagged with: java
has title: XML android layout hiding icon
accepted answer: http://stackoverflow.com/a/24886996
downvote count: 0
answer count: 1
has body: I'm writing an Android app and I've encountered a strange thing. Namely it is a visibility of my icon. It should be on the right side of the screen. When I put it to the left it is ok and it is visible like this: But when I put it right it looks like this: My code looks like this: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:layout_marginLeft="10dp" android:text="@string/title" android:textColor="#666666" android:textSize="20sp"/> <ImageView android:id="@+id/image" android:layout_width="60dp" android:layout_height="60dp" android:gravity="top" android:alpha=".50" android:src="@drawable/paprika" /> <TextView android:id="@+id/description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="15dp" android:text="@string/description" android:textColor="#666666" />
tagged with: icons
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/24767702
linked to: http://stackoverflow.com/q/16614029
has title: Hadoop (Yarn): Set mapper input separator?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24768213
tagged with: java
type: Question
tagged with: hadoop
tagged with: hadoop2
accepted answer: http://stackoverflow.com/a/24768213
score: 0
answer count: 1
has body: I want to be able to set different separators for my key/value pairs which I receive in to the map function of my MR job. For example my text file might have: John-23 Mary-45 Scott-13 and in my map function I want the key to be John and the value to be 23 etc for each element. Then if I set the output separator using conf.set("mapreduce.textoutputformat.separator", "-"); Will the reducer pick up the key until the first '-' and the value everything after that? or do I need to make changes for the reducer as well? Thanks

libgdx
tags question: http://stackoverflow.com/q/24769746
tags question: http://stackoverflow.com/q/24810701
tags question: http://stackoverflow.com/q/24809465
tags question: http://stackoverflow.com/q/24843761
tags question: http://stackoverflow.com/q/24852423
tags question: http://stackoverflow.com/q/24826195
tags question: http://stackoverflow.com/q/24856201
tags question: http://stackoverflow.com/q/24774904
tag name: libgdx
tags question: http://stackoverflow.com/q/24838883
tags question: http://stackoverflow.com/q/24749593
tags question: http://stackoverflow.com/q/24867203
tags question: http://stackoverflow.com/q/24807058
tags question: http://stackoverflow.com/q/24894698
tags question: http://stackoverflow.com/q/24799929
tags question: http://stackoverflow.com/q/24895111
tags question: http://stackoverflow.com/q/24850475
tags question: http://stackoverflow.com/q/24788443
tags question: http://stackoverflow.com/q/24787297
tags question: http://stackoverflow.com/q/24896430
type: Tag
tags question: http://stackoverflow.com/q/24828004
tags question: http://stackoverflow.com/q/24767877
tags question: http://stackoverflow.com/q/24834385
tags question: http://stackoverflow.com/q/24884517
tags question: http://stackoverflow.com/q/24756326
tags question: http://stackoverflow.com/q/24778054
tags question: http://stackoverflow.com/q/24775329
tags question: http://stackoverflow.com/q/24763379
tags question: http://stackoverflow.com/q/24759463
tags question: http://stackoverflow.com/q/24791802
tags question: http://stackoverflow.com/q/24768316
tags question: http://stackoverflow.com/q/24887580
tags question: http://stackoverflow.com/q/24771068
tags question: http://stackoverflow.com/q/24764968
tags question: http://stackoverflow.com/q/24862676
tags question: http://stackoverflow.com/q/24770215
tags question: http://stackoverflow.com/q/24784624
tags question: http://stackoverflow.com/q/24892623
tags question: http://stackoverflow.com/q/24780532
tags question: http://stackoverflow.com/q/24850534
tags question: http://stackoverflow.com/q/24890200
tags question: http://stackoverflow.com/q/24853501
tags question: http://stackoverflow.com/q/24778613

http://stackoverflow.com/a/24884279
upvote count: 3
has comment: http://stackoverflow.com/comment/38652293
accepted answer of: http://stackoverflow.com/q/24884169
has body: I have tried using HTML which works perfectly, although this would go horribly wrong if any of these records contained any sort of html tags, as they would be rendered. Actually if the text contains html tags you can escape the tags and wrap it in &lt;html&gt; escaped text of record&lt;/html&gt; marking text wth desired colors UPDATE working example public static void main(String[] args) { JFrame f=new JFrame(); String text="&lt;html&gt;An example of tag &amp;lt;html&amp;gt; with &lt;font color='red'&gt;&amp;lt;input&amp;gt;&lt;/font&gt; tag colored&lt;/html&gt;"; f.add(new JLabel(text)); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
has comment: http://stackoverflow.com/comment/38652059
answers question: http://stackoverflow.com/q/24884169
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer

http://stackoverflow.com/comment/38455186
score: 0
type: Comment
type: AnswerComment
has text: But I want to read samples from .wav, so I thought to use AudioInputStream. Is there some other way? Thanks!
comment on: http://stackoverflow.com/a/24780291

http://stackoverflow.com/comment/38580437
has text: You declare `randomNumbers` in `main`, so it's not visible to `printArray`
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24846624

http://stackoverflow.com/comment/38467599
has text: You are talking about the English writing system, not an "English word." Just as नमस्ते is not a Devanagari word, it's a Marathi, Hindi, and maybe other languages' word.
comment on: http://stackoverflow.com/q/24751432
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38451394
comment on: http://stackoverflow.com/a/24777765
type: AnswerComment
has text: I think it would be more helpful for the op and further visitors, when you add some explanations to your intention.
score: 0
type: Comment

http://stackoverflow.com/comment/38489810
type: Comment
has text: it should express: if there is the same typename mapped to the different namespace n2 as it is in n1, all individuals of n1 get also the same type in n2, but i would first consult your pointer, and than maybe post a new question. Thanks
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24786478

http://stackoverflow.com/comment/38484577
score: 0
type: AnswerComment
has text: Yes I could do that, but if I want to use it in another method, I will not get it so annotation is not a solution for me neither. It's tricky case I agree...
type: Comment
comment on: http://stackoverflow.com/a/24795003

http://stackoverflow.com/q/24771679
tagged with: playframework-2.0
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/32531898
type: Question
has comment: http://stackoverflow.com/comment/38440142
has comment: http://stackoverflow.com/comment/38439782
has comment: http://stackoverflow.com/comment/38440104
upvote count: 1
has title: java.lang.NoClassDefFoundError: scala/StringContext
answer count: 1
has body: Scala, Play in CentOS I'm not totally sure how to explain this error, because I'm diving head first into a framework I don't know much about. But if it is a common error, someone here should be able to help me. Basically, I'm trying to "play" a project, and I get this error. What's the problem, some direction please. http://pastebin.com/WqdNHNF1
has comment: http://stackoverflow.com/comment/38440089
tagged with: scala-2.10
favorite count: 0
has comment: http://stackoverflow.com/comment/38439829
has comment: http://stackoverflow.com/comment/38440615
has comment: http://stackoverflow.com/comment/38440012
tagged with: scala
type: UnansweredQuestion

http://stackoverflow.com/comment/38558147
has text: @ MadProgrammer Then what should I do . Help me please
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24832750

http://stackoverflow.com/a/24905704
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/64018510
has comment: http://stackoverflow.com/comment/63900814
type: Answer
has comment: http://stackoverflow.com/comment/78087329
has comment: http://stackoverflow.com/comment/90025256
has comment: http://stackoverflow.com/comment/63899622
downvote count: 1
has comment: http://stackoverflow.com/comment/38709916
has body: Add a pane with no content which always grows to fit available space between the left aligned tools in the bar and right aligned ones. <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <Pane HBox.hgrow="ALWAYS" />
has comment: http://stackoverflow.com/comment/63922868
score: 103
has comment: http://stackoverflow.com/comment/64195924
upvote count: 104
accepted answer of: http://stackoverflow.com/q/24896498
has comment: http://stackoverflow.com/comment/79703122
answers question: http://stackoverflow.com/q/24896498

http://stackoverflow.com/comment/39515463
comment on: http://stackoverflow.com/a/24854712
type: AnswerComment
type: Comment
has text: But it doesn't warm up the JITC.
score: 1

http://stackoverflow.com/q/24810675
tagged with: data-structures
linked to: http://stackoverflow.com/q/24025392
has comment: http://stackoverflow.com/comment/38515780
accepted answer: http://stackoverflow.com/a/24810783
has comment: http://stackoverflow.com/comment/38516774
answer count: 3
has comment: http://stackoverflow.com/comment/38513377
has answer: http://stackoverflow.com/a/24811094
has title: Data too big for int indexing
has comment: http://stackoverflow.com/comment/38513157
favorite count: 0
has answer: http://stackoverflow.com/a/24824077
upvote count: 2
has comment: http://stackoverflow.com/comment/38512839
possible better answer: http://stackoverflow.com/a/24811094
has comment: http://stackoverflow.com/comment/38512885
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38513293
has comment: http://stackoverflow.com/comment/38514033
tagged with: java
has comment: http://stackoverflow.com/comment/38515800
has comment: http://stackoverflow.com/comment/38513805
has comment: http://stackoverflow.com/comment/38513224
has comment: http://stackoverflow.com/comment/38513435
type: Question
has body: Suppose I'm into Big Data (as in bioinformatics), and I've chosen to analyze it in Java using the wonderful Collections Map-Reduce framework on HPC. How can I work with datasets of more than 2 31 ^ 1 - items? For example, final List&lt;Gene&gt; genome = getHugeData(); profit.log(genome.parallelStream().collect(magic);
score: 2
has answer: http://stackoverflow.com/a/24810783
downvote count: 0

http://stackoverflow.com/comment/38612670
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24863376
has text: @user3764893, Yes, my callback `onRandomAddEventFromRemoteEnd` is called by an anonymous thread and i am calling `runOnUiThread`
score: 0

http://stackoverflow.com/q/24902382
linked to: http://stackoverflow.com/q/5351854
has answer: http://stackoverflow.com/a/24902438
has answer: http://stackoverflow.com/a/24902933
type: Question
tagged with: gwt
tagged with: java
has body: In Gwt DataGrid we have SelectionCell in Column ,in which we can pass List. I want a selection Cell with Checkboxes and Text in it.So that on dropdown we will get checkbox and String text list. Please Help.
score: 0
answer count: 2
has title: How To Add Checkbox in Selection Cell GWT
type: UnansweredQuestion

http://stackoverflow.com/comment/38582542
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24847613
has text: But make sure to check **b** against 0!
score: 1

http://stackoverflow.com/comment/38480816
score: 0
type: Comment
has text: @Ash Thanks for the response, but the order or elements would change depending on the values entered and boxes checked. I don't think I would be able to use this method to do that.
type: AnswerComment
comment on: http://stackoverflow.com/a/24793399

http://stackoverflow.com/a/24764190
has comment: http://stackoverflow.com/comment/38460232
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24750967
downvote count: 0
has body: I dont think its possible with standard CDI. But if you use the DeltaSpike extension, you can use BeanProvider.injectFields ... does what you want. Note that of course your Pojo is not managed (scoped) by CDI, only the field injections are resolved ...
has comment: http://stackoverflow.com/comment/38524274
has comment: http://stackoverflow.com/comment/38461055
upvote count: 2

http://stackoverflow.com/q/24827560
tagged with: business-rules
possible better answer: http://stackoverflow.com/a/24827694
type: AnsweredQuestion
tagged with: drools
has title: Drools Regex to Match Non-Alpha
tagged with: java
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24827701
has body: According to the Drools Documentation, I should be able to match the following regex in a rule, since the matches operator "Matches a field against any valid Java Regular Expression." However, $firstName : String(value matches "[^A-Za-z]") from $person.name.firstName results in an error when attempting to evaluate the rule. What am I missing here? Edit - originally had "contains" instead of "matches" in the expression. This was a type-o made when re-typing an expression similar to the one I'm working with.
accepted answer: http://stackoverflow.com/a/24827701
has answer: http://stackoverflow.com/a/24827694

http://stackoverflow.com/comment/38603389
has text: @RemiliaScarlet Hope it all helps
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24858285
type: AnswerComment

http://stackoverflow.com/comment/38406410
comment on: http://stackoverflow.com/a/24754027
score: 0
type: AnswerComment
type: Comment
has text: can you print the object and show it in logcat that you are getting the object with all values filled.

http://stackoverflow.com/comment/38688890
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24903578
has text: you could print out the canonicalpath of the File as a kind of debugging - then you might see if the relative path was correct.
score: 0

http://stackoverflow.com/q/24850688
has body: I am trying to make an interval count down timer app. I already made a normal timer which counts down 3 minutes - you can change the time of course - but I would like to have a count down timer which counts down 20 seconds, and as soon as they are over 10, more should start. I seriously don't know how to make it, that's why I need some help. If anyone could help me to fix it, I would be very thankful. Thanks in advance. Here's my code, check it out: import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import java.util.concurrent.TimeUnit; @TargetApi(Build.VERSION_CODES.GINGERBREAD) @SuppressLint("NewApi") public class MainActivity extends Activity { Button btnStart, btnStop; TextView textViewTime; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnStart = (Button)findViewById(R.id.btnStart); btnStop = (Button)findViewById(R.id.btnStop); textViewTime = (TextView)findViewById(R.id.textViewTime); textViewTime.setText("00:03:00"); final CounterClass timer = new CounterClass(180000,1000); btnStart.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { timer.start(); } }); btnStop.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { timer.cancel(); } }); } @TargetApi(Build.VERSION_CODES.GINGERBREAD) @SuppressLint("NewApi") public class CounterClass extends CountDownTimer { public CounterClass(long millisInFuture, long countDownInterval) { super(millisInFuture, countDownInterval); } @Override public void onFinish() { textViewTime.setText("Completed."); } @SuppressLint("NewApi") @TargetApi(Build.VERSION_CODES.GINGERBREAD) @Override public void onTick(long millisUntilF…
score: 0
tagged with: android
answer count: 1
tagged with: timer
tagged with: countdowntimer
accepted answer: http://stackoverflow.com/a/24851054
type: AnsweredQuestion
tagged with: java
has title: Interval count down timer doesn't work
has answer: http://stackoverflow.com/a/24851054
type: Question

http://stackoverflow.com/comment/38586654
type: Comment
type: QuestionComment
has text: @user3808021: Please post the respective code too
comment on: http://stackoverflow.com/q/24849826
score: 0

http://stackoverflow.com/comment/38563732
has text: If i is not an integer literal then what it means to be declaring int 1=12;?
type: Comment
comment on: http://stackoverflow.com/a/24837697
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38673045
type: Comment
score: 0
type: AnswerComment
has text: @Dan OK, then maybe the first part of my answer is sufficient?
comment on: http://stackoverflow.com/a/24894705

http://stackoverflow.com/comment/38426476
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24759841
has text: What do you use at the service layer? controller?

http://stackoverflow.com/comment/38601326
type: QuestionComment
score: 0
has text: @peeskillet I am trying to draw a rectangle. Yes, a graphic. I was working using blueJ and the snippet just worked fine. Now that I am using eclipse, most of my code is not working. Thank you for the links you have provided.
comment on: http://stackoverflow.com/q/24857236
type: Comment

http://stackoverflow.com/q/24753150
has comment: http://stackoverflow.com/comment/38404901
has body: I've run into a really strange bug, and I'm hoping someone here can shed some light as it's way out of my area of expertise. First, relevant background information: I am running OS X 10.9.4 on a Late 2013 Macbook Pro Retina with a 2.4GHz Haswell CPU. I'm using JDK SE 8u5 for OS X from Oracle, and I'm running my code on the latest version of IntelliJ IDEA. This bug also seems to be specific only to OS X, as I posted on Reddit about this bug already and other users with OS X were able to recreate it while users on Windows and Linux, including myself, had the program run as expected with the println() version running half a second slower than the version without println(). Now for the bug: In my code, I have a println() statement that when included, the program runs at ~2.5 seconds. If I remove the println() statement either by deleting it or commenting it out, the program counterintuitively takes longer to run at ~9 seconds. It's extremely strange as I/O should theoretically slow the program down, not make it faster. For my actual code, it's my implementation of Project Euler Problem 14. Please keep in mind I'm still a student so it's not the best implementation: public class ProjectEuler14 { public static void main(String[] args) { final double TIME_START = System.currentTimeMillis(); Collatz c = new Collatz(); int highestNumOfTerms = 0; int currentNumOfTerms = 0; int highestValue = 0; //Value which produces most number of Collatz terms for (double i = 1.; i &lt;= 1000000.; i++) { currentNumOfTerms = c.startCollatz(i); if (currentNumOfTerms &gt; highestNumOfTerms) { highestNumOfTerms = currentNumOfTerms; highestValue = (int)(i); System.out.println("New term: " + highestValue); //THIS IS THE OFFENDING LINE OF CODE } } final double TIME_STOP = System.currentTimeMillis(); System.out.println("Highest term: " + highestValue + " with " + highestNumOfTerms + " number of terms"); System.out.println("Completed in " + ((TIME_STOP - TIME_START)/1000) + " s"); } } public class C…
has comment: http://stackoverflow.com/comment/38440651
type: Question
has comment: http://stackoverflow.com/comment/38437588
has comment: http://stackoverflow.com/comment/38574435
has comment: http://stackoverflow.com/comment/38408373
has comment: http://stackoverflow.com/comment/38404829
upvote count: 12
has comment: http://stackoverflow.com/comment/38410002
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38583436
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/38482426
has answer: http://stackoverflow.com/a/24942185
has comment: http://stackoverflow.com/comment/38405248
has comment: http://stackoverflow.com/comment/38432931
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24942185
score: 12
has title: In OS X, why does using println() cause my program to run faster than without println()
tagged with: java

http://stackoverflow.com/a/24888968
type: Answer
has comment: http://stackoverflow.com/comment/38698169
has body: There is no way to do that. you can test an object for its class by using instanceof Object integerValue = 1234; Object doubleValue = 12.34; Object array = new String[] { "This", "is", "a", "Stringarray" }; if (integerValue instanceof Integer) { System.out.println("it's an Integer! Classname: " + integerValue.getClass().getName()); // will be printed } if (doubleValue instanceof Double) { System.out.println("this one is a Double *___* Classname: " + doubleValue.getClass().getName()); // will be printed } if (array instanceof String) { System.out.println("Is it a String?"); } else if (array instanceof String[]) { System.out.println("It's a Stringarray :O! Classname: " + array.getClass().getName()); // will be printed } else { System.out.println("Huh? Something went wrong here :D"); }
downvote count: 1
answers question: http://stackoverflow.com/q/24888629
score: -1
has comment: http://stackoverflow.com/comment/38661045
upvote count: 0
has comment: http://stackoverflow.com/comment/38687459

http://stackoverflow.com/a/24819379
has comment: http://stackoverflow.com/comment/38529223
upvote count: 2
answers question: http://stackoverflow.com/q/24819332
type: Answer
score: 2
downvote count: 0
has body: This should be able to intercept the signal Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { /* my shutdown code here */ } }); More information here: How can I "intercept" Ctrl+C in a CLI application?

http://stackoverflow.com/q/24792477
has answer: http://stackoverflow.com/a/24796058
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/38483239
has comment: http://stackoverflow.com/comment/38479364
has comment: http://stackoverflow.com/comment/38479126
has comment: http://stackoverflow.com/comment/38483002
has comment: http://stackoverflow.com/comment/38483571
has comment: http://stackoverflow.com/comment/38482674
has comment: http://stackoverflow.com/comment/38482862
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has title: Spring:failed to load applicationContext?
has body: My project has service module which has applicationContext.xml on src/main/resources path. I run integration test using maven-cargo plugin and dependency looks like org.codehaus.cargo cargo-maven2-plugin 1.4.8 tomcat7x <spring.profiles.active>${spring.profiles.active}</spring.profiles.active> org.apache.derby derby org.apache.derby derbyclient <cargo.servlet.port>9090</cargo.servlet.port> <cargo.datasource.datasource.derby>cargo.datasource.driver=org.apache.derby.jdbc.ClientDriver cargo.datasource.url=jdbc:derby://localhost:1527/pryme_common;create=true| cargo.datasource.username=sa|</cargo.datasource.datasource.derby> com.org.common services war common start-container start pre-integration-test stop-container stop post-integration-test I run my integration test as @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:applicationContext.xml") public class ITCache extends AbstractIntegrationTest { @Autowired private ApplicationContext applicationContext; @Test public void testCaches() { { final String url = "http://localhost:9090/common/rest"; final Client client = ClientBuilder.newClient(); final WebTarget target = client.target(url).path("networks"); final Invocation.Builder builder = target.request().accept(MediaType.APPLICATION_JSON); final Response response = builder.get(); assertStatus(Response.Status.OK.getStatusCode(), response); } assertNotNull(applicationContext); final SimpleCacheManager simpleCacheManager = (SimpleCacheManager) applicationContext.getBean("cacheManager"); System.out.println("cacheName:" + simpleCacheManager.getCacheNames().toString()); System.out.println(simpleCacheManager.getCache("genders").toString()); } } and I see error as Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.018 sec <<< FAILURE! testCaches(com.org.comma.integration.ITCache) Time elapsed: 0.016 sec <<< ERROR! java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareConte…
tagged with: java

http://stackoverflow.com/q/24766184
favorite count: 0
has comment: http://stackoverflow.com/comment/38471625
upvote count: 2
has answer: http://stackoverflow.com/a/24788565
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38471576
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38431557
tagged with: java
tagged with: hibernate
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38471788
type: Question
accepted answer: http://stackoverflow.com/a/24788565
has body: I have the following problem. I have 10 Threads which create objects that are inserted in the database. Each Thread has a ThreadLocal and its own session. All objects are inserted together, after they were created. These objects have a column which is marked as unique. However, I have the problem, that it can happen that two different threads create the same object. This behaviour is wanted but I don't know how I can insert them into my database. Currently, each thread queries all objects that are inserted in the database, checks on the queried objects if they exist or not and inserts the non-existing objects into the database. However, as it can happen that the object did not exist on the query of all objects, I get a ConstraintViolationException when I insert the objects and they were already added by another Thread. However, doing a database (or cache) query for each object has to bad performance, as we are trying to add 1000 objects per thread and minute. If I try to flush the database after each single insert, then I get the following error: Deadlock found when trying to get lock; try restarting transaction So my question is: How can I insert objects, that have a unique constraint from different threads simultanously. //Edit: currently I'm using Hibernate with MYSQL InnoDB //Edit2: Finally, the code which I use to write a single item. public class ItemWriterRunnable implements Callable&lt;Object&gt; { private final ThreadLocal&lt;Session&gt; session = new ThreadLocal&lt;Session&gt;(); private Item item; public ItemWriterRunnable(Item item) { super(); this.item= item; } protected Session currentSession() { Session s = this.session.get(); // Open a new Session, if this thread has none yet if (s == null || !s.isOpen()) { s = HibernateUtils.getSessionFactory().openSession(); // Store it in the ThreadLocal variable this.session.set(s); } return s; } @Override public Object call() throws Exception { Session currentSession = currentSession(); try { currentSession.begi…
has comment: http://stackoverflow.com/comment/38431779
has comment: http://stackoverflow.com/comment/38464337
has comment: http://stackoverflow.com/comment/38430792
has title: Hibernate: Insert objects with unique constraints from different threads
score: 2
has comment: http://stackoverflow.com/comment/38488087
answer count: 1
has comment: http://stackoverflow.com/comment/38431470
downvote count: 0
has comment: http://stackoverflow.com/comment/38475774

http://stackoverflow.com/q/24759153
tagged with: apache-camel
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/24759295
favorite count: 0
type: Question
has body: I am trying to make a small program that takes in console input such as a user's name, school and other information and then creates a file whose file name is that of the user. Each file will then be located in a folder named after the school. I am not sure how to create a file with those qualities since Camel seems to determine the path and file name before any input is read. Is there a way of getting around this problem?
answer count: 1
tagged with: java
has title: Apache-Camel console input
upvote count: 1
has answer: http://stackoverflow.com/a/24759295

http://stackoverflow.com/comment/38592491
type: AnswerComment
type: Comment
has text: The type of `savedData` field in your code is `DataOut`. Compiler has no idea that it's guaranteed to be the type acceptable by `tah.handle`.
comment on: http://stackoverflow.com/a/24852841
score: 0

http://stackoverflow.com/comment/38447611
score: 0
comment on: http://stackoverflow.com/a/24767322
type: AnswerComment
has text: I have just tried it - but the errors are the same(( anyway thank you for the answer
type: Comment

http://stackoverflow.com/q/24807274
tagged with: jtable
type: AnsweredQuestion
has title: Unique JMenu for every column in JTable
tagged with: swingx
type: Question
has answer: http://stackoverflow.com/a/24807678
accepted answer: http://stackoverflow.com/a/24807678
score: 0
tagged with: java
answer count: 2
tagged with: swing
tagged with: jmenu
has answer: http://stackoverflow.com/a/24807431
has body: I'm trying to add a JMenu component for every column in my JTable. The tricky bit is that I'd like the menu to be unique for each column e.g. right clicking on a column header displays a menu which is unique for the column. Anyone has an idea of how to achieve such behavior?
possible better answer: http://stackoverflow.com/a/24807431

junit
type: Tag
tags question: http://stackoverflow.com/q/24808297
tags question: http://stackoverflow.com/q/24811274
tags question: http://stackoverflow.com/q/24822923
tags question: http://stackoverflow.com/q/24762325
tags question: http://stackoverflow.com/q/24816179
tags question: http://stackoverflow.com/q/24802434
tags question: http://stackoverflow.com/q/24824253
tags question: http://stackoverflow.com/q/24821983
tags question: http://stackoverflow.com/q/24823972
tags question: http://stackoverflow.com/q/24813389
tags question: http://stackoverflow.com/q/24781462
tags question: http://stackoverflow.com/q/24764429
tag name: junit
tags question: http://stackoverflow.com/q/24756615
tags question: http://stackoverflow.com/q/24892696
tags question: http://stackoverflow.com/q/24864177
tags question: http://stackoverflow.com/q/24772728
tags question: http://stackoverflow.com/q/24867650
tags question: http://stackoverflow.com/q/24805149
tags question: http://stackoverflow.com/q/24878875
tags question: http://stackoverflow.com/q/24901968
tags question: http://stackoverflow.com/q/24816075
tags question: http://stackoverflow.com/q/24854527
tags question: http://stackoverflow.com/q/24870579
tags question: http://stackoverflow.com/q/24753650
tags question: http://stackoverflow.com/q/24860367
tags question: http://stackoverflow.com/q/24890628
tags question: http://stackoverflow.com/q/24776185
tags question: http://stackoverflow.com/q/24781223
tags question: http://stackoverflow.com/q/24774285
tags question: http://stackoverflow.com/q/24874424
tags question: http://stackoverflow.com/q/24874577
tags question: http://stackoverflow.com/q/24765219

http://stackoverflow.com/comment/38615354
comment on: http://stackoverflow.com/a/24864475
type: AnswerComment
score: 0
type: Comment
has text: As FunkTheMonk said, I want the `ThreadActivity` to always be resumed instead of the `MainActivity`. And while being in `ThreadActivity`, when the back button is pressed my application should be put in background, not being returned to `MainActivity`

http://stackoverflow.com/comment/38549275
score: 0
type: Comment
type: QuestionComment
has text: so you have one to one mapping? and you want to consider A is deleted if B is deleted - but not do a join? how is that possible even logically without jpa? and why not put deleted flag in A, that would be clean design from db point of view
comment on: http://stackoverflow.com/q/24829987

http://stackoverflow.com/q/24771825
downvote count: 4
answer count: 3
has body: I'm having a bit of trouble understanding encapsulation in Java. What I know is that encapsulation allows for information hiding (using private variables) from anywhere else in the program. But, could anyone show me how creating a class with public data fields could cause problems? I'm not understanding how the data is hidden if the classes have getter and setter methods provided. public class Student{ private int id; private String name; private int grade; public Student(){ } public Student(int id; String name, int grade){ this.id = id; this.name = name; this.grade = grade; } public int getId(){ return id; } public void setId(int id){ this.id = id; } //more code }
favorite count: 0
has comment: http://stackoverflow.com/comment/38439587
has comment: http://stackoverflow.com/comment/38439671
has answer: http://stackoverflow.com/a/24772006
has comment: http://stackoverflow.com/comment/38439584
accepted answer: http://stackoverflow.com/a/24771902
type: AnsweredQuestion
has title: Class without Encapsulation
type: Question
possible better answer: http://stackoverflow.com/a/24772358
has answer: http://stackoverflow.com/a/24772358
tagged with: java
tagged with: encapsulation
has answer: http://stackoverflow.com/a/24771902
has comment: http://stackoverflow.com/comment/38439647
upvote count: 4
score: 0

http://stackoverflow.com/comment/38508637
score: 1
has text: What is the fully qualified name for JSONResponse?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24808297

http://stackoverflow.com/comment/38522312
score: 0
comment on: http://stackoverflow.com/a/24767551
type: AnswerComment
has text: Those PDF's are the specs for OpenGL ES 2.0 and OpenGL Shading Language, it might be easier to find tutorials and only use the spec pdf's as reference when you get hung up on something.
type: Comment

http://stackoverflow.com/a/24781408
answers question: http://stackoverflow.com/q/24758577
score: 0
has body: finally after a hours of screwing around that piece of code I have found what exactly caused such trouble - the dependency of tomcat-servlet-api MUST BE FIRST in section. I am using 7.0.50 version by the way.
type: Answer
has comment: http://stackoverflow.com/comment/38461648

http://stackoverflow.com/comment/38546654
comment on: http://stackoverflow.com/a/24828462
score: 0
type: AnswerComment
has text: It's work!! Thank you so much!! Thanks for share the link too. ^^
type: Comment

http://stackoverflow.com/q/24877814
tagged with: orm
has comment: http://stackoverflow.com/comment/38648866
type: Question
tagged with: jpa
answer count: 2
linked to: http://stackoverflow.com/q/11013138
upvote count: 1
has title: Unidirectional @OneToMany association fails equality test in JPA
favorite count: 0
has comment: http://stackoverflow.com/comment/38660398
has body: I have set up a unidirectional OneToMany relationship like the example in section 2.10.5.1 of the JPA 2.1 spec: @Entity public class Client implements Serializable { ... @OneToMany private List&lt;ServiceOrder&gt; activeServiceOrders; public void setActiveServiceOrders( List&lt;ServiceOrder&gt; activeServiceOrders ) { this.activeServiceOrders = activeServiceOrders; } public List&lt;ServiceOrder&gt; getActiveServiceOrders() { return activeServiceOrders; } } The ServiceOrder class implements hashCode and equals using its auto-generated long id. They were implemented by Eclipse. public class ServiceOrder implements Serializable { @TableGenerator( name = "generator_serviceOrder", table = "SEQUENCE_TABLE", pkColumnName = "SEQ_NAME", valueColumnName = "LAST_VALUE_GEN", pkColumnValue = "SERVICE_ORDER_SEQ", allocationSize = 1, initialValue = 0 ) @Id @GeneratedValue( strategy = GenerationType.TABLE, generator = "generator_serviceOrder" ) private long id; ... @Override public boolean equals( Object obj ) { if ( this == obj ) return true; if ( obj == null ) return false; if ( getClass() != obj.getClass() ) return false; ServiceOrder other = (ServiceOrder ) obj; if ( id != other.id ) return false; return true; } ... } Tables are all auto-generated as expected. Then, when I want to establish the relationship I do: ... Client client = entityManager.find(...); ServiceOrder so = entityManager.find(...); client.getActiveServiceOrders().add( so ); ... Everything is fine until now, transaction commits successfully. Problem starts when I try to remove the relationship (in another transaction, another moment): ... Client sameClient = entityManager.find(...); ServiceOrder sameSo = entityManager.find(...); log.info(sameClient.getActiveServiceOrders().size()); // "1", OK log.info(sameClient.getActiveServiceOrders().contains(so)); // "false". Why? sameClient.getActiveServiceOrders().remove(so); // does nothing, returns false ... I debugged and discovered that the following is failing in Ser…
type: UnansweredQuestion
tagged with: wildfly
has answer: http://stackoverflow.com/a/24878581
has answer: http://stackoverflow.com/a/24879391
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/38655915
type: AnswerComment
type: Comment
has text: @feuerball: It is now after kocko edited his answer, it wasn't before.
comment on: http://stackoverflow.com/a/24886423
score: 4

http://stackoverflow.com/comment/38648012
score: 0
type: AnswerComment
type: Comment
has text: Why not move gcal.add(Calendar.MONTH, 1); to the end of the while body? Simpler no?
comment on: http://stackoverflow.com/a/24881881

http://stackoverflow.com/a/24824451
has comment: http://stackoverflow.com/comment/38538656
score: 2
upvote count: 2
downvote count: 0
has body: This can mostly be achieved by the Builder pattern. This is useful when there is a lot of information required to create the object.
answers question: http://stackoverflow.com/q/24824238
type: Answer

http://stackoverflow.com/a/24901425
downvote count: 0
type: Answer
has body: Just look in your DaysOfTheWeek array. You have missed a double quote at the end of Thursday like String[] DaysofTheWeek = {"", "Wednesday", "Thursday, "Friday"}; Correction: String[] DaysOfTheWeek = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
score: 2
answers question: http://stackoverflow.com/q/24901361
upvote count: 2

http://stackoverflow.com/q/24906251
has comment: http://stackoverflow.com/comment/70991323
has answer: http://stackoverflow.com/a/24908343
score: 3
downvote count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38696755
type: Question
tagged with: jpa
upvote count: 3
answer count: 1
has body: I have the following tables: TABLE Orders ( ID BIGINT NOT NULL PRIMARY KEY, ... other columns ... ) TABLE Order_States ( ID BIGINT NOT NULL PRIMARY KEY, Order_ID BIGINT NOT NULL FOREIGN KEY REFERENCES Orders(ID), State_Type VARCHAR(30) NOT NULL, State_Date DATETIME NOT NULL, ... other columns ... ) And the following mappings: @Entity @Table(name = "orders") class Order { @Id @GeneratedValue private Long id; @OneToMany(mappedBy = "order") @OrderBy("stateDate DESC") private List&lt;OrderState&gt; orderStates public OrderState getCurrentState() { return orderStates.get(0); } public void setCurrentState(OrderState state) { state.setStateDate(new Date()); orderStates.add(state); } ... other members ... } @Entity @Table(name = "order_states") class OrderState { @Id @GeneratedValue private Long id; @ManyToOne @JoinColumn(name = "order_id") private Order order; @Enumerated(EnumType.STRING) @Column(name = "state_type") private StateType stateType; @Temporal(TemporalType.TIMESTAMP) @Column(name = "state_date") private Date stateDate; ... other members ... } I don't want to have all order's states in my mappings (they are just for historical reasons), but just the current state of the order, which is determined by the latest state's date. Is there are any annotations for this? For example (I guess): @Entity @Table(name = "orders") class Order { ... @OneToMany(mappedBy = "order") @OrderBy("stateDate DESC") @TakeFirst private OrderState orderState ... getter and setter for orderState ... ... }
favorite count: 0
has title: JPA/Hibernate: mapping a single element in an entity with an one-to-many relationship
type: UnansweredQuestion

http://stackoverflow.com/q/24878897
tagged with: java
type: Question
tagged with: batch-file
score: 0
duplicate of: http://stackoverflow.com/q/615948
has body: I tried to run a bat file in Java using the following code. Runtime.getRuntime().exec("run.bat", null, new File("C:\\test\\")); I got the following error. java.io.IOException: Cannot run program "run.bat" (in directory "C:\test"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at java.lang.Runtime.exec(Runtime.java:617) at java.lang.Runtime.exec(Runtime.java:450) at stl_generator.Program.runCommandScript(Program.java:102) at stl_generator.Program.createFile(Program.java:20) at stl_generator.Program.main(Program.java:112) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:385) at java.lang.ProcessImpl.start(ProcessImpl.java:136) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) ... 10 more My file is exist in the location that I've declared. How to fix this? Thanks in Advance
answer count: 1
has title: Cannot run bat file in java
has comment: http://stackoverflow.com/comment/38642560
has answer: http://stackoverflow.com/a/24879057
accepted answer: http://stackoverflow.com/a/24879057
linked to: http://stackoverflow.com/q/615948
type: AnsweredQuestion

http://stackoverflow.com/comment/38464248
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24784811
has text: How do you initialize your `RunGenerator`?
score: 0

http://stackoverflow.com/q/24784106
favorite count: 0
has body: I'd like to setup an android wear app that extends push notifications by stacking multiple notifications and then displaying different background images and action on each stacked notification. http://developer.android.com/training/wearables/notifications/stacks.html This is how the stacked notifications would look and then cards in the 2nd and 3rd columns would have unique background images. I can get the background image to show up on a single notification, but when I moved to stacked notifications, they do not show up. Does anyone know if this is possible at this time? Example Code.. // Main Notification Object NotificationCompat.Builder wearNotificaiton = new NotificationCompat.Builder(this) .setDefaults(Notification.DEFAULT_ALL) .setSmallIcon(R.drawable.icon) .setWhen(System.currentTimeMillis()) .setTicker(title) .setContentTitle(title) .setContentText(text); wearNotificaiton.setGroup(GROUP_ALARM_KEY); // Create second page Notification TrendPage = new NotificationCompat.Builder(this) .setLargeIcon(trendImage) .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(trendImage)) .build(); // Create third page Notification ChartPage = new NotificationCompat.Builder(this) .setLargeIcon(trendImage) .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(trendImage)) .setContentTitle("test title 1") .build(); // wearable extender to add 2nd page and extend the main notification NotificationCompat.Builder extendedNotification = new NotificationCompat.WearableExtender() .addPage(TrendPage) .addPage(ChartPage) .extend(wearNotificaiton) .addAction(alertPageAction);
accepted answer: http://stackoverflow.com/a/24788156
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: wear-os
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24788156
tagged with: android
has title: Android Wear Bundled Notifications and Background Images

http://stackoverflow.com/comment/38496990
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24802266
has text: If `Circle` is not a leaf node in the hierarchy, your `CircleDescriber` code should be correct. The problem is how the `CircleDescriber`-object is created (which you are not showing). As long as it is initiated as in the example in the answer above, it should work (from what I can see, haven't actually tried it..)

http://stackoverflow.com/a/24865364
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24865294
type: Answer
has body: Set ResultTransformer to you (Hibernate)Criteria and you will get result without duplicates: Session session = getSession(); Criteria criteria = session.createCriteria(clazz); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); If you are using JPA, try this: CriteriaQuery&lt;Group&gt; query = cb.createQuery(Group.class); query.distinct(true);
has comment: http://stackoverflow.com/comment/38617455
has comment: http://stackoverflow.com/comment/38617867
accepted answer of: http://stackoverflow.com/q/24865294
upvote count: 4

http://stackoverflow.com/comment/38693711
comment on: http://stackoverflow.com/a/24867802
has text: @Kyle: I can't answer that in a comment. Ask a new question for that.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24794308
tagged with: loops
type: Question
tagged with: factorization
tagged with: algorithm
has body: I am trying to implement Pollard's Rho algorithm for finding a factor of an integer n. I have an implementation which usually works, but is now having some issues. in this case, my n = 262063. Here is my Rho Algorithm, along with the referenced getGCD() and pollardRhoFunction() [I have kept the println's in so I can provide the results afterwards]: public static int pollardRho(int n, int xStart){ // the function we will be using is f(x)=x^2+1, as per our textbook, // (in question# 5.26) int x = xStart; int xPrime = pollardRhoFunction(x) % n; int p = getGCD(x-xPrime, n); int nmbr = 0; System.out.println("x="+x); System.out.println("xPrime="+xPrime); System.out.println("p"+p); while (p == 1||p==31313||p==20||p==75||p==25||p == n ||p==262063){ System.out.println("i="+nmbr); x = pollardRhoFunction(x) % n; xPrime = pollardRhoFunction(xPrime) % n; System.out.println("xPrime="+xPrime); xPrime = pollardRhoFunction(xPrime) % n; System.out.println("xPrime="+xPrime); p = getGCD(x-xPrime, n); nmbr++; } updateIterNmbrs(nmbr); if (p == n){ return -1; } else{ return p; } } public static int getGCD(int a, int b){ int a_0 = a; int b_0 = b; int q = (int)Math.floor(a_0/b_0); int r = a_0 - q*b_0; while (r &gt; 0){ a_0 = b_0; b_0 = r; q = (int)Math.floor(a_0/b_0); r = a_0 - q*b_0; } r = b_0; return r; } public static int pollardRhoFunction(int x){ // the function we will be using is f(x)=x^2+1, as per our textbook, // (in question# 5.26) int result = (int)Math.pow(x,2)+2; //System.out.println("x^2+1="+result); return result; } It gets stuck in a loop after a little bit. Here is the printout of (some) of the System.out.println()'s: x=1 xPrime=3 p262063 i=0 x=3 xPrime=11 xPrime=123 r= -120; a_0= -120; b_0= 262063 p262063 i=1 x=11 xPrime=15131 xPrime=166164 r= -166153; a_0= -166153; b_0= 262063 p262063 i=2 x=123 xPrime=-139425 xPrime=-139425 r= 139548; a_0= 139548; b_0= 262063 r= 122515; a_0= 262063; b_0= 139548 r= 17033; a_0= 139548; b_0= 122515 r= 3284; a_0= 122515; b_0= 17033 r= 613; a_…
has title: Pollard Rho algorithm stuck in loop
has answer: http://stackoverflow.com/a/24794641
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24794641
type: AnsweredQuestion
score: 1
upvote count: 3
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/38710187
type: QuestionComment
comment on: http://stackoverflow.com/q/24866814
score: 0
has text: What happens if you run your code without the SecurityManager, and unwrap the code inside the doPrivileged block? Do you still get the same problem then?
type: Comment

http://stackoverflow.com/comment/38644853
type: Comment
comment on: http://stackoverflow.com/a/24880039
has text: @user3795283: You don't need to change anything about the static methods. They're not affected by my suggestion at all.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38649667
has text: I think you need to log and check the index `k`, and the problem is at `dataList.get(k)`.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24882250

http://stackoverflow.com/comment/38461050
type: QuestionComment
score: 1
has text: Is it whether the RESTful web service components are used in the job at all or whether it's in the flow of data? If performance is a massive drag then you've got a couple of potential options: If you can use both RESTful and Postgres components in the same job but not same subjob then maybe hash the result from the web service (post JSON handling) and then read the hash back in to a subjob with a proper tPostgreSQLConnection and tPostgreSQLCommit series of sub jobs.
comment on: http://stackoverflow.com/q/24769699
type: Comment

http://stackoverflow.com/q/24895544
type: AnsweredQuestion
has title: Java Inheritance - Trying to make generic method to get a bus from Guava EventBus library
score: 0
tagged with: java
type: Question
tagged with: inheritance
linked to: http://stackoverflow.com/q/9519769
has answer: http://stackoverflow.com/a/24895681
answer count: 1
accepted answer: http://stackoverflow.com/a/24895681
has body: Following this answer I'm trying to create a library that creates an EventBus or an AsyncEventBus from Guava EventBus Library. So I tried to create a class that extends Guava's AsyncEventBusClass, so I created RetroAsyncEventBus as follows: public class RetroAsyncEventBus extends AsyncEventBus{ private AsyncEventBus asyncEventBus; public RetroAsyncEventBus(Executor executor) { super(executor); } @Override public void register(Object object) { super.register(object); } @Override public void unregister(Object object) { super.unregister(object); } } Firstly here I don't understand why I've to Override register and unregister, from what I understand from inheritance, I should be able to access this super methods thru RetroAsyncEventBus object, I mean I should be able to do this: RetroAsyncEventBus retroAsyncEventBus = new RetroAsyncEventBus(executor); retroAsyncEventBus.register(this); but my IDE (netbeans) says I can't with compile error: cannot find symbol at retroAsyncEventBus.register(this);. So I had to Override them, I can live with that. Then I've my RetroBus class where I create and initialize the bus I want, in a singleton approach. Like this: public class RetroBus { private final EventBus bus; private final AsyncEventBus asyncEventBusMainThread; private final AsyncEventBus asyncEventBus; private static RetroBus instance; private RetroBus(){ bus = new EventBus(); asyncEventBusMainThread = new AsyncEventBus(new EventQueueExecutor()); asyncEventBus = new AsyncEventBus(Executors.newCachedThreadPool()); } public synchronized static EventBus getDefaultBus() { if (instance == null) { instance = new RetroBus(); return instance.getDefaultEventBus(); } return instance.getDefaultEventBus(); } public synchronized static AsyncEventBus getAsyncBus() { if(instance == null) { instance = new RetroBus(); return instance.getAsyncEventBus(); } return instance.getAsyncEventBus(); } public synchronized static AsyncEventBus getAsyncBusToMainThread() { if(instance == null) { instance…

http://stackoverflow.com/comment/38686612
comment on: http://stackoverflow.com/q/24902248
score: 0
type: QuestionComment
type: Comment
has text: do you have a traceback?

http://stackoverflow.com/comment/38594933
comment on: http://stackoverflow.com/a/24854098
has text: And instead of you can use \n
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38502165
has text: Yes I guess it might work and I'll still get pretty code reuse. Thank you. Still if anybody can explain with more details how things are going for that matter it would be appreciated.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24790770

http://stackoverflow.com/a/24865431
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38617121
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24864922
answers question: http://stackoverflow.com/q/24864922
type: Answer
has body: You can achieve that using Google Cloud Messaging. Also check this link. You'll have to register the Android devices' keys in order to be able to send notifications. In other words. You need to store the devices' keys in the Database when they log in. And then when device1 wants to send a notification to device 2 you do that using GCM and the device 2 key that's stored in the database. Here's an example of the code I'm using server side to send a message using GCM: Sender sender = new Sender (SENDER_API_CODE); Message message = new Message.Builder () .collapseKey ("1") .timeToLive (2419200) .delayWhileIdle (false) .addData ("message", "example message") .build (); result = sender.send (message, reGid, sendCount); Receiving side you have to create a Broadcast Receiver with these actions: &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt; &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt; &lt;action android:name="com.google.android.c2dm.intent.GCM_RECEIVED_ACTION" /&gt; and then when you receive the intent you get the message like this: Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { //Here you process the intent like you normally would //String parameter = intent.getStringExtra("name of parameter"); //... //After that you can create a notification like in the link below. } creating notifications

http://stackoverflow.com/comment/38435756
score: 0
type: AnswerComment
type: Comment
has text: OK (again, thanks for your answer!). The plot thickens: When I add a `flush()` call to the end of the `initialize()` method I get the following interesting exception: `javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.jpa.spi.AbstractEntityManagerImpl.checkTransactionNeeded(AbstractEntityManagerImpl.java:1171) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1332)` (sorry about the formatting).
comment on: http://stackoverflow.com/a/24769643

http://stackoverflow.com/q/24818124
has answer: http://stackoverflow.com/a/24818335
has title: How to read a file and write in 2 different files in java
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/38527442
type: Question
has comment: http://stackoverflow.com/comment/38526835
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24818364
has comment: http://stackoverflow.com/comment/38527074
has body: I have a large file comprising of question and answers. I want to put questions in one file and answer on other file.The only way to identify whether the question ends/answer begins is a '?'. and the answer ends in a ''. Kindly help... Note: the answer begins at the same line question ends..however the next question begins on a different line.
has comment: http://stackoverflow.com/comment/38527163
type: UnansweredQuestion

http://stackoverflow.com/comment/38443234
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24772447
has text: @drum There is nothing in this question about multiple web services.
score: 0

http://stackoverflow.com/a/24909232
upvote count: 1
has body: double sum = 0; for (int i=0; i &lt; arrayList.size() ; i++ ) { for (int j=0; j &lt; arrayList.get(i).length; i++) sum += arrayList.get(i)[j]; }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24908979
score: 1

http://stackoverflow.com/a/29641510
score: 0
has body: Several possiblies that causes this problem. The root cause is mismatched of compiler version between projects and IDE. For windows environment you can refer to this blog to do the detail troubleshooting.
type: Answer
answers question: http://stackoverflow.com/q/24790834

http://stackoverflow.com/comment/38471985
has text: So, Do i really have to deploy it under the application name just for a test?
comment on: http://stackoverflow.com/q/24788197
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38440856
type: QuestionComment
has text: I hope it's the format error, you have to convert your response from server in JSON format.
score: 0
comment on: http://stackoverflow.com/q/24772318
type: Comment

http://stackoverflow.com/comment/38573907
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24842550
has text: Determine cell width from `View` width and the number of columns, loop through the number of columns, and draw a line from top to bottom. Do the same for horizontal lines, with cell height and the number of rows.
score: 0

http://stackoverflow.com/a/24781798
accepted answer of: http://stackoverflow.com/q/24778346
type: AcceptedAnswer
has body: As you have identified, it seems to be a BUG reported here. The typical workaround (that works perfectly in JPA&lt;2.1) is to map that column to a simple (i.e without AttributeConverter) Long field/property and to hide it (make it private) and expose another field of type Date that converts it.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/47313746
has comment: http://stackoverflow.com/comment/38459116
answers question: http://stackoverflow.com/q/24778346

http://stackoverflow.com/a/24802239
has comment: http://stackoverflow.com/comment/38496903
has comment: http://stackoverflow.com/comment/38497671
type: Answer
has comment: http://stackoverflow.com/comment/38497258
has comment: http://stackoverflow.com/comment/38497569
has comment: http://stackoverflow.com/comment/38496720
score: 0
has comment: http://stackoverflow.com/comment/38497057
has body: Here is the complete code - import java.io.*; import java.util.*; public class Records2 { static ArrayList&lt;Person&gt; information = new ArrayList&lt;Person&gt;(); public static void main(String[] args) { int choice; do { System.out.println("\n-------------------------------\n Enter your Choice : "); System.out.println("1.Add \n 2.Delete \n 3.Update \n 4.Show \n 5.Exit"); Scanner sc = new Scanner(System.in); choice = sc.nextInt(); switch (choice) { case 1: System.out.println("Getting ready to Add a Record "); set(); break; case 2: System.out.println("Getting ready to Delete a Record. Enter id - "); int choice2 = sc.nextInt(); delete(choice2); break; case 3: System.out.println("Getting ready to Update a Record "); // update(); break; case 4: System.out.println("Here is your record "); display(); break; case 5: System.out.println("Out we go."); System.exit(0); // exit(); break; default: System.out.println("Try again"); break; } } while ( choice &gt; 1 || choice &lt; 5 ); } public static void set() { System.out.println("Please enter the ID, Name and Address of the person \n"); Scanner readId = new Scanner(System.in); int ID = readId.nextInt(); Scanner readName = new Scanner(System.in); String name = readName.nextLine(); Scanner readAddress = new Scanner(System.in); String address = readAddress.nextLine(); // ArrayList information = new ArrayList(); Person person=new Person(); person.setID(ID); person.setName(name); person.setAddress(address); information.add(person); } public static void display() { System.out.println("here is your list" + information); // how to differentiate from one set to another? } public static void delete(int passedid) { // System.out.println("here is your list" + information); // how to differentiate from one set to another? System.out.println("Before Deleting - "+information); Iterator&lt;Person&gt; it=information.iterator(); while (it.hasNext()) { Person p = it.next(); if(p.getID()==passedid){ it.remove(); } } System.out.println("AfterDelet…
answers question: http://stackoverflow.com/q/24802205
has comment: http://stackoverflow.com/comment/38497774

ksoap2
type: Tag
tag name: ksoap2
tags question: http://stackoverflow.com/q/24833426

http://stackoverflow.com/q/24841778
has comment: http://stackoverflow.com/comment/38571516
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38571398
favorite count: 0
type: Question
has body: I've decided on using JSON.Simple to parse Java in my application, as apposed to GSON or Jackson, because both of them seem over complicated for my needs and appeared to need additional class files to work as intended. I have the following JSON: { "request":{ "act":"rec_load_all", "email":"Redacted", "tkn":"Redacted", "a":"rec_load_all", "z":"Redacted" }, "response":{ "recs":{ "has_more":false, "count":9, "objs":[{ "rec_id":"1385442465", "rec_hash":"1825780e334bcd831034bd9ca62", "zone_name":"Redacted", "name":"Redacted", "display_name":"Redacted", "type":"A", "prio":null, "content":"Redacted", "display_content":"Redacted", "ttl":"1", "ttl_ceil":86400, "ssl_id":null, "ssl_status":null, "ssl_expires_on":null, "auto_ttl":1, "service_mode":"1", "props":{ "proxiable":1, "cloud_on":1, "cf_open":0, "ssl":0, "expired_ssl":0, "expiring_ssl":0, "pending_ssl":0, "vanity_lock":0 } }] } }, "result":"success", "msg":null } The objs array lists 9 different items, but I only included one for simplicity. I need to get has_more, count, and the id within objs. I've tried: JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = (JSONObject) jsonParser.parse(responseString); JSONArray objs = (JSONArray) jsonObject.get("objs"); Iterator&lt;JSONObject&gt; iterator = objs.iterator(); while (iterator.hasNext()) { JSONObject idObj = (JSONObject) iterator.next(); String id = (String) idObj.get("rec_id"); System.out.println(id); } But it fires a java.lang.NullPointerException error, so I'm assuming because it's nested under response -&gt; recs -&gt; objs it isn't getting a value. I'm also following a few year old tutorial, so something could have changed since. If you could explain whats wrong and an example of how to fix it, I would greatly appreciate it, I learn by seeing. EDIT: Full error Exception in thread "main" java.lang.NullPointerException at ddns.Net.getId(Net.java:46) at ddns.DDNS.main(DDNS.java:7) Java Result: 1 ddns.Net.getId(Net.java:46) | Iterator&lt;JSONObject&gt; ite…
possible better answer: http://stackoverflow.com/a/57995419
score: 7
accepted answer: http://stackoverflow.com/a/24842038
has answer: http://stackoverflow.com/a/57995419
has comment: http://stackoverflow.com/comment/38571303
has comment: http://stackoverflow.com/comment/38571607
answer count: 2
has title: Using JSON.Simple with nested objects and arrays
upvote count: 7
has comment: http://stackoverflow.com/comment/38571217
has comment: http://stackoverflow.com/comment/38571541
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24842038

http://stackoverflow.com/a/24873159
type: Answer
accepted answer of: http://stackoverflow.com/q/24813589
upvote count: 22
has body: Answered by Igor Vishnevskiy I have been looking for the answer everywhere on the internet and could not find anything. It took me some time to make this work. I hope this quick guide will help the next engineer to save some time on setting up Appium to run automation on Android devices. Appium will not run if NODE or Appium itself is installed using SUDO and MAC won't let you install neither without using SUDO. There is a workaround though. My steps make it possible to install and setup Appium the right way without need to use SUDO for installation. Everything is tested and it works. Below are the steps. Enjoy! There could be one problem while setting up Appium using bellow steps. If you face some errors while creating or saving data into certain directories, that is caused by the luck of write permissions set to those directories. What you will need to do is to set CHMOD to 777 to the directories where components of Appium are trying to write while installing and then rerun all steps again. Step 1: Install JAVA 6. You will need JAVA 6 with Appium. JAVA 6 for Mac OS has to be downloaded from Apple's support page: http://support.apple.com/kb/DL1572 Step 2: In your bash add the following path using following format: export PATH=$HOME/local/bin:$PATH Step 3: Setup Maven (Download and set Bash profile PATH for Maven): http://maven.apache.org/download.cgi ------> This is what your Bash Profile should look like: export PATH="/Users/your_username/Desktop/adt-bundle-mac-x86_64-20140702/sdk/platform-tools":$PATH export PATH="/Users/your_username/Desktop/adt-bundle-mac-x86_64-20140702/sdk/tools":$PATH export PATH=$HOME/local/bin:$PATH export ANDROID_HOME=/Users/your_username/Desktop/adt-bundle-mac-x86_64-20140321/sdk export PATH="/Users/your_username/Desktop/apache-maven-3.2.2/bin":$PATH export JAVA_HOME=$(/usr/libexec/java_home -v 1.6) Obviously to run tests on Android device, you will need to download Android SDK and add it to your Bash Profile as well. To run tests on iOS…
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24813589
has comment: http://stackoverflow.com/comment/41479813
score: 22

http://stackoverflow.com/comment/38604571
type: AnswerComment
comment on: http://stackoverflow.com/a/24851619
type: Comment
has text: You could take a look at this GIS-question: http://gis.stackexchange.com/questions/74538/how-to-use-openstreetmap-in-java
score: 0

http://stackoverflow.com/q/24866791
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: aspectj
downvote count: 0
tagged with: aop
favorite count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24876667
has title: AspectJ matching Annotated classes but not its child classes
has body: I want to configure transaction on my DAOs parent class and prohibit that a concrete DAO has its own transaction config, so I use Springs @Transactional: @Transactional(/* some transactionConfig */) abstract class AbstractDao { //... } // this is ok class UserDao extends AbstractDao { //... } @Transactional (/* some other config*/) // this should be illegal class DocumentDao extends AbstractDao { //... } I use AspectJs @DeclareError to enforce my design rules. When I use the followint error and pointcut declaration I get errors also on the code in the (legal) UserDao as it inherits the Annotation from AbstractDao. @Pointcut("call(*.new(..)) || call(* *(..)) || set (* *) || get (* *)") public void doAnything() { // no code } @Pointcut("within(@org.springframework.transaction.annotation.Transactional *) &amp;&amp; doAnything()") public void transactionalClass() { // only pointcut, no code } @Pointcut("within(AbstractDao+) &amp;&amp; !within(AbstractDao)") public void inDao() { // no code } @DeclareError("transactionalMethod() &amp;&amp; doAnything() &amp;&amp; inDao()") public static final String TRANSACTIONAL_NOT_ALLOWED = "@Transactional of this method is not necesarry, we have it on class level in AbstractDao"; @DeclareError("transactionalClass() &amp;&amp; inDao() &amp;&amp; doAnything()") public static final String ERROR = "Transactional is not allowed on method level"; Is it possible to match only classes that are explicitelty annotated (in this example the DocumentDao)?
type: UnansweredQuestion
tagged with: annotations

http://stackoverflow.com/comment/38407131
comment on: http://stackoverflow.com/q/24754712
type: Comment
type: QuestionComment
has text: A Company _contains_ Departments, and Departments _contain_ Employees. They do not form an inheritance hierarchy.
score: 3

http://stackoverflow.com/comment/38464119
type: Comment
comment on: http://stackoverflow.com/q/24784677
score: 0
has text: Before asking, why don't you check yourself the issues? (It took me very little to track down the same problem mentioned in Luiggi's answer)
type: QuestionComment

http://stackoverflow.com/q/24850530
has body: Alright, so this has been pissing me off for hours .I do not understand why isn't this if statement not executing. Here's my complete code. There are 2 classes, 'Client' is the main class and the other is the connector class. package com.app.client; import java.net.ServerSocket; import java.sql.SQLException; public class Client{ private int IntervalForDatabase=60000; private int IntervalForIPCheck=180000; private boolean AppRunning=true; public boolean ConnectionSuccess=false; private Connector ConnectionTools = new Connector(); public static void main(String args[]){ Thread thread = new Thread(new Runnable(){ public void run(){ Client client = new Client(); } }); thread.start(); } Client(){ /* Check For Current Instance Of Program */ try{ ServerSocket ApplicationSocket = new ServerSocket(6251); }catch(Exception e){ System.exit(0); } Thread Network = new Thread(new Runnable(){ public void run(){ while(!ConnectionSuccess){ try{ ConnectionTools.ConnectToDatabaseServer(); ConnectionSuccess=true; System.out.println("bein a bit"); }catch(Exception e){ } } } }); Network.start(); Thread LiveConnectionCheck = new Thread(new Runnable(){ public void run(){ while(AppRunning){ if(ConnectionSuccess){ /* THIS IF STATEMENT IS NOT EXECUTING */ try { System.out.println("tester"); Thread.sleep(IntervalForIPCheck); } catch (Exception e) { e.printStackTrace(); } } } } }); LiveConnectionCheck.start(); } } The connector class: package com.app.client; import java.net.Socket; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class Connector { public boolean DatabaseConnection=false; Socket ClientSocket; private String DatabaseHost="localhost"; private String DatabaseUsername="root"; private String DatabasePassword = ""; private String DatabaseName = "spyware"; private String TableName="activespywares"; public String CurrentServerIP = ""; private Connection MYSQLConnection = null; pub…
possible better answer: http://stackoverflow.com/a/24850561
has comment: http://stackoverflow.com/comment/38587953
has answer: http://stackoverflow.com/a/24850561
has answer: http://stackoverflow.com/a/24850606
has answer: http://stackoverflow.com/a/24850567
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38587974
tagged with: mysql
has title: Java: Simple If Statement not executing
type: Question
accepted answer: http://stackoverflow.com/a/24850567
tagged with: concurrency
has comment: http://stackoverflow.com/comment/38587967
has comment: http://stackoverflow.com/comment/38587980
score: 0
has comment: http://stackoverflow.com/comment/38587938
answer count: 3

http://stackoverflow.com/comment/38462149
comment on: http://stackoverflow.com/a/24780173
type: AnswerComment
type: Comment
score: 0
has text: @JoaoEvangelista Through the Network Analyzer from the Browser, I notice only the text input fields are sent to server, none of the file input fields are listed there. I expected all the fields should be here. I ever knew only fields with the atribute `name` are sent to server, which is what's happening here. Do you have any idea why this is happening?

http://stackoverflow.com/q/24885839
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24887638
score: 0
tagged with: izpack
answer count: 1
has comment: http://stackoverflow.com/comment/38655440
has body: I new to izpack. I have all the panels and a java class which takes mongodb collection and produces excel as output.I want to run this java code and produce excel when i click next on a particular panel. How can I achieve that??
has comment: http://stackoverflow.com/comment/38656442
has title: Execute java class from panel izpack

http://stackoverflow.com/q/24778687
tagged with: jackson
has title: Getting one field from response entity json
has body: i need to connect to a rest service to get the user id by using a token. List&lt;Object&gt; providers = new ArrayList&lt;&gt;(); providers.add(new JacksonJaxbJsonProvider()); client = WebClient.create(properties.getProperty(URL), providers); client = client.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE); client.path(PATH + token); Response response = client.get(); The entity of response have this format: {"message":"Token is valid","userId":1} To get the userId, i have: response.readEntity(AuthResponse.class).userId; It is possible to take only the userId without creating an class with that format ? (without AuthResponse.class)
accepted answer: http://stackoverflow.com/a/24778857
answer count: 1
score: 1
favorite count: 0
upvote count: 1
tagged with: httpresponse
type: AnsweredQuestion
tagged with: cxf
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24778857
type: Question
downvote count: 0

http://stackoverflow.com/comment/38539395
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24824936
type: Comment
has text: Are you sure the dependency does not have provided scope?

http://stackoverflow.com/q/24878980
has body: I'm still relatively new to spring-data-neo4j, and while I've enjoyed interacting with it for the most part, I've had some periodically-reoccurring problems with transaction management (using simple mapping) that I don't understand and that have been extremely frustrating. Controller: @Controller @RequestMapping("/user") public class UserController { @Autowired UserService userService; @RequestMapping("/{id}/posts") @ResponseBody public Set&lt;POSTED&gt; getPosts(@PathVariable Long id){ //POSTED is a @RelationshipEntity-annotated class return userService.getItemsPosted(id); } //... } Service interface: public interface UserService extends DomainService&lt;User&gt; { User load(long id); //works fine User createNew(Map&lt;String, Object&gt; props); //works fine Set&lt;POSTED&gt; getItemsPosted(User u); //NotInTransactionException !!! } Service implementation: @Service @Transactional public class UserServiceImpl implements UserService { @Autowired UserRepo repo; //standard empty interface extending GraphRepository&lt;User&gt; @Autowired Neo4jTemplate template; @Override @Transactional public User load(long id) { return repo.findOne(id); } @Override @Transactional public Set&lt;User&gt; loadAll(int howMany) { Result&lt;User&gt; result = repo.findAll(); Iterator&lt;User&gt; iter = result.iterator(); if (!iter.hasNext()) throw new RuntimeException(" the result is empty!"); User next =iter.next(); HashSet&lt;User&gt; toret = new HashSet&lt;User&gt;(); for (int i =0; i &lt; howMany &amp;&amp; iter.hasNext(); i++, next = iter.next() ) { toret.add(next); } return toret; } @Override @Transactional public void save(User u) { template.save(u); } @Override @Transactional public User createNew(Map&lt;String, Object&gt; props) { return repo.save(new User(props)); } @Override @Transactional public Set&lt;POSTED&gt; getItemsPosted(User u) { return template.fetch(u.posts); //NotInTransactionException } } Domain entity @NodeEntity @TypeAlias("user") public class User implements DomainN…
has comment: http://stackoverflow.com/comment/38654475
answer count: 0
type: UnansweredQuestion
tagged with: spring-data
upvote count: 1
tagged with: spring
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38646993
downvote count: 0
favorite count: 0
tagged with: spring-data-neo4j
has title: @Transactional headaches with Spring-Data-Neo4j

http://stackoverflow.com/a/24811779
has body: if (o instanceof PGPEncryptedDataList) { pgpEncryptedDataList = (PGPEncryptedDataList)o; if o is already an instance of PGPEncryptedDataList, why are you casting it to PGPEncryptedDataLIST? I don't know enough about the specifics of what you're doing so I just figured I'd provide some general code analysis. Sorry I couldn't be of more help.
has comment: http://stackoverflow.com/comment/38515811
type: Answer
answers question: http://stackoverflow.com/q/24810805
score: 0

http://stackoverflow.com/comment/38586578
score: 1
has text: Well for one thing your program is not compiled since it contains errors.
type: QuestionComment
comment on: http://stackoverflow.com/q/24849826
type: Comment

http://stackoverflow.com/a/24797497
has comment: http://stackoverflow.com/comment/38489544
has comment: http://stackoverflow.com/comment/38488309
has comment: http://stackoverflow.com/comment/38491805
has comment: http://stackoverflow.com/comment/38489818
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38489318
answers question: http://stackoverflow.com/q/24797212
score: 2
has body: You can (and should) use an enum - not a String nor a int: enum Severity { LOW, MEDIUM, HIGH; } Usage: List&lt;Severity&gt; lst = new ArrayList&lt;Severity&gt;(); lst.add(Severity.MEDIUM); lst.add(Severity.LOW); lst.add(Severity.HIGH); for (Severity s : lst) System.out.println("s = " + s); Collections.sort(lst); System.out.println(); for (Severity s : lst) System.out.println("s = " + s); OUTPUT: s = MEDIUM s = LOW s = HIGH s = LOW s = MEDIUM s = HIGH EDIT Since the OP says he can't modify the usage of Strings, we can map the strings into a comparable values: static Map&lt;String, Integer&gt; severities = new HashMap&lt;String, Integer&gt;(); static { severities.put("LOW",1); severities.put("MEDIUM",2); severities.put("HIGH",3); } public static void main(String[] args) { List&lt;String&gt; lst = new ArrayList&lt;String&gt;(); lst.add("MEDIUM"); lst.add("LOW"); lst.add("HIGH"); for (String s : lst) System.out.println("s = " + s); Collections.sort(lst, new Comparator&lt;String&gt;() { public int compare(String a1, String a2) { Integer v1 = severities.get(a1); Integer v2 = severities.get(a2); return v1.compareTo(v2); } }); System.out.println(); for (String s : lst) System.out.println("s = " + s); } and if you want to order the items in descending order you can sort and then reverse: Collections.sort(lst); Collections.reverse(lst);
has comment: http://stackoverflow.com/comment/38488464
has comment: http://stackoverflow.com/comment/38490990
has comment: http://stackoverflow.com/comment/38488459
has comment: http://stackoverflow.com/comment/38489836
has comment: http://stackoverflow.com/comment/38491950
downvote count: 0

http://stackoverflow.com/a/24768357
score: 0
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24758944
has body: split[] has elements split[0], split[1], split[2] and split[3] only

http://stackoverflow.com/q/24770961
possible better answer: http://stackoverflow.com/a/24774498
score: 0
linked to: http://stackoverflow.com/q/270445
has title: How do I create an executable jar file including dependencies where the main class is in Test, using Maven
has comment: http://stackoverflow.com/comment/38441204
tagged with: executable-jar
tagged with: dependencies
has answer: http://stackoverflow.com/a/24890258
has body: I am new to Maven and have a project with the following directory structure project -src -main -java -org -core -starter.java -test -java -org -core -testStarter.java Both starter.java and testStarter.java are Main classes. However I wish to create an executable jar file (including dependencies) where testStarter.java is executed. I added the following to my pom file: org proj 1.0-SNAPSHOT jar project <plugins> org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 maven-assembly-plugin package single org.core.testStarter jar-with-dependencies <plugins> However everytime I run mvn clean package, it creates a package with only the compiled classes in the main directory and not the test directory. Hence everytime I run the jar file, it does not run, since the testStarter.class does not exist in the created jar file. Is there a way I can create either 1) One big jar file containing test and main classes while it executes only the test class 2) Only the test classes but all dependencies are included.
tagged with: maven
accepted answer: http://stackoverflow.com/a/24824199
answer count: 4
has comment: http://stackoverflow.com/comment/38439737
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24824199
has answer: http://stackoverflow.com/a/24854264
type: Question
has answer: http://stackoverflow.com/a/24774498

http://stackoverflow.com/comment/38530893
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24817578
has text: Without a greater understanding of your over code, it's difficult to make recommendations. If you intend to replace your current view with the `JTable`, then you need to provide some means by which that view can generate the (child) table model. This would suggest that your current model needs to provide some means to provide a `List` of `Treatement`s...
type: AnswerComment

http://stackoverflow.com/comment/38489003
type: AnswerComment
score: 0
has text: Thanks its work, but i have any problem, i find error in LogCat "org.json.JSONException: Value <?xml of type java.lang.String cannot be converted to JSONObject" why it could happen? @Slyzz
type: Comment
comment on: http://stackoverflow.com/a/24797729

http://stackoverflow.com/comment/38462416
has text: Have you tried `$.response.data.*.id`?
type: QuestionComment
comment on: http://stackoverflow.com/q/24783844
type: Comment
score: 2

http://stackoverflow.com/comment/38490929
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24788443
has text: @donfuxx I don't get the message "exited" in my Android device nor in my Desktop. Maybe the button initilization is wrong?

http://stackoverflow.com/q/24857847
score: 0
has body: I am trying to solve that tutorial and I noticed in the end when running the main class : public class App { public static void main(String[] args) { System.out.println("Hibernate one to many (Annotation)"); Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); Stock stock = new Stock(); stock.setStockCode("7052"); stock.setStockName("PADINI"); session.save(stock); StockDailyRecord stockDailyRecords = new StockDailyRecord(); stockDailyRecords.setPriceOpen(new Float("1.2")); stockDailyRecords.setPriceClose(new Float("1.1")); stockDailyRecords.setPriceChange(new Float("10.0")); stockDailyRecords.setVolume(3000000L); stockDailyRecords.setDate(new Date()); stockDailyRecords.setStock(stock); stock.getStockDailyRecords().add(stockDailyRecords); session.save(stockDailyRecords); session.getTransaction().commit(); System.out.println("Done"); } in this line, stock.getStockDailyRecords().add(stockDailyRecords); I couldn't understand what is it useful for ? I tried to remove it, nevertheless it was inserting the rows without any problem, so what is the use of it ? why didn't he use setDailyRecords(stockDailyRecords) instead, is there something I am not understanding ?
has comment: http://stackoverflow.com/comment/38602796
has comment: http://stackoverflow.com/comment/38602444
has comment: http://stackoverflow.com/comment/38602821
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38602742
has comment: http://stackoverflow.com/comment/38602509
has title: Hibernate Issue of understanding what a method is for
has comment: http://stackoverflow.com/comment/38602581
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/38602851
has comment: http://stackoverflow.com/comment/38602646

http://stackoverflow.com/a/24830993
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38551768
has comment: http://stackoverflow.com/comment/38551907
type: Answer
has comment: http://stackoverflow.com/comment/38551883
has body: Have a look at the SWT Snippets. There are code examples for all the widgets. To answer your question: Use Label or Text for simple text you want to display Use Text for input Use a group of Buttons with style SWT.RADIO for radio selection buttons Use a Button with style SWT.CHECK for a checkbox Also, here is the overview of all the widgets there are. And finally there is this excellent tutorial by Vogella about SWT in general and of course every SWT developers bread and butter: Understanding Layouts in SWT. Good luck with your game :)
accepted answer of: http://stackoverflow.com/q/24830706
score: 0
answers question: http://stackoverflow.com/q/24830706

http://stackoverflow.com/q/24756819
score: 0
has answer: http://stackoverflow.com/a/24757055
has comment: http://stackoverflow.com/comment/38411059
has comment: http://stackoverflow.com/comment/38411794
has comment: http://stackoverflow.com/comment/38411318
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38411231
has body: i have 16 to 17 record in DB BUT when i want to retrive data.... on the run time i received null pointer exceptiion (sorry for bad english) sql="SELECT * FROM CUSTOMER ORDER BY date DESC"; //my query stmt=con.prepareStatement(sql); //preparedStatement System.out.println("2"); //checking output (where is exception) rs=stmt.executeQuery(); //resultsetGlobal declare System.out.println("3"); //checking outpur i=0; //for show record number System.out.println(i); //checking output while(rs.next()){ //here i get the exception any one tell me why exception?? }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38412573
has comment: http://stackoverflow.com/comment/38412943
has answer: http://stackoverflow.com/a/24757836
tagged with: java
type: Question
answer count: 2
has title: ResultSet is not null but giving a null pointer exception
has comment: http://stackoverflow.com/comment/38411826
has comment: http://stackoverflow.com/comment/38412846
has comment: http://stackoverflow.com/comment/38411069

http://stackoverflow.com/q/24774676
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38446266
possible better answer: http://stackoverflow.com/a/24775808
upvote count: 1
has answer: http://stackoverflow.com/a/24775837
has answer: http://stackoverflow.com/a/24775808
type: Question
has body: I have a ArrayList which has some elements. The items in this list are repeated. I want to group the similar values and convert it into an array. Currently my ArrayList is:- ArrayList&lt;String&gt; isonC = new ArrayList&lt;String&gt;(); Value of isonC = `[a, a, a, a, b, c, c,C, c, c, c, d, d, d, d, d, d,d] I group the so:- icons = isonC.toArray(new String[isonC.size()]); icons = new HashSet&lt;String&gt;(Arrays.asList(icons)).toArray(new String[0]); I get the values as:- icons = [a, c, b,d] Whereas the actual order of the elements should be:- [a,b, c,d] Why are the 2nd and 3rd values have interchanged? Any suggesstions will be helpful. Thanks
tagged with: arrays
tagged with: arraylist
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/24775837
has comment: http://stackoverflow.com/comment/38447033
has title: Values get interchanged while converting from ArrayList to Array android
favorite count: 0
has comment: http://stackoverflow.com/comment/38445168
tagged with: android

http://stackoverflow.com/q/24906862
has comment: http://stackoverflow.com/comment/38694956
type: Question
has body: We have to update the spring , hibernate version also we know that we need to update the maven and other versions as well .We are using maven to bind dependency and making build. I am providing you the all dependency that used in our project. [dependency:tree {execution: default-cli}] com.xyz:web-service:war:0.0 +- com.xyz:core:jar:0.0:compile | +- com.xyz:model:jar:0.0:compile | +- commons-lang:commons-lang:jar:2.4:compile | +- commons-dbcp:commons-dbcp:jar:1.2.2:compile | | - commons-pool:commons-pool:jar:1.3:compile | +- org.springframework:spring-webmvc:jar:2.5.6:compile | | - org.springframework:spring-context-support:jar:2.5.6:compile | +- org.springframework:spring-tx:jar:2.5.6:compile | +- org.springframework:spring-aop:jar:2.5.6:compile | +- org.springframework:spring-aspects:jar:2.5.6:compile | | +- org.aspectj:aspectjrt:jar:1.6.1:compile | | - org.aspectj:aspectjweaver:jar:1.6.1:compile | +- org.springframework.security:spring-security-core-tiger:jar:2.0.4:compile | | - org.springframework.security:spring-security-core:jar:2.0.4:compile | +- org.ow2.jotm:jotm-core:jar:2.1.4:compile | | +- org.ow2.carol:carol:jar:3.0.2:compile | | | +- org.ow2.carol:carol-interceptors:jar:1.0.1:compile | | | +- org.ow2.carol.irmi:irmi:jar:1.1.2:compile | | | +- org.jacorb:jacorb:jar:2.2.3-jonas-patch-20071018:compile | | | | - avalon-framework:avalon-framework:jar:4.1.5:compile | | | +- org.jacorb:jacorb-idl:jar:2.2.3-jonas-patch-20071018:compile | | | | - logkit:logkit:jar:1.2:compile | | | +- org.ow2.cmi:cmi-jndi:jar:2.1.0:compile | | | | +- org.ow2.util:util-log:jar:1.0.10:compile | | | | | - org.ow2.util:util-i18n:jar:1.0.10:compile | | | | +- org.ow2.cmi:cmi-api-client:jar:2.1.0:compile | | | | | +- org.ow2.util:util-component-api:jar:1.0.10:compile | | | | | +- org.ow2.util:util-component-impl:jar:1.0.10:compile | | | | | +- org.ow2.util:util-pool-api:jar:1.0.10:compile | | | | | +- org.ow2.spec.ee:ow2-ejb-3.0-spec:jar:1.0-M1:compile | | | | | | +- org.ow2.spec.ee:ow…
has comment: http://stackoverflow.com/comment/38698108
score: 3
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38696120
has title: How to upgrade Spring 2.56,Hibernate version 3.2.6.ga to 4.0.6 (Spring), 4.3.6.Final(Hibernate)
tagged with: maven
tagged with: spring
upvote count: 4
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38695615

http://stackoverflow.com/comment/38442925
type: Comment
has text: The original title did say declaration...I edited it.
score: 0
comment on: http://stackoverflow.com/q/24772183
type: QuestionComment

http://stackoverflow.com/comment/38421833
has text: Is `SearchConfig` class `Serializable` as well?
score: 0
comment on: http://stackoverflow.com/q/24762397
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24766600
score: 2
upvote count: 2
has body: The following does not compile: list = Lists.&lt;Object&gt;toListArray(1,"two");//&lt;---Not compiles list = Lists.&lt;Object&gt;toListArray();//&lt;---Not compiles because toListArray() expects exactly one argument (and it has to be an array). You are trying to pass 0 or 2 arguments, thus the error (only varargs allows arbitary nummber of arguments)
answers question: http://stackoverflow.com/q/24766564
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24766564

http://stackoverflow.com/q/24794812
has comment: http://stackoverflow.com/comment/38483600
has comment: http://stackoverflow.com/comment/38483759
has comment: http://stackoverflow.com/comment/38490082
has body: I have an Object with a synchronized method: public class Foo { public synchronized void bar() { // Do stuff } } And I have thousands of threads calling the same method. When I want to quit the program, how can I interrupt these waiting threads so that the program exits immediately? I have tried to call Thread.interrupt() and Foo.notify() but not work. The question is: Is blocking synchronized method interruptible?
tagged with: synchronization
favorite count: 0
tagged with: multithreading
score: 6
has comment: http://stackoverflow.com/comment/38484069
type: AnsweredQuestion
tagged with: java
has title: How to interrupt a synchronized method that is blocked
has answer: http://stackoverflow.com/a/24794939
has answer: http://stackoverflow.com/a/24796887
accepted answer: http://stackoverflow.com/a/24796887
upvote count: 8
type: Question
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/24794939

http://stackoverflow.com/comment/38536488
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24807747
score: 0
has text: If that doesn't help, it would be useful to include as much detail as possible (such as, but not only) the myeclipse release, OS, etc.

http://stackoverflow.com/comment/38577950
has text: I think your answer is valid which is why I accepted it but I'm not sure why someone would down vote it?
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24845177
type: AnswerComment

http://stackoverflow.com/q/24852305
has comment: http://stackoverflow.com/comment/38594333
has comment: http://stackoverflow.com/comment/38591392
has comment: http://stackoverflow.com/comment/38593363
has comment: http://stackoverflow.com/comment/38591370
score: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/38592010
has title: Run Java file(.class) in Linux with php exec(), return empty array
has body: I can run java file using command line: java HelloWorld Now I am trying to run a HelloWorld.class file in php script using exec(). The problem is, when I run commands like: &lt;?php exec("which java", $output); print_r($output); ?&gt; it print correct result, but when I tried to run java file: &lt;?php exec("java HelloWorld", $output); print_r($output); ?&gt; it only print out Array(). The content of HelloWorld.java is: public class HelloWorld{ public static void main(String []args){ System.out.println("Hello World!!!!"); } } And I have already create the HelloWorld.class file using command line javac HelloWorld. So how can I fix it? PS. I changed the command into: &lt;?php exec("java HelloWorld 2&gt;&amp;1", $output); print_r($output); ?&gt; and I got Array ( [0] =&gt; Error: Could not find or load main class HelloWorld ) Does anyone know what the problem is? Ok, I've fixed it. I forget to set classpath when I use php exec(). So, the code should be: &lt;?php exec("java -cp '/var/www/html/run' HelloWorld 2&gt;&amp;1", $output); print_r($output);?&gt;
tagged with: exec
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38591521
tagged with: php
has comment: http://stackoverflow.com/comment/38591506
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38591324
type: Question

http://stackoverflow.com/comment/38567313
type: Comment
has text: I can't modify the map until it destory. So ,do you think I have to copy that map into a new one and do so?
score: 0
comment on: http://stackoverflow.com/a/24839743
type: AnswerComment

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/24813087
tags question: http://stackoverflow.com/q/24899154
tags question: http://stackoverflow.com/q/24817011
type: Tag
tags question: http://stackoverflow.com/q/24840849
tags question: http://stackoverflow.com/q/24824884

http://stackoverflow.com/comment/38457623
comment on: http://stackoverflow.com/q/24769699
type: Comment
has text: Jira ticket was opened today by talend support but I do not know if is public or not (https://jira.talendforge.org/browse/TDI-30083). Ticket describes the problem when using rest web services with tpostgresqloutput component. Both options "use an existing connection" and "use batch size" on the component does not work if used in combination with rest web services. For the first option we have found a workaroud but for the second we are still looking for a solution.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38589873
comment on: http://stackoverflow.com/q/24850165
score: 0
has text: You need to learn how to debug. This should be a very simple debugging task. If you don't have an interactive debugger then just insert println statements to track where you are and what values you have.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38427595
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24765289
has text: Oh maybe my json string is made wrong, I want a map for each of the objects in the array. so from my snippet there should be 3 entrys in the Map, I guess it is misleading that all the keys are the same, they would be different in reality.
score: 0

http://stackoverflow.com/comment/38468372
has text: I am a bit ashamed :D You sir, are a Where is Waldo pro player!
type: AnswerComment
comment on: http://stackoverflow.com/a/24786102
score: 0
type: Comment

http://stackoverflow.com/a/24908752
has body: You need to appened last character and its count outside your for loop because else part does not handle the appending for last character. Here i have tweaked your code to get required result. public static void main(String[] args) { char T[] = { 'h', 'h', 'l', 'l', 'y', 'y', 'j', 'h', 'h', 'l', 'a' }; String ans = ""; int counter = 0; int j = 0; for (int i = 0; i &lt; T.length; i++) { if (j == T.length - 1) { if (T[i] != T[j - 1]) { counter = 1; } break; } for (j = i; j &lt; T.length; j++) { if (T[i] == T[j]) { counter++; if (j == T.length - 1) { break; } } else { ans = ans + T[i] + counter; i = j - 1; counter = 0; break; } } } if (counter &gt; 0) { ans = ans + T[T.length - 1] + counter; } System.out.println(ans); }
score: 0
answers question: http://stackoverflow.com/q/24904260
type: Answer

http://stackoverflow.com/q/24795291
has body: I am trying to fetch records from a table using Join (self join). I am using EclipseLink JPA2 and MySQL. Here is the native query that I using. select * from mytable as detail join (select max(timestamp) as maxtimestamp from mytable where id=" + theUser.getId() + " group by hnumber order by maxtimestamp limit " + &lt;offset&gt; + "," + &lt;iTotalRecords&gt; + ") as topconv on detail.timestamp=topconv.maxtimestamp order by detail.timestamp I have following pojo class @Entity @Table(name="mytable") public class MyTable { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) @Column(name="mytableid") private long lMyTableId; @ManyToOne @JoinColumn(name="id", referencedColumnName="id") private User user; //this object has id, name and so on fields. @Column(name="timestamp", length=15, nullable=false) private String strTimestamp; @Column(name="hnumber", nullable=true) private String hNumber; //Getters and Setters. } Here is method to fetch the records public List&lt;MyTable&gt; fetchRecords(User theUser, int iTotalRecords, long offset) throws Exception { if(null == theUser) { throw new Exception("Invalid input."); } EntityManager entityManager = getEntityManager(); if(false == entityManager.getTransaction().isActive()) { entityManager.getTransaction().begin(); } try { Query query = entityManager.createQuery("select detail from MyTable as detail join (select topconv, max(topconv.timestamp) as maxtimestamp from MyTable where topconv.User= :User group by topconv.hnumber order by topconv.maxtimestamp) as topconv on detail.timestamp=topconv.maxtimestamp order by detail.timestamp"); query.setParameter("User", theUser.getUser()); @SuppressWarnings("unchecked") List&lt;SMS&gt; resultList = query.getResultList(); return resultList; } catch(Throwable th) { throw new Exception(th.getMessage()); } finally { closeEntityManager(); } } To get and close EntityManager private EntityManagerFactory _entityManagerFactory = Persistence.createEntityManagerFactory("JPATest"); protected EntityM…
answer count: 0
has comment: http://stackoverflow.com/comment/38486777
tagged with: java
tagged with: multithreading
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/38487279
score: 0
tagged with: eclipselink
has title: JPA2: JOIN (Self Join) issue
tagged with: jpa-2.0
type: UnansweredQuestion

http://stackoverflow.com/comment/71595853
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24887709
has text: More closely a duplicate of [Java / convert ISO-8601 (2010-12-16T13:33:50.513852Z) to Date object](http://stackoverflow.com/q/4525850/642706)
type: QuestionComment

http://stackoverflow.com/comment/38557271
comment on: http://stackoverflow.com/q/24834050
score: 0
has text: @Jarmund you're going to have to give more specifications if you want a "smooth" curve. I'll give a piecewise linear solution that is continuous so that you don't have to worry about whether A < B < C or whatever.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38543008
comment on: http://stackoverflow.com/a/24826372
score: 0
has text: It says F:\ I think I realised my mistake. I changed the fileOut.write("cd "+ filePath +"\n") to just fileOut.write(filePath) and it changed the directory to my usb.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24759716
tagged with: java
has body: I have this composite key class: @Embeddable public class TaskEntityId implements Serializable { private static final long serialVersionUID = 1L; public String objectUuid; @Column(name="DOMAIN_OBJECT_UUID", nullable=false, length=36) public String getObjectUuid() { return objectUuid; } public void setObjectUuid(String uuid) { this.objectUuid = uuid; } public String taskName; @Column(name = "TASK_NAME", nullable=false, length=32) public String getTaskName() { return taskName; } public void setTaskName(String taskName) { this.taskName = taskName; } public Date createdTimestamp = new Date(); @Column(name = "CREATED_TS", nullable=false, updatable=false) @Temporal(TemporalType.TIMESTAMP) public Date getCreatedTimestamp() { return createdTimestamp; } public void setCreatedTimestamp(Date createdTimestamp) { this.createdTimestamp = createdTimestamp; } @Override public boolean equals(Object o) {...} @Override public int hashCode() {...} @Override public String toString() {...} } Which is used in this entity class: @Entity @Table(name = "TASK") @IdClass(TaskEntityId.class) public class TaskEntity implements Serializable { @EmbeddedId TaskEntityId id; public TaskEntityId getId() { return id; } public void setId(TaskEntityId id) { this.id = id; } ... I also added to this class some extra getters based on suggestions to other similar questions: public String getObjectUuid() { return id.getObjectUuid(); } public String getTaskName() { return id.getTaskName(); } public Date getCreatedTimestamp() { return id.getCreatedTimestamp(); } Still, I get this exception: Error in custom provider, org.hibernate.AnnotationException: Unable to find properties (createdTimestamp, objectUuid, taskName) in entity annotated with @IdClass:c.m.d.p.TaskEntity
type: Question
tagged with: hibernate
has title: Hibernate Exception: Unable to find properties ... in entity annotated with @IdClass
has answer: http://stackoverflow.com/a/24760121
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24760015
upvote count: 2

http://stackoverflow.com/comment/38539854
has text: @morgano There is no other way to put it but "you are wrong." I have specifically quoted the sentence from the JLS which makes `msg` receive a happens-before arrow (the one mentioning *program order*). Additionally, ChrisK has even linked to a *compiler cookbook* which explains what the JLS requirements boil down to for the compiler writer.
comment on: http://stackoverflow.com/a/24823918
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/48569695
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24751032
has body: JDK is needed to compile your java file into class file. And JRE will execute the generated class file and provides the output. If you have admin problems in your m/c then you can install the JDK in some other m/c and take the class files into your system and execute them.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38680760
has text: @user1613360 The trick to remember is that most of these sort of puzzles are mathematical in nature rather than plan programming tasks. Find a mathematical transformation which is cheaper and you will be dramatically faster.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24899138

http://stackoverflow.com/comment/38640614
comment on: http://stackoverflow.com/q/24862433
score: 0
type: QuestionComment
has text: Right now there is no way for doing that.
type: Comment

http://stackoverflow.com/comment/63727039
has text: Typo? Do you mean `if (! label.isEnabled() ){`
comment on: http://stackoverflow.com/a/38148446
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38461030
score: 0
type: QuestionComment
has text: 1. does you code compile? 2.you can reverse you string easily using a StringBuilder.
type: Comment
comment on: http://stackoverflow.com/q/24783072

http://stackoverflow.com/q/24770120
tagged with: sockets
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24770263
type: Question
tagged with: datagram
has answer: http://stackoverflow.com/a/24770214
answer count: 2
tagged with: udp
possible better answer: http://stackoverflow.com/a/24770214
has answer: http://stackoverflow.com/a/24770263
has title: Java: send repeatedly from same UDP port or specify localport for UDP Socket.send()
has body: Is it possible to either use the same port over multiple socket.send() or specify a port when creating a DatagramSocket? If so how. I am attempting hole-punching and need to listen from the port that is used and I cannot change the port the client is sending from. try { DatagramSocket dSocket = new DatagramSocket(); InetAddress serverAddr = InetAddress.getByName(TARGETIP) int msg_len = currentMsg.length(); byte[] message = currentMsg.getBytes(); DatagramPacket dPacket = new DatagramPacket(message,msg_len,serverAddr,3222); dSocket.send(dPacket); updateConversationHandler.post(new systemUIUpdate("UDP Packet from " + dSocket.getLocalPort())); } catch (Exception e){ e.getMessage(); e.printStackTrace(); } Every time this is run via an eventhandler dSocket.getLocalPort() shows a different port.

http://stackoverflow.com/comment/38643717
has text: I don't understand this syntax = if(mPrefs.getInt("login", -401)==201)return true; How can i check all the edit texts in launcher Activity.
comment on: http://stackoverflow.com/a/24879585
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38438678
score: 0
type: AnswerComment
type: Comment
has text: @user3674428 For what purpose?
comment on: http://stackoverflow.com/a/24770885

http://stackoverflow.com/a/24887386
has body: Turns out something must have gone wrong with the dependency download of javaee-api-7.0 - I could only see the META-INF directories underneath the jar itself. After manually downloading and installing the artefact, I was able to build successfully. Huzzah!
answers question: http://stackoverflow.com/q/24826961
score: 0
type: Answer

http://stackoverflow.com/q/24840667
has comment: http://stackoverflow.com/comment/68397524
type: Question
has title: What is the regex to extract all the emojis from a string?
has answer: http://stackoverflow.com/a/30840603
has answer: http://stackoverflow.com/a/66500607
has answer: http://stackoverflow.com/a/35078321
has body: I have a String encoded in UTF-8. For example: That's a nice joke I have to extract all the emojis present in the sentence. And the emoji could be anything. When this sentence is viewed in terminal using command less text.txt it is viewed as: That's a nice joke <U+1F606><U+1F606><U+1F606> <U+1F61B> This is the corresponding UTF code for the emoji. All the codes for emojis can be found at emojitracker. For the purpose of finding all the occurances, I used a regular expression pattern (<U\+\w+?>) but it didnt work for the UTF-8 encoded string. Following is my code: String s = "That's a nice joke "; Pattern pattern = Pattern.compile("(<U\\+\\w+?>)"); Matcher matcher = pattern.matcher(s); List<String> matchList = new ArrayList<>(); while (matcher.find()) { matchList.add(matcher.group()); } for (int i = 0; i < matchList.size(); i++) { System.out.println(matchList.get(i)); } This pdf says Range: 1F300–1F5FF for Miscellaneous Symbols and Pictographs. So I want to capture any character lying within this range.
possible better answer: http://stackoverflow.com/a/32872406
linked to: http://stackoverflow.com/q/24070515
has answer: http://stackoverflow.com/a/75528528
has comment: http://stackoverflow.com/comment/38569195
has answer: http://stackoverflow.com/a/53113333
upvote count: 75
has comment: http://stackoverflow.com/comment/82442094
answer count: 19
has comment: http://stackoverflow.com/comment/38569001
has answer: http://stackoverflow.com/a/45894101
has answer: http://stackoverflow.com/a/25369066
has answer: http://stackoverflow.com/a/32101331
has comment: http://stackoverflow.com/comment/75780384
tagged with: utf-8
tagged with: regex
has answer: http://stackoverflow.com/a/24841069
has answer: http://stackoverflow.com/a/45006350
favorite count: 0
has answer: http://stackoverflow.com/a/77157680
has answer: http://stackoverflow.com/a/42236875
has answer: http://stackoverflow.com/a/46279500
has answer: http://stackoverflow.com/a/25858015
has comment: http://stackoverflow.com/comment/69497552
linked to: http://stackoverflow.com/q/28366172
has answer: http://stackoverflow.com/a/67730175
has answer: http://stackoverflow.com/a/50026845
tagged with: emoji
downvote count: 1
score: 74
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38569049
has answer: http://stackoverflow.com/a/44056668
tagged with: java
accepted answer: http://stackoverflow.com/a/24841069
has answer: http://stackoverflow.com/a/63552506
has answer: http://stackoverflow.com/a/32872406

http://stackoverflow.com/q/24845402
type: Question
has comment: http://stackoverflow.com/comment/38578115
has answer: http://stackoverflow.com/a/24845570
downvote count: 0
answer count: 1
score: 1
has body: I know this is a common question but I couldn't find solution for my particular case. I have a class Player implements Runnable which is used to play .wav sounds when a button is clicked. Here is the run() method. public void run() { auline.start(); int nBytesRead = 0; byte[] abData = new byte[EXTERNAL_BUFFER_SIZE]; try { while (nBytesRead != -1) { nBytesRead = audioInputStream.read(abData, 0, abData.length); if (nBytesRead &gt;= 0) auline.write(abData, 0, nBytesRead); } } catch (IOException e) { e.printStackTrace(); return; } finally { auline.drain(); auline.close(); } } And this is where I create and run the thread itself. soundButtons[j].addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); int index = Integer.parseInt(button.getName()); Thread t = new Thread(samples[index]); t.start(); } }); The problem is that java doesn't allow to start the same thread two times. But i can't figure out why it isn't working because every time I am creating a new reference object new Thread(samples[index]); . Are there any suggestions? Thanks in advance
favorite count: 0
has comment: http://stackoverflow.com/comment/38578244
has comment: http://stackoverflow.com/comment/38578302
has comment: http://stackoverflow.com/comment/38578295
accepted answer: http://stackoverflow.com/a/24845570
has comment: http://stackoverflow.com/comment/38578189
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38578093
tagged with: java
tagged with: multithreading
upvote count: 1
has title: Java thread not working second time
has comment: http://stackoverflow.com/comment/38578129

http://stackoverflow.com/comment/38643074
type: QuestionComment
comment on: http://stackoverflow.com/q/24879303
has text: What are you trying to accomplish? Is this just to play around with threads?
score: 0
type: Comment

http://stackoverflow.com/q/24882198
tagged with: swing
has comment: http://stackoverflow.com/comment/38656027
has comment: http://stackoverflow.com/comment/38648449
has answer: http://stackoverflow.com/a/45207522
type: Question
has comment: http://stackoverflow.com/comment/38652958
tagged with: awt
score: 0
has title: How to change the color of JInternalFrame Titlebar?
has body: I want to change the color of JInternalFrame Title bar. For this I had tried with some forum suggestions but it doesn't work. In my application Click on create menu item then it shows an internal frame. I want to change the color of that title bar. Here is my code: public class CreateDocs extends javax.swing.JFrame { int i=0; JTextPane textPane; public CreateDocs() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tabbedPane = new javax.swing.JTabbedPane(); menuBar = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); create = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); create.setText("Create"); create.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { createActionPerformed(evt); } }); jMenu1.add(create); menuBar.add(jMenu1); setJMenuBar(menuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 410, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 410, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 279, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)) ); pack(); }// &lt;/editor-fold&gt; private void createActionPerformed(java.awt.event.ActionEvent evt) { final JInternalFrame internalFrame = new JInternalFrame(""); i++; UI…
answer count: 1
tagged with: jinternalframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38650662
has comment: http://stackoverflow.com/comment/38655065
linked to: http://stackoverflow.com/q/2183953
tagged with: java
tagged with: look-and-feel
has comment: http://stackoverflow.com/comment/38654270

http://stackoverflow.com/comment/38672724
type: Comment
comment on: http://stackoverflow.com/a/24894476
type: AnswerComment
has text: @Sanjeev There is no need for another answer, one is fine especially that you are close to correct solution. Feel free to update your answer or if you want I can do it for you.
score: 0

http://stackoverflow.com/a/24876123
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24875998
has body: I continued my fiddling and was able to do it with: File theDir = new File(host); if(!theDir.exists()) { System.out.println("Creating Directory: " + host); boolean result = false; try{ theDir.mkdir(); result = true; } catch (SecurityException se){ //handle } if(result){ System.out.println("DIR created"); } } } catch (IOException ex) { ex.printStackTrace(); } Thanks to those who replied.

http://stackoverflow.com/q/24825964
accepted answer: http://stackoverflow.com/a/24950927
tagged with: soap
has title: How to use GetLineReq in AXL Java Client using JAX-WS
upvote count: 1
type: AnsweredQuestion
has body: What I'm trying to do is to obtain a Directory Number from CUCM, using the AXL API from Cisco. Here's the relevant Code: private void getNumber(){ AXLAPIService axlService = new AXLAPIService(); AXLPort axlPort = axlService.getAXLPort(); String validatorUrl = "https://mycucm:8443/axl/"; ((BindingProvider) axlPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, validatorUrl); ((BindingProvider) axlPort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, Demo.ucAdmin); ((BindingProvider) axlPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, Demo.ucPswd); GetLineReq axlParams = new GetLineReq(); axlParams.setPattern("7491817"); axlParams.setUuid("{48a6ff28-cea7-fc3e-3d82-8cc245ed4ea3}"); GetLineRes getLineResponse = axlPort.getLine(axlParams); Demo.informUser("Line Information: \n" + "Alerting Name: " + getLineResponse.getReturn().getLine().getAlertingName() + "\n" + "Dial Number: " + getLineResponse.getReturn().getLine().getPattern() + "\n" + "Description: " + getLineResponse.getReturn().getLine().getDescription() + "\n" + " " + getLineResponse.getReturn().getLine().getShareLineAppearanceCssName()); } As you can tell from this diagram it is only necessary to specify either the uuid or the pattern of the number: But the code only works, if I specify the uuid, which is not, what I'm trying to achieve. The only thing i have given, is the pattern, which I want to use, to get all the other information. I Already examined this site from Cisco: How to ... Create an AXL Java Client using JAX-WS When I leave out the uuid I get this Error: Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Item not valid: The specified Line was not found I also checked, how the Directory Number is stored inside the CUCM Database using the AXLSqlToolkit: <?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/e…
score: 1
tagged with: java
tagged with: jax-ws
tagged with: cisco-axl
type: Question
has answer: http://stackoverflow.com/a/24950927
downvote count: 0
answer count: 1
favorite count: 0

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/24899115
type: Tag

http://stackoverflow.com/a/24807150
has comment: http://stackoverflow.com/comment/38507444
answers question: http://stackoverflow.com/q/24806938
has comment: http://stackoverflow.com/comment/38508788
has comment: http://stackoverflow.com/comment/38506052
has comment: http://stackoverflow.com/comment/38506168
score: 0
has comment: http://stackoverflow.com/comment/38507302
has comment: http://stackoverflow.com/comment/38508508
has comment: http://stackoverflow.com/comment/38507638
has comment: http://stackoverflow.com/comment/38507451
has comment: http://stackoverflow.com/comment/38508314
has comment: http://stackoverflow.com/comment/38509462
has body: In the past when creating memory intensive apps I've had to manually increase the amount of memory the app has access to. There may not necessarily be a OOM error, but the app may simply be extremely memory intensive. Try adding this to your application tag in your manifest: android:largeHeap="true" Hopefully this helps :)
has comment: http://stackoverflow.com/comment/38507769
type: Answer
has comment: http://stackoverflow.com/comment/38508890

rest
tags question: http://stackoverflow.com/q/24828996
tags question: http://stackoverflow.com/q/24807998
tags question: http://stackoverflow.com/q/24837703
tags question: http://stackoverflow.com/q/24805416
tags question: http://stackoverflow.com/q/24844779
tags question: http://stackoverflow.com/q/24750522
tags question: http://stackoverflow.com/q/24860075
tags question: http://stackoverflow.com/q/24752326
tags question: http://stackoverflow.com/q/24776450
tags question: http://stackoverflow.com/q/24806419
tags question: http://stackoverflow.com/q/24820215
tags question: http://stackoverflow.com/q/24833533
tags question: http://stackoverflow.com/q/24771632
tags question: http://stackoverflow.com/q/24828421
tags question: http://stackoverflow.com/q/24865762
tags question: http://stackoverflow.com/q/24844049
tags question: http://stackoverflow.com/q/24813594
tags question: http://stackoverflow.com/q/24781516
tags question: http://stackoverflow.com/q/24798291
tags question: http://stackoverflow.com/q/24897439
tags question: http://stackoverflow.com/q/24825386
tags question: http://stackoverflow.com/q/24896353
tags question: http://stackoverflow.com/q/24759192
tags question: http://stackoverflow.com/q/24906314
tags question: http://stackoverflow.com/q/24885870
tags question: http://stackoverflow.com/q/24874424
tags question: http://stackoverflow.com/q/24777883
tags question: http://stackoverflow.com/q/24840863
tags question: http://stackoverflow.com/q/24855250
type: Tag
tags question: http://stackoverflow.com/q/24807092
tags question: http://stackoverflow.com/q/24769691
tags question: http://stackoverflow.com/q/24890675
tags question: http://stackoverflow.com/q/24765840
tags question: http://stackoverflow.com/q/24822923
tags question: http://stackoverflow.com/q/24856728
tags question: http://stackoverflow.com/q/24854552
tag name: rest
tags question: http://stackoverflow.com/q/24897634
tags question: http://stackoverflow.com/q/24790870
tags question: http://stackoverflow.com/q/24801296
tags question: http://stackoverflow.com/q/24762641
tags question: http://stackoverflow.com/q/24857790
tags question: http://stackoverflow.com/q/24817877
tags question: http://stackoverflow.com/q/24757609
tags question: http://stackoverflow.com/q/24796256
tags question: http://stackoverflow.com/q/24757492
tags question: http://stackoverflow.com/q/24757076
tags question: http://stackoverflow.com/q/24880649
tags question: http://stackoverflow.com/q/24893738
tags question: http://stackoverflow.com/q/24819442
tags question: http://stackoverflow.com/q/24766202

http://stackoverflow.com/comment/38638566
type: Comment
type: QuestionComment
score: 0
has text: Show the code that accesses this file.
comment on: http://stackoverflow.com/q/24876819

http://stackoverflow.com/q/24759784
downvote count: 0
tagged with: java
has body: In my app I have two modes: demo and real. In demo mode I mock server communication by using another class: @Module(...) public class CommunicationModule { @Provides @Singleton CommunicationWrapper provideNetworkBusWrapper(Application app) { boolean isDebug = ((MyApplication) app).isDebug(); CommunicationWrapper result = null; if (isDebug) { result = new DemoWrapper(app); } else { result = new NetworkWrapper(app); } return result; } } Now after a specific user action I'd like to reinitialize this dependency. Is it it possible to do it without rebuilding the whole ObjectGraph?
has answer: http://stackoverflow.com/a/24760463
tagged with: dagger
type: Question
tagged with: dependency-injection
upvote count: 2
has answer: http://stackoverflow.com/a/27953879
answer count: 3
has answer: http://stackoverflow.com/a/24767115
tagged with: android
favorite count: 0
has title: How do I re-inject specific object with Dagger
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/38531251
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24813135
has text: @TravisParks look at the update - the project where you use `EntityManager` should have these dependencies.

http://stackoverflow.com/comment/38399327
type: Comment
comment on: http://stackoverflow.com/a/24750400
has text: `Double.parseDouble()` will be fine with whitespace in it. [Its backing implemenation will use `trim()`](http://www.docjar.com/html/api/sun/misc/FloatingDecimal.java.html) to remove the whitespace character(s).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38440504
type: QuestionComment
score: 0
has text: I have tried with apache poi 3.10 also but its not working
comment on: http://stackoverflow.com/q/24753664
type: Comment

http://stackoverflow.com/comment/38501628
type: Comment
score: 0
type: AnswerComment
has text: @Unihedron - *"...as it prevents the need for creating a new Iterator<?>"* . It is more complicated than that. That optimization only happens for `Iterable` objects that can be cast to `List`. In other words, not in this case.
comment on: http://stackoverflow.com/a/24794013

http://stackoverflow.com/comment/38616633
score: 1
comment on: http://stackoverflow.com/q/24865454
has text: It is not related to maven rather how log4j works. IMO, log4j expects to finds the 'properties' file available on the classpath.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24847466
tagged with: persistence
favorite count: 0
has title: Update multiple rows using hibernate Criteria
has body: I am trying to run an update query which would look like this in sql: update studentMaster set sess_status = 'G' where ACADEM_YEAR = COURSE_YEAR; I am trying to re-create the query using Criteria like this: public void updateSessionStatus() { Session sess = factory.openSession(); Transaction tx = null; try { tx = sess.beginTransaction(); Criteria crit = sess.createCriteria(CollegeStudentsMaster.class); crit.add(Restrictions.eqProperty("academicYear", "courseYears")); CollegeStudentsMaster e = (CollegeStudentsMaster) crit.uniqueResult(); e.setSessionStatus("G"); sess.saveOrUpdate(e); tx.commit(); } catch (HibernateException asd) { if (tx != null) { tx.rollback(); } log.debug(asd.getMessage()); } finally { sess.close(); } } This is not working because the rows which meet this Criteria are many, my unique result is the problem here I guess. How can I convert this into an update for all the rows that meet the Criteria. I do not want to use HQL query, I am rather doing it with Criteria.
downvote count: 0
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
score: 7
type: Question
has answer: http://stackoverflow.com/a/24847809
accepted answer: http://stackoverflow.com/a/24847809
upvote count: 7
answer count: 1

http://stackoverflow.com/comment/54924095
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24766809
has text: Ok, but still it feels that answer to: "I want to have a work queue that behaves almost exactly like ruby's sidekiq" is not exactly the same as implement it yourself using this libraries. :-)

http://stackoverflow.com/q/24821170
score: 2
favorite count: 0
has body: I am trying to get people information from the google API. Below is the code public static void main(String[] args) throws IOException, JSONException { plus = new Plus.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, new HttpRequestInitializer() { public void initialize(HttpRequest request) throws IOException { } }).setApplicationName("youtubeSearchSample").build(); Person profile = plus.people().get("https://www.googleapis.com/plus/v1/people/118359906569721392650?key=<Key>").execute(); System.out.println("hello-->"+profile.toPrettyString()); } public static Credential authorize(List<String> scopes, String credentialDatastore) throws IOException { // Load client secrets. InputStreamReader clientSecretReader = new InputStreamReader(Auth.class.getResourceAsStream("/client_secrets.json")); GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, clientSecretReader); // Checks that the defaults have been replaced (Default = "Enter X here"). if (clientSecrets.getDetails().getClientId().startsWith("Enter") || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) { System.out.println( "Enter Client ID and Secret from https://code.google.com/apis/console/?api=youtube" + "into src/main/resources/client_secrets.json"); System.exit(1); } // This creates the credentials datastore at ~/.oauth-credentials/${credentialDatastore} FileDataStoreFactory fileDataStoreFactory = new FileDataStoreFactory(new File(System.getProperty("user.home") + "/" + CREDENTIALS_DIRECTORY)); DataStore<StoredCredential> datastore = fileDataStoreFactory.getDataStore(credentialDatastore); System.out.println("scopes-->"+scopes.toString()); System.out.println("clientSecrets-->"+clientSecrets.toString()); GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, scopes).setCredentialDataStore(datastore) .build(); // Build the local server and bind it to port 8080 LocalServerReceiver localReceiver = new LocalServerRece…
has comment: http://stackoverflow.com/comment/38532880
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/38538809
has title: Google API for Plus Builder getting failed
tagged with: google-api
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38532707
downvote count: 0
has comment: http://stackoverflow.com/comment/38532466
has answer: http://stackoverflow.com/a/28290896
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38532757

http://stackoverflow.com/comment/38458753
score: 0
type: Comment
has text: Test your algorithm, and you'll see.
comment on: http://stackoverflow.com/a/24781728
type: AnswerComment

http://stackoverflow.com/a/24824448
type: Answer
has body: Edit: a good discussion can be found at Get generic type of class at runtime. The simplest solution is to pass a reference to the class at the time of instantiation of the object. Maintain a reference to this class to return when needed. This is due to Java not holding onto generics at runtime. The generic info is available in metadata if you want to use the verbose reflection api to retrieve it. use getClass() on the object itself. public final Class getClass() Returns the runtime class of this Object. The returned Class object is the object that is locked by static synchronized methods of the represented class. The actual result type is Class where |X| is the erasure of the static type of the expression on which getClass is called. For example, no cast is required in this code fragment: Number n = 0; Class c = n.getClass(); Returns: The Class object that represents the runtime class of this object. See Also: Literals, section 15.8.2 of The Java™ Language Specification. http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#getClass()
has comment: http://stackoverflow.com/comment/38555890
accepted answer of: http://stackoverflow.com/q/24824317
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24824317
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/57928782
answers question: http://stackoverflow.com/q/24838298
upvote count: 0
has body: Late answer, but findings can help others :) Faced similar issue, i was trying to connect database from Spring boot application developed using Eclipse. Open Mysql Command Prompt or GUI tool and run following query. GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%your_password%' WITH GRANT OPTION; Also check your TCP/IP service for database are enabled or not.
type: Answer
downvote count: 1
score: -1

http://stackoverflow.com/comment/38648928
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24861733
has text: @Dinu check wether you're pointing the alert correctly. else you try window handling, since we dont know what type of alert it is

http://stackoverflow.com/a/24875502
has comment: http://stackoverflow.com/comment/38636485
has comment: http://stackoverflow.com/comment/38638413
has comment: http://stackoverflow.com/comment/38636439
type: AcceptedAnswer
has body: I wrote a program to test this. All it does it call two methods repeatedly. The only contents of the methods are the two comparisons we want to test the performance of. public class StackOverflow { public static void main(String[] args) { String s = ""; while (true) { a(s); b(s); } } private static void a(String s) { if (s == null); } private static void b(String s) { if (null == s); } } I attached a profiler to my program. Here are the results after 70 seconds of execution: As you can see, the CPU time is nearly four times lighter in a(). This suggests that the comparison s == null is indeed faster than null == s.
has comment: http://stackoverflow.com/comment/38638381
answers question: http://stackoverflow.com/q/24875362
score: 12
has comment: http://stackoverflow.com/comment/38636559
downvote count: 3
accepted answer of: http://stackoverflow.com/q/24875362
has comment: http://stackoverflow.com/comment/38636563
upvote count: 15
has comment: http://stackoverflow.com/comment/38638756
type: Answer

http://stackoverflow.com/comment/38398522
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24749757
has text: I think you are right. I matched character-by-character and it does seem the text is in `ISO-8859-7` encoding. Now my problem is there are several HTML files which are `ISO-8859-1`. Is there any "generic" way of reading the contents of files so that both `ISO-8859-1` and `ISO-8859-7` files are read correctly?
score: 0

http://stackoverflow.com/comment/52565190
has text: Here we are solving the same problem hope this link will help you. [enter link description here][1] [1]: https://stackoverflow.com/questions/10292587/java-date-time-difference/32345585#32345585
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24907002

http://stackoverflow.com/q/24801297
favorite count: 0
has comment: http://stackoverflow.com/comment/38526387
answer count: 0
type: UnansweredQuestion
tagged with: javasound
tagged with: audio
has title: javax.sound.midi in Java
has body: I'm trying to play some things with the javax.sound.midi ; this is the code: import javax.sound.midi.*; public class MiniMidiProject1 { public static void main(String[] args){ try{ Sequencer sequencer = MidiSystem.getSequencer(); sequencer.open(); Sequence seq = new Sequence(Sequence.PPQ, 4); Track track = seq.createTrack(); for(int i=5;i&lt;61;i+=4){ track.add(makeEvent(144,1,i,100,i)); track.add(makeEvent(128,1,i,100,i+2)); } sequencer.setSequence(seq); sequencer.setTempoInBPM(220); sequencer.start(); } catch(Exception ex) {ex.printStackTrace();} } public static MidiEvent makeEvent(int comd, int chan, int one, int two, int tick){ MidiEvent event = null; try{ ShortMessage a = new ShortMessage(); a.setMessage(comd, chan, one, two); event = new MidiEvent(a,tick); } catch(Exception a){} return event; } } It's supposed to be working, because it is from the "Head First Java" book. The warning generated is: ??? 17, 2014 1:30:48 PM java.util.prefs.WindowsPreferences &lt;init&gt; WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. Can some one explain me what the problem is?
score: 1
has comment: http://stackoverflow.com/comment/38497710
tagged with: java
has comment: http://stackoverflow.com/comment/38499645
type: Question
has comment: http://stackoverflow.com/comment/38495200
downvote count: 0
has comment: http://stackoverflow.com/comment/38513530
upvote count: 1

http://stackoverflow.com/comment/38467405
has text: Exactly what I wanted to know. So system.in is a parameter in scanner class to accept input.
type: AnswerComment
comment on: http://stackoverflow.com/a/24786431
type: Comment
score: 1

http://stackoverflow.com/comment/38471594
comment on: http://stackoverflow.com/q/24788535
score: 7
type: Comment
type: QuestionComment
has text: Maybe renaming your getters will make it easy for you to remember which getter to use. Also three getters does not imply "a huge amount of getters".

http://stackoverflow.com/a/24908750
has body: You can try python modules that allow to access java classes dynamically such as Py4j and JPype.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24908276
answers question: http://stackoverflow.com/q/24908276

http://stackoverflow.com/q/24825804
has body: Working on a project with google maps in it.I am trying to retrieve bitmap images from a URL and it works fine ,but not all the time The code i am using to retrieve the url is inside a async class. The async class: public class retrieveimage extends AsyncTask&lt;String,Void,Void&gt; { Store_data s; MarkerOptions marker; Bitmap pinbit; public retrieveimage(Store_data s) { this.s=s; } @Override protected Void doInBackground(String... arg0) { try { marker = new MarkerOptions().position(new LatLng(Double.parseDouble(s.store_latitude),Double.parseDouble(s.store_longitude))).title(s.store_name); String url1=arg0[0]; URL url = new URL(url1); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); bitmap= BitmapFactory.decodeStream(input); pinbit=bitmap; } catch (Exception e) { e.printStackTrace(); return null; } return null; } @Override protected void onPostExecute(Void result) { View custom_layout = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.custom_marker_layout,null); ImageView iv_category_logo=(ImageView) custom_layout.findViewById(R.id.iv_category_logo); pinbit=Bitmap.createScaledBitmap(pinbit,68,62,false); iv_category_logo.setImageBitmap(pinbit); //pinbit=MainActivity.getCroppedBitmap(pinbit, 10); marker.icon(BitmapDescriptorFactory.fromBitmap(createDrawableFromView(StoreFinal.this, custom_layout))); // adding marker googleMap.addMarker(marker); } } I am calling the async class as: new retrieveimage(sobj).execute(URL_image+sobj.category+".png"); The problem is that the variable pinbit gets NPE randomly.Many times the desired result is seen.But sometimes out of random i get NPE.So i think there is something wrong with the doInBackground method where the web operation takes place.How do i ensure that the code with the web operation doesnt break? The LOGCAT: 07-18 18:26:20.289: E/AndroidRuntime(27803): FATAL EXCEP…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38541334
tagged with: eclipse
type: Question
score: 0
linked to: http://stackoverflow.com/q/19310985
tagged with: google-maps
has title: Retrieving bitmap image from a URL ,getting nullpointerexception randomly in android
answer count: 1
has comment: http://stackoverflow.com/comment/38541887
tagged with: android
has answer: http://stackoverflow.com/a/24827531
accepted answer: http://stackoverflow.com/a/24827531
has comment: http://stackoverflow.com/comment/38541383

http://stackoverflow.com/q/24810859
has title: Is there simple way to detect keyboard and mouse button being pressed and held in Java without application focus?
answer count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24810973
accepted answer: http://stackoverflow.com/a/24810973
type: Question
tagged with: mouseevent
score: 0
has body: I'm trying to write quite simple program in Java - when user click left mouse button it will autoclick until released, but only if toggled before with keyboard key. I have no problem with this autofire part, but I dont know how to detect keyboard press, and mouse button press when my aplication doesn't have focus. Is there some simply way to do it?

apache
tag name: apache
tags question: http://stackoverflow.com/q/24756738
tags question: http://stackoverflow.com/q/24824844
tags question: http://stackoverflow.com/q/24812590
tags question: http://stackoverflow.com/q/24903986
tags question: http://stackoverflow.com/q/24809803
tags question: http://stackoverflow.com/q/24902919
tags question: http://stackoverflow.com/q/24836693
tags question: http://stackoverflow.com/q/24832946
tags question: http://stackoverflow.com/q/24767276
tags question: http://stackoverflow.com/q/24826808
tags question: http://stackoverflow.com/q/24877741
tags question: http://stackoverflow.com/q/24905069
tags question: http://stackoverflow.com/q/24837169
tags question: http://stackoverflow.com/q/24824270
tags question: http://stackoverflow.com/q/24882765
tags question: http://stackoverflow.com/q/24751528
tags question: http://stackoverflow.com/q/24872259
tags question: http://stackoverflow.com/q/24792837
tags question: http://stackoverflow.com/q/24764433
type: Tag
tags question: http://stackoverflow.com/q/24757430
tags question: http://stackoverflow.com/q/24805540
tags question: http://stackoverflow.com/q/24876740
tags question: http://stackoverflow.com/q/24772367
tags question: http://stackoverflow.com/q/24901621
tags question: http://stackoverflow.com/q/24882580
tags question: http://stackoverflow.com/q/24808207
tags question: http://stackoverflow.com/q/24806299

http://stackoverflow.com/q/24902975
upvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/24903241
has title: Difference between synchronized methods and blocks
has comment: http://stackoverflow.com/comment/38687756
has body: My question is seems similar to other question in stack over flow,but I am not able to understand that when have more than one method in the class I put both the methods in synchronized block and I am trying to run the both methods is different threads but here the methods are running one after the other. Main Class /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Login.Package; import java.util.ArrayList; import java.util.List; import org.hibernate.Session; /** * * @author ranjeeth.g */ public class TransportDataTransper { public static void main(String[] args) { Account a = new Account(); Thread t = new Thread(new WithDraw(a)); t.start(); Thread b = new Thread(new BalanceChecfk(a)); b.start(); // Thread t1 = new Thread(new WithDraw(a)); // t1.start(); // t.start(); // t.start(); } } Account Class. public class Account { public double withDr() { synchronized (this) { System.out.println("with draw check method = "); for (int i = 0; i &lt; 50; i++) { System.out.println("i = " + i); } return 0; } } public double balacheck() { synchronized (this) { System.out.println("Balance check method = "); for (int i = 0; i &lt; 50; i++) { System.out.println("i = " + i); } return 0; } } // public synchronized double deposit(double amount) { // return 0; // } }
downvote count: 1
linked to: http://stackoverflow.com/q/574240
type: Question
has answer: http://stackoverflow.com/a/24903283
has comment: http://stackoverflow.com/comment/38687804
score: -1
has answer: http://stackoverflow.com/a/24903038
answer count: 3

http://stackoverflow.com/a/24812347
has comment: http://stackoverflow.com/comment/38859123
has body: this is not enough : jdbc:derby:Wa_Poly for a embedded connection must be something like jdbc:derby:C:/Dokumente und Einstellungen/Administrator/.netbeans-derby/Wa_Poly look at my answer here embedded Derby EDIT Right click Services -> JavaDB -> create database look where your database folder is.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38523522
upvote count: 1
has comment: http://stackoverflow.com/comment/38859811
has comment: http://stackoverflow.com/comment/38538403
type: Answer
answers question: http://stackoverflow.com/q/24806661
has comment: http://stackoverflow.com/comment/38524869

http://stackoverflow.com/comment/38568218
comment on: http://stackoverflow.com/q/24840217
type: Comment
type: QuestionComment
score: 1
has text: possible duplicate of [In Java, what's the difference between public, default, protected, and private?](http://stackoverflow.com/questions/215497/in-java-whats-the-difference-between-public-default-protected-and-private)

http://stackoverflow.com/comment/38463188
score: 2
has text: Since Java 8 you can also return an `Optional` which is empty in case of a non-existing key.
comment on: http://stackoverflow.com/q/24784008
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38653480
type: Comment
has text: @Stephan not sure I get what you're saying, namely *used grouping on user* and *give me a like for this C* solution* parts.
comment on: http://stackoverflow.com/q/24863598
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38685579
type: AnswerComment
comment on: http://stackoverflow.com/a/24901771
has text: I need to parse a very large file that is on a server and find some specific info within this file and display the results on a mobile device.
score: 0
type: Comment

http://stackoverflow.com/comment/38515869
type: QuestionComment
score: 0
has text: In the IDE. Unfortunately I don't have an easy way to run these methods, and even if I did it would take a lot of work to be sure that my testing ran through every possible conditional branch in the code. I was hoping for some kind of tool that I could plug method A into and determine if there is a path to method D. As for code to show, that's the big problem: I've got hundreds of classes and hundreds more methods, the complexity is why it's unrealistic to sift through each branch by hand.
comment on: http://stackoverflow.com/q/24812155
type: Comment

http://stackoverflow.com/q/24846880
has answer: http://stackoverflow.com/a/24846896
type: Question
upvote count: 0
tagged with: user-interface
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -3
has body: I wanted to create a desktop app for simple use, however I want to learn change the theme and look of the app. I want the app to look like Spotify in a way. How should I code this and are there any libraries available ?
has title: How do I change the color of GUI in Java, for example the way spotify has their desktop app in color of blackish/grey?
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/38642440
score: 0
has text: The obvious question is "Why did they write the specification in a way that does not treat floating point and integer arithmetic congruently?"
type: AnswerComment
comment on: http://stackoverflow.com/a/24878894
type: Comment

http://stackoverflow.com/comment/38497029
has text: some code examples:http://www.coreservlets.com/JSF-Tutorial/primefaces/code/
type: QuestionComment
comment on: http://stackoverflow.com/q/24801372
score: 0
type: Comment

calendar
tags question: http://stackoverflow.com/q/24842731
tags question: http://stackoverflow.com/q/24851351
tags question: http://stackoverflow.com/q/24846701
tag name: calendar
tags question: http://stackoverflow.com/q/24881756
tags question: http://stackoverflow.com/q/24844982
tags question: http://stackoverflow.com/q/24828014
type: Tag
tags question: http://stackoverflow.com/q/24806183

http://stackoverflow.com/a/24819094
upvote count: 2
has body: Since you have not overriden toString() it takes the implementation from Object class which is implicit superclass of all classes. public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); }
answers question: http://stackoverflow.com/q/24819037
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/24789913
has body: JPanels hold JComponents, i.e. JButtons, JLabels, etc. A String is not a component. It would be best if you'd just use a JLabel with a String as its parameter, then add that to a JPanel.
score: 0
answers question: http://stackoverflow.com/q/24789755
type: Answer

http://stackoverflow.com/q/24905478
has comment: http://stackoverflow.com/comment/38696272
upvote count: 2
type: UnansweredQuestion
tagged with: sockets
tagged with: encryption
has body: I need my Java client which its job is to makes SSL connection with SSL servers to be able to support the following chipher suites: ECDHE-ECDSA-CHACHA20-POLY1305-SHA256 ECDHE-RSA-CHACHA20-POLY1305-SHA256 The problem is that when I the Java supported cipher suites using: socket.getSupportedCipherSuites(); I did not find them. How can I add these two ciphers into the JSSE supported cipher suites? Please, clarify.
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38707768
type: Question
tagged with: ssl
tagged with: security
has title: How to enable cipher suites not in JSSE
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/108501018
comment on: http://stackoverflow.com/a/33402845
type: Comment
has text: @M.Justin Not a bad point for the array portion of this answer, but what about a plain "List"? You can't really use Arrays.toString() on that. How would you suggest using this technique on something like the AutoPopulatingList you mentioned? Maybe: new ArrayList(autoPopulatingList).toString()? Or I guess you could convert it into an array. Maybe if you ran into such a problem you should hope you are on 1.8 or later and could use one of the other answers in this thread...
score: 0
type: AnswerComment

http://stackoverflow.com/a/24786478
has comment: http://stackoverflow.com/comment/38474005
has comment: http://stackoverflow.com/comment/38475706
has comment: http://stackoverflow.com/comment/38504318
has comment: http://stackoverflow.com/comment/38474052
has comment: http://stackoverflow.com/comment/38475003
has body: The prefix eg: isn't what you think it is: The eg: prefix in the rules doesn't expand to what you think it does. I modified your rules string to String rules = "[rule1: (?a eg:p ?b) (?b eg:p ?c) -&gt; (?a eg:p ?c)] [rule2: -&gt; (&lt;urn:ex:a&gt; eg:foo &lt;urn:ex:b&gt;)]"; so that rule2 will always insert the triple urn:ex:a eg:foo urn:ex:b into the graph. Then, the output from your tests includes: [urn:ex:a, urn:x-hp:eg/foo, urn:ex:b] [urn:x-hp-jena:eg/C, urn:x-hp-jena:eg/p, urn:x-hp-jena:eg/D] The first line shows the triple that my rule2 inserted, whereas the second uses the prefix you entered by hand. We see that the eg: prefix is short for urn:x-hp:eg/. If you change your NS string accordingly, with String NS = "urn:x-hp:eg/";, then your derivations test will pass. You need to ask the right model The subProperty test fails for two reasons. First, it's checking in the wrong model. You're checking with A.getProperty(q): Statement statement = A.getProperty(q); System.out.println("Statement: " + statement); assertNotNull(statement); A is a resource that you created for the the model model, not the model inf, so when you ask for A.getProperty(q), it's actually asking model for the statement, so you won't see the inferences in inf. You can use inModel to get A "in inf" so that getProperty looks in the right model: Statement statement = A.inModel(inf).getProperty(q); Alternatively, you could also ask inf directly whether it contains a triple of the form A q &lt;something&gt;: inf.contains( A, q, (RDFNode) null ); Or you could enumerate all such statements: StmtIterator stmts = inf.listStatements( A, q, (RDFNode) null ); assertTrue( stmts.hasNext() ); while ( stmts.hasNext() ) { System.out.println( "Statement: "+stmts.next() ); } You need RDFS reasoning too Even if you're querying the right model, your inference model still needs to do RDFS reasoning as well as your custom rule that makes the property p transitive. To do that, we can pull the rules out from an RDFS re…
has comment: http://stackoverflow.com/comment/38475115
has comment: http://stackoverflow.com/comment/38476878
score: 7
has comment: http://stackoverflow.com/comment/38475654
has comment: http://stackoverflow.com/comment/38476071
has comment: http://stackoverflow.com/comment/38489810
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38476971
has comment: http://stackoverflow.com/comment/38474400
answers question: http://stackoverflow.com/q/24786035
has comment: http://stackoverflow.com/comment/38495613
upvote count: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/24786035
downvote count: 0
has comment: http://stackoverflow.com/comment/38474984
has comment: http://stackoverflow.com/comment/38475073
has comment: http://stackoverflow.com/comment/38474275
has comment: http://stackoverflow.com/comment/38495534

http://stackoverflow.com/comment/96644462
comment on: http://stackoverflow.com/a/24760731
type: Comment
score: 2
has text: Thank you, that was it for me. Deleted the reference to the jar under "java build path -> librairies" and everything came back in order
type: AnswerComment

http://stackoverflow.com/comment/38445604
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24774948
has text: @Dani then it's a wrong opinion. I don't understand where you are coming from. Why would using an array with `50` empty spaces to store two values be better than using a `Map` specifically designed for the task?

http://stackoverflow.com/comment/38451355
comment on: http://stackoverflow.com/q/24778123
type: QuestionComment
has text: I think you need to post some code, only relevant parts and then explain clearly what is currently happening and what you would like to achieve.
score: 0
type: Comment

http://stackoverflow.com/comment/38412846
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24756819
type: QuestionComment
has text: @AndrewStubbs there is no method hasNext().

http://stackoverflow.com/a/24759078
accepted answer of: http://stackoverflow.com/q/24758805
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24758805
type: Answer
has body: Simply include the path to the class files under the path corresponding to your fully qualified package names: <fileset dir="gen/bin" includes="com/me/myorg/fizz/**/*.class" /> <fileset dir="gen/bin" includes="com/me/myorg/buzz/**/*.class" /> <fileset dir="gen/bin" includes="com/me/myorg/foo/**/*.class" /> <fileset dir="gen/bin" includes="com/me/myorg/bar/**/*.class" /> **/*.class means all class files including ones inside subdirectories if any.
score: 2
upvote count: 2

http://stackoverflow.com/q/24801059
tagged with: spring
has comment: http://stackoverflow.com/comment/38501097
downvote count: 0
has comment: http://stackoverflow.com/comment/38498658
has comment: http://stackoverflow.com/comment/38499177
score: 1
tagged with: java
has title: Spring @Configurable/@Autowired not working under Linux
type: Question
has comment: http://stackoverflow.com/comment/38497826
has comment: http://stackoverflow.com/comment/38496139
tagged with: intellij-idea
has body: I have a multi-module Maven project where I am using @Configurable and @Autowired to inject dependencies (CTW). The project have been developed on OS X and Win8, and now I am trying to get it to work with Linux (Ubuntu 14.04). Maven runs just fine but when running the application locally through IntelliJ, the autowired fields are null. I'm running Tomcat 7 but I have tried with Jetty and I get the same error. Also, @Autowired in @Component annotated classes works fine. Since the project is currently running on both OS X and Win8 using the same(?) IntelliJ configuration, it feels like I've missed something when setting up the environment. Any ideas? Example class @Configurable public class TestClass { @Autowired private MyRepository repository; ... } Application context <context:spring-configured/> <context:component-scan base-package="com.mycompany"/> <aop:aspectj-autoproxy/> aspectj-maven-plugin org.codehaus.mojo aspectj-maven-plugin ${aspectj.maven.plugin.version} org.aspectj aspectjtools ${aspectj.version} ${java.version} ${java.version} ${java.version} org.springframework spring-aspects compile test-compile AspectJ weaveInfo [INFO] Extending interface set for type 'com.mycompany.TestClass' (TestClass.java) to include 'org.springframework.beans.factory.aspectj.ConfigurableObject' (AnnotationBeanConfigurerAspect.aj) [INFO] Join point 'initialization(void org.springframework.beans.factory.aspectj.ConfigurableObject.<init>())' in Type 'com.mycompany.TestClass' (TestClass.java:15) advised by before advice from 'org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect' (spring-aspects-3.2.1.RELEASE.jar!AbstractDependencyInjectionAspect.class:78(from AbstractDependencyInjectionAspect.aj)) [with runtime test] [INFO] Join point 'initialization(void org.springframework.beans.factory.aspectj.ConfigurableObject.<init>())' in Type 'com.mycompany.TestClass' (TestClass.java:15) advised by afterReturning advice from 'org.springframework.beans.factory.aspectj.Ann…
has comment: http://stackoverflow.com/comment/38504192
has comment: http://stackoverflow.com/comment/38499668
upvote count: 1
has comment: http://stackoverflow.com/comment/38505475
has comment: http://stackoverflow.com/comment/38494723
has comment: http://stackoverflow.com/comment/38497646
favorite count: 0
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/828747
has comment: http://stackoverflow.com/comment/38498272
tagged with: maven

http://stackoverflow.com/comment/38431557
comment on: http://stackoverflow.com/q/24766184
type: Comment
type: QuestionComment
has text: No, one object per insert. You have no choice -- you cannot do a check/write without a semaphore to lock your database and block all threads on that lock from doing any work at all, and that will only work in a single jvm -- if you distribute your transactions to a cluster, for example, you're screwed. If you have multiple objects per write, they're all going to fail if one fails. One object per write means that only one fails. The thread overhead isn't as large as your locking overhead when using a check-then-write pattern.
score: 3

http://stackoverflow.com/comment/38582513
has text: this is an assignment given to me by my teacher. he is going to check it and will surely ask me this question. please answer my question how will the functions get the digital signature and i'll select your answer.
score: 0
comment on: http://stackoverflow.com/q/24847591
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38629138
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24871683
has text: Translate them to what? They are generally non-recoverable, which makes unchecked the way to go. Let them bubble up to a layer that can "handle" them (logging, notifications, etc.).
score: 3

http://stackoverflow.com/comment/38644698
has text: @jvd you can save all fields email-is, cmp-name etc. and make one string tag that will indicate that data has been submitted correctly and check it like i have given in my code.
comment on: http://stackoverflow.com/a/24879585
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24773416
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24773450
has comment: http://stackoverflow.com/comment/38442500
possible better answer: http://stackoverflow.com/a/24773624
has answer: http://stackoverflow.com/a/24773624
answer count: 3
has title: How to UnitTest a method that recieve and return a list of objects
favorite count: 0
has body: My class is as following, it receives a string and using that create an arraylist of objects. I am not sure how to test it. public class Company{ private String id; private String name; .... } public List&lt;Company&gt; retrieve(String factories) { String[] fac = factories.split(","); List&lt;Company&gt; comp; comp = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; fac.length - 1; i++) { comp.add(new Company(fac[i], fac[i])); } return comp; } JUnitTest @Test public void testRetrieve() { System.out.println("retrieve"); String factories = "a,b,c"; Transact instance = new Transact(); List&lt;Company&gt; expResult = null; //&lt;&lt;&lt;how to define this? List&lt;Company&gt; result = instance.retrieveData(factories); assertEquals(expResult, result); }
downvote count: 1
type: AnsweredQuestion
score: 3
tagged with: junit4
has answer: http://stackoverflow.com/a/24773450
tagged with: java
has answer: http://stackoverflow.com/a/24773569

http://stackoverflow.com/comment/55853605
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24792989
has text: Do note that this answer is incorrect because you can't use `truth.equals(true)`, it will not compile due to primitive types not having a `.equals()` method

http://stackoverflow.com/a/24843543
downvote count: 0
type: Answer
has body: A start would be not to divide by multiples of two. for (int i=3;i&lt;21;i++){ //begin at i = 3 i = i + 1; //count by twos if(n%2 !=0 &amp;&amp; n%i!=0) //add a condition k=1; } I imagine you could extend this logic to multiples of 3, 5, 7, 11, 13, 17, and 19, all the prime numbers between 1 and 21. Get rid of the for loop and use an else if statements to speed up the process. if (n%2 !=0) k = 1; else if (n%3 != 0) k = 1; else if (n%5 != 0) k = 1; else if (n%7 != 0) k = 1; else if (n%11 != 0) k = 1; else if (n%13 != 0) k = 1; else if (n%17 != 0) k = 1; else if (n%19 != 0) k = 1; else check = false; Hope that helps.
answers question: http://stackoverflow.com/q/24843008
score: 1
upvote count: 1

http://stackoverflow.com/a/24796061
answers question: http://stackoverflow.com/q/24795838
score: 0
type: AcceptedAnswer
type: Answer
has body: There are multiple problems in your code. You are missing the recursion. You need to return the call to isReverse in the isReverse method. You need a success termination (if both length are 0, the the strings are reverses of each others) The substrings indexes you use are not good You are inverting your strings between char comparaison and substrings You need to return false everywhere except in your stopping condition public static void main(String[] args) { String first = "abadcd"; String second = "Dcdbua"; String third = "dcdabA"; System.out.println("Should be false = " + isReverse(first, second)); System.out.println("Should be true = " + isReverse(first, third)); } public static boolean isReverse(String first, String second) { System.out.println("1=" + first + " / 2=" + second); if (first.length() != second.length()) { // If string are not of equal length, impossible to be reverses return false; } // Stopping condition if (first.length() == 0 &amp;&amp; second.length() == 0) { return true; } String check1 = "" + first.charAt(first.length() - 1); String check2 = "" + second.charAt(0); if (check1.equalsIgnoreCase(check2)) { // gets the 1st char of first and last char of 2nd to see if it matches String temp1 = first.substring(0, first.length() - 1); // shorten the string by escluding first char String temp2 = second.substring(1, second.length()); // shorten the string by last char return isReverse(temp1, temp2); } return false; // reaches here after goes through }
accepted answer of: http://stackoverflow.com/q/24795838

http://stackoverflow.com/q/24864381
accepted answer: http://stackoverflow.com/a/24865742
has title: How to restore to exact activity after coming from Paused or Resumed state in android
score: 0
answer count: 3
tagged with: android
tagged with: multithreading
has comment: http://stackoverflow.com/comment/38859584
has comment: http://stackoverflow.com/comment/38614704
has answer: http://stackoverflow.com/a/24864775
has body: I have two simple activities MainActivity and ThreadActivity. I call ThreadActivity from MainActivity. The code ofMainActivity: public class MainActivity extends Activity { private Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button)findViewById(R.id.btn2); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, ThreadActivity.class); startActivity(intent); } }); } } And the code of ThreadActivity: public class ThreadActivity extends Activity{ private Thread myThread=null; Button btn; int i = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.custom); btn = (Button)findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { runThread(); } }); } void runThread(){ myThread = new Thread() { public void run() { while (i++ &lt; 1000) { try { runOnUiThread(new Runnable() { @Override public void run() { btn.setText("#" + i); Log.d("Thread", "I am running " + i); } }); Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); return; } } } }; myThread.start(); } } When I start ThreadActivity I run a simple thread and change button text. My Problem When I loose focus from application, i.e when application becomes partially visible, and I come back I am redirected to ThreadActivity and the thread is still running. When I leave application running and open a new application, and then come back, I am again redirected to ThreadActivity. The problem is when I press back button, I am being redirected to first activity MainActivity. But instead when back button is being pressed I want my application to exit. In a few words MainActivity should not exist in the stack. I tried setting android:noHistory="true" for MainActivity but I could not keep the …
linked to: http://stackoverflow.com/q/5914040
has answer: http://stackoverflow.com/a/24865742
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24864475
type: Question
has comment: http://stackoverflow.com/comment/38614781
possible better answer: http://stackoverflow.com/a/24864475

http://stackoverflow.com/comment/38677223
has text: I tried to see if there's a difference when I use reflection. For a public inner class, `getConstructors` returns the default constructor, and `getParameterAnnotations` on that constructor returns an array of length 1, which I think reflects the implicit parameter for the enclosing instance. But for a private inner class, I couldn't get `getConstructors` to return the default constructor at all. Unless I did it wrong.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24896831

pom.xml
tags question: http://stackoverflow.com/q/24827194
tags question: http://stackoverflow.com/q/24899538
type: Tag
tag name: pom.xml
tags question: http://stackoverflow.com/q/24824103
tags question: http://stackoverflow.com/q/24798014
tags question: http://stackoverflow.com/q/24816253
tags question: http://stackoverflow.com/q/24766922
tags question: http://stackoverflow.com/q/24769861
tags question: http://stackoverflow.com/q/24764676
tags question: http://stackoverflow.com/q/24822939

http://stackoverflow.com/comment/38584764
type: Comment
has text: I tried including this library to my project and getting a lot of errors in the library related to package name.. what should i do?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24838600

http://stackoverflow.com/q/24902182
score: 0
has comment: http://stackoverflow.com/comment/38686478
has comment: http://stackoverflow.com/comment/38686755
type: UnansweredQuestion
has title: Pipe Closed Exception with BufferedWriter
has body: I am using BufferedWriter to write on the external Process. In fact I am getting the BufferedWriter from the ProcessBuilder itself. As it is a continuous process, I am giving this writer to a separate thread and writing few commands. I am not closing the writer since I require that for subsequent calls. Now it is writing perfectly for the first time but failing for every subsequent time saying Pipe Is Closed exception. Code snippet is below public SolverWriter(BufferedWriter writer, List&lt;String&gt; commands) { this.bWriter = writer; this.commands = commands; } @Override public void run() { try { for (String str : commands) { // writer.write(str.getBytes()); // writer.flush(); bWriter.write(str); } bWriter.write(RETURN); bWriter.newLine(); bWriter.flush(); // notifyAll(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Any idea how the stream is getting closed when I am not calling any close method?
has comment: http://stackoverflow.com/comment/38687145
answer count: 0
has comment: http://stackoverflow.com/comment/38686382
has comment: http://stackoverflow.com/comment/38687367
has comment: http://stackoverflow.com/comment/38686856
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38686945

http://stackoverflow.com/comment/38694482
type: Comment
comment on: http://stackoverflow.com/a/24886727
type: AnswerComment
score: 0
has text: If that is the case , Inside TestTable() , Add the JLabel and JTable inside a new JPanel and return it.

http://stackoverflow.com/a/24868861
type: Answer
has comment: http://stackoverflow.com/comment/38623720
answers question: http://stackoverflow.com/q/24868637
score: 2
upvote count: 2
has body: Binary search has to check for three cases inside the loop: the value searched for is smaller than the current center element the value searched for is larger than the current center elelemt the value is equal to the current center element (the search is finished then) Binary search should abort, when the lowerBound equals the upperBound and the position in question is not equal to the value searched for. Anyway, the position at which the search ends is the position where you want to insert the value: if the value at that position equals the value you want to insert, it doesn't matter if you insert at this position or after. If it is smaller, you want to insert after this position, if it is larger, you want to insert at this position. I won't give code, as OP clearly just asked for a hint.
has comment: http://stackoverflow.com/comment/38623646
accepted answer of: http://stackoverflow.com/q/24868637
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38623476
has comment: http://stackoverflow.com/comment/38623353

http://stackoverflow.com/q/24839794
has title: Why can we create new instances of a generic template and not of generic type in Java?
has answer: http://stackoverflow.com/a/24840657
has body: I'm aware that it's not possible to do: new T where T is a generic type due to type erasure. Why then is it okay to do something like new A&lt;T&gt; where T is generic? For example, why does the following compile? static class A&lt;T&gt;{ T t; A(T t){ this.t=t; } } static class B&lt;T&gt;{ A&lt;T&gt; create(T t){ return new A&lt;T&gt;(t); } } public static void main (String[] args) throws java.lang.Exception { A&lt;Integer&gt; a = new B&lt;Integer&gt;().create(3); }
answer count: 3
downvote count: 0
tagged with: generics
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24839831
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24839817

http://stackoverflow.com/comment/38487020
score: 0
has text: How would I check if proguard was used. I worked with a team so I am unsure.
type: Comment
comment on: http://stackoverflow.com/a/24795813
type: AnswerComment

http://stackoverflow.com/comment/38507324
has text: @brainstorm: `Map` also defines `size()` as `the number of key-value mappings in this map`. It just happens that since each key has exactly one value, that's also equal to the number of keys and the number of values.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24792985

http://stackoverflow.com/comment/38595706
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24854210
has text: It compiles for me if `constructorParams` is not there (obviously) as it was put there to indicate that parameters go here since I have not included the constructor, but I will comment it out if you insist. In addition, this is only meant to show the methods used to add tabs and is not meant as a standalone GUI application that displays tabs when you put it into a .java file and run it. Notice the `// Some GUI code...` and `// Some more GUI code...` comments
type: Comment

http://stackoverflow.com/comment/38621648
type: QuestionComment
has text: oh i think i get the point, but it would be nice if you can post the answer i really appreciate it :)
type: Comment
comment on: http://stackoverflow.com/q/24849480
score: 0

http://stackoverflow.com/q/24827209
upvote count: 1
has comment: http://stackoverflow.com/comment/38605622
has answer: http://stackoverflow.com/a/24827331
tagged with: list
tagged with: java
tagged with: set
tagged with: duplicates
type: Question
downvote count: 0
has title: How best to compare Java sets of integers?
score: 1
has comment: http://stackoverflow.com/comment/38544341
favorite count: 0
has body: While learning Java I'm using the lottery like many to sharpen my new skills. As an exercise I want to create all 13.9M 6 ball combinations for a given random seed. I've managed to generate the lines OK for a given seed but I'm not currently checking they're unique and I'm therefore getting duplicates. What I'd like advice on his what approach to take to check each generated line against the previously generated lines? I'm currently using a set to hold the 6 numbers in each line and was wondering if I should be comparing sets or if I should use a list or something else? All advice appreciated :-)
has comment: http://stackoverflow.com/comment/38544076
has answer: http://stackoverflow.com/a/73470955
answer count: 4
tagged with: integer
has answer: http://stackoverflow.com/a/24827518
has answer: http://stackoverflow.com/a/24832964
type: UnansweredQuestion

http://stackoverflow.com/a/24822762
answers question: http://stackoverflow.com/q/24822668
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: first statement in update method is matrix = rawMatrix; Because of it your both reference varible matrix and rawMatrix refer to the same oblect of List>. Because of this, Although you are adding an element using either of this variable, both result in same answer because both refer to the same object.
has comment: http://stackoverflow.com/comment/38535389

http://stackoverflow.com/a/24895215
type: Answer
upvote count: 9
has body: Load you heap Dump in Memory Analyzer (MAT). Go to Histogram and see the big size Object. Now right click on this and select Immediate dominators. It will open a dominator tree and u can identify what is holding your object. Sometimes when the big size object is local variable you will not be able to see immediate dominators in tree. It can only tell you that your variable is part of which thread.(Below image doesn't show this local variable scenario) In that case check (stack trace ) where are you getting OutOfMemoryError. Then accordingly trace it backwards and try to find out in which method are you creating big size objects as local variables. Most of the cases we get big size objects in same method which is shown in stack trace as at some point of time while allocating more memory we get OutOfMemoryError. More details.
score: 9
accepted answer of: http://stackoverflow.com/q/24888121
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24888121

http://stackoverflow.com/comment/38443910
has text: @JrChen Well, it used to not work, now it's using `String` instead
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24753865

http://stackoverflow.com/q/24809196
possible better answer: http://stackoverflow.com/a/24940141
has body: I have 2 Stateless EJBs StatelessA and StatelessB, both of them have interceptors InterceptorA and InterceptorB respectively. Also, StatelessB has Asynchronous methods. Something like this: @Stateless @Interceptors(InterceptorA.class) public class StatelessA{... @Stateless @Asynchronous @Interceptors(InterceptorB.class) public class StatelessB{... When calling a method on StatelessA, it calls several StatelessB methods and returns a value. I am trying to develop 2 interceptors to store the total time and the subtotal times of StatelessB calls, this is the objective of the interceptors. I need to do it so InterceptorA can see the detail of InterceptorB data, so I store only a value in the DB, containing the total time (of SLSB A) and the subtotal times (of SLSB B). I tried using a ThreadLocal variable (containing a list of times, something like long[]), which works fine if StatelessB is not asyncrhonous. The problem is that when it is asynchronous, the variable is not available, since it is running in a different thread (AFAIK). I also tried injecting EJBContext or using the InvocationContext, but none of them works. Can someone point me out what other alternatives do I have? Thanks in advance.
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/24918308
tagged with: ejb
has title: How to pass data from EJB Interceptor to Interceptor in Async EJB
linked to: http://stackoverflow.com/q/37430969
answer count: 3
has answer: http://stackoverflow.com/a/24814020
downvote count: 0
has answer: http://stackoverflow.com/a/24940141
tagged with: asynchronous
favorite count: 0
has answer: http://stackoverflow.com/a/24918308

http://stackoverflow.com/q/24763709
accepted answer: http://stackoverflow.com/a/24763902
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: logging
type: Question
has title: What is event sourcing and how can I implement it in Java?
tagged with: file-io
upvote count: 1
downvote count: 0
answer count: 1
has body: I have heard about the term event sourcing but I am confused about the difference between an event sourcing framework and a logging library such as Log4J. Can anyone clarify, provide a source code example and point me to the right direction in learning more about this programming topic?
has answer: http://stackoverflow.com/a/24763902

http://stackoverflow.com/comment/38468985
score: 0
type: QuestionComment
type: Comment
has text: @MarcoAcierno Time limit exceeded.
comment on: http://stackoverflow.com/q/24787245

http://stackoverflow.com/comment/77968332
comment on: http://stackoverflow.com/a/25077728
type: Comment
has text: I was thinking that I would not find this solution for the spinner any more. Congratulations and thank you.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38432914
type: Comment
type: QuestionComment
has text: Set the `marks` to `60` and you will see the problem. The `grade` variable needs to be set like `char grade = 'I';` or something similar. Then fix your if/else blocks to handle the grades (e.g. `<=` instead of `<`).
comment on: http://stackoverflow.com/q/24768253
score: 0

http://stackoverflow.com/a/24902796
upvote count: 1
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/38687423
type: Answer
has body: Be aware that Studio 0.8.3 is a canary release, and bugs are to be expected. Since updating to 0.8.3 seems to be the change that broke your build, I can only suggest that you file a bug report to the dev team and then downgrade and/or reinstall a more stable release.
answers question: http://stackoverflow.com/q/24902308
has comment: http://stackoverflow.com/comment/38687341

http://stackoverflow.com/comment/38652853
comment on: http://stackoverflow.com/q/24884733
has text: Why can't you just create a class that extends either B or C2?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38439239
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24771600
has text: To add to this answer, `setC()` should have the logic to update the value of `c`. (Perhaps it would be better named`updateC()`?)
type: AnswerComment

http://stackoverflow.com/a/24831426
answers question: http://stackoverflow.com/q/24831151
score: 1
downvote count: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38553236
has comment: http://stackoverflow.com/comment/38561188
has body: First thing dont consume the exception by doing this catch(Exception e){} Its not a good practice always print the stacktrace like the catch(Exception e){ e.printStacktrace();} now the problem in ur code is the url change it to- url = jdbc:oracle:thin:@localhost:1521:xe there is a typo in url's localhost. Edit :As you are executing the class through cmd I expect that the classes and the db.properties are in same folder try something like this try { prop.load(new FileInputStream("db.properties")); } catch (IOException e) { e.printStackTrace(); } so the full ConnectionProvider class looks something like this class ConnectionProvider { static Properties prop; static { prop = new Properties(); try { prop.load(new FileInputStream("db.properties")); } catch (IOException e) { e.printStackTrace(); } } public static Connection getConnection() throws Exception { Class.forName(prop.getProperty("driverclass")); Connection con = DriverManager.getConnection(prop.getProperty("url"), prop.getProperty("user"), prop.getProperty("password")); return con; } } Now while executing the class dont forget to include the ojdbc6.jar in your classpath.You can get it from here.

http://stackoverflow.com/q/24853435
has answer: http://stackoverflow.com/a/24853519
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
tagged with: eclipse
has body: I'm using OpenGL ES 2.0. "GLES20.GLuint test_type;" gets an error: "GLES20.GLuint cannot be resolved to a type." I need variables of this type to refer to things like framebuffers, textures, and depthbuffers.
has title: How can I declare variables to be of OpenGL's GLuint type in Eclipse for Android programs?
score: 0
tagged with: types
answer count: 1
tagged with: opengl-es

http://stackoverflow.com/comment/38640322
type: Comment
type: QuestionComment
has text: that makes no sense. Why not set your server to throttle outbound bandwidth instead? What are you actually trying to test
score: 0
comment on: http://stackoverflow.com/q/24877712

http://stackoverflow.com/q/24907530
linked to: http://stackoverflow.com/q/6481627
has comment: http://stackoverflow.com/comment/38701951
has title: java.security.InvalidKeyException: Illegal key size or default parameters in android
has answer: http://stackoverflow.com/a/24907555
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/51457785
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/51457785
has answer: http://stackoverflow.com/a/48705532
upvote count: 23
has answer: http://stackoverflow.com/a/52795417
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24907555
tagged with: java
score: 23
has answer: http://stackoverflow.com/a/46235949
type: Question
has body: I got the following error and I got a little stuck: Exception in thread "main" java.security.InvalidKeyException: Illegal key size or default parameters at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1011) at javax.crypto.Cipher.implInit(Cipher.java:786) at javax.crypto.Cipher.chooseProvider(Cipher.java:849) at javax.crypto.Cipher.init(Cipher.java:1213) at javax.crypto.Cipher.init(Cipher.java:1153) at net.nakou.indie.wtext.engineClass.Session.cryptString(Session.java:52) I'm stuck because all the answers I've found talk about the Java Cryptography Extension (JCE) which be normally included into the android SDK. So I think my problem is not this one. I must have forgotten something, but I can't find what. Maybe my code is wrong (it's my first approach of cryptography in Java, I'm not an expert, and the following code is mostly some copy-pastes of tutorials). I use this code to crypt and decrypt a String : public String cryptString(String s) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, BadPaddingException, IllegalBlockSizeException { byte[] KeyData = this.cryptKey.getBytes(); SecretKeySpec KS = new SecretKeySpec(KeyData, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish"); cipher.init(Cipher.ENCRYPT_MODE, KS); String ret = new String(cipher.doFinal(s.getBytes("UTF-8"))); return ret; } public String decryptString(byte[] s) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { byte[] KeyData = this.cryptKey.getBytes(); SecretKeySpec KS = new SecretKeySpec(KeyData, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish"); cipher.init(Cipher.DECRYPT_MODE, KS); String ret = new String(cipher.doFinal(s)); return ret; } And the following key : private String cryptKey = "qkjll5@2md3gs5Q@FDFqf"; Thank you guys.

http://stackoverflow.com/q/24802986
tagged with: android
has title: Java TimePicker does not return right value
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24803998
type: Question
has answer: http://stackoverflow.com/a/24803467
accepted answer: http://stackoverflow.com/a/24803467
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24803998
has body: In android project I have this class package mycalories.com.jalle.mycalories; import android.app.Dialog; import android.app.DialogFragment; import android.app.TimePickerDialog; import android.os.Bundle; import android.text.format.DateFormat; import android.text.format.Time; import android.widget.TimePicker; import java.util.Calendar; public class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener { public static interface OnTimeSetListener { void onTimeSet(Time time); } private OnTimeSetListener onTimeSetListener; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Calendar c = Calendar.getInstance(); int hour = c.get(Calendar.HOUR_OF_DAY); int minute = c.get(Calendar.MINUTE); return new TimePickerDialog(getActivity(), this, hour, minute, DateFormat.is24HourFormat(getActivity())); } public void onTimeSet(TimePicker view, int hourOfDay, int minute) { if (onTimeSetListener != null) { Time newTime =new Time(hourOfDay+":"+minute+ ""); onTimeSetListener.onTimeSet(newTime); } } public void setOnTimeSetListener(OnTimeSetListener onTimeSetListener) { this.onTimeSetListener = onTimeSetListener; } } that should return Time selected. And in the main activity I have button and a text field: Button btnTime = (Button) findViewById(R.id.btnTime); btnTime.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TimePickerFragment timePicker = new TimePickerFragment(); timePicker.show(getFragmentManager(), "timePicker"); timePicker.setOnTimeSetListener(new OnTimeSetListener() { @Override public void onTimeSet(Time time) { // SimpleDateFormat HHMM = new SimpleDateFormat("hh:mm"); final EditText txtTime = (EditText) findViewById(R.id.txtTime); txtTime.setText(time.toString()); } }); } }); After selecting time I should have in format hh:mm but instead I got 19700101T00000011:55(4,0,0,0,0) (obviously current time is not selected but default one) I guess that the method onTimeSetis not right. Any idea ? And o…
tagged with: timepicker

http://stackoverflow.com/a/26559477
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24898684
has body: Android Studio Works Perfectly fine with Java 1.8 or Java 8. I was also having invalid JVM error. The reason was including ";" (semicolon) at the end of JAVA_HOME path value. The correct format for path value is: C:\Program Files\Java\jdk1.8.0_xx (Replace xx with your current version) Do not include ; (semicolon) at the end of JAVA_HOME value

http://stackoverflow.com/a/24847092
score: 0
has body: The advantage of keeping the form has a product relationship is that you are able to encapsulate the different ideas of a product and form. While in your scenario just having the id is acceptable the challenge comes as the application grows and you need to represent the relationship between form and product. For example what happens when you need to persist a form and its product information? Then you will need the product to still be part of the form. Generally speaking its best to develop a clear domain model in the java code because its more flexible than just attaching ID's to different objects.
type: Answer
answers question: http://stackoverflow.com/q/24847036

http://stackoverflow.com/a/24757169
answers question: http://stackoverflow.com/q/24754363
score: 0
type: Answer
has body: The main problem with your code is that your program's logic is held in the catch block. As it seems you are not very familiar with the try-catch concept. Try block is the place where your program tries to do something that might throw an exception. It also might not. If it does however - for this you have the catch block. This is called exception handling. In case something goes wrong and the program throws an exception in the try block, the executions continues in the catch block where you might for example print out a human-readable exception and continue to do something else without the programs execution being stopped by a runtime exception. So - in your case - you do not want your program's logic to be in the catch block. Basically what happens with your code right now: File is being read in (in the try block) No exception is throw - thus the execution continues at the place where you have the comment (// print employee number and worked hours). The array named total is empty - by default Java int[] array is intialized with 0's. What you want to do is to put your logic in the try block, so that the execution after reading in the file, continues with the manipulation of the data read in. More info on try-catch: http://docs.oracle.com/javase/tutorial/essential/exceptions/try.html http://docs.oracle.com/javase/tutorial/essential/exceptions/catch.html Just so you know - you will get an InputMismatchException when you do only the aforementioned because the file contains a 10 on the first line. I assume that this is the number of the cases that will follow - maybe it would be a good idea to initialize your array sizes with this value (just before entering the while loop).

http://stackoverflow.com/comment/38585483
type: QuestionComment
type: Comment
score: 1
has text: Note that clarity in your post would have saved you from asking, essentially, the same question twice. I commented on your last post about using a RelativeLayout.
comment on: http://stackoverflow.com/q/24849118

http://stackoverflow.com/a/24829917
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38549368
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/38549428
accepted answer of: http://stackoverflow.com/q/24829212
has body: I think you are super estimating AWS api complexity, interface and SDK are quite simple and straightforward to implement. I suggest you starting by downloading SDK of course and than take a look some samples and the Getting Started. You also can find everything you would need at AWS Documentation. For testing and practicing I suggest you create an account and use the Free Tier, it is more than enough for learning and costs nothing =].
answers question: http://stackoverflow.com/q/24829212

http://stackoverflow.com/q/24862410
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38645682
tagged with: spring
answer count: 0
score: 1
tagged with: java
has title: Neo4j and Spring - How to save autowired properties
type: Question
has body: I cannot save autowired properties when using Spring components with Neo4j. I have defined an abstract entity class which includes the graph id: @NodeEntity public abstract class DBEntity { @GraphId private Long id; } There is a data model with a parent and a child both defined as Spring components. I have simplified the data model here, in reality it is a tree with several child nodes and levels: @Component("DataModel") @Scope("prototype") public class DataModel extends DBEntity { @Autowired private DataStructure dataStructure; public TestDataStructure testDataStructure; } @Component("DataStructure") @Scope("prototype") public class DataStructure extends DBEntity { ... } For testing purposes, I have also defined a test data structure without Spring annotations: public class TestDataStructure extends DBEntity { private String test; public TestDataStructure() { this.test = "test"; } } Here is also the definition of my repository and the database service implementation: @Repository public interface DataModelRepository extends GraphRepository&lt;DBEntity&gt; { DBEntity save(DBEntity entity); } public class DatabaseServiceImpl implements DatabaseService { @Autowired private DataModelRepository modelRepository; public void putModel(DBEntity entity) { modelRepository.save(Entity); } } Now, when I call putModel with an Spring-managed instance of DataModel, it will save the DataModel instance and also an instance of TestDataStructure as nodes with 1:1 relationship. The instance of DataStructure and the relationship to the instance of DataModel will not be saved, although it is not null in the program. How can I achieve to save the whole DataModel? Probably Spring interferes with the Neo4j mapping. I am not sure, why autowired properties might get lost in the cloning process or whatever Neo4j uses to get the data. Maybe someone can shed some light on this?
upvote count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
tagged with: spring-data-neo4j

http://stackoverflow.com/comment/38679430
score: 0
comment on: http://stackoverflow.com/q/24897183
has text: Yes, but that was JPA 1 and Hibernate 3.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24881551
has comment: http://stackoverflow.com/comment/38648653
tagged with: java
type: Question
has body: Tomcat works with unpackWAR=true: &lt;Host name="localhost" appBase="webapps" unpackWARs="false" autoDeploy="false" deployOnStartup="true" &gt; Context configured with: $ cat .$CATALINA_HOME/conf/app/localhost/ROOT.xml &lt;Context docBase="${app.app}/app-web-${app.version}.war" reloadable="true" /&gt; But we need to call some classes, which included inside this war. Previously, when we make war-unpack, we call it with: encryptpwd () { $JRE_HOME/bin/java -classpath "$CATALINA_HOME/webapps/ROOT/WEB-INF/lib/*" com.***.Encryptor "$1" } function in bash script. How I can run this class from inside war-file?
tagged with: tomcat
score: 0
tagged with: bash
has title: Run class from unpacked .war?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38647782

http://stackoverflow.com/q/24766147
score: 6
upvote count: 6
has body: I have a testng suite of test classes that I am running via a testng.xml file. This works fine. All tests are run serially, so no parallel-execution hurdles. My goal now is to take state that was generated by the test methods in one test class (e.g., a customerId primary key value generated by a database insert) and pass it along to another test class, so that the test methods in that second class can take further action based on that shared state (e.g., look up the just-inserted customer using the customerId value from the first class). It's easy to share state between test methods in a single class, of course, via class member variables, but I don't see how to share it across test classes.
tagged with: testng
type: AnsweredQuestion
tagged with: java
has title: TestNG - sharing state between test classes
possible better answer: http://stackoverflow.com/a/38792029
has answer: http://stackoverflow.com/a/38792029
type: Question
has answer: http://stackoverflow.com/a/54681845
has answer: http://stackoverflow.com/a/24766349
downvote count: 0
has answer: http://stackoverflow.com/a/75976490
has answer: http://stackoverflow.com/a/49385709
favorite count: 0
accepted answer: http://stackoverflow.com/a/24766349
answer count: 5

http://stackoverflow.com/comment/38633892
comment on: http://stackoverflow.com/a/24832315
has text: Hi SiKing, I know I can get the text by using the getText method, but the test case specifies the text must be selected and then copied to another textarea
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24837562
has comment: http://stackoverflow.com/comment/38563452
accepted answer: http://stackoverflow.com/a/24837642
type: Question
type: AnsweredQuestion
has body: My AI code for a computer player is not working as expected. I want it to play a random move, but block an opponent's incoming winning turn. However, it sometimes stops working altogether, and other times plays a specific move even though there is no incoming win combo. My computer AI code is below. public void compturn() { count++ ; if(count == 1||count == 3 || count == 5 || count == 7 || count == 9 || count == 11) { letter = "O" ; } else if ( count == 2 || count == 4 || count == 6 || count == 8 || count == 10) { letter = "X" ; } if (b1.getText() == b2.getText() &amp;&amp; b2.getText() != "" &amp;&amp; b3.getText() == "") { b3.setText(letter); b3bool = false ; } else if (b4.getText() == b5.getText() &amp;&amp; b6.getText() == "") { b6.setText(letter); b6bool = false ; } else if (b7.getText() == b8.getText() &amp;&amp; b9.getText() == "") { b9.setText(letter); b9bool = false ; } else if (b1.getText() == b4.getText() &amp;&amp; b4.getText() != "" &amp;&amp; b7.getText() == "") { b7.setText(letter); b7bool = false ; } else if (b2.getText() == b5.getText() &amp;&amp; b8.getText() == "") { b8.setText(letter); b8bool = false ; } else if (b3.getText() == b6.getText() &amp;&amp; b9.getText() == "") { b9.setText(letter); b9bool = false ; } else if (b1.getText() == b5.getText() &amp;&amp; b5.getText() != "" &amp;&amp; b9.getText() == "") { b9.setText(letter) ; b9bool = false ; } else if (b3.getText() == b5.getText() &amp;&amp; b7.getText() == "") { b7.setText(letter); b7bool = false ; } else { randomMove(); } } public void randomMove() { int randomnum = (int)(Math.random() * 10); if(randomnum == 1 ) { if(b1.getText().equals("X") || b1.getText().equals("O")) { randomMove(); } else { b1.setText(letter); } } if(randomnum == 2 ) { if(b2.getText().equals("X") || b2.getText().equals("O")) { randomMove(); } else { b2.setText(letter); } } if(randomnum == 3 ) { if(b3.getText().equals("X") || b3.getText().equals("O")) { randomMove(); } else { b3.setText(letter); } } if(randomnum == 4 …
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/38563365
has comment: http://stackoverflow.com/comment/38563712
answer count: 1
has title: Java Tic Tac Toe AI not working
favorite count: 0
has comment: http://stackoverflow.com/comment/38563420
has answer: http://stackoverflow.com/a/24837642
score: -2
tagged with: artificial-intelligence
upvote count: 1
tagged with: tic-tac-toe

http://stackoverflow.com/a/48019359
downvote count: 0
has body: List&lt;String&gt; list = Arrays.asList("One", "Two", "Three"); list.stream() .reduce("", org.apache.commons.lang3.StringUtils::join); Or List&lt;String&gt; list = Arrays.asList("One", "Two", "Three"); list.stream() .reduce("", (s1,s2)-&gt;s1+s2); This approach allows you also build a string result from a list of objects Example List&lt;Wrapper&gt; list = Arrays.asList(w1, w2, w2); list.stream() .map(w-&gt;w.getStringValue) .reduce("", org.apache.commons.lang3.StringUtils::join); Here the reduce function allows you to have some initial value to which you want to append new string Example: List&lt;String&gt; errors = Arrays.asList("er1", "er2", "er3"); list.stream() .reduce("Found next errors:", (s1,s2)-&gt;s1+s2);
type: Answer
answers question: http://stackoverflow.com/q/24882927
score: 2
upvote count: 2

imap
tags question: http://stackoverflow.com/q/24849807
tag name: imap
type: Tag
tags question: http://stackoverflow.com/q/24888072

http://stackoverflow.com/a/24894803
answers question: http://stackoverflow.com/q/24888014
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: Which option you should choose depents on your model. Do you have/need a collection of orders in the Customer? Then you have to add the object anyway and you should choose (2). Take care of proper fetch configuration or otherwise Hibernate will load the whole collection even if you don't need it. For that case take a look at Hibernate - How to persist a new item in a Collection without loading the entire Collection. If you don't have a collection in Customer then use option (1). (2) is often shown in tutorials to show the capabilities of Hibernate/ORMs in general. It's also more object oriented but I would recomment to create a method Customer.addOrder() or even Customer.creatOrder() instead od directly manipulating the collection from outside.
has comment: http://stackoverflow.com/comment/38901431

http://stackoverflow.com/q/24777689
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38450571
has body: I am trying to fetch data from a site using the following code import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class test { public static void main(String[] args) throws IOException { Document d=Jsoup.connect("some site URL") .userAgent("Mozilla/5.0 (X11; CrOS i686 3912.101.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36").timeout(100000).get(); Elements e = d.select("span[class=lrg bold]"); for (Element element : e) { System.out.println("aaaaaaaa"+element.text()); } } } This way i want to get price information from a site. but the problem is Price for one product has two rules. sometimes price available in &lt;del class="grey"&gt; or else price is available is &lt;span class="bld lrg red"&gt;. If the price is available in both rules i want to take just the first one. If the first one is not available then i want the price value from second one. how can i give condition in element.
has title: fetching data from a site using jsoup
type: Question
tagged with: java
score: 0
tagged with: jsoup
tagged with: xml-parsing
has answer: http://stackoverflow.com/a/24777996
answer count: 1
has comment: http://stackoverflow.com/comment/38450437
type: UnansweredQuestion

http://stackoverflow.com/a/24808634
has comment: http://stackoverflow.com/comment/38510022
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/38509024
answers question: http://stackoverflow.com/q/24808314
has comment: http://stackoverflow.com/comment/38510073
upvote count: 3
has comment: http://stackoverflow.com/comment/38509866
type: Answer
has body: View refers to android.view.View and it's the superclass for all views. By itself it doesn't draw anything but is often used as a spacer. view refers to any View and the specific class is given in the class attribute, class="com.example.customui2.MainActivity$ArticleFragment$MyButton" in your case. You could also have written it as &lt;com.example.customui2.MainActivity.ArticleFragment.MyButton ... (though with the link Mike M. posted in the comments I'm not 100% certain it really works with inner classes like this and I don't have a development environment right here to try it out)

http://stackoverflow.com/comment/38446995
type: Comment
has text: Please avoid multiple question and exclamation signs especially when asking trivial questions.
score: 1
comment on: http://stackoverflow.com/q/24775661
type: QuestionComment

http://stackoverflow.com/comment/38452136
comment on: http://stackoverflow.com/q/24757014
has text: How do you determine which of the methods is called? Through calls to System.out in the method bodies?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38455729
type: QuestionComment
type: Comment
has text: Having the same counter variable for both cases is that an option?
comment on: http://stackoverflow.com/q/24780521
score: 0

http://stackoverflow.com/comment/89471715
type: Comment
has text: @mohituprim , I edited the post because that value was wrong. Even if it is a palindrome 100001 cannot be written as 2 3-digit number product. Instead you can use 110011 as a correct starting value. Unfortunately, I don't have a rule that could work for all combinations, so using a negative value / 100*100 is applicable for all situations, even if it's slower.
comment on: http://stackoverflow.com/a/26834494
type: AnswerComment
score: 0

http://stackoverflow.com/q/24761658
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38428272
has title: Trilateration Method Android Java
type: Question
has body: I have a little problem... Does anyone knows about how can i implement this? I need a method in java like this: public /*COORDINATE OBJECT*/ getTrilaterationPointBetween( /*COORDINATE OBJECT*/ coordinate1, double distance1, /*COORDINATE OBJECT*/ coordinate2, double distance2, /*COORDINATE OBJECT*/ coordinate3, double distance3){ //MAGIC return /*COORDINATE OBJECT*/; } In practice this method will receive 3 coordinates and the distance between "myLocation" with one of them... I need the algorithm of the Trilateration!! I did some searches and made some tests and the results are driving me into the middle of the pacific!! About the OBJECT, is really simple, have 2 variables representing Latitude and Longitude. I have tried this method: static double[] MyTrilateration(Ponto ponto1, double dist1, Ponto ponto2, double dist2, Ponto ponto3, double dist3) { double[] tmpWAP1 = new double[3]; double[] tmpWAP2 = new double[3]; double[] tmpWAP3 = new double[3]; double tmpLat2, tmpLong2, tmpLat3, tmpLong3; double tmpSlide, deg; double MyLat, MyLong; double[] MyLocation = new double[2]; tmpLat2 = ponto2.getX() - ponto1.getX(); tmpLong2 = ponto2.getY() - ponto1.getY(); tmpLat3 = ponto3.getX() - ponto1.getX(); tmpLong3 = ponto3.getY() - ponto1.getY(); tmpSlide = Math.sqrt(Math.pow(tmpLat2,2)+Math.pow(tmpLong2,2)); deg = (180/Math.PI)*Math.acos( Math.abs(tmpLat2)/Math.abs(tmpSlide)); if( (tmpLat2&gt;0 &amp;&amp; tmpLong2&gt;0) ) { deg = 360 - deg; } else if( (tmpLat2&lt;0 &amp;&amp; tmpLong2&gt;0) ) { deg = 180 + deg; } else if( (tmpLat2&lt;0 &amp;&amp; tmpLong2&lt;0)){ deg = 180 - deg; } else if( (tmpLat2&gt;0 &amp;&amp; tmpLong2&lt;0)) { deg = deg; } tmpWAP1[0] = 0.0; tmpWAP1[1] = 0.0; tmpWAP1[2] = dist1; tmpWAP2 = myRotation(tmpLat2, tmpLong2, dist2, deg); tmpWAP3 = myRotation(tmpLat3, tmpLong3, dist3, deg); MyLat = (Math.pow(tmpWAP1[2],2)-Math.pow(tmpWAP2[2],2)+Math.pow(tmpWAP2[0],2))/(2*tmpWAP2[0]); MyLong = (Math.pow(tmpWAP1[2],2)-Math.pow(tmpWAP3[2],2)-Math.pow(MyLat,2) +Math…
linked to: http://stackoverflow.com/q/16176656
has comment: http://stackoverflow.com/comment/38424163
has comment: http://stackoverflow.com/comment/38420806
upvote count: 2
tagged with: location
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: trilateration
has answer: http://stackoverflow.com/a/24789565
score: 2

http://stackoverflow.com/q/24835669
has title: Java While Loop Not Executing
has answer: http://stackoverflow.com/a/24835725
accepted answer: http://stackoverflow.com/a/24835725
possible better answer: http://stackoverflow.com/a/24835734
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38560095
has comment: http://stackoverflow.com/comment/38560128
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24835734
score: 0
has body: I am attempting to build a simple program, and the first part of my program will not work correctly. Could someone please check my code and tell me why the while loop will not execute and generate a proper random number? Thank you in advance.
answer count: 2
tagged with: char
tagged with: random
has comment: http://stackoverflow.com/comment/38560153
tagged with: while-loop
has comment: http://stackoverflow.com/comment/38560134
has comment: http://stackoverflow.com/comment/38560120

http://stackoverflow.com/comment/38521688
has text: Great answer, thanks, and mighty quick at that! What I don't get though is why my half-baked solution does work for some but not all of the metacharacters... (Note to myself: Need to understand non-capturing groups).
type: AnswerComment
comment on: http://stackoverflow.com/a/24815180
score: 0
type: Comment

http://stackoverflow.com/comment/38562478
type: AnswerComment
has text: how can i get statement_1 and statement_2 separately ??
type: Comment
comment on: http://stackoverflow.com/a/24836746
score: 0

http://stackoverflow.com/q/24895489
has answer: http://stackoverflow.com/a/24895917
tagged with: java
has body: class Hello12 { static int b = 10; static { b = 100; } } class sample { public static void main(String args[]) { System.out.println(Hello12.b); } } On running above code the output comes as 100 because when I called Hello class, static block is executed first setting the value of b to 100 and displaying it. But when i write this code: class Hello12 { static { b = 100; } static int b = 10; } class sample { public static void main(String args[]) { System.out.println(Hello12.b); } } Here the output comes as 10. I am expecting answer as 100 because once the static block is executed it gave b the value as 100. so when in main(), I called Hello.b it should have referred to b (=100). How is the memory allocated to b in both the codes?
accepted answer: http://stackoverflow.com/a/24895554
has answer: http://stackoverflow.com/a/24895555
downvote count: 0
score: 28
favorite count: 0
tagged with: static
upvote count: 28
has answer: http://stackoverflow.com/a/24895560
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24895560
has answer: http://stackoverflow.com/a/24895554
type: Question
has title: Java classes and static blocks

http://stackoverflow.com/comment/129262178
type: Comment
score: 0
type: AnswerComment
has text: Dear all, are we able to use provided scope for sap jco connector? if yes is there any example? Thanks in advance
comment on: http://stackoverflow.com/a/57758811

http://stackoverflow.com/q/24833973
type: Question
tagged with: wiki-markup
tagged with: http://stackoverflow.com/tag/xhtml
upvote count: 1
has answer: http://stackoverflow.com/a/27191597
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: confluence
downvote count: 0
score: 1
tagged with: java
has title: WikiToXhtmlMigrator in Confluence
has body: I have been trying to use this class from tha JAVA API (https://docs.atlassian.com/atlassian-confluence/5.3.1/index.html?com/atlassian/confluence/), but I'm struggling because of the lack f proper documentation. My aim is to convert from a wiki markup format to the xhtml that Confluence uses: Here is my code till now: package org.myorg; import java.util.List; import java.util.ArrayList; import java.io.BufferedReader; import java.io.FileReader; import com.atlassian.renderer.RenderContext; import com.atlassian.confluence.content.render.xhtml.migration.WikiToXhtmlMigrator; import com.atlassian.confluence.content.render.xhtml.ConversionContext; import com.atlassian.confluence.content.render.xhtml.DefaultConversionContext; import com.atlassian.confluence.content.render.xhtml.storage.pagelayouts.StoragePageLayoutMarshaller; import com.atlassian.confluence.xhtml.api.MacroDefinition; import com.atlassian.confluence.content.render.xhtml.storage.macro.*; import com.atlassian.renderer.RendererConfiguration; import com.atlassian.renderer.links.LinkRenderer; import com.atlassian.renderer.v2.V2LinkRenderer; import com.atlassian.renderer.embedded.EmbeddedResourceRenderer; import com.atlassian.renderer.embedded.DefaultEmbeddedResourceRenderer; import com.atlassian.confluence.content.render.xhtml.migration.ErrorReportingV2Renderer; import com.atlassian.renderer.v2.V2Renderer; import com.atlassian.confluence.content.render.xhtml.storage.macro.StorageMacroV2Marshaller; import com.atlassian.renderer.v2.components.RendererComponent; public class Wiki2xhtml { public static class Rend implements RendererConfiguration { public String getCharacterEncoding() { return new String("UTF-8"); //Will return the character encoding for the current application. } public String getWebAppContextPath() { return ""; //Returns the context path of the running web application. } public boolean isAllowCamelCase() { return true; //If this method returns true then camelCase links will be allowed and generated.…

http://stackoverflow.com/comment/38451468
score: 0
type: Comment
type: QuestionComment
has text: @Zmavus the internals of `HashMap` can be fine-tuned with the load-factor. With this you can balance between memory requirement and speed.
comment on: http://stackoverflow.com/q/24778264

http://stackoverflow.com/comment/38609749
has text: @PabloFranciscoPérezHidalgo I would also upvote your answer, but I can't due to low reputation :-/ Thanks anyway!
comment on: http://stackoverflow.com/a/24860879
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24898684
has answer: http://stackoverflow.com/a/27241404
tagged with: android
has answer: http://stackoverflow.com/a/26559477
has body: I'm having issues trying to boot-up Android Studio When I try to launch it after installation I'm getting this error: No JVM Installation found. Please install a 64 bit JDK. My current system specification: Operating System: Windows 8.0 64 bit version JDK installed: JDK 1.8.0 What I have tried: I have tried what was reported in the error, and also in most of the solutions to set the JDK_HOME variable in environment variables to my JDK path (64 bit version) i.e. C:\Program Files\Java\jdk1.8.0_05 *I also have tried rebooting system, just in case to test if the environment variable is not working without a restart I have seen these solutions and tried but none of them works, so don't mark it as a duplicate of any of these: Android Studio installation on Windows 7 fails, no JDK found With android studio no jvm found, JAVA_HOME has been set Android Studio start fails on Windows 8 64bit Android Studio does not launch after installation Here is the cmd output for java version:
has answer: http://stackoverflow.com/a/25072904
has comment: http://stackoverflow.com/comment/38807758
has comment: http://stackoverflow.com/comment/38683372
linked to: http://stackoverflow.com/q/16574189
has answer: http://stackoverflow.com/a/31157815
favorite count: 0
has answer: http://stackoverflow.com/a/25054118
has answer: http://stackoverflow.com/a/24966609
tagged with: android-studio
has answer: http://stackoverflow.com/a/28391391
has answer: http://stackoverflow.com/a/32537511
linked to: http://stackoverflow.com/q/20033231
has answer: http://stackoverflow.com/a/27675089
has comment: http://stackoverflow.com/comment/52892340
has answer: http://stackoverflow.com/a/37495307
accepted answer: http://stackoverflow.com/a/25054118
has comment: http://stackoverflow.com/comment/38679770
has answer: http://stackoverflow.com/a/27576779
has answer: http://stackoverflow.com/a/75178884
has answer: http://stackoverflow.com/a/27526867
has answer: http://stackoverflow.com/a/25027037
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25386926
has answer: http://stackoverflow.com/a/28076192
has answer: http://stackoverflow.com/a/47850945
has comment: http://stackoverflow.com/comment/117616039
score: 91
has answer: http://stackoverflow.com/a/27846328
has answer: http://stackoverflow.com/a/27602108
linked to: http://stackoverflow.com/q/23318109
tagged with: java
has comment: http://stackoverflow.com/comment/38679830
upvote count: 91
has answer: http://stackoverflow.com/a/36911509
has answer: http://stackoverflow.com/a/27914068
possible better answer: http://stackoverflow.com/a/25027037
linked to: http://stackoverflow.com/q/38113200
type: Question
has comment: http://stackoverflow.com/comment/57875296
has answer: http://stackoverflow.com/a/37847245
has answer: http://stackoverflow.com/a/52008486
has answer: http://stackoverflow.com/a/50924551
linked to: http://stackoverflow.com/q/2062020
has answer: http://stackoverflow.com/a/26472377
has title: Android Studio - No JVM Installation found
has answer: http://stackoverflow.com/a/27090318
downvote count: 0
linked to: http://stackoverflow.com/q/16596520
has answer: http://stackoverflow.com/a/25007422
has answer: http://stackoverflow.com/a/56976796
tagged with: jvm
has answer: http://stackoverflow.com/a/30988392
answer count: 31
has comment: http://stackoverflow.com/comment/38829479
linked to: http://stackoverflow.com/q/16574544
has comment: http://stackoverflow.com/comment/38826265
has answer: http://stackoverflow.com/a/26790440
has answer: http://stackoverflow.com/a/34647693

http://stackoverflow.com/comment/38829463
type: Comment
type: QuestionComment
has text: i had like to thank all of you who had commented on this code,i had solve the issue, this is a school project and i felt it not to show all the code, even if i had like to it will be enormous,so i took to MCVE,run the code and it work just i had wish, then i went back to project, i created 3 Jpanel, one as the container for the rest two, give the first JPanel a borderlayout and the rest two the gridlayout manager, sort the giving data into two groups and added each group to the two remaining panel, then i got it done just like i wanted. thanks to MadProgrammer , Andrew thompson and peeskillet
comment on: http://stackoverflow.com/q/24848606
score: 0

http://stackoverflow.com/comment/38407991
has text: @SatishCh i have updated answer. Please check. This sorts in order ISE_BASE,ISE,ISE_ADVANCED.
comment on: http://stackoverflow.com/a/24753385
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24903881
tagged with: spring
has comment: http://stackoverflow.com/comment/38692368
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38690545
tagged with: kerberos
linked to: http://stackoverflow.com/q/2973355
score: 2
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/38690421
duplicate of: http://stackoverflow.com/q/2973355
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38689530
has title: Kerberos/SPNEGO authorization
tagged with: spnego
linked to: http://stackoverflow.com/q/17705727
upvote count: 2
has comment: http://stackoverflow.com/comment/38689950
has body: I'm trying configure Spring Kerberos/SPNEGO Aauth for Active Directory and I am getting this error 08:43:29,951 DEBUG SpnegoAuthenticationProcessingFilter:109 - Received Negotiate Header for request http://servername:8001/Web/index.jsp: Negotiate [binary]:43:29,951 DEBUG ProviderManager:124 - Authentication attempt using org.springframework.security.extensions.kerberos.KerberosServiceAuthenticationProvider 08:43:29,952 DEBUG KerberosServiceAuthenticationProvider:85 - Try to validate Kerberos Token 08:43:29,954 WARN SpnegoAuthenticationProcessingFilter:122 - Negotiate Header was invalid: Negotiate [binary] org.springframework.security.authentication.BadCredentialsException: Kerberos validation not succesfull at org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator.validateTicket(SunJaasKerberosTicketValidator.java:65) at org.springframework.security.extensions.kerberos.KerberosServiceAuthenticationProvider.authenticate(KerberosServiceAuthenticationProvider.java:86) at org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:127) at org.springframework.security.authentication.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49) at org.springframework.security.extensions.kerberos.web.SpnegoAuthenticationProcessingFilter.doFilter(SpnegoAuthenticationProcessingFilter.java:118) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) at org.springframework.security.web.FilterChainProxy.doF…

http://stackoverflow.com/comment/38452080
has text: B y1 = new B(10); B z2 = new B(10); System.out.println(z2.f((A)y1));
type: Comment
comment on: http://stackoverflow.com/a/24778520
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38672375
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24890697
has text: @TomBlodget Thats a good point, I'll try to be a little more verbose on why its still a bad idea.

http://stackoverflow.com/a/24860682
has comment: http://stackoverflow.com/comment/38607855
has body: You redefine your list every time in the loop. Change your code from JSONArray jArray = new JSONArray(response); if (jArray != null) { for (int i = 0; i &lt; jArray.length(); i++) { try { searchResult = new ArrayList&lt;Message&gt;(); To JSONArray jArray = new JSONArray(response); if (jArray != null) { searchResult = new ArrayList&lt;Message&gt;(); for (int i = 0; i &lt; jArray.length(); i++) { try {
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24860613
type: Answer
answers question: http://stackoverflow.com/q/24860613
upvote count: 3
has comment: http://stackoverflow.com/comment/38608124

http://stackoverflow.com/comment/38539474
comment on: http://stackoverflow.com/a/24824784
score: 0
type: Comment
has text: If you are using the builder tool, see the link above. Instead of adding panels from the palette, just add your panel classes, and give each panel a name. When the menu is pressed, show the corresponding panel
type: AnswerComment

http://stackoverflow.com/q/24845071
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/38577445
tagged with: string
has comment: http://stackoverflow.com/comment/38577406
favorite count: 0
has comment: http://stackoverflow.com/comment/38577514
upvote count: 2
accepted answer: http://stackoverflow.com/a/24845208
has comment: http://stackoverflow.com/comment/38577512
has title: null pointer exception in java .
has answer: http://stackoverflow.com/a/24845359
score: 2
type: AnsweredQuestion
tagged with: java
has body: Getting NullPointerException when it tries to access stones[0].length. Please Help. I have already Initialized Stones Object. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Solution { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Scanner sc = new Scanner(System.in); int times = sc.nextInt(); String stones[] = new String[times]; int score = 0; int counter; for(int tcase = 0; tcase &lt; times; tcase++) stones[tcase] = br.readLine(); int s = stones[0].length(); for (int i = 0; i &lt; s ; i++) { char j = stones[0].charAt(i); counter = 0; for (int k = 1; k &lt; times; k++) { char aa[] = stones[k].toCharArray(); for (int l = 0; l &lt;aa.length ; l++) { if(aa[l]==j) { counter++; break; } } if (counter==times-1) { score++; } } } System.out.println(score); } } Getting NullPointerException when I try to access stones[0].length(). Please help
has comment: http://stackoverflow.com/comment/38577575
type: Question
has comment: http://stackoverflow.com/comment/38577503
linked to: http://stackoverflow.com/q/218384
possible better answer: http://stackoverflow.com/a/24845383
has answer: http://stackoverflow.com/a/24845383
downvote count: 0
has answer: http://stackoverflow.com/a/24845208
has comment: http://stackoverflow.com/comment/38577653

http://stackoverflow.com/a/24749965
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24749894
has comment: http://stackoverflow.com/comment/38398778
answers question: http://stackoverflow.com/q/24749894
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38398726
has comment: http://stackoverflow.com/comment/38399114
has comment: http://stackoverflow.com/comment/38414251
has body: I use Smack API. You can read here for more information on how to use this API.

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/24865329

http://stackoverflow.com/comment/119622818
type: Comment
score: 1
has text: This messes up the URL if there are more than one query parameters and the first one is "language". In this case, the "?" is removed, so the query parameters are no longer treated as query parameters, but instead as part of the URL path.
type: AnswerComment
comment on: http://stackoverflow.com/a/24780153

http://stackoverflow.com/comment/38663143
has text: No is not any kind of proxy.
score: 0
comment on: http://stackoverflow.com/q/24889081
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38516728
type: AnswerComment
type: Comment
has text: IF you are clear then you should accept and/or upvote answers
comment on: http://stackoverflow.com/a/24812459
score: 1

http://stackoverflow.com/q/24866472
has comment: http://stackoverflow.com/comment/38619249
has comment: http://stackoverflow.com/comment/38619473
has comment: http://stackoverflow.com/comment/38620104
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/38619066
has comment: http://stackoverflow.com/comment/38619830
tagged with: java
tagged with: jpanel
has body: I'm trying to clear everything in my JPanel in an easier way than hard coding it all. I have a for loop which works great for JTextFields but nothing else. The commented out block makes everything work but I wanted to see if I could add the JPanels contained within on the fly as well. List&lt;Component&gt; controls = new ArrayList&lt;&gt;(); controls.addAll(Arrays.asList(this.getComponents())); /*controls.addAll(Arrays.asList(jPanel1.getComponents())); controls.addAll(Arrays.asList(jPanel2.getComponents())); controls.addAll(Arrays.asList(jPanel3.getComponents())); controls.addAll(Arrays.asList(jPanel4.getComponents())); controls.addAll(Arrays.asList(jPanel5.getComponents())); controls.addAll(Arrays.asList(jPanel6.getComponents())); controls.addAll(Arrays.asList(jPanel7.getComponents())); controls.addAll(Arrays.asList(jPanel8.getComponents())); controls.addAll(Arrays.asList(jPanel9.getComponents())); controls.addAll(Arrays.asList(jPanel10.getComponents())); controls.addAll(Arrays.asList(jPanel11.getComponents())); controls.addAll(Arrays.asList(jPanel12.getComponents())); controls.addAll(Arrays.asList(jPanel13.getComponents()));*/ for(Component control : controls) { if(control instanceof JTextField) { System.out.println(control.toString()); JTextField ctrl = (JTextField) control; ctrl.setText(""); } else if (control instanceof JList) { System.out.println(control.toString()); JList list = (JList) control; for (int i = 0; i &lt; list.getModel().getSize(); i++) { list.remove(i); } } else if (control instanceof JTable) { System.out.println(control.toString()); JTable table = (JTable) control; for (int i=0;i &lt; table.getRowCount();i++) { table.getModel().setValueAt("", i, 0); } for (int i=0;i &lt; table.getColumnCount();i++) { table.getModel().setValueAt("", 0, i); } } else if (control instanceof JRadioButton) { System.out.println(control.toString()); JRadioButton radio = (JRadioButton) control; radio.setSelected(false); } else if (control instanceof JPanel) { JPanel pan…
linked to: http://stackoverflow.com/q/993025
type: Question
has title: Java Clearing Components in JPanel Issue

http://stackoverflow.com/a/24819146
upvote count: 3
has body: The likely cause is going to be the location of the image. From you code example, the image "seems" to be an embedded resource. These resources can't be accessed like normal files on the file system. Instead of Image image = toolkit.getImage("pencil.gif"); Try using... Image image = toolkit.getImage(getClass().getResource("pencil.gif")); assuming the image resides within the same location as the class file or Image image = toolkit.getImage(getClass().getResource("/pencil.gif")); if the image resides somewhere else (this example demonstrates the image located in the default package).
has comment: http://stackoverflow.com/comment/38531997
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24818948
score: 3
accepted answer of: http://stackoverflow.com/q/24818948

http://stackoverflow.com/q/24902387
score: 0
accepted answer: http://stackoverflow.com/a/24902885
possible better answer: http://stackoverflow.com/a/39468083
has answer: http://stackoverflow.com/a/39468083
has body: i need to probe a static method. but the method invocation could not be probed. can anybody offer some help? my java code: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CaseObject.java package test; public class CaseObject{ private static int sleepTotalTime=0; public boolean execute(int sleepTime) throws Exception{ System.out.println("sleep: "+sleepTime); sleepTotalTime+=sleepTime; Thread.sleep(sleepTime); return true; } public static boolean execute2(int sleepTime) throws Exception{ System.out.println("sleep: "+sleepTime); sleepTotalTime+=sleepTime; Thread.sleep(sleepTime); return true; } } // Case2.java package test; import java.util.Random; public class Case2 { public static void main(String[] args) throws Exception { Random random = new Random(); boolean result = true; while (result) { result = CaseObject.execute2(random.nextInt(1000)); Thread.sleep(1000); } } } my btrace script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // TraceMethodArgsAndReturn2.java import static com.sun.btrace.BTraceUtils.*; import com.sun.btrace.annotations.*; @BTrace public class TraceMethodArgsAndReturn2{ @OnMethod( clazz="test.CaseObject", method="execute2", location=@Location(Kind.RETURN) ) public static void traceExecute(@Self test.CaseObject instance,int sleepTime,@Return boolean result){ println("call CaseObject.execute2"); println(strcat("sleepTime is:",str(sleepTime))); println(strcat("sleepTotalTime is:",str(get(field("test.CaseObject","sleepTotalTime"),instance)))); println(strcat("return value is:",str(result))); } } and i run it like this ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./btrace/bin/btrace -cp /tmp/a/target/classes/ 8477 ./btrace/TraceMethodArgsAndReturn2.java
type: AnsweredQuestion
has title: how to use btrace probe static method?
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24902885
tagged with: btrace

http://stackoverflow.com/comment/38570191
has text: @Zach I have already given +1 for your answer. :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24841177

http://stackoverflow.com/comment/38577013
type: Comment
has text: @PeterLawrey I wasn't arguing against making the field volatile, I was just clarifying on why writing to the console helps :) I don't consider it to be a side effect. Hoisting the variable out of a loop is effectively the same as reordering instructions: you move the read backwards in time and use a cached value. Fences are designed to prevent that. Fences will tell the compiler, the jitter and the cpu not to hoist the variable. The fact that writing to the console happens to emit fences - that, I consider to be a side effect.
comment on: http://stackoverflow.com/a/24844202
score: 1
type: AnswerComment

http://stackoverflow.com/a/24757374
upvote count: 1
has body: Let say you have put the product list in modelmap inside your controller. Access the same inside Jsp through your command object. Jsp Code &lt;c:forEach var="product" begin="0" step="1" items="${products}"&gt; &lt;td&gt;${product.name}&lt;/td&gt; &lt;/c:forEach&gt;
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24757140
answers question: http://stackoverflow.com/q/24757140
downvote count: 0
score: 1

http://stackoverflow.com/comment/38602975
type: QuestionComment
type: Comment
score: 1
has text: `String[] books = new String[15];` should be `Book[] books = new Book[15];`, then when you load file you would simply assign a new instance of each book to an element of the array `books[i] = new Book(isbn, price, copies);`
comment on: http://stackoverflow.com/q/24858116

http://stackoverflow.com/q/24887691
tagged with: java
has title: Tokenizing a string using negations
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/38658775
accepted answer: http://stackoverflow.com/a/24887791
tagged with: token
has comment: http://stackoverflow.com/comment/38658465
favorite count: 0
score: 0
upvote count: 1
tagged with: regex
downvote count: 1
has body: So i have the following problem: I have to tokenize a string using String.split() and the tokens must be in the form 07dd ddd ddd, where d is a digit. I thought of using the following regex : ^(07\\d{2}\\s\\d{3}\\d{3}) and pass it as an argument to String.split(). But for some reason, although i do have substrings under that form, it outputs the whole initial string and doesn't tokenize it. I initially thought that it was using an empty string as a splitter, as an empty string indeed matches that regex, but even after I added &amp; (.)+ to the regex in order to assure that the splitter hasn't got length 0, it still outputs the whole initial string. I know that i could have used Pattern's and Matchers to solve it much faster, but i have to use String.split(). Any ideas why this happens?
has answer: http://stackoverflow.com/a/24887791
type: AnsweredQuestion

http://stackoverflow.com/comment/38676052
comment on: http://stackoverflow.com/q/24896430
has text: I would suspect something is done differently between bodies made when loading the level, and those made afterward? Do the bodies made when loading the level all use this exact same procedure?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24764118
tagged with: performance
tagged with: inner-classes
tagged with: java
upvote count: 10
has answer: http://stackoverflow.com/a/24764371
type: Question
score: 10
answer count: 2
has body: I would like to know how big of a benefit lambdas have in Java 8. I agree that it might be more readable sometimes to use lambdas, but does it have really such of a big impact on the performance side? Or is it mainly focused as syntactic sugar? I prefer anonymous inner classes sometimes; do I really lose many benefits when I don't use lambda all the time? The only ?big? performance gain, it seems to me, is that we don't actually create classes that the class loader has to load at the start of the program -- for example creating many many threads: Thread t = new Thread(new Runnable() { public..... }); creates classes like Sample$1.class. Other than that, is there any performance or other hidden gain besides readability or maintainability etc. of the code? Hidden somewhere in JVM? I've seen questions similiar to this but most of them were focused on visual side; I'm not interested in that. The question is out of curiosity after watching Java 8 Lambdas Hacking with Venkat Subramaniam.
downvote count: 0
accepted answer: http://stackoverflow.com/a/24764371
favorite count: 0
has answer: http://stackoverflow.com/a/29179961
has title: Lambda vs anonymous inner class performance: reducing the load on the ClassLoader?
tagged with: lambda
tagged with: java-8
possible better answer: http://stackoverflow.com/a/29179961
type: AnsweredQuestion

http://stackoverflow.com/a/24883180
upvote count: 509
has body: One simple way is to append your list items in a StringBuilder List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); list.add(1); list.add(2); list.add(3); StringBuilder b = new StringBuilder(); list.forEach(b::append); System.out.println(b); you can also try: String s = list.stream().map(e -&gt; e.toString()).reduce(&quot;&quot;, String::concat); Explanation: map converts Integer stream to String stream, then its reduced as concatenation of all the elements. Note: This is normal reduction which performs in O(n2) for better performance use a StringBuilder or mutable reduction similar to F. Böller's answer. String s = list.stream().map(Object::toString).collect(Collectors.joining(&quot;,&quot;)); Ref: Stream Reduction
has comment: http://stackoverflow.com/comment/83633072
type: AcceptedAnswer
score: 508
has comment: http://stackoverflow.com/comment/136263302
has comment: http://stackoverflow.com/comment/72732870
has comment: http://stackoverflow.com/comment/38650652
type: Answer
has comment: http://stackoverflow.com/comment/43511422
accepted answer of: http://stackoverflow.com/q/24882927
has comment: http://stackoverflow.com/comment/38650591
downvote count: 1
answers question: http://stackoverflow.com/q/24882927
has comment: http://stackoverflow.com/comment/84411388

http://stackoverflow.com/comment/38633482
type: QuestionComment
comment on: http://stackoverflow.com/q/24873504
score: 0
has text: ...but it worked before I installed Java 8. Hmmm...
type: Comment

http://stackoverflow.com/q/24823056
score: 0
tagged with: string-hashing
favorite count: 0
linked to: http://stackoverflow.com/q/9364134
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24823121
possible better answer: http://stackoverflow.com/a/24823124
upvote count: 1
downvote count: 1
has title: Problems with my implementation of a Java Hashmap
has answer: http://stackoverflow.com/a/24823348
has answer: http://stackoverflow.com/a/24823124
type: Question
has body: After doing research and looking up old posts for a while I realize that when you use a Hashmap or Hashtable in Java where Strings are the keys, the first "round" of hashing is applied to each String objects hashCode (apparently there is a second hash function that is applied to the result of int hashCode()), where by default int hashCode()has some relationship with it's callers location in memory (from what I read). With that being said, if I had a map with a developer defined class for keys, I read that I can override int hashCode() and use some distinct field(s) of my object to return the most unique int possible for each object. However, consider the code fragment below that contains arrays of primitive types. import java.util.HashMap; public class test { public static void main(String[] args) { HashMap&lt;char[], int[] &gt; map = new HashMap&lt;char[], int[]&gt;(); String s = "Hello, World"; int x[] = { 1, 2, 3, 4, 5 }; map.put( s.toCharArray(), x ); x = map.get( s ); for ( int i : x ) System.out.print( i ); } } The program crashes from a NullPointerException of course because map.get( s ); returns null. I suspect that has happened because there are two different references between map.put() and map.get(). What I want the program to output is 1 2 3 4 5. My question: How can I get the above code fragment to look up the keys by the value of the key vs the reference of the key? That is, how can I get the program to output 1 2 3 4 5? Edit: I am using the hashmap as a look up table. I am reading strings from a file and need a fast way to determine if the string I just read in is in the table or not.
accepted answer: http://stackoverflow.com/a/24823348
has answer: http://stackoverflow.com/a/24823257

http://stackoverflow.com/comment/38582408
type: QuestionComment
has text: no I know that but what they try to do? if your ds is consist of fn and ls, I think it is easier way to check it? did i get the point of ds right?
score: 0
comment on: http://stackoverflow.com/q/24847591
type: Comment

http://stackoverflow.com/a/24860555
downvote count: 0
has body: "Original class should not be changed" - then you are seeking something mocking, byte code fiddling, AOP. If you made makeSomeWeirdConfig protected, you could override the method and test a child class. The same with testing an extra flag. If you could put the code in a delegator even better towards sound code. class SomeWeirdConfig { void makeSomeWeirdConfigs() { ... } } SomeWeirdConfig delegate = new SomeWeirdConfig(); public void initTest() { delegate = null; } private void makeSomeWeirdConfigs() { if (delegate != null) { delegate.makeSomeWeirdConfigs(); } } Then the test could disable the setter.
type: Answer
accepted answer of: http://stackoverflow.com/q/24860367
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24860367
type: AcceptedAnswer

http://stackoverflow.com/comment/38670105
has text: Oh, sorry, the exact error message is "The method getAuthorizeUrl(ClientRequest) is undefined for the type String" on line 43. It is in the Verification method.
score: 0
comment on: http://stackoverflow.com/q/24893535
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38528726
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24819134
has text: you need Apache Common Digester. See other similiar [question][1] [1]: http://stackoverflow.com/questions/14729528/java-lang-noclassdeffounderror-when-using-a-third-party-jar-file

http://stackoverflow.com/a/24846082
has comment: http://stackoverflow.com/comment/38585624
score: 5
has comment: http://stackoverflow.com/comment/38580586
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38579455
answers question: http://stackoverflow.com/q/24846017
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/24846017
downvote count: 0
has comment: http://stackoverflow.com/comment/38585379
has comment: http://stackoverflow.com/comment/38579778
has comment: http://stackoverflow.com/comment/38579572
has body: This is the expected behavior, because in both cases getType() is called on the same object of type Test. This is because JVM knows the type of the object being created is of the derived class Test at the time the base constructor is called, so that is the type being printed. This behavior is not universal to all programming languages, but it works this way in Java. If a class wants to access its own Class object, it can do so statically, i.e. using the SuperTest.class expression. To get the behavior that you want you can pass the class to whoAmI from the constructor, like this: class SuperTest { SuperTest() { whoAmI(SuperTest.class); } void whoAmI(Class c) { System.out.println(c.getName()); } } class Test extends SuperTest { Test() { whoAmI(Test.class); } }
has comment: http://stackoverflow.com/comment/38579485

http://stackoverflow.com/comment/38694226
comment on: http://stackoverflow.com/q/24901221
has text: My actual use case has 10 or so possible filters, and this this is just the first of many models in the application. Was really hoping there was a one line solution. (having just come from a Python/Django project, Java/Play is rather verbose)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24818289
has body: I'm trying to convert this date string 2014-07-17T22:41:17+0000 to a timestmap, similar to this: 1405645259000. I've tried something similar to this: String string = "January 2, 2010"; Date date = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH).parse(string); System.out.println(date); How do I convert this (2014-07-17T22:41:17+000) to a Date? What is the correct format? I'm at a loss.
tagged with: java
linked to: http://stackoverflow.com/q/24726584
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/24818373
answer count: 3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24818360
has answer: http://stackoverflow.com/a/24818707
possible better answer: http://stackoverflow.com/a/24818373
type: Question
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24818360
has comment: http://stackoverflow.com/comment/38527131
has title: Date to timestamp

http://stackoverflow.com/a/26237270
answers question: http://stackoverflow.com/q/24785219
type: Answer
has comment: http://stackoverflow.com/comment/45161562
accepted answer of: http://stackoverflow.com/q/24785219
has body: Currently you can not set concurrent consumers for CXF 3. I did some performance tests with ActiveMQ and found the performance with CXF 3 is equal to CXF 2 or even better. The reason is that we now use a MessageListener approach instead of the polling that spring did. See my website for the performance tests.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24867420
type: Question
tagged with: java
tagged with: database
answer count: 1
has comment: http://stackoverflow.com/comment/38621131
tagged with: nfc
has title: Connecting NFC to the Web Application
type: UnansweredQuestion
tagged with: php
has body: Is it possible to connect NFC reader/writer to a web application directly? Or do I need to have a middleware? I mean, I have to fetch data from NFC reader/writer using a desktop application then send it to the database and my web application will then process the data. I need to output some data from NFC in my web application and if possible I don't need to create another application for the desktop.
score: 0
has answer: http://stackoverflow.com/a/25226854
has comment: http://stackoverflow.com/comment/38621470
has comment: http://stackoverflow.com/comment/38620841

http://stackoverflow.com/a/24834440
has comment: http://stackoverflow.com/comment/38558522
score: 2
has body: @Override public boolean onTouch(View arg0, MotionEvent arg1) { if(arg1.getAction() == MotionEvent.ACTION_DOWN) { // This is what happens on the click down... } else if(arg1.getAction() == MotionEvent.ACTION_UP) { // this is what happens on the click release return true; } return false; }}); This would process the click if any of their motion is on the object and is based on release to vague first-engagement will be refined to further accuracy where they choose to remove their finger.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24834385
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24834385
type: Answer

vaadin-push
type: Tag
tags question: http://stackoverflow.com/q/24888657
tag name: vaadin-push

http://stackoverflow.com/comment/38398750
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24749941
has text: Assumption #3 does not have to be there, if you know what an [`ArrayList`](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html) is.

http://stackoverflow.com/a/24880073
score: 1
answers question: http://stackoverflow.com/q/24877958
upvote count: 1
type: Answer
has body: You're using streams, so this code violates the general streams principle against non-interference. See the java.util.stream package documentation in the section on "Non-interference". This is essentially a generalization of the fail-fast property of iterators that others have cited. The streams implementation doesn't necessarily use the source collection's iterator, so that rule doesn't apply directly; however, the concept is the same: you mustn't modify the stream's source while the stream is in operation. The penalty may be a ConcurrentModificationException if you're lucky (because this tells you the code is doing something wrong) or if you're not lucky, inconsistent or incorrect results. It looks the intent is simply to remove certain matching elements. The Collection interface has a default method removeIf that, given a predicate, does exactly this. You can use this instead of streams. Here's the code: this.entries.removeIf(entry -&gt; object.equals(entry.getStorage()));
downvote count: 0

http://stackoverflow.com/a/24876666
has comment: http://stackoverflow.com/comment/38662713
has comment: http://stackoverflow.com/comment/38638318
answers question: http://stackoverflow.com/q/24876660
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38638519
type: Answer
has comment: http://stackoverflow.com/comment/38638207
has comment: http://stackoverflow.com/comment/38638253
has comment: http://stackoverflow.com/comment/38666294
has comment: http://stackoverflow.com/comment/38638220
has body: this is standard, more readable, and less error prone. It will help you when you are mistakenly shadowing variables or and trying to access non-static field in static code. i.e to avoid this int m_bar; public Foo(int m_bar) { m_bar = m_bar; } and static int m_bar; int m_bar; public Foo(int bar) { this.bar = m_bar; // a warning static field being accessed as non-static }
has comment: http://stackoverflow.com/comment/38638261
upvote count: 9
accepted answer of: http://stackoverflow.com/q/24876660
score: 9

http://stackoverflow.com/comment/38776752
has text: While HSQLDB does not have `connect by` it does support recursive queries: http://hsqldb.org/doc/2.0/guide/dataaccess-chapt.html#dac_with_clause
type: Comment
comment on: http://stackoverflow.com/a/24949857
score: 0
type: AnswerComment

http://stackoverflow.com/a/24796410
answers question: http://stackoverflow.com/q/24796273
score: 8
downvote count: 0
has body: It is clearly stated in Java Doc In general, if Foo is a subtype (subclass or subinterface) of Bar, and G is some generic type declaration, it is not the case that G&lt;Foo&gt; is a subtype of G&lt;Bar&gt;. This is probably the hardest thing you need to learn about generics, because it goes against our deeply held intuitions. Same thing happens here it's Bar = List&lt;Integer&gt; and Foo = ArrayList&lt;Integer&gt; as ArrayList&lt;ArrayList&lt;Integer&gt;&gt; is not sub type of List&lt;List&lt;Integer&gt;&gt;
upvote count: 8
type: Answer

http://stackoverflow.com/comment/38491922
score: 0
has text: @Sanjeev nope..!! I would like to create a notepad file.. enter few data inside that file and save it with a specific extension like .NEW or .CSV
comment on: http://stackoverflow.com/q/24798881
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38675574
type: QuestionComment
comment on: http://stackoverflow.com/q/24896577
has text: `.equals()` is not equal to `==`
score: 1
type: Comment

http://stackoverflow.com/q/24875923
duplicate of: http://stackoverflow.com/q/14930516
accepted answer: http://stackoverflow.com/a/24875973
has comment: http://stackoverflow.com/comment/38637023
favorite count: 0
score: 4
answer count: 5
has answer: http://stackoverflow.com/a/24876108
has comment: http://stackoverflow.com/comment/38637139
downvote count: 1
has answer: http://stackoverflow.com/a/24876016
has comment: http://stackoverflow.com/comment/38636946
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38636797
possible better answer: http://stackoverflow.com/a/24876108
tagged with: java
has answer: http://stackoverflow.com/a/24875973
has comment: http://stackoverflow.com/comment/38636932
type: Question
has answer: http://stackoverflow.com/a/24876135
tagged with: algorithm
upvote count: 5
has title: Removing duplicates from a Array
has comment: http://stackoverflow.com/comment/38636899
has body: I am dealing with the following problem from my data structure book. I have come up with the solution as suggested by this text . I basically found all the duplicates and labelled them some arbitrary number like 666 and then removed them from the array. My question to everyone is - is my solution is exactly as the text suggested? - also what is a more effective method to solve this problem? Here is the complete code (LOOK at the nodups method to see my solution) public class HighArray { private long[] a; private int nElems; public HighArray(int max) { a = new long[max]; nElems = 0; } public boolean find(long searchKey) { int j; for (j = 0; j &lt; nElems; j++) if (a[j] == searchKey) break; if (j == nElems) { return false; } else { return true; } } public void insert(long value) { a[nElems] = value; nElems++; } public void noDups() { int i = 0; long compareKey; while (i &lt; nElems) { compareKey = a[i]; for (int j = 0; j &lt; nElems; j++) { if (j != i &amp;&amp; a[j] != 666) { if (a[j] == compareKey) { a[j] = 666; } } j++; } i++; } for (int k = 0; k &lt; nElems; k++) { if (a[k] == 666) { delete(a[k]); } } } public boolean delete(long value) { int j; for (j = 0; j &lt; nElems; j++) if (a[j] == value) break; if (j == nElems) { return false; } else { for (int k = j; k &lt; nElems - 1; k++) a[k] = a[k + 1]; nElems--; return true; } } public long removeMax() { if (nElems != 0) { long maxValue = a[0]; for (int i = 0; i &lt; nElems; i++) { if (a[i] &gt; maxValue) maxValue = a[i]; } delete(maxValue); return maxValue; } else { return -1; } } public void display() { for (int i = 0; i &lt; nElems; i++) { System.out.println(a[i]); } } } The following class has main method. public class HighArrayApp { public static void main(String[] args) { HighArray arr = new HighArray(100); arr.insert(2); arr.insert(2); arr.insert(3); arr.insert(4); arr.insert(4); arr.insert(5); arr.display(); arr.noDups(); System.out.println("-------------------------"); arr.display(); } } I highly appreciate …
has answer: http://stackoverflow.com/a/24876126
has comment: http://stackoverflow.com/comment/38720724

http://stackoverflow.com/comment/38536571
type: Comment
comment on: http://stackoverflow.com/a/24823120
has text: I am talking about the `yourView.getId()`. You call `getId()` on the `View` instance you are trying to get so obviously you already have the instance and don't need to find it again.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38425560
type: AnswerComment
comment on: http://stackoverflow.com/a/24764148
type: Comment
has text: I think you need to spend some time reading about how [inheritance](http://en.wikipedia.org/wiki/Inheritance_%28object-oriented_programming%29) works.
score: 0

http://stackoverflow.com/comment/38500190
has text: But there's no `static class` in this sense... The static modifier means nothing but that the *instances* don't get an implicit pointer to the enclosing class (so static classes are just like top level ones in this respect). All classes reference their classloaders and vice versa; there's no difference between the three classes in `class A { static class B {} class C {} }`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24799357

http://stackoverflow.com/q/24815492
has answer: http://stackoverflow.com/a/24821876
has comment: http://stackoverflow.com/comment/38646682
type: Question
answer count: 2
tagged with: jpa
tagged with: jpql
score: 0
tagged with: eclipselink
has answer: http://stackoverflow.com/a/24889596
has comment: http://stackoverflow.com/comment/38552323
has comment: http://stackoverflow.com/comment/38533466
has body: I have the following JQPL query: SELECT e FROM Emp e WHERE SIZE(e.companyBean.emps) &gt; 0 The problem is that it didn't work on eclipselink 2.5.2, when I tried it on 2.3.2 it worked successfully I thought that there maybe some changes in JPA that disallow this path navigation but couldn't find anything on the web. So is there something wrong about this query or changes in eclipselink that may be the cause of this exception ?? Thanks The whole maven project: https://github.com/mohamedkomalo/jpa2-eclipselink/ The Emp entity: https://github.com/mohamedkomalo/jpa2-eclipselink/blob/master/src/main/java/model/Emp.java The Company entity: https://github.com/mohamedkomalo/jpa2-eclipselink/blob/master/src/main/java/model/Company.java The exception Exception in thread "main" Local Exception Stack: Exception [EclipseLink-6015] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.QueryException Exception Description: Invalid query key [ Query Key emps Base model.Emp{DatabaseTable(t0)=DatabaseTable(emp)}] in expression. Query: ReadAllQuery(name="Emp.findEmployeesInBigCompanies" referenceClass=Emp jpql="SELECT e FROM Emp e WHERE SIZE(e.companyBean.emps) &gt; 0") at org.eclipse.persistence.exceptions.QueryException.invalidQueryKeyInExpression(QueryException.java:697) at org.eclipse.persistence.internal.expressions.ObjectExpression.getDescriptor(ObjectExpression.java:453) at org.eclipse.persistence.internal.expressions.SubSelectExpression.normalizeSubSelect(SubSelectExpression.java:186) at org.eclipse.persistence.internal.expressions.ExpressionNormalizer.normalizeSubSelects(ExpressionNormalizer.java:114) at org.eclipse.persistence.internal.expressions.SQLSelectStatement.normalize(SQLSelectStatement.java:1534) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.buildNormalSelectStatement(ExpressionQueryMechanism.java:549) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.prepareSelectAllRows(ExpressionQuery…
has title: Invalid query key thrown because of JPQL statement in eclipselink 2.5.2 but works in 2.3.2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24889596
tagged with: java
possible better answer: http://stackoverflow.com/a/24821876
has comment: http://stackoverflow.com/comment/38529124

http://stackoverflow.com/q/24858204
score: -1
has title: After editing opened file, how to save the changes?
answer count: 2
accepted answer: http://stackoverflow.com/a/24858494
downvote count: 2
has comment: http://stackoverflow.com/comment/38603583
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38603110
has answer: http://stackoverflow.com/a/24858494
possible better answer: http://stackoverflow.com/a/24858328
tagged with: io
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38603300
has answer: http://stackoverflow.com/a/24858328
has comment: http://stackoverflow.com/comment/38603338
tagged with: java
has comment: http://stackoverflow.com/comment/38603331
tagged with: file
has body: I am able to open file through the code below on text field txt1. How can I save the changes automatically after editing in txt1 field in this same function by using Buffered Reader or anything else? private void btnOpenfileActionPerformed(java.awt.event.ActionEvent evt) { String file=""; JFileChooser chooser = new JFileChooser("./"); int i = chooser.showOpenDialog(null); if (i == 0) { File f = chooser.getSelectedFile(); filelocation=f.getAbsolutePath(); System.out.println(f); try { FileReader fr = new FileReader(f); //file location passed BufferedReader br = new BufferedReader(fr); String temp = ""; while ((temp = br.readLine()) != null) { file += temp+"\n"; } txt1.setText(file); //txt1 is a text field in split pane fr.close(); } catch (Exception e) { System.out.println(e); } }
tagged with: swing
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/38603131

http://stackoverflow.com/comment/38514853
type: QuestionComment
comment on: http://stackoverflow.com/q/24811004
has text: Of Course, when running I only get this line of exception on the console: at test.Start.main(Start.java:8)
score: 0
type: Comment

http://stackoverflow.com/q/24899985
has answer: http://stackoverflow.com/a/24900260
accepted answer: http://stackoverflow.com/a/24900260
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38682447
has body: Following my question here I now came up to this problem. I'm using NetBeans 8. I've created a Maven Project, let's call it MyLibMaven, (I used New Project -> Maven -> Java Aplication) and I moved my library, let's call it MyLib, into this Maven Project. Now when I go to my normal Java Project (let's call it MyProject) and I try to add MyLibMaven as a library to MyProject I get this popup in Netbeans saying: This project cannot be added because it does not produce a JAR file using an Ant script What am I doing wrong here? Here's my pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.dwnz.my.lib MyLib 1.0-SNAPSHOT jar <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> MyLib com.google.guava guava 17.0 ///////////////////////// EDIT ////////////////////////////// I moved my project to a maven project and added the MyLibMaven as a dependency. But now when I try to run my project I get this failed error: --- exec-maven-plugin:1.2.1:exec (default-cli) @ TeseMaven --- Could not load the icon: /view/images/enable-server-icon.png Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:217) at view.toolbar.ToolBar.createIcon(ToolBar.java:171) at view.toolbar.ToolBar.<init>(ToolBar.java:53) at view.MainFrame.<init>(MainFrame.java:98) at view.MainFrame.newInstance(MainFrame.java:586) at view.Main.main(Main.java:98) ------------------------------------------------------------------------ ------------------------------------------------------------------------ BUILD FAILURE ------------------------------------------------------------------------ Total time: 2.382s Finished at: Wed Jul 23 02:13:22 BST 2014 Final Memory: 5M/126M ------------------------------------------------------------------------ Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project MyProjectMaven: Co…
score: 3
has title: This project cannot be added because it does not produce a JAR file using an Ant script
tagged with: ant
has comment: http://stackoverflow.com/comment/38682183
upvote count: 3
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/1729054
has comment: http://stackoverflow.com/comment/38682387
tagged with: maven
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/38682314
downvote count: 0

http://stackoverflow.com/comment/38544395
type: QuestionComment
has text: Environment variables belong for the user who runs the program. What user is running your Java program?
score: 0
comment on: http://stackoverflow.com/q/24827358
type: Comment

http://stackoverflow.com/q/24897753
tagged with: nullpointerexception
has title: Nullpointerexception on getIntent()
tagged with: android
answer count: 1
tagged with: android-intent
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24897821
type: Question
accepted answer: http://stackoverflow.com/a/24897821
has body: I want to get a value from my second activity to use it in a separate class (a fragmentPageAdapter). At first this value is passed from my main activity to my second activity using Intent.putExtra(key_name, string). So in my second activity I am retrieving this value again with getIntent().getStringExtra(key_name). However I want to use this specific value not inside my second activity but in my fragmentPageAdapter which is a separate class. So I thought I use an getter inside my second activity so that I can retrieve this value in my fragmetnPageAdapter class. However I'll get an nullpointerexception. Inside my second activity I am using this getter: public String getMyItem(){ return getIntent().getStringExtra("selectedItem"); } this is how my fragmentPageAdapter class looks like: class myPagerAdapter extends FragmentPagerAdapter { MySecondActivity mySecondActivity = new MySecondActivity(); public myPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { Fragment fragment = null; if(mySecondActivity.getMyItem().equals("ride_height")){ if(i==0){ fragment = new fragment_ride_height_overview(); } if(i==1){ fragment = new fragment_ride_height_measure(); } if(i==2){ fragment = new fragment_ride_height_adjust(); } } return fragment; } @Override public int getCount() { return 3; //nothing implemented here yet... } } the nullpointerexception looks like this: java.lang.NullPointerException at com.example.offroad_set_up_guide.MySecondActivity.getMyItem(MySecondActivity.java:73) at com.example.offroad_set_up_guide.myPagerAdapter.getItem(MySecondActivity.java:86) Now the weird thing is, if I change the getter to the code below, it does work as I expect. public String getMyItem(){ return "ride_height"; } So I thought something is going wrong with retrieving the data of the "selectedItem". So I did use the Toast annotation (could have used the log function I suppose...) function to print out the: getIntent().getStringExtra("selectedItem"). And …
score: 0

http://stackoverflow.com/q/24802177
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24802258
score: -1
has comment: http://stackoverflow.com/comment/38496685
has title: How to replace dollar character with backslash dollar in a string
type: Question
has answer: http://stackoverflow.com/a/24802280
tagged with: string
tagged with: str-replace
answer count: 3
favorite count: 0
has body: I have a String like this: String str = "aLnx5$bK$#C4EFg"; And I want to replace all the dollar $ characters with backslash dollar \$, in order to get: String expectedString = "aLnx5\$bK\$#C4EFg";
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24802284
downvote count: 2

singleton
tags question: http://stackoverflow.com/q/24860796
type: Tag
tags question: http://stackoverflow.com/q/24810802
tags question: http://stackoverflow.com/q/24809246
tags question: http://stackoverflow.com/q/24837405
tag name: singleton

http://stackoverflow.com/comment/38674144
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24895611
has text: Now I have a weird problem. The returned value from the EditText is this: 07-22 14:11:01.649 28038-28038/com.collusion.serviceassistant I/INFO﹕ [ 07-22 14:11:01.649 28038:28038 D/AndroidRuntime ]. I'm getting the value using: String goalNumberString = String.valueOf(et.getText());
type: Comment

http://stackoverflow.com/comment/38525864
comment on: http://stackoverflow.com/q/24817541
type: Comment
score: 0
type: QuestionComment
has text: You get an error. Which error ?

http://stackoverflow.com/comment/38432913
type: QuestionComment
comment on: http://stackoverflow.com/q/24766927
has text: This now has an answer by the original poster, seems OK to me (unless it's a dupe).
score: 0
type: Comment

http://stackoverflow.com/a/24865008
downvote count: 0
score: 1
has body: data = [['cars', 50, 'q1', 'ground'], ['boat', 0, 'q1', 'water'], ['bicycles', 50, 'q2', 'ground'], ['cars', 75, 'q2', 'water'], ['horses', 0, 'q2', 'ground'], ['foxes', 50, 'q5', 'ground']] data_dict = {i[2]: i[1] for i in data if i[0] == 'cars'} for i in data: if i[3] == 'ground' and i[0] != 'cars': if i[2] != data_dict.get(i[2]): print("{}, {} (result: {}, differs from cars {})".format(i[0], i[2], i[1], data_dict.get(i[2]))) result: bicycles, q2 (result: 50, differs from cars 75) horses, q2 (result: 0, differs from cars 75) foxes, q5 (result: 50, differs from cars None)
answers question: http://stackoverflow.com/q/24864788
upvote count: 1
type: Answer

http://stackoverflow.com/q/24894946
has answer: http://stackoverflow.com/a/24894971
tagged with: arrays
answer count: 2
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/24894976
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/38672524
favorite count: 0
tagged with: multidimensional-array
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
has title: Initializing a 2d array of custom class in java
has body: I'm getting a NullPointerException when I try to instantiate a class that contains a 2d array of interface. In a other class i have an Object of type CompetitionGround and i try to do something like this to initialize it: CompetitionGround groud; ground=new CompetitionGround(5); My constructor for the class CompetitionGround looks like this: public CompetitionGround(int boundries) { for (int i = 0; i &lt;boundries; i++) for (int j = 0; j &lt;boundries; j++) eggs[i][j]=new Egg(); } and the whole class is: public class CompetitionGround { private IEgg eggs[][]; public void goIn(Rabbit rabbit) { IPozition temp = rabbit.getPozition(); rabbit.Collect(eggs[temp.getPozitionX()][temp.getPozitionY()]); } public CompetitionGround(int boundries) { for (int i = 0; i &lt; boundries; i++) for (int j = 0; j &lt; boundries; j++) eggs[i][j] = new Egg(); } public void AddEgg(int x, int y, int points) { eggs[x][y] = new Egg(points); } } Class Egg that implements IEgg has two types of constructors. I tried with both and get the same problem. What am I doing wrong? I can't figure it out.
has answer: http://stackoverflow.com/a/24894976
downvote count: 1
possible better answer: http://stackoverflow.com/a/24894971
type: Question
has comment: http://stackoverflow.com/comment/38672526

http://stackoverflow.com/q/24850060
tagged with: android
has title: Android HttpsUrlConnection with POST data not work on Gingerbread
accepted answer: http://stackoverflow.com/a/24872455
tagged with: httpsurlconnection
tagged with: https
has body: I've written code to download some data from external server. The server is using self-signed certificate, need to have session cookie set and some POST data. Currently I have the following code: private byte[] getResponse(URL url, String postData) throws IOException, KeyManagementException, CertificateException, KeyStoreException, NoSuchAlgorithmException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection(); urlConnection.setRequestProperty("User-Agent", userAgent); urlConnection.setRequestProperty("Cookie", cookie); urlConnection.setRequestMethod("POST"); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); urlConnection.setSSLSocketFactory(getSocketFactory()); OutputStream os = urlConnection.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); writer.write(postData); writer.flush(); writer.close(); os.close(); try { urlConnection.connect(); InputStream is = urlConnection.getInputStream(); int len = 0; while ((len = is.read(buffer)) != -1) { baos.write(buffer, 0, len); } } catch(IOException e) { throw e; } finally { urlConnection.disconnect(); } return baos.toByteArray(); } On Ice Cream Sandwich and higher (API >= 14) everything works fine. The problem started when I tried to make the app work on API >= 8. It is now properly sending the request with GET and no params (CAPTCHA) but when it comes to getting the actual data urlConnection's connect method fails with no exception. The code for getSocketFactory() is: private SSLSocketFactory getSocketFactory() throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); InputStream caInput = context.getResources().openRawResource(R.raw.historiapojazdu); Certificate ca; try { ca = cf.generateCertificate(caInput); } finally { caInput.c…
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24872455
score: 0

http://stackoverflow.com/comment/38459110
has text: A little bit less information you provide. In which format is it coming? Do you already have some code?
comment on: http://stackoverflow.com/q/24782255
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24808477
tagged with: synchronization
favorite count: 0
type: UnansweredQuestion
has body: I have a java main class SendEmail.java that I can run in Eclipse or in a bat file. If I make a change to the code in Eclipse, save, and then run bat file (which runs the java class), an old version of the class runs instead of the new version that has the change. When I run the class in eclipse, the new version runs and I have no problem. Why is it that the bat file doesn't run the updated version? What can I do to the bat file to run the updated version of the class? Is the problem that running the bat file just runs the class (may not compile), while running in eclipse both compiles and runs? My bat file uses set CLASSPATH for JavaMail's external jars, changes the directory to the location of the package mypack, and then calls this: java -Djava.net.preferIPv4Stack=true mypack.SendEmail EDIT (info David Conrad requested): The .bat file is run from my computer's C drive C:\Users\myusername\myfolder\runSendEmail.bat In runSendEmail.bat, I change the directory to a shared Network Z drive and run the java class Z: cd Z:\PATH\JAVA_CODE\EMAIL\bin java -Djava.net.preferIPv4Stack=true mypack.SendEmail So the .class file is located in the shared Network Z drive at Z:\PATH\JAVA_CODE\EMAIL\bin\mypack The jar files are also in the C drive. Thank you in advance for your help!
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38511784
type: Question
has title: Java File Sync between Bat and Eclipse
has comment: http://stackoverflow.com/comment/38516040
has comment: http://stackoverflow.com/comment/38509460
tagged with: eclipse
tagged with: batch-file
has answer: http://stackoverflow.com/a/24812041
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/38510846
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24791992
has text: Make sure your "public" directory is marked as a resource (or source) directory. (Right click it in the project view and select "Mark Directory as...". You can also configure this in the Project Structure (File > Project Structure) dialog. If that does not help, please update your question with more details on your project configuration.

http://stackoverflow.com/comment/38473528
score: 2
comment on: http://stackoverflow.com/q/24789504
has text: Provide the code that implements your RESTful service. Probably there's an error like an infinite loop there or your table in mysql is locked.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/88992961
comment on: http://stackoverflow.com/a/24807774
score: 0
type: AnswerComment
has text: Where can I get the "com.sun.mail:javax.mail" library? All I can find online is only the javax.mail-1.6.1 which is good only for compiling.
type: Comment

http://stackoverflow.com/comment/43383324
type: AnswerComment
has text: Wear 5.0.1 has some ability! the SDK sample Watchface has a way to detect it. Look for WatchFaceService.INTERRUPTION_FILTER_NONE
type: Comment
comment on: http://stackoverflow.com/a/24781964
score: 1

http://stackoverflow.com/comment/38481502
comment on: http://stackoverflow.com/a/24793470
type: AnswerComment
score: 0
type: Comment
has text: what OP has stated in the post. OP is not masking the phone numbers just want to accept digits that is either 7 and 10 times

http://stackoverflow.com/comment/39018571
type: AnswerComment
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58484/discussion-between-help-and-magicmicky).
comment on: http://stackoverflow.com/a/25077728
score: 0

http://stackoverflow.com/a/24823257
score: 0
has body: From Oracle Documentation public V get(Object key) Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. and obviously s.equals(s.toCharArray()) is false. They are not even the same Class. However, you could use as key a Class that overrides equals() in a way that returns true for your case. For example: class MyCharArray { private char[] data; @Override public boolean equals(Object o) { if (o instanceOf String) { return data.equals(o.toCharArray); else { return false; } } ... }
has comment: http://stackoverflow.com/comment/38536449
type: Answer
answers question: http://stackoverflow.com/q/24823056

http://stackoverflow.com/a/24750015
has comment: http://stackoverflow.com/comment/38398903
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24749973
score: 2
upvote count: 2
has body: First of all dont use scriptlet for any logic to be implemented and secondly your code &lt;%Hej a = new Hej(); %&gt; fails because you have a parameterized constructor in your class by you are initializing an object without an argument try ths &lt;% Hej a = new Hej("Hello World !"); %&gt; One more thing instead of using default package create some package. Example create a package named mypackage and drag the class inside it. then change the page import to something like this : &lt;%@ page import="mypackage.Hej" %&gt;

http://stackoverflow.com/comment/38507815
type: Comment
has text: I just bench marked mine at 3 microseconds using String.matches() and .7 microseconds reusing a compiled Pattern. Fast enough?
comment on: http://stackoverflow.com/a/24807272
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38585842
has text: @Boann actually no. The two answers have some similarities, but the big difference is in the initialuzation of the queue (the main topic of the question): the other answer takes an array, creates (and initialized) a List, then uses that List to initialize the queue. My answer skips the intermediate object and goes straight to the JDK's (fast) List copy constructor. Another important difference is my reference list contains Integer objects, which don't need converting, but the other answer initialized he reference list with inf primitives that must be wrapped as Integers every time.
type: Comment
comment on: http://stackoverflow.com/a/24846567
score: 0
type: AnswerComment

http://stackoverflow.com/q/24859173
upvote count: 0
has body: I am using Mysql database in jsp to request data from a database. But i received the error stating HTTP 500 error exception occurred processing JSP page /Home.jsp at line 21 Could you help me in resolving this error .. <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.sql.*" %> Home <% Connection con= null; PreparedStatement ps = null; ResultSet rs = null; String sql = "select Category from e_createuser"; try { Class.forName("com.mysql.jdbc.Driver"); con =(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/newapplication","root","root"); ps = (PreparedStatement)con.prepareStatement(sql); rs = ps.executeQuery(); %> Welcome HR Enter Your Name : Enter Your Password : Select Category : select <% while(rs.next()) { String cattype = rs.getString("Category"); %> <option value=<%=cattype%>><%=cattype%> <% } } catch(SQLException sqe) { out.println("Home"+sqe); } %>
tagged with: java
tagged with: mysql
type: Question
has title: Http 500 error exception occurred processing JSP page /Home.jsp at line 21
has comment: http://stackoverflow.com/comment/38605011
score: -1
has answer: http://stackoverflow.com/a/24864383
answer count: 1
downvote count: 1
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/38606647
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/49228961
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30574958
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment).
type: AnswerComment

http://stackoverflow.com/comment/38481303
type: QuestionComment
score: 2
has text: where are you printing it?
comment on: http://stackoverflow.com/q/24793655
type: Comment

http://stackoverflow.com/q/24892865
has body: I know that similar topics exists, but actually none of them works at 100%. Kind of hints/script how to attach those latest android annotations to latest android studio version. Env: Ubuntu x64, gradle 2.0, android studio 0.8.2 Regards Edit: The solution also works with AndroidStudio 1.0 .
type: Question
tagged with: android-annotations
tagged with: java
has title: How to attach android annotations v3+
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27338146
has comment: http://stackoverflow.com/comment/38705983
tagged with: android
tagged with: android-studio
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27338146
tagged with: gradle

http://stackoverflow.com/q/24768178
type: Question
has answer: http://stackoverflow.com/a/24768649
tagged with: adapter
has comment: http://stackoverflow.com/comment/38433138
has comment: http://stackoverflow.com/comment/38433157
accepted answer: http://stackoverflow.com/a/24768649
score: 0
has body: I need help with a project in Android where I'm working. I have an AsyncTask that external data collected through the internet with a custom adapter. My view currently has a view that is generated by the adapter and outside of it, contains a button. I would like to press that button give me current information from view as for example the name of the element. MainActivity.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ebebeb" android:orientation="vertical" &gt; &lt;RelativeLayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="50dp" android:background="@drawable/header" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="55dp" android:gravity="center_vertical" android:paddingLeft="35dp" android:text="Menú" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#FFF" /&gt; &lt;TextView android:id="@+id/openmenu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:background="@drawable/ic_action_overflow" android:clickable="true" android:contentDescription="Desc" android:visibility="visible" /&gt; &lt;TextView android:id="@+id/love" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:background="@drawable/ic_action_love" android:clickable="true" android:contentDescription="Desc" android:visibility="visible" /&gt; &lt;TextView android:id="@+id/refresh" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/love" android:layout_alignBottom="@+id/l…
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/38433025
tagged with: android-asynctask
has title: How to get information of an item with button in Android
has comment: http://stackoverflow.com/comment/38433259
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/10261499

http://stackoverflow.com/q/24780318
type: Question
has answer: http://stackoverflow.com/a/24783867
has title: JNA and Java Language Keywords
downvote count: 0
tagged with: jna
has body: Is there a way to map method names, member variables, struct data etc. when the member name is a java reserved keyword? I am creating a JNA wrapper for a third party C-library, whose sources I am not able to modify. A simplified example would be this: // C-library typedef struct { const char* name; } Class; typedef struct { const Class *class } Context; So to map this to JNA I have a class public static class Context extends Structure { public Pointer class; // &lt;-- compile error, reserved keyword } Is there any way around this? I tried looking at JNA sources (I'm using version 3.2.2) but didn't find anything related.
answer count: 1
favorite count: 0
tagged with: mapping
type: UnansweredQuestion
tagged with: reserved
tagged with: keyword
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/24814001
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25774181
tagged with: jodatime
score: -1
answer count: 2
upvote count: 0
has body: I have a legacy component that uses Joda-time-1.6. I am integrating something new to complement this legacy component and the new component requires Joda-time 2.1. So, can I use Joda-time 2.1 lib with the legacy component?
accepted answer: http://stackoverflow.com/a/25774181
favorite count: 0
has answer: http://stackoverflow.com/a/24815374
has title: Is Joda-time 2.1 backward compatible with 1.6?
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24815374

http://stackoverflow.com/comment/39117608
has text: I eventually solved this. Instead of adding the body to the destroy list in my ContactListener, I added a new boolean to the objects, and set them to true when I wanted to destroy them. Then, in the objects update method, I add it to the destroy list. That seems to have fixed it. I think it may he been an issue with either getting the body from the object, or adding it to the destroy list in the contact listener.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24896430

http://stackoverflow.com/comment/38536847
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24821614
has text: I have already defined a context root e.g. /cont-root for the portlet and the portlet is visible under server -> Update Manager section in liferay. how that can be visible in add portlet section?

http://stackoverflow.com/q/24847504
type: Question
has comment: http://stackoverflow.com/comment/38582939
tagged with: ejb
tagged with: jndi
score: 0
has comment: http://stackoverflow.com/comment/38582840
has comment: http://stackoverflow.com/comment/38587621
has body: package myJsp; import java.sql.*; import javax.sql.*; import javax.ejb.*; import javax.naming.*; public class A implements SessionBean { private static final long serialVersionUID = 1L; public void ejbCreate() throws CreateException { ctx = new InitialContext(); ds = (DataSource)ctx.lookup("jdbc/fastCoffeeDB"); } public void ejbActivate() { } public void ejbPassivate() { } public void ejbRemove() { } public void setSessionContext(SessionContext ctx) { } public void updatePrice(float price, String cofName, String username, String password) throws SQLException { Connection con; PreparedStatement pstmt; try { con = ds.getConnection(username, password); con.setAutoCommit(false); System.out.println("connection successful"); con.commit(); } finally { if (con != null) con.close(); } } private DataSource ds = null; private Context ctx = null; } I have added javaee.jar file and trying to create jndi interface for my project. ds = (DataSource)ctx.lookup("jdbc/fastCoffeeDB"); ------The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files. What does it mean?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38587651
has title: Data Source creation using ejb.The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
answer count: 0
has comment: http://stackoverflow.com/comment/38582715
tagged with: java
has comment: http://stackoverflow.com/comment/38586951
has comment: http://stackoverflow.com/comment/38583677

http://stackoverflow.com/q/24759014
linked to: http://stackoverflow.com/q/6998905
has answer: http://stackoverflow.com/a/24759109
has title: Why is my attempt to append text to a file not responding?
linked to: http://stackoverflow.com/q/21158142
linked to: http://stackoverflow.com/q/9589227
has answer: http://stackoverflow.com/a/24759458
linked to: http://stackoverflow.com/q/4430143
answer count: 4
tagged with: append
accepted answer: http://stackoverflow.com/a/24759232
type: AnsweredQuestion
tagged with: bufferedwriter
possible better answer: http://stackoverflow.com/a/24759109
linked to: http://stackoverflow.com/q/21210697
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/18283513
linked to: http://stackoverflow.com/q/4614227
has body: I'm simply trying to add a new line of text to my *.txt file, but nothing happens at all. The file is packed with a .war, so I use a ClassLoader to access the file. Also, both my eclipse IDE, and the contents of the file, use UTF-8 encoding. I've used these for inspiration: How to add a new line of text to an existing file in Java? Java BufferedWriter object with utf-8 Now my code is mainly based on the last post, and looks like this: public class test { public static void main(String[] args){ URL url = Thread.currentThread().getContextClassLoader().getResource("MilestoneExport.txt"); File file = new File(url.getFile()); System.out.println(file.canRead()); //true System.out.println(file.canWrite()); //true try { BufferedWriter out = new BufferedWriter (new OutputStreamWriter(new FileOutputStream(file),"UTF-8")); out.append("new line"); out.append("new line 2"); out.append("new line 3"); out.close(); } catch (IOException e) { e.printStackTrace(); } } } I've confirmed that the file is in fact found, and it reads fine. I've been able to output the entire content of it to the console through the use of a BufferedReader. The path of the file is also correct, but absolutely no text is added to the file. I've made sure that I have refreshed and updated every time I've run the program. Also, I've tried to create a simple empty file called foo.txt, which is located in the same directory as test.java. I added the following code to the main method, as provided by the BufferedWriter API, at http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html PrintWriter out2 = new PrintWriter( new BufferedWriter(new FileWriter("foo.txt"))); out2.println("new Line"); out2.close(); What am i missing here? Why are there no error messages, and no responses or feedbacks whatsoever? EVERYTHING BELOW IS ONLY ADDITIONAL INFO ABOUT WHAT I'VE TRIED. NO FEEDBACK IN ANY CASES: Not this one: Why is BufferedWriter not writing to file? Not this one: why is bufferedwriter not writing in the fi…
has answer: http://stackoverflow.com/a/24759293
score: 0
has answer: http://stackoverflow.com/a/24759232
tagged with: file-io

http://stackoverflow.com/comment/38561989
has text: Thanks! I really don't know how I could have overlooked such an easy solution... I didn't even have the panel added to the frame yet (facepalm). Rookie mistake hahaha! Thanks for the "case & break" innovation as well. I forgot all about that :o
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24836600

http://stackoverflow.com/comment/38661183
comment on: http://stackoverflow.com/a/24888606
has text: if you think there's no way that's correct you can try return super.onCreateOptionsMenu(menu);
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38419454
type: Comment
comment on: http://stackoverflow.com/a/24760767
score: 0
type: AnswerComment
has text: Sorry. This didn't fix it. I suspect the issue lies in the fact that I can't pull the application context from App because App doesn't ever get referenced from a class that's a part of the Android life cycle.

http://stackoverflow.com/q/24908860
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/38698686
has answer: http://stackoverflow.com/a/24909048
favorite count: 0
has comment: http://stackoverflow.com/comment/38698727
has answer: http://stackoverflow.com/a/24909076
score: 9
linked to: http://stackoverflow.com/q/36707
linked to: http://stackoverflow.com/q/65035
possible better answer: http://stackoverflow.com/a/24909356
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24909356
tagged with: java
has comment: http://stackoverflow.com/comment/38698406
has comment: http://stackoverflow.com/comment/38698362
type: Question
has body: I have a try block where database queries are attempted to be run and a finally block where database resources are released. If a value does not exist in the database I return null. Is it a good idea to return in a try block? Some example code: try { if (!jedis.exists(name)) { return null; // Is this a good idea? } // Do database related stuff... } catch (JedisConnectionException e) { // Fix any problems that happen } finally { // Return all objects to pools and clean up }
has answer: http://stackoverflow.com/a/24909010
has answer: http://stackoverflow.com/a/24909066
has answer: http://stackoverflow.com/a/24908959
upvote count: 9
has title: Using return in try block (Java)
has comment: http://stackoverflow.com/comment/38699356
has answer: http://stackoverflow.com/a/24908952
has comment: http://stackoverflow.com/comment/38698336
has comment: http://stackoverflow.com/comment/38698371
accepted answer: http://stackoverflow.com/a/24908952

http://stackoverflow.com/q/24784400
possible better answer: http://stackoverflow.com/a/29116220
has answer: http://stackoverflow.com/a/24784657
tagged with: jtable
accepted answer: http://stackoverflow.com/a/24784657
answer count: 2
tagged with: listselectionlistener
has title: Deselecting the selected row in a JTable
downvote count: 0
favorite count: 0
upvote count: 2
has body: I have created a UI using Swing with a JTable. I have implemented a ListSelectionListener through which I am able to fetch records based on the selected row in the table. I am unable to deselect the row after selection. So basically I should be able to select a row with one click and then I should be able to deselect the row with another click. I tried using tableName.getSelectionModel.clearSelection, but I don't know how to see if a row is selected or not. What would tell me this? Another solution I tried is using a Mouse Click Listener. Again, I am not able to write the condition to check if the mouse click happens on the previously selected row. Is there a way by which I can get the previous row selected? I am using the DefaultTableModel.
has answer: http://stackoverflow.com/a/29116220
tagged with: swing
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38463875
has comment: http://stackoverflow.com/comment/46460469
type: Question
linked to: http://stackoverflow.com/q/18337580

http://stackoverflow.com/a/24831256
has body: You have several ways. Use this regex ^.*\.(?!tar).*$ EndWith solution if(!filename.endsWith(".tar")) FileFilter - Link And probably a few more. I think the endsWith is the fastest way, not regex, because that's pretty heavy operation.
answers question: http://stackoverflow.com/q/24831140
accepted answer of: http://stackoverflow.com/q/24831140
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/24796341
has comment: http://stackoverflow.com/comment/38486392
has body: I am new to android.. in a video tutorial I watch the guy writing a code and compiling it with no any error.. but when the same code I type gives me error.. don't know why.. Well.. Layout xml file is ok.. there is a error in java file.. whenever I add to a onclicklistener method to a button... it does not give any error in the code section but when I compile it it shows an error.. that application XXX has stopped unexpectedly. pleas try again. code is here.. package com.abrosoft.trycommand; import java.util.Random; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import android.os.Build; import android.view.View.OnClickListener; public class MainActivity extends ActionBarActivity { EditText input; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } Button cmd = (Button) findViewById(R.id.bCmd); display = (TextView) findViewById(R.id.tvcmd); input = (EditText) findViewById(R.id.etinput); //if I delete this SetOnClickListener method.. it runs ok.. //I get xml layout on screen of emulator.. but with this method..it doesnot run cmd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //even I write any lines of code which should perform any action on button //click is giving same error } }); } @Ove…
score: 0
has answer: http://stackoverflow.com/a/24796375
has title: Android Eclipse setting on click listener error
has comment: http://stackoverflow.com/comment/38489115
has comment: http://stackoverflow.com/comment/38486766
possible better answer: http://stackoverflow.com/a/24796363
has answer: http://stackoverflow.com/a/24796363
has answer: http://stackoverflow.com/a/24796813
has answer: http://stackoverflow.com/a/24796376
tagged with: android
has comment: http://stackoverflow.com/comment/38486744
answer count: 4
has comment: http://stackoverflow.com/comment/38486118
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38486334
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38486269
accepted answer: http://stackoverflow.com/a/24796813

http://stackoverflow.com/comment/38516548
type: AnswerComment
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/57531/discussion-between-dormouse-and-dharam).
comment on: http://stackoverflow.com/a/24812151
score: 0

http://stackoverflow.com/a/24786503
score: 1
has body: Declare adapter as global, setting adapter as global will let you filter it: YourActivity.this.adapter.getFilter().filter("some text"); Did you try this?, it should works: Adapter adapter= MyListView.getAdapter(); adapter.getFilter().filter("some text"); Too you can post your code to check what are you doing wrong, if you're using a custom adapter you have to implement the getFilter method
accepted answer of: http://stackoverflow.com/q/24786316
answers question: http://stackoverflow.com/q/24786316
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38467914
downvote count: 0

http://stackoverflow.com/q/24837094
accepted answer: http://stackoverflow.com/a/25027260
has body: CharsetEncoder takes a sequences of characters, and encodes it, turning it into a sequence of bytes. I'm working on creating a Charset for use in Java, and I'm having a little trouble understanding the intent of the following. From java.nio.charset.CharsetEncoder's documentation: The possible error actions are to ignore the erroneous input, report the error to the invoker via the returned CoderResult object, or replace the erroneous input with the current value of the replacement byte array. What I'm wondering is, does the replacement byte array replace a sequence of erroneous characters, or do you add a copy for every erroneous character? For example, imagine the sequence of chars was {'a', 'a', 'a'} and your replacement byte sequence was {0, 1}. If you're working in a charset in which 'a' is an illegal character, would you write {0, 1, 0, 1, 0, 1}, replacing all illegal characters separately, or just {0, 1}, replacing the sequence of illegal characters? I know those aren't actually byte literals, but ints. Please just go with it. I figured that adding a ton of casts would simply make it harder to follow. I'm tempted to do it by character, but at the same time, it just feels weird to replace one character with a (potentially, though probably not) very long sequence of bytes.
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25027260
tagged with: character-encoding
score: 0
answer count: 1
has title: CharsetEncoder - Unmappable character replacement

http://stackoverflow.com/q/24880054
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24885268
type: Question
has body: Say I have private final static int N = 1 in class A Is there any chance to 'hack' so that N becomes 2(without touching the source file A.java)? The set pointcut seems not work on these final fields. The thing is, I have the source code of some project, and I'm making some modifications to it to deploy it in our region. I'm trying to make these changes without touching the source file unless I have to. @VinceEmigh reflection wouldn't work in my case. The source code looks like: class MyClass private final static String[] NAMES = {"Name1", "Name2", "Name3"}; public void createIsland() { //something int i = getNumberOfIsland(); String name = NAMES[i]; createIslandWithName(name); //something } end The thing is I need to change those hard coded NAMES to something else
has comment: http://stackoverflow.com/comment/38644431
tagged with: aop
tagged with: aspectj
upvote count: 1
answer count: 1
has title: AspectJ - is there a way to 'hack' a static final field?
favorite count: 0
linked to: http://stackoverflow.com/q/3301635
accepted answer: http://stackoverflow.com/a/24885268
has comment: http://stackoverflow.com/comment/38644441
has comment: http://stackoverflow.com/comment/38644450
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/24886594
has comment: http://stackoverflow.com/comment/38656284
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24886352
type: Answer
accepted answer of: http://stackoverflow.com/q/24886352
has body: You have the problem that you are adding nothing, like null. Everything you add to the panel must inherit from the parent- class called Component. So, your Class TestTable, i hope it is a Class, must inherit from JTable or so.
upvote count: 3
score: 3

http://stackoverflow.com/a/40607985
answers question: http://stackoverflow.com/q/24831183
downvote count: 0
has body: I have the same problem finally, I was solved. //Use like this import com.test.helpers.A; If u have a more than class in com.test.helpers then u can use import com.test.helpers.*;
type: Answer
has comment: http://stackoverflow.com/comment/68512491
score: 1
upvote count: 1

http://stackoverflow.com/a/24873442
score: 3
upvote count: 3
downvote count: 0
has body: The other answers don't take into account that you are talking about a Thread Pool. Here's what you'd need to do: private static class MyThreadFactory implements ThreadFactory { public Thread newThread(final Runnable r) { return new Thread() { public void run() { try { r.run(); } finally { // teardown code } } }; } } public static void main(String[] args) { ThreadPoolExecutor exec = new ThreadPoolExecutor(10, 20, 100, TimeUnit.SECONDS, null, new MyThreadFactory()); }
type: Answer
answers question: http://stackoverflow.com/q/24872009

http://stackoverflow.com/q/24906849
has body: I recently switched from Eclipse to Android Studio and I'm experimenting with PagerSlidingTabStrip library. Trying to customize the Tab Strip I came across the Triangle Pager Sliding Tab Strip which suggests to modify the source code of the dependency library. How can I modify the source code of a gradle dependency (in this case and in general)? I don't see any available PagerSlidingTabStrip.java in my project.
tagged with: gradle
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38694851
score: 6
has answer: http://stackoverflow.com/a/24908366
has comment: http://stackoverflow.com/comment/38695065
answer count: 1
favorite count: 0
has title: Is it possible to modify library file's source code in Android Studio from Gradle dependency
tagged with: android
accepted answer: http://stackoverflow.com/a/24908366
upvote count: 6
type: AnsweredQuestion
tagged with: android-gradle-plugin
has comment: http://stackoverflow.com/comment/38694872
tagged with: java
tagged with: pagerslidingtabstrip

http://stackoverflow.com/a/32019094
score: 2
upvote count: 2
has body: Same idea, but different approach. Create a ContainerResponseFilter with the following code to put headers for all your jax-rs web services at once: @Provider public class HeadersReponseFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext request, ContainerResponseContext response) { response.getHeaders().putSingle("Access-Control-Allow-Origin", "*"); response.getHeaders().putSingle("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); } } And the following configuration on your web.xml: Jersey REST Service * Jersey REST Service org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages your.webservices.package com.sun.jersey.spi.container.ContainerResponseFilters your.webservices.package.HeadersReponseFilter true Cheers. :)
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24906314

http://stackoverflow.com/a/24842527
type: Answer
has body: It's "bad" mainly because there's no guarantee that your MainActivity constructor has been called. This can happen if your process is terminated and then re-created while another activity is above it, for example. You can use a custom Application subclass and store a static reference to its Context there, which will be available no matter how your app starts. (The exception is that ContentProviders may be instantiated before your Application subclass.) You may want to expose it via a static method instead of a static field. But it would be better design to simply pass the Context as a constructor parameter to Renderer, if at all possible.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24842462

http://stackoverflow.com/comment/38430351
type: Comment
type: QuestionComment
score: 0
has text: You are a life saver @Jigar Joshi!!!! Thanks again***** a mill. Am so grateful. You could put your response as an answer so I can accept it. Wow! Again thank you. Had been stuck for so long!
comment on: http://stackoverflow.com/q/24766591

http://stackoverflow.com/comment/38509456
has text: ok, I tried to run it and this is the error I get returned a response status of 415 Unsupported Media Type
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24808297

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/24858264
type: Tag

http://stackoverflow.com/comment/40925790
type: Comment
comment on: http://stackoverflow.com/a/24776904
score: 0
type: AnswerComment
has text: I found the solution here "http://stackoverflow.com/questions/14255493/get-updated-row-in-one-to-many-mapping-using-hibernate", thank you Shailendra for your response.

http://stackoverflow.com/q/24795897
has title: Java Printing the content of the textarea to the printer
has comment: http://stackoverflow.com/comment/38491513
tagged with: java
type: Question
tagged with: jtextarea
answer count: 1
score: 0
tagged with: printing
has answer: http://stackoverflow.com/a/27783792
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38490792
linked to: http://stackoverflow.com/q/17505070
has body: I'm trying to create a program that will print what is written in the jTextArea my problem is that when the printDialog pops out and I pressed OK the printer doesn't print or when I changed the properties to Paper Source to Cont.Feed- No Break, it gives a blank page I'm trying to print on a thermal receipt printer here is my code public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page &gt; 0) { return NO_SUCH_PAGE; } Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()-55); frameToPrint.print(g); return PAGE_EXISTS; } public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) { } } } public PrintUIWindow(JFrame f) { frameToPrint = f; } public static void main(String args[]) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame("Print UI Example"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); JLabel label1=new JLabel("Selling Bill",JLabel.CENTER); JLabel label2=new JLabel("Customer Name :Mahmoud Saleh ",JLabel.LEFT); JLabel label3=new JLabel("Buying Date :29/8/2008 ",JLabel.LEFT); JLabel label4=new JLabel("Book Buyed :Java Printing ",JLabel.LEFT); JLabel label5=new JLabel("Number : 6 Copies ",JLabel.LEFT); JLabel label6=new JLabel("Total Price :600 $ ",JLabel.LEFT); label1.setFont(new Font("Courier New", Font.BOLD, 13)); label2.setFont(new Font("Courier New", Font.BOLD, 13)); label3.setFont(new Font("Courier New", Font.BOLD, 13)); label4.setFont(new Font("Courier New", Font.BOLD, 13)); label5.setFont(new Font("Courier New", Font.BOLD, 13)); label6.setFont(new Font("Courier New", Font.BOLD, 13)); JButton printButton = new JButton("Print This Window"); printButton.addActionListener(new PrintUIWindow(f)); JPanel panel=new JPanel(); panel.setLayout(new GridLayout(6,1)); panel.add(label1…
tagged with: swing

http://stackoverflow.com/comment/38693495
type: QuestionComment
score: 0
has text: Are you providing the dependency scope of core package? your web project is compiling it means it is having the dependency however it is not available at runtime means it is not getting included in war.
comment on: http://stackoverflow.com/q/24905752
type: Comment

http://stackoverflow.com/q/24814422
answer count: 4
has title: AsyncTask doesn't call onPostExecute(Result result)
has answer: http://stackoverflow.com/a/24814517
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24814486
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24814486
type: Question
downvote count: 0
favorite count: 0
has body: I m trying here to display a 7 day weather forecast from OWM API using AsyncTask. doInBackground(String...param) method is also working fine. I have checked the LOGCAT. After the async has finished the execution. I tried to refresh the ListView on refresh button in the menu. But it seems the onPostExecute() does care all about. ForecastFragment.java package com.example.sunshine; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; 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.ArrayAdapter; import android.widget.ListView; /** * A placeholder fragment containing a simple view. */ public class ForecastFragment extends Fragment { private ArrayAdapter&lt;String&gt; mForeCastAdapter; public String[] forecastArray; public ForecastFragment() { } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); } public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.forecastfragment, menu); } public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_refresh) { new FetchWeatherTask().execute("44700"); return true; } return super.onOptionsItemSelected(item); } protected void onPostExecute(String[] result) { if (result != null) { Log.v("msg", result[0]); mForeCastAdapter.clear(); // forecastArray = result; for (String…
tagged with: android
has answer: http://stackoverflow.com/a/24814701
has answer: http://stackoverflow.com/a/24814495
possible better answer: http://stackoverflow.com/a/24814517

http://stackoverflow.com/comment/38408569
score: 1
has text: don't to extend JFrame, create this Object as local variable
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24755439

http://stackoverflow.com/a/24897932
downvote count: 0
answers question: http://stackoverflow.com/q/24813947
type: Answer
score: 1
has body: Well it turns out it wasn't honoring the passed in JVM HTTP arguments because my web service is using HTTPS. After setting the flags to the following: -Dhttps.proxyHost=proxyhostURL -Dhttps.proxyPort=proxyPortNumber -Dhttps.proxyUser=someUserName -Dhttps.proxyPassword=somePassword All worked as planned.
has comment: http://stackoverflow.com/comment/56274828
upvote count: 1

http://stackoverflow.com/comment/38655081
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24885430
has text: yea its working thanks is it possible i can show these files in list form and then after clicking particular file will get download...

http://stackoverflow.com/a/24774031
score: 0
type: AcceptedAnswer
has body: You could use Google Gson (https://code.google.com/p/google-gson/) For example: import com.google.gson.Gson; public Resolution autocomplete() { List&lt;String&gt; opts = new ArrayList&lt;String&gt;(); ... String json = new Gson().toJson(opts); return new StreamingResolution("application/json",json); }
has comment: http://stackoverflow.com/comment/38524465
answers question: http://stackoverflow.com/q/24767172
type: Answer
accepted answer of: http://stackoverflow.com/q/24767172

http://stackoverflow.com/comment/38664459
has text: Have you checked your transaction isolation?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24889981

http://stackoverflow.com/a/24770885
has comment: http://stackoverflow.com/comment/38478527
has comment: http://stackoverflow.com/comment/38438163
accepted answer of: http://stackoverflow.com/q/24770637
type: Answer
answers question: http://stackoverflow.com/q/24770637
has comment: http://stackoverflow.com/comment/38442392
has comment: http://stackoverflow.com/comment/38438066
upvote count: 3
has body: Your first probelm is with IntStream.range(x,y). This method expects a range which is inclusive at the start and exclusive at the end. Since you passed objList.size()-1 (6 in your case) as the end of the range, the index of the last String in your input list (6) was excluded from the IntStream and the String located at this index ("7") didn't appear in your output. static IntStream range(int startInclusive, int endExclusive) Returns a sequential ordered IntStream from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step of 1. API Note: An equivalent sequence of increasing values can be produced sequentially using a for loop as follows: for (int i = startInclusive; i &lt; endExclusive ; i++) { ... } (Source) Change it to IntStream.range(0, objList.size()). Another problem is that .filter( i -&gt; i % 2 == 0 || i -&gt; i == objList.size()-1) won't compile, since it expects a single lambda expression, and you don't need the || i -&gt; i == objList.size()-1 part anyway (since the last index of the array, 6, is already even). Of course that still won't work. If you fix those problems objList.get(i + 1) will give you an ArrayIndexOutOfBoundsException exception when i = 6. My fix to the final problem is probably not the most elegant possible solution, but that's the first thing I came up with that compiled and worked at this late hour. Fixing that we finally get (after some minor formatting added in the last line) : import java.util.Arrays; import java.util.stream.IntStream; import java.util.stream.Collectors; import java.util.List; public class LambdaTest { public static void main (String[] args) { List&lt;String&gt; objList = Arrays.asList("1", "2", "3", "4", "5", "6", "7"); List&lt;String&gt; result = IntStream.range(0, objList.size()) .filter( i -&gt; (i % 2) == 0) .mapToObj(i -&gt; (i&lt;objList.size()-1)?(objList.get(i) + " " + objList.get(i + 1)):objList.get(i)) .collect(Collectors.toList()); result.forEach(i -&gt; System.out.print("\"" + i …
has comment: http://stackoverflow.com/comment/38468518
has comment: http://stackoverflow.com/comment/38439017
has comment: http://stackoverflow.com/comment/38462757
score: 3
has comment: http://stackoverflow.com/comment/38438999
has comment: http://stackoverflow.com/comment/38438104
has comment: http://stackoverflow.com/comment/38438678
has comment: http://stackoverflow.com/comment/38438388
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38462262
downvote count: 0

http://stackoverflow.com/q/24866181
score: 0
has body: I have created a tool bar with few Tool bar items in my Application. Menu: <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:main"> Command configuration: <extension point="org.eclipse.ui.commands"> Below is my TestCommand class. public class TestCommand extends AbstractHandler{ //Overridden the execute method here.... } So now if I click on my Tool bar this will execute my Command class. I would like to know how can I add mouse listener to this Tool bar item so that we can do some stuff when mouse over on the tool bar item (Ex:Mouse over to tool bar item, it generally shows tool tip, So now if I press some key it should open some other page for this. So to do that if I can get the control of this event I can add some stuff to it)
has title: How to Handle mouse over events for Tool Bar Items in RCP
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38851959
type: Question
has comment: http://stackoverflow.com/comment/39019295
tagged with: rcp
tagged with: eclipse-rcp

http://stackoverflow.com/comment/38541062
score: 0
type: Comment
has text: Yes it is an answer but a lot more complicated then my method with flexible resolutions.
comment on: http://stackoverflow.com/a/24810218
type: AnswerComment

http://stackoverflow.com/a/24833695
accepted answer of: http://stackoverflow.com/q/24833607
type: Answer
upvote count: 1
has body: Two very minor issues with your code, // System.out.println(encryptData.toString()); // System.out.println(decryptData.toString()); System.out.println(Arrays.toString(encryptData)); System.out.println(new String(decryptData)); The encrypted string is in binary. So you probably would not enjoy seeing it directly mapped to ASCII. It looks like garbage. Java arrays do not override Object.toString(), so you are getting Object.toString() and that is basically the hashCode() and essentially a reference address. My second println() above outputs the expected "Secure Message" here.
answers question: http://stackoverflow.com/q/24833607
score: 1
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24811325
downvote count: 0
has body: A list called people would normally contain Person objects. Here's some example code that shows how to use a for-each loop: public class Demo { private static class Person { public int age; public String name; public Person(int age, String name) { this.age = age; this.name = name; } } public static void main(String... args) { // Create and populate a list of people with individuals List&lt;Person&gt; people = new ArrayList&lt;&gt;(); people.add(new Person(32, "Fred")); people.add(new Person(45, "Ginger")); people.add(new Person(66, "Elsa")); // Iterate over the list (one person at a time) for (Person person : people) { if (person.age &gt; 60) { System.out.println("Old person: " + person.name); } } } } You can also read the Oracle Java documentation about for-each loops. The general form is: for (Person person : people) { ... } Instead of: for (int i = 0; i &lt; people.size(); i++) { Person person = people.get(i); ... } The for-each is usually recommended because it's terser. However, if you need to know the index number of the item you will have to use the original for loop or increment a counter inside the for-each.
type: Answer
upvote count: 14
accepted answer of: http://stackoverflow.com/q/24811229
score: 14
answers question: http://stackoverflow.com/q/24811229
type: AcceptedAnswer

http://stackoverflow.com/a/77157680
has body: This can be done with Java 21 new IsEmoji character class: var regex = "\\p{IsEmoji}"; Extract all emojis: var myString = "This is a ⭐ emoji and a \uD83C\uDF0D emoji"; var emojiRegex = "\\p{IsEmoji}"; var pattern = Pattern.compile(emojiRegex); var matcher = pattern.matcher(myString); var emojis = matcher.results().map(MatchResult::group).toList(); var emojisString = String.join(" ", emojis); Remove all emojis: var myString = "This is a ⭐ emoji and a \uD83C\uDF0D emoji"; var emojiRegex = "\\p{IsEmoji}"; var myStringWithoutEmojis = myString.replaceAll(emojiRegex, "");
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/24840667
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38504045
score: 0
type: QuestionComment
type: Comment
has text: Not that I can see. There's nothing in the console except a few GWT.log messages
comment on: http://stackoverflow.com/q/24803028

http://stackoverflow.com/q/24855444
tagged with: listview
has title: How to change the text color in Chris Banes' Android-PullToRefresh Library?
upvote count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
type: Question
has body: I'm currently using this library: https://github.com/chrisbanes/Android-PullToRefresh By Chris Banes to implement pull to refresh in my app and I'm having trouble customizing the text color and size in my app. I noticed that in the README Chris gives a rough, quick guide on how to customize your app but I don't understand it. Is the stuff in the attrs.xml file supposed to go as attributes in my layout file? How do I change the background color to blue, for example? Any help would be greatly appreciated!
tagged with: eclipse

http://stackoverflow.com/q/24873504
has comment: http://stackoverflow.com/comment/38645555
tagged with: swing
has answer: http://stackoverflow.com/a/24875960
has comment: http://stackoverflow.com/comment/38632292
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38633537
has title: JOptionPane not displaying correctly?
tagged with: java
has comment: http://stackoverflow.com/comment/38633796
has comment: http://stackoverflow.com/comment/38634229
has comment: http://stackoverflow.com/comment/38635580
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38634157
has comment: http://stackoverflow.com/comment/38633482
has comment: http://stackoverflow.com/comment/38632396
has comment: http://stackoverflow.com/comment/38640108
accepted answer: http://stackoverflow.com/a/24875960
answer count: 1
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/38633500
has comment: http://stackoverflow.com/comment/38635791
has comment: http://stackoverflow.com/comment/38633434
favorite count: 0
tagged with: joptionpane
has body: Today I updated my jdk and docs from 7 to 8. I made a few changes to my program, and now when I try to have the program use JOptionPane, JLabel, ..., everything messes up. I made a separate tester class whose sole purpose is to run a single JOptionPane box and the error still occurred. Below is a picture of what the dialog box looks like. Is there something seriously wrong with Java 8? import javax.swing.JOptionPane; public class CirclePointTester { public static void main(String [] args) { String input = JOptionPane.showInputDialog("Enter the x coordinate of the circle"); int xc = Integer.parseInt(input); String input2 = JOptionPane.showInputDialog("Enter the y coordinate of the circle"); int yc = Integer.parseInt(input2); String input3 = JOptionPane.showInputDialog("Enter the height value of the circle"); int height = Integer.parseInt(input3); String input4 = JOptionPane.showInputDialog("Enter the width value of the circle"); int width = Integer.parseInt(input4); } }
has comment: http://stackoverflow.com/comment/38634269

http://stackoverflow.com/a/24922501
accepted answer of: http://stackoverflow.com/q/24888912
score: 2
answers question: http://stackoverflow.com/q/24888912
downvote count: 0
has body: Channel.setInterestOps() in Netty 3 was used to suspend or resume the read operation of a Netty Channel. Its name and mechanic were unnecessarily low-level, so we changed how we deal with the suspension and resumption of the inbound traffic. First, we added a new outbound operation called read(). When read() is invoked, Netty will read inbound traffic once, and it will trigger at least one channelRead() event and a single channelReadComplete() event. Usually, you continue to read by calling ctx.read() in channelReadComplete(). However, because having to call ctx.read() for every channelReadComplete() is not very interesting, Netty has an option called autoRead, which is turned on by default. When autoRead is on, Netty will automatically trigger a read() operation on every channelReadComplete(). Therefore, If you want to suspend the inbound traffic, all you need to do is to turn the autoRead option off. To resume, turn it back on.
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/24789030
tagged with: arrays
duplicate of: http://stackoverflow.com/q/7056749
has comment: http://stackoverflow.com/comment/38472492
answer count: 2
accepted answer: http://stackoverflow.com/a/24789086
has comment: http://stackoverflow.com/comment/38473047
favorite count: 0
has comment: http://stackoverflow.com/comment/38472529
has comment: http://stackoverflow.com/comment/38472525
downvote count: 2
type: AnsweredQuestion
has body: Why is my while loop making two passes before allowing user input? Tried the same with for loop and can't figure out why it's asks for input twice before allowing user to enter input. I know it's a stupid, simple logic mistake I'm making but I'm a noob. Thanks in advance. public static void main (String [] args){ Scanner scan = new Scanner(System.in); System.out.println("How large would you like the array to be? (number)"); int arraySize = scan.nextInt(); String [] myArray = new String [arraySize]; int i = 0; if (arraySize &lt;= 0 ) { System.out.println("Please enter a positive integer for the array size. Rerun program when ready."); } else { while (i &lt; myArray.length) { System.out.println("Please type a string to be entered in the array"); myArray[i] = scan.nextLine(); i++; } } } Output looks like How large would you like the array to be? (number) 5 Please type a string to be entered in the array Please type a string to be entered in the array
tagged with: java.util.scanner
upvote count: 2
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/24789086
has comment: http://stackoverflow.com/comment/38473011
linked to: http://stackoverflow.com/q/7056749
type: Question
possible better answer: http://stackoverflow.com/a/24789090
has comment: http://stackoverflow.com/comment/38472563
has title: Why is my Java while loop making two passes first?
has answer: http://stackoverflow.com/a/24789090

http://stackoverflow.com/comment/38433701
comment on: http://stackoverflow.com/q/24767786
has text: All right, next question: what do you mean, "execute it using BufferedReader"? BufferedReader cannot execute system calls. Can you show how you actually call the process?
score: 0
type: QuestionComment
type: Comment

jface
tags question: http://stackoverflow.com/q/24765166
tag name: jface
tags question: http://stackoverflow.com/q/24773965
tags question: http://stackoverflow.com/q/24889808
type: Tag

http://stackoverflow.com/comment/38454158
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24779578
type: Comment
has text: +1 Nice timing table! You could even parallelize certain steps, e.g. the first 6 steps of the producer could be carried out in one flow (without empty lines), while the consumer executes its first three steps in one block (with one step delay).

http://stackoverflow.com/comment/38631447
type: AnswerComment
score: 0
type: Comment
has text: Ok, I have created an issue for your use case https://github.com/owlike/genson/issues/17, see if the description helps you to implement it. Don't hesitate to ask there for help to implement it.
comment on: http://stackoverflow.com/a/24799327

http://stackoverflow.com/comment/38617400
has text: What do you mean? If you mean for not changing the order of activities, yeah it was a part of my problems and I feel relieved now.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24864475
type: AnswerComment

http://stackoverflow.com/a/24823919
type: Answer
has body: The other answers already cover how to get the result you want. I'm gonna comment your code to explain why it isn't doing that already. (Note that I modified your variable names because strings don't get anything; they are a thing.) // declare a bunch of variables String articleBody = listArt.getChildText("body"); StringBuilder mainArticle = new StringBuilder(); String subHeadlineFromArticle; // check to see if the article body consists entirely of a subheadline if(articleBody.startsWith("&lt;h3&gt;") &amp;&amp; articleBody.endsWith("&lt;/h3&gt;")){ // if it does, append an empty string to the StringBuilder mainArticle.append(subHeadlineFromArticle); } // if it doesn't, don't do anything // final result: // articleBody = the entire article body // mainArticle = empty StringBuilder (regardless of whether you appended anything) // subHeadlineFromArticle = empty string
answers question: http://stackoverflow.com/q/24823422
score: 0

http://stackoverflow.com/q/24798469
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has body: I develop a web portal to give the user a way to access the information of an existing system. It is build on Java, running on Tomcat, Linux and MySQL. the user rarely access the system. Probably once every week to turn on and turn off some stuff. The strange thing is, sometime to time, our system will encounter database connection issue and if the user refresh the browser, it will work again. Below is the stack trace when the connection issue occur: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 648,770,075 milliseconds ago. The last packet sent successfully to the server was 648,770,076 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3988) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2598) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2323) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) at org.springframework.j…
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38499533
downvote count: 0
tagged with: c3p0
favorite count: 0
has title: C3P0 connection timeout
has comment: http://stackoverflow.com/comment/53662594
linked to: http://stackoverflow.com/q/667289
tagged with: connection-pooling

http://stackoverflow.com/comment/134703243
has text: what if it is mongo db
comment on: http://stackoverflow.com/q/24901118
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25656374
has body: I know this question has been solved long time ago, but here is another solution using new features of Java 8. Using Java streams the whole exercise can be written in one line: Arrays.asList(new String[]{"Java my love"}) //start with a list containing 1 string item .stream() //start the stream .flatMap(x -&gt; Stream.of(x.split(" "))) //split the string into words .map((String x) -&gt; x.length()) //compute the length of each word .sorted((Integer x, Integer y) -&gt; x-y) //sort words length (not necessary) .collect(Collectors.groupingBy(x -&gt; x, Collectors.counting())) //this is tricky: collect results to a map: word length -&gt; count .forEach((x,y) -&gt; {System.out.println("There are " + y + " word(s) with " + x + " letter(s)");}); //now print each result Probably in few year time this would be a preferred method for solving such problems. Anyway it is worth knowing that such alternative exists.
has comment: http://stackoverflow.com/comment/40128473
type: Answer
answers question: http://stackoverflow.com/q/24787781
score: 0
has comment: http://stackoverflow.com/comment/40091741

http://stackoverflow.com/a/24789363
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24789354
type: Answer
answers question: http://stackoverflow.com/q/24789354
has comment: http://stackoverflow.com/comment/38473219
upvote count: 1
has body: Simple: holdDigitsChar is null. Try searching harder next time.

http://stackoverflow.com/comment/38777544
comment on: http://stackoverflow.com/a/24868538
type: AnswerComment
score: 0
type: Comment
has text: Ah okay yes. IF you give your bean a local interface then you have to use it. But since JEE6 you are not forced to give it any kind of interface anymore.

http://stackoverflow.com/a/24894599
score: 1
has comment: http://stackoverflow.com/comment/38672574
upvote count: 1
has body: I think you have you have swapped the operators. Your criteria results in: ... where START_VALUE_COLUMN &gt;= "C" and END_VALUE_COLUMN &lt;= "C" Turn them around: Criteria criteria = session.createCriteria(); criteria.add(Restrictions.le("START_VALUE_COLUMN", "C")) .add(Restrictions.ge("END_VALUE_COLUMN", "C"));
type: Answer
has comment: http://stackoverflow.com/comment/38671918
has comment: http://stackoverflow.com/comment/38672714
answers question: http://stackoverflow.com/q/24888353
downvote count: 0

http://stackoverflow.com/comment/38628406
has text: You can use a `while` loop: `ObjectInputStream ois = getOIS(fis); while (ois.available() > 0) { HYB hf2 = (HYB) ois.readObject(); System.out.println(hf2); }`. This works because your application knows that it writes all of its content before it starts reading; if you weren't sure of that (e.g. if you were reading from a Socket), then you could just use `while (true)` instead and then catch the `EOFException` that will get thrown once you try to read after you've read the last object (or if the Socket is prematurely closed).
comment on: http://stackoverflow.com/a/24869624
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24865229
accepted answer: http://stackoverflow.com/a/24865545
downvote count: 1
type: Question
score: 3
tagged with: java
upvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/24865299
favorite count: 0
has answer: http://stackoverflow.com/a/24865545
has body: I am trying to pass a Runnable to an AsyncTask and then set the results of doInBackgroud to it and run it. I am trying the following code with no success. // MyActivity.java public void click(View v) { if(v.getId() == R.id.button) { new AsyncHTTP(myAsyncClassCallback()).execute(); } } public Runnable myAsyncClassCallback() { return new StringRunnable() { @Override public void run() { Log.v(DEBUG_TAG,result.toString()); } }; } // StringRunnable.java public class StringRunnable implements Runnable { volatile String result; public void setResult(String res) { this.result = res; } @Override public void run() { // do something with result } } // MyAsyncClass.java public class MyAsyncClass extends AsyncTask&lt;String, Integer, String&gt;{ private Runnable myCallback; public MyAsyncClass(Runnable runnable){ this.myCallback = runnable; } @Override protected String doInBackground(){ // works normally return someString; } @Override protected void onPostExecute(String result) { myCallback.setResult(result); // &lt;--- This is my question myCallback.run(); super.onPostExecute(result); } } So I get the message: Cannot resolve method setResult How can I fix this? Is this some access issue?
has title: Access Runnable's method before it runs
possible better answer: http://stackoverflow.com/a/24865296
tagged with: android
has answer: http://stackoverflow.com/a/24865296
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38616568

http://stackoverflow.com/comment/38595030
has text: How your java code correlates with `R.layout.openproject`?
type: Comment
comment on: http://stackoverflow.com/q/24854137
score: 0
type: QuestionComment

http://stackoverflow.com/a/24821629
has comment: http://stackoverflow.com/comment/38533315
upvote count: 5
has body: You appear to be implementing the standard "group by" primitive. This is supported out-of-the-box by the Streams API: Map&lt;String, List&lt;Item&gt;&gt; itemsByName = list.stream().collect(Collectors.groupingBy(Item::getName));
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24821445
answers question: http://stackoverflow.com/q/24821445
type: Answer
score: 5

mime-message
tags question: http://stackoverflow.com/q/24779292
tag name: mime-message
type: Tag
tags question: http://stackoverflow.com/q/24908641

http://stackoverflow.com/a/24830975
downvote count: 0
has comment: http://stackoverflow.com/comment/38563175
type: Answer
answers question: http://stackoverflow.com/q/24830903
has comment: http://stackoverflow.com/comment/38592751
has comment: http://stackoverflow.com/comment/38551282
upvote count: 3
has comment: http://stackoverflow.com/comment/38551288
has comment: http://stackoverflow.com/comment/38551316
has body: I think the problem is your try-with-resources call in the sender, which will call close() at the end of the try block and hence close the Socket. Try using a single PrintWriter across all calls to sendData().
score: 3

http://stackoverflow.com/comment/38621110
comment on: http://stackoverflow.com/q/24867203
type: Comment
type: QuestionComment
has text: Hmm that is really odd. I guess that could work, yes. This "Gradle" thing is good in concept but it causes a whole bunch of issues... are you using Gradle 2.0 or 1.12?
score: 0

http://stackoverflow.com/comment/38684287
score: 0
type: Comment
has text: @jiaderberg, Thanks for your answer, I have another question, could you help me ?http://stackoverflow.com/questions/24859704/spring-neo4j-save-entity-and-add-relationship-to-an-existing-node
comment on: http://stackoverflow.com/a/24832703
type: AnswerComment

http://stackoverflow.com/comment/38476407
type: QuestionComment
type: Comment
has text: I'm using existing code that I've modified. I need a way to pass information to the java applet so it can post the image to the proper database record. Essentially, I'll open the a browser window with the applet and pass a transaction ID and a URL to post the image to.
score: 0
comment on: http://stackoverflow.com/q/24790631

http://stackoverflow.com/comment/38523124
has text: If there is no other way to get the salt to machine A then what you propose is the only way. That's how it works unfortunately.
comment on: http://stackoverflow.com/a/24815863
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24809152
has comment: http://stackoverflow.com/comment/38509949
has comment: http://stackoverflow.com/comment/38510262
score: 0
has comment: http://stackoverflow.com/comment/38510167
answer count: 1
has answer: http://stackoverflow.com/a/24811801
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38510461
has comment: http://stackoverflow.com/comment/38510090
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38509957
has body: I have class like this (Actually onResponse method parses JSON, but I removed that piece od code for the sake of simplicity): class DistRespListener implements HttpClient.HttpResponseListener { private double dist; @Override public void onResponse(HttpMetaResponse response) { Double distTemp = 14.7; setDist(distTemp); Log.d("distanceInner2", String.valueOf(this.dist)); } public void setDist(double dist) { this.dist = dist; Log.d("distanceInner4", String.valueOf(this.dist)); } public double getDist() { Log.d("distanceInner3", String.valueOf(this.dist)); return this.dist; } Later in the code, I make this: HttpClient httpClient = new HttpClient(); DistRespListener distRespListener = new DistRespListener(); httpClient.executeRequestUsingOwnListener(new HttpGet(builder.build().toString()), distRespListener); Log.d("distanceOuter", String.valueOf(distRespListener.getDist())); Method executeRequestUsingOwnListener of httpClient object calls method onResponse() of distRespListener object. Problem is, getDist() method always return "0.0".
has title: Java unusual behaviour of variables

http://stackoverflow.com/q/24822257
tagged with: spring
has body: I have a strange issue with Async methods. If I run it in async way and its job throws some particular exception, it doesn't show it and simply stop the execution (no catch, no log). I found it working with jasperreport. This is the fault block code: JasperPrint jp1=null; try{ jp1 = JasperFillManager.fillReport(reportD1, params, new JRBeanCollectionDataSource(ingressi)); }catch(Exception e){ log.error(e); e.printStackTrace(); throw e; } If this code is inside an Async annotated method it doesn't throw the exception and doesn't log (simply stops the execution). If I remove the Async annotation, it throws this: java.lang.ClassNotFoundException: org.apache.commons.collections.map.ReferenceMap My trouble is not the exception itself, but why async method doesn't catch it?
score: 2
upvote count: 2
tagged with: java
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/24829507
has title: Spring Async method hides exceptions
answer count: 1
downvote count: 0
tagged with: asynchronous
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38605786
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24853841
type: Comment
has text: Thanks for answering. It doesn't really make sense to increase the wait timeout. It seems to be configured for 10 hours? That sounds strange. I checked the other suggestion to set 'autoReconnect=true'. From what I read, it seems that setting this property can cause other problems, what do you think?

http://stackoverflow.com/comment/38552296
has text: @NewbieGirl I would refer to you my answer. I don't believe you have the full solution.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24830945
type: QuestionComment

http://stackoverflow.com/comment/38504016
comment on: http://stackoverflow.com/a/24781011
score: 0
type: Comment
has text: Thanks again @Ignasi Barrera (+1) - OK here we go, please see my update iin the original question, it contains mmy `knife.rb` file. Here's the answer I need to give you the green check you so righteously deserve! : Based on the contents of my `knife.rb` file, what should the values be (in your code snippet above) for `client`, `validator`, `clientCredential` and `validatorCredential`? Thanks again here, *enormously*!
type: AnswerComment

http://stackoverflow.com/comment/38491961
score: 0
type: Comment
has text: You could generate a Map<Integer, Integer> for horizontal lines and vertical lines when you construct the grid. The key is the x/y position, the value the index or any object that represents your line. And then use the `event.getX()`and `event.getY()` to find the line
type: AnswerComment
comment on: http://stackoverflow.com/a/24797148

http://stackoverflow.com/a/24843182
has comment: http://stackoverflow.com/comment/38573801
type: Answer
has body: public void findFile(File dir){ for(File f: dir.listFiles()){ if(f.isDirectory()){ findFile(f); }else if(f.getName().endsWith(".db")){ System.out.prinltn(f.getName()); } } }
has comment: http://stackoverflow.com/comment/38574373
answers question: http://stackoverflow.com/q/24843117
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/61967780
has text: this is THE answer! :-) great, thanks for sharing. (myself, being too lazy to scroll all the way down to find your answer, I had to find out about the asPredicate the hard way :-))
type: AnswerComment
comment on: http://stackoverflow.com/a/31888916
score: 4
type: Comment

http://stackoverflow.com/comment/38575693
has text: 1) Pick a JSON kit for your language. 2) Construct the "tree" of objects from that kit to represent the structure of your desired JSON. In Java these objects will be Maps and Lists, or some set of classes which behave like Maps and Lists. 3) Tell the kit to "serialize" the constructed tree.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24843850
type: QuestionComment

http://stackoverflow.com/comment/38672606
comment on: http://stackoverflow.com/a/24894852
has text: Build Path only shows me -> Remove from build path, Configure output folder, Configure build path, Configure inclusion/exclusion filters. Thanks!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38576005
has text: Thank you, I right-clicked to the dependency in the dependency list of my web project and set the artifact manually(Pointed to compiled first-project.jar), now it works!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24844302
type: Comment

http://stackoverflow.com/comment/38616056
type: QuestionComment
has text: Thanks GameDroids. I tried putting a print statement and the output from the array list was null. So I'm guessing I'm not accessing the array list that I added questions to but an empty one. Still unsure how to access it :(
score: 0
comment on: http://stackoverflow.com/q/24864964
type: Comment

http://stackoverflow.com/comment/38522433
type: Comment
comment on: http://stackoverflow.com/a/24815037
score: 0
has text: It worked. I upgraded Eclipse to the 4.3 version and the errors were gone.
type: AnswerComment

http://stackoverflow.com/comment/38436960
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24769878
has text: yes, that's what I said: create a service (could be a singleton) that handles that map. You can access the service from anywhere and that service will "hide" the hashmap and expose only its functionalities.
type: Comment

http://stackoverflow.com/comment/38699257
score: 0
type: Comment
has text: I like it! Actually using this style you can get away without using mockito at all. Old school mocking. Sometimes it is much more straightforward then the mockito counterpart.
type: AnswerComment
comment on: http://stackoverflow.com/a/24884603

http://stackoverflow.com/comment/38585159
comment on: http://stackoverflow.com/a/24848922
type: Comment
score: 1
has text: How can EHcache help when writing to the DB is the bottleneck?
type: AnswerComment

http://stackoverflow.com/comment/38460997
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24783001
has text: http://crm-software-review.toptenreviews.com/ and http://stackoverflow.com/questions/4531321/open-source-crm-software-written-in-java

http://stackoverflow.com/comment/38403305
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24752580
has text: What is the error? BTW a compile error != a runtime exception != a crash.

http://stackoverflow.com/q/24806183
has comment: http://stackoverflow.com/comment/38505202
linked to: http://stackoverflow.com/q/38922754
score: 56
has comment: http://stackoverflow.com/comment/38504194
linked to: http://stackoverflow.com/q/5565052
accepted answer: http://stackoverflow.com/a/24806352
has body: I have been searching over the net from past few hours to get the datetime in my system timezone. When I use calendar.getTimezone.getDefaultName()it always returns me GMT. Ideally it should return my current timezone, which is IST. I am trying to convert this string "2014-02-14T06:04:00:00", which is in GMT to my timezone datetime. It always returns me the same time in GMT. All I see is that everyone is suggesting to use Timezone, i.e, dateFormatter.setTimezone("any_arbitary_timezone"); Point is my application will be used in different geographical locations. I cannot set it to a particular timezone. It should be set to the system timezone, so that it can display in whichever timezone the user is currently in.
upvote count: 57
tagged with: datetime
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/38505018
tagged with: timezone
tagged with: calendar
has comment: http://stackoverflow.com/comment/38509789
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24806352
has answer: http://stackoverflow.com/a/51701909
has title: Get date in current timezone in Java
possible better answer: http://stackoverflow.com/a/24808474
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/24808474
linked to: http://stackoverflow.com/q/2010284
type: Question
has answer: http://stackoverflow.com/a/24806471

http://stackoverflow.com/a/24858586
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24856192
answers question: http://stackoverflow.com/q/24856192
has body: If you examine the code closely, you will notice the Thread.sleep() was only being executed when the file had been updated since the last iteration. Whenever this was not true, i think it was being thrown into a wild endless loop of "write not updated timestamp" etc... endlessly. I moved the Thread.sleep() statement outside of both the if and else statements right before the end of the while } bracket and it now seems to execute wonderfully. Thank you guys for all your help.
score: 0

http://stackoverflow.com/a/24886927
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Have a look at this: http://en.wikipedia.org/wiki/Geoid For everyday purposes, you can use the spheric model. Geoid deformation starts in the higher latitudes, so unless you are into something very accurate, scientific or polar travel, you should be fine.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24886717
answers question: http://stackoverflow.com/q/24886717

jtextfield
tags question: http://stackoverflow.com/q/24811142
tags question: http://stackoverflow.com/q/24802523
tags question: http://stackoverflow.com/q/24850292
tags question: http://stackoverflow.com/q/24842068
tags question: http://stackoverflow.com/q/24899178
tags question: http://stackoverflow.com/q/24844559
tags question: http://stackoverflow.com/q/24836681
tags question: http://stackoverflow.com/q/24825841
tags question: http://stackoverflow.com/q/24849691
tags question: http://stackoverflow.com/q/24836853
tags question: http://stackoverflow.com/q/24858204
tags question: http://stackoverflow.com/q/24880068
tag name: jtextfield
type: Tag
tags question: http://stackoverflow.com/q/24906538

http://stackoverflow.com/a/34470627
answers question: http://stackoverflow.com/q/24773272
score: 0
has body: I was stuck with this error for a very long time. Adding some research I did before resolving this issue. Yes we need to remove libraries like jsp-api.jar, el-api.jar, servlet-api.jar from /WEB-INF/lib folder. But how? In my case I am using Apache Ivy as a dependency manger and used Spring MVC. It downloads all dependencies along with the libraries mentioned above. At runtime these conflicts with the APIs provided by Tomcat libraries. Simple solution would be to exclude these jars from dependencies or create configurations and include these libraries in compile time configuration only. What worked for me quickly is excluding these libraries. &lt;dependency org="org.springframework" name="spring-webmvc" rev="4.0.4.RELEASE"&gt; &lt;exclude org="javax.servlet" name="javax.servlet-api" /&gt; &lt;exclude org="javax.servlet.jsp" name="jsp-api" /&gt; &lt;exclude org="javax.el" name="javax.el-api" /&gt; &lt;/dependency&gt;
type: Answer

http://stackoverflow.com/q/24834736
has body: I just cant seem to get 3D collision to work properly, when I run my engine it thinks I am always colliding with something. The following is the loop that does something when collision occurs. Camera cam = new Camera(); Obj obj = new Obj(); Collision c = new Collision(obj); for(int i=0;i&lt;obj.triangles.size();i+=3) { if(c.triPntCol(obj.triangles.get(i), obj.triangles.get(i+1),obj.triangles.get(i+2), new Vector3f(cam.x,cam.y,cam.z))==true){ cam.x=cam.px; cam.y=cam.py; cam.z=cam.pz; } } Here is the method from the collision class. public boolean triPntCol(Vector3f a,Vector3f b,Vector3f c,Vector3f p ){//Triangle point collision. Vector3f v0=new Vector3f(c.x-a.x,c.y-a.y,c.z-a.z); Vector3f v1=new Vector3f(b.x-a.x,b.y-a.y,b.z-a.z); Vector3f v2=new Vector3f(p.x-a.x,p.y-a.y,p.z-a.z); float dot00= (v0.x*v0.x)+(v0.y*v0.y)+(v0.z*v0.z); float dot01= (v0.x*v1.x)+(v0.y*v1.y)+(v0.z*v1.z); float dot02= (v0.x*v2.x)+(v0.y*v2.y)+(v0.z*v2.z); float dot11= (v1.x*v1.x)+(v1.y*v1.y)+(v1.z*v1.z); float dot12= (v1.x*v2.x)+(v1.y*v2.y)+(v1.z*v2.z); float inv=1/((dot00*dot11)-(dot01*dot01)); float u=((dot11*dot02)-(dot01*dot12))*inv; float v=((dot00*dot12)-(dot01*dot02))*inv; if(u&gt;=0 &amp;&amp; v&gt;=0 &amp;&amp; u+v&lt;1){ return true; } else return false; } and finaly here is the code that loads in the 3D modles. public List&lt;Vector3f&gt; v = new ArrayList&lt;Vector3f&gt;(); public List&lt;Vector3f&gt; vn = new ArrayList&lt;Vector3f&gt;(); public List&lt;Vector2f&gt; vt = new ArrayList&lt;Vector2f&gt;(); public List&lt;Face&gt; face = new ArrayList&lt;Face&gt;(); public ArrayList color = new ArrayList&lt;&gt;(); public ArrayList colorFace = new ArrayList&lt;&gt;(); public ArrayList&lt;Vector3f&gt; triangles = new ArrayList&lt;Vector3f&gt;(); public Texture texture; public Obj(){ } public void load(File f,File mtl) throws IOException{//Gets data from obj and mtl files. BufferedReader reader = new BufferedReader(new FileReader(f)); BufferedReader reader2 = new BufferedReader(new FileRead…
tagged with: mesh
tagged with: java
tagged with: lwjgl
type: Question
tagged with: 3d
has comment: http://stackoverflow.com/comment/38558459
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38559596
has title: 3D Mesh Collision Java
tagged with: collision

http://stackoverflow.com/comment/38696450
score: 0
type: AnswerComment
type: Comment
has text: @Valan,I happy I could help. If my answer was helpful, then you may consider accepting it so future visitors will be helped as well.
comment on: http://stackoverflow.com/a/24843063

http://stackoverflow.com/a/24842854
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24842828
type: Answer
answers question: http://stackoverflow.com/q/24842828
has comment: http://stackoverflow.com/comment/38573299
has comment: http://stackoverflow.com/comment/38573281
upvote count: 3
score: 3
has body: You are concatenating strings but the different segments have no spaces, this could be causing keywords to be bunched together with your data creating invalid keywords. It is simple but this may be all you need: String addConstraint = "alter table ContactTable "+ "ADD CONSTRAINT FK_ContactTable_UserInfoTable "+ "FOREIGN KEY(UserInfoID) "+ "REFERENCES UserInfoTable (UserInfoID) "+ "ON UPDATE CASCADE "+ "ON DELETE CASCADE";
type: AcceptedAnswer

http://stackoverflow.com/q/24847622
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38582402
type: Question
has comment: http://stackoverflow.com/comment/38600083
tagged with: java
has body: I am new to programming in Java and am trying to compile a Java source file but I keep getting the following message when I type javac Welcome.java Welcome.java:5: error: cannot find symbol System.out.println("Welcome to Java!"); ^ symbol: method printIn&lt;String&gt; location: variable out of type PrintStream 1 error any ideas on how to correct this? Thanks.
accepted answer: http://stackoverflow.com/a/24847730
score: 0
has comment: http://stackoverflow.com/comment/38582504
upvote count: 1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24847730
favorite count: 0
has comment: http://stackoverflow.com/comment/38582396
tagged with: javac
has comment: http://stackoverflow.com/comment/38600806
has comment: http://stackoverflow.com/comment/38582398
has title: new to programming in Java - issues with Javac

http://stackoverflow.com/a/24759111
type: Answer
has comment: http://stackoverflow.com/comment/38442926
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24755303
answers question: http://stackoverflow.com/q/24755303
score: 0
has body: ClassNotFoundException is pretty clear (and ought to be familiar to anyone using Java). You don't have the specified class in your CLASSPATH, so include the jar that provides that class. Suggest that this is likely http://central.maven.org/maven2/javax/resource/javax.resource-api/1.7/

http://stackoverflow.com/comment/38513906
type: Comment
type: QuestionComment
has text: `for (People person : people) { ....}`, but surely you've looked this up, no?
score: 4
comment on: http://stackoverflow.com/q/24811229

http://stackoverflow.com/comment/38654058
type: QuestionComment
score: 0
has text: I also tried to use Native.synchronizedLibrary, but the result is the same...
type: Comment
comment on: http://stackoverflow.com/q/24823595

http://stackoverflow.com/comment/38552539
type: QuestionComment
score: 0
has text: Put textview in LinearLayout
type: Comment
comment on: http://stackoverflow.com/q/24831477

http://stackoverflow.com/q/24886138
type: Question
tagged with: hadoop
score: 3
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How to mix Hadoop ChainMapper with MultipleInputs
has body: I have hadoop job that joins two types of entities. The map step does some filtering, calculations and produces proper key-value records for later join. Hadoop MultipleInputs works fine in that case. The part of the map logic can be reused in another context, so I am looking for a solution to chain different mappers. The default one I see is ChainMapper. However I am not yet clear how can I mix it with MultipleInputs having separate chain for each input. Please let me know if smb faced the same issue and has some thoughts, ideas or even examples on how to achieve that. Thank you! I keep going through Hadoop source and it looks like each Mapper in ChainMapper is run in a separate thread. This looks like overhead in my case. It would be enough if context.write in first mapper directly calls map method in the second. Example: There are monkeys and bananas at a location. class Banana { location class mature } class Monkey { location type } YellowBananaMapper { filter out non yellow } MatureBananaMapper { filter out non mature } BananaByLocation { map banana to location -&gt; banana } MonkeyByLocation { map monkey to location -&gt; monkey } If I have question: Where are enough yellow bananas for monkeys? I would do: Monkeys: MonkeyByLocation; Bananas: YellowBananaMapper -> BananaByLocation. If I am asked to list yellow mature bananas, I would do: Bananas: YellowBananaMapper -> MatureBananaMapper. PS. I've read about Pig and Hive and this is not a solution in my case as I am forced to use java MR jobs.
answer count: 0
upvote count: 3
tagged with: java
tagged with: mapreduce

http://stackoverflow.com/comment/38570876
type: QuestionComment
comment on: http://stackoverflow.com/q/24840153
score: 0
has text: No, How can it be done ?
type: Comment

http://stackoverflow.com/comment/38472483
comment on: http://stackoverflow.com/a/24787036
has text: @Mo. write a file to HDFS then, there is no built-in facily to easily make this possible.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38471399
type: QuestionComment
comment on: http://stackoverflow.com/q/24788435
has text: Return it as an array of type `int`
score: 1
type: Comment

http://stackoverflow.com/comment/38478073
has text: Well, that's two firsts in quick succession :) Glad to be of service!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24789799
type: AnswerComment

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/24900868
type: Tag

http://stackoverflow.com/comment/38514188
score: 1
has text: Is this really a compiler warning? I didn't think the compiler cared. My IDE gives me this warning.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24811229

http://stackoverflow.com/q/24876323
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18571223
has comment: http://stackoverflow.com/comment/38637703
tagged with: java
has comment: http://stackoverflow.com/comment/38638434
has comment: http://stackoverflow.com/comment/38637816
has body: How do I convert a String written as Binary, to binary (in byte array)? If I have a String: String binary = "0000" I want the binary data to be 0000. below is what happens when I set the binary to a byte array (which in turn returns 48, which is ASCII) Binary String: 0000 Binary Byte array: 48 Binary Byte array: 48 Binary Byte array: 48 Binary Byte array: 48 I'm not good at explaining so hopefully the above example was enough to tell you what I want. EDIT: This is to set the data into a binary file.
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24876401
upvote count: 5
tagged with: arrays
has comment: http://stackoverflow.com/comment/38637784
has comment: http://stackoverflow.com/comment/38637841
possible better answer: http://stackoverflow.com/a/24876372
score: 4
accepted answer: http://stackoverflow.com/a/24876401
has answer: http://stackoverflow.com/a/24876372
has comment: http://stackoverflow.com/comment/38637583
has comment: http://stackoverflow.com/comment/38637614
has answer: http://stackoverflow.com/a/24876417
has comment: http://stackoverflow.com/comment/38637536
has answer: http://stackoverflow.com/a/25699484
tagged with: string
favorite count: 0
has title: Convert Binary String to Binary
tagged with: binary
has comment: http://stackoverflow.com/comment/38637992
has comment: http://stackoverflow.com/comment/38637780

http://stackoverflow.com/a/30976972
type: Answer
score: 13
upvote count: 13
answers question: http://stackoverflow.com/q/24885223
downvote count: 0
has body: As far as I understand MLProgrammer-CiM answer, simply it's possible to just do this: class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ private ImageView image; private TextView title; private TextView price; public MyViewHolder(View itemView) { super(itemView); image = (ImageView)itemView.findViewById(R.id.horizontal_list_image); title = (TextView)itemView.findViewById(R.id.horizontal_list_title); price = (TextView)itemView.findViewById(R.id.horizontal_list_price); image.setOnClickListener(this); title.setOnClickListener(this); price.setOnClickListener(this); } @Override public void onClick(View v) { Toast.makeText(context, "Item click nr: "+getLayoutPosition(), Toast.LENGTH_SHORT).show(); } }

http://stackoverflow.com/comment/38672763
has text: @asrivat1 For some reason I didn't see `IEgg`. Updated.
type: Comment
comment on: http://stackoverflow.com/a/24894971
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38572532
type: QuestionComment
has text: @azurefrog- I'm just checking firstly row wise then column wise from i=0 to width/height of the matrix. if (i * m || i*n == T) then return i; My solution is not covering each cases.
comment on: http://stackoverflow.com/q/24842426
score: 0
type: Comment

http://stackoverflow.com/comment/38574352
has text: @BrettOkken edited the question and added snippet of what I tried with org.apache.commons.io.FileUtils
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24843117
type: QuestionComment

http://stackoverflow.com/comment/38593590
comment on: http://stackoverflow.com/a/24853378
type: AnswerComment
score: 0
type: Comment
has text: Hmm...can you give me some reference or link to read more about connection pools and how to implement them in Java?

http://stackoverflow.com/comment/38696724
type: Comment
type: QuestionComment
has text: To have embedded tomcat with in my application for web apps.
score: 0
comment on: http://stackoverflow.com/q/24906778

http://stackoverflow.com/comment/38676804
has text: The import is found, you would have a compile error otherwise. It is more likely to be a packaging issue.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24897192
type: Comment

http://stackoverflow.com/a/24755684
answers question: http://stackoverflow.com/q/24755500
upvote count: 1
has body: You should use a technical id for your product and not the name of the product as the identifier. There might be two products with the same name or products that change their name. But if you want you could just leave out the generator and always set the name to a unique value before saving. Add a number column, a Long member variable and the appropriate mapping for your technical Id and everything should work. You still can use a index for faster fetching or a unique constraint if you want. As an alternative you could write your own generator if there is a automatic way to generate unique product names. See this answer.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/46252754
type: Comment
has text: Can someone delete the 10 m's that I added. There was a 4 character change I made `usernamename -> username` that didn't meet the 6 character limit. So I thought by adding extra characters, and then deleting them in a separate edit would be a clever way around the rule. Well it wasn't. Sorry about that.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24838420

http://stackoverflow.com/a/25172024
accepted answer of: http://stackoverflow.com/q/24800467
score: 0
answers question: http://stackoverflow.com/q/24800467
type: AcceptedAnswer
has body: RecommenderIRStatsEvaluator user_eval = new GenericRecommenderIRStatsEvaluator(); RecommenderBuilder user_rb = new RecommenderBuilder() { @Override public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity user_ll_sim = new LogLikelihoodSimilarity(model); UserNeighborhood user_ll_nbhd = new NearestNUserNeighborhood(5, user_ll_sim, model); return new GenericUserBasedRecommender(model, user_ll_nbhd, user_ll_sim); } }; IRStatistics user_ll_stats = user_eval.evaluate(user_ll_rb, null, model, null, 2, GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD, 0.8); System.out.println(user_ll_stats.getPrecision()+" "+user_ll_stats.getRecall()); Replace the User Based LogLikelihood model with the SVD one.
type: Answer

http://stackoverflow.com/q/24809514
tagged with: shrink
possible better answer: http://stackoverflow.com/a/30811861
tagged with: obfuscation
has body: Typically, excluding a class with -keep prevents the class from being obfuscated However it also prevents it from being shrunk. Is it possible to define a proguard-project.txt that will shrink all classes except those that are excluded with -keep, but also obfuscate only a specific subset of the classes? The aim is to use proguard to keep below the android 65k method limit, while also obfuscating first party code ONLY within the APK. Thanks
favorite count: 0
tagged with: proguard
has title: Can we shrink all classes but only obfuscate some with proguard?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24855896
type: Question
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/59248681
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/30811861
accepted answer: http://stackoverflow.com/a/24855896
tagged with: android

http://stackoverflow.com/a/24792175
type: Answer
accepted answer of: http://stackoverflow.com/q/24767461
answers question: http://stackoverflow.com/q/24767461
has body: Like Voicu says above, I was recieving OOM errors because my drawables are in the wrong folder. I was browsing the internet last night, and found this question deep in the google results: Android setBackgroundResource cause out of memory excepiton Where, he described how he moved his images from the drawable folder to the drawable-nodpi folder and it solved all of his OOM problems. So I tried it for my app, and it worked as well. However, Images do look a bit different, so to figure out why this works, let us quote some of the Android documentation: "The resources in drawable/ are the default drawable resources. The system assumes that default resources are designed for the baseline screen size and density, which is a normal screen size and a medium density. As such, the system scales default density resources up for high-density screens and down for low-density screens, as appropriate." So, in my case, I was putting "HD" images for an "HD" Phone in the folder meant for "SD" images and phones since that what drawables/ defaults too. So in turn, it would scale all of my "HD" images bigger than they actually were and needed to be, which not only made them look worse, but also would make them use WAY more memory on the heap causing OOM (Out of Memory) Errors in my app. For more info on the drawables folder and DPI see this link of Android Docs: http://developer.android.com/guide/practices/screens_support.html P.S Unbind Drawables in OnDestroy() of every activity does help with memory, so If you are having any memory problems I suggest you try this. And with this call, people often call System.gc() after, which does help, but it is bad coding practice. But in my situation it was specifically the /drawables thing. Also, I stumbled upon tinypng.com to reduce PNG sizes, it does not help with OOM errors at all, but it does reduce your apk size, so I suggest you do this for your games and things since it lessens the file size with almost no noticeable difference.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38707562
comment on: http://stackoverflow.com/q/24902301
score: 0
has text: if you are looking for java api unfortunately currently there is none except the one you mentioned
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38532911
has text: It seems to have swallowed my explanation. I want to extract specific variables (e.g. Company_Name, Job Title, etc.) and import them into an SQL-DB (later). Can you give me an example of how to use your code? `span[itemprop=\"name\"]` I don't get that part for instance. I tried this, which looks stupid to me =) `File input = new Elements jobListingElements = ParseResult.select(".joblisting"); for (Element jobListingElement: jobListingElements) { jobListingElement.select(".companyName span[itemprop=\"name\"]"); System.out.println(jobListingElements);`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24820859
type: Comment

http://stackoverflow.com/a/24811014
type: Answer
has body: For information on how your FFT output data is represented look at the JTransforms documentation HERE For RealForwardFull the output is the Full FFT data the usual way, i.e N-Complex numbers, with the real and imaginary components interleaved. For RealForward the output is arranged as follows: -The first two elements are the real components of the first ( k = 0 ) and the middle ( k = N/2 ) FFT coefficients respectively, the rest of the FFT coefficients are then given after that with the real and imaginary components interleaved. Like Oli CharlesWorth has mentioned, the imaginary component of the k = 0 and k = N/2 terms will be zero because the input signal is real, so Realforward does not return them.It only returns the minimum information enough for you to be able to reconstruct the full spectrum.
score: 0
answers question: http://stackoverflow.com/q/24809836

http://stackoverflow.com/comment/38617560
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24865670
score: 0
has text: ((DefaultTableModel)searchListTable.getModel()).removeRow(selIndex); I have used this now. But it is asking for integer type..and selIndex is String array.

http://stackoverflow.com/comment/38425929
type: Comment
has text: I need to fetch the binary data from a file and print the data 16 bytes line by line is it possible by using append method or any other suggestions.
comment on: http://stackoverflow.com/a/24762267
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38615869
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24860817
has text: @LucaBassoRicci I have added a disclaimer as the first sentence of this answer. I am trying to be as helpful as I can, and apparently my answer has indeed helped OP.
score: 0

heaps-algorithm
tags question: http://stackoverflow.com/q/24889201
type: Tag
tag name: heaps-algorithm

http://stackoverflow.com/a/24775965
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24766682
type: Answer
answers question: http://stackoverflow.com/q/24766682
downvote count: 0
score: 2
has body: Create field (e.g. invalidEmails) with getter and setter in your EmailListValidator and assign invalid emails to it. In validation xml file you can access this property by using ${...} notation. ${getText("validation.reqEmail.valid")}: ${invalidEmails}

communication
tag name: communication
type: Tag
tags question: http://stackoverflow.com/q/24758072

http://stackoverflow.com/q/24799904
has body: I am new to android and i need a littel help, i am trying to call json webservice but i always gets null pointer exception. below is my code Method name: AuthorizeAndLoginWithVinlite public String readJSON(String strURL) throws Exception { strURL = "https://www.vinlite.com/DesktopModules/Vinlite/API/MobileService/"; HttpClient httpClient = new DefaultHttpClient(); String Content; String Error = null; URI url = new URI(strURL); HttpPost httpost = new HttpPost(url); //Content = sb.toString(); StringBuilder stringBuilder = new StringBuilder(); Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put(new String("VINLITEAPPID"), "Vin1.0"); params.put(new String("VINLITEAPPSECRET"), "AppTest-Vin"); params.put(new String("portalID"), "0"); params.put(new String("DEVICETOKEN"), "ECF3392D-30D7-466B-9BBB-AD"); params.put(new String("DEVICEPLATFORM"), "IOS"); params.put(new String("VinliteUsername"), "test@yahoo.com"); params.put(new String("VinlitePassword"), "test"); JSONObject holder = getJsonObjectFromMap(params); //passes the results to a string builder/entity StringEntity se = new StringEntity(holder.toString()); //sets the post request as the resulting string httpost.setEntity(se); //sets a request header so the page receving the request //will know what to do with it httpost.setHeader("Accept", "application/json"); httpost.setHeader("Content-type", "application/x-www-form-urlencoded"); try { HttpResponse response = httpClient.execute(httpost); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream inputStream = entity.getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(inputStream)); String line; while ((line = reader.readLine()) != null) { stringBuilder.append(line); } inputStream.close(); } else { Log.d("JSON", "Failed to download file"); } } catch (Exception e) { Log.d("readJSONFeed", e.getLocali…
answer count: 1
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24800084
type: UnansweredQuestion
tagged with: web-services
has title: Call json webservice in android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/q/24864487
downvote count: 1
has comment: http://stackoverflow.com/comment/38614722
has comment: http://stackoverflow.com/comment/38614695
has answer: http://stackoverflow.com/a/24864603
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38625967
has comment: http://stackoverflow.com/comment/38614579
upvote count: 0
has comment: http://stackoverflow.com/comment/38615930
favorite count: 0
tagged with: android-volley
type: Question
has body: I have the following code: String response1; StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener&lt;String&gt;() { @Override public void onResponse(String response) { response1 = response; //This log gives result Log.d("volley", response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.d("volley", error.toString()); } }); requestQueue.add(stringRequest); //This log give null pointer exception Log.d(TAG, response1); //How I can make sth like this: String [] data = doSthWithThisValue(response1) As described in the code the the variable response1 gives result inside Response.Listener class. I want to use this value outside this inner class. How I can do this? I have read some posts to declare the variable as final
has comment: http://stackoverflow.com/comment/38622255
tagged with: android
score: -1
has answer: http://stackoverflow.com/a/24864669
has title: Persist Variable value from inner class to the outside world
answer count: 2

http://stackoverflow.com/comment/38500530
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24804205
has text: You will have to do that for all of the solutions
score: 0

http://stackoverflow.com/comment/54683511
type: QuestionComment
type: Comment
has text: Try using the solution on this link [android-multi-line-linear-layout](http://stackoverflow.com/questions/6996837/android-multi-line-linear-layout)
score: 0
comment on: http://stackoverflow.com/q/24903499

http://stackoverflow.com/a/24802266
upvote count: 3
answers question: http://stackoverflow.com/q/24802155
has comment: http://stackoverflow.com/comment/38496782
has comment: http://stackoverflow.com/comment/38498139
has comment: http://stackoverflow.com/comment/38497850
has comment: http://stackoverflow.com/comment/38496833
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38497284
has comment: http://stackoverflow.com/comment/38497201
has comment: http://stackoverflow.com/comment/38496990
has body: I think this should work as is, but depending a bit on how you instantiate the CircleDescriber. This should work: new CircleDescriber&lt;Circle&gt;().describe(circle); The reason that this does not compile is that you have the test method inside the CircleDescriber, with a call to this. Since the compiler does not know the generic parameter of this, it can't say for sure that passing a Circle to it will work (what if this refers to a CircleDescriber parameterized to a subclass of Circle?) Change this with new CircleDescriber&lt;Circle&gt;() in your test-method, and it shold compile. But, here you see that you are actually specifying that you are describing a Circle twice, both in the class name and in the generic parameter. This should not be necessary, at least as long as Circle is a leaf node in your hierarchy. Instead, do this: (Keep ShapeDescriber as is) public class CircleDescriber extends ShapeDescriber&lt;Circle&gt; { @Override public void describe(Circle circle) { super.describe(circle); System.out.println("Its radius is " + circle.getRadius()); } }
has comment: http://stackoverflow.com/comment/38497455
score: 3
has comment: http://stackoverflow.com/comment/38497642
type: Answer
accepted answer of: http://stackoverflow.com/q/24802155

http://stackoverflow.com/a/26431247
answers question: http://stackoverflow.com/q/24824387
upvote count: 2
type: Answer
has body: tl;dr Just run each script in a separate process. Options for running withing the same process There's a couple of things to look at. The first would be to put each script into it's own classLoader that has the Extensions ClassLoader or maybe even the Bootstrap classloader as it's parent. This is to control the groovy script's access to your application's classes. Monitoring the execution time is easy. Just run each script in it's own thread and interrupt the thread if it goes over the 3 second limit. Keep in mind, though, that interrupting the thread simply raises an InterruptedException, which can be caught and handled within that thread. It's not easy to stop a thread if the code is designed to recover from those exceptions. The memory part is where things really fall apart. This answer pretty much says everything that needs to be said about that - not possible. Somebody could easily run you out of heap space and crash the jvm. Running in their own processes Ultimately, I would really recommend just running each one in a separate process. There's a couple of benefits to this, not the least of which being that it's way easier to sandbox them by taking advantage of running them as a separate user. That way you can get another level of protection from the OS. Also, if you want to pass exceptions back to the main java process, this can be done pretty easily because Exception implements Serializable. This means that you can easily send the Exception back to the main process over a SocketChannel, or by http, serializing to a file, or using whatever protocol you want. Take a look at this article for some basic info in Serialization.
score: 2
downvote count: 0

http://stackoverflow.com/comment/38411281
type: Comment
has text: Refer to [this](http://stackoverflow.com/questions/6218143/android-post-json-using-http). You are getting the exception because your `HTTP GET` params are too long. Yes, `HTTP GET`, because that's how you supply the params. Also, this is a duplicate of given link.
type: QuestionComment
comment on: http://stackoverflow.com/q/24756748
score: 0

http://stackoverflow.com/q/24840095
has comment: http://stackoverflow.com/comment/38568455
has comment: http://stackoverflow.com/comment/38567865
has comment: http://stackoverflow.com/comment/38567851
score: 0
tagged with: printing
answer count: 2
has answer: http://stackoverflow.com/a/24840132
has body: i need to print an array but it only prints the last info i entered that's the printing code for(int i=0; i&lt;undergrad.length;i++){ if(undergrad[i]!=null){ System.out.println("Student Name : "+undergrad[i].getName()+"\n" + "Full Address : "+undergrad[i].getAddress()+"\n" + "Mobile No :"+undergrad[i].getPhone()+"\n" + "Number of Tests : "+undergrad[i].getTests()+"\n" + "GBA : "+undergrad[i].GBA()+"\n" + "Status : "+undergrad[i].computeGrade()+"\n" + "Internship : "+undergrad[i].getInternship()+"\n" + "Project Title : "+undergrad[i].getProject_Title()+"\n" + "Project Area : "+undergrad[i].getProject_Area()+"\n" + "Project Score : "+undergrad[i].computeProjectGrade()+"\n" + "****************************************\n"); } } the array of objects is of size 10 but i might put info in less than 10 (for example 4) and when i print i need to show all and only the 4 i entered thats the adding part for(int i=0; i&lt;undergrad.length; i++){ undergrad[i]=new Undergraduate(); System.out.println("Enter Student Name: "); undergrad[i].setName(in.nextLine()); System.out.println("Full Address : "); undergrad[i].setAddress(in.nextLine()); System.out.println("Mobile No : "); undergrad[i].setPhone(in.nextLong()); System.out.println("Number of test : "); undergrad[i].setTests(in.nextInt()); tests=undergrad[i].getTests(); for(int j=0; j&lt;tests; j++){ System.out.println("Test "+(j+1)+":"); undergrad[i].setScores(in.nextInt(), j); } System.out.println("Internship: "); undergrad[i].setInternship(in.nextBoolean()); in.nextLine(); System.out.println("Project title: "); undergrad[i].setProject_Title(in.nextLine()); System.out.println("Project Area: "); undergrad[i].setProject_Area(in.nextLine()); System.out.println("Supervisor Grade: "); undergrad[i].setGrade(in.nextInt(), 0); System.out.println("Committee Grade: "); undergrad[i].setGrade(in.nextInt(), 1); System.out.println("\n"); break; } i need the break because the user should be asked about the action he want to do after entering detai…
has answer: http://stackoverflow.com/a/24840170
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24840170
accepted answer: http://stackoverflow.com/a/24840132
has comment: http://stackoverflow.com/comment/38567822
tagged with: arrayobject
has comment: http://stackoverflow.com/comment/38567843
type: Question
has title: cant print the whole array
has comment: http://stackoverflow.com/comment/38568059

visualization
tags question: http://stackoverflow.com/q/24891821
tag name: visualization
type: Tag

http://stackoverflow.com/a/24757055
score: 1
upvote count: 1
downvote count: 0
has body: You cannot get NPE where you are pointing. while(rs.next()) this line will throw NPE if and only if the variable rs is null. And the javadoc says: executeQuery() returns a ResultSet object that contains the data produced by the given query; never null` Hence, after rs=stmt.executeQuery(); the variable rs cannot be null. The source of the NPE could be somewhere else in the code but not the condition in while loop.
type: Answer
answers question: http://stackoverflow.com/q/24756819

http://stackoverflow.com/a/69753473
answers question: http://stackoverflow.com/q/24832614
score: 0
has body: I am getting a UTF-16 encoded response and after each simple character in the byte[] there is a ((CTRL-CHAR, code 0)) see screen. it work for me: StringUtils.toEncodedString(responseBodyAsByteArray, StandardCharsets.UTF_16LE)
type: Answer

http://stackoverflow.com/comment/38439076
type: Comment
type: QuestionComment
has text: @shazin Well indeed this is not certain and :) this is not the real problem, for ur comment i have tried with different cases, Hibernate Generates SQL in the order the objects are saved...
comment on: http://stackoverflow.com/q/24771253
score: 0

http://stackoverflow.com/q/24878314
has comment: http://stackoverflow.com/comment/38641765
has comment: http://stackoverflow.com/comment/38641646
has body: I have been studying a bit of Java and C++ more or less at the same time and I noticed that Java has a more friendly and intuitive way of interpreting the OOP than the C++ way. Yes, Java is completely OO and, on the other hand, C++ supports many paradigms, but this doesn't mean that C++ couldn't improve its way of implementing the OO paradigm. C++ supports multiple inheritance and Java translated it with multiple implementation (interfaces), which I find really intuitive and simple (I don't think that this is just an opinion). My first question is in the title. I think that C++ would be more friendly, without losing practically a bit of its power. It's a question of improving a extraordinary programming language, which however is not perfect. My second question is: what are the advantages of multiple inheritance compared to the interfaces of Java programming language (if any)?
tagged with: multiple-inheritance
has comment: http://stackoverflow.com/comment/38655026
has comment: http://stackoverflow.com/comment/38655123
has comment: http://stackoverflow.com/comment/38641614
has comment: http://stackoverflow.com/comment/38641319
has comment: http://stackoverflow.com/comment/38641737
possible better answer: http://stackoverflow.com/a/24878530
score: 0
linked to: http://stackoverflow.com/q/4041447
has comment: http://stackoverflow.com/comment/38641531
answer count: 3
has comment: http://stackoverflow.com/comment/38641464
has comment: http://stackoverflow.com/comment/38641717
has comment: http://stackoverflow.com/comment/38641724
favorite count: 0
upvote count: 2
tagged with: interface
downvote count: 2
has comment: http://stackoverflow.com/comment/38641273
tagged with: c++
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24878530
has answer: http://stackoverflow.com/a/24878549
accepted answer: http://stackoverflow.com/a/24878549
tagged with: java
has title: Is there a possibility that C++ multiple inheritance might be replaced with the Java interfaces?
has comment: http://stackoverflow.com/comment/38641289
type: Question
has comment: http://stackoverflow.com/comment/38641866
has answer: http://stackoverflow.com/a/24879251
has comment: http://stackoverflow.com/comment/38641475

http://stackoverflow.com/q/24757711
has comment: http://stackoverflow.com/comment/38412744
answer count: 1
has comment: http://stackoverflow.com/comment/38412973
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
has body: I have bean which has to be binded at run time. <constructor-arg ref="${requiredBean:mysql}"/> In the property file I added the property requiredBean=mongo But due to some reason the requiredBean from the properties file is not picked up by the spring (The properties file is configured correctly and all other properties are loading properly except for this one). I just want to know if the syntax that I used for declaring the arg for constructor aa ref is right or is there any other way to declare it. Pls help me to resolve this. Let me know if the question is not clear.
has comment: http://stackoverflow.com/comment/38413304
accepted answer: http://stackoverflow.com/a/24758128
has comment: http://stackoverflow.com/comment/38412672
type: Question
has comment: http://stackoverflow.com/comment/38412890
has comment: http://stackoverflow.com/comment/38413923
has title: constructor-arg ref from properties in spring
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24758128
has comment: http://stackoverflow.com/comment/38412818
upvote count: 1

http://stackoverflow.com/q/24854927
upvote count: 7
type: Question
score: 5
has answer: http://stackoverflow.com/a/24854936
has answer: http://stackoverflow.com/a/24854954
favorite count: 0
has answer: http://stackoverflow.com/a/24854969
has title: What is a resource in java?why we have to close it after it is used?
type: UnansweredQuestion
downvote count: 2
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/38596721
has comment: http://stackoverflow.com/comment/38596763
answer count: 4
has answer: http://stackoverflow.com/a/24854933
has comment: http://stackoverflow.com/comment/84973464
has body: What is the meaning of the word "resource" in java? Why we have to close it after usage,even though garbage collector runs in jvm ? Why we have to write resource cleanup code in finally block?
tagged with: java

http://stackoverflow.com/q/24905235
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24958910
has body: I want to delete a specific queue when consumer's down time in activemq. I don't want to send queue message when consumer available time.Give me some suggestions.Thanks in advance. This is my publisher class public class MessageHandler implements MessageListener { private static String url = "tcp://localhost:61616"; private Session session; private MessageProducer producer; private MessageConsumer consumer; private Connection connection; private Map&lt;String, String&gt; messageStatus = new HashMap&lt;String, String&gt;(); public void setup(String systemCode, String funCode, boolean synchronous) { try { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); if(synchronous) { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(false, Session.SESSION_TRANSACTED); } else { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } Destination requestQueue = session.createQueue(systemCode + "-" + funCode + "-request"); producer = session.createProducer(requestQueue); Destination responseQueue = session.createQueue(systemCode + "-" + funCode + "-response"); consumer = session.createConsumer(responseQueue); consumer.setMessageListener(this); } catch(JMSException e) { throw new RuntimeException("Failed to initialize MessageHandler", e); } } public String sendMessage(String parameter) { String response = null; try { TextMessage message = session.createTextMessage(parameter); String messageId = UUID.randomUUID().toString(); message.setJMSCorrelationID(messageId); producer.send(message); boolean carryon = true; long start = System.currentTimeMillis(); long end = start + 10 * 1000; while (System.currentTimeMillis() &lt; end &amp;&amp; carryon) { if(checkStatus(messageId)) { carryon = false; } } response = getMessage(messageId); stop(); } catch(JMSException e) { try { stop(); } catch (JMSException e1) { throw new Run…
possible better answer: http://stackoverflow.com/a/24911842
has answer: http://stackoverflow.com/a/24958910
downvote count: 0
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38695967
score: 2
has title: Delete specific queue when client's idle time in activemq
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24911842
tagged with: activemq-classic
tagged with: java

http://stackoverflow.com/a/24882930
score: 1
has comment: http://stackoverflow.com/comment/38649693
answers question: http://stackoverflow.com/q/24882752
has body: You do not have TextView in activity_my.xml text = (TextView)findViewById(R.id.text);
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38496332
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24801463
score: 0
has text: v.toString(),consider it.....

http://stackoverflow.com/q/24839254
possible better answer: http://stackoverflow.com/a/24839434
answer count: 3
accepted answer: http://stackoverflow.com/a/24839465
has title: Set dimensions (number lines) of JTextArea (Java Swing)
has answer: http://stackoverflow.com/a/24839434
has comment: http://stackoverflow.com/comment/38566514
has comment: http://stackoverflow.com/comment/38566366
has body: Here's a code of a silly application for data entry. I would like that the "oggetto" JTextArea to have a size so that the user can enter different lines of information: JPanel body = new JPanel(); body.setLayout(new GridLayout(10, 1)); body.add(new JLabel("Inserimento di un nuovo protocollo")); JTextArea oggetto = new JTextArea(5,1); oggetto.setOpaque(true); oggetto.setBackground(Color.cyan); //oggetto.setSize(100, 100); ... body.add(oggetto); jframe.add(body); jframe.setVisible(true); I've tried many ways to make it but when I launch the app I only get a "oggetto" jtextarea of a unique line... can you help me?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24839465
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/38566428
has answer: http://stackoverflow.com/a/24839461
linked to: http://stackoverflow.com/q/7229226
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/24834815
tags question: http://stackoverflow.com/q/24807170
tags question: http://stackoverflow.com/q/24889323
tags question: http://stackoverflow.com/q/24781899
tags question: http://stackoverflow.com/q/24814895
tags question: http://stackoverflow.com/q/24878250
tags question: http://stackoverflow.com/q/24755080
tag name: tcp

http://stackoverflow.com/q/24772297
upvote count: 1
has comment: http://stackoverflow.com/comment/38440578
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38440411
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38440379
accepted answer: http://stackoverflow.com/a/24772444
tagged with: java
has title: Do I need multiple classes to make a poker program with 1 user?
type: Question
has body: I am working on a poker program. It should deal 5 cards, allow the user to replace up to 3 cards. and then it will evaluate the hand and give points for the different hands, ex: a pair = 1 point, 2 pair = 2 points etc. I have written out a basic outline of how I think it should go, but I am really struggling with actually putting it in to code. I just have a couple of questions to help get me started Do I need to do multiple classes, EX: a deck class, a card class, a hand class? Or can I just do a poker class and just have separate methods? Here is what I have so far. Next I am thinking I can make public class Poker { private int rank, suit; private static String[] suits = { "hearts", "spades", "diamonds", "clubs" }; private static String[] ranks = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" }; I'm not really sure where to go from here, or if this is even a good start? Any suggestions?
has answer: http://stackoverflow.com/a/24772444
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/38440409

http://stackoverflow.com/comment/38685197
type: Comment
type: QuestionComment
has text: @bgossit Sorry about late response. What you mean by configuration of `SampleResource`? I'll put my `SampleResource` class.
score: 0
comment on: http://stackoverflow.com/q/24817877

http://stackoverflow.com/a/24865493
answers question: http://stackoverflow.com/q/24863864
has body: Another way that was not mentioned here is the use of a char object. String quote1 = (char)'"'; String quote2 = (char)34;
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/24865296
answers question: http://stackoverflow.com/q/24865229
type: Answer
has body: instead of private Runnable myCallback; use private StringRunnable myCallback;
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/q/24778123
answer count: 1
has body: I've a BIRT report which is linked to a DataSource. I want to have a checkbox with Yes &amp; No value and based on one field of Checkbox, i want to generate report in which either Yes or No is checked based on the value of DataSource's field. I am trying to get the value and then putting it under IF loop and checing if it is true, then i want a image to be displayed in that field where YES is written(over YES) I'm new to BIRT report.Please tell me how to do it. I have no clue
has comment: http://stackoverflow.com/comment/38451683
favorite count: 0
has title: BIRT Reporting: Image Display
upvote count: 0
has comment: http://stackoverflow.com/comment/38451094
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38451355
has comment: http://stackoverflow.com/comment/38456200
tagged with: birt
tagged with: java
has answer: http://stackoverflow.com/a/24883671
type: Question
has comment: http://stackoverflow.com/comment/38451286
downvote count: 2
score: -2

http://stackoverflow.com/a/24757607
has comment: http://stackoverflow.com/comment/38457575
has body: The default Groovy behaviour is not to compile the code with the same bytecode version as the JDK being used. 1.5 is the default for compatibility reasons, IMHO. If you want the compiler to output newer bytecode you need to set that explicitly. For example if you're using Maven to compile the code, you can use the GMavenPlus plugin. See the description of the targetBytecode parameter. If you're not using Maven you can use -Dgroovy.target.bytecode=1.7 or research the possibilities for your particular build tool
has comment: http://stackoverflow.com/comment/38428429
type: Answer
has comment: http://stackoverflow.com/comment/38454748
answers question: http://stackoverflow.com/q/24757103
score: 7
has comment: http://stackoverflow.com/comment/38469301
upvote count: 7
has comment: http://stackoverflow.com/comment/38428104
has comment: http://stackoverflow.com/comment/38430700
has comment: http://stackoverflow.com/comment/38428505
has comment: http://stackoverflow.com/comment/38421532
has comment: http://stackoverflow.com/comment/38420942
has comment: http://stackoverflow.com/comment/38463515
downvote count: 0
has comment: http://stackoverflow.com/comment/38428194

http://stackoverflow.com/comment/38709858
type: Comment
score: 0
has text: ..thank u for quick reply... Im trying to figure out the code given for Rest API, which language can we use to implment this. can we use powershell or does Ant script has the ability to take this.... `GET /api/build { "uri": "http://localhost:8080/artifactory/api/build" "builds" : [ { "uri" : "/wicket", "lastStarted" : ISO8601 (yyyy-MM-dd'T'HH:mm:ss.SSSZ) }, { "uri" : "/jackrabbit", "lastStarted" : ISO8601 (yyyy-MM-dd'T'HH:mm:ss.SSSZ) } ] }`
type: AnswerComment
comment on: http://stackoverflow.com/a/24892058

http://stackoverflow.com/a/25369066
answers question: http://stackoverflow.com/q/24840667
score: 5
downvote count: 0
type: Answer
has body: Assuming that you are asking for standard Unicode emoji ranges (there are different blocks by vendor) you may consider these three ranges: 0x20a0 - 0x32ff 0x1f000 - 0x1ffff 0xfe4e5 - 0xfe4ee Besides all the thoughtful explanation that T.J.Crowder has shared with us, needs to be said that beginning with Java 7 is possible to match UTF-16 encoded surrogate pairs with ease. Take a look at the docs: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html A Unicode character can also be represented in a regular-expression by using its Hex notation(hexadecimal code point value) directly as described in construct \x{...}, for example a supplementary character U+2011F can be specified as \x{2011F}, instead of two consecutive Unicode escape sequences of the surrogate pair \uD840\uDD1F. Nevertheless, if you cannot switch to Java 7, you can extend the valuable UnicodeEscaper provided by Guava. Here an implementation for the sake of example: public class SimpleEscaper extends UnicodeEscaper { @Override protected char[] escape(int codePoint) { if (0x1f000 &gt;= codePoint &amp;&amp; codePoint &lt;= 0x1ffff) { return Integer.toHexString(codePoint).toCharArray(); } return Character.toChars(codePoint); } }
upvote count: 5

http://stackoverflow.com/comment/38469053
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24787068
has text: @Swapnil Now, you do understand me. I'm not stuck at parsing the files , i'm stuck in the business logic. I do now know what to do and i don't know what this method signatures above are.

http://stackoverflow.com/q/24803233
has comment: http://stackoverflow.com/comment/38499401
has answer: http://stackoverflow.com/a/24803337
has title: Syntax error, insert ":" to complete SwitchLabel
possible better answer: http://stackoverflow.com/a/24803337
accepted answer: http://stackoverflow.com/a/24803391
has comment: http://stackoverflow.com/comment/38498517
has answer: http://stackoverflow.com/a/24803357
favorite count: 0
upvote count: 2
downvote count: 8
tagged with: android
has body: import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { EditText username; EditText password; Button login; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); username = (EditText) findViewById(R.id.editTextpaswrd); password = (EditText) findViewById(R.id.editTextpssd); Button login = (Button) findViewById(R.id.buttonlgin); login.setOnClickListener(this); } @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 onClick(View v) { String name=username.getText().toString(); String pwd=password.getText().toString(); switch(v.getId()) { case R.id.buttonlgin; break; if (name.equals("nana") &amp;&amp; pwd.equals("12345")) { Intent i=new Intent(this, Qrcodescreen.class); startActivity(i); Toast.makeText(getBaseContext(), "Success!", Toast.LENGTH_SHORT).show(); } else Toast.makeText(getBaseContext(), "Invalid Login Details", Toast.LENGTH_SHORT).show(); break; } displayNextAlert(); } private void displayNextAlert() { // Get what the user entered EditText username = (EditText) findViewById(R.id.editTextpaswrd); //Puts out an error message (!) if ( username.getText().toString().length() == 0) username.setError( "Username required"); EditText password = (EditText) findViewById(R.id.editTextpssd); if ( password.getText().toString().length() == 0) password.setError( "Password required"); } } I am getting errors on the 'case R.id.buttonlgn;'. Please help. Thanks
has answer: http://stackoverflow.com/a/24803510
answer count: 4
has comment: http://stackoverflow.com/comment/38498577
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24803391
tagged with: eclipse
type: Question
score: -6

http://stackoverflow.com/q/24856864
has comment: http://stackoverflow.com/comment/38600719
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has comment: http://stackoverflow.com/comment/38600611
tagged with: java
has title: Android - Using same button over two activities
has answer: http://stackoverflow.com/a/24857692
type: Question
has body: I have the following activity: calc.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String gpaString = gpa.getText().toString(); if (gpaString.equals("")) { gpaString = "0"; } double gpaDouble = Double.parseDouble(gpaString); String satString = sat.getText().toString(); if (satString.equals("")) { satString = "0"; } int satInt = Integer.parseInt(satString); String actString = act.getText().toString(); if (actString.equals("")) { actString = "0"; } int actInt = Integer.parseInt(actString); if (actInt / 36.0 &lt; satInt / 2400.0) { scoreDouble = (0.6 * gpaDouble * 25) + (0.4 * ((double) satInt / 2400.0) * 100.0); } else { scoreDouble = (0.6 * gpaDouble * 25) + (0.4 * ((double) actInt / 36.0) * 100.0); } Intent myIntent = new Intent(MainActivity.this, CollegeList.class); MainActivity.this.startActivity(myIntent); } } ); In another activity I have the following code: if(act/36.0&gt;sat/2400.0){ this.score = 0.6*gpa*25.0+0.4*(act/36.0)*100.0; }else{ this.score = 0.6*gpa*25.0+0.4*(sat/2400.0)*100.0; } scoreDistance = Math.abs(this.score-MainActivity.scoreDouble)/MainActivity.scoreDouble; if(uagri&amp;&amp;ListOfMajors.agricultural||uchem&amp;&amp;ListOfMajors.chem){ scoreDistance--; }else{ scoreDistance = Math.abs(this.score-MainActivity.scoreDouble)/MainActivity.scoreDouble; } } How can I have the button from the first activity also perform the operations in the second activity? The variables used in the second activity are from objects in that activity so I cannot just copy that code into the first activity. Note that while variable names between the two activities may be named similarly, they are different variables.
score: 0
has comment: http://stackoverflow.com/comment/38600686
answer count: 1
tagged with: button
tagged with: android-activity
has comment: http://stackoverflow.com/comment/38600608

http://stackoverflow.com/comment/45096624
has text: Please share the liferay and SOLR version details
score: 0
comment on: http://stackoverflow.com/q/24797535
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24851696
type: Answer
has comment: http://stackoverflow.com/comment/38604573
answers question: http://stackoverflow.com/q/24851348
has body: First of you create one model for question and answer (show below class). public class MyQuestion { private String question; private ArrayList&lt;String&gt; ans; public MyQuestion(String question, ArrayList&lt;String&gt; ans) { this.question = question; this.ans = ans; } public String getQuestion() { return question; } public ArrayList&lt;String&gt; getAns() { return ans; } } after that for your question and answer create one static arraylist. First time your arraylist is empty then add your question and answer.Next time your arraylist is with questions and answers. public class MyActivity extends FragmentActivity { static ArrayList&lt;MyQuestion&gt; myQuestions = new ArrayList&lt;MyQuestion&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (myQuestions.isEmpty()) { addQuestionAndAnswer(); } } private void addQuestionAndAnswer() { // here add your question and answer } }
score: 0
accepted answer of: http://stackoverflow.com/q/24851348
has comment: http://stackoverflow.com/comment/38590637
has comment: http://stackoverflow.com/comment/38611627
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38590858
has comment: http://stackoverflow.com/comment/38598643
has comment: http://stackoverflow.com/comment/38611434

http://stackoverflow.com/comment/38453262
has text: Note that `GetStringUTFChars` converts a Unicode/UTF-16 encoded Java string to a 0x00-terminated Unicode/*modified* UTF-8 encoded string. If that's not what you use on the C++ side, use `GetStringChars` (not 0x00-terminated) or call String.getBytes(Charset charset) or similar.
comment on: http://stackoverflow.com/q/24754375
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38689578
type: Comment
type: QuestionComment
score: 0
has text: So, edit your question, remove everything it contains, and replace it by the text in this last comment, which is your actual question. Elaborate on what you mean by "check for duplicate records". That said, if the goal is to avoid duplicates, then why don't you have a unique constraint?
comment on: http://stackoverflow.com/q/24903711

http://stackoverflow.com/q/24750230
downvote count: 0
has comment: http://stackoverflow.com/comment/38399546
favorite count: 0
has body: I am using the Reflections API to scan my java project and fetch all classes/interfaces having a particular annotation. However it is just returning classes but not interfaces. I am using the following: Set&lt;Class&lt;?&gt;&gt; annotated = reflections.getTypesAnnotatedWith(Path.class); Note : it is working for classes having Path annotation. So is it that Reflections does not support scanning interfaces ? Or I have to code something else?
upvote count: 2
tagged with: annotations
has answer: http://stackoverflow.com/a/24778680
has answer: http://stackoverflow.com/a/24753256
type: AnsweredQuestion
tagged with: reflections
tagged with: java
accepted answer: http://stackoverflow.com/a/24778680
possible better answer: http://stackoverflow.com/a/24753256
type: Question
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/38399471
has title: Reflections API not showing Interfaces having annotations

http://stackoverflow.com/comment/38463896
has text: See http://docs.oracle.com/javase/tutorial/java/data/characters.html. You need to use "\\" instead of "\" in a string.
comment on: http://stackoverflow.com/q/24784610
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/24879270
type: Question
has comment: http://stackoverflow.com/comment/38643030
tagged with: imageview
has comment: http://stackoverflow.com/comment/38643084
score: 0
has body: In my android app, I want to make an imageview and make its height a certain amount. The width needs to be automatically set so that the ratio matches the original image dimension ratio. This is what I got so far: ImageView img = new ImageView(context); img.setTag(Integer.toString(fish.getId(), 10)); img.setAdjustViewBounds(true); LinearLayout.LayoutParams imageviewparams = new LinearLayout.LayoutParams(IMAGESIZE, IMAGESIZE); imageviewparams.setMargins(20, 20, 20, 20); imageviewparams.gravity = Gravity.CENTER_HORIZONTAL; img.setLayoutParams(imageviewparams); It doesn't not work so well... Does anyone know how to get it to work? Thanks.
answer count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-imageview
has title: How to scale imageview and preserve ratio in android?
tagged with: java

http://stackoverflow.com/q/24757140
type: Question
has body: I have got List of all entities from a table in a database by the method: public Collection&lt;? extends Product&gt; getAllProducts() throws SQLException { Session session = Hibernate.util.HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); List&lt;Product&gt; products = new ArrayList&lt;Product&gt;(); products = session.createCriteria(Product.class).list(); return products; } I want to display Product.name for all elements from given collection. How it can be done in jsp page?
score: -1
answer count: 1
downvote count: 1
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24757374
favorite count: 0
has answer: http://stackoverflow.com/a/24757374
tagged with: spring-mvc
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: hibernate
has title: How to display all entity?
has comment: http://stackoverflow.com/comment/38411984

http://stackoverflow.com/comment/38683212
score: 0
type: AnswerComment
type: Comment
has text: There is __absolutely__ no point in exporting an instance of a Java class to a `.java` (as in Java source code) file - I think you are maybe mis-understanding something here. Please explain further what you're trying to do, maybe we can dis-entangle it then.
comment on: http://stackoverflow.com/a/24900477

http://stackoverflow.com/comment/38560269
comment on: http://stackoverflow.com/a/24835734
type: Comment
has text: @DaveNewton I saw the range checking on the random and thought let's just generate a value in the correct range. I knew the original logic was incorrect. :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38592239
score: 0
has text: My app is able to connect to sqllite database of eclipse now I want to connect my app to mysql database for storing large amount of data.Thank you for replying
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24852581

http://stackoverflow.com/comment/38609339
score: 3
comment on: http://stackoverflow.com/q/24861416
type: Comment
type: QuestionComment
has text: Have you looked at: http://spring.io/guides/gs/rest-service-cors/

http://stackoverflow.com/comment/38673101
type: AnswerComment
comment on: http://stackoverflow.com/a/24894953
has text: Thank you Alexandre. You answered my question. Can you then explain why my code above is not working? I know it's not the most efficient way of saving and loading an image, but why then can't I load the image on the RouteDetail fragment when I click on an item from "SendList"?
score: 0
type: Comment

http://stackoverflow.com/q/24884347
has answer: http://stackoverflow.com/a/24885430
has body: I have to get input any kind of file as a folder and want to retrive them as a list and after clicking any file from that list that file should get download I can do half of the way in normal class, I am making folder in project and doing this process its taking input from that folder and saving into other folder but when I am using servlet then its not working its not able to file in that folder its showing error. Here is my code public class main extends HttpServlet { private static String INPUTFILE = "Salary/pivot.pdf"; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { try { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D:/test/ReadPdf.pdf")); document.open(); PdfReader reader = new PdfReader(INPUTFILE); int n = reader.getNumberOfPages(); PdfImportedPage page; for (int i = 1; i &lt;= n; i++) { // only page number 2 will be included page = writer.getImportedPage(reader, i); Image instance = Image.getInstance(page); document.add(instance); } document.close(); } catch (Exception e) { e.printStackTrace(); } } } One more thing when I am removing that folder only giving file name as input and am keeping in project also putting file directly into web content its able to find and working but I want with folder.
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/5694385
tagged with: servlets
type: Question
accepted answer: http://stackoverflow.com/a/24885430
tagged with: jsp
answer count: 1
has title: how to give input file from project folder in servlet
has comment: http://stackoverflow.com/comment/38652487
score: 0

http://stackoverflow.com/comment/38634644
type: AnswerComment
has text: @aliteralmind But look-behind is not counted as capturing group so we can't get part matched by it without surrounding regex inside of it with parenthesis.
comment on: http://stackoverflow.com/a/24874476
type: Comment
score: 1

http://stackoverflow.com/a/24837600
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24827319
has body: Even though it seems complicated, I think you're onto something with the nested maps. I also think one reason the use of a database has been suggested is that SQL queries have a clause GROUP BY that essentially does what you want to do. That is, it takes individual records (rows) and sorts them so that (say) all the rows with the same part number are grouped together. These GROUP BY clauses can be nested, so within the same-part-number group, the rows could be sorted and grouped together by date. The in-memory data structure that would represent such a grouping would be similar to how you described it: Map&lt;PartNumber, Map&lt;Calendar, List&lt;Custom&gt;&gt;&gt; I've modified your example a bit to use a PartNumber type instead of String to make it clear what the key is. Continuing with the assumptions :-), let's say your Custom class, as you referred to it, looks something like this: class Custom { PartNumber getPartNumber() { ... } int getQuantity() { ... } Calendar getDate() { ... } } If you've upgraded to Java 8, it's quite simple to run through your input list and sort/group the data records (instances of the Custom class) into groups in a Map similar to the one described above. This uses the new java.util.stream API. in particular, it uses the Collectors class, which has the grouping functions. I've used static imports to make things more readable. Let's start off grouping the input list by part number. import java.util.*; import java.util.stream.*; import static java.util.stream.Collectors.*; List&lt;Custom&gt; input = ... ; Map&lt;PartNumber, List&lt;Custom&gt;&gt; map1 = input.stream() .collect(groupingBy(Custom::getPartNumber)); This takes the input list, turns it into a stream, and then sends the stream into the groupingBy collector. groupingBy in turn takes a classifier function which is run on each incoming object to extract an object that will be the key in the output map. The incoming objects become values in the map. Since there's the possibility th…

android-intentservice
type: Tag
tags question: http://stackoverflow.com/q/24806922
tag name: android-intentservice

http://stackoverflow.com/q/24823560
tagged with: android
has body: I'm using wordpress-passcode-lock library for providing a PIN lock feature to my app. I'm also using Google Analytics to track custom events. I want to add a custom event for when a user sets a PIN. If I hadn't used the above library the event could've been sent from a Preference.OnPreferenceChangeListener. Problem is that the library provides a PasscodePreferencesActivity which handles the PIN preference. So basically I'm looking for a way to bind a listener to a Preference that it's not defined in the current activity. Is there any way to achieve this without having to fork the library and directly modifying the listener method?
upvote count: 1
tagged with: preferenceactivity
answer count: 0
score: 1
tagged with: java
type: Question
has title: Listen to Preference change from outside PreferenceActivity
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24845255
has title: rewriting a for loop to include any type of object
has answer: http://stackoverflow.com/a/24845287
tagged with: arrays
downvote count: 0
answer count: 1
has body: I have a problem that I'm stuck on. Namely, I have a for loop that goes through an integer array and compares it to another integer. If any integer in the array is the same as the given integer it's true, otherwise, it's false. public static boolean search(int item, int[] arr) { for (int i = 0; i &lt; arr.length; i++) { if (arr[i] == item) { return true; } } return false; } What I'm wondering is how could I modify this code so that I could input any type of item and array (ie String or int or double, etc) and have it do the same thing. I attempted to do something like: public static boolean search(Object item, Object[] arr) { for (int i = 0; i &lt; arr.length; i++) { if (arr[i].equals(item)) { return true; } } return false; } However this doesn't work for ints. If possible, could you keep this at a more conceptual level rather than straight giving me the answer as I would like to code and debug it myself. Conceptually I just want to know what is the generic form of everything (int, String, etc). Thanks!
favorite count: 0
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/2721546
tagged with: object
score: 1
tagged with: java
type: Question
tagged with: boolean
tagged with: for-loop

http://stackoverflow.com/q/24903499
tagged with: android-layout
score: 5
has comment: http://stackoverflow.com/comment/38689119
linked to: http://stackoverflow.com/q/6996837
has comment: http://stackoverflow.com/comment/55665695
linked to: http://stackoverflow.com/q/4474237
has comment: http://stackoverflow.com/comment/38729644
has title: Android Staggered/Multi-line Linear Layout?
tagged with: staggered-gridview
has comment: http://stackoverflow.com/comment/79688109
favorite count: 0
has comment: http://stackoverflow.com/comment/79694494
upvote count: 5
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/54683511
answer count: 0
downvote count: 0
tagged with: java
tagged with: android-linearlayout
has body: For my app, I'm trying to have a section listing the tags in an article but I wasn't able to find an Android Layout that can achieve this. Basically, I have an array of strings which contains anywhere from 1 to 5 elements. I want to be able to list them in an manner in which they're sort of staggered. Similar to what a Horizontal LinearLayout would do except it goes to the next line if the next view is too large. I'd have to do this programatically and without a ListView/GridView since it's inside a ScrollView. Is there any way to achieve this? Here is an edited image of what I mean... https://i.sstatic.net/Hhpry.png
has comment: http://stackoverflow.com/comment/38729386
type: Question

http://stackoverflow.com/a/24794389
has body: First, add four variables to every node. The four variables are sum of distance to the left offspring, sum of distance to the right offspring, number of node in left offspring and number of node in right offspring. Denote them as l, r, nl and nr. Second, add a total variable to root node to record the sum after each insertion. The idea is if you have total of current Tree, the new total after inserting a new node is (old total + sum of distance of new node to all other nodes). What you need to calculate in every insertion is sum of distance of new node to all other nodes. 1- Insert the new node with four variable set to zero. 2- Create two temp counter "node travel" and "subtotal" with value zero. 3- Back trace the route from new node to root. a- go up to parent node b- add one to node travel c- add node travel to subtotal d- add (nr * node travel) + r to subtotal if the new node is on left offspring e- add node travel to l f- add one to nl 4- Add subtotal to total 1 - O(n) 2 - O(1) 3 - O(log n), a to f take O(1) 4 - O(1)
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24793567
type: Answer
upvote count: 1

http://stackoverflow.com/q/24788227
tagged with: java
type: Question
score: 0
tagged with: batch-file
answer count: 1
has body: I am using the below code to access and run a bat file Runtime runtime = Runtime.getRuntime(); Process p =null; p = runtime.exec("cmd /c c:/{foldername}/codereview.bat"); I realized that my code is not portable as i have hardcoded the path, so i copied my bat file in a folder under /src and am now trying to use it after removing the c:/{foldername} part but the code is not working for me... The file can not be found. Please help as to how i can provide the relative path inside the bat file.
has title: How to provide relative URL in bat file in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24788706

http://stackoverflow.com/comment/38513194
type: Comment
has text: I currently just use Texture and use that straight inside the spritebatch.draw method. So this does add some extra work, isn't there a way to just set all Textures, textureRegions or sprites to be flipped? And by flipped i mean read flipped not actually flip the image "physically" so performance wise about the same.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24810786

hibernate-mapping
tags question: http://stackoverflow.com/q/24756609
tags question: http://stackoverflow.com/q/24758459
tag name: hibernate-mapping
tags question: http://stackoverflow.com/q/24757019
type: Tag
tags question: http://stackoverflow.com/q/24896675

http://stackoverflow.com/a/24772743
type: Answer
has comment: http://stackoverflow.com/comment/38441445
has body: Use if (isGPSEnabled &amp;&amp; isNetworkEnabled) instead if (!isGPSEnabled &amp;&amp; !isNetworkEnabled) and paste you else part inside it.
has comment: http://stackoverflow.com/comment/38441622
answers question: http://stackoverflow.com/q/24772693
has comment: http://stackoverflow.com/comment/38441381
score: 0

http://stackoverflow.com/comment/38440530
has text: Not in logcat , i got errors in my compiler, after implemnting what I stated above
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24772360

http://stackoverflow.com/comment/38671597
has text: Did you test it? I have a feeling that you can have problems with `$` and greediness of `*`.
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24894476

http://stackoverflow.com/a/25527161
score: 1
has body: It really also depends on the type of game you make. In my experience, loosely coupled objects almost always perform better since memory allocation occurs very infrequently, while referencing objects usually occurs in batches, and for specific tasks. I liked this approach because it prevents you to mess with a whole lot of virtual tables and class hierarchies. Virtual pointers break the code cache. So in this case I keep objects together in different managers, but with the same handle/id, and just run across a relevant set. If expensive visibility queries are involved, it is often cheaper to keep several lists handy and update them only when necessary (e.g. time-sliced) Another approach is to build dependency traversal trees using linked lists with parent/child relationships to only the relevant objects (a kind of tree-based skip-list). This is useful because somethimes you want to pre-build the transforms, or loop over all light-emitters, or first run all objects through collision detection and response, etc.. logically, any type of 'event' that has to occur on your gameworld can then be translated in a linked-list traversal. It saves you the managers, but it creates a whole lot of memory jumping and management to keep the parent/childs up-to-date. If you can vectorize your calculations and get 100x speedup, well, that's a good reason to look at alignments and packing. At one time, we used a small object cache, to keep only those bits aligned in memory that would frequently be needed such as transforms etc.. in reality, though, you end up with so many isXYZ() calls before you even get to the transform, that this did not really pay off anymore. The idea was good, and there was some speedup at the time, but logic convoluted to the point it became meaningless. The right thing to say is of course that it depends on the tasks and the number of objects or subsets thereof you have to deal with. If you don't know this at first hand but you suspect it can get out of hand, i…
upvote count: 1
answers question: http://stackoverflow.com/q/24893154
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38486676
has text: Languages without mutation get to have much more fun with polymorphism.
comment on: http://stackoverflow.com/a/24796474
type: AnswerComment
type: Comment
score: 3

http://stackoverflow.com/comment/38608931
type: AnswerComment
comment on: http://stackoverflow.com/a/24860958
has text: Eclipse has it's own compiler. Normaly it's generated classes are put in some `bin` or `build` dir as configured in `Project Settings -> Java Build Path -> Source -> Default output folder` Using `javap` on it is the same as for the .class files generated by `javac`
type: Comment
score: 1

http://stackoverflow.com/q/24894518
has answer: http://stackoverflow.com/a/24894766
has comment: http://stackoverflow.com/comment/38672790
has comment: http://stackoverflow.com/comment/38671822
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24894600
has title: navigating hierarchy of xml input file
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24894600
has body: How do I list the element names at a given level in an xml schema hierarchy? The code I have below is listing all element names at every level of the hierarchy, with no concept of nesting. Here is my xml file: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><?xml-stylesheet type="text/xsl" href="CDA.xsl"?> some title <languageCode code="en-US"/> <versionNumber value="1"/> <id extension="998991"/> 1357 Amber Drive Beaverton OR 97867 US <telecom value="tel:(816)276-6909" use="HP"/> Here is my java method for importing and iterating the xml file: public static void parseFile() { //get the factory DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { //Using factory get an instance of document builder DocumentBuilder db = dbf.newDocumentBuilder(); //parse using builder to get DOM representation of the XML file Document dom = db.parse("D:\\mypath\\somefile.xml"); //get the root element Element docEle = dom.getDocumentElement(); //get a nodelist of elements NodeList nl = docEle.getElementsByTagName("*"); if (nl != null && nl.getLength() > 0) { for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { System.out.println("node.getNodeName() is: "+node.getNodeName()); } } } } catch (Exception e) { e.printStackTrace(); } } The output of the above program is: title languageCode versionNumber recordTarget someRole id addr streetAddressLine city state postalCode country telecom Instead, I would like to output the following: title languageCode versionNumber recordTarget It would be nice to then be able to list the children of recordTarget as someRole, and then to list the children of someRole as id, addr, and telecom. And so on, but at my discretion in the code. How can I change my code to get the output that I want?
possible better answer: http://stackoverflow.com/a/24894766

http://stackoverflow.com/q/24840307
linked to: http://stackoverflow.com/q/75175
accepted answer: http://stackoverflow.com/a/24840331
score: 0
has title: In Java, why can't you use a constructor on generic classes?
answer count: 2
has comment: http://stackoverflow.com/comment/39724472
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/38568234
has comment: http://stackoverflow.com/comment/38568231
has body: What's the logic behind the limitaion of doing the following in Java? public class genericClass&lt;T&gt;{ void foo(){ T t = new T(); //Not allowed } }
has comment: http://stackoverflow.com/comment/38568281
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24840331
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/24840344
downvote count: 1
has answer: http://stackoverflow.com/a/24840344
type: Question

http://stackoverflow.com/comment/38683334
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24900629
score: 1
has text: how are you using a double value from Array B to index array A?

http://stackoverflow.com/q/24885837
has comment: http://stackoverflow.com/comment/38655275
tagged with: selenium-webdriver
has title: Else condition not executed due to try catch
has answer: http://stackoverflow.com/a/24886170
has answer: http://stackoverflow.com/a/24885913
tagged with: selenium
has comment: http://stackoverflow.com/comment/38654975
type: Question
tagged with: testing
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24885934
tagged with: java
has comment: http://stackoverflow.com/comment/38654870
has comment: http://stackoverflow.com/comment/38657345
has comment: http://stackoverflow.com/comment/38655403
tagged with: webdriver
has comment: http://stackoverflow.com/comment/38655298
answer count: 3
has comment: http://stackoverflow.com/comment/38654862
has comment: http://stackoverflow.com/comment/38654908
score: 0
has answer: http://stackoverflow.com/a/24885934
accepted answer: http://stackoverflow.com/a/24885913
has body: I have a scenario in which, when we click on save two process can occur. It can show some messages or else the page can crash. I have added an if condition for the crash and mentioned the other process if the application does not crash as else condition. I have written a code like this to handle the crash. try { if (driver.findElement(By.xpath("/html/body/form/div[4]/div[3]/div[1]/div[1]/div[1]/span[1]")).isDisplayed()){ System.out.println("Critical Error Occured."); driver.close(); } else{ String msg = driver.findElement(By.xpath("/html/body/form/div[4]/div[3]/div[1]/div[1]/div/div/div[1]/div/div[2]/div/div[1]/span")).getText(); if (msg.equals("User already registered")){ driver.findElement(By.name("dnn$ctr5995$View$btnOk")).click(); System.out.println(msg); driver.close(); } else if (msg.equals("Admission number already exist.")) { driver.findElement(By.name("dnn$ctr5995$View$btnOk")).click(); System.out.println(msg); System.out.println("Please change the admission number."); driver.quit(); } else if (msg.equals("Saved Successfully.")){ driver.findElement(By.name("dnn$ctr5995$View$btnOk")).click(); System.out.println(msg); } } }catch ( org.openqa.selenium.NoSuchElementException e){ System.out.println("No Such Element Exception."); } Since the page crashes rarely, while executing the control goes to catch and so the else conditions for the first if condition is not executed. Is there any solution for this?

http://stackoverflow.com/q/24798989
type: Question
has answer: http://stackoverflow.com/a/24803316
has body: I'm currently developing an App that is used to scan ID cards. Basically I've got everything working, except for one thing: Whenever a Tag comes near the phone, whatever other application currently is running, my Activity is being called. However, I want the tag to be read only when the Activity, telling the user to scan his ID card, is in focus. I already tried to achieve this behaviour by setting a boolean true once the Activity is started by the user, instead of a scanned NFC tag, and setting the boolean false onPause/onStop, but those are being called nonetheless, once the tag is being scanned rendering my attempts useless. (A behaviour similar to the one I'm trying to achieve can be observed in the app NFC Tools where the user is being told to switch focus to the right Activity in order to scan a tag. If a tag is placed near the phone while outside of the App no action is being taken.) I'm happy to see your views on this topic.
tagged with: android
accepted answer: http://stackoverflow.com/a/24803316
upvote count: 2
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/38514167
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
has title: Scan NFC only from certain Activity
tagged with: nfc
linked to: http://stackoverflow.com/q/23290483

http://stackoverflow.com/comment/42794685
score: 0
type: Comment
has text: I'm trying to set java.util.Calendar to firstDayOfWeek=1, and no luck. It's always=2 Using Apple Java 1.6
type: AnswerComment
comment on: http://stackoverflow.com/a/24845484

http://stackoverflow.com/q/24773248
downvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/38451293
upvote count: 1
has comment: http://stackoverflow.com/comment/38456089
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38444824
has comment: http://stackoverflow.com/comment/38467556
has comment: http://stackoverflow.com/comment/38458752
tagged with: testng
has comment: http://stackoverflow.com/comment/38447434
has title: Selenium assertEqual
tagged with: selenium
has answer: http://stackoverflow.com/a/24779649
has comment: http://stackoverflow.com/comment/38451259
type: Question
tagged with: assertion
tagged with: java
has answer: http://stackoverflow.com/a/38083045
score: -1
has body: I have created a test case in Selenium WebDriver using the TestNG framework. I am trying to getText() and print it and also use it in Assert.assertEquals(). The problem I am facing is when I run this test case, it is showing error "java.lang.AssertionError: expected [] but found [Register here]" and also nothing prints in the "ab" variable. My test case @Test public void signinpopup() { driver.get("http://uat.tfc.tv/"); driver.findElement(By.id("login_buttoni")).click(); String ab = driver.findElement(By.xpath("html/body/section[1]/div/div[1]/div[7]/div[2]/a")).getText(); // ab variable contains value "Register here" System.out.println(ab); System.out.println("hello1"); //Assert.assertEquals("Registe12r here", driver.findElement(By.xpath("html/body/section[1]/div/div[1]/div[7]/div[2]/a")).getText()); Assert.assertEquals(ab,"Regist5434er here"); } One more thing: When I change the assert condition to Assert.assertEquals(ab,"Register here");, it will print the "ab" variable. What is going on here?

http://stackoverflow.com/q/24754229
tagged with: exception
type: UnansweredQuestion
tagged with: android
score: -3
tagged with: php
has title: Exception dispatching input event android
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38406269
tagged with: mysql
has body: Good morning, I'm making a game where I'm trying to keep the scores in MYSQL database, and came across this great error that I am not able to solve, if someone give me podesse grateful little help. (Sorry for the bad english) UserFunctions.java public JSONObject savegame(int fuid, int fscore, int fenergy, int ftime){ // Building Parameters String uid= Integer.toString(fuid); String score= Integer.toString(fscore); String energy= Integer.toString(fenergy); String time= Integer.toString(ftime); List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("tag", save_tag)); params.add(new BasicNameValuePair("uid", uid)); params.add(new BasicNameValuePair("score", score)); params.add(new BasicNameValuePair("energy", energy)); params.add(new BasicNameValuePair("time", time)); JSONObject json = jsonParser.getJSONFromUrl(URL,params); return json; } Game.java (game over) UserFunctions userFunction = new UserFunctions(); JSONObject json = userFunction.savegame(22, 100, 3, 60); System.exit(0); index.php else if ($tag == 'savescore') { $uid = $_POST['uid']; $score = $_POST['score']; $energy = $_POST['energy']; $time = $_POST['time']; $result = $db-&gt;savescore($uid, $score, $energy, $time); } DB_Functions.php public function savescore($uid, $score, $energy, $time) { $result = mysql_query("INSERT INTO tk_users_info(uid, score, energy, time) VALUES('$uid', '$score', '$energy', '$time')"); // check for successful store if ($result) { // get user details $uid = mysql_insert_id(); // last inserted id $result = mysql_query("SELECT * FROM tk_users_info WHERE uid = $uid"); // return user details return mysql_fetch_array($result); } else { return false; } } Error message: 07-15 10:15:54.467: E/InputEventReceiver(3745): Exception dispatching input event. 07-15 10:15:54.467: E/MessageQueue-JNI(3745): Exception in MessageQueue callback: handleReceiveCallback 07-15 10:15:54.477: E/MessageQueue-JNI(3745): android.os.NetworkOnMainThreadException…
type: Question
has answer: http://stackoverflow.com/a/24754487
downvote count: 3
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24807138
tagged with: java
has answer: http://stackoverflow.com/a/24807687
tagged with: unit-testing
type: Question
answer count: 2
tagged with: private
tagged with: legacy
favorite count: 0
has body: For testing MyClass - I Have: MyClass{ private MyThing usedThing = new MyThing(); public String funcToTest(){ return usedThing.Fields.something.ToString(); } } QUESTION: This is only a section of the method, but my question is without a setter, or without changing the prod code, how can I inject the mocked MyThing object into the test? thanks
has answer: http://stackoverflow.com/a/24808472
has title: No Private Setter for Fields - Unit Testing Legacy Code
tagged with: field
score: 0
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/24808472
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24807687

http://stackoverflow.com/comment/38456552
type: Comment
comment on: http://stackoverflow.com/a/24780847
has text: I just want to allow users to perform search on this excel sheet,SO should I use database for it(for it first I need to set excel sheet values in database).So my question is that can I have a better approach than this?
type: AnswerComment
score: 0

http://stackoverflow.com/q/24846787
score: 3
downvote count: 0
has title: Is there any way to get TimeZone by only country name?
favorite count: 0
type: Question
tagged with: timezone
has answer: http://stackoverflow.com/a/24846843
tagged with: android
linked to: http://stackoverflow.com/q/1234563
has comment: http://stackoverflow.com/comment/38583541
has answer: http://stackoverflow.com/a/24846845
linked to: http://stackoverflow.com/q/14135355
has body: Hi I know this question is asked many times but those question relate webservice. I am developing an app that shows timezone selecting country by user. For example I have list of all the countries and when a user select one country from them I want search TimeZOne by country name (May be by string "Canada"). If i search like this is it possible to get timezone from android device? Note: My application does not use internet connection. I want to these without internet connection. Apart from that is there any relevant way?
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24846842
answer count: 3
duplicate of: http://stackoverflow.com/q/1234563
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20743368

http://stackoverflow.com/a/27919225
type: Answer
answers question: http://stackoverflow.com/q/24883127
has body: This works for me: ALTER TABLE myTable ALTER COLUMN id TYPE uuid USING CAST(ENCODE(id, 'hex') AS uuid);
has comment: http://stackoverflow.com/comment/44281770
score: 0

http://stackoverflow.com/comment/38568005
score: 0
type: Comment
type: QuestionComment
has text: Why do you want to get the latest version? Let's say your code requires and runs with Java 1.7.0_21 but the newest version is 1.7.0_65. What's the advantage of the new version? Do you think people can install their own version on a corporate machine?
comment on: http://stackoverflow.com/q/24777073

http://stackoverflow.com/a/24891352
score: 0
has body: You don't. I do not think this is the best way to go about making a button connected to a map. Check out http://s.goel.im/wDM
type: Answer
accepted answer of: http://stackoverflow.com/q/24891272
answers question: http://stackoverflow.com/q/24891272
has comment: http://stackoverflow.com/comment/38665925
type: AcceptedAnswer

http://stackoverflow.com/q/24804185
upvote count: 0
has answer: http://stackoverflow.com/a/24804343
tagged with: string
tagged with: iterable
has comment: http://stackoverflow.com/comment/38503088
possible better answer: http://stackoverflow.com/a/24804407
has body: I have a List which I want to transform to one string. I wanted to use Iterables.concat or Iterables.transform but non of them did what I wanted. How can i do this in java?
has comment: http://stackoverflow.com/comment/38500328
has answer: http://stackoverflow.com/a/24804205
has title: how can I transform a list of objects into one string using java?
favorite count: 0
accepted answer: http://stackoverflow.com/a/24804224
answer count: 5
score: -3
has answer: http://stackoverflow.com/a/24804402
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24804407
has answer: http://stackoverflow.com/a/24804224
tagged with: java
downvote count: 3
type: Question
tagged with: transform

http://stackoverflow.com/comment/38472328
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24788718
score: 2
has text: Explain why do you need to slow down your process. We don't have a magic crystal ball that explains your specific requirements about your work to completely understand the problem.

http://stackoverflow.com/comment/38628889
has text: how are you calling servlet? just pass it as query params. `setletPath?computerName=xyz`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24871661
score: 2

http://stackoverflow.com/comment/38449352
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24776340
has text: It seems that the message is clear. You have created a loop. When EventsTest is loaded, it calls `testfun(that)`, where that is EventsTest. replace `testfun(that)` by `testfun(alert("foo"))`.

http://stackoverflow.com/q/24760176
has body: I have drawn some buttons on a JFrame, however when the user clicks the "Shop" button, I would like to wipe what is currently drawn and draw some new stuff. When the user clicks the "Shop" button again, I would like to close the shop and for the old stuff to re-appear again and the shop menu to dispensary. How can I do this without creating an entire new JFrame?
score: 0
has comment: http://stackoverflow.com/comment/38418400
accepted answer: http://stackoverflow.com/a/24760434
has comment: http://stackoverflow.com/comment/38417712
tagged with: jframe
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/38417893
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38417567
has comment: http://stackoverflow.com/comment/38418718
tagged with: java
has title: How can I "undraw" stuff on a JFrame?
has answer: http://stackoverflow.com/a/24760434
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38596859
score: 0
comment on: http://stackoverflow.com/q/24854811
type: Comment
type: QuestionComment
has text: If you are thinking about recursive parallel tasks, consider fork-join: http://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html

http://stackoverflow.com/comment/38554125
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24829295
has text: I actually went ahead and completely disabled the basic auth provided with Boot, and it now works as expected it seems. Was this the correct way to accomplish this?

http://stackoverflow.com/a/24840015
has comment: http://stackoverflow.com/comment/38568692
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/38568408
type: Answer
has body: you can increase your heap size java -Xmx2g myprogram
score: 1
has comment: http://stackoverflow.com/comment/38568471
has comment: http://stackoverflow.com/comment/38568763
answers question: http://stackoverflow.com/q/24839990
has comment: http://stackoverflow.com/comment/38569487

http://stackoverflow.com/a/24791162
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24790927
upvote count: 1
score: 1
has body: It really depends. Typically speaking, you will need additional code to support older API levels, but it isn't different code for every level. The deciding factor to whether you need segments of code to support the API levels is whether or not you use the functionality that was introduced in the newer APIs. A quick example of this is the HOLO theme. This is a pretty common theme used to give android apps a similar feel, however it wasn't introduced until API level 11 (3.0 I believe). If you want to implement this theme and support pre3.0 devices, you need special code to handle that. If however you choose not to use this, there is no need for special code. All that being said, some of the newer features are very convenient and make a programmer's job much easier. I think the last app I wrote I stuck with API 16+ as there were some tasks that would have been a nightmare to support pre API 16. I guess my thought would be to start coding with the minSDKVersion = 4 (android 1.6). The compiler will let you know if you have features that need special support for older versions. You will find out pretty quickly how much extra work supporting all the way back to 1.6 will take. Then you can properly evaluate whether you find it worth it to include the extra support or would rather adjust how far back you support.
accepted answer of: http://stackoverflow.com/q/24790927

http://stackoverflow.com/comment/38473047
comment on: http://stackoverflow.com/q/24789030
score: 0
has text: I recommend taking all input as strings and deal with it. It can save headaches when users make mistakes at the command line.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24883455
favorite count: 0
score: 3
answer count: 1
has comment: http://stackoverflow.com/comment/38652707
has comment: http://stackoverflow.com/comment/38668852
has answer: http://stackoverflow.com/a/24904617
upvote count: 3
has comment: http://stackoverflow.com/comment/38686219
accepted answer: http://stackoverflow.com/a/24904617
tagged with: apache-kafka
type: AnsweredQuestion
has title: How to handle OffsetOutOfRangeException Error?
has body: I am using storm and kafka for analysis realtime data. I am getting the following error in spout Error kafka.common.OffsetOutOfRangeException 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) at java.lang.Class.newInstance(Class.java:374) at kafka.common.ErrorMapping$.maybeThrowException(ErrorMapping.scala:53) at kafka.message.ByteBufferMessageSet.kafka$message$ByteBufferMessageSet$$internalIterator(ByteBufferMessageSet.scala:99) at kafka.message.ByteBufferMessageSet.iterator(ByteBufferMessageSet.scala:82) at scala.collection.IterableLike$class.foreach(IterableLike.scala:73) at kafka.message.MessageSet.foreach(MessageSet.scala:87) at scala.collection.TraversableOnce$class.size(TraversableOnce.scala:104) at kafka.message.MessageSet.size(MessageSet.scala:87) at storm.kafka.PartitionManager.fill(PartitionManager.java:113) at storm.kafka.PartitionManager.next(PartitionManager.java:83) at storm.kafka.KafkaSpout.nextTuple(KafkaSpout.java:106) at backtype.storm.daemon.executor$fn__3430$fn__3445$fn__3474.invoke(executor.clj:547) at backtype.storm.util$async_loop$fn__444.invoke(util.clj:403) at clojure.lang.AFn.run(AFn.java:24) at java.lang.Thread.run(Thread.java:745) Note: startOffsetTime of spout is -1. Storm version - 0.9.0 kafka verison - 0.7.2 How to fix this issue? Any suggestion will be grateful.
tagged with: java
has comment: http://stackoverflow.com/comment/38690861
tagged with: apache-storm
type: Question
downvote count: 0

http://stackoverflow.com/q/24799369
tagged with: google-maps
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/7575921
has title: New error java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
tagged with: android
has comment: http://stackoverflow.com/comment/38491938
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24799495
has comment: http://stackoverflow.com/comment/38491678
has comment: http://stackoverflow.com/comment/38491857
has body: I have a problem with sample code from google maps ! This code worked when i used eclipse. I changed for android studio and i have a wird error. Error is : ( i have no onSaveInstanceState method) Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1360) at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1378) at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595) at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574) at android.support.v4.app.DialogFragment.show(DialogFragment.java:138) at com.example.smartoo.HomeActivity.servicesConnected(HomeActivity.java:325) at com.example.smartoo.HomeActivity.stopUpdates(HomeActivity.java:373) at com.example.smartoo.HomeActivity.onStop(HomeActivity.java:209) at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1212) at android.app.Activity.performStop(Activity.java:5376) at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3185) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3234) at android.app.ActivityThread.access$1100(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Error is on this line : errorFragment.show(getSupportFragmentManager(), LocationUtils.APPTAG); The code : /** * Verify that Google Play services is available before making a request. * * @return t…
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
linked to: http://stackoverflow.com/q/7469082
accepted answer: http://stackoverflow.com/a/24799495
type: Question

http://stackoverflow.com/comment/38454927
comment on: http://stackoverflow.com/a/24780033
type: Comment
score: 0
type: AnswerComment
has text: then how can i read from file. openFileInput remains undefined

http://stackoverflow.com/comment/39822910
comment on: http://stackoverflow.com/q/24824387
score: 0
type: QuestionComment
type: Comment
has text: The problem that you cannot stop a arbitrary Java thread, so I don't see any other way that spawn it in a separate process.

http://stackoverflow.com/comment/38444232
score: 0
has text: Nah, this should be ok. I suspect you forgot recompiling the Java file, running a different classfile, etc. This seems to be a config issue.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24774142

http://stackoverflow.com/q/24759920
has answer: http://stackoverflow.com/a/24759936
has body: I am a newbie to Generics in java . I have tried the following : Entity class: public class Box&lt;T&gt; { private List&lt;T&gt; boxList; public List&lt;T&gt; getBoxList() { if (this.boxList == null) this.boxList = new ArrayList&lt;T&gt;(); return this.boxList; } public void setBoxList(List&lt;T&gt; boxList) { this.boxList = boxList; } } Test class: public class Client { public static void main(String[] args) { Box box = new Box(); box.getBoxList().add(1); box.getBoxList().add("one"); System.out.println(box.getBoxList()); Box boxInt=new Box&lt;Integer&gt;(); boxInt.getBoxList().add("apple"); System.out.println(boxInt.getBoxList()); } } Though my boxInt is of type Integer,the list BoxList still accepts "apple" . I expected it to throw an error in compile time . Any help on how this work will be very much appreciated. Thanks, Divya
has comment: http://stackoverflow.com/comment/38421462
answer count: 1
downvote count: 0
tagged with: generics
favorite count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has title: How Generics-Type parameter works?
type: Question

http://stackoverflow.com/a/24796395
answers question: http://stackoverflow.com/q/24796355
type: Answer
has comment: http://stackoverflow.com/comment/38486246
upvote count: 1
has body: https://www.java.com/en/download/help/java_blocked.xml Java has further enhanced security to make the user system less vulnerable to external exploits. Starting with Java 7 Update 51, Java does not allow users to run applications that are not signed (unsigned), self-signed (not signed by trusted authority) or that are missing permission attributes. WORKAROUND It is highly recommended not to run these types of applications. However if you still want to run these apps, run only if you understand the risks and implications. As a workaround, you can use the Exception Site list feature to run the applications blocked by security settings. Adding the URL of the blocked application to the Exception Site list allows it to run with some warnings. Steps to Add URLs to the Exception Site list Go to the Java Control Panel (On Windows Click Start and then Configure Java) Click on the Security tab Click on the Edit Site List button Click Add in the Exception Site List window Add url to Exception Site list Click in the empty field under the Location field to enter the URL
score: 1
has comment: http://stackoverflow.com/comment/38486328
downvote count: 0

http://stackoverflow.com/a/24777455
type: AcceptedAnswer
score: 4
downvote count: 0
has body: isInetAddress seems to just check the address for IPv4 or IPv6, i.e. the plain address. isUriInetAddress on the other hand tries to call forUriString and returns true if that succeeds. The docs of forUriString state the following: Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL, encoded in the format specified by RFC 3986 section 3.2.2. Said section states the following: IPv4: IPv4address, e.g. 0.0.0.0 IPv6: "[" ( IPv6address / IPvFuture ) "]" Thus for IPv4 both methods seem to have the same result while for IPv6 isUriInetAddress expects the address to be surrounded by square brackets. Quick test: //IPv4 are treated the same way isInetAddress("0.0.0.0") -&gt; true isUriInetAddress("0.0.0.0") -&gt; true isInetAddress("[0.0.0.0]") -&gt; false isUriInetAddress("[0.0.0.0]") -&gt; false //IPv6 are treated differently isInetAddress("aaaa::bbbb:cccc:dddd:eeee") -&gt; true isUriInetAddress("aaaa::bbbb:cccc:dddd:eeee") -&gt; false isInetAddress("[aaaa::bbbb:cccc:dddd:eeee]") -&gt; false isUriInetAddress("[aaaa::bbbb:cccc:dddd:eeee]") -&gt; true
answers question: http://stackoverflow.com/q/24777199
type: Answer
accepted answer of: http://stackoverflow.com/q/24777199
upvote count: 4

http://stackoverflow.com/comment/41622112
comment on: http://stackoverflow.com/a/25848060
type: Comment
score: 0
has text: This is actually not always true. Catching an error (vs an exception) will most likely just cause your app to behave in unexpected ways (and probably still crash).
type: AnswerComment

http://stackoverflow.com/comment/38637667
comment on: http://stackoverflow.com/a/24871776
score: 0
type: AnswerComment
type: Comment
has text: Yes. Yes. Java follows the principles of the IEEE 754 standard, which says that base conversions (decimal <-> binary) should be according to the current rounding mode. For the conversion from floating-point to integer (by truncation), Java follows C tradition, which predates the IEEE 754 standard. Finally, don't worry for others with a similar problem or question, they won't read this answer any more than you read the metric ton of existing documentation, including the Java Language definition, the Wikipedia pages on floating-point, …

http://stackoverflow.com/q/24770342
tagged with: image
has comment: http://stackoverflow.com/comment/38436879
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38437168
has body: I am new to Java and I am trying to learn images from several tutorials. I have found many uses of ImageUtil.something but when I try to use this in my code it always gives me the following error: Exception in thread "main" java.lang.Error: Unresolved compilation problems: ImageUtil cannot be resolved ImageUtil cannot be resolved at spriteAnimation.Animation.main(Animation.java:35) line 35: BufferedImage img = ImageUtil.makeColorTransparent( Here are the imports I am using if it will help answer the question: import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import javax.swing.JFrame; also tried: import java.util.*; Here is the code I am using: // Init the resources BufferedImage img = ImageUtil.makeColorTransparent( "mario2.png", new Color(0, 115, 0)); BufferedImage[] imgs = ImageUtil.splitImage(img, 6, 4); Is there a required library or import that needs to be set up for ImageUtil to work?
has comment: http://stackoverflow.com/comment/38436870
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
has title: Is a special library or import needed for ImageUtil to work?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38436823

http://stackoverflow.com/q/24844559
tagged with: documentfilter
has body: EDIT - added at then end of the post the answer we were able to achieve This is my first post in SO, so i hope i can ask everything right! I searched and didn't quite find a answer to my question despite similar questions being posted, so i hope this isn't a repost. This is what a i got, a small application that uses JTextField to receive user's input and on top of that i have a DocumentFilter so the user can only input integers and a period in order to receive values that represent weight. My problem is, with my DocumentFilter I'm not being able to filter "copy pasted" text and i can't filter a selected text removal. Here is the code for the Filter import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; /** * The Class IntAndDotFilter. */ public class IntAndDotFilter extends DocumentFilter { /** The period counter. */ private int periodCounter = 0; /** The number counter. */ private int numberCounter = 0; private boolean canRemove = true; public void setCanRemove(boolean canRemove) { this.canRemove = canRemove; } @Override public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException { if (periodCounter == 0) { // If there is no . on the text if (text.matches("\\.")) { // Checks if the input is a dot super.replace(fb, offset, length, text.replaceAll("[^0-9.]", ""), attrs); periodCounter++; // If it is, inserts it and saves that info } else { super.replace(fb, offset, length, text.replaceAll("[^0-9]", ""), attrs); // If not, checks if the input is a digit // and inserts if it is } } else { // If there is already a . if (text.matches("\\.")) { // Checks if the input is another . super.replace(fb, offset, length, text.replaceAll("[^0-9]", ""), attrs); // If it is, filters so that cannot be more than one . } else { if (text.matches("[0-9]")) { // Checks if it's a digit if (numberCounter != 2) { super.replace(fb, offset, length, text.replaceAll…
has title: JTextField, using Document Filter to filter integers and periods
linked to: http://stackoverflow.com/q/23501827
possible better answer: http://stackoverflow.com/a/63964109
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24847125
has answer: http://stackoverflow.com/a/63964109
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/24847125
tagged with: swing
upvote count: 7
tagged with: jtextfield
type: Question

http://stackoverflow.com/comment/38541383
has text: first, you can prevent the NPE with `if(pinbit != null) { ... `. This will not call the NPE. But it seems either the host is not available or the background process is interrupted or something like that, therefore you need to retry this operation. The `AsyncHttpClient` library by loopj is perfect for this, it does all necessary operations and retries when it fails.
comment on: http://stackoverflow.com/q/24825804
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38440614
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24772183
has text: 1. OP never said it was a method declaration.
score: 0

http://stackoverflow.com/q/24790236
tagged with: flash
tagged with: applet
has comment: http://stackoverflow.com/comment/38501609
score: 0
answer count: 1
has body: I'm not good enough in java-programming, But i know its basics. My question is: Is it possible to run java application "java-applet" on explorer without java plugin "i mean java-platform"?? I ask this question -even it's stupid- because i see a lot of people not used java platform "java-plugin" on their explorers. Plus many people advice to not activate that java platform "java-plugin" on explorers. In addition, I think the message of permissions requirement make some people confused about application. On anther hand, Is it possible to run java application by anther spread plugin such as flash player or anything else?? May be that is wrong question, Playing java by flash player, But i asked that to explain my question. At the end, Is that possible or not? And if yes, What should i do to get that?
type: UnansweredQuestion
has title: Is there any alternative player "plugin or platform" to run java application instead of java-applet platform?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24790410

http://stackoverflow.com/a/24876049
answers question: http://stackoverflow.com/q/24875823
score: 0
has body: Pass String from configuration file and convert String into Path in SomeBeanTest class. You can just use the Paths class: public class SomeBeanTest(){ public SomeBeanTest(String textPath){ Path path = Paths.get(textPath); // String to Path } } XML: &lt;bean class="springtest.SomeBeanTest"&gt; &lt;constructor-arg value="/Users/admin/test.txt"/&gt; &lt;/bean&gt; Note: Assuming Users/admin/test.txt is directly accessed form class-path. Read more Create a Path from String in Java7
type: Answer
has comment: http://stackoverflow.com/comment/38637130

http://stackoverflow.com/comment/38593050
score: 0
type: QuestionComment
type: Comment
has text: Noone told you about strings?
comment on: http://stackoverflow.com/q/24852744

http://stackoverflow.com/comment/38561856
type: Comment
comment on: http://stackoverflow.com/a/24836317
has text: This isn't adding anything to what the OP is already doing. You shouldn't be using getResource with absolute paths, that's the point of using getResource.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38475618
has text: No. Not reversed. Thread-1 is a reading thread , Thread-2 is an update thread. This is same in both places. It is not important which particular thread does particularly what - except that there are two threads - one reads and one updates. The thread that updates does the update on its own copy , and the thread that reads reads its own copy.Because there is no guarantee of when the exact update and the exact read will happen ( with respect to each other ) ther is always a chance that these are not consistent. HTH.
comment on: http://stackoverflow.com/a/24790057
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38581416
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24847143
has text: @cursayer can you provide more pseudo-code, like an example of what you are trying to do ... then an alternative solution will be easier to provide. You could also use a second (nested) `if`, or possibly a `switch` statement, instead of the any `if`s.

http://stackoverflow.com/comment/38510167
score: 0
comment on: http://stackoverflow.com/q/24809152
type: Comment
type: QuestionComment
has text: @user3199693 does the Log 'distanceInner2' print '14.7' and the 'distanceOuter' '0.0'? If that is the case, it is because the 'distanceOuter' is logged right after the request has been sent, when a response has not been received yet.

http://stackoverflow.com/comment/38650574
score: 0
type: QuestionComment
type: Comment
has text: boolean isPdf = uri.matches(".*\\b.pdf\\b.*"); change this line with: ".*\\b.mp4\\b.*" and review your if statement as well.
comment on: http://stackoverflow.com/q/24883339

http://stackoverflow.com/comment/38599227
has text: The parent project has a dependency on javaee-api, and should download and install the JAR during step 3.2.1.1. In NetBeans, if you expand Dependencies under firstcup, is javaee-api-7.0.jar expandable? If not, there might have been an error installing the dependency. If so, try right-clicking firstcup and selecting Build with Dependencies.
comment on: http://stackoverflow.com/q/24826961
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38637506
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24824472
has text: Thank you but I already have something similar. I need help in how to use this on the JavaFX controller. Do you have a sample project or tutorial?

http://stackoverflow.com/comment/38660812
comment on: http://stackoverflow.com/q/24888836
type: QuestionComment
type: Comment
score: 0
has text: Where is the `.class` file that has the code for creating the file exists? The path to the `File` api should be relative to the project context

http://stackoverflow.com/q/24886579
tagged with: java
tagged with: cluster-computing
type: Question
has comment: http://stackoverflow.com/comment/41740693
has title: Configuring Glassfish 4 Cluster without multicast
tagged with: glassfish
has comment: http://stackoverflow.com/comment/41781437
score: 2
downvote count: 0
favorite count: 0
upvote count: 2
has body: I'm configuring Glassfish 4 Cluster on DigitalOcean which doesn't allow multicast. I want to deploy an EAR application with one WAR inside and I want all instances on Cluster share session info. The web.xml has the tag. The setup: I have one Glassfish 4 server as DAS: server. And I have other 2 Glassfish 4 servers as instances on different hosts from DAS: node01, node02 I configured the GMS_DISCOVERY_URI_LIST on Cluster to point to the instances as: clusters.cluster.myCluster.property.GMS_DISCOVERY_URI_LIST=tcp://server:9090,tcp://node01:9090,tcp://node02:9090 and the GMS_LISTENER_PORT on Cluster to: clusters.cluster.myCluster.property.GMS_LISTENER_PORT=9090 At Cluster starts the log of the instance shows GMS is ok (that's what I think): GMS1092: GMS View Change Received for group: ntkCluster : Members in view for ADD_EVENT(before change analysis) are : 1: MemberId: instance01, MemberType: CORE, Address: 10.0.0.2:9090:228.9.143.254:10292:myluster:instance01 2: MemberId: instance02, MemberType: CORE, Address: 10.0.0.3:9090:228.9.143.254:10292:myluster:instance02 3: MemberId: server, MemberType: SPECTATOR, Address: 10.0.0.1:9090:228.9.143.254:10292:myCluster:server But it shows too some messages about JMS failing. The point is that my application don't use JMS and I configured nothing of JMS: [2014-07-22T12:33:16.431+0200] [glassfish 4.0] [INFO] [addresslist.setjmsservice.provider] [javax.enterprise.resource.jms.com.sun.enterprise.connectors.jms.system] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1406025196431] [levelValue: 800] JMS010: ADDRESSLIST in setJmsServiceProvider: mq://node01:27676/,mq://node02:27676/ [2014-07-22T12:33:16.438+0200] [glassfish 4.0] [INFO] [jms.connection.url] [javax.enterprise.resource.jms.com.sun.enterprise.connectors.jms.system] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1406025196438] [levelValue: 800] JMS08: JMS Service Connection URL is : mq://node01:27676/,mq://node02:27676/ [2014-07-22T12:33:16.444+0200] [glassfish…
type: UnansweredQuestion
answer count: 0

date
tags question: http://stackoverflow.com/q/24804534
tags question: http://stackoverflow.com/q/24788101
tags question: http://stackoverflow.com/q/24853429
tags question: http://stackoverflow.com/q/24783246
tag name: date
tags question: http://stackoverflow.com/q/24903259
tags question: http://stackoverflow.com/q/24887730
tags question: http://stackoverflow.com/q/24791823
tags question: http://stackoverflow.com/q/24887984
tags question: http://stackoverflow.com/q/24857104
tags question: http://stackoverflow.com/q/24907121
tags question: http://stackoverflow.com/q/24851351
tags question: http://stackoverflow.com/q/24887709
tags question: http://stackoverflow.com/q/24823743
tags question: http://stackoverflow.com/q/24805149
tags question: http://stackoverflow.com/q/24820553
type: Tag
tags question: http://stackoverflow.com/q/24817528
tags question: http://stackoverflow.com/q/24849513
tags question: http://stackoverflow.com/q/24846701
tags question: http://stackoverflow.com/q/24790436
tags question: http://stackoverflow.com/q/24806183
tags question: http://stackoverflow.com/q/24751358
tags question: http://stackoverflow.com/q/24770168
tags question: http://stackoverflow.com/q/24806288
tags question: http://stackoverflow.com/q/24877700
tags question: http://stackoverflow.com/q/24816853

http://stackoverflow.com/comment/38487958
type: QuestionComment
comment on: http://stackoverflow.com/q/24772651
has text: Can you describe your situation? Specifically, why must every element have a different index? Would a mapping suffice in lieu of a shuffle?
score: 0
type: Comment

http://stackoverflow.com/comment/78042787
has text: You can attach position in tag. yourItemView.setTag(position)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/45262503

http://stackoverflow.com/comment/39114838
comment on: http://stackoverflow.com/a/24878549
type: Comment
has text: I think that the world needs just some almost perfect types. People continue to create programming languages and sometimes not for a real useful reason.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24798163
accepted answer of: http://stackoverflow.com/q/24794924
type: Answer
answers question: http://stackoverflow.com/q/24794924
upvote count: 35
type: AcceptedAnswer
downvote count: 0
score: 35
has comment: http://stackoverflow.com/comment/130312096
has body: Why ? Because the type inference of generics types has not been expanded to chained invocation. From the java tutorial on generics type inference: The notion of what is a target type has been expanded to include method arguments. That is why this code: f(Map.empty()); compiles. But this code doesn't because this is a chained invocation: f(Map.empty().put(1,"A").put(2,"B")); You can also find a small paragraph in the JSR-000335 Lambda Expressions for the JavaTM Programming Language Final Release for Evaluation (specifically part D): There has been some interest in allowing inference to "chain": in a().b(), passing type information from the invocation of b to the invocation of a. This adds another dimension to the complexity of the inference algorithm, as partial information has to pass in both directions; it only works when the erasure of the return type of a() is fixed for all instantiations (e.g. List). This feature would not fit very well into the poly expression model, since the target type cannot be easily derived; but perhaps with additional enhancements it could be added in the future. So maybe in Java 9.

http://stackoverflow.com/comment/38520387
type: Comment
type: QuestionComment
has text: If your connection is telling you that a table doesnt exist, then clearly its able to get to your server and the server is responding that it doesnt have a table by that name. what do you mean when you say you are querying from the same table?
comment on: http://stackoverflow.com/q/24814415
score: 0

http://stackoverflow.com/comment/38491789
has text: possible duplicate of [Use JSch to put a file to the remote directory and if the directory does not exist, then create it](http://stackoverflow.com/questions/12838767/use-jsch-to-put-a-file-to-the-remote-directory-and-if-the-directory-does-not-exi)
comment on: http://stackoverflow.com/q/24798881
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38588832
comment on: http://stackoverflow.com/q/24851012
type: Comment
type: QuestionComment
has text: If you would use google to search for 'Java reverse string', you would find at least one concise one-liner.
score: 0

http://stackoverflow.com/a/24762269
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38425159
has body: You make nextvalue bigger and bigger and bigger. The substring operations on it become expensive. substring is an O(n) operation. instead of if(a == 0) { incValue = nextvalue.substring(0, 32); System.out.println(incValue); } else { counter = counter + 32; incValue = nextvalue.substring(counter, counter + 32); System.out.println(incValue); } a++; why not just: System.out.println(nextvalue); nextvalue = "";
downvote count: 0
has comment: http://stackoverflow.com/comment/38421920
answers question: http://stackoverflow.com/q/24762006
type: Answer

http://stackoverflow.com/q/24796982
has comment: http://stackoverflow.com/comment/38489441
tagged with: java
has body: I've suddenly got the ajax error: "Invalid XML" when doing search in PrimeFaces table. After inspection, it's a problem with parsing partial response on IE. The partial response contains the link, in which title there is a special character " ": &lt;a href="/some/link" title="Some text with strange arrow"/&gt; That "arrow" that you see only when editing the source of that question, is ASCII 26 (SUB). I don't know how that character got into the database, but it shouldn't break the application. I'd expect the framework to somehow handle such characters (escape them or filter them out). Is it possible to activate the escaping of non-ASCII characters in PrimeFaces/JSF partial response, or activate some filtering of potential problematic Unicode characters?
has answer: http://stackoverflow.com/a/24797499
type: UnansweredQuestion
tagged with: unicode
tagged with: ajax
type: Question
has comment: http://stackoverflow.com/comment/38527618
has comment: http://stackoverflow.com/comment/38527797
has title: Ajax error: Invalid XML when some 'strange' Unicode characters land in partial response. Is it possible to activate non-ASCII character escaping?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38528369
tagged with: jsf
tagged with: primefaces

http://stackoverflow.com/comment/38533387
type: QuestionComment
comment on: http://stackoverflow.com/q/24821467
score: 0
has text: so how can I do this on dot net side? thanks for your advice
type: Comment

http://stackoverflow.com/comment/38549729
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24826844
type: QuestionComment
has text: Yes, it's rooted. No, I need to copy the databases of other apps to the storage of the device

http://stackoverflow.com/comment/38572136
type: AnswerComment
has text: I used Jackson with String MVC and is really easy a nice, check this tutorial is pretty good and I think it fits your needs: http://spring.io/guides/tutorials/rest/
score: 0
comment on: http://stackoverflow.com/a/24842038
type: Comment

http://stackoverflow.com/comment/38636555
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24873574
has text: @noobProgrammer you can't change the value outside cause it has to be declared `final` in order to be used by an inner class. That said, you can create an object that will hold/set that value for you: see the edit in my answer.
type: Comment

http://stackoverflow.com/a/24772950
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38460952
has comment: http://stackoverflow.com/comment/38461218
type: Answer
has comment: http://stackoverflow.com/comment/38464504
has comment: http://stackoverflow.com/comment/38460532
has comment: http://stackoverflow.com/comment/38461656
upvote count: 2
has comment: http://stackoverflow.com/comment/38460801
score: 2
has comment: http://stackoverflow.com/comment/38481621
accepted answer of: http://stackoverflow.com/q/24771467
has body: If you are building your artifacts outside of Maven you need to reference them in your .pom file At first, set the packaging of your project to pom so Maven will not attempt to compile anything. Then use the build-helper-maven-plugin to attach your artifact files to the project. Here is an example: org.codehaus.mojo build-helper-maven-plugin 1.8 attach-artifacts package attach-artifact build/xbnjava-0.1.1/download/mylibrary-0.1.1.jar jar build/xbnjava-0.1.1/download/mylibrary-0.1.1-javadoc.jar jar javadoc build/xbnjava-0.1.1/download/mylibrary-0.1.1-sources.jar jar sources Finally, add the distributionManagement section to your .pom file as specified here. You can refer to my own Maven project setup at github which was created to upload manually built .jar files on Maven central.
answers question: http://stackoverflow.com/q/24771467

http://stackoverflow.com/q/24879980
tagged with: superclass
type: Question
score: 1
tagged with: java
has title: Field value of superclass is showing up as zero when referencing it from a subclass
upvote count: 1
answer count: 1
tagged with: inheritance
has answer: http://stackoverflow.com/a/24880039
accepted answer: http://stackoverflow.com/a/24880039
favorite count: 0
has body: I am currently having an issue with obtaining a value in the superclass from the subclass. In the superclass, if choice == 5, it calls the power method in the subclass. The problem is that it prints out 0.0 when it calls getCurrentValue() from the power method in the subclass even when the field currentValue has a value other than 0. I'm wondering if I messed something up when I extended the superclass. When I'm calling getCurrentValue() from the power method in the subclass, could I be calling a different currentValue field, perhaps one that's value hasn't changed? Here is the code for my superclass: import java.util.Scanner; public class TrippelTylerMemoryCalculator { //Fields private double currentValue; //Methods public static int displayMenu(){ Scanner input = new Scanner(System.in); int choice; System.out.print("\nMenu \n" + "1. Add \n" + "2. Subtract \n" + "3. Multiply \n" + "4. Divide \n" + "5. Power \n" + "6. Logarithm \n" + "7. Clear \n" + "8. Quit \n\n" + "What would you like to do? \n"); choice = input.nextInt(); if(choice&lt;1 || choice&gt;6){ while(choice&lt;1 || choice&gt;6){ System.out.println("You have entered an invalid menu option. \n" + "What would you like to do? \n"); choice = input.nextInt(); } return choice; } else{ return choice; } } public static double getOperand(String prompt){ Scanner input = new Scanner(System.in); double operand; System.out.println(prompt); operand = input.nextDouble(); return operand; } public double getCurrentValue(){ return currentValue; } public void add(double operand2){ double operand = operand2; double answer; answer = currentValue + operand; currentValue = answer; } public void subtract(double operand2){ double operand = operand2; double answer; answer = currentValue - operand; currentValue = answer; } public void multiply(double operand2){ double operand = operand2; double answer; answer = currentValue * operand; currentValue = answer; } public void divide(double operand2){ double operand = operand2; double an…
tagged with: subclass
type: AnsweredQuestion
downvote count: 0
tagged with: methods

http://stackoverflow.com/comment/38402096
type: Comment
comment on: http://stackoverflow.com/a/24751332
score: 1
has text: This doesn't really puts it all in the regex though. See `tokens[i] = tokens[i].replace(",", ""); tokens[i] = tokens[i].replace(";", "");`.
type: AnswerComment

http://stackoverflow.com/q/24878130
answer count: 2
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24882372
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jdeveloper
upvote count: 0
tagged with: oracle-adf
has body: I'm trying to install jdeveloper 11g on win8 but i got this error Thanks
has answer: http://stackoverflow.com/a/26924975
type: Question
has title: Could not locate the launcher command
tagged with: java
score: -1

http://stackoverflow.com/a/24788698
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24788535
has body: Yes, it is possible to define a getter that returns a specific panel based on a parameter. The way I'd do it in your case (with the little information you have posted) would be to define an enum with the possible states (provided you have a known set of possible states), and associate a panel to each state via a lookup map. E.g. (I didn't try to compile this code, it might contain a few compilation errors): public enum GameState { BEGIN, MIDDLE, END; } public class GamePanels { private Map&lt;GameState, JPanel&gt; lookup = new HashMap&lt;GameState, JPanel&gt; (); private JPanel beginPanel; private JPanel middlePanel; private JPanel endPanel; public GamePanels () { // Initialize panels lookup.put (GameState.BEGIN, beginPanel); lookup.put (GameState.MIDDLE, middlePanel); lookup.put (GameState.END, endPanel); } public getPanel (GameState state) { JPanel panel = new JPanel (); if (lookup.containsKey (state)) { panel = lookup.get (state); } return panel; } } Note that while this will work, this might not be the optimal implementation for this kind of problem. This subject would be a better fit for Programmers.SE.
has comment: http://stackoverflow.com/comment/38471981
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24788535
type: Answer
has comment: http://stackoverflow.com/comment/38472054

http://stackoverflow.com/comment/38608990
has text: do you want to same activity with unsaved data? I mean previous data.
comment on: http://stackoverflow.com/q/24861126
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24784320
has body: Of the two options, I would throw an exception, it is an exceptional circumstance (the user is requesting something that doesn't exist) and it's the right thing to do, I think. Some would agree and others as well as 'Clean Code' ... debatably. Returning null is bad practice -I think- because it just leads to users of the method/class having to deal with a null which can be forgotten and just propagates the null pointer upwards. Some would say this is the right thing to do, however. The other option in some cases is to return an empty object, avoiding the NullPointerException and not quite classing it as an exceptional situation but I'm not sure that applies here.
answers question: http://stackoverflow.com/q/24784008
score: 0
type: Answer

char
tags question: http://stackoverflow.com/q/24790557
tags question: http://stackoverflow.com/q/24823420
tags question: http://stackoverflow.com/q/24801638
type: Tag
tags question: http://stackoverflow.com/q/24859500
tags question: http://stackoverflow.com/q/24835669
tags question: http://stackoverflow.com/q/24830945
tag name: char

http://stackoverflow.com/comment/38406714
has text: @Meghna : I have not opened database anywhere in this class , i have only read .
type: QuestionComment
comment on: http://stackoverflow.com/q/24754443
score: 0
type: Comment

http://stackoverflow.com/comment/46318394
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28416430
type: AnswerComment
has text: And @Flow if you want to discuss this further I suggest we move this to meta. E.g. keep in mind that affiliations change over time (sometimes a LOT) and we would not want to have to update answers to reflect that all the time.

http://stackoverflow.com/q/24799481
tagged with: java
tagged with: hibernate
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24799821
has body: I am using session.getNamedQuery("query1").setString("a", "123") session.getNamedQuery("query2").setString("b", "123") session.getNamedQuery("query3").setString("c", "123") to set parameter. &lt;sql-query name="query1"&gt; select * from table where a = :a &lt;/sql-query&gt; &lt;sql-query name="query2"&gt; select * from table where b = :b &lt;/sql-query&gt; &lt;sql-query name="query3"&gt; select * from table where c = :c &lt;/sql-query&gt; How can I call any one of sqls using only one namedQuery for example &lt;sql-query name="query"&gt; select * from table where (it can be a or b or c ) = :(it can be a or b or c ) &lt;/sql-query&gt; This named query should be work both session.getNamedQuery("query").setString("a", "123") and session.getNamedQuery("query").setString("c", "123")
type: UnansweredQuestion
has title: Usage of Hibernate Mapping Xml when parameter name changed
has answer: http://stackoverflow.com/a/32790826
type: Question
tagged with: named-query

http://stackoverflow.com/q/24819538
has comment: http://stackoverflow.com/comment/38529466
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25338943
has comment: http://stackoverflow.com/comment/38529500
linked to: http://stackoverflow.com/q/5622278
type: Question
linked to: http://stackoverflow.com/q/9467759
score: 5
downvote count: 0
linked to: http://stackoverflow.com/q/24401467
has comment: http://stackoverflow.com/comment/38529499
accepted answer: http://stackoverflow.com/a/25338943
answer count: 1
has comment: http://stackoverflow.com/comment/38532487
favorite count: 0
has comment: http://stackoverflow.com/comment/38530103
tagged with: scjp
has body: This is a piece of code in a SCJP practice question: public class Threads2 implements Runnable { public void run() { System.out.println("run."); throw new RuntimeException("Problem"); } public static void main(String[] args) { Thread t = new Thread(new Threads2()); t.start(); System.out.println("End of method."); } } It was partly mentioned here. However, my question is not the prior question. As I run the program on a few machines multiple times, I occasionally get RuntimeException before "run" in the output. This does not make sense to me, as these lines of codes executed in the same thread, so it should have been the reverse order. Can anyone explain why that happens?
tagged with: multithreading
has title: Codes on the same thread executed in unusual order
has comment: http://stackoverflow.com/comment/38532325
type: AnsweredQuestion

http://stackoverflow.com/a/37269258
type: Answer
has body: Assign a key stroke for Navigate -&gt; Open Hyperlink command via Preferences -&gt; Keys. Now you can use this key stroke instead of using Ctrl+Click to bring up the hyperlink popup (in my case I use F6 than arrow down to Open Declared Type) Not exactly what you are looking for, but this is the way to minimize mouse use.
score: 0
answers question: http://stackoverflow.com/q/24766103

http://stackoverflow.com/q/24887914
has comment: http://stackoverflow.com/comment/38660460
has comment: http://stackoverflow.com/comment/38660560
has comment: http://stackoverflow.com/comment/38660658
has comment: http://stackoverflow.com/comment/38662057
type: Question
has comment: http://stackoverflow.com/comment/38660703
has comment: http://stackoverflow.com/comment/38661181
has comment: http://stackoverflow.com/comment/38661716
has comment: http://stackoverflow.com/comment/38660269
has title: Custom Annotation-driven Formatting Spring MVC
upvote count: 1
answer count: 1
has body: I am migrating a java EE application to spring boot and i got stuck at a converting problem. Now whether its good or not i stored my currencies as Long (its german euro). I wrote a custom jsf converter that does something like that: Long -> String 22 -> 00,22 3310 -> 33,10 String -> Long 3 -> 3 22,11 -> 2211 Now Spring MVC was one reason to move away from JSF. I would like to make use of 303 Beanvalidation, with Spring MVC (@Valid @ModelAttribute, BindingResult which works fine for @Pattern e.g) Now i cant use @NumberFormat(style=Style.Currency), which would do what I want, if I have not stored my currency as long. I wrote a custom Formatter and registered it to FormatterRegistry public class LongCurrencyFormatter implements Formatter&lt;Long&gt;{ @Getter private static final long serialVersionUID = 1L; @Override public String print(Long arg0, Locale arg1) { //logic removed for shorter post } @Override public Long parse(String arg0, Locale arg1) throws ParseException { //logic removed for shorter post } } to this point everthing is working, but now every long is converted. What I think is right. So after some research I looked into 6.6.2 Annotation-driven Formatting http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html I created as in the documentation an AnnotationFormatterFactory public class LongCurrencyFormatAnnotationFormatterFactory implements AnnotationFormatterFactory&lt;LongCurrency&gt; { @Override public Set&lt;Class&lt;?&gt;&gt; getFieldTypes() { Set&lt;Class&lt;?&gt;&gt; setTypes = new HashSet&lt;Class&lt;?&gt;&gt;(); setTypes.add(Long.class); return setTypes; } @Override public Parser&lt;?&gt; getParser(LongCurrency annotation, Class&lt;?&gt; fieldType) { return new LongCurrencyFormatter(); } @Override public Printer&lt;?&gt; getPrinter(LongCurrency annotation, Class&lt;?&gt; fieldType) { return new LongCurrencyFormatter(); } } My annotation: public @interface LongCurrency { } My Bean: public class Costunit { //other …
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24889488
accepted answer: http://stackoverflow.com/a/24889488
has comment: http://stackoverflow.com/comment/38659715
downvote count: 0
has comment: http://stackoverflow.com/comment/38660144
score: 1
tagged with: java

http://stackoverflow.com/comment/38569906
comment on: http://stackoverflow.com/a/24840880
type: AnswerComment
has text: Here is [Source code](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/swing/JFrame.java#JFrame.setLayout%28java.awt.LayoutManager%29) and I hope now its clear to you.
type: Comment
score: 0

http://stackoverflow.com/comment/38417567
score: 2
comment on: http://stackoverflow.com/q/24760176
has text: You might read documentation about the CardLayout. You could also use JavaFX instead of Swing (outdated).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38474281
has text: It also says: DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'projectWebController' null
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24789602
type: Comment

http://stackoverflow.com/q/24830703
has comment: http://stackoverflow.com/comment/38551274
has title: Stuck, need help Program crashes whenever it tries to access the SharedPreferences
type: Question
has comment: http://stackoverflow.com/comment/38551061
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24831044
tagged with: android
has body: Program runs until it tries to access the SharedPreferences in my updateUserSettings() method. I have spent the last 2 hours searching the internet with no explanations. Please help! I have the line that messes everything up Commented at the bottom of my onCreate(); Here is FuelEconomyCalculatorActivity.java package com.example.fuelcalculator; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; public class FuelEconomyCalculatorActivity extends ActionBarActivity implements OnClickListener { private EditText fuelEditText; private EditText distanceEditText; private TextView mpgTextView; private TextView litresTextView; private Button calculateButton; private Button clearButton; private RadioButton gallonsRadio; private RadioButton litresRadio; private RadioButton milesRadio; private RadioButton kmRadio; private String mpg = " "; private String kp100 = " "; private boolean metricChecked; private boolean imperialChecked; private boolean usGallonChecked; private boolean ukGallonChecked; private static final int RESULT_SETTINGS = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fuel_economy_calculator); fuelEditText = (EditText) findViewById(R.id.fuelEditText); distanceEditText = (EditText) findViewById(R.id.distanceEditText); mpgTextView = (TextView) findViewById(R.id.mpgTextView); litresTextView = (TextView) findViewById(R.id.litresTextView); calculateButton = (Button) findViewById(R.id.calculateButton); clearButton = (Button) findViewById(R.id.clearButton); gallonsRadio…
favorite count: 0
has comment: http://stackoverflow.com/comment/38550998
has comment: http://stackoverflow.com/comment/38551156
downvote count: 2
score: -2
answer count: 1
accepted answer: http://stackoverflow.com/a/24831044
has comment: http://stackoverflow.com/comment/38551297
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/38551117
has comment: http://stackoverflow.com/comment/38551091
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/38550750
has comment: http://stackoverflow.com/comment/38551193
upvote count: 0
has comment: http://stackoverflow.com/comment/38550879
has comment: http://stackoverflow.com/comment/38550630
has comment: http://stackoverflow.com/comment/38550870

http://stackoverflow.com/q/24839530
type: Question
has answer: http://stackoverflow.com/a/24839603
score: -2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How to catch the elements of JSON list which is sent by back-end method in Javascript?
downvote count: 2
has comment: http://stackoverflow.com/comment/38567400
has comment: http://stackoverflow.com/comment/38566974
answer count: 1
has body: I'm doing Java web application. A back-end method sends a JSON list but how can I access it from front-end? This is a sample of the JSON list which is returning from back-end method. [ { "completedDate" : null, "completenessLevel" : 0, "priority" : 0, "startedDate" : 1405621923000, "toBeCompleted" : 1405621923000, "userName" : "prasad", "userTaskDiscription" : "Task1 desc", "userTaskId" : 25, "userTaskName" : "Task1" }, { "completedDate" : null, "completenessLevel" : 0, "priority" : 0, "startedDate" : 1405704875000, "toBeCompleted" : 1405704875000, "userName" : "prasad", "userTaskDiscription" : "Task2 desc", "userTaskId" : 26, "userTaskName" : "Task2" } ]
tagged with: javascript
tagged with: jquery
favorite count: 0
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/24839603

http://stackoverflow.com/q/24781223
accepted answer: http://stackoverflow.com/a/24781347
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38456990
has comment: http://stackoverflow.com/comment/38457070
has comment: http://stackoverflow.com/comment/38457341
has body: I am learning JUnit and I am testing a simple method, I have a method which populate a list and return it. Although in unit test I provided the same list, the unit test failed. Code public List&lt;Transaction&gt; retrieveData() throws ParseException { List&lt;Transaction&gt; expResult = new ArrayList(); Date convertedDate = new SimpleDateFormat("yyyy-MM-dd").parse("2014-04-29T13:15:54"); Transaction tran = new Transaction("A", convertedDate,new BigDecimal("20.00")); expResult.add(tran); tran = new Transaction("B", convertedDate,new BigDecimal("20.00")); expResult.add(tran); tran = new Transaction("A", convertedDate,new BigDecimal("20.00")); expResult.add(tran); tran = new Transaction("B", convertedDate,new BigDecimal("20.00")); expResult.add(tran); return expResult; } JUnit @Test public void testRetrieveData() throws ParseException { MyClass instance = new MyClass(); List&lt;Transaction&gt; expResult = new ArrayList(); Date convertedDate = new SimpleDateFormat("yyyy-MM-dd").parse("2014-04-29T13:15:54"); Transaction tran = new Transaction("A", convertedDate,new BigDecimal("20.00")); expResult.add(tran); tran = new Transaction("B", convertedDate,new BigDecimal("20.00")); expResult.add(tran); tran = new Transaction("A", convertedDate,new BigDecimal("20.00")); expResult.add(tran); tran = new Transaction("B", convertedDate,new BigDecimal("20.00")); expResult.add(tran); List&lt;Transaction&gt; result = instance.retrieveData(); assertEquals(expResult, result); } The failed message and stacktrace are as following Error expected: java.util.ArrayList&lt;[ Transaction{cardNumber=A, timestamp=Tue Apr 29 00:00:00 EST 2014, price=20.00}, Transaction{cardNumber=B, timestamp=Tue Apr 29 00:00:00 EST 2014, price=20.00}, Transaction{cardNumber=A, timestamp=Tue Apr 29 00:00:00 EST 2014, price=20.00}, Transaction{cardNumber=B, timestamp=Tue Apr 29 00:00:00 EST 2014, price=20.00}]&gt; but was: java.util.ArrayList&lt;[ Transaction{cardNumber=A, timestamp=Tue Apr 29 00:00:00 EST 2014, pric…
has answer: http://stackoverflow.com/a/24781347
type: AnsweredQuestion
has title: UnitTest shows the test is failed while expected result and actual result are the same
tagged with: junit
linked to: http://stackoverflow.com/q/2989987
possible better answer: http://stackoverflow.com/a/24781449
type: Question
has answer: http://stackoverflow.com/a/24781449
answer count: 2

http://stackoverflow.com/a/24829064
accepted answer of: http://stackoverflow.com/q/24814433
score: 15
answers question: http://stackoverflow.com/q/24814433
has body: After more digging I found what caused my error. Note the location of my compontent: webapp/WEB-INF/resources/ccc/codedType.xhtml. The appropriate location should be webapp/resources/ccc/codedType.xhtml (root vs WEB-INF). In JSF 2.2, they allowed the location to be configurable and I had the following in my web.xml: javax.faces.WEBAPP_RESOURCES_DIRECTORY /WEB-INF/resources which is why things worked in JSF 2.2. The fix for my situation was to remove javax.faces.WEBAPP_RESOURCES_DIRECTORY since it isn't used in JSF 2.1 and move the resources to the root.
upvote count: 15
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38654864
has text: my bad, Sorry. I have updated the answer on how I did.
type: AnswerComment
comment on: http://stackoverflow.com/a/24878667
score: 0
type: Comment

http://stackoverflow.com/comment/38448173
type: Comment
comment on: http://stackoverflow.com/a/24763206
score: 0
type: AnswerComment
has text: Do I get it right that the text "File saved to ..." is returned (as a response body) but Content-Location header is not present? How do you test it?

http://stackoverflow.com/q/24805884
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: treeview
has title: How to convert json data into nested json data format?
answer count: 1
has body: [{"roleId":1,"roleName":"system Admin","createUser":"1","createActive":"N"},{"roleId":2,"roleName":"admin","createUser":"1","createActive":"Y"},{"roleId":3,"roleName":"system Admin","createUser":"1","createActive":"Y"}] This is my Output written in spring using list but i want it in nested json format such that is tree view(structure) like following structure. [{ "id": 1, "data": "Category", "attr": { "id": "1", "selected": false }, "children": [ { "id": 2, "data": "SubCategory1", "attr": { "id": "2", "selected": false }, "children": [{ "id": 4, "data": "Item1", "attr": { "id": "4", "selected": false }, "children": [] }, { "id": 5, "data": "Item2", "attr": { "id": "5", "selected": false }, "children": [] }, { "id": 6, "data": "Item3", "attr": { "id": "6", "selected": false }, "children": [] } ] }, { "id": 3, "data": "SubCategory2", "attr": { "id": "3", "selected": false }, "children": [{ "id": 7, "data": "Item4", "attr": { "id": "7", "selected": false }, "children": [] }, { "id": 8, "data": "Item5", "attr": { "id": "8", "selected": false }, "children": [] }, { "id": 9, "data": "Item6", "attr": { "id": "9", "selected": false }, "children": [] } ] } ] }]; my code is, @GET @Path("/findall") public List&lt;UserRole&gt; getAll() { return userroleservice.findAll(); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24806125
type: Question

http://stackoverflow.com/comment/38623534
has text: Yeah that makes sense, so if they equal am i safe to assume that the insertion spot is 1 index higher than the index where they equal?
comment on: http://stackoverflow.com/q/24868637
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38671694
has text: Use `[]`. In particular it would be the element one less than it's `length`; hint, hint. Edit: re-read, make it two.
comment on: http://stackoverflow.com/q/24894528
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38773031
score: 0
type: AnswerComment
has text: @noobProgrammer Please submit a full working example (that doesn't print what you want). I can't really understand what's wrong when you show me only a small portion of the code.
comment on: http://stackoverflow.com/a/24873574
type: Comment

http://stackoverflow.com/comment/38612170
score: 0
type: Comment
type: QuestionComment
has text: Which websocket implementation are you using? atmosphere? Which framework? which server? glassfish? jetty?
comment on: http://stackoverflow.com/q/24862927

http://stackoverflow.com/q/24899154
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/24920155
score: 2
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: java
type: Question
has body: I'm having a problem with the MediaPlayer. This is in a SherlockFragment and it worked when I created buttons using XML. The working code looked like this: @Override public void onClick(View v) { switch (v.getId()) { case R.id.stop: if(mPlayer!=null &amp;&amp; mPlayer.isPlaying()){ mPlayer.stop(); buttonPlay.setText("Play"); mPlayer.reset(); buttonPlay.setEnabled(true); } break; case R.id.play: mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); buttonPlay.setEnabled(false); buttonPlay.setText("Playing..."); try { mPlayer.setDataSource(url); } catch (IllegalArgumentException e) { Toast.makeText(getActivity(), "mPlayer.setDataSource(url); error 1", Toast.LENGTH_LONG).show(); } catch (SecurityException e) { Toast.makeText(getActivity(), "mPlayer.setDataSource(url); error 2", Toast.LENGTH_LONG).show(); } catch (IllegalStateException e) { Toast.makeText(getActivity(), "mPlayer.setDataSource(url); error 3", Toast.LENGTH_LONG).show(); } catch (IOException e) { e.printStackTrace(); } mPlayer.prepareAsync(); final ProgressDialog progressDialog; progressDialog = ProgressDialog.show(getActivity(), "", "Fetching files..."); mPlayer.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { //Now dismis progress dialog, Media palyer will start playing progressDialog.dismiss(); mp.start(); } }); break; } } It worked fine but I need it to working for programmatically created buttons like this: play[i].setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.e("button", "play clicked "); mPlayer = new MediaPlayer(); mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mPlayer.setDataSource(url); } catch (IllegalArgumentException e) { Toast.makeText(getActivity(), "mPlayer.setDataSource(url); error 1", Toast.LENGTH_LONG).show(); } catch (SecurityException e) { Toast.makeText(getActivity(), "mPlayer.setDataSource(url); error 2", Toast.LENGTH_LONG).show(); } catch (IllegalStateException e) { Toast.makeText(g…
has title: Android MediaPlayer Error -1004
answer count: 2
has answer: http://stackoverflow.com/a/28183916
linked to: http://stackoverflow.com/q/15732553
downvote count: 0
accepted answer: http://stackoverflow.com/a/24920155
tagged with: media-player
possible better answer: http://stackoverflow.com/a/28183916
favorite count: 0

http://stackoverflow.com/q/24902145
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-adf
upvote count: 1
has body: In my fragment i have &lt;af:selectOneChoice value="#{pageFlowScope.loanPurposeBean.loanPurpose.levelPurpose}" contentStyle="width:150px" autoSubmit="true" readOnly="#{pageFlowScope.loanPurposeBean.activity=='edit'}" required="true" label="Cấp mục đích vay" id="soc1" valueChangeListener="#{pageFlowScope.loanPurposeBean.valueChangeLevel}"&gt; &lt;af:selectItem label="1" value="1" id="si10"/&gt; &lt;af:selectItem label="2" value="2" id="si5"/&gt; &lt;af:selectItem label="3" value="3" id="si6"/&gt; &lt;af:selectItem label="4" value="4" id="si3"/&gt; &lt;af:selectItem label="5" value="5" id="si9"/&gt; &lt;af:selectItem label="6" value="6" id="si8"/&gt; &lt;af:selectItem label="7" value="7" id="si4"/&gt; &lt;af:selectItem label="8" value="8" id="si1"/&gt; &lt;af:selectItem label="9" value="9" id="si2"/&gt; &lt;af:selectItem label="10" value="10" id="si7"/&gt; &lt;/af:selectOneChoice&gt; &lt;af:selectOneChoice value="#{pageFlowScope.loanPurposeBean.loanPurpose.loanPurposeParent}" immediate="true" binding="#{pageFlowScope.loanPurposeBean.socLoanPurposeParent}" contentStyle="width:150px" partialTriggers="soc1" readOnly="#{pageFlowScope.loanPurposeBean.activity=='edit'}" label="Mã cha mục đích vay" id="soc2"&gt; &lt;f:selectItems value="#{pageFlowScope.loanPurposeBean.loanPurposeByLevel}" id="si12"/&gt; &lt;/af:selectOneChoice&gt; and My Bean public void valueChangeLevel(ValueChangeEvent valueChangeEvent) { level = (Integer)valueChangeEvent.getNewValue(); System.out.println("New value level: " + level); if (level &gt; 1) { socLoanPurposeParent.setDisabled(false); socLoanPurposeParent.setRequired(true); } else { socLoanPurposeParent.setDisabled(true); socLoanPurposeParent.setValue(""); } if (level &gt; 0) { level = level - 1; } RequestContext.getCurrentInstance().addPartialTarget(socLoanPurposeParent); } if i select level with value > 1, i set required = true then i select level with value = 1 and set required = false but i still get validation from selectonechoice soc2
score: 1
tagged with: java
type: Question
has title: Can't Set Required selectOneChoice
has comment: http://stackoverflow.com/comment/38686324
downvote count: 0
has answer: http://stackoverflow.com/a/24932507

http://stackoverflow.com/a/25041502
type: Answer
score: 10
accepted answer of: http://stackoverflow.com/q/24875253
answers question: http://stackoverflow.com/q/24875253
upvote count: 10
type: AcceptedAnswer
has body: The following example will validate an id_token from an OAuth2 call for Salesforce, without any 3rd party libraries. Note that you'll have to supply a valid id_token below to test this out. package jwt_validate_signature_sf_no_third_party; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.security.GeneralSecurityException; import java.security.KeyFactory; import java.security.PublicKey; import java.security.Signature; import java.security.spec.RSAPublicKeySpec; import org.apache.commons.codec.binary.Base64; public class Main { // Sample id_token that needs validation. This is probably the only field you need to change to test your id_token. // If it doesn't work, try making sure the MODULUS and EXPONENT constants are what you're using, as detailed below. public static final String id_token = "YOUR_ID_TOKEN_HERE"; public static final String[] id_token_parts = id_token.split("\\."); // Constants that come from the keys your token was signed with. // Correct values can be found from using the "kid" value and looking up the "n (MODULUS)" and "e (EXPONENT)" fields // at the following url: https://login.salesforce.com/id/keys // MAJOR NOTE: This url will work for 90% of your use cases, but for the other 10% // you'll need to make sure you get the "kid" value from the instance url that // the api responses from Salesforce suggest for your token, as the kid values *will* be different. // e.g. Some users would need to get their kid values from https://na44.salesforce.com/id/keys for example. // The following 2 values are hard coded to work with the "kid=196" key values. public static final String MODULUS = "5SGw1jcqyFYEZaf39RoxAhlq-hfRSOsneVtsT2k09yEQhwB2myvf3ckVAwFyBF6y0Hr1psvu1FlPzKQ9YfcQkfge4e7eeQ7uaez9mMQ8RpyAFZprq1iFCix4XQw-jKW47LAevr9w1ttZY932gFrGJ4gkf_uqutUny82vupVUETpQ6HDmIL958SxYb_-d436zi5LMlHnTxcR5TWIQGGxip-CrD7vOA3hrssYLhNGQdwVYtwI768EvwE8h4VJDgIrovoHPH1ofDQk8-oG20eEmZeWugI1K3z33fZJS-E_2p_OiDVr0EmgFMTvPTnQ75h_9vyF1qhzikJpN9P8KcEm8o…
downvote count: 0

http://stackoverflow.com/comment/38639703
score: 0
type: Comment
type: QuestionComment
has text: @HovercraftFullOfEels This gets asked to often
comment on: http://stackoverflow.com/q/24877347

http://stackoverflow.com/a/24866975
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24865820
has body: OK, I have found the solution to be to switch to a newer version of xuggler as mentioned in this answer. The interesting part is that this blog here http://blog.xuggle.com/ which is semi-official states that even since v5.2 of xuggler the need for downloading multiple jars etc has been eliminated. Probably not. I also had to use the latest version of logback-core (1.1.2) to make it work around a new exception that was thrown.
score: 3
upvote count: 3

http://stackoverflow.com/comment/38409963
type: Comment
type: QuestionComment
has text: The rectangles are already visible with g.drawRect(), but I just tried using g.draw() now. The rectangles are no longer visible, but now for some reason my console keeps spamming "INTERSECT!" output even before the characters move anywhere.
comment on: http://stackoverflow.com/q/24755050
score: 0

http://stackoverflow.com/q/24820329
favorite count: 0
has title: Getting RunTimeException:com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder in fge/jsonSchemaValidator
answer count: 0
type: UnansweredQuestion
score: 1
has body: I have used 2.2.5 version of [https://github.com/fge/json-schema-validator] using maven dependency com.github.fge json-schema-validator 2.2.5 I am trying to validate a simple json against schema given in code samples. When I load the page, I get a runTimeException as: Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder at com.github.fge.jsonschema.cfg.ValidationConfiguration.newBuilder(ValidationConfiguration.java:92) at com.github.fge.jsonschema.cfg.ValidationConfiguration.byDefault(ValidationConfiguration.java:102) at com.github.fge.jsonschema.main.JsonSchemaFactoryBuilder.(JsonSchemaFactoryBuilder.java:68) at com.github.fge.jsonschema.main.JsonSchemaFactory.newBuilder(JsonSchemaFactory.java:123) at com.github.fge.jsonschema.main.JsonSchemaFactory.byDefault(JsonSchemaFactory.java:113) Do I need a version upgrade for any of the jars or is it because of some other issue?
upvote count: 1
tagged with: maven
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38533282

http://stackoverflow.com/comment/38676509
type: Comment
comment on: http://stackoverflow.com/q/24823595
score: 0
has text: You can synchronize around your `.apply()` calls on the object returned by `NativeLibrary.getInstance()`; that is the object used by `Native.synchronizedLibrary()`.
type: QuestionComment

http://stackoverflow.com/a/25629835
score: 36
upvote count: 36
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/76488942
answers question: http://stackoverflow.com/q/24835051
type: Answer
has body: I reviewed your code and saw an issue in this class of your code: https://github.com/purrox/Spring-example/blob/master/src/main/java/hello/Application.java You're doing it correctly (as defined in the SpringBoot docs) but it seems there's a bug with Weblogic12C (or maybe an interpretation of the standard). It seems like Weblogic12C Searches for a class that implements WebApplicationInitializer DIRECTLY. Notice how your code extends SpringBootServletInitializer (which implements WebApplicationInitializer). Weblogic12C doesn't like it that way it seems. So, the simplest way is to make your Application class implement WebApplicationInitializer. So, change this line: public class Application extends SpringBootServletInitializer { to this: public class Application extends SpringBootServletInitializer implements WebApplicationInitializer { Note: once you fix the above, you'll run into another Weblogic12C deploy issue: "java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath". To fix that other issue, create a new file src/main/webapp/WEB-INF/weblogic.xml and put this content in it: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd"&gt; &lt;wls:weblogic-version&gt;12.1.1&lt;/wls:weblogic-version&gt; &lt;wls:context-root&gt;helloApp&lt;/wls:context-root&gt; &lt;wls:container-descriptor&gt; &lt;wls:prefer-application-packages&gt; &lt;wls:package-name&gt;org.slf4j.*&lt;/wls:package-name&gt; &lt;/wls:prefer-application-packages&gt; &lt;/wls:container-descriptor&gt; &lt;/wls:weblogic-web-app&gt;
accepted answer of: http://stackoverflow.com/q/24835051

http://stackoverflow.com/comment/38638205
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24876423
type: QuestionComment
has text: No It doesn't it's the normal public class login then the void main string args

http://stackoverflow.com/comment/38676664
score: 0
type: QuestionComment
type: Comment
has text: Architecturally it makes little sense to do however. IMO of course.
comment on: http://stackoverflow.com/q/24887927

http://stackoverflow.com/comment/38635237
comment on: http://stackoverflow.com/q/24874817
score: 0
type: Comment
type: QuestionComment
has text: @RyanJ those functions are part of is Android API

http://stackoverflow.com/q/24806739
answer count: 0
has body: I'm looking to be able to get the metadata from various mp3s and store them as strings. This is easy with ID3v1 as it's the last 128 bits, but for ID3v2 onwards all of the metadata is stored in variable sized frames, and I'm currently unable to extract this. Any help much appreciated, thanks Current code is : Path fromC = Paths.get("C:\\whatever.mp3"); byte[] data = Files.readAllBytes(fromC); String[] bytesInString = new String[768]; //uses a loop 768 times as its up to 256mb in size, and 3 digit numbers for (int i = 0; i &lt; (768); i++) { bytesInString [i] = Character.toString((char) (data[i])); } StringBuilder byteResult = new StringBuilder(); for (int i = 0; i &lt; bytesInString .length; i++) { byteResult.append(title[i]); } String allMeta= byteResult.toString(); System.out.println(allMeta); which is to simply save the metadata as a string for use elsewhere, but currently prints it out to just check it. This however gives results such as 'ID3 OTRCK 2TALB FeelTIT2 Here We GoPRIV ) WM/MediaClassSecondaryID PRIV 'WM/MediaClassPrimaryID ￑#￣￢KﾆﾡHﾤ PRIV ' - which shows that it is semi-able to get the metadata, but is currently unable to make it easy to read/useful. Could anyone explain or give any sample code as to how to make it more legible and with just the title, artist, etc, rather than the frame information.
tagged with: file-io
type: Question
has comment: http://stackoverflow.com/comment/38505652
has title: rewrite id3v2 tagging java
score: 0
has comment: http://stackoverflow.com/comment/38506303
tagged with: java
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/mp3

http://stackoverflow.com/a/24861427
answers question: http://stackoverflow.com/q/24861249
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24861249
type: Answer
has body: Make sure if you have only one version of JAR. For ex- You may have both sqljdbc.jar or sqljdbc4.jar in the classpath.
score: 0
has comment: http://stackoverflow.com/comment/38609699

http://stackoverflow.com/comment/38404802
comment on: http://stackoverflow.com/a/24753372
type: Comment
score: 1
has text: And how can I get md5 file checksums from Dropbox?
type: AnswerComment

http://stackoverflow.com/comment/38504788
has text: yes..but the else block follows the wait statement in this case ..so ...?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24805442
type: Comment

http://stackoverflow.com/q/24774683
has comment: http://stackoverflow.com/comment/38483087
has answer: http://stackoverflow.com/a/24774817
has answer: http://stackoverflow.com/a/24774948
has answer: http://stackoverflow.com/a/24774905
linked to: http://stackoverflow.com/q/11990514
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38446465
answer count: 8
has answer: http://stackoverflow.com/a/24774736
tagged with: java
has answer: http://stackoverflow.com/a/24774964
type: Question
has comment: http://stackoverflow.com/comment/38457234
score: 0
has answer: http://stackoverflow.com/a/24774753
has comment: http://stackoverflow.com/comment/38445247
has answer: http://stackoverflow.com/a/24775234
has title: How to make a Java array behave like a JavaScript array?
has body: In JavaScript, I can write code like this: var a = new Array(); a[2] = 'a'; a[20] = 'b'; and this would not work on Java, the point is I don't want to specific the exact length for it. How could I keep this happy style when writing java?
has answer: http://stackoverflow.com/a/24774756

http://stackoverflow.com/q/24862751
has title: slf4j with jdk14 is logging INFO messages to stderr
type: Question
linked to: http://stackoverflow.com/q/5416769
tagged with: java.util.logging
downvote count: 0
tagged with: slf4j
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/38612279
has body: I am trying to get a grip of slf4j with jdk14. Weirdly, some INFO level messages are appearing in stderr. I am executing the jar with the following command java -Djava.util.logging.config.file=./src/main/resources/logging.properties -jar ./target/adwordsConnectorV2-account.jar I am sure that they are INFO level, because when I set the property java.util.logging.ConsoleHandler.level to ALL, the messages show, but when it is set to SEVERE, they don't show. Please can someone tell me why they might be logging to stderr instead of stdout? Thanks Ben com.google.api-ads ads-lib = 1.30.0 adwords-axis = 1.30.0 org.slf4j slf4j-api = 1.7.7 slf4j-jdk14 = 1.7.7 Here is what is logged to stderr: Jul 18, 2014 3:42:11 AM com.google.api.ads.adwords.lib.utils.logging.ReportServiceLogger log INFO: Request made: POST https://adwords.google.com//api/adwords/reportdownload/v201406 Jul 18, 2014 3:42:11 AM com.google.api.ads.adwords.lib.utils.logging.ReportServiceLogger log INFO: accept-encoding: [gzip] authorization: REDACTED user-agent: [fetch-report (AwApi-Java, Common-Java/1.30.0, Java/1.6.0_31, maven)] developertoken: REDACTED clientcustomerid: XXXX Parameters: __rdxml: &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;reportDefinition xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201406"&gt;&lt;ns2:selector&gt;&lt;ns2:fields&gt;Date&lt;/ns2:fields&gt;&lt;ns2:fields&gt;AccountDescriptiveName&lt;/ns2:fields&gt;&lt;ns2:fields&gt;ExternalCustomerId&lt;/ns2:fields&gt;&lt;ns2:fields&gt;AccountCurrencyCode&lt;/ns2:fields&gt;&lt;ns2:fields&gt;Device&lt;/ns2:fields&gt;&lt;ns2:fields&gt;AverageCpc&lt;/ns2:fields&gt;&lt;ns2:fields&gt;AverageCpm&lt;/ns2:fields&gt;&lt;ns2:fields&gt;AveragePosition&lt;/ns2:fields&gt;&lt;ns2:fields&gt;Impressions&lt;/ns2:fields&gt;&lt;ns2:fields&gt;Clicks&lt;/ns2:fields&gt;&lt;ns2:fields&gt;Cost&lt;/ns2:fields&gt;&lt;ns2:fields&gt;Ctr&lt;/ns2:fields&gt;&lt;ns2:fields&gt;ConversionsManyPerClick&lt;/ns2:fields&gt;&lt;ns2:dateRange&gt;&lt;ns2:m…
has answer: http://stackoverflow.com/a/72197550
tagged with: google-ads-api
favorite count: 0
type: UnansweredQuestion
tagged with: logging
score: 4
has answer: http://stackoverflow.com/a/24882091
linked to: http://stackoverflow.com/q/194165
tagged with: java

http://stackoverflow.com/comment/38492522
has text: IntelliJ/Android Studio does have a number of different shortcuts and simple wizard dialogs to generate code depending on the type of methods you want (Code > Generate). It's not universal because it really does depend on the type of methods you want implemented, but perhaps that functionality might work for you. See: http://www.jetbrains.com/idea/features/code_generation.html
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24793591
type: AnswerComment

http://stackoverflow.com/q/24821320
has title: SH execution from Java GUI application don't work
tagged with: java
has answer: http://stackoverflow.com/a/24823209
type: Question
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38557109
has comment: http://stackoverflow.com/comment/38534860
has comment: http://stackoverflow.com/comment/38535774
tagged with: bash
answer count: 1
favorite count: 0
has body: I'm trying to execute a SH script from my java GUI application. I'm using jsch to connect to the machine. I can execute commands like "ls" or "pwd". When I try to execute my SH I only get all output from it, if I execute it directly in the machine it take several time (that's what is expected) and works fine. The script begins with "#!/bin/bash" and the code that call it is: String command= "cd /opt/app/ordersync/scripts/RE-INJEC;sh ./proc_reinjec.sh"; // enter any command you need to execute Channel channel=session.openChannel("exec"); ((ChannelExec)channel).setCommand(command); channel.setInputStream(null); ((ChannelExec)channel).setErrStream(System.err); in = channel.getInputStream(); channel.connect(); When I execute it I get TERM environment variable not set I can't figure it out what is the problem. I tried to the same in php with shell_exec and I the problem (result) was the same.
has comment: http://stackoverflow.com/comment/38557570
upvote count: 2
type: UnansweredQuestion
tagged with: sh
has comment: http://stackoverflow.com/comment/38535910

http://stackoverflow.com/a/24877602
has body: When you call go() from the catch block, you're forgetting that the original go() invocation is still on the stack. It doesn't disappear just because you've called the method again. Essentially, you're performing some accidental recursion. So in this case, you'll call go() a second time, it will execute as per normal, then the stack will "unwind" and execute the remainder of the first invocation of the go method, printing out the wordlist, sorting it, then printing it out again. A quick fix might be to have getWords() return a boolean (false if an exception is thrown), then just change the first line to while(!getWords());.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24877550
answers question: http://stackoverflow.com/q/24877550
upvote count: 1
score: 1

http://stackoverflow.com/q/24798986
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24813250
type: UnansweredQuestion
tagged with: design-patterns
has title: How to structure application to aid testing of sql
has body: I am writing an application - to which I think my design is not great. I use a class called ExposedFunctions which houses my @WebMethod logic for requests to my web service. These methods often need to read from an internal cache or go to the database. Therefore I have a DBFactory class which has individual methods for database operations. An example of this structure can be seen below ExposedFunctions @WebService public class ExposedFunctions { private static Logger logger = Logger.getLogger(ExposedFunctions.class); private DBFactory factory = new DBFactory(); @WebMethod public String register(String username, String password, String email, String firstname, String lastname) { if(StringUtilities.stringEmptyOrNull(username) || StringUtilities.stringEmptyOrNull(password) || StringUtilities.stringEmptyOrNull(email) || StringUtilities.stringEmptyOrNull(firstname) || StringUtilities.stringEmptyOrNull(lastname)){ logger.error("String was null or empty when registering"); } RegistrationStatus status = factory.register(username, password, email, firstname, lastname); return status.getValue(); } } DBFactory public class DBFactory { private final BasicDataSource source = new BasicDataSource(); private final Logger logger = Logger.getLogger(DBFactory.class); public DBFactory() { try { setupConnections(); } catch (DatabasePropertyException e) { logger.info("Unable to load the properties file", e); System.exit(1); } } private void setupConnections() throws DatabasePropertyException{ Properties props = DatabaseUtilities.getDatabaseConnectionProps("/swiped.properties"); if(props != null){ source.setDriverClassName("com.mysql.jdbc.Driver"); source.setUsername(props.getProperty("username")); source.setPassword(props.getProperty("password")); source.setUrl(props.getProperty("url_local")); source.setMaxActive(-1); }else{ throw new DatabasePropertyException("Unable to load the proeprties file in order to connect to the database - exiting application"); } } public RegistrationStatus re…
tagged with: java
type: Question
tagged with: testing

http://stackoverflow.com/comment/80770485
has text: If you use `System.out.print`(ln)`(list)` it will use the `toString()` method of the elements to print the list. So, this piece of code is just repeating what happens inside the `toString` of List.
comment on: http://stackoverflow.com/a/27542779
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24781531
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24777591
answers question: http://stackoverflow.com/q/24777591
has body: getFragmentManager was only added in API11 (http://developer.android.com/reference/android/app/Fragment.html#getFragmentManager()) You should change the code to use getSupportFragmentManager(). You can find more information about the api of android-support-v4.jar here(http://developer.android.com/reference/android/support/v4/app/Fragment.html). You need to use android-support-v4.jar to support fragments in android 2.2

http://stackoverflow.com/q/24804579
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24804830
has body: I have developed a code to make excel file and write it to hard disk. I have to give a "Save as Excel" option on my webpage. On click of this button i want to create excel dynamically and write it to the http responsestream without creating any file on disk. I have done the same for a pdf by writing the file to disk and copying it to response stream as shown below // get your file as InputStream InputStream is = new FileInputStream(dedupePDFPath);; // copy it to response's OutputStream IOUtils.copy(is, response.getOutputStream()); response.setContentType("application/pdf"); response.flushBuffer(); However this time i do not want to write file to disk. How can that be done ?
tagged with: java
type: Question
tagged with: jsp
tagged with: servlets
score: 0
answer count: 1
has title: Write Excel Sheet directly to response without creating any file on hard disk?

http://stackoverflow.com/q/24875234
type: Question
has body: this is my first question here, please don't be cruel :). I am creating dictionary application for Android. I have source dictionary (LMF) which contains data including pronunciation. For example I have word: "transcription" phoneticForm: "trHn'skrIpSEn" My question is: How do I get something like this "trænˈskrɪpʃ(ə)n"? Is there any library for transcription? Thank you for any response which can guide me.
accepted answer: http://stackoverflow.com/a/24875336
has title: Transcription from phonetic form to pronunciation
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24875336
score: 0
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/38640436
comment on: http://stackoverflow.com/q/24877818
score: 2
has text: It means that you are missing a jar or a class in your build path. This could happen because you did not put it there or did not build the project.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24851650
has answer: http://stackoverflow.com/a/24851714
has comment: http://stackoverflow.com/comment/38600141
linked to: http://stackoverflow.com/q/21270610
has comment: http://stackoverflow.com/comment/38590157
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/13223065
has comment: http://stackoverflow.com/comment/38590121
tagged with: colors
has title: Blend 2 Colors in Java
has body: So I need to blend 2 colors with different alpha values. Either color can have an alpha color of 0-255. Here's the algorithm I am using now and it doesn't work. If the alpha is above 1 for either color then the whole color turns solid. On a scale of 0-255 1 should be almost entirely transparent. What do I need to change in order to achieve this? public void blend(Color color1, Color color2, double ratio) { float r = (float) ratio; float ir = (float) 1.0 - r; float[] rgb1 = new float[3]; float[] rgb2 = new float[3]; color1.getColorComponents(rgb1); color2.getColorComponents(rgb2); Color color = new Color(rgb1[0] * r + rgb2[0] * ir, rgb1[1] * r + rgb2[1] * ir, rgb1[2] * r + rgb2[2] * ir); this.color = color; }
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/38590126
tagged with: java
tagged with: alphablending

http://stackoverflow.com/comment/38486558
has text: Thanks Joshua. I have changed "Model tdb = dataset.getDefaultModel();" in "Model model = ModelFactory.createDefaultModel();". If I run this query: "String qiry = "select * {graph <http://prova/File1> { ?s ?p ?o }}";" I get only query results of the model1
comment on: http://stackoverflow.com/a/24783705
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24859251
score: 0
accepted answer of: http://stackoverflow.com/q/24841913
answers question: http://stackoverflow.com/q/24841913
has body: There is no way how to pass parameters to the constructor of the injected EJB because initialization of this object is performed by container and you can't do it manually. So only viable solution is to introduce a setter in MyEJB and than just call myEJB.setMain(this);
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/24846616
has body: As far as efficiency goes, an unrolled loop like you posted will be faster than any loop construct. If you are more interested in conciseness and have more than two variables, you might consider declaring an ArrayList of List&lt;Map&lt;Integer, Integer&gt;&gt; rather than separate variables. I also recommend that you program to an interface (declare all your variables as interface types [e.g., List] rather than implementation types [ArrayList]): List&lt;List&lt;Map&lt;Integer, Integer&gt;&gt;&gt; RPs = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; NUMBER_OF_ARRAYLISTS; i++) { List&lt;Map&lt;Integer, Integer&gt;&gt; list = new ArrayList&lt;&gt;(); for (int j = 0; j &lt; NUMBER_OF_MAPS_PER_LIST; j++) { list.add(new HashMap&lt;Integer, Integer&gt;()); } RPs.add(list); } If you really need to access each List&lt;Map&lt;Integer, Integer&gt;&gt; by name, but still want to eliminate the individual variables, then declare the outer structure as a Map&lt;String, List&lt;Map&lt;Integer, Integer&gt;&gt; and add the elements by name that way. But none of this is going to make things more efficient, just (perhaps) easier to program.
score: 0
accepted answer of: http://stackoverflow.com/q/24846579
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24846579
type: Answer

http://stackoverflow.com/q/24821467
tagged with: asp.net-mvc-4
has comment: http://stackoverflow.com/comment/38533387
has body: I have a edittext wihch users can write something and post my server. I want to know how can I control the text include javascript , jquery or something else which has bad behavior ? should I solve this android side or webservice side ? I use mvc 4.5 (I mean should I solve this c# side?) thanks in advance
has title: How can I understand javascript or jquery code inside in edittext?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38533513
has comment: http://stackoverflow.com/comment/38533312
tagged with: c#
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38533300
answer count: 1
has answer: http://stackoverflow.com/a/24821643
tagged with: javascript
tagged with: android

http://stackoverflow.com/q/24887508
favorite count: 0
type: UnansweredQuestion
has body: I want to add several components to a JPanel and then add the panel to a JFrame. Here is a short sample program: public class Test extends JPanel { private static final long serialVersionUID = -5616883761578620198L; static JPanel jpanel; private static JLabel jLabel; private static void createAndShowGUI() { JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //adding everything to the jpanel jpanel = new JPanel(); jpanel.add(addLabel()); jpanel.add(addTable()); //adding the jpanel to the frame frame.add(jpanel); frame.pack(); frame.setVisible(true); } public static Component addTable() { jLabel = new JLabel("Test"); String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"}; Object[][] data = { {"Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false)}, {"John", "Doe", "Rowing", new Integer(3), new Boolean(true)}, {"Sue", "Black", "Knitting", new Integer(2), new Boolean(false)}, {"Jane", "White", "Speed reading", new Integer(20), new Boolean(true)}, {"Joe", "Brown", "Pool", new Integer(10), new Boolean(false)} }; final JTable table = new JTable(data, columnNames); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); JScrollPane scrollPane = new JScrollPane(table); table.add(scrollPane); return this; //do not know how to return the whole component? } public static Component addLabel() { jLabel = new JLabel("Test1"); return jLabel; } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } However, I am getting the exception: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: adding container's parent to itself Any suggestions how to fix that?
has comment: http://stackoverflow.com/comment/38658268
has title: Adding several Components to a Jpanel
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38658457
type: Question
answer count: 1
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24887578

http://stackoverflow.com/comment/38428777
has text: Annotations never "work"... they are just annotations! What you seem to be saying is that whatever JSON serialiser you are using is not working. You should provide some more information on that.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24765368

http://stackoverflow.com/a/24856657
has body: As others have suggested in comments, you probably want to use a CardLayout. From the listeners of menu items, you can just call cardLayout.show(...) to should the panel you want. See more at How to use CardLayout. Also I noticed that you are using the Netbeans builder tool. You will probably get some help at How to use CardLayout with Netbeans GUI Buidler. Also you question seems to hint you may want to use tabs. In that case you will want to use the tabbed pane. You can just drag the tabbed pane from the palette then start adding panels to the tabbed pane. Maybe this link will help also for dragging panel class. Note: with dragging more than one panel, you should drag the panel, so that the cursor is next to the actual tab of the first tab panel.
answers question: http://stackoverflow.com/q/24854126
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/24957333
has body: I ended up with the solution that uses JDBC query and pretty print the results with Derbytools utility class. I'm selecting all tables from the JPA project like that: Connection conn = em.unwrap(Connection.class); Statement st = conn.createStatement(); for(EntityType<?> et : emf.getMetamodel().getEntities()) { String query = "SELECT * FROM " + et.getName(); System.out.println("> " + query); st.execute(query); JDBCDisplayUtil.DisplayResults(System.out, st, conn); } As a result I have pretty formatted results like: > SELECT * FROM Employee ID ----------- 1 51 Here comes the information to keep completeness of this post: I used EclipseLink java.sql.Connection unwrapping and added to my pom.xml dependency to Derbytools: org.apache.derby derbytools 10.10.2.0 Actually you can use pretty-printing from Derbytools with any database, not only Apache Derby. The whole hassle I make was to create a "testing" project for JPA mappings, that will be displaying generated tables along with data in there. The whole project is called "jpa-testing" and it is available from my github.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24806390
answers question: http://stackoverflow.com/q/24806390

http://stackoverflow.com/comment/38631076
type: Comment
comment on: http://stackoverflow.com/q/24872855
type: QuestionComment
score: 2
has text: CSS does not select text, it selects elements (tags). Can you describe the desired selection target in terms of tags? No. So CSS can't select it. What it *can* do is select the .NavUserText and do something, and also select the .LogoutText and do something else (including undoing the first something). Or of course insert an element whose only content is the text in question.

http://stackoverflow.com/q/24863598
has comment: http://stackoverflow.com/comment/38613887
has comment: http://stackoverflow.com/comment/38624047
has title: How can Kafka limitations be avoided?
has comment: http://stackoverflow.com/comment/38613681
favorite count: 0
score: 8
upvote count: 8
accepted answer: http://stackoverflow.com/a/29890683
has comment: http://stackoverflow.com/comment/38626055
tagged with: bigdata
has comment: http://stackoverflow.com/comment/38625550
has comment: http://stackoverflow.com/comment/38623888
has comment: http://stackoverflow.com/comment/38628451
has comment: http://stackoverflow.com/comment/38613254
has body: We're trying to build a BI system that will collect very large amounts of data that should be processed by other components. We decided that it will be a good idea to have an intermediate layer to collect, store &amp; distribute the data. The data is represented by a big set of log messages. Each log message has: a product an action type a date message payload System specifics: average: 1.5 million messages / minute peak: 15 million messages / minute the average message size is: 700 bytes (aprox 1.3TB / day) we have 200 products we have 1100 action types the data should be ingested every 5 minutes the consumer applications usually need 1-2-3 product with 1-2-3 action types (we need fast access for 1 product / 1 action type) We were thinking that Kafka would do this job but we encountered several problems. We tried to create a topic for each action type and a partition for each product. By doing this we could be able to extract 1 product / 1 action type to be consumed. Initially we had a problem with "too many opened files", but after we changed the server config to support more files we're getting out-of-memory error (12GB allocated / node) Also, we had problems with Kafka stability. At a big number of topics, kafka tends to freeze. Our questions: Is Kafka suitable for our use-case scenario? Can it support such a big number of topics / partitions? Can we organize the data in Kafka in another way to avoid this problems but still to be able to have a good access speed for 1 product / 1 action type? Do you recommend other Kafka alternatives that are better suitable for this?
tagged with: apache-kafka
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38625394
has comment: http://stackoverflow.com/comment/38658194
has comment: http://stackoverflow.com/comment/47904845
has comment: http://stackoverflow.com/comment/47863691
tagged with: java
has comment: http://stackoverflow.com/comment/38628486
has comment: http://stackoverflow.com/comment/38626203
has comment: http://stackoverflow.com/comment/38619225
has comment: http://stackoverflow.com/comment/38653480
has comment: http://stackoverflow.com/comment/42407277
type: Question
has comment: http://stackoverflow.com/comment/38628218
has comment: http://stackoverflow.com/comment/38646365
answer count: 1
has comment: http://stackoverflow.com/comment/42280754
downvote count: 0
has answer: http://stackoverflow.com/a/29890683
has comment: http://stackoverflow.com/comment/38613461
has comment: http://stackoverflow.com/comment/43011315
tagged with: business-intelligence

http://stackoverflow.com/comment/41094255
comment on: http://stackoverflow.com/q/24842224
score: 0
type: QuestionComment
has text: to resolve your issue, you can try this solution : http://stackoverflow.com/a/25834298/4017037
type: Comment

http://stackoverflow.com/q/24777085
has body: I am using the JClouds-Chef API to bootstrap a Linux VM (myapp01.me.example.com) with Chef Client, and to then run the client and configure the VM with its app stack via a typicalapp role: package com.me.myorg.chef; import org.jclouds.Constants import org.jclouds.ContextBuilder import org.jclouds.chef.ChefContext import org.jclouds.chef.ChefService import org.jclouds.chef.config.ChefProperties import org.jclouds.chef.domain.BootstrapConfig import org.jclouds.chef.util.RunListBuilder import org.jclouds.compute.domain.ExecResponse import org.jclouds.compute.domain.OsFamily import org.jclouds.domain.LoginCredentials import org.jclouds.scriptbuilder.domain.Statement import org.jclouds.ssh.SshClient import org.jclouds.sshj.config.SshjSshClientModule import com.google.common.base.Charsets import com.google.common.collect.ImmutableSet import com.google.common.io.Files import com.google.common.net.HostAndPort import com.google.inject.Key import com.google.inject.TypeLiteral public class ChefProvisioner { public static void main(String[] args) { ChefProvisioner.provision() } public static provision() { String vmIp = "myapp01.me.example.com"; // A Linux VM living in our local vCenter String vmSshUsername = "admin"; String vmSshPassword = "12345"; String endpoint = "https://mychefserver"; String client = "myuser"; String validator = "chef-validator"; String clientCredential = Files.toString(new File("C:\\Users\\myuser\\sandbox\\chef\\myuser.pem"), Charsets.UTF_8); String validatorCredential = Files.toString(new File("C:\\Users\\myuser\\sandbox\\chef\\chef-validator.pem"), Charsets.UTF_8); Properties props = new Properties(); props.put(ChefProperties.CHEF_VALIDATOR_NAME, validator); props.put(ChefProperties.CHEF_VALIDATOR_CREDENTIAL, validatorCredential); props.put(Constants.PROPERTY_RELAX_HOSTNAME, "true"); props.put(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); ChefContext ctx = ContextBuilder.newBuilder("chef") .endpoint(endpoint) .credentials(client, clientCredential) .overr…
tagged with: chef-infra
type: AnsweredQuestion
has title: JClouds-Chef: IllegalAccessError on TokenType2?
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24781011
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24781011
favorite count: 0
tagged with: jclouds

http://stackoverflow.com/q/24788083
answer count: 2
has comment: http://stackoverflow.com/comment/38470810
downvote count: 1
has body: Imagine I have this class: public class SynchTest { private static Object[] objs = new Object[3]; static { objs[0] = new Object( ); objs[1] = new Object( ); objs[2] = new Object( ); } public static Object getObject(int i) { return objs[i] } } and that objects running in multiple threads call the method getObject(int i). In this case, is it necessary to declare getObject(int i) syncchronized? I wouldn't think so because the objs array is initialized in a static block and never changed. But I'd like a sanity check :) Thanks in advance!
has answer: http://stackoverflow.com/a/24788120
has answer: http://stackoverflow.com/a/24788173
favorite count: 0
tagged with: synchronization
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38470800
has title: Does a getter( ) to shared data that doesn't change need to be synchronized?
type: Question
upvote count: 2

http://stackoverflow.com/comment/38533794
comment on: http://stackoverflow.com/q/24807952
score: 0
type: Comment
type: QuestionComment
has text: where is `ImageIO` used in your code?

http://stackoverflow.com/q/24877537
has comment: http://stackoverflow.com/comment/38640389
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: logging
has title: Generate findbugs error on printStackTrace statement
score: 1
tagged with: java
has body: Is there a way in findbugs/maven combo that will generate error if exception.printStackTrace statement is seen in the code. We use log4j in code and I want all team members to log the error using log4j as stdout is normally discarded for many of the jobs and log file gets other relevant information. For development process, using maven profiles, we make sure log goes to stdout so that IDEs like eclipse show the output of code. For production build, stdout logger is removed. Best way to detect accidentally introduced printStackTrace is to fail the build. Can I achieve this using findbugs? Any other suggestions are also welcome.
has comment: http://stackoverflow.com/comment/38640393
type: Question
upvote count: 1
tagged with: findbugs
linked to: http://stackoverflow.com/q/7704252
favorite count: 0
has comment: http://stackoverflow.com/comment/38640485

dropwizard
tags question: http://stackoverflow.com/q/24771657
tags question: http://stackoverflow.com/q/24828421
tag name: dropwizard
type: Tag
tags question: http://stackoverflow.com/q/24822939
tags question: http://stackoverflow.com/q/24820123

http://stackoverflow.com/q/24900705
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/38684405
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/38683582
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24901625
has title: Android, Mandrill and Parse.com: Java ClassCastException: HashMap cannot be cast to a class
accepted answer: http://stackoverflow.com/a/24901625
type: Question
has body: I don't know whether the problem is sourced this far back, so I will tell you about it anyway. I have a function stored as Parse Cloud Code which retrieves the user's list of scheduled emails, as per Parse and Mandrill API documentation. However, the returned object from Mandrill, according to their docs, is an array of structs containing String key-value pairs. You can see the relevant docs here: https://mandrillapp.com/api/docs/messages.JSON.html#method=list-scheduled Parse Cloud Code can only be in Javascript, so how the returned array is interpreted by it, I am not sure. Either way, I have the cloud function return the returned array directly back to the Java method which called it in my Android application. I thought it would arrive as a JSONArray, but that did not seem to be the case. My editor, Android Studio, insisted that the return type was of ArrayList&lt;ScheduledEmail&gt;, and would not let me use any other parameter type, so I set it to that. (ScheduledEmail is the class I created in Java to match the elements contained in a returned struct from Mandrill, for this method. Was this part of where I went wrong? How do I convert those structs in the returned array into Java-compatible key-value pairs?) However, when I try to access an object contained in the array, I receive this error: java.lang.ClassCastException: java.util.HashMap cannot be cast to com.****.******.ScheduledEmail Nowhere does there seem to have been a HashMap used. What am I missing? Should I have first done something to the returned array before having it sent back to the Java method? Has Mandrill returned a HashMap? If so, why would it be interpreted as the Java class which I intended it to match to? The relevant portions of the Java method in question are as follows: HashMap&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("recipient", "koolstr@gmail.com"); ParseCloud.callFunctionInBackground("listScheduledEmails", params, new FunctionCallback&lt;ArrayLis…
tagged with: java
tagged with: javascript
tagged with: mandrill
score: 0

http://stackoverflow.com/a/24771232
has body: Your code seems valid to me, even if it does not look that nice. But please make your Object you are synchronizing on final. However there could be some considerations depending on your actual context. In any way should clearly state out in the Javadocs what you want to archive. Another approach is to sync on FirstClass e.g. synchronized (FirstClass.class) { // do what you have to do } However every synchronized method in FirstClass is identical to the synchronized block above. With other words, they are also synchronized on the same object. - Depending on the context it may be better. Under other circumstances, maybe you'd like to prefer some BlockingQueue implementation if it comes down that you want to synchronize on db access or similar.
score: 3
has comment: http://stackoverflow.com/comment/38438513
has comment: http://stackoverflow.com/comment/38445473
has comment: http://stackoverflow.com/comment/38478190
downvote count: 0
has comment: http://stackoverflow.com/comment/38438474
answers question: http://stackoverflow.com/q/24771072
type: Answer
has comment: http://stackoverflow.com/comment/38477113
has comment: http://stackoverflow.com/comment/38476696
upvote count: 3

annotation-processing
tags question: http://stackoverflow.com/q/24824343
tag name: annotation-processing
tags question: http://stackoverflow.com/q/24787751
type: Tag

http://stackoverflow.com/q/24860286
tagged with: andengine
type: UnansweredQuestion
has title: Android : IllegalArgumentException: Invalid int: "D1%" on Galaxy Tab3 Lite (goyawifi)
has body: To day, in my Google Developer Console -> Crash &amp; ARn, I receive a crash response below java.lang.IllegalArgumentException: Invalid int: "D1%" at android.os.Parcel.readException(Parcel.java:1429) at android.os.Parcel.readException(Parcel.java:1379) at afa.a(SourceFile:102) at aer.a(SourceFile:174) at aer.a(SourceFile:151) at afw.run(SourceFile:14) at afy.run(SourceFile:30) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) on Galaxy Tab3 Lite (goyawifi) - Android 4.2 I'm using andengine to develop game, please show me how to fix it.
type: Question
tagged with: android
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/38612146
has comment: http://stackoverflow.com/comment/38612810
has comment: http://stackoverflow.com/comment/38607997
tagged with: java
has comment: http://stackoverflow.com/comment/38610709

http://stackoverflow.com/comment/38675476
score: 10
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24896505
has text: You should also note that it has a private constructor so nobody can create it anyways.

http://stackoverflow.com/comment/39623699
type: AnswerComment
comment on: http://stackoverflow.com/a/25388271
score: 0
type: Comment
has text: I agree. It would be possible to hack it, but not really worth the time. I was in the same situation with [Spring Web Services](http://projects.spring.io/spring-ws/) and used exactly the same `@ImportResource` trick until they added support for Java configuration.

http://stackoverflow.com/comment/38688676
type: QuestionComment
comment on: http://stackoverflow.com/q/24897717
has text: But neither success nor error handler runs. Instead I see plain string in browser.
score: 0
type: Comment

http://stackoverflow.com/q/24765219
tagged with: junit
has answer: http://stackoverflow.com/a/25881974
accepted answer: http://stackoverflow.com/a/25881974
favorite count: 0
has title: Testing @RestController with @ControllerAdvice
has comment: http://stackoverflow.com/comment/40502347
tagged with: spring
score: 8
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/28723181
downvote count: 0
has body: My problem is connected with testing Spring @RestController which is also using @ControllerAdvice with @ExceptionHandler. Here is the code: @ControllerAdvice class: @ControllerAdvice public class MyAppExceptionHandler { @ExceptionHandler({ NoSuchEntityException.class }) @ResponseStatus(value = HttpStatus.NOT_FOUND) public @ResponseBody ErrorDTO handleNotFoundException(Exception ex) throws IOException { return new ErrorDTO.Builder().setStatus(HttpStatus.NOT_FOUND) .setCause(ex.getClass().getName()) .setThrowable(ex).build(); } } When using it in application everything works fine - perfectly getting 404 response with JSON explanation, but when trying to use it during tests - bad things happen. My test class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { WebConfig.class }) @WebAppConfiguration public class SomeTest { @Mock private SomeService service; @InjectMocks private SomeController controller; private MockMvc mvc; private ExceptionHandlerExceptionResolver createExceptionResolver() { ExceptionHandlerExceptionResolver exceptionResolver = new ExceptionHandlerExceptionResolver() { @Override protected ServletInvocableHandlerMethod getExceptionHandlerMethod( HandlerMethod handlerMethod, Exception exception) { Method method = new ExceptionHandlerMethodResolver( MyAppExceptionHandler.class).resolveMethod(exception); return new ServletInvocableHandlerMethod( new MyAppExceptionHandler(), method); } }; exceptionResolver.afterPropertiesSet(); return exceptionResolver; } @Before public void setup() { MockitoAnnotations.initMocks(this); mvc = MockMvcBuilders.standaloneSetup(controller) .setHandlerExceptionResolvers(createExceptionResolver()) .build(); } @Test public void thatExceptionHappens() throws Exception { when(service.get(10)).thenThrow(new NoSuchEntityException(Some.class, 10)); mvc.perform(get("/api/some/10")).andExpect(status().isNotFound()); } } When trying to run it: 2014-07-15 19:35:01.376 [main] ERROR com.package.SomeTest$1 - Failed to …
tagged with: java
has comment: http://stackoverflow.com/comment/45741825
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/28723181
answer count: 2

http://stackoverflow.com/comment/38649011
comment on: http://stackoverflow.com/q/24882535
has text: What's your question / exact problem?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38689449
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24902031
has text: oops - i thought you were having trouble with the activity.
score: 0

http://stackoverflow.com/comment/38670926
has text: The behavior you see in your case is the correct one. Analyze carefully the other scenario of your colleague, because Spring doesn't simply pick the first one or something, it will complain if it's more than one match or no matches.
comment on: http://stackoverflow.com/q/24892957
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/27644579
has comment: http://stackoverflow.com/comment/51883936
answers question: http://stackoverflow.com/q/24809580
has comment: http://stackoverflow.com/comment/63552971
downvote count: 0
has comment: http://stackoverflow.com/comment/46798096
has comment: http://stackoverflow.com/comment/46802194
type: Answer
has comment: http://stackoverflow.com/comment/53934201
has comment: http://stackoverflow.com/comment/48383872
has comment: http://stackoverflow.com/comment/52328947
has comment: http://stackoverflow.com/comment/53934259
has comment: http://stackoverflow.com/comment/51887110
upvote count: 26
has body: As #150 from google groups said Because careful with -keep class !android.support.v7.internal.view.menu.**. There are a number of classes in there which are referenced from the appcompat's resources. The better solution is add the following lines instead: -keep class !android.support.v7.internal.view.menu.*MenuBuilder*, android.support.v7.** { *; } -keep interface android.support.v7.** { *; }
score: 26
has comment: http://stackoverflow.com/comment/55137883
has comment: http://stackoverflow.com/comment/54633181
has comment: http://stackoverflow.com/comment/56360118
has comment: http://stackoverflow.com/comment/48450821
has comment: http://stackoverflow.com/comment/48387843

http://stackoverflow.com/a/24791586
type: Answer
answers question: http://stackoverflow.com/q/24791360
upvote count: 2
has comment: http://stackoverflow.com/comment/38477529
score: 2
accepted answer of: http://stackoverflow.com/q/24791360
has comment: http://stackoverflow.com/comment/38477697
type: AcceptedAnswer
downvote count: 0
has body: Consulting the javadoc for FileInputStream (I'm assuming since you're reading from file): Reads up to len bytes of data from this input stream into an array of bytes. If len is not zero, the method blocks until some input is available; otherwise, no bytes are read and 0 is returned. The key here is that the method only blocks until some data is available. The returned value gives you how many bytes was actually read. The reason you may be reading less than 128 bytes could be due to a slow drive/implementation-defined behavior. For a proper read sequence, you should check that read() does not equal -1 (End of stream) and write to a buffer until the correct amount of data has been read. Example of a proper implementation of your code: InputStream is; // = something... int read; int read_total; byte[] buf = new byte[128]; // Infinite loop while(true){ read_total = 0; // Repeatedly perform reads until break or end of stream, offsetting at last read position in array while((read = is.read(buf, read_total, buf.length - offset)) != -1){ // Gets the amount read and adds it to a read_total variable. read_total = read_total + read; // Break if it read_total is buffer length (128) if(read_total == buf.length){ break; } } if(read_total != buf.length){ // Incomplete read before 128 bytes }else{ process_data(buf); } } Edit: Don't try to use available() as an indicator of data availability (sounds weird I know), again the javadoc: Returns an estimate of the number of remaining bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream. Returns 0 when the file position is beyond EOF. The next invocation might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes. In some cases, a non-blocking read (or skip) may appear to be blocked when it is merely slow, for example when reading large files over slow networks. The key there is est…
has comment: http://stackoverflow.com/comment/38477877

http://stackoverflow.com/q/24871977
has comment: http://stackoverflow.com/comment/38896078
tagged with: android
has comment: http://stackoverflow.com/comment/38633474
has comment: http://stackoverflow.com/comment/38633528
tagged with: audio
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: stream
has comment: http://stackoverflow.com/comment/38631482
has title: Play audio stream on Android
has comment: http://stackoverflow.com/comment/38637630
type: Question
has body: I'm developing a webradio player application on Android (API 17) and I'd like to play an audio flux from the Internet with the MediaPlayer Android library. This is my code: String url = "http://stream.url.net/" ; mediaPlayer.setDataSource(url); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.prepareAsync(); And within an OnPreparedListener() I launch the audio: mediaPlayer.start(); All goes well with this code on my old Android device (API 10). However, when I launch it on my new Android device (API 17), the application is stuck on the prepareAsync() and the player never appears. How can I fix this?
has comment: http://stackoverflow.com/comment/38673357
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38629452
tagged with: webradio

http://stackoverflow.com/comment/38669711
comment on: http://stackoverflow.com/q/24839283
has text: This is an option but doensn't work for me because I have a (Sudoku) model object that is displayed in this view and I think it would be a bad solution to check every object if it was 4x4, 9x9 or 16x16 and then load and display the fitting view.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24823422
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38536788
has title: parsing string to get content
has body: I have the following html string: I only want this content I don't want this content random content And I would like to only get the content from the h3 tags and remove the other content. I have the following: String getArticleBody = listArt.getChildText("body"); StringBuilder mainArticle = new StringBuilder(); String getSubHeadlineFromArticle; if(getArticleBody.startsWith(" ") && getArticleBody.endsWith(" ")){ mainArticle.append(getSubHeadlineFromArticle); } But this returns the whole content, which is not what I am after. If someone could help me that would be great thanks.
has answer: http://stackoverflow.com/a/24823586
linked to: http://stackoverflow.com/q/18153998
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24823919
linked to: http://stackoverflow.com/q/2038104
has answer: http://stackoverflow.com/a/24823617
answer count: 6
has answer: http://stackoverflow.com/a/24823616
has answer: http://stackoverflow.com/a/24823593
score: 0
linked to: http://stackoverflow.com/q/16597303
has answer: http://stackoverflow.com/a/24823696
has comment: http://stackoverflow.com/comment/38536656
tagged with: parsing
type: UnansweredQuestion

http://stackoverflow.com/comment/38641202
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24878211
score: 0
has text: Create the `unsorted_Array` once. When you need a copy it, use `sorted_Array = Arrays.copyOf(unsorted_Array, unsorted_Array.length);` to copy the contents of the `unsorted_Array` to the `sorted_array`, it takes < 1 millisecond to complete, I fail to see why this is an issue...

http://stackoverflow.com/a/24905988
answers question: http://stackoverflow.com/q/24905775
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38693184
upvote count: 1
has body: I want it to do the same action, plus something else. You can add multiple ActionListener on same JButton and all will fired when button is clicked but make sure the order of the listeners are not predefined and should not be. Never extend any build-in class until and unless you need to override existing functionality. Read more about Favor Composition over inheritance Principle If you want to do in the same way then try some thing like this: class AButton extends JButton implements ActionListener { AButton () { addActionListener(this); } @Override public void actionPerformed (ActionEvent aEvent) { methodA(); methodB(); } public void methodB(){ // nothing here, no code // you can make this method abstract if needed } } class BButton extends AButton { @Override public void methodB(){ // add more code here specific to this class } }
has comment: http://stackoverflow.com/comment/38693093
type: Answer

http://stackoverflow.com/comment/38633366
score: 0
type: QuestionComment
type: Comment
has text: I analysed the content. Sometimes Bytes are added and then the file goes on as it should.
comment on: http://stackoverflow.com/q/24873352

http://stackoverflow.com/comment/38527014
comment on: http://stackoverflow.com/a/24813262
has text: It means that, if something needs to be locked before the variable is updated, you must not remove the lock (you can make the variable volatile---it won't hurt, it's just pointless). Which is kind of obvious anyway and could have gone without saying, but it had to be stated to minimize the chance of complaints by literal-minded readers.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24885607
has comment: http://stackoverflow.com/comment/38655093
type: Answer
answers question: http://stackoverflow.com/q/24885391
score: 1
has comment: http://stackoverflow.com/comment/38654974
upvote count: 1
has comment: http://stackoverflow.com/comment/38654941
downvote count: 0
has body: // Create a new Random Object, this helps you generate random numbers Random rand = new Random(); // create a integer array with 7 integers int freq[] = new int[7]; // loop 9 times for(int roll = 1; roll &lt; 10; roll++) { // rand.nextInt(6) generates a number between 0 and 5 (&lt;6). add one to it // ++ adds one to the integer in the array that is at the index of 1-6. (++freq[1 + rand.nextInt(6)]); } Some strange things about this code: Roll loop starts at 1 then goes to 10 so at first glance it would seem to loop 10 times but actually runs 9 times. The ++ inside the loop would generally be located on the right and could lead to some confusion among newer programmers. freq[1 + rand.nextInt(6)] causes freq[0] to never be used.
has comment: http://stackoverflow.com/comment/38654828

http://stackoverflow.com/comment/38649903
type: Comment
type: QuestionComment
has text: I have a file to mapping Emoji unicode bytes to the real icons, but I can do nothing if i can't recognize the Emoji bytes in java language.
score: 0
comment on: http://stackoverflow.com/q/24882981

http://stackoverflow.com/comment/72427582
type: AnswerComment
score: 0
type: Comment
has text: I use Android Studio 2.3 with targetSdk set to 25 in Gradle. But compiler complains about onClickSubject.asObservable(); saying asObservable() cannot be resolved. Does anyone know why? I'm quite experienced in Android development (but don't call myself a specialist).
comment on: http://stackoverflow.com/a/24933117

http://stackoverflow.com/comment/38412163
score: 0
has text: The collection is eager and not empty. I think I tried switching the order of eviction and this didn't change a thing ;-(
type: AnswerComment
comment on: http://stackoverflow.com/a/24757489
type: Comment

http://stackoverflow.com/comment/38511376
has text: (issue is line 207, replace `vi` by `tempRow`)
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24809768

http://stackoverflow.com/comment/38700835
type: AnswerComment
comment on: http://stackoverflow.com/a/24908483
type: Comment
has text: Sorry, I'm not too sure about it.
score: 0

http://stackoverflow.com/q/24907390
tagged with: java
accepted answer: http://stackoverflow.com/a/24907391
has body: I'm coding with Java generics. I currently have to deal with sorting of generic Lists. Given List&lt;T&gt; where T is anything If T implements Comparable, then sort by natural order Else, instantiate a proper Comparator&lt;T&gt; I wrote the following code public class MyClass&lt;T&gt; { private Class&lt;T&gt; entityClass; //evaluates to T. Always! protected List&lt;T&gt; orderBy(List&lt;T&gt; list, Collection&lt;ItemSorting&gt; order) { if (order == null) if (!Comparable.class.isAssignableFrom(entityClass)) throw new RuntimeException("Entity " + entityClass.getSimpleName() + " not sortable"); else Collections.sort(list); else { Comparator&lt;T&gt; comparator = ...; //my Reflection-based comparator Collections.sort(list, comparator); } return list; } } The compilation problem lies in Collections.sort(list);. And the error is: Bound mismatch: The generic method sort(List&lt;T&gt;) of type Collections is not applicable for the arguments (List&lt;T&gt;). The inferred type T is not a valid substitute for the bounded parameter &lt;T extends Comparable&lt;? super T&gt;&gt; Obviously, I know that I cannot sort a List without a Comparator if T itself is not Comparable. But since I have checked that, I'm sure that the sorting is possibile
score: 0
answer count: 1
tagged with: generics
has answer: http://stackoverflow.com/a/24907391
has title: Bypassing Bound mismatch compile error when I checked that T implements Comparable
type: AnsweredQuestion
type: Question

http://stackoverflow.com/a/24879869
type: Answer
upvote count: 46
has comment: http://stackoverflow.com/comment/133926970
has body: You can make your thread sleep for 30 minutes like this: Thread.sleep(30 * // minutes to sleep 60 * // seconds to a minute 1000); // milliseconds to a second Using Thread.sleep is not inherently bad. Simply explained, it just tells the thread scheduler to preempt the thread. Thread.sleep is bad when it is incorrectly used. Sleeping without releasing (shared) resources: If your thread is sleeping with an open database connection from a shared connection pool, or a large number of referenced objects in memory, other threads cannot use these resources. These resources are wasted as long as the thread sleeps. Used to prevent race conditions: Sometimes you may be able to practically solve a race condition by introducing a sleep. But this is not a guaranteed way. Use a mutex. See Is there a Mutex in Java? As a guaranteed timer: The sleep time of Thread.sleep is not guaranteed. It could return prematurely with an InterruptedException. Or it could oversleep. From documentation: public static void sleep(long millis) throws InterruptedException Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. You could also use, as kozla13 has shown in their comment: TimeUnit.MINUTES.sleep(30);
has comment: http://stackoverflow.com/comment/45467469
score: 46
downvote count: 0
answers question: http://stackoverflow.com/q/24879303

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/24753435
tags question: http://stackoverflow.com/q/24875982
tags question: http://stackoverflow.com/q/24850060
tag name: httpsurlconnection

http://stackoverflow.com/comment/38670085
type: QuestionComment
has text: The most obvious solution is to use an ObjectOutputStream for serialization. There is too many examples on the web to mention here.
score: 2
comment on: http://stackoverflow.com/q/24893600
type: Comment

http://stackoverflow.com/comment/38671648
type: QuestionComment
has text: @DavidWallace C is the value, A and F are columns.
comment on: http://stackoverflow.com/q/24888353
score: 0
type: Comment

http://stackoverflow.com/a/24785207
accepted answer of: http://stackoverflow.com/q/24779906
answers question: http://stackoverflow.com/q/24779906
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has body: Firstly I'd wrap every call to MyMapper in DAO instance and keep out exception hierarchy in specific place(ExceptionHandler): public class MyDAO { MyMapper mapper; public Article getArticle(int id) { try { return mapper.getArticle(id); } catch (PersistenceException e) {//IbatisException is deprecated throw ExceptionHandler.handle(e); } } } try/catch clause probably would be duplicated in every method, so using Java proxy or AspectJ to refactor exception handling functionality might be an option. It might be possible to use load time weaving and weave around mapper itself instead of DAO. But I'd stil prefer DAO to leave myself room to extend functionality. Regarding exception hierarchy MyBatis already has exception hierarchy of it's own. And in case your are using Spring, it has it's own data access exception hierarchy, so you might try out MyBatis-Spring integration. But as documentation states, base DataAccessException is Root of the hierarchy of data access exceptions discussed in Expert One-On-One J2EE Design and Development So you might try to implement something similar based on the aforementioned book.

http://stackoverflow.com/q/24870027
tagged with: ant
score: 0
has body: I am trying to build my first android app using phonegap and for that i need jdk environment,node.js,ant. And I am able to install jdk but for Apache ant I have tried many forum and tutorials for setting the path but not able to succeeded on this. I set my varialbe like this.... Variable Name :- ANT_HOME Variable Value:- C:\JAVA\ant\bin Variable Name :- JAVA_HOME Variable Value:- C:\Program Files\Java\jdk1.7.0_60\jre\bin\ But still i am getting "unalbe to locate tools.jar. Expected to find in C:\ProgramFiles\java\jre7\lib\tools.jar BuildFile: build.xml doest not exists. Build Failed. PLEASE HELP ME OUT FROM THIS ANONYMOUS TROUBLES..
answer count: 3
has title: How to set environment variable for ant
tagged with: cordova
has answer: http://stackoverflow.com/a/24870463
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/54434056
has answer: http://stackoverflow.com/a/24870962
tagged with: java
type: Question

http://stackoverflow.com/comment/38436407
type: Comment
has text: @MonaJalal Previously, you may have had a number such as `3.14` that would have "worked", because each digit would have been necessary anyway.
score: 1
comment on: http://stackoverflow.com/a/24770091
type: AnswerComment

http://stackoverflow.com/comment/38445794
type: Comment
type: AnswerComment
score: 0
has text: @a_horse_with_no_name yeah exactly, he needs to shift to the latest version of the drivers
comment on: http://stackoverflow.com/a/24773065

http://stackoverflow.com/a/24774947
answers question: http://stackoverflow.com/q/24774917
score: 0
type: Answer
has body: BigDecimal.valueOf(&lt;string read in from command line&gt;)

http://stackoverflow.com/comment/38643631
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24864144
has text: hi @Stefan , sorry , I am using Log.info("") only

http://stackoverflow.com/q/24778827
has answer: http://stackoverflow.com/a/24780786
has comment: http://stackoverflow.com/comment/38453246
type: Question
has comment: http://stackoverflow.com/comment/38452314
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24780242
has answer: http://stackoverflow.com/a/24779048
has body: I am a bit confused about what JDBC version to use for MySQL server 5.1.72. Could you please tell me, what version I should use and why?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38452309
tagged with: jdbc
tagged with: java
has title: What is the right JDBC version for MySQL server 5.1.72?
tagged with: mysql

http://stackoverflow.com/q/24818483
tagged with: java
has comment: http://stackoverflow.com/comment/38527850
type: Question
has body: I am unable to add navigation in drawer in intelli J idea. Can any one please tell me how can I add navigation drawer in intelliJ idea.
has comment: http://stackoverflow.com/comment/38528035
has title: I can not add Navigation Drawer in intelli J Idea
score: 0
has comment: http://stackoverflow.com/comment/38527533
type: UnansweredQuestion
tagged with: android
tagged with: intellij-13
tagged with: http://stackoverflow.com/tag/xml
answer count: 0

performance
tags question: http://stackoverflow.com/q/24806154
tags question: http://stackoverflow.com/q/24904265
tags question: http://stackoverflow.com/q/24868943
tags question: http://stackoverflow.com/q/24899038
tags question: http://stackoverflow.com/q/24793823
tags question: http://stackoverflow.com/q/24764118
tags question: http://stackoverflow.com/q/24817045
tags question: http://stackoverflow.com/q/24777650
tags question: http://stackoverflow.com/q/24803741
tags question: http://stackoverflow.com/q/24792112
tags question: http://stackoverflow.com/q/24790540
tags question: http://stackoverflow.com/q/24899315
tags question: http://stackoverflow.com/q/24848062
tags question: http://stackoverflow.com/q/24900138
tags question: http://stackoverflow.com/q/24791311
tags question: http://stackoverflow.com/q/24843491
tags question: http://stackoverflow.com/q/24884923
tags question: http://stackoverflow.com/q/24855415
tags question: http://stackoverflow.com/q/24818823
tags question: http://stackoverflow.com/q/24788718
tags question: http://stackoverflow.com/q/24789646
tags question: http://stackoverflow.com/q/24809711
tags question: http://stackoverflow.com/q/24875362
tags question: http://stackoverflow.com/q/24817014
tags question: http://stackoverflow.com/q/24800063
tags question: http://stackoverflow.com/q/24830936
tags question: http://stackoverflow.com/q/24837232
tags question: http://stackoverflow.com/q/24882946
tags question: http://stackoverflow.com/q/24903901
tags question: http://stackoverflow.com/q/24773506
tags question: http://stackoverflow.com/q/24780521
tags question: http://stackoverflow.com/q/24797155
tags question: http://stackoverflow.com/q/24835763
tag name: performance
type: Tag
tags question: http://stackoverflow.com/q/24779758
tags question: http://stackoverflow.com/q/24814637
tags question: http://stackoverflow.com/q/24754622
tags question: http://stackoverflow.com/q/24873010
tags question: http://stackoverflow.com/q/24838198
tags question: http://stackoverflow.com/q/24802335

http://stackoverflow.com/a/24796230
type: Answer
has comment: http://stackoverflow.com/comment/38486484
has comment: http://stackoverflow.com/comment/38487586
has comment: http://stackoverflow.com/comment/38490609
has body: Since you are using the AlarmManager.ELAPSED_REALTIME_WAKEUP argument, your initial alarm-time should be base on the elapsed real time of the device: long alarmtime = SystemClock.elapsedRealtime() + 10 * 1000; alarmman.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, alarmtime, 10 * 1000, pi); (see this link). For a BroadcastReceiver it's probably PendingIntent.getBroadcast() instead of PendingIntent.getService(). You are also cancelling the alarm, just update your PendingIntent like this and try not cancelling before: PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT); Read the documentation thoroughly for further information.
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24796127
has comment: http://stackoverflow.com/comment/38487236
has comment: http://stackoverflow.com/comment/38489512
accepted answer of: http://stackoverflow.com/q/24796127
has comment: http://stackoverflow.com/comment/38487553
has comment: http://stackoverflow.com/comment/38486116

http://stackoverflow.com/a/24800967
score: 0
type: Answer
has body: Consider to use one-way &lt;int-ip:tcp-outbound-channel-adapter&gt;: http://docs.spring.io/spring-integration/docs/latest-ga/reference/html/ip.html#tcp-adapters
accepted answer of: http://stackoverflow.com/q/24800016
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24800016

http://stackoverflow.com/comment/38536770
type: Comment
has text: i included the path of jni.h, jni_md and jvm.dll,but can not create virtual machine,i have this error: [ilink32 Error] Error: Unresolved external 'JNI_CreateJavaVM' referenced from C:\USERS\DOCUMENTS\RAD STUDIO\PROJECTS\CPPTOJAVA\WIN32\DEBUG\MAIN.OBJ
comment on: http://stackoverflow.com/q/24823133
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38588075
type: AnswerComment
score: 0
has text: That's really not my question :P Read the second answer below, another guy already said that. I've made some changes. What's wrong with just printing out "e" ?
type: Comment
comment on: http://stackoverflow.com/a/24850606

http://stackoverflow.com/q/24847716
tagged with: wicket
has title: How to test a link's text in Wicket
type: AnsweredQuestion
score: 1
tagged with: wicket-tester
tagged with: java
accepted answer: http://stackoverflow.com/a/24859584
upvote count: 1
tagged with: unit-testing
has body: I'm trying to implement a link with dynamic text in Wicket, with the username as its text. My first thought was to do something like this in the markup: &lt;a wicket:id="somelink"&gt;&lt;wicket:message key="some.key"&gt;bla bla&lt;/wicket:message&gt;&lt;/a&gt; With the properties file looking like this: some.key=Username is: {0} And the code: String username = ... add(new Link("somelink", new StringResourceModel("some.key", this, null, username)) { ... }); The problem is that I have no idea how to test that the link's text is being set to the username (in the unit test that is). I've tried: Using WicketTester's assertLabel method, but it can't cast the Link to a Label Using the Link's getModelObject() method returns the original message (i.e. before formatting the username into it) Adding an id to the message and accessing it directly through a path, doesn't work since I get the message that this path doesn't exist (can you even give an ID to a wicket:message element ?) Any thoughts ?
type: Question
tagged with: tdd
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24859584
favorite count: 0

facebook
tags question: http://stackoverflow.com/q/24849042
type: Tag
tags question: http://stackoverflow.com/q/24818419
tags question: http://stackoverflow.com/q/24899211
tags question: http://stackoverflow.com/q/24873454
tag name: facebook
tags question: http://stackoverflow.com/q/24893605
tags question: http://stackoverflow.com/q/24830987
tags question: http://stackoverflow.com/q/24832149
tags question: http://stackoverflow.com/q/24804068
tags question: http://stackoverflow.com/q/24838374

http://stackoverflow.com/comment/38710149
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24900679
type: AnswerComment
has text: Seeing that my xml file has two different elements with id's, and they both have child elements that also have id's, how should I go about finding them? Would I do entity[@id='1'] and then option[@id='1']? Thank you, and this seems like a good solution.

http://stackoverflow.com/q/24790398
has comment: http://stackoverflow.com/comment/38475914
has title: Create file inside folder "resources" of spring project
has comment: http://stackoverflow.com/comment/38476758
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/18664579
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38476293
upvote count: 1
has comment: http://stackoverflow.com/comment/38475954
tagged with: spring
has body: In my current spring, some forms have a field where the user can upload a file, which should be saves inside the folder resources from project (src/main/resources, following the structure created by maven). the method responsible for save the file in this folder is working ok until this line: URL path = this.getClass().getClassLoader().getResource(file); the variable path is staying with the value null. the variable file is defined with this value: String file = "/"+this.getName()+"/"+String.valueOf(id)+"/picture.jpg"; Anyone can tell me the right way to do this? PS.: the complete code for this method is: public boolean upload_picture(E e, MultipartFile f) { Integer id = null; if(f == null) { return false; } Class&lt;?&gt; clazz = e.getClass(); Method methods[] = clazz.getDeclaredMethods(); for(int i=0; i&lt;methods.length; i++) { if(methods[i].getName().equals("getId")) { try { id = (Integer) methods[i].invoke(e); } catch (IllegalAccessException e1) { e1.printStackTrace(); return false; } catch (IllegalArgumentException e1) { e1.printStackTrace(); return false; } catch (InvocationTargetException e1) { e1.printStackTrace(); return false; } } } BufferedImage src; try { src = ImageIO.read(new ByteArrayInputStream(f.getBytes())); } catch (IOException e3) { e3.printStackTrace(); return false; } String file = "/"+this.getName()+"/"+String.valueOf(id)+"/picture.jpg"; URL path = this.getClass().getClassLoader().getResource(file); File destination; try { destination = new File(path.toURI()); } catch (URISyntaxException e2) { destination = new File(path.getPath()); e2.printStackTrace(); } try { ImageIO.write(src, "jpeg", destination); return true; } catch (IOException e1) { e1.printStackTrace(); return false; } }
type: Question
has comment: http://stackoverflow.com/comment/38475307
has comment: http://stackoverflow.com/comment/38475883
score: 1
tagged with: java

http://stackoverflow.com/comment/38729788
score: 0
type: AnswerComment
has text: removed...still error exisits
type: Comment
comment on: http://stackoverflow.com/a/24908259

jackson
tags question: http://stackoverflow.com/q/24832614
tags question: http://stackoverflow.com/q/24834193
tags question: http://stackoverflow.com/q/24901391
tags question: http://stackoverflow.com/q/24778687
tags question: http://stackoverflow.com/q/24808687
tags question: http://stackoverflow.com/q/24799457
tags question: http://stackoverflow.com/q/24827621
tags question: http://stackoverflow.com/q/24867344
tags question: http://stackoverflow.com/q/24894342
type: Tag
tags question: http://stackoverflow.com/q/24819442
tags question: http://stackoverflow.com/q/24820123
tags question: http://stackoverflow.com/q/24880613
tags question: http://stackoverflow.com/q/24868064
tags question: http://stackoverflow.com/q/24761843
tags question: http://stackoverflow.com/q/24785013
tags question: http://stackoverflow.com/q/24769322
tag name: jackson
tags question: http://stackoverflow.com/q/24873786
tags question: http://stackoverflow.com/q/24889081
tags question: http://stackoverflow.com/q/24889998
tags question: http://stackoverflow.com/q/24869708
tags question: http://stackoverflow.com/q/24890447
tags question: http://stackoverflow.com/q/24795488
tags question: http://stackoverflow.com/q/24752326
tags question: http://stackoverflow.com/q/24765713
tags question: http://stackoverflow.com/q/24797873
tags question: http://stackoverflow.com/q/24831071
tags question: http://stackoverflow.com/q/24769182
tags question: http://stackoverflow.com/q/24877844
tags question: http://stackoverflow.com/q/24821565

http://stackoverflow.com/comment/38578030
comment on: http://stackoverflow.com/q/24845299
has text: @Cubby208 - wondering why you are using udemy. Most of those courses are junk. Try using text books instead if you can't find alternate sources for good video tutorials. Here are some suggestions of various levels of textbook - head first java, java - how to program by deitel, thinking in java. Good luck and use google to get clues for errors in your code.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38637583
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24876323
has text: At least @Braj knows what Im talking about. PM 77-1 This is in no possible way a duplicate of Coverting a Java String to a byte[] array. Im aware of how to do that, Im NOT aware however, of how to put the actual input string value and set it as binary.

http://stackoverflow.com/q/24823478
tagged with: java
has comment: http://stackoverflow.com/comment/38541882
tagged with: apache-tomee
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38536822
score: 0
has comment: http://stackoverflow.com/comment/38537314
has body: I'm trying to deploy an application on a TomEE server. I have run the application successfully within Eclipse under Tomcat 7. When I try to deploy it on TomEE the application won't autostart and starting it manually the server returns an error message and removes the app from the list. I'm a newbie at both Tomcat &amp; Java and the TomEE server has been setup by another department. I don't like to past logs of errors, but I'm at a loss. When the app is deployed the errors in the the log are: SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/pce2json]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1648) at sun.reflect.GeneratedMethodAccessor299.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1496) at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:286) at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:206) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at javax.servlet.htt…
answer count: 0
type: UnansweredQuestion
has title: Application won't start on TomEE, but works on Tomcat 7
type: Question

http://stackoverflow.com/q/24876560
has comment: http://stackoverflow.com/comment/38638129
downvote count: 1
type: Question
has body: I have an issue , i need to use json for java and i try to import a it's library by this way : import org.json.simple.JSONObject; but it don't work , it says that the package org.json.simple does not exist . any help please (I use netbeans)
has comment: http://stackoverflow.com/comment/38638099
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38638061
favorite count: 0
score: -1
tagged with: netbeans
has answer: http://stackoverflow.com/a/24876724
has title: Json library for java on netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38638107
has comment: http://stackoverflow.com/comment/38638086
linked to: http://stackoverflow.com/q/5893349
has comment: http://stackoverflow.com/comment/38638018
tagged with: java
has comment: http://stackoverflow.com/comment/38638085
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/38509109
score: 1
has text: @ayushi That's a relative path, and OP can't give the absolute path, or the relative path, because s/he doesn't know it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24807920

http://stackoverflow.com/comment/38585401
comment on: http://stackoverflow.com/a/24848859
score: 0
has text: I did decide to simplify my code to be more inline with the asker's code.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38597728
has text: Y, sorry my englisj is low.
type: AnswerComment
comment on: http://stackoverflow.com/a/24855371
type: Comment
score: 1

http://stackoverflow.com/comment/38466918
has text: Sorry I can't do that, I don't have enough reputation. :(
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24776192
type: Comment

http://stackoverflow.com/q/24801507
has answer: http://stackoverflow.com/a/45671030
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/63207847
upvote count: 8
tagged with: filter
has answer: http://stackoverflow.com/a/37876286
has title: OutOfOrderScannerNextException when filtering results in HBase
linked to: http://stackoverflow.com/q/37011342
score: 8
has comment: http://stackoverflow.com/comment/58856094
tagged with: hbase
has body: I am trying to filter results in HBase this way: List&lt;Filter&gt; andFilterList = new ArrayList&lt;&gt;(); SingleColumnValueFilter sourceLowerFilter = new SingleColumnValueFilter(Bytes.toBytes("cf"), Bytes.toBytes("source"), CompareFilter.CompareOp.GREATER, Bytes.toBytes(lowerLimit)); sourceLowerFilter.setFilterIfMissing(true); SingleColumnValueFilter sourceUpperFilter = new SingleColumnValueFilter(Bytes.toBytes("cf"), Bytes.toBytes("source"), CompareFilter.CompareOp.LESS_OR_EQUAL, Bytes.toBytes(upperLimit)); sourceUpperFilter.setFilterIfMissing(true); SingleColumnValueFilter targetLowerFilter = new SingleColumnValueFilter(Bytes.toBytes("cf"), Bytes.toBytes("target"), CompareFilter.CompareOp.GREATER, Bytes.toBytes(lowerLimit)); targetLowerFilter.setFilterIfMissing(true); SingleColumnValueFilter targetUpperFilter = new SingleColumnValueFilter(Bytes.toBytes("cf"), Bytes.toBytes("target"), CompareFilter.CompareOp.LESS_OR_EQUAL, Bytes.toBytes(upperLimit)); targetUpperFilter.setFilterIfMissing(true); andFilterList.add(sourceUpperFilter); andFilterList.add(targetUpperFilter); FilterList andFilter = new FilterList(FilterList.Operator.MUST_PASS_ALL, andFilterList); List&lt;Filter&gt; orFilterList = new ArrayList&lt;&gt;(); orFilterList.add(sourceLowerFilter); orFilterList.add(targetLowerFilter); FilterList orFilter = new FilterList(FilterList.Operator.MUST_PASS_ONE, orFilterList); FilterList fl = new FilterList(FilterList.Operator.MUST_PASS_ALL); fl.addFilter(andFilter); fl.addFilter(orFilter); Scan edgeScan = new Scan(); edgeScan.setFilter(fl); ResultScanner edgeScanner = table.getScanner(edgeScan); Result edgeResult; logger.info("Writing edges..."); while ((edgeResult = edgeScanner.next()) != null) { // Some code } This code launchs this error: org.apache.hadoop.hbase.DoNotRetryIOException: Failed after retry of OutOfOrderScannerNextException: was there a rpc timeout? at org.apache.hadoop.hbase.client.ClientScanner.next(ClientScanner.java:402) at org.deustotech.internet…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/58636393
tagged with: java

http://stackoverflow.com/a/24820359
has comment: http://stackoverflow.com/comment/38531256
accepted answer of: http://stackoverflow.com/q/24820325
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24820325
type: Answer
score: 4
has body: Those classes are marked as @Deprecated. This means that the compiler advises not to use them, because they can bring you problems. A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code. Check the javadoc(s) of the deprecated classes to check which classes to use instead.
upvote count: 4

http://stackoverflow.com/a/24853297
type: Answer
accepted answer of: http://stackoverflow.com/q/24772860
answers question: http://stackoverflow.com/q/24772860
has body: After taking hard time to figure out how the Matcher work I was able to create a tokenizer a little more sophisticated than the usual Scanner. Since no one answered Here's the relevant part (since this was school assignment I can share the code): private final Scanner scanner; private final String delimiter = "\\*|/|-|\\(|\\)|"; private final Pattern delim = Pattern.compile(delimiter); private Matcher delim_matcher; private String region; private int regionStart; private int regionEnd; private int start; private int end; // Called by constructor, I stripped the constructor because trivial private void Init(){ scanner = new Scanner(System.in); region = scanner.next(); delim_matcher = delim.matcher(region); regionStart = 0; regionEnd = region.length(); } private boolean nextDelimiter(){ boolean found = delim_matcher.find(); start = found ? delim_matcher.start() : delim_matcher.regionEnd(); end = found? delim_matcher.end(): delim_matcher.regionEnd(); return found; } private boolean hasPrefix(){ return start &gt; regionStart; } public TokenType next() throws NoSuchElementException{ //find next delimiter ( symbol ) boolean found = nextDelimiter(); //TODO: see breakpoints here if(hasPrefix()){ //there was something before the delimiter (keyword, identificator etc.) decodePrefix( region.substring(regionStart,start) ); if(found) delim_matcher.region(start,regionEnd); //reset to match symbol next time regionStart = start; //hasPrefix -&gt; false return tokenType; } else if(!hasPrefix() &amp;&amp; found){ decodeSymbol( region.substring(start,end)); delim_matcher.region(end,regionEnd); //reset to skip already found symbol regionStart = end; return tokenType; } else{ if(scanner.hasNext()){ //next is not a whitespace (because scanner already skip blanks) region = scanner.next(); delim_matcher = delim.matcher(region); regionStart = 0; regionEnd = region.length(); return next(); }else return tokenType = EOF; } } public boolean hasNext() { return tokenType != EOF; //EOF is a value …
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/24758359
tagged with: jsp
has comment: http://stackoverflow.com/comment/38414265
score: 1
favorite count: 0
has body: I'm doing a project where there is an insertion operation. First I'm sending the required data from my form in JSP to my Servlet. I want to get a response from the Servlet back to the JSP page so that I can display a message that the value has been inserted successfully. Please tell me how to do this.
has answer: http://stackoverflow.com/a/24758467
type: AnsweredQuestion
has title: Sending response of Servlet back to the JSP
possible better answer: http://stackoverflow.com/a/24758467
upvote count: 3
downvote count: 2
has answer: http://stackoverflow.com/a/24758579
type: Question
tagged with: jakarta-ee
tagged with: java
tagged with: servlets
answer count: 2
accepted answer: http://stackoverflow.com/a/24758579

poker
tags question: http://stackoverflow.com/q/24836561
tag name: poker
tags question: http://stackoverflow.com/q/24817745
tags question: http://stackoverflow.com/q/24900525
tags question: http://stackoverflow.com/q/24811003
type: Tag
tags question: http://stackoverflow.com/q/24819037

http://stackoverflow.com/comment/38592486
score: 0
has text: *it avoids the need to create Character objects from char primitives.* have you heard about [Autoboxing and Unboxing](http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html)?
type: Comment
comment on: http://stackoverflow.com/a/24852861
type: AnswerComment

http://stackoverflow.com/a/24863003
upvote count: 1
has body: The problem is in your bruteforce method. You are expecting it to return false after you have removed all the duplicates, but this is not the case. Your replace method is working ok and putting the String null where the duplicates A appeared. It is putting in more than one String null (one for each extra 'A' ) and because of this your bruteforce method still sees duplicates and still returns true. Just add if(!input[i].equals("null")) To your bruteforce method and it should be fine
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24862669

http://stackoverflow.com/a/38600738
type: Answer
has comment: http://stackoverflow.com/comment/64590212
has comment: http://stackoverflow.com/comment/64589608
has comment: http://stackoverflow.com/comment/64590170
has comment: http://stackoverflow.com/comment/64589665
has body: Perhaps an alternate approach would be to simply use a FutureCallback or an AsyncFunction? FutureCallback example: final List&lt;ListenableFuture&lt;T&gt;&gt; futures = new ArrayList&lt;ListenableFuture&lt;T&gt;&gt;(); final Callable&lt;T&gt; callable = new Callable&lt;T&gt;() { // Some task you want to complete }; // Submit all your tasks for execution futures.add(listeningExecutorService.submit(callable)); // ... add as many tasks as you have futures.add(listeningExecutorService.submit(callable)); // Get a single Future to wait on final ListenableFuture&lt;List&lt;T&gt;&gt; future = Futures.allAsList(futures); Futures.addCallback(future, new FutureCallback&lt;List&lt;T&gt;&gt;() { @Override public void onSuccess(final List&lt;T&gt; result) { // Begin other tasks using `result` (the set of results from the first tasks) } @Override public void onFailure(final Throwable t) { // ... } }); This would be helpful if you don't care about waiting around for the second set of tasks to complete, as Futures.addCallback doesn't return anything. AsyncFunction example: final ListenableFuture&lt;O&gt; result = Futures.transform(future, new AsyncFunction&lt;List&lt;T&gt;, O&gt;() { @Override public ListenableFuture&lt;O&gt; apply(final List&lt;T&gt; input) { // Begin other tasks using `input` (the set of results from the first tasks) } }); This would be beneficial if you want to wait on the resulting ListenableFuture, or potentially add a third set of tasks that need to happen upon completion of the second set.
answers question: http://stackoverflow.com/q/24854811
has comment: http://stackoverflow.com/comment/64589320
score: 0

http://stackoverflow.com/a/24857090
upvote count: 16
accepted answer of: http://stackoverflow.com/q/24857070
score: 16
has comment: http://stackoverflow.com/comment/60678720
answers question: http://stackoverflow.com/q/24857070
has comment: http://stackoverflow.com/comment/38601055
has body: Just add input.next() once you catch InputMismatchException. catch (InputMismatchException e) { //if an exception appears prints message below System.err.println("Please enter a number! " + e.getMessage()); input.next(); // clear scanner wrong input continue; // continues to loop if exception is found } You need to clear the wrong input, which scanner automatically does not.
has comment: http://stackoverflow.com/comment/60671432
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38691464
type: AnswerComment
has text: I have tried PoolingHttpClientConnectionManager which still blocked thread when use up connections in pool, so I try to use BasicHttpClientConnectionManager. I hope to get a method to release conection to let thread can continue using it to post data.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24904809

http://stackoverflow.com/q/24834815
has comment: http://stackoverflow.com/comment/38591481
has comment: http://stackoverflow.com/comment/38560324
favorite count: 0
tagged with: latency
tagged with: sockets
type: AnsweredQuestion
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/38581142
has answer: http://stackoverflow.com/a/24834983
accepted answer: http://stackoverflow.com/a/24834983
has comment: http://stackoverflow.com/comment/38558847
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/38558702
has body: Note: TCP_NODELAY didn't seem to solve the issue described below. The Main issue: TCP sockets have bad latency (100ms+) unless they're streaming data constantly. If I send a message normally, the latency is 100ms or worse. I tried sending garbage data at regular intervals (every 0.05 seconds) and putting my actual messages in between, and the latency improved immensely. The Question: Why do TCP messages have a bad latency when they're sent alone, but they have good latency when the socket is streaming large amounts of data? Some other things: I tried Datagrams (UDP) and I still got a bad latency. My lan ping is pretty bad between computers, which may be related. I've got an Apple Aiport Express. I've also tried creating wireless networks directly between my Macs, but I still get a bad ping. This may or may not be related. I don't know if it's just the result of the ping command having a really low priority or not. It seems to be consistent with the socket latency though.
has title: TCP socket has bad latency unless constantly streaming
downvote count: 0
answer count: 1
score: 4
has comment: http://stackoverflow.com/comment/38558755

http://stackoverflow.com/comment/38450667
comment on: http://stackoverflow.com/a/24762493
score: 0
type: AnswerComment
type: Comment
has text: Entry keys are immutable. Listen, Java's collection/type system is more than rich enough. Why don't you just create a treemap that does exactly what you want?

http://stackoverflow.com/q/24873671
has title: Delete button in a Jtable
score: 0
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24874106
tagged with: jtable
has comment: http://stackoverflow.com/comment/38632991
type: UnansweredQuestion
has body: I added a button in each row of my Jtable, but without action. The button "delete" must delete the row from my Jtable and also my database. I thought of using map, the map contains the row number and id in my database, but i'm stack, i couldn't continue with that logic. here is my code : public class Fenetre extends JFrame { Statement stmt; Map&lt;Integer,Integer&gt; row_table = new HashMap&lt;Integer,Integer&gt;(); public Fenetre(){ this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle("JTable"); this.setSize(600, 140); String requeteListeUser=" SELECT * FROM COMPTE_UTILISATEUR"; try{ stmt= (Statement) new Connexion().getConnection().createStatement(); ResultSet resultat= stmt.executeQuery(requeteListeUser); resultat.last(); String title[] = {"Nom","Prenom","Matricule","Action"}; int rowCount = resultat.getRow(); Object[][] data = new Object[rowCount][4]; JTable tableau = new JTable(data,title); // this.tableau = new JTable(model); tableau.getColumn("Action").setCellRenderer(new ButtonRenderer()); this.getContentPane().add(new JScrollPane(tableau), BorderLayout.CENTER); int i=0; resultat.beforeFirst(); // on repositionne le curseur avant la première ligne while(resultat.next()) //tant qu'on a quelque chose à lire { //Remplire le tableau à deux dimensions Data[][] for(int j=1;j&lt;=4;j++) { if(j != 4)data[i][j-1]=resultat.getObject(j)+""; else data[i][j-1] = new JButton("Supprimer"); } i++; row_table.put(i, resultat.getInt("id_utilisateur")); } } catch(SQLException ex){ System.out.println(ex); } } //Classe model customized class ZModel extends AbstractTableModel{ private Object[][] data; private String[] title; //Constructor public ZModel(Object[][] data, String[] title){ this.data = data; this.title = title; } //Number of columns public int getColumnCount() { return this.title.length; } //Number of rows public int getRowCount() { return this.data.length; } //The value at the specified à l'emplacement spécifié public Ob…
tagged with: swing
tagged with: jbutton
has comment: http://stackoverflow.com/comment/38633284

http://stackoverflow.com/a/24780150
has comment: http://stackoverflow.com/comment/57739064
has comment: http://stackoverflow.com/comment/38455404
type: Answer
has comment: http://stackoverflow.com/comment/59201663
has comment: http://stackoverflow.com/comment/38455280
upvote count: 6
has body: Use the below regex and replace the matched strings with empty string, [&amp;?]language.*?(?=&amp;|\?|$) DEMO Example code: String s1 = "/fr/welcome?param1=222&amp;param2=aloa&amp;language=en"; String s2 = "/fr/welcome?language=en"; String s3 = "/fr/welcome?param1=222&amp;language=en&amp;param2=aa"; String m1 = s1.replaceAll("[&amp;?]language.*?(?=&amp;|\\?|$)", ""); String m2 = s2.replaceAll("[&amp;?]language.*?(?=&amp;|\\?|$)", ""); String m3 = s3.replaceAll("[&amp;?]language.*?(?=&amp;|\\?|$)", ""); System.out.println(m1); System.out.println(m2); System.out.println(m3); Output: /fr/welcome?param1=222&amp;param2=aloa /fr/welcome /fr/welcome?param1=222&amp;param2=aa IDEONE 1 or IDEONE 2
has comment: http://stackoverflow.com/comment/38455066
answers question: http://stackoverflow.com/q/24780016
has comment: http://stackoverflow.com/comment/59201978
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24780016
score: 5
has comment: http://stackoverflow.com/comment/57739357
has comment: http://stackoverflow.com/comment/119617648
type: AcceptedAnswer

http://stackoverflow.com/q/24833273
type: Question
tagged with: java
tagged with: jaxb
has body: I am working on a piece of code that repurposes orm xmls by adding extra elements to the standard ones. I would like to use JAXB to parse the extended configuration files and JAXB parses my example xmls fine but skips the added element. Here is some more detail. The extending xsd looks like this: &lt;xsd:schema targetNamespace="http://somewhere/xml/ns/orm_extension" xmlns="http://somewhere/xml/ns/orm_extension" xmlns:orm="http://xmlns.jcp.org/xml/ns/persistence/orm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xsd:import schemaLocation="orm_2_1.xsd" namespace="http://xmlns.jcp.org/xml/ns/persistence/orm" /&gt; &lt;xsd:element name="entity"&gt; &lt;xsd:complexType&gt; &lt;xsd:complexContent xml:base="orm:entity"&gt; &lt;xsd:extension base="orm:entity"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="some-context" type="someContext" /&gt; &lt;/xsd:sequence&gt; &lt;/xsd:extension&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:complexType name="someContext"&gt; ........ &lt;/xsd:complexType&gt; &lt;/xsd:schema&gt; and the above is also the xsd I used for generation of Java classes. As for my test xml this is the content: &lt;entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm" version="2.1" xmlns:ext="http://somewhere/xml/ns/orm_extension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://somewhere/xml/ns/orm_extension http://somewhere/xml/ns/orm_extension"&gt; &lt;ext:entity&gt; &lt;/ext:entity&gt; &lt;/entity-mappings&gt; and the code that is use for testing is: @Test public void testRead() throws JAXBException { JAXBContext context = JAXBContext.newInstance(EntityMappings.class); Unmarshaller unmarshaller = context.createUnmarshaller(); EntityMappings em = (EntityMappings) unmarshaller.unmarshal( ClassLoader.getSystemResourceAsStream("schema/test.xml")); assertNotNull(em); assertEquals(1, em.getEntities().size())…
score: 0
answer count: 1
has title: JAXB ignores extended element while parsing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24834311
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/24904875
type: Answer
answers question: http://stackoverflow.com/q/24904703
score: 0
has body: By looking at the source code of FileUtils.contentEquals, it uses a BufferedInputStream to make the comparison between the two files (by giving an InputStream of the two files to IOUtils.contentEquals). And since BufferedInputStream is supposed to be thread-safe (it is what I read at least, I never try it myself), I suppose that FileUtils.contentEquals should be thread-safe as well.

nutch
tags question: http://stackoverflow.com/q/24771239
tag name: nutch
type: Tag
tags question: http://stackoverflow.com/q/24824844

http://stackoverflow.com/a/24883147
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24764745
type: Answer
has body: I'm using XML-RPC with PHP, and the login() method authenticates the user credentials and returns a user ID. Each call to subsequent methods needs the user ID and password - it seems there is no need to actually log in - it is just there to validate the user credentials. I cannot find any documentation on this, but it appears that the XML-RPC API is stateless - there is no need to log in and log out. However, there is a session interface available through the API, but it is unclear whether that is of any use with XML-RPC. It could be possible that logout() interacts with the session to connect/remove an authenticated user to the session. The session ID is a UUID string. Sorry if that is a bit fuzzy; most of what I've found out is trial-and-error, as the documentation unfortunately skips over any of the important points.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38927596
answers question: http://stackoverflow.com/q/24764745
upvote count: 2

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/24908826
tags question: http://stackoverflow.com/q/24885800
type: Tag
tags question: http://stackoverflow.com/q/24756420
tags question: http://stackoverflow.com/q/24889923
tags question: http://stackoverflow.com/q/24869322
tags question: http://stackoverflow.com/q/24874176
tags question: http://stackoverflow.com/q/24833607
tags question: http://stackoverflow.com/q/24825177
tags question: http://stackoverflow.com/q/24781318
tags question: http://stackoverflow.com/q/24807123
tags question: http://stackoverflow.com/q/24876762
tags question: http://stackoverflow.com/q/24749303

http://stackoverflow.com/comment/38588665
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24848922
type: Comment
has text: @ThomasJungblut First the OP speaks of IO bottleneck (read + write ...). Ehcache is expected to improve performance at least on reads. And *depending on your consistency requirements*, Ehcache supports write behind mode that may still improve performances if many writes concern the same element. Of course, if every request concern a different element there is nothing to cache and the gain could only concern anicilliary data ...

http://stackoverflow.com/comment/38665850
type: AnswerComment
comment on: http://stackoverflow.com/a/24890516
has text: i m new here don't know where to post ....i m getting error just like different conditions like asthma, diabetic etc //error// No enum constant com.mp.model.ConditionType.Asthama // i m using couchbase db (no sql db)
score: 0
type: Comment

http://stackoverflow.com/a/24826531
has comment: http://stackoverflow.com/comment/38543218
has body: Here's what's happening From your client: this.clientSocket = new Socket("192.168.1.25", 10501); When this line runs, the server will be woken up from the accept line. And block again at readLine() Meanwhile, your client, goes through your PacketSender. What does your PacketSender do? Socket socket = new Socket(hostName, Integer.parseInt(port)); This opens a new connection! So your Client is waiting for the server to accept a connection. And the server is waiting for the client to send a message! You arrive at a deadlock. Here's how to fix it remove the following line. this.clientSocket = new Socket("192.168.1.25", 10501); then pass the host address and port manually into your PacketSender.
score: 0
answers question: http://stackoverflow.com/q/24825547
type: Answer
has comment: http://stackoverflow.com/comment/38543276
has comment: http://stackoverflow.com/comment/38543066

http://stackoverflow.com/q/24789321
type: UnansweredQuestion
tagged with: servlets
answer count: 0
downvote count: 0
score: 1
tagged with: file-upload
favorite count: 0
tagged with: linux
type: Question
tagged with: java
upvote count: 1
tagged with: tomcat7
has title: file upload from window to linux server using servlet jsp
has body: i have tomcat server installed on linux machine .My webapp is deployed on linux machine and having browse functionality to browse the file. Now my requirement is to upload the browse file of window machine to linux server, in given specified folder on linux using servlet. I am using sshxcute framework for running the custom command.This framework provide the functionality to upload the file to linux server machine. i have tried running it through main class its working properly. But when i tried to do the same thing using servlet jsp its not working because while browsing i am getting file name only, not the full path of a file. Even if i hardcoded the path of file to ssh.uploadSingleDataToServer("C:/Users/MyPC/Documents/Youcam/apg.doc", "/home/cloudera/Desktop/Input");on Servlet class and accessing my webapp to different window machine its uploading the file apg.doc in given folder, but data of apg.doc is not coming why? please tell me where am i wrong on this approach or suggest me different approach thanks Code through main class working fine public class TestUpload{ public void upload(){ // Initialize a SSHExec instance without referring any object. SSHExec ssh = null; // Wrap the whole execution jobs into try-catch block try { // Initialize a ConnBean object, parameter list is ip, username, password ConnBean cb = new ConnBean("9.125.71.115", "cloudera","cloudera"); // Put the ConnBean instance as parameter for SSHExec static method getInstance(ConnBean) to retrieve a real SSHExec instance ssh = SSHExec.getInstance(cb); // Create a ExecShellScript, the reference class must be CustomTask CustomTask ct2 = new ExecShellScript("/home/cloudera/Desktop","./test.sh"); // Connect to server ssh.connect(); // Upload sshxcute_test.sh to /home/cloudera/Desktop/Input on remote system ssh.uploadSingleDataToServer("C:/Users/MyPC/Documents/Youcam/apg.doc", "/home/cloudera/Desktop/Input"); // Execute task and get the returned Result object Result res = ssh.exec(ct2); // Check re…

http://stackoverflow.com/comment/38514657
comment on: http://stackoverflow.com/q/24811142
score: 0
type: Comment
type: QuestionComment
has text: I added a minimal test code, yet NOW it decides to work.... I give up

http://stackoverflow.com/comment/38599382
comment on: http://stackoverflow.com/q/24856150
score: 0
type: Comment
has text: Beth, if that is part of the current assignment, then I'd do it now. No sense having to re-write this part of the code when you implement the Book class. Might as well write the code once.
type: QuestionComment

http://stackoverflow.com/q/24757103
answer count: 3
has answer: http://stackoverflow.com/a/24763497
has answer: http://stackoverflow.com/a/24757607
upvote count: 6
has comment: http://stackoverflow.com/comment/38412074
tagged with: java
has body: After some problems with differences between JSE versions, I'm trying to log the Java compiler version used to compile (it's Groovy 2.1.9, Grails 2.3.8, Java 1.7.0_60 in fact). After some rummaging around, I've constructed this piece of code to read the leading bytes of the class - see /http://en.wikipedia.org/wiki/Java_class_file#General_layout (change the path to the class to match the package name): class CompilerVersionSupport { public static String getVersion() { String classAsPath = 'com/my/organisation/CompilerVersionSupport.class'; InputStream stream = (new CompilerVersionSupport()).getClass().getClassLoader().getResourceAsStream(classAsPath); DataInputStream ins = new DataInputStream (stream) assert( ins.readUnsignedShort() == 0xcafe ) assert( ins.readUnsignedShort() == 0xbabe ) int minor = ins.readUnsignedShort(); int major = ins.readUnsignedShort(); ins.close(); int javaVersion = major - 44 return "1.$javaVersion" } } Trouble is, it returns 1.5. What could be going on? Charles
has comment: http://stackoverflow.com/comment/38421354
linked to: http://stackoverflow.com/q/14176878
has comment: http://stackoverflow.com/comment/38454568
downvote count: 0
has comment: http://stackoverflow.com/comment/38428483
type: UnansweredQuestion
score: 6
tagged with: groovy
type: Question
tagged with: version
has comment: http://stackoverflow.com/comment/38428147
favorite count: 0
has answer: http://stackoverflow.com/a/64947921
has title: Why does Groovy compiler apparently produce 1.5 version of Java?

http://stackoverflow.com/comment/38652575
has text: @EJP it's false, there's situations, when you can't run 32-bit application on 64-bit platform, for example, when you setting up 32-bit skype on 64-bit ubuntu, you get along with it much many additional libraries, needed to run it.
type: QuestionComment
comment on: http://stackoverflow.com/q/24884404
type: Comment
score: 1

http://stackoverflow.com/comment/69659179
comment on: http://stackoverflow.com/a/40296622
type: Comment
has text: I am doing this exact thing and it doesn't work.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38658731
score: 0
type: Comment
type: QuestionComment
has text: Because I would like to save the date as a string but I am getting errors as I cannot create an instance of DateFormat
comment on: http://stackoverflow.com/q/24887730

http://stackoverflow.com/comment/38651405
has text: with a cast this is possible :
comment on: http://stackoverflow.com/a/24883862
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24839070
has answer: http://stackoverflow.com/a/24839549
type: Question
has comment: http://stackoverflow.com/comment/38566410
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/38566269
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24839278
downvote count: 0
type: UnansweredQuestion
tagged with: android-listview
has title: ArrayAdapter and ListView
has body: I have this line in my ListActivity ArrayAdapter<String> adapter = new ArrayAdapter<String>(MealsActivity.this, R.layout.meal_row); and 2 of my layouts are like this: <ListView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/android:list" android:layout_weight="1" /> meals_row.xml <?xml version="1.0" encoding="utf-8"?> I believe smth is wrong with 'R.layout.meal_row' parameter. Process: mycalories.com.jalle.mycalories, PID: 2659 java.lang.NullPointerException at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394) How do I specify textview in which data should be listed ?
score: 1
favorite count: 0

http://stackoverflow.com/comment/38696071
has text: Ok so `sessionfactory.close();` closes the database connection and also closes the transaction so i don't need to write `ListSession.close`.
comment on: http://stackoverflow.com/a/24907052
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24819956
downvote count: 0
has body: In my android app, Im asking the user to select a file from his google drive. I can load the "file picker" correctly, but what I really need is the fileId for the file that the used selected. I've looked into Drive, DriveId, Metadata etc.. but cant find out how to do it. How do I find the fileId of a file that the user selected from Google Drive?
tagged with: android
answer count: 1
score: 1
favorite count: 0
tagged with: google-drive-api
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24826977
upvote count: 1
has title: Android, how to get "fileID" from Google Drive File picker
type: Question

http://stackoverflow.com/comment/38543098
score: 0
comment on: http://stackoverflow.com/a/24814535
type: AnswerComment
has text: No. You're not accessing any fields concurrently.
type: Comment

http://stackoverflow.com/a/24901657
answers question: http://stackoverflow.com/q/24900849
accepted answer of: http://stackoverflow.com/q/24900849
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You don't need a query for the update status. You can use JMS to push progress notifications so the UI can consume them while the transaction is still running (AJAX progress bar + a REST service which can consume the JMS updates). If you don't want JMS you can use any other messaging technology for this task. You cam even use a Cache for setting the update progress and read it in some other thread. You can even write your own mechanism backed by a java.util.concurrent blocking queue. Bottom line, you don't need the db for monitoring the progress of that batch processing job.
score: 1
upvote count: 1

http://stackoverflow.com/comment/38634685
score: 0
type: Comment
has text: Is it possible to copy the jars outside of the project directory (/tmp)?
type: AnswerComment
comment on: http://stackoverflow.com/a/24858896

http://stackoverflow.com/q/24755050
has comment: http://stackoverflow.com/comment/38409420
favorite count: 0
has comment: http://stackoverflow.com/comment/38408561
has title: Slick2D Rectangle Collision Detection
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38410074
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38410447
has comment: http://stackoverflow.com/comment/38409963
has comment: http://stackoverflow.com/comment/38409491
type: Question
accepted answer: http://stackoverflow.com/a/24758880
tagged with: rectangles
tagged with: java
tagged with: slick2d
tagged with: intersection
has body: I'm having an issue showing that one rectangle has collided with another. So my question is, how can I get the intersect method to check for collision? Or are there any other ways to handle collision in this situation? I'm creating a turn-based combat game (similar to Final Fantasy or Legend of Dragoon) where the player's character is on the right side of the screen and the enemy is on the left side. The player and enemy each take turns attacking. So when the player attacks, the sprite animation moves across the screen from right to left until it stops in front of the enemy, attacks, and returns to it's starting coordinates. Both the player and enemy have a rectangle drawn around them to represent the bounds of each character. When the player moves forward, he passes through the Enemy's rectangle and stops within it. At this point there should be output to the console saying "INTERSECT!" to show that there was a collision between the two rectangles, but unfortunately there isn't. Please note that I have omitted the unnecessary pieces of code within my classes and tried to provide the code that pertains to my problem. This is my entry point, GameClass: public class GameClass extends BasicGame{ //other variable declarations public void init(GameContainer container) throws SlickException { player = new Player(); enemy = new Enemy(); skeleton = new Skeleton(); enemy = skeleton; playX = player.getStartX(); //700 playY = player.getStartY(); //140 playW = player.rect.getWidth(); //40 playH = player.rect.getHeight(); //70 enemyX = enemy.getStartX(); //100 enemyY = enemy.getStartY(); //140 enemyWidth = enemy.getWidth(); //50 enemyHeight = enemy.getHeight(); //55 SpriteSheet sheet = new SpriteSheet("data/homeranim.png", 36, 65); anim = new Animation(); for (int i=0;i&lt;8;i++) { anim.addFrame(sheet.getSprite(i,0), 150); } } public void render(GameContainer container, Graphics g) throws SlickException { anim.draw(playX,playY); // draws player animation skeletonAnim.draw(enemyX…
tagged with: collision-detection
has comment: http://stackoverflow.com/comment/38408465
has comment: http://stackoverflow.com/comment/38409357
has answer: http://stackoverflow.com/a/24758880
upvote count: 1
answer count: 1

http://stackoverflow.com/a/24838799
has comment: http://stackoverflow.com/comment/38567437
type: Answer
accepted answer of: http://stackoverflow.com/q/24838585
has comment: http://stackoverflow.com/comment/38565787
answers question: http://stackoverflow.com/q/24838585
has comment: http://stackoverflow.com/comment/38565667
has comment: http://stackoverflow.com/comment/38565859
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38565638
upvote count: 1
type: AcceptedAnswer
has body: The problem in your case is it ain't giving horizontal or vertical sidescrolls in the JTextArea.So,your output is not able to process the extra output which should have been displayed properly. Interestingly,going as per your setBounds() method,my JTextArea returns the perfect output---similar as the one which is getting displayed in the console!!!Also,it is not any problem for your output! The problem seems only with the scrolls which are absent in your code! Try this one and I hope it helps :- scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setBounds(5,25,972,500); scrollPane.add(textarea); scrollPane.setViewportView(textarea); If it doesn't help,please comment.I hope it'll solve your problem. Best Wishes...

http://stackoverflow.com/comment/38680904
score: 0
comment on: http://stackoverflow.com/a/24899252
type: AnswerComment
type: Comment
has text: Ok so, if I'm not wrong, these two Request are called with executeAndWait() so they are run in the retrieveInfoFromFb thread. Basically what I have to do is to support interruption in this thread? Stopping it from the main thread. Is it right?

http://stackoverflow.com/q/24799727
has answer: http://stackoverflow.com/a/24801237
has body: i am reading book about EJB 3.l, and they are talking about Enities and EntityManager, but i cant see any Hibernate(or other ORM framework) configuration. Does EJB has its own ORM and JPA support ?
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24801237
tagged with: java
has comment: http://stackoverflow.com/comment/38492597
has comment: http://stackoverflow.com/comment/38492588
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/8952730
tagged with: ejb
tagged with: jpa
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24799739
favorite count: 0
has title: Do i need JPA provider (like Hibernate) if i am using EJB?
accepted answer: http://stackoverflow.com/a/24799739

http://stackoverflow.com/comment/38449644
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24770031
has text: @Boris88 Glad I could help. There are plenty of great posts out there that explain pass by value in better terms. I would recommend this article: http://www.javaranch.com/campfire/StoryPassBy.jsp . It is pretty important to understand this underlying concept in Java.

http://stackoverflow.com/comment/38415397
type: QuestionComment
comment on: http://stackoverflow.com/q/24757899
has text: Hi I have uploaded full code...please check that.
score: 0
type: Comment

http://stackoverflow.com/a/24816476
answers question: http://stackoverflow.com/q/24816238
upvote count: 2
type: Answer
has body: No,Because whatever you are sending from client side is just html not any objects.Request only having set of Strings like (Header,QueryString and body etc). To pass Human Object to Servler Side from client you can use JSON.Otherwise go with Session. JSON: Class Human { private int id; privae String name; // other attributes etc } [{id:"",name:""}]---this is String but you can bring that using JSON related APIs. P.S :JSON related idea got from Scary.
score: 2
has comment: http://stackoverflow.com/comment/38524676
accepted answer of: http://stackoverflow.com/q/24816238
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24751006
score: 4
type: AcceptedAnswer
downvote count: 0
has body: Lambdas don't allow _ as a parameter name, but existing constructs do. From JLS 15.27.1. Lambda Parameters: It is a compile-time error if a lambda parameter has the name _ (that is, a single underscore character). The use of the variable name _ in any context is discouraged. Future versions of the Java programming language may reserve this name as a keyword and/or give it special semantics. I would suggest either renaming the parameters to __, $, or to save space, since you're already using unicode,＿ (though perhaps the latter is linguistic abuse - I don't know what that actual code point is intended for).
answers question: http://stackoverflow.com/q/24750576
type: Answer
accepted answer of: http://stackoverflow.com/q/24750576
upvote count: 4

http://stackoverflow.com/comment/38606372
score: 3
has text: upvoted this because I think this is an interesting **theoretical** question. I see why the author don't want to get **practical** advice for this.
type: QuestionComment
comment on: http://stackoverflow.com/q/24859500
type: Comment

http://stackoverflow.com/comment/38582675
comment on: http://stackoverflow.com/a/24840823
score: 0
type: Comment
has text: That's quite good but not exactly what I want. If my list has less than 10 items the list is still shown that big as it is with ten items but I want no blank lines in the JScrollpane.
type: AnswerComment

spongycastle
type: Tag
tag name: spongycastle
tags question: http://stackoverflow.com/q/24839323

http://stackoverflow.com/q/24899575
possible better answer: http://stackoverflow.com/a/24899633
favorite count: 0
accepted answer: http://stackoverflow.com/a/24899767
answer count: 3
tagged with: stopwatch
has title: Using stopwatch in java to record elapsed time of a drawing
has comment: http://stackoverflow.com/comment/38681382
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24899767
score: 1
tagged with: java
has body: I'm having trouble with a part of my assignment. I've done the first part with no trouble, but when I try and record the time I can't seem to get it to work. In the assignment it states "The circle drawing code shall be enclosed by elapsed time measurement using the StopWatch class provided." Here is the circle code and the stopwatch class that was provided can anyone educate me as to how I can use this with the circle code? import java.awt.*; import java.awt.geom.GeneralPath; import javax.swing.*; public class DrawCircle extends JPanel { Point[] points; GeneralPath circle; final int INC = 5; public DrawCircle() { initPoints(); initCircle(); } private void initPoints() { int numberOfPoints = 360/INC; points = new Point[numberOfPoints]; double cx = 200.0; double cy = 200.0; double r = 100.0; // Dimension variables int count = 0; for(int theta = 0; theta &lt; 360; theta+=INC) { int x = (int)(cx + r * Math.cos(Math.toRadians(theta))); int y = (int)(cy + r * Math.sin(Math.toRadians(theta))); points[count++] = new Point(x, y); } } private void initCircle() { circle = new GeneralPath(); for(int j = 0; j &lt; points.length; j++) { if(j == 0) circle.moveTo(points[j].x, points[j].y); else circle.lineTo(points[j].x, points[j].y); } circle.closePath(); } protected void paintComponent(Graphics g) { // fill and color super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setPaint(Color.red); g2.fill(circle); g2.setPaint(Color.red); Point p1 = points[0]; for(int j = 1; j &lt;= points.length; j++) { Point p2 = points[j % points.length]; g2.drawLine(p1.x, p1.y, p2.x, p2.y); // Line coordinates p1 = p2; } } public static void main(String[] args) { //Main functions JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(new DrawCircle()); f.setSize(400,400); // Frame f.setLocation(200,200); // Center f.setVisible(true); } } Here is the stopwatch class I was…
has answer: http://stackoverflow.com/a/24899633
type: Question
has answer: http://stackoverflow.com/a/24899691
downvote count: 0

http://stackoverflow.com/comment/38460458
type: AnswerComment
type: Comment
has text: Great! I got your answer. Thank you!
comment on: http://stackoverflow.com/a/24782567
score: 0

http://stackoverflow.com/comment/38475781
comment on: http://stackoverflow.com/a/24789556
type: Comment
has text: In #1 above, if you don't call super() explicitly, it's called implicitly. A superclass default constructor will be called whether you call super() or not. In #2 above, subclasses are *not* required to define constructors with the same signatures as in the superclass. A subclass can provide fewer constructors, with completely different signatures.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38696655
type: QuestionComment
has text: What code do you want me to post then? The rest of the code doesn't really give more information.
comment on: http://stackoverflow.com/q/24907914
score: 0
type: Comment

http://stackoverflow.com/comment/38658221
comment on: http://stackoverflow.com/q/24882946
score: 0
type: Comment
type: QuestionComment
has text: @Eric: Thanks. Very similar to mine. Narrows it down to being a Linux problem (or just MY problem)

http://stackoverflow.com/comment/74172131
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24878580
has text: have you solved the problem? i am also faced w/ same problem and want to know how did you solve the problem.
score: 0

http://stackoverflow.com/a/54074182
has body: I was able to fix the issue by providing the following in my connection URL; useUnicode=true&amp;characterEncoding=UTF-8 Example; jdbc:mysql://localhost/database?useUnicode=true&amp;characterEncoding=UTF-8
answers question: http://stackoverflow.com/q/24886504
score: 0
type: Answer

http://stackoverflow.com/comment/38462993
type: Comment
comment on: http://stackoverflow.com/a/24783522
has text: Ah! This is where C# alias's disguised as keywords come in handy. `float.NaN == System.Single.NaN` :)
score: 0
type: AnswerComment

http://stackoverflow.com/a/24863975
has body: In a similar setting, I used callbacks/anonymous classes by calling a method out of every endpoint and passing a callback for every variable part into the method, like the following public String methodA(final int param1, final String param2) throws Exception { return this.call(new Callable&lt;Boolean&gt;() { @Override public Boolean call() throws Exception { return param1 != 0 &amp;&amp; param2 != null; } }); } public String methodB(final String param1, final String param2) throws Exception { return this.call(new Callable&lt;Boolean&gt;() { @Override public Boolean call() throws Exception { return param1 != null &amp;&amp; param2 != null; } }); } private String call(Callable&lt;Boolean&gt; validationCallable) throws Exception { // static code similar to all methods assert validationCallable.call().equals(Boolean.TRUE); // static code similar to all methods return ""; // probably result based on another callable }
score: 0
answers question: http://stackoverflow.com/q/24863833
type: Answer

http://stackoverflow.com/comment/38471534
has text: (I can't tell what your `ntohf` function is supposed to do. It's certainly not converting an IEEE float stored in an `int` into `float`.)
type: Comment
comment on: http://stackoverflow.com/q/24788067
score: 0
type: QuestionComment

http://stackoverflow.com/q/24879250
type: Question
tagged with: weblogic
tagged with: java
score: 0
answer count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/24900856
has title: 404 error in Spring web app deployed to weblogic 10.3.3.0
type: UnansweredQuestion
has body: I made a web app with a RESTful web service and some webpages which make ajax calls. I used Java class based configuration instead of XMLs. The war file works well in Tomcat7. Now I am trying to deploy it on Weblogic 10.3.3.0. However, I got this. Going to the root url (http://myaddress.com:7001/myapp/) from browser gives me a error 403. Doing a POST to the web service gives me error 404. I CAN get to the static webpage. (the ajax call would fail due to web service not working) I cannot see any errors in the server log. I tried deploying Spring's example REST project (http://spring.io/guides/tutorials/rest/) to the Weblogic server, I got the same issue. After googling around, I found quite a number of similar questions, but none of them seems to be solved by looking at the thread. Is there any extra configuration I missed here?

http://stackoverflow.com/q/24905448
answer count: 1
downvote count: 0
has body: &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 http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd" xmlns:osgi="http://www.springframework.org/schema/osgi"&gt; These are the errors I get: the matching wildcard is strict but no declaration can be found for element 'osgi:service' the matching wildcard is strict but no declaration can be found for element 'osgi:reference'
favorite count: 0
has answer: http://stackoverflow.com/a/24905449
tagged with: osgi
tagged with: spring
has comment: http://stackoverflow.com/comment/38693621
upvote count: 3
accepted answer: http://stackoverflow.com/a/24905449
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
has title: the matching wildcard is strict but no declaration can be found for element 'osgi:service'

http://stackoverflow.com/q/24831192
has body: I have a "creator button" in my action bar that, when pressed, creates other buttons in my main activity. Every time this button is pressed, a new button is created in my main activity, creating a list of buttons. The buttons that are created are each associated with a custom object. When pressed, the buttons pass their associated object to a method and open a new fragment. Question: My question is, how can I save all of these buttons/associated objects that the user creates? Attempt at solution: I tried to store the buttons/objects in a hashmap, writing an internal wrapper class containing the hashmap and then using Gson to convert to/from JSON, but when I try to convert back from JSON, Gson.fromJson(jsonString) returns null (I have a suspicion this is because I am trying to store buttons). Here is some of the code for my attempted solution: public void saveButtonsMap() { Gson gson = new Gson(); MapWrapper wrapper = new MapWrapper(); wrapper.setMap(buttonsMap); String serializedMap = gson.toJson(buttonsMap); Editor editor = prefs.edit(); editor.putString(BUTTONS_MAP, serializedMap); editor.commit(); } public void restoreButtonsMap() { String mapString = prefs.getString(BUTTONS_MAP, ""); Gson gson = new Gson(); if(!mapString.isEmpty()) { MapWrapper wrapper = gson.fromJson(mapString, MapWrapper.class); // this is returning null buttonsMap = wrapper.getMap(); } else { buttonsMap = new HashMap&lt;Button, CustomObject&gt;(); } } Any ideas?
type: UnansweredQuestion
has title: Saving dynamically created buttons in android
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38557204
score: 0
has comment: http://stackoverflow.com/comment/38551730
tagged with: android
answer count: 0

http://stackoverflow.com/q/24799518
type: Question
has answer: http://stackoverflow.com/a/25605775
upvote count: 15
tagged with: connection-timeout
score: 15
answer count: 2
downvote count: 0
tagged with: socket-timeout-exception
favorite count: 0
tagged with: ftp
has answer: http://stackoverflow.com/a/24799709
accepted answer: http://stackoverflow.com/a/24799709
has title: FTP response 421 received. Server closed connection
possible better answer: http://stackoverflow.com/a/25605775
type: AnsweredQuestion
tagged with: java
tagged with: ftp-client
has body: I am writing a JAVA code to traverse FTP Location using Apache Commons Net FTPClient and getting output in an Excel file. the code execute correctly for approx 5 min but then gives an IOException: org.apache.commons.net.ftp.FTPConnectionClosedException: FTP response 421 received. Server closed connection. I am using commons-net-3.0.1.jar. I have done some R&amp;D and tried: setDefaultTimeout(6000); setConnectTimeout(3000); setSoTimeout(3000); enterLocalPassiveMode(); and sending NOOP, but still getting the same error. All I am trying to do is traverse through a directory and if file is found than get file name and file update date in excel else if directory is found then get inside and do until file is found again. Please help and ask if any other information is required. I am new to JAVA.

http://stackoverflow.com/q/24906934
tagged with: http://stackoverflow.com/tag/html
score: 1
has comment: http://stackoverflow.com/comment/38695454
has answer: http://stackoverflow.com/a/24917430
answer count: 2
upvote count: 1
has body: Last few hours i am trying to solve this but i can not.I am sending ajax request using jquery and based on response i set data on jsp.actully i am checking login detail so if login fail it set error message on label problem is that error message is set for few second and removed i mean to say error message is set for few second i want that if login fails the message is set on label still user enter valid details thanks in advance Here is my code LoginDemo.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here Log In Forgot your password? AddInspServlet Here i m adding code which server executed and retrieve response if(btn.equals("login")) { System.out.println("***** login condition checking ******"); String password =request.getParameter("password"); UserVO v =op.loginCheck(username, password); if(password.equals(v.getPassword())) { System.out.println("inside true condition"); HttpSession session = request.getSession(); session.setAttribute("userid",v.getUser_id()); session.setAttribute("username",v.getUsername()); session.setAttribute("user", v.getFirst_name()+" "+v.getLast_name()); session.setAttribute("roleid", v.getRole_id()); // response.sendRedirect("Home.jsp"); System.out.println("submitting data success fully"); out.print("yes"); } else { System.out.println("false condition"); out.print("no"); } }
tagged with: java
accepted answer: http://stackoverflow.com/a/24917430
type: AnsweredQuestion
downvote count: 0
tagged with: javascript
favorite count: 0
has comment: http://stackoverflow.com/comment/38695104
possible better answer: http://stackoverflow.com/a/24907353
has title: Set Ajax response on jsp not working
type: Question
has answer: http://stackoverflow.com/a/24907353

http://stackoverflow.com/comment/38512273
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24810288
has text: Thanks @Apalala (+1) - but a few questions here! (1) Are you saying I should **modify** the `ExpParser` class, or not use it at all? If you are saying the former, this doesn't seem like a very maintainable process, for every time the grammar rules changes for any reason, I'll need to be modifying the outputted `ExpParser` that ANTLR gives me. (2) How do I "connect" the `Calculator` in the grammar file, with say, `com.me.myorg.Calculator`?
type: AnswerComment

http://stackoverflow.com/a/24899731
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38709507
upvote count: 1
has comment: http://stackoverflow.com/comment/38694201
has body: Referring to the answer here, you should create a class that holds the 2D array as a data structure. An example of this would be: public class Matrix { private double[][] mat; public Matrix(double[][] mat) { this.mat = mat; } public double[][] getMatrix() { return mat; } public void setMatrix(double[][] mat) { this.mat = mat; } And then for your code to make matrices with random floats/doubles would be like: public static ArrayList&lt;Matrix&gt; generateMatrices(int num, int size) { ArrayList&lt;Matrix&gt; matrices = new ArrayList&lt;Matrix&gt;(); for(int i = 0; i &lt; num; i++) { double[][] matrix = new double[size][size]; //populate matrix with random numbers matrices.add(new Matrix(matrix)); } return matrices; } And all you would do is call the method and get an ArrayList of matrices: ArrayList&lt;Matrix&gt; generated = generateMatrices(10, 5); Hopefully this helped. Edit: toString() is a method all Object classes have. If you try printing out an Object, it will use the Object's toString method(). The toString() method primitively returns the memory location of the object instance. Some objects, like the ArrayList class, override the method already in order for programmers to print it out easily. You must override the toString() method in order to print out your Matrix class, specifically being the matrix stored in its class. You could make a custom method that prints it out, but instead I've decided to show you a small part of OOP. In your Matrix class, add this piece of code: @Override public String toString() { stringedMat = ""; for(int i = 0; i &lt; mat.length; i++) { for(int j = 0; j &lt; mat.length; j++) { if(j != (mat.length - 1)) { stringedMat += (mat[i][j] + " "); }else{ stringedMat += mat[i][j]; } } stringedMat += "\n"; } return stringedMat; }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24899612
answers question: http://stackoverflow.com/q/24899612
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38706861

http://stackoverflow.com/q/24877347
accepted answer: http://stackoverflow.com/a/24877404
score: 0
has comment: http://stackoverflow.com/comment/38639775
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/38639703
linked to: http://stackoverflow.com/q/9864267
has body: So, I do not know why my image is not showing because I put the image in the right folder and I believe that the code below is right. The result of this code is just a blank white frame background. I thought the image was corrupted but I tried a different image and its the same result. Anyway I will be highly grateful if anyone could solve this. package fia_project; import java.awt.Color; java.awt.*; import javax.swing.*; public class Fia_test extends JFrame { public Frame kenny; public Fia_test(){ super(""); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setVisible(true); setSize(350, 100); Container pane = getContentPane(); getContentPane().setBackground(Color.WHITE); ImageIcon icon = new ImageIcon("speaker.png"); JLabel label2 = new JLabel(icon); add(label2); } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Fia_test t = new Fia_test(); } }
has comment: http://stackoverflow.com/comment/38640240
has comment: http://stackoverflow.com/comment/38639807
has comment: http://stackoverflow.com/comment/38639607
has comment: http://stackoverflow.com/comment/38639622
tagged with: swing
has title: I don't know why my image is not showing on the frame
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24877404
tagged with: java
linked to: http://stackoverflow.com/q/11812427
type: Question
has comment: http://stackoverflow.com/comment/38639788
has comment: http://stackoverflow.com/comment/38639664
duplicate of: http://stackoverflow.com/q/11812427
tagged with: label
has comment: http://stackoverflow.com/comment/38639565

http://stackoverflow.com/a/24846800
has comment: http://stackoverflow.com/comment/38596787
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24846707
accepted answer of: http://stackoverflow.com/q/24846707
has body: Clean your project if does not work then restart your eclipse with clean option -clean by setting in eclipse.ini file in eclipse config home folder. If not works then check your jdk libs in build path
type: Answer

http://stackoverflow.com/comment/38567400
type: QuestionComment
has text: Thanks Mritunjay and Ganesh. Both of your answers are working. Now my task is to display them in a table.
comment on: http://stackoverflow.com/q/24839530
score: 0
type: Comment

http://stackoverflow.com/comment/47810620
has text: I'm able to run it successfully, can you paste the full error? or Just try sending message to an already created Queue?
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24821627

http://stackoverflow.com/comment/38417921
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24759998
type: Comment
has text: Concise and to the point. However, it might be beneficial to show OP quickly how to set which MP3 file is assigned to the MediaPlayer.

http://stackoverflow.com/comment/38682566
type: AnswerComment
comment on: http://stackoverflow.com/a/24899967
has text: Also if its positive, don't add + to it? Could I change this from (?<=[\\d)])[-+] to (?<=[\\d)])[-] ? Would this work?
type: Comment
score: 0

http://stackoverflow.com/q/24893366
possible better answer: http://stackoverflow.com/a/24893434
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/38669865
has comment: http://stackoverflow.com/comment/38669698
has answer: http://stackoverflow.com/a/24893434
accepted answer: http://stackoverflow.com/a/24893515
tagged with: string-comparison
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/38669575
score: -3
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24893515
has comment: http://stackoverflow.com/comment/38669688
type: Question
has title: Check for string inequality
has comment: http://stackoverflow.com/comment/38670069
has body: I am trying to create an if that sees if two Strings are 'Different' from each other. Just like .equals(), but the exact opposite :P it would be like: if (String a /* Is different */ String b){ //do stuff }

http://stackoverflow.com/q/24841237
has answer: http://stackoverflow.com/a/24841325
possible better answer: http://stackoverflow.com/a/24841385
accepted answer: http://stackoverflow.com/a/24841325
has comment: http://stackoverflow.com/comment/38582353
has comment: http://stackoverflow.com/comment/38570289
has comment: http://stackoverflow.com/comment/38570223
tagged with: 2d-games
tagged with: chess
has comment: http://stackoverflow.com/comment/38570279
has body: I'm learning to code Java by myself after learning a bit of the language and decided to make a non-graphical game of Chess. The First Problem: Here is my multidimentional list of Strings which is in the "Board.java": public static String chessBoard[][][] = { { { "A1" }, { "A2" }, { "A3" }, { "A4" }, { "A5" }, { "A6" }, { "A7" }, { "A8" } }, { { "B1" }, { "B2" }, { "B3" }, { "B4" }, { "B5" }, { "B6" }, { "B7" }, { "B8" } }, { { "C1" }, { "C2" }, { "C3" }, { "C4" }, { "C5" }, { "C6" }, { "C7" }, { "C8" } }, { { "D1" }, { "D2" }, { "D3" }, { "D4" }, { "D5" }, { "D6" }, { "D7" }, { "D8" } }, { { "E1" }, { "E2" }, { "E3" }, { "E4" }, { "E5" }, { "E6" }, { "E7" }, { "E8" } }, { { "F1" }, { "F2" }, { "F3" }, { "F4" }, { "F5" }, { "F6" }, { "F7" }, { "F8" } }, { { "G1" }, { "G2" }, { "G3" }, { "G4" }, { "G5" }, { "G6" }, { "G7" }, { "G8" } }, { { "H1" }, { "H2" }, { "H3" }, { "H4" }, { "H5" }, { "H6" }, { "H7" }, { "H8" } }, }; If I place a pawn (from "WPawn.java") on the board I get: A1 A2 A3 A4 A5 A6 A7 A8 WP1 B2 B3 B4 B5 B6 B7 B8 C1 C2 C3 C4 C5 C6 C7 C8 D1 D2 D3 D4 D5 D6 D7 D8 E1 E2 E3 E4 E5 E6 E7 E8 F1 F2 F3 F4 F5 F6 F7 F8 G1 G2 G3 G4 G5 G6 G7 G8 H1 H2 H3 H4 H5 H6 H7 H8 I want the resulting list (above) to return to the original list (from the first code), but how do I do that? Thanks in advance :) public static void update() { // Print chessBoard nicely System.out.println("Here is the board: "); for (int row = 0; row &lt; chessBoard.length; row++) { for (int column = 0; column &lt; chessBoard[row].length; column++) { for (int pos = 0; pos &lt; chessBoard[row][column].length; pos++) { System.out.print(chessBoard[row][column][pos] + "\t"); } } System.out.println(); } // end }
type: AnsweredQuestion
has title: How do I reset a multi-dimentional list after any action is made (Noob Java coding in Chess)?
tagged with: java
has comment: http://stackoverflow.com/comment/38570312
has answer: http://stackoverflow.com/a/24841385
type: Question
score: 0
answer count: 2

http://stackoverflow.com/a/24907295
type: Answer
has body: Whenever you add a char to an int in java first it converts the character into its equivalent ASCII value and then adds it to the integer eg suppose the following scenario , char c = 'a'; // ASCII value of 'a' is 97 int i = c + 5 ; // result will be 97 + 5 = 102 I think this answers your first half question Now the Second part , Whenever you use the shorthand operator in Java the expression at right hand side is evaluated first. Hence , for expresion result += prev + curr it is evaluated as result = result + (prev + curr); Therefore , result+=prev+curr; // Here first it appends "abc" with "def" and then the resultant "abcdef" is appended to as result .
answers question: http://stackoverflow.com/q/24906705
score: 0
has comment: http://stackoverflow.com/comment/38695769

google-maps
tags question: http://stackoverflow.com/q/24796056
tag name: google-maps
tags question: http://stackoverflow.com/q/24778109
tags question: http://stackoverflow.com/q/24799369
tags question: http://stackoverflow.com/q/24863567
tags question: http://stackoverflow.com/q/24804652
tags question: http://stackoverflow.com/q/24879120
tags question: http://stackoverflow.com/q/24791446
tags question: http://stackoverflow.com/q/24825804
tags question: http://stackoverflow.com/q/24826639
tags question: http://stackoverflow.com/q/24836883
tags question: http://stackoverflow.com/q/24838417
tags question: http://stackoverflow.com/q/24820312
tags question: http://stackoverflow.com/q/24757702
type: Tag
tags question: http://stackoverflow.com/q/24795914
tags question: http://stackoverflow.com/q/24821551
tags question: http://stackoverflow.com/q/24878791
tags question: http://stackoverflow.com/q/24823591
tags question: http://stackoverflow.com/q/24810494
tags question: http://stackoverflow.com/q/24759536
tags question: http://stackoverflow.com/q/24781880
tags question: http://stackoverflow.com/q/24772693
tags question: http://stackoverflow.com/q/24804028

http://stackoverflow.com/comment/38553693
type: QuestionComment
type: Comment
has text: Hello to you all. @NaumanAfzaal, Guardanis, Jimmysnn I figured the problem. first I did not initialize calculate_button. I fixed this, had a crash when trying to calculate a result, then I resolved the second problem by initializing bmi_text.
score: 0
comment on: http://stackoverflow.com/q/24831857

http://stackoverflow.com/comment/38592883
type: Comment
has text: @Mo. Yes. colon isn't. So it's safe to remove. In fact. I'll edit it. Force of habit.
type: AnswerComment
comment on: http://stackoverflow.com/a/24852988
score: 0

http://stackoverflow.com/comment/38571679
type: AnswerComment
type: Comment
has text: You are right. I missed that info. Now error message changed to "Invalid memory access", so function have been found, but my calling parameters are wrong. I will work on it. I tried another function with simpler parameters (CMGetInfo) and it works. Thank you very much!
comment on: http://stackoverflow.com/a/24841827
score: 0

http://stackoverflow.com/q/24766605
tagged with: split
has answer: http://stackoverflow.com/a/24766716
upvote count: 1
has comment: http://stackoverflow.com/comment/38429661
tagged with: string
favorite count: 0
has title: How to properly split a String input of a filename using the split()?
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38429717
downvote count: 1
has answer: http://stackoverflow.com/a/24766723
tagged with: regex
accepted answer: http://stackoverflow.com/a/24766723
has body: I am creating an ImageViewer application which prompts the user using showInputDialog to first input the name of the first image filename. However, I got stuck splitting the String by using the split(). Say for example the user inputs image1.gif and I have to make sure that I can split them into three elements. Firstly will be image followed by 1 and finally gif. So do you guys think you can help me with it? Thanks in advance! public static void main(String [] args) { //First input dialog. Example from user will be like: image1.gif String userInput = JOptionPane.showInputDialog("Please input name of first image file"); Scanner myScanner = new Scanner(userInput); String a = userInput.split("."); String fileName = myScanner.next(); String fileNumber = myScanner.next(); String fileFormat = myScanner.next(); } Here's the trial part. But it says that the Array index is out of bound exception. Any advise? import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; class TestImageViewer { public static void main(String [] args) { //First input dialog. Example from user will be like: image1.gif String userInput = JOptionPane.showInputDialog("Please input name of first image file"); Scanner myScanner = new Scanner(userInput); String[] a = userInput.split("."); System.out.println(a[0]); } }
has comment: http://stackoverflow.com/comment/38432825
possible better answer: http://stackoverflow.com/a/24766779
has answer: http://stackoverflow.com/a/24766779
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38430734
type: Question

http://stackoverflow.com/comment/64917667
type: AnswerComment
has text: Doesn't work for me, changing Target bytecode version to 1.8 but get the same error
comment on: http://stackoverflow.com/a/29811355
type: Comment
score: 0

http://stackoverflow.com/q/24902608
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24902946
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/24902946
has body: I have a basic REST service exposing various APIs based on Spring MVC and the @RestController mechanism. Now I am trying to add an interceptor for Spring security in order to require login (through a particular REST request) before any other request can be accessed. The idea is that the interceptor checks the active session of the request, and points it to the login service if an active login is not found. If an active login is found the interceptor lets the request through to the proper URL. I've been playing around with the XML files but all I keep getting is redirection loops. :( It's worthwhile noting that I do not have a view associated with this server at all. Access is done via http requests from a GUI that I don't have access to. Here's my configuration thus far: Web.xml: <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation /WEB-INF/spring/root-context.xml, /WEB-INF/spring/application-security.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /aisrv/* org.springframework.web.context.ContextLoaderListener aisrvServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/aisrvServlet/servlet-context.xml 1 aisrvServlet / Servlet-Context.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd 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"> <annotation-driven /> <resources mapping="/resources/**" location="/resources/" /> <beans:bean class="org.springframework…
score: 5
has title: Building a Spring security interceptor for a rest service
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38687188
tagged with: spring-security
favorite count: 0
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/38506887
has text: You will have to write your own `Comparator`.
comment on: http://stackoverflow.com/q/24807573
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24889282
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
has title: return a value from a JFrame to main()
answer count: 2
tagged with: jdialog
has comment: http://stackoverflow.com/comment/38662071
has answer: http://stackoverflow.com/a/24889567
score: 0
has body: I am writing a program which has a JFrame with a JMenu in it. Once the user clicks a menuItem, a JDialog is being called, to get a String from the user. I want to use that string in my main programm but i don't know how to return that value from the JFrame to the main programm (I managed to return the value from the JDialog to the JFrame). Any ideas? My main:: public static void main(String[] args) { myFirstFrame m = new myFirstFrame(); m.setVisible(true); String localhost = m.getLh(); System.out.println(localhost); } My JFrame:: public class myFirstFrame extends JFrame { String lh; myDialog myD; public myFirstFrame(JFrame mf) { super(); setTitle("Welcome"); setSize(300, 300); setDefaultCloseOperation(DISPOSE_ON_CLOSE); JMenuItem playg = new JMenuItem("Play game"); simetoxi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { myD = new myDialog(myFirstFrame.this); myD.setVisible(true); String lh = myD.getText(); System.out.println(lh + "ASasASas"); dispose(); } }); JMenu game = new JMenu("GAME"); game.add(playg); JMenuBar myBar = new JMenuBar(); myBar.add(game); setJMenuBar(myBar); } public String getLh() { return lh; } } My JDialog:: public class myDialog extends JDialog { JTextField t1; String sname; public myDialog(JFrame fr) { super(fr, true); setTitle("Connect"); setSize(200, 200); setLayout(new FlowLayout()); JLabel l1 = new JLabel("Give the server name"); t1 = new JTextField(15); add(l1); add(t1); JButton okb = new JButton("submit"); okb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { sname = t1.getText(); dispose(); } }); add(okb); } public String getText() { return sname; } }
has answer: http://stackoverflow.com/a/24889546

http://stackoverflow.com/comment/38597417
type: QuestionComment
has text: `total.setTest(some_text);` You want to change the text of a string?
comment on: http://stackoverflow.com/q/24855233
score: 0
type: Comment

http://stackoverflow.com/q/24890902
has title: JACOB can't co-create Outlook 2010 object
has answer: http://stackoverflow.com/a/26859166
score: 2
has body: On Windows 7 32 / 64 bit with UAC enabled and Outlook 2010 running I receive a ComFailException when attempting to create new ActiveXComponent via: ActiveXComponent axOutlook = new ActiveXComponent("Outlook.Application"); Has anyone found a source workaround with this issue or has this issue been corrected with later versions of JACOB? Currently, we are telling our customers to close Outlook before emailing their reports.
has answer: http://stackoverflow.com/a/24895799
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38665303
tagged with: outlook
answer count: 2
has comment: http://stackoverflow.com/comment/38669963
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: jacob

http://stackoverflow.com/q/24851679
favorite count: 0
tagged with: combinatorics
type: UnansweredQuestion
tagged with: integer
has title: Generate x number of integer partitions
score: 1
tagged with: java
upvote count: 1
has body: I have a recursive algorithm, that generates all combinations of a number given as a parameter. It can also do a partition based on 'k' which can also be given as a parameter. It works fine as long as we have smaller numbers given as input. But as 'n'increases, it takes more time and space to compute the results. Is it possible to given 'x'as input, such that the algorithm only returns x partitions of the number, not all. Here is an example of what I am looking for: input: n = 10, k = 4, partition n into 'k'parts x = 2, number of partitions required m = 4, maximum number in the partition output: 4,2,2,2 4,3,2,1 Here is the algorithm that I am using: int h=0; //iterator public ArrayList<int[]> generate_partitions(int n,int k,int max,boolean norep) { int korig; korig = k; int[] A = new int[korig+1]; ArrayList<int[]> partitions = new ArrayList<int[]>(); GenP(A, n, k, korig, 1,partitions,max); if(norep) { for(int i=0; i<partitions.size(); i++) { if(check_repetition(partitions.get(i),max)) partitions.remove(i); } } return partitions; } boolean check_repetition(int[] a,int max) { boolean[] hash = new boolean[max+1]; for(int i=0; i<max+1; i++) hash[i]= false; for(int i=0; i<a.length; i++) { if(hash[a[i]]==false) hash[a[i]]=true; else return true; } return false; } void GenP(int[] A, int n, int k, int korig, int l, ArrayList<int[]> partitions,int max) { //n = number to partition //korig = original k //l = least number integer required in partition if (k==1) // k = number of partitions { A[k]=n; int [] temp = new int[korig]; // System.out.println("size = "+korig); boolean max_check = false; for (int j=1; j<=korig; j++) { // System.out.print(A[j]+" "); temp[j-1]=A[j]; if(A[j]>max) max_check = true; } if(!max_check) { partitions.add(temp); } //System.out.println(); } else { if (k==0) { h=0; } else { h=n/k; for (int i=l; i<=h; i++) { A[k]=i; GenP(A, n-A[k], k-1, korig, A[k], partitions,max); } } } }
type: Question
tagged with: algorithm
tagged with: math
has answer: http://stackoverflow.com/a/24852743
downvote count: 0
answer count: 1

http://stackoverflow.com/q/24871299
linked to: http://stackoverflow.com/q/791591
answer count: 1
downvote count: 0
has title: Warning in Regular Expression - JavaCC
favorite count: 0
tagged with: parsing
upvote count: 2
has body: I've this code in my JavaCC parser: &lt; VARIABILE : "§" &lt; LETTERA &gt; ( &lt; CIFRA &gt; | &lt; LETTERA &gt; )* &gt; &lt; TERMINE: ( &lt; NUM_SEGNO &gt; | &lt; VARIABILE &gt; | "(-" &lt; VARIABILE &gt; ")" ) &gt; I get this error when compiling Regular Expression choice : VARIABILE can never be matched as : TERMINE How can I fix this?
accepted answer: http://stackoverflow.com/a/24877688
score: 2
type: AnsweredQuestion
tagged with: javacc
tagged with: java
tagged with: warnings
type: Question
has comment: http://stackoverflow.com/comment/38628053
has answer: http://stackoverflow.com/a/24877688

http://stackoverflow.com/q/24861997
has comment: http://stackoverflow.com/comment/38625080
type: UnansweredQuestion
tagged with: google-app-engine
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I have a 6 back ends servlet which i want to schedule it in a sequence . I want to schedule them in a sequence as order specified in BackendQueueServlet . Here s my task queue code : public class BackendQueueServlet extends HttpServlet { @SuppressWarnings("deprecation") protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String key = "aaaaaa"; // Add the task to the default queue. Queue queue = QueueFactory.getQueue("BackendQueue"); queue.add(withUrl("/twitterservlet").method(Method.GET).param("key", key).header( "Host", BackendServiceFactory.getBackendService().getBackendAddress("twitterservlet"))); queue.add(withUrl("/facebookservlet").method(Method.GET).param("key", key).header( "Host", BackendServiceFactory.getBackendService().getBackendAddress("facebookservlet"))); queue.add(withUrl("/loadingservlet").method(Method.GET).param("key", key).header( "Host", BackendServiceFactory.getBackendService().getBackendAddress("loadingservlet"))); queue.add(withUrl("/fbcomments").method(Method.GET).param("key", key).header( "Host", BackendServiceFactory.getBackendService().getBackendAddress("fbcomments"))); queue.add(withUrl("/fbcomments").method(Method.GET).param("key", key).header( "Host", BackendServiceFactory.getBackendService().getBackendAddress("fbcomments"))); queue.add(withUrl("/fbcomments").method(Method.GET).param("key", key).header( "Host", BackendServiceFactory.getBackendService().getBackendAddress("fbcomments"))); } } And here's my backend.xml B1 true B1 true B1 true B1 true B1 true
upvote count: 1
tagged with: task-queue
has title: Google App Engine : Calling Multiple Back end Inside a task queue in a sequence
favorite count: 0

http://stackoverflow.com/comment/38420948
comment on: http://stackoverflow.com/a/24761460
has text: I'm not instantiating `CreepIDs`. I'm using it as a static class already. That's the problem. I've found a round-about solution anyways. But thanks for trying.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38578593
comment on: http://stackoverflow.com/q/24845556
has text: Why are you suing a binary tree? Whatever did it do to you that you should sue it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38597454
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24855162
has text: @G.BlakeMeike : Yes it is. So if I understand well, there is no way to execute the onResume method of the fragment right tmalseed ?

http://stackoverflow.com/comment/38582690
score: 2
has text: There is no easy way to do this without library functions. You could use `pow` or `exp` and `log`
comment on: http://stackoverflow.com/q/24847701
type: Comment
type: QuestionComment

android-volley
tags question: http://stackoverflow.com/q/24864487
tags question: http://stackoverflow.com/q/24877292
type: Tag
tags question: http://stackoverflow.com/q/24887133
tags question: http://stackoverflow.com/q/24791453
tag name: android-volley

http://stackoverflow.com/q/24783093
type: AnsweredQuestion
tagged with: java
answer count: 2
has body: I have re-factored a class and I am currently trying to update Unit Tests to reflect this. One addition to the class is a static field as shown below: private static JdbcTempate jdbcTemple = DbConfiguration.getJdbcTemplate(); When running the unit tests after adding this field I was getting null pointer errors. I resolved this by mocking the field using powermock with the createMock() and WhiteBox.setInternalState() methods, easy enough. However one of the suite of tests uses JMockit instead of powermock and mockito. Would anyone be able to show me how I can mock this field using JMockit?
downvote count: 0
tagged with: jmockit
has answer: http://stackoverflow.com/a/24786332
favorite count: 0
has title: Mocking a static class field using JMockit
has answer: http://stackoverflow.com/a/24784815
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/24784815
accepted answer: http://stackoverflow.com/a/24786332
tagged with: unit-testing
type: Question

http://stackoverflow.com/comment/38451419
comment on: http://stackoverflow.com/q/24778185
has text: For better help sooner, post an [MCVE](http://www.stackoverflow/mcve) (Minimal, Complete, Verifiable Example).
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24782435
has body: I wrote the program of what I think you meant,if I understood wrong please correct me. //let's say you have to wait for 42 miliseconds try{ long x = System.currentTimeMillis(); //do your thing; long y = System.currentTimeMillis(); Thread.sleep(42-y-x); } catch(IOException e){ e.printStackTrace(); }
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/24782252
downvote count: 1
type: Answer

http://stackoverflow.com/comment/38685724
comment on: http://stackoverflow.com/a/24901633
has text: I didn't realize you are trying to rerun every few second, let me change my answer
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24831291
has title: Trimmomatic not acknowleding commands over Linux cluster
has answer: http://stackoverflow.com/a/24836721
has answer: http://stackoverflow.com/a/24832649
score: 0
tagged with: linux
tagged with: bioinformatics
type: UnansweredQuestion
has body: I am trying to use the program Trimmomatic to removed adapter sequences from an Illumina paired-end read over a computer cluster. While I can get the program to open, it will either not acknowledge the commands I enter or will return an error message. I have tried all kinds of permutations of the input commands without success. Examples of input code and error messages are below Code: java -classpath /*filepath*/Trimmomatic-0.32/trimmomatic-0.32.jar org.usadellab.trimmomatic.TrimmomaticPE \ -phred33 -trimlog /Results/log.txt \ ~/*filepath*/data_R1.fq ~/*filepath*/data_R2.fq \ ILLUMINACLIP:/*filepath*/Trimmomatic-0.32/adapters/TruSeq3-PE-2.fa:2:30:10:3:"true" Results: (the o/s seems to find and execute the software, but is not feeding in the command; I get the same result if I use the java -jar option for executing Trimmomatic) TrimmomaticPE [-threads &lt;threads&gt;] [-phred33|-phred64] [-trimlog &lt;trimLogFile&gt;] [-basein &lt;inputBase&gt; | &lt;inputFile1&gt; &lt;inputFile2&gt;] [-baseout &lt;outputBase&gt; | &lt;outputFile1P&gt; &lt;outputFile1U&gt; &lt;outputFile2P&gt; &lt;outputFile2U&gt;] &lt;trimmer1&gt;... Code: (If I add in the command PE immediately before all other commands, the program executes and can find the fasta file containing the adapter sequences, but then searches for and cannot fund a file called 'PE') java -classpath /*filepath*/trimmomatic-0.32.jar org.usadellab.trimmomatic.TrimmomaticPE \ PE -phred33 -trimlog /Results/log.txt \ ~/*filepath*/data_R1.fq ~/*filepath*/data_R2.fq \ ILLUMINACLIP:/*filepath*/Trimmomatic-0.32/adapters/TruSeq3-PE-2.fa:2:30:10:3:"true" Results: (Programs rus and finds the fasta file of adapter sequences, but then fails to execute. Why is it looking for a PE file?) TrimmomaticPE: Started with arguments: PE -phred33 -trimlog /Results/log.txt /*filepath*/data_R1.fq /*filepath*/data_R2.fq ILLUMINACLIP:/*filepath*/Trimmomatic-0.32/adapters/TruSeq3-PE-2.fa:2:30:10:3:true Multiple cores found: Using 12 threads Using Prefi…
tagged with: java
tagged with: cluster-computing
type: Question
answer count: 2

http://stackoverflow.com/comment/38466550
type: AnswerComment
has text: @user3737992 then use an online IDE like http://www.ideone.com/
comment on: http://stackoverflow.com/a/24784783
type: Comment
score: 0

http://stackoverflow.com/comment/38644441
type: Comment
type: QuestionComment
has text: The first problem is that anything referring to that field will have the constant value baked into it, so changing the value of the field at execution time wouldn't affect that code. Fundamentally, this seems like a bad idea to me. What concrete problem are you trying to solve? I suspect you should take a step back and redesign.
comment on: http://stackoverflow.com/q/24880054
score: 3

http://stackoverflow.com/a/24797644
type: Answer
has comment: http://stackoverflow.com/comment/38488601
has body: It's okay if you save the parameters you've already set earlier, but you need to retrieve all that information from the Intent itself and repopulate your activity with the proper data. This must be done like this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String categoryId = getIntent().getStringExtra(CATEGORY_ID); // retrieve the others and populate your activity }
score: 0
answers question: http://stackoverflow.com/q/24797587

compiler-errors
tags question: http://stackoverflow.com/q/24852744
tags question: http://stackoverflow.com/q/24751438
tag name: compiler-errors
tags question: http://stackoverflow.com/q/24773080
tags question: http://stackoverflow.com/q/24852410
tags question: http://stackoverflow.com/q/24770444
tags question: http://stackoverflow.com/q/24816652
type: Tag
tags question: http://stackoverflow.com/q/24803423
tags question: http://stackoverflow.com/q/24827403
tags question: http://stackoverflow.com/q/24882772
tags question: http://stackoverflow.com/q/24817306

http://stackoverflow.com/q/24897418
has comment: http://stackoverflow.com/comment/38677980
type: Question
has comment: http://stackoverflow.com/comment/38721139
has comment: http://stackoverflow.com/comment/38677491
score: 0
has title: Strange behavior of bitmap position
answer count: 1
has answer: http://stackoverflow.com/a/24978803
has comment: http://stackoverflow.com/comment/38723108
tagged with: position
has comment: http://stackoverflow.com/comment/38678109
tagged with: android
tagged with: animation
has comment: http://stackoverflow.com/comment/38677428
accepted answer: http://stackoverflow.com/a/24978803
tagged with: bitmap
has comment: http://stackoverflow.com/comment/38681055
has body: I have a line drawn at the bottom of the screen at Y position 1072, which is 1 inch from the bottom of the screen (screenHeight - dpi). I am trying to make bitmap objects disappear when they pass the line: for (int i=0;i&lt;objectList.size();i++) { if (objectList.get(i).y &gt;= (screenHeight-dpi) - objectList.get(i).objectBitmap.getHeight()) { Log.d("Line Collison", "Working"); } } I tested it by logging several variables: Bitmap's Y position (logged every frame) Line's position: 1072 Line position minus bitmap height (objects should disappear after passing): 944 I stopped the application when an object reached the line, and observed that its logged Y position was only 475, which is about half of the point at which it's supposed to disappear (944). The bitmap I'm using is 128 pixels in height and doesn't have top/bottom padding. So what could be the problem here?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38677326
has comment: http://stackoverflow.com/comment/38677596
tagged with: java

nexus
type: Tag
tags question: http://stackoverflow.com/q/24813357
tag name: nexus

http://stackoverflow.com/a/24858885
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24854382
has body: I think, you are getting something in response of nearByPlacesArray. Thats why it is going inside if block, so it happens when you get error msg/response from server. Because it treats error response as a something that is not null though it does have wrong info. To handle this, you need to implement some validation functionality inside your "Callback" interface. that will solve the issue.

http://stackoverflow.com/a/24825169
type: AcceptedAnswer
has body: Solve my partially my using external libraries : https://code.google.com/p/google-api-translate-java/ Hope it's help
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24816761
accepted answer of: http://stackoverflow.com/q/24816761

http://stackoverflow.com/comment/38694577
has text: You don't want, but you'll have to. What you want is not possible.
type: AnswerComment
comment on: http://stackoverflow.com/a/24905258
score: 0
type: Comment

http://stackoverflow.com/comment/38417712
has text: Tutorial for CardLayout is here: http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
score: 3
comment on: http://stackoverflow.com/q/24760176
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38689829
type: Comment
comment on: http://stackoverflow.com/q/24904060
score: 0
has text: what about if system resolution is changed or OS is changed.
type: QuestionComment

http://stackoverflow.com/q/24797013
has answer: http://stackoverflow.com/a/24797945
has answer: http://stackoverflow.com/a/24798190
has comment: http://stackoverflow.com/comment/68782384
has answer: http://stackoverflow.com/a/24797736
answer count: 3
has title: How to catch NegativeArraySizeException?
has comment: http://stackoverflow.com/comment/38487615
favorite count: 0
has comment: http://stackoverflow.com/comment/38487440
has body: How to catch NegativeArraySizeException in the given set of arrays.Here I want to display the largest number in given arrays ,but it is showing NegativeArraySizeException. Example: 12, -23, 34 TreeSet ts=new TreeSet(); public void abc() { Scanner sc=new Scanner(System.in); int s1=0; System.out.println("enter number of elemtns "); s1=sc.nextInt(); int i[]=new int[s1]; for(int i2=0; i2&lt;=i.length; i2++) { int s2=sc.nextInt(); if(s2&lt;0) throw new NegativeArraySizeException(); int i1[]=new int[s2]; System.out.println("first,,,,"+s2); ts.add(s2); System.out.println("higest....."+ts.last()); } } public static void main(String[] args) { StringAbc s=new StringAbc(); s.abc(); }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38487379
has comment: http://stackoverflow.com/comment/38487396
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38487861
tagged with: java
has comment: http://stackoverflow.com/comment/38487442
type: Question
upvote count: 2

http://stackoverflow.com/comment/38716029
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24876650
score: 0
has text: Yes, cast it to HttpURLConnection.

http://stackoverflow.com/comment/38533870
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24807952
has text: Click on `read more` to find the project structure as well.

http://stackoverflow.com/a/24823348
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24823056
downvote count: 0
answers question: http://stackoverflow.com/q/24823056
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/38536498
has comment: http://stackoverflow.com/comment/38536661
has body: "Read somewhere that there are 2 rounds of hashing". No. If you want to see how Strings are hashed - go look at the code. The basic contract of hash map is that it will retrieve items if the keys have the same hash and are equal by their equals function. Why do you think that char[] has an overridden equals that allows it to compare itself with Strings properly? Or even between each other? It does not override equals, and will only return true if it's the same instance. You are using arrays for keys. That is possible but most senior devs will shout at you for that. There is no good way to compare them: Object.equals (that they use by default) means you cannot reproduce an array - you have to use the exact same object. Using Arrays.equals (or similar means to compare contents) will mean you have mutable objects as keys - BAD. As per your comment I understand that you want to be able to edit the string. That's fine before you put it into the map. But do not change objects when they are keys in a map in a way that might change the hash code or equals. Best way to do this is to use a custom object. Arrays are not suitable for this. If you really want to change the values on the fly while they're in a map - use a BiMap (or do what it does in forcePut yourself).

http://stackoverflow.com/a/24857177
type: Answer
answers question: http://stackoverflow.com/q/24857104
upvote count: 4
downvote count: 0
score: 4
has body: You don't want to convert the time (they're the same time), you want to format the time. Joda has a DateTimeFormatter class (see http://www.joda.org/joda-time/key_format.html for details). You can use it something like this: DateTimeFormatter fmt = DateTimeFormat.forPattern("HH:mm:ss"); String str = date.toString(fmt);

http://stackoverflow.com/comment/38643211
score: 0
has text: AFAIK both are possible. Note that you can also use an annotation instead of JavaScript.
type: AnswerComment
comment on: http://stackoverflow.com/a/24862928
type: Comment

celltable
type: Tag
tag name: celltable
tags question: http://stackoverflow.com/q/24803028

http://stackoverflow.com/a/24825363
score: 1
has comment: http://stackoverflow.com/comment/38540490
has body: Keeping or using a local thread variable inside another thread class is matter of choice.But personally from my knowledge its not a good design,until you have specific requirement to do so and use that local thread variable inside your thread class.You hardly needs this type of requirement in real life scenario.Hope it helps you !
type: Answer
has comment: http://stackoverflow.com/comment/38540279
upvote count: 1
has comment: http://stackoverflow.com/comment/38540384
answers question: http://stackoverflow.com/q/24825100
downvote count: 0

http://stackoverflow.com/comment/38456851
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24780956
has text: @HotLicks other than the return value (Long, long) is there any diff?
type: Comment

http://stackoverflow.com/a/24795539
has comment: http://stackoverflow.com/comment/38487886
answers question: http://stackoverflow.com/q/24795395
upvote count: 1
score: 1
has body: You can do it the old DOS way. Create a file, say yes.txt. All it should have is y (as per your app expectations). The file can contain responses to multiple prompts each on their own lines Now you can execute your exe file something like this myApp.exe &lt; yes.txt When exe prompts, yes.txt will supply the prompt text
downvote count: 0
has comment: http://stackoverflow.com/comment/38492677
type: Answer

http://stackoverflow.com/comment/38417315
score: 0
type: AnswerComment
type: Comment
has text: I've updated my answer with links for both. I do recommend taking a look at maven\ant\... for your dependency management. It will save a lot of headaches. (and most tutorials will mention which dependencies you need)
comment on: http://stackoverflow.com/a/24759962

http://stackoverflow.com/comment/38699003
type: AnswerComment
has text: @BradlySpicer Then it's very difficult to identify ,where is the **problem** actually? but i think your issue is not related to this. I thought.
type: Comment
comment on: http://stackoverflow.com/a/24908992
score: 0

http://stackoverflow.com/q/24754722
score: 0
has body: It's more of a 'XML encoding question' - I'm trying to send a SOAP request, containing characters from ISO-8859-1 such as 'руддщцщкдв'. when trying to append it to XML for SOAP requests, it just replaces it all to '?'. Using Burp, I found out it will work only if I send the value as: &lt;groupName&gt;&amp;#1088;&amp;#1091;&amp;#1076;&amp;#1076;&amp;#1097;&amp;#1094;&amp;#1097;&amp;#1082;&amp;#1076;&amp;#1074;&lt;/groupName&gt; but I cna't get it to do that using Java Stirng methods.
answer count: 1
tagged with: soap
tagged with: utf-8
tagged with: iso-8859-1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24754905
tagged with: java
has title: SOAP and Charsets in Java
type: Question
tagged with: encoding

apache-pig
tags question: http://stackoverflow.com/q/24890628
tags question: http://stackoverflow.com/q/24795301
tags question: http://stackoverflow.com/q/24832420
tags question: http://stackoverflow.com/q/24834448
tag name: apache-pig
tags question: http://stackoverflow.com/q/24875999
type: Tag

http://stackoverflow.com/q/24860517
tagged with: android-activity
type: UnansweredQuestion
downvote count: 1
type: Question
has title: Error Read .txt from sdcard insert into EditText
tagged with: java
score: -1
upvote count: 0
answer count: 1
has body: I made an android program where we(user) can set the id etc. from Edit Text and then that value will be saved into .txt file in sdcard. I already can do that (make a .txt file in sdcard. now I'm trying to read that .txt file in other activities in my application and insert that value in edit text there when this activities start/begin.. I need that so I can set for example "id" just one time in my application,, and then everytime user makes a form entries data, some data that set before for example "id" already insert into edit text in entries activities there.. when i'm trying to read value from .txt(file that i build before in other Activity) and want to insert that value into EditText when Activity started, i got an error something like this "activity unable to bla.. bla.. bla.." "java.lang.null.pointerexception" please help me what i miss in my code, thanks this is my code in Activities when i'm trying to read .txt file : package com.asrimobile; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.view.View; import android.view.Window; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; public class Email extends Activity implements OnClickListener{ //inisilisasi elemen-elemen pada layout private Button Send; private EditText Subject; private EditText Message; private TextView tv_attach; private ImageButton Attachment; private EditText edTo_email; String file_path; private static final int PICK_IMAGE = 100…
tagged with: android-sdcard
favorite count: 0
tagged with: nullpointerexception
tagged with: android
has answer: http://stackoverflow.com/a/24882015

http://stackoverflow.com/comment/41666770
has text: Why don't you want to use DataFX?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24805951

parsing
tags question: http://stackoverflow.com/q/24845525
tags question: http://stackoverflow.com/q/24854100
tags question: http://stackoverflow.com/q/24790856
tags question: http://stackoverflow.com/q/24864424
tags question: http://stackoverflow.com/q/24867614
tags question: http://stackoverflow.com/q/24823422
tags question: http://stackoverflow.com/q/24813430
tag name: parsing
tags question: http://stackoverflow.com/q/24826029
tags question: http://stackoverflow.com/q/24764687
tags question: http://stackoverflow.com/q/24820430
tags question: http://stackoverflow.com/q/24879697
tags question: http://stackoverflow.com/q/24865636
tags question: http://stackoverflow.com/q/24853688
tags question: http://stackoverflow.com/q/24871299
tags question: http://stackoverflow.com/q/24772828
type: Tag
tags question: http://stackoverflow.com/q/24810755
tags question: http://stackoverflow.com/q/24862777
tags question: http://stackoverflow.com/q/24822323
tags question: http://stackoverflow.com/q/24894123
tags question: http://stackoverflow.com/q/24906464
tags question: http://stackoverflow.com/q/24814250
tags question: http://stackoverflow.com/q/24760984
tags question: http://stackoverflow.com/q/24791823
tags question: http://stackoverflow.com/q/24899409
tags question: http://stackoverflow.com/q/24899112
tags question: http://stackoverflow.com/q/24771938
tags question: http://stackoverflow.com/q/24802724

http://stackoverflow.com/a/24805598
downvote count: 0
has comment: http://stackoverflow.com/comment/38503247
score: 4
answers question: http://stackoverflow.com/q/24804618
type: Answer
has comment: http://stackoverflow.com/comment/75641789
has comment: http://stackoverflow.com/comment/75636705
has comment: http://stackoverflow.com/comment/38503214
has comment: http://stackoverflow.com/comment/38503376
upvote count: 4
has body: I looked at the source code: In the Java 7 case, the method gives the last modified timestamp with 1 second precision: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/sun/nio/fs/UnixFileAttributes.java#UnixFileAttributes.lastModifiedTime%28%29 In the Java 8 case, it looks like it should give microsecond precision: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/sun/nio/fs/UnixFileAttributes.java#UnixFileAttributes.lastModifiedTime%28%29 But in either case, the code doesn't seem to provide a way to get the timestamp with a different precision.

http://stackoverflow.com/a/39383524
score: 1
downvote count: 0
has body: maybe it is not a standard way, but it works for me better than other answers. I make an anim resource file for each view I want to animate after each other and gave each next animation more duration time. for example if we have three textviews which we want to animate right to left after each other , we make two anim files .xml like this: anim1.xml : anim2.xml : and than in my activity I set my textview like this: new AnimationUtils(); Animation anim_one= AnimationUtils.loadAnimation(this, R.anim.anim1); Animation anim_two = AnimationUtils.loadAnimation(this, R.anim.anim2); txt1.startAnimation(anim_one); txt2.startAnimation(anim_two);
type: Answer
answers question: http://stackoverflow.com/q/24889019
upvote count: 1

http://stackoverflow.com/q/24761254
tagged with: android-loadermanager
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/24761872
has comment: http://stackoverflow.com/comment/38419806
tagged with: android
has title: Should WeakReference to a Context object be used when instantiating a Loader/AsyncTask?
tagged with: android-loader
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/24761872
type: Question
downvote count: 0
has body: I came across information that a WeakReference to the Context object should be used with AsyncTasks and Loaders to avoid memory leaks in case Activity gets destroyed before the AsyncTask completes. But i am unclear if any references to the Context should be a weak reference - including the one when a AsyncTask gets instantiated. So should, say, AsyncTaskLoader be instantiated this way? public abstract class BaseLoader extends AsyncTaskLoader&lt;Response&gt; { public BaseLoader(WeakReference&lt;Context&gt; context){ super(context.get()); } ... } Or is it fine to user the actual Context object to instantiate the AsyncTastkLoader class, but keep a WeakReference to context in case it is needed anywhere else in the AsyncTask?
has comment: http://stackoverflow.com/comment/38420170
answer count: 1

http://stackoverflow.com/comment/38631711
type: Comment
type: QuestionComment
has text: the problem is in the starting itself. I am not able to call Ajax function on changing the dropdpwn value. Could you please suggest what can be wring while calling the AJAX function?
comment on: http://stackoverflow.com/q/24781259
score: 0

http://stackoverflow.com/a/24843755
answers question: http://stackoverflow.com/q/24843730
has body: GIF, JPEG and PNG should be supported in all JREs. As a more specific answer to what any particular JRE supports, see the MediaTypes source code which provides lots of info.
accepted answer of: http://stackoverflow.com/q/24843730
type: Answer
has comment: http://stackoverflow.com/comment/38575496
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38575956
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/24870074
has answer: http://stackoverflow.com/a/24870107
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/38625455
upvote count: 1
has body: Take a loot at the bottom in my for loop. It's probably a simple logical error but for some reason 'if' condition is never met. Sorry for asking basic stuff but I've searched and searched and can't seem to find the answer. Thanks for helping a noob. Scanner scan = new Scanner(System.in); System.out.println("How large would you like the array to be? (number)"); int arraySize = scan.nextInt(); scan.nextLine(); String [] myArray = new String [arraySize]; int i = 0; if (arraySize &lt;= 0 ) { System.out.println("Please enter a positive integer for the array size. Rerun program when ready."); } else { while (i &lt; myArray.length) { System.out.println("Please type a string to be entered in the array"); myArray[i] = scan.nextLine(); i++; } System.out.println("Array contents: " + Arrays.toString(myArray)); } System.out.println("What element would you like would you like to find in the array by performing a linear search?"); String search = scan.nextLine(); for (int j = 0; j &lt; myArray.length; j++) { if (myArray[j] == search){ int location = j + 1; System.out.println("The element, " + search + " was found in the array, in which the linear search looped " + location + " times to find it." ); j = myArray.length; } }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24870107
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38625518
duplicate of: http://stackoverflow.com/q/513832
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38625488
tagged with: for-loop
tagged with: linear-search
tagged with: arrays
downvote count: 0
has title: Why is my condition never met?
favorite count: 0
has answer: http://stackoverflow.com/a/24870099
accepted answer: http://stackoverflow.com/a/24870099

http://stackoverflow.com/comment/121096029
type: Comment
comment on: http://stackoverflow.com/q/24827194
score: 0
has text: [This](https://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html) this is really helpful.
type: QuestionComment

http://stackoverflow.com/a/24853170
answers question: http://stackoverflow.com/q/24853094
has comment: http://stackoverflow.com/comment/38593383
has comment: http://stackoverflow.com/comment/38593147
accepted answer of: http://stackoverflow.com/q/24853094
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/38593078
score: 8
has body: @NotNull is a JSR 303 Bean Validation annotation. It has nothing to do with database constraints itself. This annotation is intended for validation. @Column(nullable = false) is the way of declaring a column to be not-null. This last annotation is intended for indicating database schema details
has comment: http://stackoverflow.com/comment/91307572

http://stackoverflow.com/a/62847558
type: Answer
has body: "System.in" is a parameter that is taken by Scanner Class where "System" is a class and "in" is a static variable of type InputStream which tells the Java Compiler that System input will be provided through console(keyboard).
score: 0
answers question: http://stackoverflow.com/q/24786399

http://stackoverflow.com/a/24801121
score: 0
has body: You are passing the link.toString() into the URI. Instead of this you need to pass link.getText().toString(). See The edited line in your code. I just replace Uri uri = Uri.parse(link.toString()); to Uri uri = Uri.parse(link.getText().toString().trim()); rowView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { TextView textview1 = (TextView) v.findViewById(R.id.title); Log.i("textview1",textview1.getText().toString().trim()); TextView link = (TextView) v.findViewById(R.id.link); //Uri uri = Uri.parse(link.toString()); // WRONG STATEMENT Uri uri = Uri.parse(link.getText().toString().trim()); // EDITED context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); } });
type: Answer
answers question: http://stackoverflow.com/q/24800959

http://stackoverflow.com/a/24800892
has comment: http://stackoverflow.com/comment/38494748
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24800777
has body: sometimes i use the library XStream, check this "2 minute tuturial" http://x-stream.github.io/tutorial.html create the objects that have the info public class Person { private String firstname; private String lastname; private PhoneNumber phone; private PhoneNumber fax; // ... constructors and methods } public class PhoneNumber { private int code; private String number; // ... constructors and methods } start the xtream XStream xstream = new XStream(); insert the info as alias xstream.alias("person", Person.class); xstream.alias("phonenumber", PhoneNumber.class); Insert info Person joe = new Person("Joe", "Walnes"); joe.setPhone(new PhoneNumber(123, "1234-456")); joe.setFax(new PhoneNumber(123, "9999-999")); Generete the XML String xml = xstream.toXML(joe);
has comment: http://stackoverflow.com/comment/38494372
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/38596787
type: Comment
has text: If starting eclipse with -clean on commandline does not work, please report a bug to https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Recommenders
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24846800

http://stackoverflow.com/a/24801317
upvote count: 2
downvote count: 0
has body: The only way you can do this is using JNDI Bound Datasource in the server. In general the way it works as follows: Configure a datasource in the server. The username and password are part of the configuration. The datasources is bound to to JNDI tree. The datasource can be looked up into JNDI tree and from there a connection can be obtained. Once you have the connection, you can fire queries. Here is an example of how to do this in Tomcat.
answers question: http://stackoverflow.com/q/24801071
type: Answer
score: 2

http://stackoverflow.com/a/24793948
score: 1
upvote count: 1
has body: Your instance of the GamePlay class must have a reference to your MainActivity object in oder to access its members. public class GamePlay { ... MainActivity main = ... .... main.player1ScoreView.setText(num.format(player1score)); } Of course it would be better to access is via a getter method. I'm not sure how you'll pass the reference of the MainActivity to your GamePlay object. It depends on how you create that object.
has comment: http://stackoverflow.com/comment/38481872
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24793920

http://stackoverflow.com/comment/38803629
has text: So far I have gotten it working well enough so that it separates all the items less than one line to be added to the right spot in the array list, but only the first line of the "Description" item is put in the correct spot in the array list, since my parser splits up "Description" on each new line in it.
comment on: http://stackoverflow.com/q/24877673
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24824844
tagged with: apache
has title: Working with apache nutch 2.2.1
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24830007
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to start my first crawl, I've already configured the database settings and I execute the following command: bin/nutch inject urls And the bug result is the following: InjectorJob: starting at 2014-07-18 08:13:34 InjectorJob: Injecting urlDir: urls InjectorJob: Using class org.apache.gora.sql.store.SqlStore as the Gora storage class. InjectorJob: java.lang.RuntimeException: job failed: name=inject urls, jobid=job_local1172062909_0001 at org.apache.nutch.util.NutchJob.waitForCompletion(NutchJob.java:54) at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:233) at org.apache.nutch.crawl.InjectorJob.inject(InjectorJob.java:251) at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:273) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at org.apache.nutch.crawl.InjectorJob.main(InjectorJob.java:282) Can someone help me?
score: 1
tagged with: java
tagged with: nutch
tagged with: gora
upvote count: 1
tagged with: web-crawler
type: Question

http://stackoverflow.com/a/24884619
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24882752
type: Answer
accepted answer of: http://stackoverflow.com/q/24882752
has body: According to code from your Activity: private TextView mTextView; private TextView text; public void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); setContentView(R.layout.activity_my); final WatchViewStub stub = (WatchViewStub)findViewById(R.id.watch_view_stub); text = (TextView)findViewById(R.id.text); stub.setOnLayoutInflatedListener((stub -&gt; { mTextView = (TextView)stub.findViewById(R.id.text); }}; text.setText("test"); } Why do you have two TextViews? You have only one either in your rect_activity: or round_activity: layouts. You have to understand how WatchViewStub works. You cannot access views from your rect/round layouts right after setContentView because they are not inflated yet. Like you did - you can access your views only in OnLayoutInflatedListener listener callback. You have tried to find your mTextView inside this callback - which is the way you should do it. What is wrong? You should remove following lines: text = (TextView)findViewById(R.id.text); and this one: (it also causes your NullPointerException) text.setText("test"); and keep only the mTextView field. What should you do? Add following like right after mTextView = (TextView)stub.findViewById(R.id.text);: mTextView.setText("test"); It must be incide the OnLayoutInflatedListener. Your final code should look like: private TextView mTextView; public void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); setContentView(R.layout.activity_my); final WatchViewStub stub = (WatchViewStub)findViewById(R.id.watch_view_stub); stub.setOnLayoutInflatedListener((stub -&gt; { mTextView = (TextView)stub.findViewById(R.id.text); mTextView.setText("test"); }}; }

http://stackoverflow.com/q/24830936
has answer: http://stackoverflow.com/a/25686906
has comment: http://stackoverflow.com/comment/38556231
score: 0
answer count: 2
tagged with: instrumentation
tagged with: cobertura
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38556453
has answer: http://stackoverflow.com/a/24831615
tagged with: performance
tagged with: java
has title: what is the performacne impact on instrumented jars vs non instrumented jars
has body: What would be the performance impact if I instrument my java classes with cobertura or clover and deploy vs not instrument jars and deploy ? Will this have any significant difference in how application performs ? I tried this test on my web application(locally), which is really small and I am not able to notice any difference in performance, but I would like to know how much impact does it have on a big projects like a heavy web server that takes around 50 requests per sec.
type: Question

http://stackoverflow.com/q/24751855
score: 0
type: UnansweredQuestion
tagged with: spring
has title: How to rewrite mockControl test to spring 4
tagged with: testing
tagged with: java
type: Question
answer count: 1
has body: In spring 3.6 I am testing client side according to this example: http://javacrumbs.net/spring-ws-test/ Problem is this doesn work with spring 4. It throw exception: java.lang.IncompatibleClassChangeError: Found interface org.springframework.test.context.TestContext, but class was expected at net.javacrumbs.springws.test.simple.annotation.WsMockControlTestExecutionListener.prepareTestInstance(WsMockControlTestExecutionListener.java:47) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:331) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:213) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:290) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:292) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:176) at org.eclipse.jdt.internal.junit4.runner.JUnit4Te…
has answer: http://stackoverflow.com/a/24752355

http://stackoverflow.com/q/24887402
favorite count: 0
possible better answer: http://stackoverflow.com/a/24887566
has answer: http://stackoverflow.com/a/24887470
has answer: http://stackoverflow.com/a/24887566
linked to: http://stackoverflow.com/q/24883018
has comment: http://stackoverflow.com/comment/38658016
type: AnsweredQuestion
score: 1
upvote count: 1
has title: How to make loops more efficient?
type: Question
accepted answer: http://stackoverflow.com/a/24887470
tagged with: java
has comment: http://stackoverflow.com/comment/38668922
has comment: http://stackoverflow.com/comment/38658065
has comment: http://stackoverflow.com/comment/38667152
has comment: http://stackoverflow.com/comment/38658353
has comment: http://stackoverflow.com/comment/38658110
answer count: 2
downvote count: 0
has body: I am having a problem with a basic code which displays some animated images in a 150x150 grid on the screen. (Note: Yes i know the images go off the edge of the screen but in the end i was planning to scale the images as required to fit the screen). However the program only runs at 2 FPS causing the animation to sometimes not work. My loop is currently as follows (in Java): for (int i = 0; i &lt; 22; i++) { for (int j = 0; j &lt; 11; j++) { g2d.drawImage(getImage(texture_Ocean,l),i*64,j*64,i*64+64,j*64+64,0,0,64,64,this); } } And getImage: public Image getImage(Image i, Long l) { BufferedImage b = (BufferedImage) i; int w = b.getWidth(); if (b.getHeight() % w == 0) { int frames = b.getHeight()/w; int frame = Math.round((l%1000)/(1000/frames)); System.out.println(frame); return b.getSubimage(0,(int) (w*frame) ,w, w); } else { return texture_error; } } My question is how can i make my program more efficient/run quicker? I know there has to be a way to do it as you see games such as prison architect and rimworld with words that are 300x300 and have hundreads of entities. And games such as TF2 which display thousands of polygons in 3D space. How?

http://stackoverflow.com/comment/38637816
comment on: http://stackoverflow.com/q/24876323
score: 0
type: Comment
type: QuestionComment
has text: @Braj but its the other way around. I want decimal value TO binary... allow me to edit the post...

http://stackoverflow.com/q/24799871
has answer: http://stackoverflow.com/a/24800116
tagged with: servlets
type: Question
answer count: 2
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/24800270
has comment: http://stackoverflow.com/comment/38492604
tagged with: opencsv
favorite count: 0
upvote count: 2
has title: Showing 20,000 records through pagination
type: UnansweredQuestion
score: 2
has body: I need to read a CSV file with 20,000 records. I can't put all those records in a list at once. We are not using any database. We are reading the CSV through openCSV framework. Please tell me some approach so I can read csv part wise part and send the list to Servlet for pagination. This is the sample of code what I have started to implement pagination but its not working. private void viewRecords(List&lt;CSVBean&gt; generated) { int page = 1; int recordsPerPage = 100; int offset = (page - 1) * recordsPerPage; System.out.println("offset:"+offset); System.out.println("recordsPerPage:"+recordsPerPage); for(int i= offset;i&lt;recordsPerPage;i++) { CSVBean csvBean = generated.get(i); System.out.println(csvBean.getAttr1()); System.out.println(csvBean.getAttr2()); System.out.println(csvBean.getAttr3()); System.out.println(csvBean.getAttr4()); System.out.println(csvBean.getAttr5()); } }
tagged with: java
tagged with: pagination

http://stackoverflow.com/q/24824546
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38538753
type: Question
tagged with: android-wallpaper
has title: stuck on loading image while trying to set image as wallpaper
tagged with: image
has body: i am creating images gallery wallpaper app in which i am trying to set image as wallpaper. when i try to set a image as wallpaper i gets stuck at image loading message. this is the screenshot: it gets stuck here: tThis is the set wallpaper code: set_wallpaper.java package com.td.gridview; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.app.AlertDialog; import android.app.WallpaperManager; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class Set_Wallpaper extends Activity { private Uri mImageCaptureUri; private ImageView mImageView; private AlertDialog dialog; private static final int PICK_FROM_CAMERA = 1; private static final int CROP_FROM_CAMERA = 2; private static final int PICK_FROM_FILE = 3; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.set_wallpaper); // get intent data Intent i = getIntent(); // Selected image id int position = i.getExtras().getInt("id"); ImageView ing = (ImageView) findViewById(R.id.image_page); ing.setImageResource(MainActivity.ICONS[position]); doCrop(); } private void doCrop() { final ArrayList&lt;CropOption&gt; cropOptions = new ArrayList&lt;CropOption&gt;(); /** * Open image crop app by starting an intent * ‘com.android.camera.action.CROP‘. */ Intent intent = new Intent("com.android.camera.action.CROP"); intent.setType("image/*"); /** * Check if there is image cropper app installed. */ List&lt;ResolveInfo&gt; list = getPackageManager().queryInt…
upvote count: 1
has comment: http://stackoverflow.com/comment/38540031
has comment: http://stackoverflow.com/comment/38665866
has comment: http://stackoverflow.com/comment/38539051
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38666119
downvote count: 0
answer count: 0

http://stackoverflow.com/q/24837337
downvote count: 0
tagged with: wifi
favorite count: 0
tagged with: android
has body: This is about network Wifi how to connect it under android. But the question is which one is the best practice between the Code shown at here. And... this below? Because two of the source code given have a similarity but they're different in configuring the content. Please give a comment / clear answer. Thanks private void getConnected(){ // for Wifi Connectivity obWifiManager = (WifiManager) getApplicationContext().getSystemService( Context.WIFI_SERVICE); WifiConfiguration config = new WifiConfiguration(); config.SSID = "\""+objOpp.getName()+"\""; config.BSSID = objOpp.getID(); config.priority = 1; config.preSharedKey = "\""+ "PASSWORD"+"\""; config.status = WifiConfiguration.Status.DISABLED; config.status = WifiConfiguration.Status.CURRENT; config.status = WifiConfiguration.Status.ENABLED; config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.IEEE8021X); config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP); config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.NONE); config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104); config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED); config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.LEAP); config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); obWifiManager.addNetwork(config); // start connection obWifiManager.enableNetwork(config.…
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: network-programming
score: 1
tagged with: java
has title: Which one is the best practice to connect Wifi under Android?
upvote count: 1
linked to: http://stackoverflow.com/q/8818290
tagged with: connectivity

http://stackoverflow.com/comment/38696648
comment on: http://stackoverflow.com/q/24907705
type: Comment
type: QuestionComment
has text: Your error says "getRootLogger()" but your code says "getLogger()" Did you paste the correct code and wrong error message?
score: 0

http://stackoverflow.com/comment/38546393
has text: Also, you don't need all those `<bean />` definitions. Using `@ComponentScan` everything that has certain annotations (`@Component`, `@Service` etc) will be picked up automatically and used. See [here](http://docs.spring.io/spring/docs/4.0.4.RELEASE/spring-framework-reference/htmlsingle/#beans-stereotype-annotations) more about this.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24763580

php
tags question: http://stackoverflow.com/q/24805540
tags question: http://stackoverflow.com/q/24807294
tags question: http://stackoverflow.com/q/24854552
tags question: http://stackoverflow.com/q/24792659
tags question: http://stackoverflow.com/q/24771890
tags question: http://stackoverflow.com/q/24818374
tags question: http://stackoverflow.com/q/24772318
tag name: php
tags question: http://stackoverflow.com/q/24758195
tags question: http://stackoverflow.com/q/24754229
tags question: http://stackoverflow.com/q/24867420
tags question: http://stackoverflow.com/q/24750342
tags question: http://stackoverflow.com/q/24749303
tags question: http://stackoverflow.com/q/24799059
tags question: http://stackoverflow.com/q/24852305
tags question: http://stackoverflow.com/q/24882535
tags question: http://stackoverflow.com/q/24849328
tags question: http://stackoverflow.com/q/24814734
tags question: http://stackoverflow.com/q/24854628
tags question: http://stackoverflow.com/q/24851367
tags question: http://stackoverflow.com/q/24901626
tags question: http://stackoverflow.com/q/24779206
tags question: http://stackoverflow.com/q/24799307
tags question: http://stackoverflow.com/q/24907854
tags question: http://stackoverflow.com/q/24892346
tags question: http://stackoverflow.com/q/24856346
type: Tag
tags question: http://stackoverflow.com/q/24812110

http://stackoverflow.com/q/24846701
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24846733
possible better answer: http://stackoverflow.com/a/24846733
has answer: http://stackoverflow.com/a/24847086
upvote count: 1
tagged with: calendar
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: date
type: Question
answer count: 2
has body: If today's date is 19 July 2014 then my code works as follows : Calendar c = Calendar.getInstance(); My code and output is: c.roll(3, true); System.out.print(c.get(Calendar.DATE) + " " + c.get(Calendar.MONTH) + " " + c.get(Calendar.YEAR)); o/p : 26 6 2014 c.roll(2, true); System.out.print(c.get(Calendar.DATE) + " " + c.get(Calendar.MONTH) + " " + c.get(Calendar.YEAR)) o/p : 19 7 2014 c.roll(1, true); System.out.print(c.get(Calendar.DATE) + " " + c.get(Calendar.MONTH) + " " + c.get(Calendar.YEAR)) o/p : 19 6 2015 roll now will add 1st parameter to my date and give the answer. Am i write? once it is adding to year once to the month... I am not getting the exact working of this method. Please feel free to correct me.
accepted answer: http://stackoverflow.com/a/24847086
has title: understanding roll method in calendar class

http://stackoverflow.com/q/24847288
tagged with: java
has body: I am working with android and I need to make an XML design in which I need to have three buttons at the bottom of my screen horizontally always. Just like facebook application in android, they have three buttons at the bottom of the screen (Status, Photo, Check In) - similarly I need to have three buttons as well always in my application. What will be the design for this kind of layout? I tried with the below XML design but it doesn't work somehow and they all are coming vertical - &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/db1_root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/cow" android:layout_weight="0" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="center|bottom" android:orientation="vertical" &gt; &lt;Button android:id="@+id/button1" style="?android:attr/buttonStyleSmall" android:layout_width="145dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center" android:text="ButtonA" /&gt; &lt;Button android:id="@+id/button2" style="?android:attr/buttonStyleSmall" android:layout_width="145dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center" android:text="ButtonB" /&gt; &lt;Button android:id="@+id/button3" style="?android:attr/buttonStyleSmall" android:layout_width="145dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center" android:text="ButtonC" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; I just need to show three buttons at the bottom of the screen horizontally just like facebook shows always side by si…
tagged with: android-linearlayout
has comment: http://stackoverflow.com/comment/38581723
has answer: http://stackoverflow.com/a/24848188
has answer: http://stackoverflow.com/a/24847347
type: Question
has comment: http://stackoverflow.com/comment/38581799
has comment: http://stackoverflow.com/comment/38581643
accepted answer: http://stackoverflow.com/a/24847347
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38581916
tagged with: android-relativelayout
possible better answer: http://stackoverflow.com/a/24847454
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24847454
has comment: http://stackoverflow.com/comment/38581703
has comment: http://stackoverflow.com/comment/38581673
tagged with: android
has comment: http://stackoverflow.com/comment/38581752
type: AnsweredQuestion
has title: How to show three buttons at the bottom of the screen like facebook in android?

http://stackoverflow.com/comment/38527163
comment on: http://stackoverflow.com/q/24818124
score: 0
has text: Answer can be more than one line ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38575170
has text: If the dimensions of my grid expand then so does the conditional clauses to check if its within the column and row.. it ia a way but seems like its exhaustive.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24842550

http://stackoverflow.com/comment/44372931
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24762522
has text: I had the same problem, but it simply dissapeared after some time. Now I'm having it again. If you was able to solve it, please answer your own question. If I'm able to solve it i'll post an answer here too.
type: Comment

http://stackoverflow.com/comment/38650336
score: 1
comment on: http://stackoverflow.com/q/24878332
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/18259690/jsoup-escaping-ampersand-in-link-href

http://stackoverflow.com/comment/38522564
has text: did it work with you ? maybe it is something with the pom.xml ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24815540

http://stackoverflow.com/comment/38599766
has text: That is not a class named `Car`. That is a method named `retriveCarDetails()` which returns a `Car` object. You need something like `public class Car { ... }`.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24856404

http://stackoverflow.com/q/24775974
has answer: http://stackoverflow.com/a/24776716
has body: I am using menuContribution(Command Framework) to show a context menu, I want to limit it's visibility to and only to all type of files whatever in what perspective and view the appropriate editor that has the file open whatever in what perspective and view How to achieve this?
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
tagged with: eclipse-plugin
has title: How to limit visibility of a popup menu to all type of files including compilable file like Java file, etc.?
answer count: 1

http://stackoverflow.com/comment/38472366
comment on: http://stackoverflow.com/q/24788718
has text: @Mystical can i make any changes to the code, without using Thread.sleep(); to delay the execution? ..if i use Thread.sleep(); my execution will be delayed as a whole, i.e whether i calculate for 100 or for 10000000 the execution will be delayed for 5 seconds, but i want my program to be executed slowly..but not 5 seconds in all cases.. i want it to be 1 second for 100 and 8-10 seconds for 10000000
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38636899
comment on: http://stackoverflow.com/q/24875923
has text: Does it work? Make sure you test some cases where there are three or more duplicates right next to each other in the array. I suspect you will run into problems.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38559119
type: QuestionComment
comment on: http://stackoverflow.com/q/24821753
score: 0
has text: The effect is that your program pauses for the "real" times.
type: Comment

http://stackoverflow.com/a/24803179
has body: One aspect that hasn't been touched on in other answers is the fact that the example in the Oracle docs has a clear problem: if Relatable is only meant to be analogous to Comparable, then there needs to be a specialization for shapes in order to avoid the cast in the isLargerThan method. Perhaps, for example, an interface called RelatableShape, which itself extends Relatable, and provides for the getArea() method. Then, you could have Circle, Hexagon, Rectangle, etc. classes that implement RelatableShape (the interface with isLargerThan and getArea), and the isLargerThan() method would not need to cast its argument to a particular concrete class (since the parameter could be guaranteed to implement RelatableShape, and getArea() would always be available). Thus, though the Oracle documentation is showing something that is valid Java, it's also showing something that's necessary because of a bad design. Keep that in mind. Casting is almost never necessary in real code.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24802425

http://stackoverflow.com/a/24862654
has body: Your JSON isn't in correct format. Can you try using quotes for values of char array? { **"question" : "{'Q', 'u', 'e', 's', 't', 'i', 'o', 'n'}",** "status" : true, "userSecurityAnswerList" : null }
answers question: http://stackoverflow.com/q/24862561
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38611577

http://stackoverflow.com/comment/38567851
has text: honestly I'd just use a `List<UnderGrad> list = new ArrayList<UnderGrad>();` rather than an array.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24840095

http://stackoverflow.com/q/24779581
has title: Finding usage of methods in java
has comment: http://stackoverflow.com/comment/38454334
has comment: http://stackoverflow.com/comment/38456883
linked to: http://stackoverflow.com/q/5268998
answer count: 2
downvote count: 4
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24780340
has body: I have to find usage of methods in java. The requirement is to write metacode which can look in to code and find out methods which are used and where. In eclipse we can find it : Find methods calls in Eclipse project I have tried manually parsing the code and the java parser api : http://code.google.com/p/javaparser/. I found both the appoach difficult and involves lot of scenario to be handled. Any APIs which can be used or i have to manually parse the code to find the usages?
has answer: http://stackoverflow.com/a/24779816
tagged with: java
type: Question
score: -2

http://stackoverflow.com/comment/38564514
has text: the error for the example is: http://stackoverflow.com/questions/24821923/error-package-org-jboss-netty-channel-socket-nio-does-not-exist
type: AnswerComment
comment on: http://stackoverflow.com/a/24765016
score: 0
type: Comment

http://stackoverflow.com/comment/38416753
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24759551
has text: @A4L; it's returning: E:\CodePractice @Enterprise Java\@Eclipse\Murach's Servlet and JSP\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Chapter6\WEB-INF\EmailList.txt
score: 0

http://stackoverflow.com/comment/38758878
has text: In your `foreach` example the semantics of `i` have been changed. It was 0 the first time around the loop. It will now be 1 the first time around. Also, the same problem with it not being effectively final exists, so `i2` would still be needed.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24907787

http://stackoverflow.com/comment/38479176
type: QuestionComment
has text: You're mistaken that percent signs and backslashes are interchangeable in `printf()` calls.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24792397

http://stackoverflow.com/q/24839594
accepted answer: http://stackoverflow.com/a/24839641
has comment: http://stackoverflow.com/comment/38566956
possible better answer: http://stackoverflow.com/a/24839738
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/24839738
upvote count: 0
has comment: http://stackoverflow.com/comment/38567016
favorite count: 0
has title: Java game error, input == null?
has comment: http://stackoverflow.com/comment/38566948
has answer: http://stackoverflow.com/a/62781999
has comment: http://stackoverflow.com/comment/38566929
has comment: http://stackoverflow.com/comment/38566946
has answer: http://stackoverflow.com/a/24839641
has body: I am making a Java 2D game and I am a newbie to programming language and game devolpment, so any help would be superb for me. Right, to start off I have an error in my java script, here it is: Exception in thread "Thread-0" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1388) at ca.gingerninja.game.gfx.SpriteSheet.&lt;init&gt;(SpriteSheet.java:19) at ca.gingerninja.game.Game.init(Game.java:55) at ca.gingerninja.game.Game.run(Game.java:78) at java.lang.Thread.run(Thread.java:745) And here is a screenshot of my code: public class SpriteSheet { public String path; public int width; public int height; public int[] pixels; public SpriteSheet(String path) { BufferedImage image = null; try { image = ImageIO.read(getClass().getResource(path)); } catch (IOException e) { e.printStackTrace(); } if(image == null) { return; } And here is the error in the debug console: public static BufferedImage read(URL input) throws IOException { if (input == null) { throw new IllegalArgumentException("input == null!"); } If you need anymore code please ask me and i will show them. Please help me sort out this error.
score: -4
has comment: http://stackoverflow.com/comment/38567058
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11116020
tagged with: java

http://stackoverflow.com/q/24773739
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24775077
has comment: http://stackoverflow.com/comment/38443024
has comment: http://stackoverflow.com/comment/38443272
has comment: http://stackoverflow.com/comment/38443630
has comment: http://stackoverflow.com/comment/38443597
has answer: http://stackoverflow.com/a/24773942
has comment: http://stackoverflow.com/comment/38443374
tagged with: java
has comment: http://stackoverflow.com/comment/38443449
has comment: http://stackoverflow.com/comment/38443232
has comment: http://stackoverflow.com/comment/38443544
has body: I have a arrays inside array of number in java, Now I want to print this array in linear way. So how to traverse over it? Eg: [1,[4,6],[4,9,1,[34,[56,32,45,87]],56,7],98]
type: Question
has title: Nth dimensional array in java
has comment: http://stackoverflow.com/comment/38443033
has comment: http://stackoverflow.com/comment/38443699
score: 0
answer count: 3
tagged with: arrays
has comment: http://stackoverflow.com/comment/38443260
has answer: http://stackoverflow.com/a/24773914

http://stackoverflow.com/comment/38407425
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24754854
has text: @SanchitShah - you are representing binary numbers as String right?. becaause `01` is an octal number and different from `1`
score: 0

http://stackoverflow.com/comment/38509763
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24808502
has text: Your code has several other problems. All your methods return values, but when they are called in `main` it ignores the return values. Your `for` loop is broken; with `i == employees` the loop will run if and only if there is exactly 1 employee. If it worked, you would read an int for each employee, throwing them all away and keeping just the last one. You also create several `Scanner`s over `System.in`. I'm not sure if that's a bug or just a bad practice.
score: 0

http://stackoverflow.com/q/24856918
upvote count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: java
tagged with: keylistener
type: Question
has title: How to eliminate delay in keyPress?
answer count: 2
has comment: http://stackoverflow.com/comment/38600742
accepted answer: http://stackoverflow.com/a/24857086
downvote count: 0
has comment: http://stackoverflow.com/comment/38600786
tagged with: awt
has body: So I have seen a few threads about this already and I need some help about how to fix it specifically. When you hold down a key, Java will read the first key press, then there will be a small delay, and then it will continuously read the key press until you release the key. public void keyPressed(KeyEvent key) { int code = key.getKeyCode(); if (code == KeyEvent.VK_DOWN) { //Do stuff } if (code == KeyEvent.VK_LEFT) { //Do stuff } if (code == KeyEvent.VK_RIGHT) { //Do stuff } if (code == KeyEvent.VK_UP) { //Do stuff } } That is my current code. I heard that to fix this you can create a timer which rapidly checks for key presses, but I'm not really sure how to do that. Would appreciate some help here or if there is a better solution.
possible better answer: http://stackoverflow.com/a/78075647
score: 1
has answer: http://stackoverflow.com/a/78075647
favorite count: 0
has answer: http://stackoverflow.com/a/24857086

http://stackoverflow.com/a/24834248
score: 2
has comment: http://stackoverflow.com/comment/38557795
has comment: http://stackoverflow.com/comment/38557653
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The simplest answer is a piece-wise linear function as in the other answer. However, a comment says "Any kind of smooth curve that doesn't result in pointy mountaintops or narrow pits". The second simplest answer is to use the unique parabola which goes through the 3 points (quadratic interpolation) but that violates the requirement that all the values must be between min(A,B,C) and max(A,B,C). So we are stuck with the 3rd simplest answer: use a piece-wise quadratic function with 0 derivative at 0: f(x) = B + (C-B) * x^2 when x is in [0,1] B + (A-B) * x^2 when x is in [-1,0]
has comment: http://stackoverflow.com/comment/38557740
accepted answer of: http://stackoverflow.com/q/24834050
upvote count: 2
answers question: http://stackoverflow.com/q/24834050

http://stackoverflow.com/comment/38453174
score: 12
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24779281
has text: Use a dependency management system? Like Maven

http://stackoverflow.com/a/24810104
has body: Yes. Samsung already knows about this problem. I can suggest you try to using same implementation of Popup from GitHub. It is not best way, but will be works.
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/38513354
upvote count: 4
answers question: http://stackoverflow.com/q/24809580
downvote count: 0

http://stackoverflow.com/a/24850671
type: Answer
answers question: http://stackoverflow.com/q/24808418
has body: i did retrieve the style from the web element, but i am trying to set new style , i tried this: JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("document.getElementById('colorPickIcon').setAttribute('style', '22.3333px')"); and it doesn't work....
score: 0

http://stackoverflow.com/q/24907194
answer count: 0
tagged with: java
tagged with: excel
type: Question
has title: JXL Api Throwing an error while reading MS Excel 2013 generated Excel File
tagged with: jxl
score: 0
has body: I have a "test.xlsx" file created via MS Excel 2013. When I tried to read this via JXL API as below public Workbook readExcel(File inputWorkbook) { Workbook workbook= null; try { workbook = Workbook.getWorkbook(inputWorkbook); Sheet sheet = workbook.getSheet(0); for (int j = 0; j &lt; sheet.getColumns(); j++) { for (int i = 0; i &lt; sheet.getRows(); i++) { Cell cell = sheet.getCell(j, i); CellType type = cell.getType(); if (type == CellType.LABEL) { System.out.println("I got a label " + cell.getContents()); } if (type == CellType.NUMBER) { System.out.println("I got a number " + cell.getContents()); } } } } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return workbook ; } I am getting "jxl.read.biff.BiffException: Unable to recognize OLE stream" When I am saving this file as 1997-2003 .xls then program runs fine. I wanted to know if JXL api has limitation that it cannot read MS 2013 Excel programs ? If someOne solved this issue please let me know
has comment: http://stackoverflow.com/comment/38796275
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38731655

http://stackoverflow.com/comment/38606890
type: AnswerComment
has text: I got this **-1** because Stephen C think it is not hashing but this code is correct to solve above problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24848153

http://stackoverflow.com/q/24851012
has title: Can't add chars to Character ArrayList
possible better answer: http://stackoverflow.com/a/24851029
tagged with: arraylist
has answer: http://stackoverflow.com/a/24851029
score: 0
tagged with: string
has answer: http://stackoverflow.com/a/57140120
has answer: http://stackoverflow.com/a/57160944
has comment: http://stackoverflow.com/comment/38588796
answer count: 4
accepted answer: http://stackoverflow.com/a/24851026
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/383947
has answer: http://stackoverflow.com/a/24851026
type: Question
has comment: http://stackoverflow.com/comment/38588832
has body: I'm having issues understanding ArrayList in Java. I tried to declare a Character ArrayList and add a char at 0, but it returned error at list.add(0, "B") line. public class ArrListTest { public static void main(String[] args) { ArrayList&lt;Character&gt; list; list.add(0, "B"); } } Also I'm having issues reversing a string. Is there a way to reverse a string without using a loop?

http://stackoverflow.com/q/24891990
tagged with: program-entry-point
downvote count: 0
has title: Java: Passing combination of named and unnamed parameters to executable jar/main method
possible better answer: http://stackoverflow.com/a/24893326
has answer: http://stackoverflow.com/a/24893326
tagged with: arguments
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24892328
upvote count: 7
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/24892149
accepted answer: http://stackoverflow.com/a/24892328
has body: I want to pass, both, named and unnamed arguments to the main method. Currently I am passing arguments as: java -jar myfile.jar param1 param2 and handling them as: public static void main(String[] args) throws IOException { String param1 = args[0]; String param2 = args[1]; } However, I want to pass the arguments in a more dynamic way - namely, so that: I can pass, both, named and unnamed arguments; I can fetch/handle these arguments with their names; I will not be required to pass them in the same order, every time I execute the main method. Passing in a way Something like this: java -jar myJar param3name=param3 param2name=param2 param1name=param1 param5 param6 and handling in a way something like this: public static void main(String[] args) throws IOException { //something like String param3 = getvaluemethod("param3name"); String param1 = getvaluemethod("param1name"); ..... String param5 = args[n] String param6 = args[n+1] ..... } I am fine to work with some external libraries which would make my work easier. I have already seen this and it is not comprehensive. Any input on how to accomplish the task?
type: Question
has answer: http://stackoverflow.com/a/76148276

self-signed
type: Tag
tag name: self-signed
tags question: http://stackoverflow.com/q/24780708

http://stackoverflow.com/q/24804388
has title: Display and writing of image in java
score: 2
type: AnsweredQuestion
upvote count: 3
has body: I am unable to display the image as there's problem in the main method and i am not sure whether did i write the image correctly. Sorry, I am really new to Java. public class Display extends JPanel { String path = "C:/Users/asus/workspace/Code/src/7horses.jpg"; File file = new File(path); static BufferedImage img; img = ImageIO.read(new File(file)); public static BufferedImage CopyImage (File file) { BufferedImage cImg = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics g = cImg.createGraphics(); g.drawImage(img, 0, 0, null); g.dispose(); File saveImage = new File("C:/Users/asus/workspace/Code/src", saveAs); ImageIO.write(cImg, "png", saveImage); return cImg; } public static void main(String[] args) { JFrame f = new JFrame("Show Image"); LoadImage panel = new BufferedImage CopyImage(file);// f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(panel); f.pack(); f.setLocation(200,200); f.setVisible(true); } } After duplicate the image, i am not sure how to display the duplicate copy. Below was the code which i initially use for loading and displaying. public class LoadImage extends JPanel { BufferedImage img; String path = "C:/Users/asus/workspace/MP/src/7horses.jpg"; File file = new File(path); public void paint(Graphics g) { g.drawImage(img, 0, 0, null); } public LoadImage() { try { img = ImageIO.read(file); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { JFrame f = new JFrame("Show Image"); LoadImage panel = new LoadImage(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(panel); f.pack(); f.setLocation(200,200); f.setVisible(true); } }
downvote count: 1
has answer: http://stackoverflow.com/a/24804645
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/24804733
tagged with: image
has answer: http://stackoverflow.com/a/24804615
has answer: http://stackoverflow.com/a/24804733
answer count: 3
accepted answer: http://stackoverflow.com/a/24804615
favorite count: 0

spring-integration
tags question: http://stackoverflow.com/q/24790805
tags question: http://stackoverflow.com/q/24800016
tags question: http://stackoverflow.com/q/24769416
tags question: http://stackoverflow.com/q/24763690
tags question: http://stackoverflow.com/q/24776775
type: Tag
tags question: http://stackoverflow.com/q/24765756
tags question: http://stackoverflow.com/q/24892890
tags question: http://stackoverflow.com/q/24806238
tag name: spring-integration
tags question: http://stackoverflow.com/q/24864836
tags question: http://stackoverflow.com/q/24797907
tags question: http://stackoverflow.com/q/24897439

http://stackoverflow.com/a/24831875
score: 4
has comment: http://stackoverflow.com/comment/38554211
type: Answer
answers question: http://stackoverflow.com/q/24831183
has body: move the A.java under folder JavaTest to com/test/helpers. the error you are seeing is for the compiler complaining that A.java is in a folder that does not match its package declaration. Remember, you cannot access A from App without A being in a package. from under src driectory run the following command to compile your classes src&gt; javac ./*.java ./com/test/helpers/*.java then from under src folder src&gt;java App that should run your program.
downvote count: 1
upvote count: 5

http://stackoverflow.com/q/24793951
has title: java String != null not working reading from bufferedReader
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/38481904
score: 0
tagged with: numberformatexception
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/513832
has body: In android I am getting the String value from BufferedReader and it is null after reading from file. intstring = br.readLine(); System.out.println(intstring); if(intstring != null) { System.out.println("Inside if condition"); int istring = Integer.parseInt(intstring); } My output is null Inside if condition NumberFormatException Help me please
has comment: http://stackoverflow.com/comment/38481882
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/38481856
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38481947
tagged with: java
has answer: http://stackoverflow.com/a/24793970
has comment: http://stackoverflow.com/comment/38481939
type: Question

http://stackoverflow.com/a/24770729
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24770667
type: Answer
has body: try Double.toString (n).split ("\\.")[1].equals(Double.toString (m).split ("\\.")[1]) but to fix your problem change to a = scan.nextDouble(); scan.nextLine (); // consume CR b = scan.nextDouble();
accepted answer of: http://stackoverflow.com/q/24770667
has comment: http://stackoverflow.com/comment/38437504
has comment: http://stackoverflow.com/comment/38437456
score: 0

http://stackoverflow.com/q/24818882
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24818940
tagged with: counter
has answer: http://stackoverflow.com/a/24818926
downvote count: 0
has answer: http://stackoverflow.com/a/24819269
favorite count: 0
has answer: http://stackoverflow.com/a/24818958
has body: Two counters are defined within my code . When the right answer to a single user ID is added to the true_counter and the wrong answer to a user if the wrong material is added to the fales_counter , but the problem is when the activity re- load the counters to zero as . package com.Learning.math; import java.util.Random; import org.w3c.dom.Text; import com.Learning.math.R; import android.app.Activity; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; public class Plus extends Activity { private TextView num11; private TextView num22; public Integer no1; public Integer no2; Button btn; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.plus_page); // Set Numbers To TextView's num11 = (TextView) findViewById(R.id.num1); num22 = (TextView) findViewById(R.id.num2); Intent iin = getIntent(); Bundle b = iin.getExtras(); if (b != null) { final String numb1 = (String) b.get("from"); final String numb2 = (String) b.get("to"); Integer min = Integer.valueOf(numb1); Integer max = Integer.valueOf(numb2); Random r1 = new Random(); int random1 = r1.nextInt(max + -min) + min; Random r2 = new Random(); int random2 = r2.nextInt(max - min) + min; String str1 = String.valueOf(random1); String str2 = String.valueOf(random2); num11.setText(str1 + ""); num22.setText(str2 + ""); no1 = Integer.valueOf(str1); no2 = Integer.valueOf(str2); } final EditText answerbox = (EditText) findViewById(R.id.answer_box); final ImageView true_pic = (ImageView) findViewById(R.id.imageView1); final ImageView false_pic = (ImageView) findViewById(R.id.imageView2); final Handler handler = new Handl…
linked to: http://stackoverflow.com/q/3624280
type: UnansweredQuestion
tagged with: android
has title: How can I define the counter is not reset by restarting activity?
answer count: 4
score: 1
tagged with: java

http://stackoverflow.com/q/24848167
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38583660
has body: I have following directory of my project(in Eclipse)as below WebContent | --Image | --logo.jpg --WEB-INF | --web.xml --lib --index.jsp --WebPage | --sayan.jsp I want to add logo.jpg in both index.jsp and sayan.jsp page. I do this in the following method for index.jsp, &lt;img src="/Image/logo.jpg" /&gt; and for sayan.jsp, &lt;img src="../Image/logo.jpg" /&gt; But in both case image does not appear in webpages.How can I load logo.jpg image in both pages?
type: AnsweredQuestion
upvote count: 2
has title: How can i add a image in jsp page from a Folder?
downvote count: 2
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24848200
accepted answer: http://stackoverflow.com/a/24848200
tagged with: java
tagged with: image
score: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/38583547

http://stackoverflow.com/q/24772129
tagged with: collections
type: Question
tagged with: java
upvote count: 1
answer count: 1
downvote count: 0
duplicate of: http://stackoverflow.com/q/70324
favorite count: 0
type: UnansweredQuestion
has title: LinkedList have static class named as Entry.Why it is static and what would be the benefits ?
linked to: http://stackoverflow.com/q/70324
score: 1
has answer: http://stackoverflow.com/a/24772146
has body: Linklist have static class named as ENTRY private static class Entry&lt;E&gt; { E element; Entry&lt;E&gt; next; Entry&lt;E&gt; previous; Entry(E paramE, Entry&lt;E&gt; paramEntry1, Entry&lt;E&gt; paramEntry2){ this.element = paramE; this.next = paramEntry1; this.previous = paramEntry2; } } And an object has created inside LinkList private transient Entry&lt;E&gt; header = new Entry(null, null, null); Following are my questions? Why it is static ? If we define more than two LinkList will it share the same static class 'Entry'?

http://stackoverflow.com/a/24797658
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24797610
answers question: http://stackoverflow.com/q/24797610
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: 100 is the equivalent of the d character. So your string will become dd. When you do ID = Long.parseLong(new String(byteArray, "utf-8").trim(), 16); You are converting the string to a long number, with hexadecimal format. the decimal value for dd is 221, that's why you get that output. what is the use of utf-8 and ,16? utf-8 is the character encoding that the String constructor will use to build up the string, and 16 is the radix that will be used to convert your string to a long.

http://stackoverflow.com/comment/94934157
has text: Yields: `The type RepositoryRestConfigurerAdapter is deprecated`. Also does not appear to work
comment on: http://stackoverflow.com/a/25066565
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/24895270
tagged with: network-programming
tagged with: data-structures
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24895479
favorite count: 0
has body: I have a list of records with below fields in each record. &lt;Network address of subnet, subnet mask, Object&gt;. For every incoming packet i have to read the client address, AND it with each subnet mask to figure out which subnet (from my list) it belongs to and return corresponding object. Currently I am using HashMap with network address as a key to store records. But the problem is, if an Ip address belongs to more than one subnet in the table, then I have to choose the one which has largest CIDR prefix (smallest subnetwork) and I can not go with any other subnet. For example, I have below two records &lt;128.30.20.0, 255.255.255.0, Object-1&gt; &lt;128.30.0.0, 255.255.0.0, Object-2&gt; Then an Ip address "128.30.20.1" should always choose first record because it is a smaller network than the second one. Hashmap doesn't guarantee that records will be in correct order. My approach is to keep these records in such a way that they will always be in such order that smaller networks are always at the beginning. This list of records will be passed to some other application wherein they just iterate through the list to find out the match starting from 0 position. (they just don't want extra processing at their end.) Could anyone please suggest some data structure in java to accomplish this?
accepted answer: http://stackoverflow.com/a/24895479
has title: Best Data structure to store subnets for matching Ip address with subnet
type: AnsweredQuestion
tagged with: subnet
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/38446805
type: Comment
has text: I looked into it, and it seems good! But I don't know how I feel about using third-party libraries, since I plan on selling the game at some point, I know licences can be tricky. But thank you very much for the comment!
type: AnswerComment
comment on: http://stackoverflow.com/a/24770618
score: 0

http://stackoverflow.com/comment/38588017
comment on: http://stackoverflow.com/a/24850561
type: Comment
has text: Ok but odd. But you might want to also add an if to the second call to next() just in case the result only contains one row :}
score: 1
type: AnswerComment

http://stackoverflow.com/a/24898842
has comment: http://stackoverflow.com/comment/38680244
has body: Color doesn't have any no-arg constructor hence you have use super(some arguments) because by default compiler calls no-arg constructor of super class public LabeledColored1(Color color, String name) { super(); // by default added .. } It should be public LabeledColored1(Color color, String name) { super(color.getRed(),color.getGreen(),color.getBlue()); .. } OR public LabeledColored1(Color color, String name) { super(color.getRGB()); .. } If you are not overriding any functionality of existing class then never extend it instead use composition. Read Composition over inheritance principle that might help you in this case. I have a doubt here why are you extending Color class where as you already have Color object in the class itself. You are combining both inheritance and composition in the same class.
upvote count: 6
has comment: http://stackoverflow.com/comment/38680275
type: Answer
has comment: http://stackoverflow.com/comment/38680340
has comment: http://stackoverflow.com/comment/38680067
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/24898820

http://stackoverflow.com/a/24801553
type: Answer
accepted answer of: http://stackoverflow.com/q/24801463
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24801463
upvote count: 2
has body: My suggestion is:Set the onClick in the XML file, and create the method in the current class. &lt;Button android:id="@+id/btn_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="click" /&gt; public void click(View arg0) { }
type: AcceptedAnswer

http://stackoverflow.com/comment/77452879
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/40824937
has text: For some reason it gave me an error "Could not find a setter for property foo in class bar". I solved it by adding @Transient annotation above the getProductName() function. And also added this on the top import javax.persistence.Transient;

http://stackoverflow.com/q/24808920
favorite count: 0
tagged with: android-studio
upvote count: 8
type: UnansweredQuestion
tagged with: java
has title: First build with AndroidStudio failed
has body: I'm new to android programming and I'd like to use Android Studio for the start. I downloaded and installed AndroidStudio 0.8.0 on my Ubuntu 14.04 machine. I also set up java properly. When I create a new project (as told by http://developer.android.com/training/basics/firstapp/creating-project.html) it looks like it will try to build the sample files. But then I always get this error: /home/daniel/AndroidStudioProjects/Heimweg/app/src/main/res/drawable-xhdpi/ic_launcher.png Error:Error: Cannot run program "/home/daniel/android/android-studio/sdk/build-tools/android-4.4W/aapt": error=2, No such file or directory Error:Execution failed for task ':app:mergeDebugResources'. /home/daniel/AndroidStudioProjects/Heimweg/app/src/main/res/drawable-xhdpi/ic_launcher.png: Error: Cannot run program "/home/daniel/android/android-studio/sdk/build-tools/android-4.4W/aapt": error=2, No such file or directory How can I deal with this error? When I try to run the app it says »ADB not responding. You can wait more, or kill "adb" process manually and click "Restart"«
type: Question
answer count: 2
score: 8
has answer: http://stackoverflow.com/a/24809227
downvote count: 0
tagged with: android
has answer: http://stackoverflow.com/a/25026209
has comment: http://stackoverflow.com/comment/38514932

http://stackoverflow.com/comment/38418065
type: QuestionComment
type: Comment
has text: I dont think there is need of any code. My only question is in which scenario we get this kind of error.
comment on: http://stackoverflow.com/q/24755613
score: 0

http://stackoverflow.com/q/24892504
possible better answer: http://stackoverflow.com/a/24893030
tagged with: inheritance
has answer: http://stackoverflow.com/a/24893030
answer count: 2
downvote count: 0
favorite count: 0
has body: I have implemented a class including methods which is not supported by built-in Java. However, after some time, this class has become quite large. Since it includes independent methods like printMapContainer() and splitMapContainer, I thought I should divide class into two or more different, logical, sub classes and add some hierarchy. But, I don't know how to split below class because they don't fit to an inheritance sort of problem. How should I logically divide this class which has independent methods with each other so that I can put more methods to a new hierarchy without losing code quality? (30 methods in one class, so awkward, is it not?) HashMapHelper mergeHashMaps.java // merge more than one hash maps into one printHashMap.java // print key,value pair in desired format to console formHashMap.java // form existing hash map into new format splitHashMap.java // split hash map into more same size chunks isEqual.java // is two hash map contain same pair removeALL.java // remove all key from hash map updateKeyALL.java // update hash map with new key set Each method has more than one helper method in order to obey 24-line-for-each-method rule. Therefore, in only one class, I have nearly 20 methods. I just want to put hierarchy to this class and then use, for example; maybe like, HashMapHelper hMH = new BasicHashMapMethods();.
has answer: http://stackoverflow.com/a/24892792
has comment: http://stackoverflow.com/comment/38668051
type: AnsweredQuestion
score: 1
has title: How to divide below class which have independent methods with each other?
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24892792
tagged with: oop
tagged with: java

http://stackoverflow.com/a/24839472
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24839394
has body: you can try this @Controller public class test { @RequestMapping("/test.htm") public String test(@RequestParam(value="name",required=true) String name) { return "index"; } }

http://stackoverflow.com/q/24851749
has title: POSTing arraylist
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: in most of the q&amp;a its Name Value Pair that is used to POST; List&lt;NameValuePair&gt; myBooks = new ArrayList&lt;NameValuePair&gt;(); DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(myBooks)); but when I try to change the params to to arrayList, List&lt;Books&gt; myBooks= //fulfilled from another class" I get this: The constructor UrlEncodedFormEntity(List&lt;myBooks&gt;) is undefined is it really impossible to post List instead of ValuePair without Jackson lib?
type: Question
has answer: http://stackoverflow.com/a/24851899
accepted answer: http://stackoverflow.com/a/24851899
tagged with: arraylist
score: 0
tagged with: http-post
answer count: 1

named-query
type: Tag
tags question: http://stackoverflow.com/q/24799481
tag name: named-query
tags question: http://stackoverflow.com/q/24862058

http://stackoverflow.com/comment/38635066
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24874817
has text: Suggest you post your `getResources()` and `getStringArray()` functions so we can see what you're trying to do. I would think at first glance, you might want to look in to some sort of XML parser such as that offered by JAXB to get data from your XML file.
score: 0

http://stackoverflow.com/comment/38680458
type: QuestionComment
has text: Why do you create a StringBuilder with the results of converting the BigInteger to a String and then, every time you want to check one of the characters, convert the StringBuilder to a String? This makes no sense.
comment on: http://stackoverflow.com/q/24899038
score: 0
type: Comment

http://stackoverflow.com/comment/38686191
comment on: http://stackoverflow.com/q/24902031
score: 0
has text: com.example.*****.*****.DisplayMessageActivity. I have just put **** instead of actual names in there to protect the privacy of the project. And DisplayMessageActivity is an actual class
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38439430
comment on: http://stackoverflow.com/q/24771626
score: 1
type: Comment
has text: Also the naming semantics of the method `insertRow()` implies that the method should just insert one row at a time. I don't think a new table and table model should be created each time you add a row. Unless I'm wrong about the method name. Just a thought.
type: QuestionComment

http://stackoverflow.com/comment/38712765
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24906846
type: Comment
has text: @bajagaraja cool, you're welcome. Unfortunately there is no other way than throwing an exception to cancel the parser after a certain number of elements. I would recommend though to use a custom Exception for example `ParseLimitReachedException` to stop parsing, then your document might grow to a point where you can't afford to let it run till the end. Using a custom Exception will allow you to differentiate it from other Exceptions related to XML parsing itself.

http://stackoverflow.com/a/24867630
type: Answer
has comment: http://stackoverflow.com/comment/38636763
has comment: http://stackoverflow.com/comment/38628928
score: 0
has comment: http://stackoverflow.com/comment/38636854
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38626534
accepted answer of: http://stackoverflow.com/q/24864424
answers question: http://stackoverflow.com/q/24864424
has comment: http://stackoverflow.com/comment/38629321
has body: Don't call it XML when it isn't. If you want to process this file you'll need to discover what rules (grammar) it conforms to, and write a parser for that grammar. This may be rather difficult; I suspect the grammar, when you discover it, will be ambiguous and will require infinite lookahead to resolve.

http://stackoverflow.com/comment/38616204
has text: Ok, I explain: If you simply enable filtering as described in the link, your build (for example: "mvn install") will apply it. Of course, you must provide the values for the parameters (with "-D...").
score: 0
comment on: http://stackoverflow.com/q/24864777
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24872529
linked to: http://stackoverflow.com/q/9114162
tagged with: java
has answer: http://stackoverflow.com/a/24872629
answer count: 2
has body: I am trying to trigger a batch job through a web url (Servlet/Spring MVC) which is working perfectly when initiated from a main program. When I start the web server and hit the url the program gives me an exception that jobLauncher is not resolved. This is the SO question which is pretty close to my requirement, but I want to see if my current approach be corrected before moving to the suggestion there which is also a multi-threaded (not really required for me at this point) Here's my perfectly working configuration, batch-config, Main program. I am invoking my spring batch through the servlet here 11:02:37.201 [tomcat-http--24] DEBUG o.s.orm.jpa.JpaTransactionManager - Not closing pre-bound JPA EntityManager after transaction 11:02:37.202 [tomcat-http--24] INFO o.s.b.c.l.support.SimpleJobLauncher - Job: [FlowJob: [name=db2FileJob]] completed with the following parameters: [{a=aa, b=123, c=ccc, d=11,22,33}] and the following status: [COMPLETED] 11:02:37.204 [tomcat-http--24] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'jobLauncher' 11:02:37.205 [tomcat-http--24] DEBUG o.s.web.servlet.DispatcherServlet - Could not complete request javax.servlet.ServletException: Could not resolve view with name 'jobLauncher' in servlet with name 'mint-gateway' at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208) ~[spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012) ~[spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) ~[spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) ~[spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) [spring-webmvc-4.0.0.R…
tagged with: spring-batch
has title: Issues triggering a batch job from Spring MVC
has answer: http://stackoverflow.com/a/24952358
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 0
type: Question

http://stackoverflow.com/comment/38857229
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24979073
type: Comment
has text: Hey the junit/spring version may do the trick. Can you tell me the version-numbers?

http://stackoverflow.com/a/24872661
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38636111
has body: Your python code appends a colon to the input String before calling Base64 &gt;&gt;&gt; print '%s:' % 'test' test: When I add the colon to your java code, I am able to get the same result in my testing (python and Java), String user = System.getProperty("user.name") + ":"; byte[] encoded_str = Base64.encodeBase64(user .getBytes()); String encoded_string = new String(encoded_str) .trim(); System.out.println(encoded_string);
has comment: http://stackoverflow.com/comment/38630803
accepted answer of: http://stackoverflow.com/q/24872557
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/38630703
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24872557

http://stackoverflow.com/comment/38494656
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24800982
has text: what is the value log.i and are the values set correctly ?
score: 0

http://stackoverflow.com/q/24841335
tagged with: cucumber
tagged with: testing
has body: I'm using jenkins, gradle, cucumber and java to run end-to-end tests. I want to retry every failing test twice. How can I configure any of the frameworks above to do so?
has title: How to retry a failed cucumber test twice?
linked to: http://stackoverflow.com/q/11719898
has comment: http://stackoverflow.com/comment/38570493
tagged with: automated-tests
has comment: http://stackoverflow.com/comment/38570731
downvote count: 0
has comment: http://stackoverflow.com/comment/38571027
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38647495
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: gradle
type: Question

http://stackoverflow.com/comment/38638434
type: QuestionComment
comment on: http://stackoverflow.com/q/24876323
has text: If you are dealing with Java strings, 48 is not ASCII, it's a Unicode/UTF-16 code-unit. In this case, the single code-unit needed for the U+0030 codepoint ([DIGIT ZERO](http://www.fileformat.info/info/unicode/char/30/index.htm)).
score: 0
type: Comment

http://stackoverflow.com/q/24879599
has title: Benefits of using dependency injection Spring
has answer: http://stackoverflow.com/a/24879842
type: AnsweredQuestion
score: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/24879842
accepted answer: http://stackoverflow.com/a/24879614
type: Question
has comment: http://stackoverflow.com/comment/38644120
upvote count: 5
answer count: 3
has comment: http://stackoverflow.com/comment/38644335
has body: What are the benefits of dependency injection of spring in an application? Can i achieve the dependency injection without using Spring as a framework?
favorite count: 0
has answer: http://stackoverflow.com/a/24879614
has answer: http://stackoverflow.com/a/24881677
downvote count: 2
tagged with: spring

http://stackoverflow.com/comment/38500891
has text: Hey. This is great! However, The "mirroring" to a presentation is only the first usecase. Its actually the first step into chromecasting, where I'd love to have a similiar approach. (like with the onViewChangedAction creating some kind of message which the html5/js on the cc supports). However, I dont think this is really doable in a "convenient" way. So I'll throw it "off board" for the moment. Your approach is much simpler for the moment (I didnt know that I could actually "just" reuse the fragment's inflated view.). Please make an answer and I'll accept it as soon as I get it working!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24802152

http://stackoverflow.com/q/24889099
upvote count: 2
favorite count: 0
tagged with: google-drive-api
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
downvote count: 0
has body: I made an android application that reads in an MPEG file uploaded on google Drive, with Google Drive Api. The reading is done correctly, but I keep getting the following error message: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. java.lang.Throwable: Explicit termination method 'close' not called at dalvik.system.CloseGuard.open(CloseGuard.java:184) at android.os.ParcelFileDescriptor.&lt;init&gt;(ParcelFileDescriptor.java:179) at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:905) at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:897) at bwe.a(SourceFile:227) at cdn.createFromParcel(SourceFile:10) at bwe.a(SourceFile:227) at cxl.createFromParcel(SourceFile:10) at daa.onTransact(SourceFile:167) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(Native Method) The function that realizes the reading is the following: private void readTrack() { Drive.DriveApi.getRootFolder(mGoogleApiClient) .listChildren(mGoogleApiClient).setResultCallback(idFolder2); } final private ResultCallback&lt;MetadataBufferResult&gt; idFolder2 = new ResultCallback&lt;MetadataBufferResult&gt;() { @Override public void onResult(MetadataBufferResult result) { // TODO Auto-generated method stub if (!result.getStatus().isSuccess()) { showToast("Cannot find DriveId. Are you authorized to view this file?"); return; } Metadata metadata2 = null; for (int i = 0; result.getMetadataBuffer().get(i) != null; i++) { metadata2 = result.getMetadataBuffer().get(i); if (metadata2.getTitle().equalsIgnoreCase("patologiaA")) { DriveFolder folder = Drive.DriveApi.getFolder( mGoogleApiClient, metadata2.getDriveId()); folder.listChildren(mGoogleApiClient).setResultCallback( metadataResult2); break; } } result.getMetadataBuffer().close(); } }; @SuppressLint("NewApi") final private ResultCallback&lt;MetadataBufferResult&gt; metadataResult2 = …
has title: A resource was acquired at attached stack trace but never released. Google Drive Api
tagged with: java
type: Question

http://stackoverflow.com/q/24880068
has comment: http://stackoverflow.com/comment/38645192
score: 4
has answer: http://stackoverflow.com/a/24880155
has answer: http://stackoverflow.com/a/24880105
upvote count: 4
has answer: http://stackoverflow.com/a/33300885
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38644552
tagged with: colors
answer count: 4
has body: i've got a question about JTextField background color. How can I change it in enabled text field (while editing) ? setBackground works only for disabled text field. UIManager.put can change this background for all of my text field in window but i want to do that only for one of them.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24880234
accepted answer: http://stackoverflow.com/a/33300885
tagged with: java
has answer: http://stackoverflow.com/a/24880234
has comment: http://stackoverflow.com/comment/38644527
tagged with: swing
tagged with: background
tagged with: jtextfield
has title: Change JTextField enabled background color
type: Question

http://stackoverflow.com/comment/38554933
comment on: http://stackoverflow.com/q/24808392
score: 1
has text: Please look at the source code of some built-in Hamcrest matcher. They show you how to override matchesSafely and describeTo.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38588968
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24850476
has text: But the above is not going to work, as instead 'Thread.sleep(1000);' I am doing a task that access UI!!!
type: AnswerComment

http://stackoverflow.com/a/69756759
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24766591
has body: I've simply tricked the build system and put Java 8 path into Java 7 section of my Maven's toolchains.xml: jdk 1.7.0_80 sun <!--jdkHome>C:\Program Files\java\jdk1.7.0_80</jdkHome--> C:\Program Files\java\jdk1.8.0_281

http://stackoverflow.com/a/24822074
answers question: http://stackoverflow.com/q/24821583
score: 0
type: Answer
has body: First you should create DOM elements. All we need are two div elements, one in other. First one will be progress bar holder and you can put it whenever you want on your page. Another one is progress bar indicator. Something like this: &lt;div id="progressBar"&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt; Now, we need some basic CSS for those elements. We will set width, height and colors: #progressBar { width: 400px; height: 22px; border: 1px solid #111; background-color: #292929; } #progressBar div { height: 100%; color: #fff; text-align: right; line-height: 22px; /* same as #progressBar height if we want text middle aligned */ width: 0; background-color: #0099ff; } And at the end we need one function with 4 lines of code. It’s a simple function that accept two parameters. function progress(percent, $element) { var progressBarWidth = percent * $element.width() / 100; $element.find('div').animate({ width: progressBarWidth }, 500).html(percent+ "%&amp;nbsp;"); } First parameters is percentages that progress bar should show and other one is jQuery object of progress bar holder. If we want to set progress bar to 80% all we have to do is: progress(80, $('#progressBar')); Of course before all of this we need to include jQuery library on our page. This simple progress bar can be easily styled with CSS. I’ve create a few skins that can be downloaded from GitHub. Feel free to create your own skins and send me pull request.
accepted answer of: http://stackoverflow.com/q/24821583
type: AcceptedAnswer

http://stackoverflow.com/comment/38626261
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24860817
has text: @LucaBassoRicci I am reading Spring Batch documentation, it seems based on the workflow where input items are consumed one at a time and only writing happens in chunks. This precludes the optimization which I am suggesting here, which is to use just one DB roundtrip to fetch 1000 existing items. Fetching one by one introduces substantial overheads. Also, each chunk is immediately committed, not just flushed to the database. This then causes escalation of the restarting logic. For some applications it is simply not acceptable to commit before the whole job is finished.

http://stackoverflow.com/q/24757230
favorite count: 0
has title: Maven copying Tomcat JARs into webapp WEB-INF/lib directory
has comment: http://stackoverflow.com/comment/38412029
has answer: http://stackoverflow.com/a/24757564
has comment: http://stackoverflow.com/comment/38412376
type: AnsweredQuestion
tagged with: maven
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24757564
has body: I have a very simple webapp published as a WAR file, being developed in Eclipse. I'm using m2e for dependency management. My project, in the Project Facets tab, has the Dynamic Web Module enabled, along with Java. In addition, under my Deployment Assembly I have the Maven dependencies listed, but no inclusion/exclusion options: My WAR builds fine, and runs fine in Eclipse. However, the Dynamic Web Module seems to be resulting in my WAR file containing a number of Tomcat JARs, in addition to all my other dependencies: I was able to remove tomcat-catalina-7.0.30.jar (not pictured) by including in my POM.xml: org.apache.tomcat tomcat-catalina 7.0.30 provided But it seems there must be a way to tell Maven that the entire Tomcat container will be provided at runtime. I don't want to add ~20 provided entries to remove the rest of them.
score: 1
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38412333
answer count: 1
downvote count: 0
tagged with: tomcat

http://stackoverflow.com/comment/38450582
comment on: http://stackoverflow.com/a/24759342
type: Comment
has text: @KanwaljeetSingh: Please accept the answer when it solved this problem and submit a new question with your new problem. Did you try to add the role `manager-script` or the url **/manager/text**? See http://stackoverflow.com/questions/3714080/tomcat-7-maven-plugin
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38408473
type: QuestionComment
has text: It would be great if you can share minimal testable code.
comment on: http://stackoverflow.com/q/24755467
score: 0
type: Comment

http://stackoverflow.com/comment/39014229
type: Comment
type: QuestionComment
has text: private static void hideSoftKeyboard(Activity activity, View v) { InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); } try this
comment on: http://stackoverflow.com/q/24799935
score: 0

hashmap
tags question: http://stackoverflow.com/q/24805664
tags question: http://stackoverflow.com/q/24850707
tags question: http://stackoverflow.com/q/24796299
tags question: http://stackoverflow.com/q/24900614
tags question: http://stackoverflow.com/q/24852854
tags question: http://stackoverflow.com/q/24809159
tags question: http://stackoverflow.com/q/24896577
type: Tag
tags question: http://stackoverflow.com/q/24790497
tags question: http://stackoverflow.com/q/24778196
tags question: http://stackoverflow.com/q/24846579
tags question: http://stackoverflow.com/q/24824887
tags question: http://stackoverflow.com/q/24768076
tags question: http://stackoverflow.com/q/24836649
tag name: hashmap
tags question: http://stackoverflow.com/q/24848313
tags question: http://stackoverflow.com/q/24785072
tags question: http://stackoverflow.com/q/24850102

http://stackoverflow.com/a/24810728
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38514318
has comment: http://stackoverflow.com/comment/38515173
has body: I would not even make a separate Comparator. You can just implement Comparable interface on your Patient class and implement the necessary compareTo method. A quick implementation: @Override public int compareTo(Object o) { Patient p = (Patient) o; if (this.getCategory() &lt; p.getCategory()) return -1; if (this.getCategory() &gt; p.getCategory()) return 1; else { if (this.getTimeArrived().before(p.getTimeArrived())) return -1; if (this.getTimeArrived().after(p.getTimeArrived())) return 1; } return 0; } Also add this.add(p) in your registerPatient method. Nothing else needed to get the program to work. More info on Comparable interface: http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html EDIT // After your comment I looked at the assignment more carefully and actually it says: c. Internal use of a PriorityQueue and PatientComparator This means (at least how I would read it) that you don't actually have to extend the PriorityQueue but you could just use it as an internal resource. Here is how I would implement the PatientQueue class: import java.util.Comparator; import java.util.PriorityQueue; public class PatientQueue { PriorityQueue pq; // default constructor public PatientQueue() { this.pq = new PriorityQueue&lt;Patient&gt;(1, new PatientComparator()); } public void registerPatient(Patient p) { this.pq.add(p); } // end registerPatient method public Patient getNextPatient() { return (Patient) this.pq.poll(); } // end getNextPatient method } // end PatientQueue class and in your EmergencyRoomSimulator class just change the field declaration to PatientQueue pq = new PatientQueue();
has comment: http://stackoverflow.com/comment/38515620
type: Answer
has comment: http://stackoverflow.com/comment/38515159
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38513132
has comment: http://stackoverflow.com/comment/38515364
answers question: http://stackoverflow.com/q/24810287
has comment: http://stackoverflow.com/comment/38515638
accepted answer of: http://stackoverflow.com/q/24810287
upvote count: 1

http://stackoverflow.com/a/24847125
accepted answer of: http://stackoverflow.com/q/24844559
answers question: http://stackoverflow.com/q/24844559
score: 13
has body: You're making the filtering more complicated than it has to be. For inserting (if the code is same is replace), you are not able to enter probably because of the \\. check. You will only be able to paste a period, as that's what you are checking for. As for the remove, the suggestion below will apply. To simplify things, you should just get the entire text of the document, then use regex to check if the entire document string matches the regex. It's much simpler than what you are trying to do. You can get a good explanation of the filtering process here. Here's an example, using just insertString and replace. For the remove, it's no different, just get the text, and check if it matches a regex. I took part of the example from the answer in the link above. The scenario was that the OP wanted max charcters, along with only one decimal place allowed. That's what the regex matches. But could also match anything as you're typing or inserting such as 00 00. 00.0 import java.awt.GridBagLayout; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.text.AbstractDocument; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; public class FilterDemo { public FilterDemo() { JFrame frame = new JFrame(); frame.setLayout(new GridBagLayout()); frame.setSize(300, 300); frame.add(createFilteredField()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationByPlatform(true); frame.setVisible(true); } public JTextField createFilteredField() { JTextField field = new JTextField(); AbstractDocument document = (AbstractDocument) field.getDocument(); final int maxCharacters = 10; document.setDocumentFilter(new DocumentFilter() { public void replace(FilterBypass fb, int offs, int length, String str, AttributeSet a) throws BadLocationException { String text = fb.getDocument().getText(0, fb.getDocument().getLength()); text += …
upvote count: 13
has comment: http://stackoverflow.com/comment/38599732
has comment: http://stackoverflow.com/comment/38598095
has comment: http://stackoverflow.com/comment/38655290
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/52715477
type: Answer
has comment: http://stackoverflow.com/comment/38596403

http://stackoverflow.com/a/24807491
downvote count: 0
type: Answer
has body: Try this WindowManager.LayoutParams localLayoutParams = getWindow() .getAttributes(); localLayoutParams.screenBrightness = 0.12F; getWindow().setAttributes(localLayoutParams);
answers question: http://stackoverflow.com/q/24807233
score: 1
upvote count: 1

http://stackoverflow.com/comment/38560120
type: QuestionComment
comment on: http://stackoverflow.com/q/24835669
score: 0
has text: Post your complete code
type: Comment

http://stackoverflow.com/a/24785118
answers question: http://stackoverflow.com/q/24784933
upvote count: 0
has comment: http://stackoverflow.com/comment/38491679
has comment: http://stackoverflow.com/comment/38532865
type: Answer
has comment: http://stackoverflow.com/comment/38508623
has comment: http://stackoverflow.com/comment/38466128
has body: You might want to check if there is data available to read by using the in.ready() method first. If available, you can read the data using in.readLine(), else do nothing. Currently, in.readLine() blocks because there is no input available on the socket.
downvote count: 1
has comment: http://stackoverflow.com/comment/38465400
score: -1

http://stackoverflow.com/a/24800221
has comment: http://stackoverflow.com/comment/38542502
has comment: http://stackoverflow.com/comment/38494049
score: 3
has body: You can use ChannelSFTP#put method to write a file to remote directory. there are several flavors of the put method and you can use any one as per your needs. Here is a sample code to write a File from Local System to remote system: JSch jsch = new JSch(); Session session = null; try { session = jsch.getSession("ragesh", "10.0.0.1", 22); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword("password"); session.connect(); System.out.println("Connected to session successfully"); Channel channel = session.openChannel("sftp"); channel.connect(); System.out.println("Connected to Channel successfully"); ChannelSftp sftpChannel = (ChannelSftp) channel; // this will read file with the name test.txt and write to remote directory sftpChannel.cd("/root/usr/path"); File f = new File("test.txt"); sftpChannel.put(new FileInputStream(f), f.getName()); // here you can also change the target file name by replacing f.getName() with your choice of name sftpChannel.exit(); session.disconnect(); } catch (JSchException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/38494182
answers question: http://stackoverflow.com/q/24798881
type: Answer
has comment: http://stackoverflow.com/comment/38494542
upvote count: 3
has comment: http://stackoverflow.com/comment/38498675
has comment: http://stackoverflow.com/comment/38499225
downvote count: 0

http://stackoverflow.com/comment/38522281
comment on: http://stackoverflow.com/q/24814895
score: 0
has text: thanks for replying. I've also tried this with images (png & jpg). The files are corrupted after receiving( gallery opens a black image). Something interesting that I noticed is that the difference in file sizes is always 4 bytes. maybe that can help ?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24751428
type: Answer
answers question: http://stackoverflow.com/q/24750912
accepted answer of: http://stackoverflow.com/q/24750912
score: 1
has body: You can try to override paintComponent() and apply horizontal scale to the Graphics instance Graphics2D g2d=(Graphics2D)g; AffineTransform old=g2d.getTransform(); g2d.scale(0.5, 1); //paint the text here g2d.setTransform(old);
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38506270
type: Comment
has text: Gallery might be opening due to some other parts in your code. Make sure to use break in switch cases at the end of each case. cannot figure out the exact problem due to lack of complete code mate.
comment on: http://stackoverflow.com/a/24804158
type: AnswerComment
score: 0

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/24861416

http://stackoverflow.com/comment/38535773
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24822935
has text: it says like below ijaz@ijaz20:/opt/software$ ls -l `which java` lrwxrwxrwx 1 root root 22 Jul 18 14:40 /usr/bin/java -> /etc/alternatives/java
type: AnswerComment

http://stackoverflow.com/comment/38483062
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24794641
score: 0
has text: It still gets stuck…it was like that originally, and then I changed it to try to fix the problem. It didn't, obviously….

http://stackoverflow.com/comment/38431517
score: 0
type: AnswerComment
has text: it still wont work. I will add the activity_main which might not work with the button press? it works fine with a button on the screen.
comment on: http://stackoverflow.com/a/24767106
type: Comment

http://stackoverflow.com/q/24825386
has title: Migrated to Jersey 2, now needing to interperate a valueType in Client
tagged with: rest
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/38540841
type: Question
has comment: http://stackoverflow.com/comment/38540551
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jettison
has body: After migrating to Jersey 2.0, my REST service seems to serve up this boolean flag in a slightly different manner. (I can provide the Service code as well if it helps, but this seems pretty standard and just needs interperated different on the client) {"incompleteFlag":{"valueType":"TRUE"}} I think this is because the way the JSON is build was changed with the migration, but I used to interperate this fine using Java code like such: boolean incompleteFlag = false; JSONObject json = new JSONObject(response.readEntity(String.class)); //At this point in debugging, checking json variable looks good, as we seen above incompleteFlag = json.getBoolean("incompleteFlag"); Obviously this does not work anymore since we now have a valueType to interperate. Any way to simply get this true/false flag? I've been trying to search out there, but not much luck. Edit - Adding service code as well. I mentioned this in a comment, but I was having some serialization issues when trying to use the JSONObject instead of JsonObject from javax and that is why that aspect changed with the migration. @GET @Path("{employeeId}") @Produces(MediaType.APPLICATION_JSON) public Response produceJSON(@PathParam("employeeId") String empId){ System.out.println("Checking emp forms for " + empId); boolean incompleteFlag = TAFactory.getHome().getIncompleteEmployeeForms(empId); JsonObject myObject = Json.createObjectBuilder().add("incompleteFlag", incompleteFlag).build(); return Response.ok(myObject, MediaType.APPLICATION_JSON).build(); }
score: 0
tagged with: jersey

http://stackoverflow.com/q/24879432
tagged with: fusioncharts
score: 0
answer count: 1
has title: Extract data from fusion charts to excel
accepted answer: http://stackoverflow.com/a/24927031
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/24927031
type: Question
tagged with: testing
has body: I am using selenium to automate the application which has fusion charts in it. Is there any method so that i can export the chart data to excel.

http://stackoverflow.com/a/24875316
has comment: http://stackoverflow.com/comment/38646936
has comment: http://stackoverflow.com/comment/38641214
accepted answer of: http://stackoverflow.com/q/24873010
upvote count: 9
has body: A method call is not a problem since hot methods are often inlined. A virtual call is an issue. In your code the type profiler is fooled by the initialization method Image.random. When Image.process is JIT-compiled for the first time, it is optimized for calling random.nextInt(). So the next invocations of Image.process will result in the inline-cache miss followed by a non-optimized virtual call to Shader.apply. Remove an Image.process call from the initialization method and JIT will then inline the useful calls to Shader.apply. After BlurShader.apply is inlined you can help JIT to perform Common subexpression elimination optimization by replacing final int p = s * y + x; with final int p = y * s + x; The latter expression is also met in Image.process, so JIT will not calculate the same expression twice. After applying these two changes I've achieved the ideal benchmark score: Benchmark Mode Samples Mean Mean error Units s.ShaderBench.testProcessInline thrpt 5 36,483 1,255 ops/s s.ShaderBench.testProcessLambda thrpt 5 36,323 0,936 ops/s s.ShaderBench.testProcessProc thrpt 5 36,163 1,421 ops/s
has comment: http://stackoverflow.com/comment/38640928
score: 9
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38647078
downvote count: 0
answers question: http://stackoverflow.com/q/24873010
type: Answer
has comment: http://stackoverflow.com/comment/38663023

http://stackoverflow.com/q/24779375
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24779523
has answer: http://stackoverflow.com/a/24779678
type: UnansweredQuestion
has title: how to do put curl to java by invoking http methods
tagged with: curl
tagged with: java
type: Question
has body: I am wondering how I can write a PUT curl to java to do this for me by invoking HTTP methods, Apache HttpClient. curl -X PUT username:passowrd http://localhost:80/api/cleint_id/include/id I can GET curl easily in java so it shows all the ids and client-is but I stuck with PUT curl to include id to client_id. Any idea or similar work that I can inspire from? Thanks

http://stackoverflow.com/comment/38430277
comment on: http://stackoverflow.com/a/24766925
type: Comment
type: AnswerComment
has text: there might be `name` have trailing spaces as well.
score: 0

http://stackoverflow.com/comment/38608096
comment on: http://stackoverflow.com/a/24860763
score: 0
type: Comment
has text: @DaeSungKim How are you running both cases?
type: AnswerComment

http://stackoverflow.com/comment/38456712
has text: your scripts is just a location wherein you have a script named tomcat-restart.sh
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24781056

http://stackoverflow.com/comment/38563036
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24837265
has text: I've tried your solution and it works perfectly! Thanks!

http://stackoverflow.com/comment/38615112
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24864117
has text: I agree with @GaryWalker, you can create two connections and if you need "once" wrap it at transaction.
score: 0

http://stackoverflow.com/comment/38449760
score: 0
has text: @khmarbaise Please re-read my post, I can't use any repository except the one from my company.
type: Comment
comment on: http://stackoverflow.com/q/24777132
type: QuestionComment

http://stackoverflow.com/comment/38613936
type: QuestionComment
has text: I am happy with supporting one level say a AND b AND (c OR d) AND (e AND f)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24864042

http://stackoverflow.com/comment/38635441
score: 0
type: Comment
type: QuestionComment
has text: FYI to people who want to answer, the `f` function is actually a normal interface method, not a `@functionalInterface`
comment on: http://stackoverflow.com/q/24873010

http://stackoverflow.com/a/73487836
type: Answer
has body: For your new ellipse to be rendered it has to be recognized by namespace. This does currently not happen due to you using: public void crearCirculo() { Element newCircle = svgDoc.createElement("ellipse"); // ... } If you instead change to the following: public void crearCirculo() { Element newCircle = svgDoc.createElementNS("http://www.w3.org/2000/svg", "ellipse"); // ... } Your new ellipsis is rendered with no further changes needed.
answers question: http://stackoverflow.com/q/24901621
score: 0

http://stackoverflow.com/a/24763599
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24749356
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24749356
has body: So, I've found the problem actually. It has to do with the way Java manages memory and the fact that Java is a bunch of garbage in that respect. The reason it works in C# and not in Java is because C# gives access to pointers whereas the closest thing that Java has are the NIO Buffers. In order for OpenGL calls to work, physical pointers must be supplied, but Buffers can supply either physical or virtual based on how they are constructed. In short, replacing "ByteBuffer.allocateDirect" with "BufferUtils.createByteBuffer" fixes the problem. Although, I would rather see Java be fixed instead :P. private void GenerateBatches() { if(glyphs.size() &lt; 1) return; // Create Arrays ByteBuffer bb = BufferUtils.createByteBuffer(6 * glyphs.size() * VertexSpriteBatch.Size); SpriteBatchCall call = new SpriteBatchCall(0, glyphs.get(0).Texture, batches); glyphs.get(0).VTL.AppendToBuffer(bb); glyphs.get(0).VTR.AppendToBuffer(bb); glyphs.get(0).VBL.AppendToBuffer(bb); glyphs.get(0).VBL.AppendToBuffer(bb); glyphs.get(0).VTR.AppendToBuffer(bb); glyphs.get(0).VBR.AppendToBuffer(bb); emptyGlyphs.add(glyphs.get(0)); int gc = glyphs.size(); for(int i = 1; i &lt; gc; i++) { SpriteGlyph glyph = glyphs.get(i); call = call.Append(glyph, batches); glyph.VTL.AppendToBuffer(bb); glyph.VTR.AppendToBuffer(bb); glyph.VBL.AppendToBuffer(bb); glyph.VBL.AppendToBuffer(bb); glyph.VTR.AppendToBuffer(bb); glyph.VBR.AppendToBuffer(bb); emptyGlyphs.add(glyphs.get(i)); } bb.flip(); glyphs = null; // Set The Buffer Data glBindBuffer(BufferTarget.ArrayBuffer, vbo); if(gc &gt; glyphCapacity) { glyphCapacity = gc * 2; glBufferData( BufferTarget.ArrayBuffer, (glyphCapacity * 6) * VertexSpriteBatch.Size, bufUsage ); } glBufferSubData(BufferTarget.ArrayBuffer, 0, bb); GLBuffer.Unbind(BufferTarget.ArrayBuffer); }
type: Answer

http://stackoverflow.com/comment/38653958
comment on: http://stackoverflow.com/a/24885353
type: AnswerComment
has text: Then what do want to base on when sorting the key?
score: 0
type: Comment

http://stackoverflow.com/comment/38596541
comment on: http://stackoverflow.com/a/24853550
has text: I prefer the setter way in terms of performance (exactly as your code) to prevent memory leaks. You use one way or the other.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24860549
has body: run is just a normal method. If you do this: class C { public void m() { while(true) {} } } C c = new C(); c.m(); System.out.println("Hello world"); then the infinite loop runs on the current thread, and "Hello world" never gets printed. This is exactly the same as: class C extends Thread { public void run() { while(true) {} } } C c = new C(); c.run(); System.out.println("Hello world"); start is a "special" method which starts a new thread, and then calls run on the new thread.
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24860483
answers question: http://stackoverflow.com/q/24860483

http://stackoverflow.com/q/24890351
has answer: http://stackoverflow.com/a/24890522
upvote count: 1
tagged with: spring
type: Question
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25521372
has title: @RequestParam annotation
has body: My question may seem to be curious, because I'm newbie in Java. I've read the oracle lesson about annotation in Java. But I have not understood yet how they work on practice. Consider the following spring framework 4.0.1 defined annotation: @Target(value = {ElementType.PARAMETER}) @Retention(value = RetentionPolicy.RUNTIME) @Documented public @interface RequestParam { public String value() default ""; public boolean required() default true; public String defaultValue() default "  "; } The annotation may apply to a function parameter like the following public void change(@RequestParam("id") String id, @RequestParam("cost") String cost, @RequestParam("name") String name, Model model) throws SQLException, UnsupportedEncodingException { //id will have the value of param id, passing inside request //but ***I have no explicitly assignation*** requested parameter //to the function parameter } Who exactly assign requested parameter value to a corresponding function parameter?
has answer: http://stackoverflow.com/a/25521372
downvote count: 0
has answer: http://stackoverflow.com/a/25344300
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/25344300
type: AnsweredQuestion
tagged with: annotations

http://stackoverflow.com/a/24901150
has body: Currently, you are checking if the file has more data, then you attempt to read 15 books, no matter what. Your for-loop goes from 0 to books.length-1, whatever is in the file. Since you don't know (in theory) how many books there are in the file, you need to check fin.hasNext before reading each book. So get rid of your for-loop and replace your reading code with something like this: int i = 0; while (fin.hasNext()) { // read book here and assign to books[i] // increment i for next iteration i++; } The while condition fin.hasNext() will be checked before reading each book. When it returns false, you'll stop looping, and i will be the number of books you read. Note that you're still assuming that each book has all its fields. If there was only half a book in the file, your code would still crash. But that's probably a good thing, since there's not really a way you can recover from that, and presumably you can assume you will receive only well-formed input.
answers question: http://stackoverflow.com/q/24900981
score: 0
type: Answer

morphia
tags question: http://stackoverflow.com/q/24894058
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/24791167
tags question: http://stackoverflow.com/q/24771143

http://stackoverflow.com/comment/38506013
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24806552
type: Comment
has text: Ah. Well, it looks like it's working. Is there a way to have it print out the correct values, like it did before?

http://stackoverflow.com/comment/38633227
has text: This did not show up with an error, but it is still only coding: Welcome to the prime number program! ######################################################## Please enter a positive integer: 2
score: 0
comment on: http://stackoverflow.com/a/24873088
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24889493
has comment: http://stackoverflow.com/comment/55057725
has comment: http://stackoverflow.com/comment/55056547
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/55057471
has comment: http://stackoverflow.com/comment/55056974
has comment: http://stackoverflow.com/comment/55056723
has comment: http://stackoverflow.com/comment/79039123
has comment: http://stackoverflow.com/comment/55057521
has comment: http://stackoverflow.com/comment/55057607
has comment: http://stackoverflow.com/comment/55056340
type: Answer
has comment: http://stackoverflow.com/comment/55057030
has comment: http://stackoverflow.com/comment/55056210
score: 2
has comment: http://stackoverflow.com/comment/55057237
has body: Okay here's the final solution. You need to put the "process-reader to file-writer" code into a separate thread and finally wait for the process object to be finished: // define backup file File fbackup = new File("C:/backup.sql"); // execute mysqldump command String[] command = new String[] {"cmd.exe", "/c", "C:/path/to/mysqldump.exe --quick --lock-tables --user=myuser --password=mypwd mydatabase"}; final Process process = Runtime.getRuntime().exec(command); // write process output line by line to file if(process!=null) { new Thread(new Runnable() { @Override public void run() { try{ try(BufferedReader reader = new BufferedReader(new InputStreamReader(new DataInputStream(process.getInputStream()))); BufferedWriter writer = new BufferedWriter(new FileWriter(fbackup))) { String line; while((line=reader.readLine())!=null) { writer.write(line); writer.newLine(); } } } catch(Exception ex){ // handle or log exception ... } } }).start(); } if(process!=null &amp;&amp; process.waitFor()==0) { // success ... } else { // failed } On Linux you can directly re-direct the output of the command to a file by using ">" as usual... (and also on Mac OS X I think). So no need for the thread. Generally, please avoid white spaces in your path to the mysqldump/mysqldump.exe file!
downvote count: 0
has comment: http://stackoverflow.com/comment/55057224
has comment: http://stackoverflow.com/comment/55057321
answers question: http://stackoverflow.com/q/24887927
has comment: http://stackoverflow.com/comment/55056756
has comment: http://stackoverflow.com/comment/55056293
has comment: http://stackoverflow.com/comment/55057193
has comment: http://stackoverflow.com/comment/55056959
accepted answer of: http://stackoverflow.com/q/24887927

http://stackoverflow.com/q/24854113
answer count: 3
has body: Let's say I have this String String myText="I think that stackoverflow is a very great website"; If i want to divide it in 2 lines i would have something like I think that stackoverflow is a very great website. So the String will be now ("I think that stackoverflow\nis a very great website" If I want it to divide in 3 lines it will be like I think that stackoverflow is a very great website What I've tried was just dividing the text, every line would have total number of words / n (n is the number of lines that i want to divide my text). But this is a bad thing, i would have a result like String myText="I me him is veryverylong wordvery longestwordever thisisevenlonger" And the result would be (if i want to divide it in 2 lines) something like "i you me is\nveryverylong wordvery longestwordever thisisevenlonger" What do you guys suggest for me to try? I've tried the common apache algorithm http://pastebin.com/68zycavf But my output text will be every word separated by \n ..if i use wrap(text,2)..
has answer: http://stackoverflow.com/a/24854182
accepted answer: http://stackoverflow.com/a/24855366
has title: Java - divide a text into n equal lines
tagged with: word-wrap
has answer: http://stackoverflow.com/a/24854722
favorite count: 0
has comment: http://stackoverflow.com/comment/38595506
has comment: http://stackoverflow.com/comment/38596255
upvote count: 2
type: Question
score: 2
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/24855366
downvote count: 0
possible better answer: http://stackoverflow.com/a/24854182

http://stackoverflow.com/a/24816181
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24816170
type: Answer
answers question: http://stackoverflow.com/q/24816170
has body: You want to check current threads's name Thread.currentThread().getName() not T1's name in run() it would always be true regardless of which Thread is executing it
score: 3

http://stackoverflow.com/q/24864579
duplicate of: http://stackoverflow.com/q/23692117
has comment: http://stackoverflow.com/comment/38614798
tagged with: datetime-format
has comment: http://stackoverflow.com/comment/38614847
linked to: http://stackoverflow.com/q/23692117
downvote count: 4
answer count: 3
possible better answer: http://stackoverflow.com/a/24864670
upvote count: 0
favorite count: 0
tagged with: oracle-database
has answer: http://stackoverflow.com/a/24865119
has comment: http://stackoverflow.com/comment/38614854
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24864671
has answer: http://stackoverflow.com/a/24864670
tagged with: java
score: -4
type: Question
tagged with: timestamp
has body: How to change timestamp format to other format? The default is "yyyy-MM-dd hh:mm:ss" and I need 'dd-MON-yyy hh24:mi:ss' (like in Oracle). I searched on this site and I found some answers, but I could not match them to my needs.
has answer: http://stackoverflow.com/a/24864671
has title: In Java: How to change timestamp format to other format?

http://stackoverflow.com/a/24752363
has comment: http://stackoverflow.com/comment/38403274
has body: In the structure-view select the setter and right-click. The popup-menu contains a menu item "Toggle Method Breakpoint" (the same way you can set a break-point in a default-constructor in a class without a default-constructor in it's java-code)
score: 0
answers question: http://stackoverflow.com/q/24751922
type: Answer

http://stackoverflow.com/q/24750576
tagged with: lambda
tagged with: java-8
score: 4
possible better answer: http://stackoverflow.com/a/24750759
has title: Can't refactor methods with underscore as a parameter into lambdas?
has answer: http://stackoverflow.com/a/24750759
has comment: http://stackoverflow.com/comment/38399731
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24751006
tagged with: intellij-idea
upvote count: 4
has body: I have a ton of classes with one method (half of them don't use their parameter and thus name it underscore), and I just switched to Java 8. Now I want to replace them with lambdas. Here is my code: interface I { void stuffHappened(Integer howManyStuff); } public class A { void go() { I i = new I() { public void stuffHappened(Integer _) { System.out.println("woah!!"); } }; } } And after: interface I { void stuffHappened(Integer howManyStuff); } public class A { void go() { I i = _ -&gt; System.out.println("woah!!"); } } As you can see, it is apparently no longer valid, claiming the use of "_" as the parameter name is no longer valid. But then why did it allow this refactor in the first place? And why does it work with anonymous classes, but not lambdas? Is this really a new rule? Or is it some sort of discrepancy in IDEA? I'm using Intellij-IDEA (first time using it), well actually, Android Studio (Beta) 0.8.1 (using retrolambda to permit lambdas on android), which I think uses IDEA.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24751006
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/23523946
type: Question
tagged with: android
duplicate of: http://stackoverflow.com/q/23523946

http://stackoverflow.com/q/24866120
tagged with: java
downvote count: 2
type: Question
tagged with: decode
tagged with: encoding
has title: Decode encoded text with ASCII
has comment: http://stackoverflow.com/comment/38618666
has comment: http://stackoverflow.com/comment/38618315
tagged with: ascii
has comment: http://stackoverflow.com/comment/38618477
answer count: 1
has answer: http://stackoverflow.com/a/24867193
favorite count: 0
score: -1
has body: I'm using below method to encode given text. static long encodeText(String text) { long l = 31; for (int i = 0; i &lt; text.length(); i++) { l = l * 47 + text.getBytes()[i] % 97; } return l; } When i call above method as encodeText("stackoverflow"), return the encoded text 3818417496786881978. Now i want to provide encoded text and get String value. For example, if i give 3818417496786881978 to decodeText(long encoded), i need to get output as stackoverflow. static String decodeText(long encoded) { String str = null; // decode steps here return str; } How can i do this ?
has comment: http://stackoverflow.com/comment/38618448
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38618025
upvote count: 1
has comment: http://stackoverflow.com/comment/38618150
has comment: http://stackoverflow.com/comment/38618319

http://stackoverflow.com/a/29408566
answers question: http://stackoverflow.com/q/24885223
score: 15
has body: How to put it all together example... onClick() handling Cursor - RecyclerView ViewHolder types public class OrderListCursorAdapter extends CursorRecyclerViewAdapter&lt;OrderListCursorAdapter.ViewHolder&gt; { private static final String TAG = OrderListCursorAdapter.class.getSimpleName(); private static final int ID_VIEW_HOLDER_ACTUAL = 0; private static final int ID_VIEW_HOLDER = 1; public OrderListCursorAdapter(Context context, Cursor cursor) { super(context, cursor); } public static class ViewHolderActual extends ViewHolder { private static final String TAG = ViewHolderActual.class.getSimpleName(); protected IViewHolderClick listener; protected Button button; public ViewHolderActual(View v, IViewHolderClick listener) { super(v, listener); this.listener = listener; button = (Button) v.findViewById(R.id.orderList_item_button); button.setOnClickListener(this); } public void initFromData(OrderData data) { Log.d(TAG, "&gt;&lt;initFromData(data=" + data + ")"); orderId = data.getId(); vAddressStart.setText(data.getAddressStart()); vAddressEnd.setText(data.getAddressEnd()); } @Override public void onClick(View view) { if (view instanceof Button) { listener.onButtonClick((Button) view, getPosition(), this); } else { super.onClick(view); } } public interface IViewHolderClick extends ViewHolder.IViewHolderClick { public void onButtonClick(Button button, int position, ViewHolder viewHolder); } } public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private static final String TAG = ViewHolder.class.getSimpleName(); protected long orderId; protected IViewHolderClick listener; protected TextView vAddressStart; protected TextView vAddressEnd; protected TextView vStatus; public ViewHolder(View v, IViewHolderClick listener) { super(v); this.listener = listener; v.setOnClickListener(this); vAddressStart = (TextView) v.findViewById(R.id.addressStart); vAddressEnd = (TextView) v.findViewById(R.id.addressEnd); vStatus = (TextView) v.findView…
type: Answer
upvote count: 15
downvote count: 0

http://stackoverflow.com/q/24783743
has comment: http://stackoverflow.com/comment/38462424
has comment: http://stackoverflow.com/comment/38493930
has comment: http://stackoverflow.com/comment/38592878
type: UnansweredQuestion
has title: Eclipse Android - App crashing when starting
has comment: http://stackoverflow.com/comment/38494026
tagged with: logcat
has comment: http://stackoverflow.com/comment/38491163
has comment: http://stackoverflow.com/comment/38491000
has body: I just started learning Andriod app development, especially games with eclipse. I recently finished (prematurely) my project, and as soon as i try to run it on my samsung galaxy s4 the app crashes on the phone, saying it stopped. I would be grateful for any help. In the following u will see my LogCat and my Manifest.xml. Thank you. : this is my LogCat: 07-16 16:12:17.565: E/AndroidRuntime(28886): FATAL EXCEPTION: main 07-16 16:12:17.565: E/AndroidRuntime(28886): Process: com.matinshah.fighter, PID: 28886 07-16 16:12:17.565: E/AndroidRuntime(28886): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.matinshah.fighter/com.matinshah.fighter.Start}: java.lang.ClassNotFoundException: Didn't find class "com.matinshah.fighter.Start" on path: DexPathList[[zip file "/data/app/com.matinshah.fighter-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.matinshah.fighter-1, /vendor/lib, /system/lib]] 07-16 16:12:17.565: E/AndroidRuntime(28886): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231) 07-16 16:12:17.565: E/AndroidRuntime(28886): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363) 07-16 16:12:17.565: E/AndroidRuntime(28886): at android.app.ActivityThread.access$900(ActivityThread.java:161) 07-16 16:12:17.565: E/AndroidRuntime(28886): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265) 07-16 16:12:17.565: E/AndroidRuntime(28886): at android.os.Handler.dispatchMessage(Handler.java:102) 07-16 16:12:17.565: E/AndroidRuntime(28886): at android.os.Looper.loop(Looper.java:157) 07-16 16:12:17.565: E/AndroidRuntime(28886): at android.app.ActivityThread.main(ActivityThread.java:5356) 07-16 16:12:17.565: E/AndroidRuntime(28886): at java.lang.reflect.Method.invokeNative(Native Method) 07-16 16:12:17.565: E/AndroidRuntime(28886): at java.lang.reflect.Method.invoke(Method.java:515) 07-16 16:12:17.565: E/AndroidRuntime(28886): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Z…
tagged with: java
has answer: http://stackoverflow.com/a/24783885
type: Question
tagged with: crash
has comment: http://stackoverflow.com/comment/38491092
has comment: http://stackoverflow.com/comment/38494582
has comment: http://stackoverflow.com/comment/38490432
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/38462411
tagged with: android
has comment: http://stackoverflow.com/comment/38490067
has comment: http://stackoverflow.com/comment/38587855
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/24773592
tagged with: easymock
has comment: http://stackoverflow.com/comment/38442912
has body: I have created EasyMock test cases for one method which has method.invoke().One test case runs fine with this code.The second one which should cover the first "if" condition creates this IlegalArguent Exception:Wrong number of arguments.I don't understand which one is incorrect.whether original code or test case. Please help. Original code: @RequestMapping(value = "/invoke/{service}/{method}", method = RequestMethod.POST) public @ResponseBody Object invokeService(@PathVariable("service") String className, @PathVariable("method") String method, @RequestParam("ms") String signature, @RequestParam("r") String responseType, @RequestBody String[] body) throws Exception { if (applicationContext != null &amp;&amp; applicationContext.containsBean(className)) { Object obj = applicationContext.getBean(className); String temp[] = signature.split(","); Object[] arguments = new Object[temp.length]; Class[] parameterTypes = new Class[temp.length]; for (int i = 0; i &lt; temp.length; i++) { if(temp[i] != null &amp;&amp; !temp[i].isEmpty()) { Class cls = Class.forName(temp[i]); parameterTypes[i] = cls; if (temp[i].startsWith("java.lang.")) { arguments[i] = body[i]; } else { try { arguments[i] = mapper.readValue(body[i], cls); } catch (Exception e) { // e.printStackTrace(); arguments[i] = body[i]; } } } } Method m = null; if(null !=signature &amp;&amp; !signature.isEmpty()) { m = obj.getClass().getMethod(method, parameterTypes); } else { m = obj.getClass().getMethod(method); } Object response = m.invoke(obj); return response; } else { throw new Exception("ApplicationContext not properly set"); } } Test1(success): @Test public void testInvokeServiceNotJavaLang() throws Exception{ Object obj = new Object(); String[] body ={ "body" }; EasyMock.expect(applicationContext.containsBean("String")).andReturn(true); EasyMock.expect(applicationContext.getBean("String")).andReturn(obj); EasyMock.replay(applicationContext); moduleInvocation.invokeService("String", "toString","", "responseType",b…
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24774469
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38444321
has comment: http://stackoverflow.com/comment/38443812
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24774469
has comment: http://stackoverflow.com/comment/38442766
has title: method.invoke generates IllegalArgumentException:wrong number of arguments

http://stackoverflow.com/q/24872855
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38631150
has comment: http://stackoverflow.com/comment/38632488
answer count: 0
type: Question
tagged with: http://stackoverflow.com/tag/html
has title: How to not include the text of a child when writing a CSS expression
tagged with: css
has comment: http://stackoverflow.com/comment/38631076
score: 0
has comment: http://stackoverflow.com/comment/38755434
tagged with: selenium
has comment: http://stackoverflow.com/comment/38631081
has body: Here is the HTML for an element on my page. This element has text listing the user name, followed by a logout link User: Automation User of Awesomeness Logout I want to find a CSS expression that will only include the text "User: Automation User of Awesomeness" If I use the below expression, it includes the text I want, along with the text of the child; "User: Automation User of Awesomeness Logout" div.NavUserText Is there a way to edit the CSS expression so the text "Logout" is excluded? I'm not familiar with the negation pseudo-class, but I tried the below CSS expression, which did not work. It returned no text instead of excluding Logout. div.NavUserText :not(.LogoutText) ---------- Attional Information Added --------------- The HTML listed will select this entire element. I am using Java and Selenium for element verification. Logout is a link, and I can use the below CSS. This will allow me to only select the link, so I can click it, and verify that it says "Logout" a.LogoutText In my program, the text User: Automation User of Awesomeness" will change for each user that I log in with. What I want to do is create an object using CSS that will only select/return this text. Is there a way to do this? I can't seem to get the user text separated from the logout text. The CSS I use will return "User: Automation User of Awesomeness Logout" instead of only "User: Automation User of Awesomeness".
has comment: http://stackoverflow.com/comment/38631371
tagged with: java

http://stackoverflow.com/q/24855711
has body: I want to create a 2D array [3][3] ; each element should be a 3x3 character array How can I accomplish this in java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24855768
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24855757
has answer: http://stackoverflow.com/a/24855735
tagged with: arrays
has title: How can I create a 2D array of 2D char arrays?
score: 0
tagged with: multidimensional-array
answer count: 3

http://stackoverflow.com/comment/38530255
has text: It seems to me that FindBugs is not clever enough in this case to properly deal with the lazy evaluation of the boolean expression. You might want to try nested `if` statements. The outer statement would check that `registrationDate` is not `null`, and the inner statement performs the `equals()` check.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24806178

android-cursoradapter
type: Tag
tags question: http://stackoverflow.com/q/24780497
tag name: android-cursoradapter

http://stackoverflow.com/q/24830318
answer count: 1
has answer: http://stackoverflow.com/a/24830434
tagged with: jsp
has title: How send the value of a dropdownlist item in servlet
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24830434
tagged with: java
linked to: http://stackoverflow.com/q/8053095
has comment: http://stackoverflow.com/comment/38549906
has body: I want to show the book details of various type(math,phy,chem) from database to webpage. When I select a particular item from dropdowlist its corresponding book will be shown in webpage. My jsp page looks like : <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %> Untitled Document Science Book Math Physics Chemistry Here Controller is the servlet name. My servlet is look like : package com.sayan.myservlet; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Controller extends HttpServlet { private static final long serialVersionUID = 1L; public Controller() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doProcess(request,response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doProcess(request,response); } protected void doProcess(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String booktype=null; //set drowdownlist item value PrintWriter out = response.getWriter(); String drivername = "oracle.jdbc.OracleDriver"; String url = "jdbc:oracle:thin:@172.16.0.30:1521:orcl"; String username = "scott"; String password = "tiger"; Connection con = null; Statement st = null; ResultSet rs = null; try{ Class.forName(drivername); con = DriverManager.getConnection(url,username,password); st = con.createStatement(); String sql = "select name,author,publisher,price from book where type="+booktype; System.out.println(sql); rs = st.executeQuery(sql); out.println(" "); out.println(" name "); out.println(" a…
type: Question
tagged with: jakarta-ee
tagged with: servlets
score: 0

http://stackoverflow.com/a/24819948
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24819922
has body: change your format to yyyy-MM-dd The year must be lowercase y rather than uppercase. If you see the documentation of SimpleDateFormat Yis the Week year. y is the field Year
has comment: http://stackoverflow.com/comment/38530450
type: Answer
has comment: http://stackoverflow.com/comment/38530240
has comment: http://stackoverflow.com/comment/38530245
upvote count: 1
downvote count: 1
score: 0
accepted answer of: http://stackoverflow.com/q/24819922

http://stackoverflow.com/a/24854210
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/38595398
has comment: http://stackoverflow.com/comment/38595423
has comment: http://stackoverflow.com/comment/38595706
answers question: http://stackoverflow.com/q/24854126
downvote count: 0
has body: Alright, I will give you some example code for making a multiple tabs with Swing import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JButton; public class GUI extends JFrame { private JTabbedPane tabManager = new JTabbedPane(JTabbedPane.TOP); // This will manage the tabs // Some GUI code... public void addTab(String name, JPanel panel) { // Takes in a name for the tab and // a panel for the tab to display when clicked getContentPane().add(tabManager); tabManager.addTab(name, null, panel, name); // The first name is the name of // the tab and second one is what // is display in the little popup // thing when you hover the mouse // over the tab } public void removeTab(int index) { // Removes a tab at the index tabManager.removeTabAt(index); } // Some more GUI code... public static void main(String[] args) { // In main method or anywhere else GUI gui = new GUI(/*constructorParams*/); JPanel panel = new JPanel(); panel.add(new JButton("This is a button!")); gui.addTab("This is a tab!", panel); // Adds a tab with the name // "This is a tab!" and the panel to display "panel" } } See this link for more details about the JTabbedPane
has comment: http://stackoverflow.com/comment/38595515

http://stackoverflow.com/a/24796947
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24791167
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24791167
has body: There is no way currently to configure morphia like that. Morphia uses the field name by default so you could name your java fields that way and morphia would pick them up but then you'd be violating the standard Java conventions.
type: Answer

http://stackoverflow.com/comment/38450221
comment on: http://stackoverflow.com/q/24777650
type: Comment
type: QuestionComment
score: 1
has text: Do your log files show anything?

http://stackoverflow.com/comment/38512104
has text: Great. Thanks for confirmation.
type: Comment
comment on: http://stackoverflow.com/a/24810141
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38440372
comment on: http://stackoverflow.com/a/24755908
score: 0
type: AnswerComment
has text: Can you give an example? I need to know field metadata at runtime like what is the data type of a particular field, maxSize, ReadOnly etc stuff set in code. Assume that we have a TextField, say 't1', which will show "Integer"'s value. So how to define its metadata to specify that 't1' has dataType Integer and readOnly ==true ? –
type: Comment

http://stackoverflow.com/a/62809369
type: Answer
answers question: http://stackoverflow.com/q/24892637
score: 2
upvote count: 2
has body: A hacky solution working with Maven 3 would be to use the Maven Dependency Plugin in combination with the Maven Help Plugin to resolve the local repository path: # Download JAR from Maven repo mvn dependency:get -DremoteRepositories=http://repo1.maven.org/maven2/ \ -DgroupId=some.group.id \ -DartifactId=some-artifact-cli \ -Dversion=1.0.0 \ -Dtransitive=false # Resolve local repository path MVN_REPO=$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout) # Execute JAR from the local repository java -jar $MVN_REPO/some/group/id/some-artifact-cli/1.0.0/some-artifact-cli-1.0.0.jar
downvote count: 0

http://stackoverflow.com/a/24808584
has comment: http://stackoverflow.com/comment/38536333
accepted answer of: http://stackoverflow.com/q/24802171
type: Answer
answers question: http://stackoverflow.com/q/24802171
score: 2
has body: Here is how you can tweak your Job class in Swift so it behave as enum in Java: class Job { class Store: Equatable { let salary: Int @private init(_ salary:Int) { // hope Swift will have private accessors one day self.salary = salary } func atack() ->() {} } class var NINJA: Store { class Ninja: Store { override func atack() ->() { println("Attack with shuriken.") } } return Ninja(3000000) } class var SAMURAY: Store { class Samuray: Store { override func atack() ->() { println("Attack with sword.") } } return Samuray(4000000) } class func CUSTOM(salary: Int) -> Store { return Store(salary) } } func == (lhs: Job.Store, rhs: Job.Store) -> Bool { return lhs.salary == rhs.salary } Usage examples: var ninja = Job.NINJA var samuray = Job.SAMURAY var custom = Job.CUSTOM(23) if (ninja == samuray) { println("Impossible") } else { println("OK") } if (ninja == Job.NINJA) { println("Ninja salary: \(ninja.salary)") } else { println("Impossible") } println("Object salary: \(Job.SAMURAY.salary)") samuray.atack() Output in playground: OK Ninja salary: 3000000 Object salary: 4000000 Attack with sword. BTW: Should you need to compare salary values you can implement Comparable interface in Store class. Useful for sorting.
has comment: http://stackoverflow.com/comment/38563029
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/132282699
type: AcceptedAnswer

http://stackoverflow.com/comment/38663137
has text: _Java doesn't care the system timezone_ True because Java is platform independent. ;)
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24889957

http://stackoverflow.com/a/24826489
accepted answer of: http://stackoverflow.com/q/24825100
answers question: http://stackoverflow.com/q/24825100
has body: Although this kind of question is obviously opinionated, I will tell you why I think that this is a design flaw. (Actually, I provoked this question, so maybe I should answer.) A Runnable is an object holding the code that will (or should) be executed within a thread. The documentation explains it this way: The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The main idea behind the Runnable interface is to separate the executable code from the means of executing it. There are several possibilities of running such code in an own thread. One of those possibilities is the Thread class. From its documentation: There are two ways to create a new thread of execution. One is to declare a class to be a subclass of Thread. This subclass should override the run method of class Thread. An instance of the subclass can then be allocated and started. [...] The other way to create a thread is to declare a class that implements the Runnable interface. That class then implements the run method. An instance of the class can then be allocated, passed as an argument when creating Thread, and started. In my opinion, you always should do the latter. Define implementations of the Runnable interface, pass instances of them to the constructor of a Thread, then start the thread. Example: class MyRunnable implements Runnable { ... } void runMyCodeInOwnThread() { Runnable runnable = new MyRunnable(); Thread thread = new Thread(runnable); thread.start(); } The other way of executing a Runnable in a thread is an Executor, although you most likely will use an ExecutorService (actually a subtype of Executor). The utility class Executors will most likely be used for retrieving an executor service. Example: class MyRunnable implements Runnable { ... } void runMyCodeInOwnThread() { Runnable runnable = new MyRunnable(); ExecutorService executor = Executors.newSingleThreadExecutor(); Future&lt;?&gt; future = executor.submit(runnable); // o…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38543813
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/24759480
type: Answer
score: 2
has body: It's a syntax thing. { and } can exist on themselves as literal, and so does ] when it's alone. An unclosed [ however, is syntax error.
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24759421

http://stackoverflow.com/comment/51244012
score: 0
type: AnswerComment
has text: For HttpClient 3.x instead of `SSLConnectionSocketFactory(sslContext,SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)` use `org.jsslutils.extra.apachehttpclient.SslContextedSecureProtocolSocketFactory(sslContext, false)`
type: Comment
comment on: http://stackoverflow.com/a/24879462

http://stackoverflow.com/comment/38609644
type: QuestionComment
comment on: http://stackoverflow.com/q/24860874
has text: Throttling can be done better by setting priortity levels properly. If the question is whether `Sleep()` makes sense, the answer is almost always "No". Same for `TerminateThread()` and for `Suspend/ResumeThread()` pairs.
score: 0
type: Comment

http://stackoverflow.com/comment/38698713
comment on: http://stackoverflow.com/q/24907914
score: 0
type: Comment
type: QuestionComment
has text: `LayoutInflater layoutInflater = LayoutInflater.from(context);` `ViewGroup layout = layoutInflater.inflate(R.layout.your_tab_layout, null);` `Button button = (Button) layout.findViewById(R.id.button1)`

http://stackoverflow.com/comment/38677032
comment on: http://stackoverflow.com/a/24897292
score: 0
type: Comment
has text: Dang I have no idea how I had the concepts mixed up
type: AnswerComment

http://stackoverflow.com/q/24766572
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/24766695
has comment: http://stackoverflow.com/comment/38429632
type: Question
has comment: http://stackoverflow.com/comment/38429598
has answer: http://stackoverflow.com/a/24766735
has comment: http://stackoverflow.com/comment/38533534
has title: Java is outputting the wrong value for a Math.tan() calculation
tagged with: java
tagged with: radians
has answer: http://stackoverflow.com/a/24766629
has body: Here is the code from both classes, the user has to input the value for two angles and a length for part of a triangle. I understand Java uses radians, but even with a simple conversion either using Math.toDegrees or * 180/Math.Pi it still gets the wrong answer. For example when the angle 30 is entered, 100 * tan(30) degrees should give 57.1, however I get 44.92.... The Code: /**Class to implement math methods, and math import * */ /** * @author Oli * */ public class Balloon { //Attributes private int angle1; private int angle2; private double distance1; private int time; private double h2; //Consttructor public Balloon (int ang1, int ang2, double dist1, int t1){ angle1 = ang1; angle2 = ang2; distance1 = dist1; time = t1; } //Methods to calculate angles, distances and time public double height1(){ double h1; h1 = distance1 * (Math.tan(angle1*180/Math.PI)); return h1; } public double height2(){ double h2; h2 = distance1 * (Math.tan(angle2))-(Math.tan(angle1)); return h2; } public double speed(){ double sp1; sp1 = h2/time; return sp1; } public double BalloonDistance(){ double BD1; BD1 = distance1 / (Math.cos(angle2)); return BD1; } }
answer count: 6
has answer: http://stackoverflow.com/a/24766631
favorite count: 0
has comment: http://stackoverflow.com/comment/38429747
has answer: http://stackoverflow.com/a/24766702
downvote count: 3
tagged with: trigonometry
has answer: http://stackoverflow.com/a/24766828
tagged with: degrees
upvote count: 0

http://stackoverflow.com/comment/38490334
comment on: http://stackoverflow.com/q/24764745
type: QuestionComment
has text: @Christian St. Yes, error is at line `execute`. I have reviewed my question and I have added the full stack trace.
score: 0
type: Comment

tabs
type: Tag
tags question: http://stackoverflow.com/q/24820769
tags question: http://stackoverflow.com/q/24807910
tag name: tabs
tags question: http://stackoverflow.com/q/24907914

http://stackoverflow.com/comment/38472054
has text: @gudthing An enum is an enumeration of contants. This allows you to allow only a predefined number of values for the `GameState`, as opposed to using an `int` or `String`, which allows other programmers to specify all kind of values, even those you do not support. Please read this [article](http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html) on the enum data type for more details.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24788698

cdi
tags question: http://stackoverflow.com/q/24750967
tags question: http://stackoverflow.com/q/24775815
tags question: http://stackoverflow.com/q/24785991
type: Tag
tag name: cdi
tags question: http://stackoverflow.com/q/24869667
tags question: http://stackoverflow.com/q/24842538
tags question: http://stackoverflow.com/q/24798529
tags question: http://stackoverflow.com/q/24862927

http://stackoverflow.com/comment/38571250
has text: @herman What would be the size of the array `String[][] x` be? It would have 8 elements for the groups of words, but groups have different size? (some are 3, some are 1). Unless you explicitly know the maximum size of the group of words (in that example, it's 3 max for `Oh My God`), it doesn't seem to be possible. Even if so, it would be inefficient.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24841484

http://stackoverflow.com/comment/38490499
has text: This is the pattern..1,2,3,5,6,7,8,10 and the pattern continues
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24794961

http://stackoverflow.com/a/24800828
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24800298
has comment: http://stackoverflow.com/comment/38494744
answers question: http://stackoverflow.com/q/24800298
has comment: http://stackoverflow.com/comment/38494719
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: In an Eclipse plugin you can get information about the product using: IProduct product = Platform.getProduct(); The about dialog text is obtained with: String aboutText = product.getProperty(IProductConstants.ABOUT_TEXT); I don't think there is anything that just gives you the Eclipse version (4.4) or name (Luna). Often it is better to check the version of a particular plugin, for example: Bundle bundle = Platform.getBundle("org.eclipse.platform"); Version version = bundle.getVersion(); if (version.getMajor() == 4 &amp;&amp; version.getMinor() == 4) { ... version 4.4 }

http://stackoverflow.com/a/24825419
has body: If you have the Class object or an instance of the class, you can access any of its fields like this: String property = "lastName"; Field field = targetObject.getClass().getDeclaredField(property); field.setAccessible(true); //overrides private field.set(targetObject, value); But you can also get ALL fields using the http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getDeclaredFields() method to receive an Array of its fields. Although I somewhat wonder if you can't just use the Bean Validation API and configure it using Annotations.
answers question: http://stackoverflow.com/q/24825218
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38615961

http://stackoverflow.com/comment/75147954
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/42001588
has text: Sir i have tried your library but facing issue with maven?
score: 0

http://stackoverflow.com/q/24789272
tagged with: algorithm
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38473052
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24789492
type: Question
has title: MinMax algorithm not working properly
tagged with: artificial-intelligence
tagged with: chess
has body: I am working on a chess engine and now trying to implement Minimax algorithm. At the moment I have put together a mimimax code but it's not really working properly. I beat the engine within minutes given that I'm not a good chess player. I would like someone to kindly look into my minimax code and tell me what I've written correctly. Thanks in advance. Here is my code: private int MiniMax(Game game, int depth){ return Max(depth); } private int Max(int depth){ if (depth &lt;= 0 || this.chessgame.getGameState() == Game.GAME_STATE_END_YELLOW_WON || this.chessgame.getGameState() == Game.GAME_STATE_END_BROWN_WON){ return EvaluatePieceScore(); } int max = -Integer.MIN_VALUE; List&lt;Move&gt; moves = generateMoves(false); for(Move allMove : moves){ executeMove(allMove); int score = -Mini(depth - 1); undoMove(allMove); if( score &gt; max){ max = score; } } return max; } private int Mini(int depth) { if (depth &lt;= 0 || this.chessgame.getGameState() == Game.GAME_STATE_END_YELLOW_WON || this.chessgame.getGameState() == Game.GAME_STATE_END_BROWN_WON){ return EvaluatePieceScore(); } int min = Integer.MIN_VALUE; List&lt;Move&gt; moves = generateMoves(false); for(Move allMove : moves){ executeMove(allMove); int score = -Max(depth - 1); undoMove(allMove); if( score &gt; min){ min = score; } } return min; }
has comment: http://stackoverflow.com/comment/38473241
has comment: http://stackoverflow.com/comment/38473340
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/38680344
has text: what is expected outcome here? If I know, I may post some ideas later
comment on: http://stackoverflow.com/q/24899052
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/29485907
score: 0
type: Answer
has body: Enter the command as slight different as setup.exe -jreloc C:\Program Files\Java\jdk1.7.0_67\jre
answers question: http://stackoverflow.com/q/24848918

http://stackoverflow.com/comment/38590029
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24851348
type: Comment
has text: You should use `SQLdbhelper`, it's what it is for.

http://stackoverflow.com/q/24768101
has body: I am using spring &amp; jersey2 to serve some rest-requests like: @GET @Path("/someservice") @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") public String getSomeStuff(...) { login(...); // ... } During a rest-request, I get an authorized user of the rest-request. Now I need this user while updating or creating entities like: @MappedSuperclass public abstract class PersistentObject { @PrePersist @PreUpdate public void onSaveOrUpdate() { setCreationUser(...); // How to get the user of this session? } // ... } How can I get the current user of the rest-request there?
score: 0
has comment: http://stackoverflow.com/comment/38466720
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38434101
tagged with: spring
type: Question
has title: Add user to session and get it in an entity using spring
tagged with: java
has answer: http://stackoverflow.com/a/24786757
answer count: 2
has answer: http://stackoverflow.com/a/24779609
tagged with: jersey-2.0

http://stackoverflow.com/q/24785134
has answer: http://stackoverflow.com/a/24785703
type: UnansweredQuestion
has body: I have created a framework in IntellijIdea for some simple functionality like Google Search, Gmail Registration and Gmail Login. I tried to run my script on IE, chrome and firefox separately. It is working fine. Now I want to run the script on all above browsers parallel y. Can anyone help me to write a piece of code for the same??? Thanks in advance.
tagged with: selenium-webdriver
tagged with: java
type: Question
tagged with: junit4
tagged with: intellij-idea
score: 0
answer count: 1
has title: How to run webdriver script on firefox, chrome and IE parallaly in IntellijIdea

http://stackoverflow.com/comment/40844858
has text: This has been resolved for Java8u40, see the similar question: [JavaFX MediaPlayer in Ubuntu 14.04 64 bits](http://stackoverflow.com/questions/26068631/javafx-mediaplayer-in-ubuntu-14-04-64-bits)
score: 1
comment on: http://stackoverflow.com/q/24848752
type: QuestionComment
type: Comment

nosuchmethoderror
type: Tag
tag name: nosuchmethoderror
tags question: http://stackoverflow.com/q/24760316

http://stackoverflow.com/comment/38616055
type: Comment
type: QuestionComment
has text: And when - you think - does filtering apply?
comment on: http://stackoverflow.com/q/24864777
score: 0

http://stackoverflow.com/q/24854100
answer count: 2
has comment: http://stackoverflow.com/comment/38595135
upvote count: 1
has comment: http://stackoverflow.com/comment/38595105
score: 0
has body: I am trying to read from xml file but I get a null pointer exception. this is the xml file: <missile id="M1" destination="Sderot" launchTime="2" flyTime="12" damage="1500"/> <missile id="M2" destination="Beer-Sheva" launchTime="5" flyTime="7" damage="2000"/> <missile id="M3" destination="Ofakim" launchTime="4" flyTime="3" damage="5000"/> <missile id="M4" destination="Beer-Sheva" launchTime="9" flyTime="7" damage="1000"/> <destructdMissile id="M1" destructAfterLaunch="4"/> <destructdMissile id="M3" destructAfterLaunch="7" /> <destructdMissile id="M4" destructAfterLaunch="2"/> <destructdMissile id="M2" destructAfterLaunch="3"/> <missileLauncherDestructors > <destructedLanucher id="L101" destructTime="4"/> <destructedLanucher id="L102" destructTime="8" /> <destructedLanucher id="L102" destructTime="12"/> </missileLauncherDestructors> and this is the code: public class XmlReader { File fXmlFile=null; DocumentBuilderFactory dbFactory=null; DocumentBuilder dBuilder=null; Document doc=null; public XmlReader(String filePath) throws ClassNotFoundException { if(filePath!=null) { this.fXmlFile = new File(filePath); dbFactory = DocumentBuilderFactory.newInstance(); try { dBuilder = dbFactory.newDocumentBuilder(); } catch (ParserConfigurationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); } catch (SAXException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else System.out.println("Xml file not found"); } //gets value by tag name private static String getTagValue(String tag, Element element) { if(element.hasChildNodes()) { NodeList nodeList = element.getElementsByTagName(tag).item(0).getChildNodes(); Node node = (Node) nodeList.item(0); if(node==null) return null; return node.getNodeValue(); } else return element.getNodeValue(); } //launcher public List readLauncher() throws Exception { List launcherList = new ArrayList (); try { NodeList nList = …
has answer: http://stackoverflow.com/a/24854162
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24854303
accepted answer: http://stackoverflow.com/a/24854303
has title: nullpointerexception while trying to read from xml file with dom parser
downvote count: 1
has comment: http://stackoverflow.com/comment/38595162
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38595150
tagged with: java
possible better answer: http://stackoverflow.com/a/24854162
tagged with: dom
type: Question
has comment: http://stackoverflow.com/comment/38595084
has comment: http://stackoverflow.com/comment/38594956

http://stackoverflow.com/comment/38561861
comment on: http://stackoverflow.com/a/24836692
type: Comment
has text: it's formatted weird but try it let us know if that's what you wanted
type: AnswerComment
score: 0

http://stackoverflow.com/a/24789041
upvote count: 1
downvote count: 0
has body: String In Standard Format, ISO 8601 If you want to return the date information as text, use the Joda-Time library or the new java.time package in Java 8 to convert a date-time value into a String using the format defined by the ISO 8601 standard. Those two libraries use ISO 8601 format by default. Such as 2014-07-13T18:02:49+05:30: String output = DateTime.now().toString(); // YYYY-MM-DDTHH:MM:SS.SSS+-00:00:00 format. But it is best to specify a desired time zone rather than rely implicitly on the JVM's default time zone. DateTimeZone timeZone = DateTimeZone.forID( "America/Montreal" ); String output = DateTime.now( timeZone ).toString(); If you want just year, month, and date only, then use an alternate formatter rather than the default one. The following code produces a string like 2014-07-13. DateTimeZone timeZone = DateTimeZone.forID( "America/Montreal" ); DateTime now = DateTime.now( timeZone ); DateTimeFormatter formatter = ISODateTimeFormat.date(); // YYYY-MM-DD formatter. String output = formatter.print( now ); Pass DateTime Object If instead of a string, you want the number values communicated to another object, then just pass the Joda-Time DateTime object. The receiving object can call methods on the DateTime such as getYear, getMonthOfYear, and getDayOfMonth. As a bonus, the receiving object will have additional information in its hands such as time zone. The other answers are correct for the general case: Create a class or use a Collection to communicate multiple values as Java can return only a single item from a method. But in the specific case of date-time values, it seems silly to invent a class when we already have such classes at our disposal. Avoid java.Util.Date and .Calendar The java.util.Date and .Calendar classes are notoriously troublesome. Avoid them. Using Joda-Time as a replacement is quite common. The new java.time package in Java 8 is another replacement, and was inspired by Joda-Time. LocalDate Class Both Joda-Time and java.time offer a…
type: Answer
answers question: http://stackoverflow.com/q/24788435
score: 1

http://stackoverflow.com/a/26757661
has body: This is a minimal working example that demonstrates the usage of OpenNLP Maxent API. It includes the following: Training a maxent model from data stored in a file. Storing the trained model into a file. Loading the trained model from a file. Using the model for classification. NOTE: the outcome is the first element in each training sample NOTE: the values can be arbitrary strings, e.g. xyz=s0methIng import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; import opennlp.maxent.GIS; import opennlp.maxent.io.GISModelReader; import opennlp.maxent.io.SuffixSensitiveGISModelWriter; import opennlp.model.AbstractModel; import opennlp.model.AbstractModelWriter; import opennlp.model.DataIndexer; import opennlp.model.DataReader; import opennlp.model.FileEventStream; import opennlp.model.MaxentModel; import opennlp.model.OnePassDataIndexer; import opennlp.model.PlainTextFileDataReader; ... String trainingFileName = "training-file.txt"; String modelFileName = "trained-model.maxent.gz"; // Training a model from data stored in a file. // The training file contains one training sample per line. // Outcome (result) is the first element on each line. // Example: // result=1 a=1 b=1 // result=0 a=0 b=1 // ... DataIndexer indexer = new OnePassDataIndexer( new FileEventStream(trainingFileName)); MaxentModel trainedMaxentModel = GIS.trainModel(100, indexer); // 100 iterations // Storing the trained model into a file for later use (gzipped) File outFile = new File(modelFileName); AbstractModelWriter writer = new SuffixSensitiveGISModelWriter((AbstractModel) trainedMaxentModel, outFile); writer.persist(); // Loading the gzipped model from a file FileInputStream inputStream = new FileInputStream(modelFileName); InputStream decodedInputStream = new GZIPInputStream(inputStream); DataReader modelReader = new PlainTextFileDataReader(decodedInputStream); MaxentModel loadedMaxentModel = new GISModelReader(m…
has comment: http://stackoverflow.com/comment/77195267
answers question: http://stackoverflow.com/q/24897358
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/77267221
downvote count: 0
has comment: http://stackoverflow.com/comment/59943940
has comment: http://stackoverflow.com/comment/77247160
has comment: http://stackoverflow.com/comment/59999414

http://stackoverflow.com/a/24793865
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24793593
type: AcceptedAnswer
type: Answer
has body: Native performance rendering in Java... games would be the first thing to come to mind but really drawing anything that would be computationally intensive or that requires a high frame-rate would benefit. Official Java Explanation: The ability to draw directly into a Java Canvas from a native code library is extremely useful for developers planning to migrate a legacy software system to Java, especially one that includes a high-performance rendering engine. It makes it much easier to migrate in stages, leaving performance-sensitive rendering code alone, while other less-sensitive portions of code are converted to Java. The result can be a modern Java-centric application, providing the benefit of portability and development efficiency, but one that does not sacrifice an investment in performance of a key piece of native code.
answers question: http://stackoverflow.com/q/24793593
score: 5

http://stackoverflow.com/q/24827194
tagged with: maven-3
has title: Maven enforcer plugin missing or invalid rules
has comment: http://stackoverflow.com/comment/92988617
has answer: http://stackoverflow.com/a/24827613
tagged with: maven-enforcer-plugin
answer count: 3
downvote count: 0
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/107643026
has comment: http://stackoverflow.com/comment/94861715
favorite count: 0
score: 29
tagged with: maven
upvote count: 29
accepted answer: http://stackoverflow.com/a/24827613
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/60723056
has body: I am trying to setup the enforcer plugin for maven to enforce a minimum Java version. However, whenever I try to run mvn enforcer:enforce, I get: The parameters 'rules' for goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce are missing or invalid Here is the relevant portion of my pom file: org.apache.maven.plugins maven-enforcer-plugin 1.3.1 enforce-java validate enforce (1.7.0-20,) I also tried replacing the block with <alwaysPass/>, in case something was invalid, but it still failed with the same error.
linked to: http://stackoverflow.com/q/6754974
has answer: http://stackoverflow.com/a/60723056
tagged with: java
has comment: http://stackoverflow.com/comment/121096029
type: Question
has answer: http://stackoverflow.com/a/63286174

http://stackoverflow.com/comment/38644970
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24880039
type: AnswerComment
has text: Oh I see now, by directing the instance to the subclass, it is still including the superclass in that instance since it is inherently included in the subclass. That's where I was messing up at. Thanks so much Jon! I really appreciate it!

http://stackoverflow.com/a/24891433
accepted answer of: http://stackoverflow.com/q/24891390
score: 4
answers question: http://stackoverflow.com/q/24891390
has body: You either need to keep a separate ArrayList of C1 and C2 instances, or you have to cast them to their respective types to use the methods of the subtypes. Something like: A.get(x).method_of_C0(); ((C1)A.get(0)).method_of_C1(); ((C2)A.get(1)).method_of_C2(); You might also use the instanceof keyword to check that an element is actually an instance of a particular subtype before you do the casting, otherwise you'll get a ClassCastException. But note that this has a pretty bad code smell, so keeping track of each subtype as you need them is probably the way to go.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24789602
has comment: http://stackoverflow.com/comment/38474746
score: 0
answers question: http://stackoverflow.com/q/24789504
has body: org.springframework.http.converter.json.MappingJackson2HttpMessageConverter is a class provided by spring used to map json objects into pojo's (plain old java objects). This issue does not sound like it is related to your database. Either you are missing some dependencies or configuration for jackson, or something in your code is getting stuck prior to persisting the data to the database. Try using your IDE to step-by-step debug through the code as it runs, you may have an infinite loop.
type: Answer
has comment: http://stackoverflow.com/comment/38474325
has comment: http://stackoverflow.com/comment/38474281

http://stackoverflow.com/q/24881951
type: Question
has title: Adding try-catch block for injected byte code through ASM
tagged with: java
score: 0
has body: I am trying to inject byte code using ASM, I want to surround the injected byte code with a try-catch block. However, I get a VerifyError on onMethodExit : "Inconsistent stack height 0 != 1". When the try-catch block is removed it works as expected. Any pointer is highly appreciated. Here is my code snapshot:----- protected void onMethodEnter() { mv.visitInsn(Opcodes.ICONST_0); mv.visitVarInsn(ISTORE, okFlag); Label startTryBlock = new Label(); Label endTryBlock = new Label(); Label startCatchBlock = new Label(); // Initialization try-catch block mv.visitTryCatchBlock(startTryBlock, endTryBlock, startCatchBlock, "java/lang/Exception"); // starting try block mv.visitLabel(startTryBlock); mv.visitLdcInsn(className); mv.visitLdcInsn(methodName); mv.visitLdcInsn(description); mv.visitMethodInsn(Opcodes.INVOKESTATIC, "org/sam/agent/trace/RootTracer", "allMethodBegin", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z"); mv.visitVarInsn(ISTORE, okFlag); //ending try block mv.visitLabel(endTryBlock); Label endCatchBlock = new Label(); mv.visitJumpInsn(GOTO, endCatchBlock); // start catch block mv.visitLabel(startCatchBlock); mv.visitVarInsn(ASTORE, isStatic); //ending catch block mv.visitLabel(endCatchBlock); } private void onMethodExit(int opcode) { Label startTryBlock = new Label(); Label endTryBlock = new Label(); Label startCatchBlock = new Label(); // Initialization try-catch block mv.visitTryCatchBlock(startTryBlock, endTryBlock, startCatchBlock, "java/lang/Exception"); // starting try block mv.visitLabel(startTryBlock); if(opcode == ATHROW){ mv.visitInsn(Opcodes.DUP); mv.visitLdcInsn(className); mv.visitLdcInsn(methodName); mv.visitLdcInsn(description); mv.visitMethodInsn(Opcodes.INVOKESTATIC, "org/sam/agent/trace/RootTracer", "recordException", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); } mv.visitLdcInsn(className); mv.visitLdcInsn(methodName); mv.visitLdcInsn(description); mv.visitVarInsn(ILOAD, okFlag); mv.visitLdcIns…
has answer: http://stackoverflow.com/a/24904748
answer count: 1
type: UnansweredQuestion
tagged with: java-bytecode-asm

http://stackoverflow.com/q/24836515
has body: I am trying to get the binary data, "deserialize?" it into usable data from the file statePopulationPercentages.dat. Then I want to add the integers to an ArrayList&lt;Integer&gt; called percentages, but for starters, just print them out. I'm really new to java and working with binary files so any help would be great. Here's what I've got so far. try { // Open the file for reading. RandomAccessFile raf = new RandomAccessFile("statePopulationPercentages.dat", "r"); long position = raf.length(); while (position &gt; 0) { position -= 1; raf.seek(position); byte b = raf.readByte(); // line = deserialize "b" // add to ArrayList&lt;Integer&gt; percentages // percentages.add(line); System.out.print((int) b); // this would obviously go away when adding to the array list } } catch (Exception e) { e.printStackTrace(); }
tagged with: binaryfiles
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/24836638
favorite count: 0
linked to: http://stackoverflow.com/q/16145682
has answer: http://stackoverflow.com/a/24836638
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38561444
score: -1
type: Question
has title: How to take a binary file, read it, convert it into usable data, and store it into an ArrayList
tagged with: deserialization

http://stackoverflow.com/a/24811560
score: 0
answers question: http://stackoverflow.com/q/24762399
type: Answer
has body: Do you need the modules to build on their own, or do you just need your application to build? Assuming it's the latter, what happens if you include the jar in only your project? Eclipse may not like this since there will be errors in the workspace, but at least with command-line Ant, you can just reference a library project without building it ahead of time and your app should compile, since it will pull in all the classes/resources and build everything at once. I.e., suppose: projectA references libraryProjectB projectA depends on libFoo libraryProjectB depends on libFoo Then try: put libFoo in projectA build projectA only Not positive this will solve your problem, but I encountered a similar situation with shared C/C++ libraries and leaving them only in the library project solved my own issue, so hopefully this is helpful.

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/24753146
tags question: http://stackoverflow.com/q/24846000
tags question: http://stackoverflow.com/q/24810904
tags question: http://stackoverflow.com/q/24836236
type: Tag
tags question: http://stackoverflow.com/q/24844884

http://stackoverflow.com/comment/38664343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24870071
score: 1
has text: Can't you just register the mouse listener with the rectangles themselves, instead of with the flow pane?

http://stackoverflow.com/comment/48801553
type: Comment
has text: Maybe I am missing something here..But I tried to leverage a Jenkins variable like NODE_NAME or NODE_LABELS in Ant and it did not work. Using ${env.NODE_NAME}
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/28200910

http://stackoverflow.com/q/24791086
favorite count: 0
has comment: http://stackoverflow.com/comment/38527355
type: UnansweredQuestion
tagged with: maven
upvote count: 1
downvote count: 1
tagged with: java
tagged with: vaadin
type: Question
has body: I use RatingStars addon to create rating stars on a survey of a web application. It works on a normal web browser, but the rating is messed up in iOs. When I choose one rating, for exp, in the photo, i choose "Poor" for one question, the star caption appears properly for that particular question. When scroll down to other question, the caption follows to other stars and the ratings are automatically chosen. I didn't click on a star of the below question, the star is automatically chosen because the caption follows my scroll. I was thinking thats its a css problem, but I checked the css styles, and the divs appeared to be in proper width and height Also, sometime i didn't choose any rating, I simply scroll down and the ratings are automatically chosen. maybe something to do with the touch on a mobile phone partial code ratingStars = new RatingStars(); ratingStars.setMaxValue(5); //The rating star widget has a function to add star specific captions, doesn't work right in iOS ratingStars.setValueCaption(valueCaptions.values().toArray(new String[5])); ratingStars.setImmediate(true); ratingStars.setPrimaryStyleName("pp-ratingstars-wrapper"); ratingStars.setPrimaryStyleName("v-ratingstars-wrapper-large"); ratingStarsList.add(ratingStars); What are the possible fixes for this problem?
tagged with: add-on
has comment: http://stackoverflow.com/comment/38517329
has title: RatingStars addon setValueCaption doesn't work on iOs
tagged with: ios
has comment: http://stackoverflow.com/comment/38485894
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/31008472

http://stackoverflow.com/comment/38446809
comment on: http://stackoverflow.com/q/24775329
type: Comment
has text: You need to specify one thing, are you using Scene2D or not? Animation on actors and animation on your own objects is fairly different.
score: 0
type: QuestionComment

http://stackoverflow.com/a/24820133
downvote count: 0
upvote count: 2
has body: The /.../ notation for regex isn't valid json. To use regex in a json document like that you need the form { field: { $regex: 'acme.*corp', $options: 'i' } as shown here.
answers question: http://stackoverflow.com/q/24818408
type: Answer
score: 2

http://stackoverflow.com/comment/38670518
type: QuestionComment
comment on: http://stackoverflow.com/q/24880635
score: 0
has text: Are you setting the font of the document to your `arialuni` font? You need to actually change the font of the text in the document.
type: Comment

http://stackoverflow.com/comment/38705246
type: AnswerComment
comment on: http://stackoverflow.com/a/24900799
type: Comment
has text: The edit you have made turned this into a completely different question. The first question was about date formats and the second is about the actual value of the date.
score: 0

http://stackoverflow.com/a/24833458
downvote count: 0
has comment: http://stackoverflow.com/comment/38556220
has comment: http://stackoverflow.com/comment/38628327
type: Answer
has body: Its because of MultivaluedMap interface. public interface MultivaluedMap&lt;K, V&gt; extends Map&lt;K, List&lt;V&gt;&gt; { It returns the values as List. Instead of parameters.get(key) try parameters.getFirst(key) Note that this will drop the other values for the same parameter. It is possible to send multiple values for same parameter while making a rest call such as blahblah:8080?foo=bar1&amp;foo=bar2. With getFirst() call you will get bar1 value only. If you are sure you will not get multiple calls, you can go with getFirst(key) approach --- UPDATED --- Based on your comments, it seems you need to iterate over the multivalued map and call queryParam on the WebTarget instance. I understand you are looking for a library/straight forward way to do this. I did not try RESTEasy. But code I believe should be simple enough. multiValuesMap?.each { key, values-&gt; webTargetInstance = webTargetInstance.queryParam(key, values as Object[]) }
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/38629747
accepted answer of: http://stackoverflow.com/q/24833004
answers question: http://stackoverflow.com/q/24833004
type: AcceptedAnswer

http://stackoverflow.com/q/24774645
type: Question
answer count: 1
downvote count: 1
has body: I'm writing a unit test case, in which I'm not able to compare two strings only because of </> tag inside the object. My output is {"description":" License forms information can be download as attachments<\/p>"} My expected output is: "{\"description\":\" License forms information can be download as attachments \"}"; The only place where I'm facing problem is at tag. When I change to <\/p> it throws me syntax error. Any suggestions would be greatly appreciated. My code WebResource webResource = client.resource("http://myip:8080/Kalgudi/restService"); ClientResponse response = webResource.type("application/xml").get(ClientResponse.class); String output = response.getEntity(String.class); JSONObject json = new JSONObject(output); System.out.println("Json object is:"+json.getJSONObject("6824")); String expected = "{\"description\":\" License forms information can be download as attachments \"}"; assertEquals(expected, json.getJSONObject("6824"));
favorite count: 0
has comment: http://stackoverflow.com/comment/38452392
has title: Assert Equals having issue in Java
has comment: http://stackoverflow.com/comment/38446519
upvote count: 0
has answer: http://stackoverflow.com/a/24774935
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38445454
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/38445185
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/1367322

http://stackoverflow.com/comment/38511343
has text: this post may also help you http://stackoverflow.com/questions/934237/sqlite-exception-no-such-table-error
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24808837

http://stackoverflow.com/comment/38441840
has text: It could be due to the JIT compilation in Java that causing such scenario. [JIT](http://en.wikipedia.org/wiki/Just-in-time_compilation). However, is your array data, R a constant ? Different input could produce different sorting time.
comment on: http://stackoverflow.com/q/24773037
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38523513
type: Comment
has text: Method references are described here: http://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/24816194

http://stackoverflow.com/a/24762068
accepted answer of: http://stackoverflow.com/q/24760561
downvote count: 1
type: AcceptedAnswer
has body: Maven is likely supplying a Classpath Container to your project, and generating entries for the Java Build Path based on the pom.xml contents (the JRE System Library is another example of this). Its entries will not have source attachment unless the container decides it will, which is why the Installed JREs preference page offers to let you set Source Attachments. If the pom.xml has something like that, see if you can use it. If not, see if you can configure the Maven container from its context menu. Otherwise, you may simply be stuck.
has comment: http://stackoverflow.com/comment/38430802
type: Answer
answers question: http://stackoverflow.com/q/24760561
upvote count: 2
score: 1

http://stackoverflow.com/comment/39184224
has text: try using the `saveAs` method on `stream` variable itself
comment on: http://stackoverflow.com/q/24856636
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/38609513
type: QuestionComment
has text: @PhamTrung, I see thanks, I recompiled and it works now. The recursive calls are still not clear for me, so if someone can explain, it will be very nice
score: 0
comment on: http://stackoverflow.com/q/24860851
type: Comment

http://stackoverflow.com/comment/68271974
comment on: http://stackoverflow.com/a/24756190
has text: @Benjamin How can you have 1.7 at /Library/Java/JavaVirtualMachines? This folder is empty.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38663473
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24890088
has text: `-vm` and `C:\Program Files\Java\jdk1.7.0_60\bin` **must** be on separate lines.
type: Comment

http://stackoverflow.com/q/24827401
answer count: 0
tagged with: java
tagged with: eclipse
type: Question
score: 2
downvote count: 0
tagged with: axis
tagged with: soap
has body: I am trying to build a SOAP Web Service using Java, Axis v1.4 and Eclipse J2EE Helios. I have a WSDL receiving two xsi:string input parameters and dispatching one complex type of three xsi:string elements. According to Axis documentation (http://axis.apache.org/axis/java/user-guide.html#Encoding_Your_Beans_-_the_BeanSerializer), I need to modify the default deploy.wsdd and use a beanMapping entry. The following entry has been appended to the aforementioned file inside service tag: &lt;beanMapping qname="ns2:Complex_code" xmlns:ns2="http://ext.system.gr/ExposeCallbackData" languageSpecificType="java:com.system.ext.ExposeCallbackData.Complex_code" /&gt; Nevertheless, the SOAP Response received when invoking the Web Service via soapUI does not contain the SOAP Envelope. Please note that in case the WSDL specifies a standard XML type (e.g. xsi:int, xsi:string, etc.), the SOAP Envelope is retrieved as expected. Is there any other configuration step I should perform in order to resolve the issue?
favorite count: 0
has title: Axis configuration for complex type inside SOAP Response
upvote count: 2
type: UnansweredQuestion
tagged with: web-services

http://stackoverflow.com/comment/38529403
comment on: http://stackoverflow.com/a/24818696
type: AnswerComment
score: 0
type: Comment
has text: As I commented in the other question you linked, maybe a Servlet Filter would be a solution to control the request without interfering too much with the rest of the sling processing.

http://stackoverflow.com/comment/38731116
type: Comment
has text: The Interface was not in my classpath though i thought so. I just added the missing jar.
comment on: http://stackoverflow.com/a/24778680
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38655812
comment on: http://stackoverflow.com/q/24886332
type: Comment
score: 1
has text: @Keppil ahh stupid me I forgot the "class" when I tried Map.isAssignableFrom(...) yes this should do the trick - thx!
type: QuestionComment

http://stackoverflow.com/q/24812089
tagged with: sip
answer count: 1
has body: I'm actually developping a SIP application using Jain SIP and I noticed with WireShark that in fact the port I want to use during the initialization process of the SipProvider object isn't being used to send requests. For example : public SipLayer(String username, String ip, int port) throws PeerUnavailableException, TransportNotSupportedException, InvalidArgumentException, ObjectInUseException, TooManyListenersException { setUsername(username); sipFactory = SipFactory.getInstance(); sipFactory.setPathName("gov.nist"); Properties properties = new Properties(); properties.setProperty("javax.sip.STACK_NAME", "MyApp"); properties.setProperty("javax.sip.IP_ADDRESS", ip); properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32"); properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "textclient.txt"); properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "textclientdebug.log"); sipStack = sipFactory.createSipStack(properties); headerFactory = sipFactory.createHeaderFactory(); addressFactory = sipFactory.createAddressFactory(); messageFactory = sipFactory.createMessageFactory(); ListeningPoint tcp = sipStack.createListeningPoint(ip, port, "tcp"); sipProvider = sipStack.createSipProvider(tcp); sipProvider.addSipListener(this); } Here is my constructor where i'm initializing the sipProvider. I'm using TCP and i want to use the 5600 port. So when sending a stateless request, i'm using the following code in my method : sipProvider.sendRequest(request); When making a capture, i noticed that the TCP port being used isn't the 5600 i have chosen but something like 52065 for example. Can someone please tell me how can i force the sipProvider object to use my 5600 TCP port please? Thanks for your help :)
tagged with: jain-sip
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24812826
has title: Custom port SipProvider Jain SIP
tagged with: java
type: Question

http://stackoverflow.com/q/24855392
possible better answer: http://stackoverflow.com/a/24856029
accepted answer: http://stackoverflow.com/a/24855411
type: Question
has answer: http://stackoverflow.com/a/24856029
tagged with: java
linked to: http://stackoverflow.com/q/22744920
has body: I am doing this small application for image viewing. The user enters the filename for eg. image1.gif and it will populate a Vector of String and from there, I am hoping to associate it with ImageIcon to display it on a JLabel. I'm stuck currently as I'm totally lost now as in how to continue from there. Can you guys give me some advise or suggestion? Thanks! Vector &lt;String&gt; imageDetails = new Vector &lt;String&gt;; ImageIcon imageGraphic = new ImageIcon(imageDetails.toString()); imageLabel.setText(imageDetails.get(0));
score: 0
has title: How to retrieve ImageIcon elements from Vector Strings?
answer count: 2
has comment: http://stackoverflow.com/comment/38598090
tagged with: jlabel
has answer: http://stackoverflow.com/a/24855411
tagged with: imageicon
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24815413
tagged with: swing

http://stackoverflow.com/comment/38432393
type: QuestionComment
comment on: http://stackoverflow.com/q/24768026
score: 2
has text: so WHERE is this exception occuring? the backtrace should tell you.
type: Comment

http://stackoverflow.com/q/24811086
favorite count: 0
possible better answer: http://stackoverflow.com/a/24811125
has answer: http://stackoverflow.com/a/24811125
answer count: 4
has answer: http://stackoverflow.com/a/24811158
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24811130
has comment: http://stackoverflow.com/comment/38513653
tagged with: instance
tagged with: java
has body: I'm making a game in java and consistenetly get the strangest bug. I have a class called weapon. Then I create an instance of it called primary. After I create an instance and call it secondary. for some strange reason, primary gets overwritten with secondary's values. My instructor and I both looked at it and couldn't figure it out. Here's the code: public class weapon { static String type; static String name; static int weight; static int damage; static int dodge; weapon(String c, String n, int w, int da, int dod) { type = c; name = n; weight = w; damage = da; dodge = dod; } //getters String getType(){ return type; } String getName(){ return name; } Integer getWeight(){ return weight; } Integer getDamage(){ return damage; } Integer getDodge(){ return dodge; } //setters void setType(String c){ c=type; } void setName(String n){ n=name; } void setWeight(Integer w){ w=weight; } void setDamage(Integer da){ damage=da; } void setDodge(Integer dod){ dodge=dod; } } /*At the top of my main class I create both instances like this because the instances are created in if statements and I need to access them.*/ weapon primary; weapon secondary; //I create primary like this earlier in the code like this primary = new weapon("primary","sword", 8, 6, -1); //and then when I run this I get the output "sword" "Heavy Sword". System.out.println(primary.getName()); secondary = new weapon("secondary", "huge sword", 9, 7, -2); System.out.println(primary.getName());
has answer: http://stackoverflow.com/a/24811197
type: Question
score: 4
accepted answer: http://stackoverflow.com/a/24811130
tagged with: class
upvote count: 4
has title: Strange runtime error declaring instance of class Java
downvote count: 0

http://stackoverflow.com/a/24864639
has body: You can do, Collection&lt;Object&gt; values = map.get(key); checkState(values.size() == 2, String.format("Found %d values for key %s", values.size(), key)); return values.iterator().next(); // to get the first Iterator&lt;Object&gt; it = values.iterator(); it.next(); // move the pointer to the second object return it.next(); // get the second object Check - retrieving-specific-values-in-multimap.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24864348

http://stackoverflow.com/q/24899178
duplicate of: http://stackoverflow.com/q/5864224
tagged with: swing
tagged with: jtextfield
downvote count: 1
tagged with: graphics
has comment: http://stackoverflow.com/comment/38680628
tagged with: java
has comment: http://stackoverflow.com/comment/38680584
has answer: http://stackoverflow.com/a/24899254
type: AnsweredQuestion
upvote count: 0
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/38680614
favorite count: 0
has title: Need advice on approaching a little graphics project
type: Question
linked to: http://stackoverflow.com/q/5864224
has comment: http://stackoverflow.com/comment/38680545
has body: So I made a fully functional credit card validator which uses Luhn's Algorithm and all that jazz to validate the card type and number. It currently only uses Scanner and the console to print out stuff, but I wanted to take my program to the next level. I wanted to make an application with Java graphics that can take in a credit card number entered into my applet/japplet/whatever you suggest and can essentially do the same process as the previously mentioned program, but I want to give it the aesthetic appeal of graphics. So I'm honestly a little overwhelmed with the graphics in Java (not sure if that's weird), but here's what I want advice on. How should I approach my graphics project? Should I use JApplet, Applet, JFrame, or something else? I want to make a text field that the user enters his or her credit card into, what is the method of doing that? I looked up JTextFields but I'm at a loss on how to use it. I looked at the API but it doesn't do a very good job of explaining things in my opinion. My main problem is the textfield, can someone give me an example of a textfield that can take in data that the user types? Sort of like Scanner in the console but in my graphics application. Sorry for my word wall, you guys have been very helpful to me in the past :) Tips, tricks, and anything else you think would help me out would be greatly appreciated.
score: -1
accepted answer: http://stackoverflow.com/a/24899254

http://stackoverflow.com/comment/38431356
type: Comment
type: QuestionComment
has text: `But it still remains hung even when something is put into this queue at a later stage?` Are you asking us, or is that what's happening? That's the expected behaviour looking at the docs, yeah.
comment on: http://stackoverflow.com/q/24767438
score: 0

http://stackoverflow.com/q/24769699
has comment: http://stackoverflow.com/comment/38457623
has answer: http://stackoverflow.com/a/24772685
has comment: http://stackoverflow.com/comment/38458521
type: Question
has comment: http://stackoverflow.com/comment/38461050
has comment: http://stackoverflow.com/comment/38460178
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38472430
tagged with: postgresql
has comment: http://stackoverflow.com/comment/38461136
has title: Optimize writes to heroku Postgresql database
tagged with: talend
has comment: http://stackoverflow.com/comment/38460701
favorite count: 0
score: 2
has body: We are dealing with quite a lot of incoming events that we process with Talend and afterwards push them in different postgresql databases (local and remote heroku db). Because of the the session option setAutoCommit(true) we are facing big performance penalties especially on the heroku database (each statement/insert is a new transaction that has to be commited). Unfortunately because of a talend bug we cannot commit in batches that would improve the performance. Because of the generated overhead I was thinking to change the session to make asyncrhonous commit however on the java.sql.Connection documentation I could not find any useful information how to do it. From talend to postgresql we are using a single persistent connection. My questions are: Can be asynchronous commits configured through java connection/driver (postgresql 9.3)? We want to configure it on the session basis and not for the whole database. What other option do I have to reduce the transaction overhead? Like I said every insert is now in each own transaction. Any other option? Links: postgresql asynchronous commit java doc: java.sql.Connection issue on talend forum
upvote count: 2
has comment: http://stackoverflow.com/comment/38472467
type: UnansweredQuestion
tagged with: heroku
has comment: http://stackoverflow.com/comment/38448531
tagged with: java
tagged with: database

http://stackoverflow.com/a/25165612
answers question: http://stackoverflow.com/q/24866028
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39213834
has body: Here's a sample code to access the Scala parameters inside the isOperationAllowed method: @Override public boolean isOperationAllowed( Operation operation, ApiDescription api, Map&lt; String , List&lt; String &gt;&gt; params, Map&lt; String , String &gt; cookies, Map&lt; String , List&lt; String &gt;&gt; headers ) { scala.collection.immutable.List&lt; Parameter &gt; paramList = operation.parameters(); for ( int i = 0; i &lt; paramList.length(); i++ ) { Parameter myparam = paramList.apply( i ); if ( myparam.paramAccess().isDefined() &amp;&amp; myparam.paramAccess().get().equals( "private" ) ) { return false; } else { return true; } } } My REST class is annotated like this: @POST @ApiOperation( value = "create" ) @ApiImplicitParam( access = "private" ) public Response create( ... ) { ... }
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24866028

http://stackoverflow.com/q/24825361
has title: How do you query sent items using gmail api?
tagged with: java
type: Question
has body: When I use label:sent as a search query in the gmail UI it takes me to sent items but when I use a labelId of sent from the gmail API for messages (https://developers.google.com/gmail/api/v1/reference/users/messages/list) I get an error "Invalid label: sent" - just wondering how do I query for sent items from the API? Also is there a reference / examples for the type of input you can use for the "q" input parameter for the gmail API? Thanks
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24829609
tagged with: gmail-api
has answer: http://stackoverflow.com/a/24829609
downvote count: 0
score: 1
tagged with: google-api
type: AnsweredQuestion
tagged with: google-api-java-client

http://stackoverflow.com/comment/39016884
has text: What is the purpose of your second Activity ? Aren't the spinners displayed in your first?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25077728
type: AnswerComment

bluetooth
tags question: http://stackoverflow.com/q/24804547
tag name: bluetooth
tags question: http://stackoverflow.com/q/24835655
tags question: http://stackoverflow.com/q/24841970
tags question: http://stackoverflow.com/q/24814848
type: Tag
tags question: http://stackoverflow.com/q/24877437
tags question: http://stackoverflow.com/q/24789310

http://stackoverflow.com/a/24931254
has comment: http://stackoverflow.com/comment/38743624
has comment: http://stackoverflow.com/comment/39084159
answers question: http://stackoverflow.com/q/24908032
has body: Your action should work actually. The browser Save as.. dialog automatically opens, if it sees "Content-disposition"-header with "attachment; filename=aaa.zip" as a value in the response. Try removing the quotes: response.setHeader 'Content-disposition', 'attachment; filename=download.zip'
type: Answer
score: 0

http://stackoverflow.com/q/24787297
favorite count: 0
has comment: http://stackoverflow.com/comment/38469103
accepted answer: http://stackoverflow.com/a/24869659
has title: Moving a body to specific point [Box2D , Libgdx]
linked to: http://stackoverflow.com/q/24516945
possible better answer: http://stackoverflow.com/a/24787471
has answer: http://stackoverflow.com/a/24869659
type: AnsweredQuestion
downvote count: 0
tagged with: libgdx
score: 1
has comment: http://stackoverflow.com/comment/38482016
tagged with: java
tagged with: box2d
has body: I'm trying to make a simple magnet effect when my character is near a coin this should move to his position I have this: if(Mycharacter.position.x +2 &gt;= position.x) //position = coin position { body.setTransform(Mycharacter.position.x, Mycharacter.position.y, 0); } This is close to what I want but I need to be able to see the movement of the coin to my character. I'm still very new to Box2d and Libgdx so if possible keep it really simple guys, it doesn't help I'm terrible on physics. Thanks in advance.
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24787471

http://stackoverflow.com/q/24840309
has body: I have two strings 1. J2EE 2. java1.6 I want to remove numbers from only the start and ends; not from between. Can anyone provide a regular expression for this, or any other solution?
has comment: http://stackoverflow.com/comment/38568306
score: -4
has answer: http://stackoverflow.com/a/24840322
tagged with: regex
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24840322
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/38568275
has answer: http://stackoverflow.com/a/24840325
possible better answer: http://stackoverflow.com/a/24840335
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/24840335
has comment: http://stackoverflow.com/comment/38568352
favorite count: 0
has title: How to remove numbers from string which starts and ends with numbers?

http://stackoverflow.com/a/24867180
type: Answer
has comment: http://stackoverflow.com/comment/38619929
downvote count: 0
score: 9
has comment: http://stackoverflow.com/comment/38620016
has comment: http://stackoverflow.com/comment/38619850
has body: Fibonnacci numbers grow very fast and the integer in java fits only values from -2^31 to 2^31 - 1. the 220-th Fibonacci number is 4244200115309993198876969489421897548446236915(about 2^151) which is way out of this range, thus you get integer overflow.
upvote count: 9
answers question: http://stackoverflow.com/q/24867140

openshift
tags question: http://stackoverflow.com/q/24788862
tags question: http://stackoverflow.com/q/24789238
tags question: http://stackoverflow.com/q/24856603
tag name: openshift
tags question: http://stackoverflow.com/q/24846661
type: Tag
tags question: http://stackoverflow.com/q/24845051
tags question: http://stackoverflow.com/q/24800896
tags question: http://stackoverflow.com/q/24855588
tags question: http://stackoverflow.com/q/24826164

http://stackoverflow.com/comment/38489812
score: 0
type: AnswerComment
type: Comment
has text: Many Many Thanks. I worked. I was stuck with this for about a day. You saved me a lot. Again Thanks.
comment on: http://stackoverflow.com/a/24791652

http://stackoverflow.com/comment/38417939
comment on: http://stackoverflow.com/a/24760187
type: Comment
score: 1
has text: It's probably not a problem in this case, but just be aware that having the `@Override` annotation on a method specified by an interface is a compile-time error prior to Java 1.6.
type: AnswerComment

http://stackoverflow.com/comment/38610902
type: AnswerComment
score: 0
type: Comment
has text: Again, awesome idea. I had thought of this and want to use this for another application I am working on. In this instance, however, I was really looking for a design of having the possibile members listed separately and not exclusively for a Page(s) to Person(s) entity relationships
comment on: http://stackoverflow.com/a/24862474

http://stackoverflow.com/a/24759695
type: Answer
has comment: http://stackoverflow.com/comment/38417147
has comment: http://stackoverflow.com/comment/38416819
has comment: http://stackoverflow.com/comment/38416888
answers question: http://stackoverflow.com/q/24759536
has comment: http://stackoverflow.com/comment/38417088
score: 0
has body: Not shown in older 2.3 device. Unless for very specific purposes, you should instead start developing for Android 4.0+. It's possible you're writing code that's not available on 2.3 devices.

http://stackoverflow.com/comment/38700405
comment on: http://stackoverflow.com/a/24909398
type: AnswerComment
score: 0
type: Comment
has text: And `System.out.println(num)` gives what?

http://stackoverflow.com/comment/38561207
type: QuestionComment
comment on: http://stackoverflow.com/q/24836343
has text: Yeah, I know what I want the assignment to do, but I have trouble turning the code into plain language so I don't flip back and forth between the two. Thanks folks!
score: 0
type: Comment

http://stackoverflow.com/a/24854520
type: Answer
has body: Because you have made ProductID static, it's value will be shared by all objects of type Product. My Suggestions would be to create a variable in your main function which you increment each time a product is created and pass it in as a parameter. Edit: @DavidPostill -- Then they will all be equal to 1.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24854475

http://stackoverflow.com/comment/38615703
comment on: http://stackoverflow.com/q/24864922
score: 0
has text: http://fr.slideshare.net/sergialmar/building-realtime-applications-with-android-and-websockets
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38596356
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24854552
has text: We can assume you have already played with database settings and optimized it, right? Like buffer size, partitions, adding indexes where needed etc.
score: 0

http://stackoverflow.com/q/24875012
score: 4
answer count: 1
favorite count: 0
has body: The documentation for SecureRandom.getInstanceStrong() says that it returns a pRNG instance from the securerandom.strongAlgorithms java.security.Security property. Is there Java documentation that lists these properties by platform?
type: UnansweredQuestion
has title: Java 8 SecureRandom.getInstanceStrong Sources
upvote count: 4
tagged with: java-8
downvote count: 0
tagged with: java
tagged with: javadoc
tagged with: prng
type: Question
has answer: http://stackoverflow.com/a/24875013

http://stackoverflow.com/q/24755068
has body: I've been using the Desktop -> browse() method so far to open the default browser with a URL i now want to move opening 3 different browsers: IE, Chrome, Firefox what would be the best solution to do this? I was thinking just Inputting into the Cmd line start (browser.exe) (URL) as that would work Or is there a better solution? Many thanks for any advice
has comment: http://stackoverflow.com/comment/38407739
favorite count: 0
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
type: Question
upvote count: 2
has title: Opening a Specific Web Browser With a specific URL JAVA

http://stackoverflow.com/q/24882974
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I want to create a object array in JSONObjet. But not run in java. Please help me. JSONObject jo[] = new JSONObject[10]; jo[0].put("A","a"); jo[1].put("B","b"); jo[2].put("B","c"); ... java
has comment: http://stackoverflow.com/comment/38649907
has answer: http://stackoverflow.com/a/24883011
has title: How to create multi JSON object in java
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38649844
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24883011

http://stackoverflow.com/a/24883183
has body: You garage contains Vehicles, so the compiler static control view that you have a Vehicle and as .auto is a Car field you can't access it, dynamically it is a Car so the cast don't create some problem, if it will be a Boat and you try to make cast to Car will rise an exception on runtime.
upvote count: 7
answers question: http://stackoverflow.com/q/24883075
type: Answer
downvote count: 0
score: 7

http://stackoverflow.com/comment/38511639
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24805416
has text: This question should be of some help to you: [REST Complex/Composite/Nested Resources](http://stackoverflow.com/questions/7104578/rest-complex-composite-nested-resources)
score: 0

http://stackoverflow.com/comment/38662610
score: 0
type: AnswerComment
has text: Hi, I ll make clear the complete scenario what needs to be working. Suppose my server is deployed on machine A and client is deployed on machine B. I want the client to access the server from machine B. I also want the client to search for a specific file on machine A. The client also gives the path on the local machine(B) where the file found on server (A) needs to be saved. Finally the server should send that file to the location mentioned by the client on machine B. Is there any code supporting this problem?
type: Comment
comment on: http://stackoverflow.com/a/24883949

http://stackoverflow.com/a/24899022
score: 0
has body: A class is not an instance of an object. In fact, an object is an instance of a class. Here is the explanation, Conceptually, each class represents and describes the characteristics of an independent concept in a program. these characteristics are also owned by any object of this class type. Usually, instance variables of a class defines properties of an entity. For example, if you have a class called Student, then obviously this class should have instance variables that represents student's characteristics such as name, level, grade...etc. Also, it can have methods like getGrade (), getName (). Now, any object of type Student will have the properties defined by its class (eg. name, level..), meaning the information stated in the class is encapsulated in its objects. Also, this object can be used to reach for the methods like getGrade or getName (again because these methods are encapsulated inside each object). The class is the definition of a single concept structure, and the object is an implementation of this structure. That's why, we say, an object is an instance of a class. Note that we can have various instances (objects) of a single class, each object will encapsulate the same structure defined by its class, but with different values. For example, you may have several objects of the class Student each represents a different student with different name, level, grade...etc. Although these objects are different, they share the same structure, meaning they are all students. Data encapsulation provided by class/object technique is really useful. Suppose you have 100 students who you need to store their names, levels, and any other related information. Instead of defining 100 String variables to store each student name, and 100 int variables to store the levels, you simply create a class which defines a student structure and create as many objects as you want. It saves both time and effort, and it makes debugging much easier.
type: Answer
answers question: http://stackoverflow.com/q/24897263

http://stackoverflow.com/comment/38483990
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24795099
has text: Remove all contents of work and temp directory. That should work.
type: AnswerComment

http://stackoverflow.com/q/24840735
has comment: http://stackoverflow.com/comment/38569194
type: AnsweredQuestion
upvote count: 0
has body: For example, i am trying to write a code about drawing figures. x and y position have to be initialized so that the whole figure is drawn in the window: int x = (int) (width * Math.random() * 0.75); int y = (int) (heigth * Math.random() * 0.75); The size of the figure should not be larger than 1/8 of the width of the window: int figureWidth = (int)(x * 0.29); int figureHeight = (int)(y * 0.29); Why multiply the width with Math.random() and 0.75? where does 0.75 and 0.29 come from? In what contexts would getWidth()/getHeight() be considered ? Can someone point the way to some resources to help me learn more or explain here? Thanks.
tagged with: java
tagged with: swing
downvote count: 1
type: Question
tagged with: components
has comment: http://stackoverflow.com/comment/38569125
tagged with: containers
score: -1
has comment: http://stackoverflow.com/comment/38569162
tagged with: random
has answer: http://stackoverflow.com/a/24840846
accepted answer: http://stackoverflow.com/a/24840846
answer count: 1
has title: Can someone explain Math.random() and width/height used together to me?
favorite count: 0

http://stackoverflow.com/comment/38562852
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24837236
has text: Can you change the catch block of SQL Exception to read ```pw.println("SQL EXCEPTION "+e.getMessage()); ``` and post the result here? This would help people to understand what the exception actually is.

http://stackoverflow.com/comment/38496893
type: QuestionComment
has text: ok maybe this tutorial can help u. http://kein-java-learning-path.blogspot.com.es/2013/03/creating-blank-jsf-primefaces-project.html
comment on: http://stackoverflow.com/q/24801372
score: 0
type: Comment

http://stackoverflow.com/comment/38625084
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24869679
score: 1
has text: Can you provide us the code for this? I shouldn't need to be digging it up.

http://stackoverflow.com/a/24850048
answers question: http://stackoverflow.com/q/24848073
score: 0
has body: you can use the reduce function, to get a horizontal/vertical projection to one row/col. each value in there is the count of pixels in a row/col
type: Answer

http://stackoverflow.com/a/24762078
has body: I suspect that you're losing precision in the conversion of a String to a Date. This complete example creates a suitable database table in memory, queries it into a JDBCXYDataset and displays the dataset in a time series chart. Note that JDBCXYDataset recognizes time series data. As a check, the JDBCXYDataset is queried for the returned date values. Typical hourly data: … Jul 15, 2014 1:10:25 PM Jul 15, 2014 2:10:25 PM Jul 15, 2014 3:10:25 PM Jul 15, 2014 4:10:25 PM Jul 15, 2014 5:10:25 PM Jul 15, 2014 6:10:25 PM … Code: import java.awt.EventQueue; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.text.DateFormat; import java.util.Calendar; import java.util.Random; import javax.swing.JFrame; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.data.jdbc.JDBCXYDataset; /** * @see http://stackoverflow.com/a/24762078/230513 */ public class JDBCTest { private static final int N = 24; private static final Random r = new Random(); private void display() { JFrame f = new JFrame("JDBCTest"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDBCXYDataset jds = createDataset(); JFreeChart chart = ChartFactory.createTimeSeriesChart( "Inventory", "Date", "Count", jds, true, true, false); f.add(new ChartPanel(chart)); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); for (int i = 0; i &lt; jds.getItemCount(); i++) { System.out.println(DateFormat.getDateTimeInstance() .format(new Date(jds.getX(0, i).longValue()))); } } private JDBCXYDataset createDataset() { try { Connection conn = DriverManager.getConnection( "jdbc:h2:mem:test", "", ""); Statement st = conn.createStatement(); st.execute("create table inventory(when timestamp, n1 integer, n2 integer)"); PreparedStatement ps = conn.prepareStatement( "insert into inventory values (?, ?, ?)")…
score: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24761082
answers question: http://stackoverflow.com/q/24761082
upvote count: 4
has comment: http://stackoverflow.com/comment/38421624

http://stackoverflow.com/a/24755736
accepted answer of: http://stackoverflow.com/q/24755600
answers question: http://stackoverflow.com/q/24755600
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: java.lang.ClassNotFoundException: antlr.RecognitionException shows antlr lib missing. Add it and itss done :)

http://stackoverflow.com/comment/38428932
type: Comment
comment on: http://stackoverflow.com/q/24766216
has text: Not sure how this question is too broad to be covered here.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38451754
type: Comment
type: QuestionComment
has text: I am confuse, would you mind rewording the question? do you want to convert data in properties file into XML ? or XML into properties file? I saw an example XML in your question but what does it have to do with your question? The word 'map' is too vague.
score: 0
comment on: http://stackoverflow.com/q/24778393

http://stackoverflow.com/a/24888297
type: Answer
downvote count: 0
has body: In general, the more specialized a type, the less waste there is, both regarding algorithms and storage. Also, the data gets easier to manipulate. Thus, if you know your argument is always a UUID, don't go for strings instead. Ignoring that advice leads to a loosely typed mess, in extreme cases also known as stringly-typed-programs. http://blog.codinghorror.com/new-programming-jargon http://c2.com/cgi/wiki?StringlyTyped
score: 7
answers question: http://stackoverflow.com/q/24887825
upvote count: 7

http://stackoverflow.com/a/24773279
downvote count: 0
has body: Let us assume your code was valid... You might have a subclass defined like this public class B extends A&lt;B&gt; { } Here type parameter T is same as type of this. Which is why I guess you said A is a suitable candidate for T Now consider this case public class C extends A&lt;B&gt; { } which is perfectly valid since B passes all criteria required for T. In this case your method declaration in class A becomes invalid. (return type is B but you are returning instance of class C.) So your assumption that A is a suitable candidate for T is invalid. Hence the error. Hope this helps. Good luck.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24769061
answers question: http://stackoverflow.com/q/24769061
type: Answer
score: 2

http://stackoverflow.com/comment/38539052
has text: @morgano, your use of the word cache is misleading. It is more about when the cpu has to make sure that the data is to become visible to other cpus. Intel chips do this by writing to the CPU cache. Without a memory barrier being there, then the cpu is allowed to keep the changes in a register. Which is what I think you meant by saying cache. It is a subtle distinction though.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24823918
type: AnswerComment

http://stackoverflow.com/comment/38628466
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24835051
has text: Thanks that's useful. First question: why don't you use the latest Boot (1.1.4.RELEASE or 1.1.5.BUILD-SNAPSHOT as of today)? Second question: does the Weblogic target container support servlet 3.0?
score: 0

http://stackoverflow.com/a/24821643
score: 0
type: Answer
has body: I think you should move it to the server side. Why ? Because if someone want to do bad things with your backend, he can easily do it directly with his computer thus bypassing your android side content purification. He just have to launch Wireshark on his PC (or use a proxy to do MITM if you use HTTPS or SSL), listen the conversation your Android app and your server are having and then use that information to build an attack with his computer. A lot of APIs are not securised enough because people are still thinking that people can't access it outside the apps, it's wrong, they can.
answers question: http://stackoverflow.com/q/24821467

http://stackoverflow.com/comment/38566757
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24839117
has text: The whole discussion is moot: you can safely publish a reference to an object graph by writing it to a volatile variable. Either way, the crux of the question is the same: is the safe publication to another thread of just a reference to an object graph root enough for thread-safety as a whole? And this question answers it properly. It *may* be improved by stressing the existence of both publishing scenarios.

http://stackoverflow.com/a/24875954
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24856486
upvote count: 1
score: 1
has body: Yes, there is even a VM option for that appeared in JDK 7 (on by default): -XX:+EliminateNestedLocks However, it seems to work only when monitor object is static final or when locking on this object.

http://stackoverflow.com/a/24760378
answers question: http://stackoverflow.com/q/24760306
score: 0
type: Answer
has body: If the file is small, read it and perform the modifications in-memory and then write back to disk; If it is too big for that, read a block of data and write back the new block using this method.

http://stackoverflow.com/comment/38448412
type: AnswerComment
comment on: http://stackoverflow.com/a/24752169
has text: hi, do you mind explaining on how to make java program pass the filename to batch file as a command-line option???
score: 0
type: Comment