http://stackoverflow.com/comment/37275265
has text: Those formatting preferences control formatting *the* *comments*, their text, not the positioning of the start of the comment. You're just seeing it maintain the indentation of the previous line.
score: 0
comment on: http://stackoverflow.com/q/24148433
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24164934
accepted answer of: http://stackoverflow.com/q/24164461
answers question: http://stackoverflow.com/q/24164461
score: 1
type: Answer
type: AcceptedAnswer
has body: Use a different css selector instead of td. Since the right &lt;td&gt; is identified be the class, why not use it: td.itemprop Your java code then would start like this instead Elements tds = elms.select("td.itemprop");
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24184883
has body: If I understand your question correctly, you can try finding those specific digits by delimiting them with word boundaries. For instance: String singleDigitsToBeBlocked = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21"; Pattern p = Pattern.compile("\\b[2-5]\\b"); Matcher m = p.matcher(singleDigitsToBeBlocked); while (m.find()) { System.out.printf("Blocked: %s%n", m.group()); } Output Blocked: 2 Blocked: 3 Blocked: 4 Blocked: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/37332408
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37332273
answers question: http://stackoverflow.com/q/24184773
type: Answer

http://stackoverflow.com/a/24189196
accepted answer of: http://stackoverflow.com/q/24188372
has comment: http://stackoverflow.com/comment/37341071
answers question: http://stackoverflow.com/q/24188372
has comment: http://stackoverflow.com/comment/37341308
type: Answer
has body: What you are seeing is pretty much normal behavior, its not java-specific. When a file is created, the file system needs to add a file entry to its structures, and in the process modify existing structure (e.g. the directory the file is contained in) to take note of the new entry. On a typical harddisk this requires some head movements, a single seek takes time in the order of milliseconds. On the other hand, once you start writing to the file, the file system will assign new blocks to the file in a linear fashion (as long as possible), so you can write sequential data with about the maximum speed the drive can handle. The only way to make major improvements in speed is use a faster device (e.g. an SSD drive). You can pretty much observe this effect everywhere, Windows explorer and similar tools all show the same behavior: large files are copied with speeds close to the devices limits, while tons of small files go painfully slow.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37374409
type: QuestionComment
has text: What is line 41 of `MainFF.java`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24206203

http://stackoverflow.com/a/31805016
downvote count: 0
score: 19
type: Answer
upvote count: 19
answers question: http://stackoverflow.com/q/24206013
has body: If we have parameter like below in our POM XML ${project.version}.${svn.version} war I run maven command line as follows : mvn clean install package -Dproject.version=10 -Dsvn.version=1

http://stackoverflow.com/comment/37371464
comment on: http://stackoverflow.com/a/24204760
has text: I'm quite sure the JIT is still doing work even in the second run.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24157856
downvote count: 1
type: Answer
has body: You could set a simple timer using Thread.sleep() and then use Job.killJob() to kill the job.
answers question: http://stackoverflow.com/q/24152843
accepted answer of: http://stackoverflow.com/q/24152843
score: 0
has comment: http://stackoverflow.com/comment/37354648
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/q/24210590
has answer: http://stackoverflow.com/a/24210964
downvote count: 2
tagged with: mysql
favorite count: 0
type: Question
has title: Getting null pointer exception in JDBC(mySql) program
tagged with: nullpointerexception
tagged with: jdbc
has answer: http://stackoverflow.com/a/24210680
tagged with: eclipse
has answer: http://stackoverflow.com/a/24210660
has body: I checked everything like username, password, db_url, table name, etc but still I get this output---connecting to database creating statement java.lang.NullPointerException here is my code, (I'm using eclipse Kepler EE and MySQL 5.6.17.0) import java.sql.*; public class Demo { static final String JDBC_DRIVER="com.mysql.jdbc.Driver"; static final String DB_URL="jdbc:mysql://localhost/sample"; static final String USER="root" ; static final String PASS="root"; public static void main(String[] args) { Connection conn=null; Statement stmt=null; try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("connecting to database"); conn=DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("creating statement"); String sql="select * from sample"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) { int eid=rs.getInt("id"); String ename=rs.getString("name"); System.out.print(eid+"\t"); System.out.print(ename); System.out.println(""); } rs.close(); stmt.close(); conn.close(); }catch(Exception e) { System.out.println(e); } finally { try { if(stmt!=null) { stmt.close(); } }catch(Exception e) { System.out.println(e); } try { if(conn!=null) { conn.close(); } }catch(Exception e) { System.out.println(e); } } } }
has comment: http://stackoverflow.com/comment/37521777
answer count: 3
upvote count: 2
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/37419947
comment on: http://stackoverflow.com/a/24221863
score: 0
type: Comment
has text: Also unfortunatly I can't remove the hold... But you're at 8 rep now so that should also be good :).
type: AnswerComment

http://stackoverflow.com/q/24125543
tagged with: serialization
answer count: 2
score: 6
upvote count: 6
favorite count: 0
accepted answer: http://stackoverflow.com/a/24127188
type: AnsweredQuestion
tagged with: enums
has title: Change default enum serialization & deserialization in gson
downvote count: 0
possible better answer: http://stackoverflow.com/a/26143796
tagged with: java
tagged with: gson
has answer: http://stackoverflow.com/a/26143796
has body: I'm using Gson in a slightly "different" way and I'm wondering if the following is possible... I'd like to change the default serialization/deserialization format for enums so that it uses fully-qualified class names, but maintain support for the @SerializedName annotation on said enums. Basically, given the following enum... package com.example; public class MyClass { public enum MyEnum { OPTION_ONE, OPTION_TWO, @SerializedName("someSpecialName") OPTION_THREE } } I'd like the following to be true... gson.toJson(MyEnum.OPTION_ONE) == "com.example.MyClass.MyEnum.OPTION_ONE" &amp;&amp; gson.toJson(MyEnum.OPTION_TWO) == "com.example.MyClass.MyEnum.OPTION_TWO" &amp;&amp; gson.toJson(MyEnum.OPTION_THREE) == "someSpecialName" and vice-versa. (for those curious, I'm trying to build a small lib that allows me to treat android's intent's actions as enums, so that I can write switch statements instead of a bunch of ugly if-elses + string compares, and I want to support the annotation so that I can also include custom pre-existing action strings like Intent.ACTION_VIEW, etc in the same enum). So would anyone know if it's possible to register a type adapter that can fall back if the @SerializedName field is present? Would I just have to check for that annotation myself in my own TypeAdapter? Thanks in advance.
has answer: http://stackoverflow.com/a/24127188
type: Question

http://stackoverflow.com/comment/37236188
has text: Best practice is List<String> lst = new ArrayList<>;
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24132733
score: 0

http://stackoverflow.com/comment/37472309
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24235603
has text: Ok, I understand. However, suppose I already fix this code `FileInputStream fileInputStream = new FileInputStream(filexlsx);XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);XSSFSheet sheet = workbook.getSheet("sample");`, what should I do next?

http://stackoverflow.com/comment/37448456
has text: I downloaded an external file again, and the program works. Thus, there was a problem somewhere in the data, as you say... Thanks.
comment on: http://stackoverflow.com/q/24244317
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24106330
has comment: http://stackoverflow.com/comment/37186202
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/37186463
has body: You could try the following: if (Mouse.isButtonDown(0)){ Mouse.setGrabbed( !Mouse.isGrabbed() ); } if(Mouse.isGrabbed()){ camera.processMouse(1, 80, -80); } The '!' sign reverses the given true/false value so !true gives false and !false gives true.
has comment: http://stackoverflow.com/comment/37191832
upvote count: 0
answers question: http://stackoverflow.com/q/24105858
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37191924
has comment: http://stackoverflow.com/comment/37186596
has comment: http://stackoverflow.com/comment/37186287
accepted answer of: http://stackoverflow.com/q/24105858
downvote count: 1
has comment: http://stackoverflow.com/comment/37186607
has comment: http://stackoverflow.com/comment/37186523
has comment: http://stackoverflow.com/comment/37186527

http://stackoverflow.com/q/24258544
has body: I'm working on webservices with Axis and among the checked exceptions that its methods declare I have: ServiceException, RemoteException and AxisFault (those depend, of course, on the specific method invoked, so these are not all the relevant exceptions, I know, but that's not the point here). Doing some tests on my code, I inadvertedly put a long port number on a URL that made the code throw the (unchecked) exception IllegalArgumentException, that I wasn't catching until now. Now, which are the relevant unchecked exceptions that I must handle, when working withh webservices and with networking in general? I tried to search on the net, but I keep getting Checked vs unchecked exceptions results. Any advice? Is there a list or a guide out there?
answer count: 1
tagged with: unchecked-exception
has answer: http://stackoverflow.com/a/24258779
type: Question
tagged with: network-programming
has title: Which unchecked exceptions to catch when dealing with networking (URLs, connections, ...)?
accepted answer: http://stackoverflow.com/a/24258779
tagged with: web-services
has comment: http://stackoverflow.com/comment/37473792
linked to: http://stackoverflow.com/q/13251368
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37475393
tagged with: java
has comment: http://stackoverflow.com/comment/37473947

http://stackoverflow.com/comment/37487132
type: AnswerComment
has text: @Pshemo Agreed with you :) basic idea is to traversing in a container.
comment on: http://stackoverflow.com/a/24265205
score: 0
type: Comment

http://stackoverflow.com/q/24133037
has body: I implemented a wordcount program with Java. Basically, the program takes a large file (in my tests, I used a 10 gb data file that contained numbers only), and counts the number of times each 'word' appears - in this case, a number (23723 for example might appear 243 times in the file). Below is my implementation. I seek to improve it, with mainly performance in mind, but a few other things as well, and I am looking for some guidance. Here are a few of the issues I wish to correct: Currently, the program is threaded and works properly. However, what I do is pass a chunk of memory (500MB/NUM_THREADS) to each thread, and each thread proceeds to wordcount. The problem here is that I have the main thread wait for ALL the threads to complete before passing more data to each thread. It isn't too much of a problem, but there is a period of time where a few threads will wait and do nothing for a while. I believe some sort of worker pool or executor service could solve this problem (I have not learned the syntax for this yet). The program will only work for a file that contains integers. That's a problem. I struggled with this a lot, as I didn't know how to iterate through the data without creating loads of unused variables (using a String or even StringBuilder had awful performance). Currently, I use the fact that I know the input is an integer, and just store the temporary variables as an int, so no memory problems there. I want to be able to use some sort of delimiter, whether that delimiter be a space, or several characters. I am using a global ConcurrentHashMap to story key value pairs. For example, if a thread finds a number "24624", it searches for that number in the map. If it exists, it will increase the value of that key by one. The value of the keys at the end represent the number of occurrences of that key. So is this the proper design? Would I gain in performance by giving each thread it's own hashmap, and then merging them all at the end? Is there any other way…
type: Question
has answer: http://stackoverflow.com/a/24133738
accepted answer: http://stackoverflow.com/a/24133738
tagged with: word-count
has title: Java wordcount: a mediocre implementation
tagged with: worker-pool
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37239525
tagged with: concurrenthashmap
has comment: http://stackoverflow.com/comment/37238133
favorite count: 0
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37250645
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37239631
has comment: http://stackoverflow.com/comment/37239189
answer count: 1
downvote count: 1

http://stackoverflow.com/a/24186810
has body: You could achieve this using: select r, count(u) from " + User.class.getName() + " u inner join u.regions r where r in :regionList group by r This may not work for regions with no users, you could use right join in case regions with no users are needed.
answers question: http://stackoverflow.com/q/24166979
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24166979
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24265110
has title: Get a list of all Java reserved Keywords
accepted answer: http://stackoverflow.com/a/24288335
has comment: http://stackoverflow.com/comment/37486469
tagged with: keyword
possible better answer: http://stackoverflow.com/a/54141029
has answer: http://stackoverflow.com/a/24265205
favorite count: 0
tagged with: reserved-words
has answer: http://stackoverflow.com/a/54141029
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37486031
has comment: http://stackoverflow.com/comment/37486084
has comment: http://stackoverflow.com/comment/37486447
has comment: http://stackoverflow.com/comment/37486308
has answer: http://stackoverflow.com/a/24288335
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/37486154
upvote count: 10
tagged with: regex
has answer: http://stackoverflow.com/a/24265584
answer count: 4
type: Question
has comment: http://stackoverflow.com/comment/95113373
has body: I'm looking for a way to retrieve all the saved keywords in Java into some kind of data structure. For example: "for, while, if, else, int, double, etc." I need to do a name validation on a string, to be specific, I need to make sure it does not equal to any java keywords. Is there a specific way of retrieving all the keywords into one data structure? or do I need to just build a regex string with all these keywords in it : "for|while|if|..." and try and match my string against it? Thanks
downvote count: 0
has comment: http://stackoverflow.com/comment/37486367

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

http://stackoverflow.com/comment/37461142
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24251383
has text: A deadlock is when process 2 tries to access data that process 1 hasn't released. Simultaneously, process 1 tries to access data that process 2 hasn't released. Is that correct? I just don't understand how to get a process to try to access the data.
type: QuestionComment

blogger
type: Tag
tag name: blogger
tags question: http://stackoverflow.com/q/24215145

http://stackoverflow.com/a/24208641
has body: The make-it-compile way would be declaring the variable using generics but initializing the array (not the elements) using raw type: //add @SuppressWarnings("unchecked") to avoid warnings Foo&lt;String&gt;[] arrayOfFoo = new Foo[8]; arrayOfFoo[0] = new ClassThatImplementsFoo&lt;String&gt;(); //line below gives a compile error since the array declaration is for Foo&lt;String&gt; //and won't allow Foo&lt;AnotherClass&gt; arrayOfFoo[1] = new ClassThatImplementsFoo&lt;Integer&gt;(); A better and safer approach would be using List instead of plain array: List&lt;Foo&lt;String&gt;&gt; fooList = new ArrayList&lt;Foo&lt;String&gt;&gt;(); fooList.add(new ClassThatImplementsFoo&lt;String&gt;()); In your code, you should do this: public class MyClass&lt;E&gt; { private final Foo&lt;E&gt;[] fooArray = new Foo[8]; // (...) }
has comment: http://stackoverflow.com/comment/37378237
has comment: http://stackoverflow.com/comment/37382146
downvote count: 0
has comment: http://stackoverflow.com/comment/37379031
type: Answer
has comment: http://stackoverflow.com/comment/37378216
answers question: http://stackoverflow.com/q/24208531
has comment: http://stackoverflow.com/comment/37378178
has comment: http://stackoverflow.com/comment/37378264
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/37379084

http://stackoverflow.com/a/24111178
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37195700
accepted answer of: http://stackoverflow.com/q/24111133
type: Answer
answers question: http://stackoverflow.com/q/24111133
downvote count: 0
has body: Try using HTTPClient. something like this. public static InputStream getInputStreamFromUrl(String url) { InputStream content = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(new HttpGet(url)); content = response.getEntity().getContent(); } catch (Exception e) { Log.("[GET REQUEST]", "Network exception", e); } return content; //url content is here. }
upvote count: 1
score: 1

http://stackoverflow.com/comment/37206567
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24111912
type: QuestionComment
has text: After trying about a dozen combinations finally this worked `java -classpath "sqlite-jdbc-3.8.4.3-SNAPSHOT.jar:Mall.jar" Mall.main` YAY! Thanks! (the main class was inside Mall.java) - if it was the answer I would mark it as solved :)

http://stackoverflow.com/comment/37303010
comment on: http://stackoverflow.com/q/24165305
has text: We send notification when consumers are created, queues are created... object states have changed.. etc... not when delivery happens. I will place my previous comment as an answer...
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24245708
downvote count: 3
has body: The Range of byte is -128 to 127.But in following code it is going beyond the byte range and the output of code is "Thank you". class Solve { public static void main(String args[]) { byte by=10; switch(by+118) {//here it go beyond the byte range. default:System.out.println("Sunday"); case 0:System.out.println("Monday"); case 128:System.out.println("Thank u"); } } }
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24245765
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24245877
has answer: http://stackoverflow.com/a/24245742
upvote count: 4
answer count: 3
score: 1
tagged with: java
has title: switch case with byte datatype

http://stackoverflow.com/q/24201612
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24201900
linked to: http://stackoverflow.com/q/11959758
duplicate of: http://stackoverflow.com/q/6714045
linked to: http://stackoverflow.com/q/14548808
has title: Resizing JLabel to full screen size?
has comment: http://stackoverflow.com/comment/37366887
has answer: http://stackoverflow.com/a/24201900
has comment: http://stackoverflow.com/comment/37366397
tagged with: java
answer count: 1
downvote count: 1
duplicate of: http://stackoverflow.com/q/14548808
favorite count: 0
type: Question
tagged with: fullscreen
tagged with: jlabel
tagged with: jframe
upvote count: 0
has body: I have a got a JLabel. JLabel background=new JLabel(new ImageIcon("C:/CraftBukkit/background.png")); add(background); background.setLayout(new FlowLayout()); The question is, how can I stretch/contract this image so that it is always the same size as the screen? Currently, it is either too big, too small, or not the right dimensions comparing to the screen size. I have been unable to find any solutions on the internet. Thanks!
linked to: http://stackoverflow.com/q/6714045
tagged with: swing
score: -1

http://stackoverflow.com/comment/37198901
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24112962
has text: thanks guys. also I hadn't noticed that it is an abstract class
type: Comment

http://stackoverflow.com/q/24148151
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/64636256
tagged with: java
downvote count: 0
has body: I'm in a project that must perform "tests" on USB Pen Drives. For that, I'm using a USB Hub (49 port Asic Miner - I'm using it due the number of ports). I intend to plug 49 USB Pen drives on the HUB and test them using a Linux Java App. The test consists on "check if it is recognized", "storing and deleting data" and "check the size". My problem is on the first step. If there is any Pen Drive that is not working properly, the system will recognize 48 pen drives, but I'll never know the specific device that is not working. My question is: Is there any way to know the address (or something like that) of a specific usb port on a usb hub? For example: If I connect just one USB Pen Drive on port "34", my software will know that the device is connected on that specific port. Thank you very much for your time and for your help!
favorite count: 0
type: Question
tagged with: linux
upvote count: 2
possible better answer: http://stackoverflow.com/a/24148448
tagged with: usb
has answer: http://stackoverflow.com/a/24148448
accepted answer: http://stackoverflow.com/a/24148800
has answer: http://stackoverflow.com/a/24148800
has title: How to identify a specific USB Port
score: 2

http://stackoverflow.com/comment/37329552
has text: first of all, you are not inserting names into array, and secondly, what issue are you facing?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24183354
score: 1

http://stackoverflow.com/a/24191308
has comment: http://stackoverflow.com/comment/37387731
has comment: http://stackoverflow.com/comment/37400006
has comment: http://stackoverflow.com/comment/37378398
score: 2
answers question: http://stackoverflow.com/q/24163101
type: AcceptedAnswer
downvote count: 0
has body: You could start with a pom like this, that extract all the content of your old war files into content directory. Then you could package everything in that directory (except for web.xml and other metadata) in your new war. 4.0.0 com.olex olex-war war 1.0 olex-war Maven Webapp junit junit 4.10 test olex-war org.apache.maven.plugins maven-dependency-plugin unpack generate-resources com.olex olex-qba ${project.version} war com.olex olex-reg ${project.version} war WEB-INF/web.xml **/*.class, **/*.jar, **/*.properties ${project.build.directory}/content
has comment: http://stackoverflow.com/comment/37351122
accepted answer of: http://stackoverflow.com/q/24163101
upvote count: 2
type: Answer

http://stackoverflow.com/comment/37338128
type: Comment
type: QuestionComment
has text: have you try `org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean` in class in `sessionFactory` ?, where have you defined hibernate dialect ?
score: 0
comment on: http://stackoverflow.com/q/24187082

http://stackoverflow.com/comment/37375921
has text: See also http://stackoverflow.com/questions/21974361/what-java-collection-should-i-use
comment on: http://stackoverflow.com/q/24207264
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24472634
score: 1
type: Answer
has body: It depends on how the access to this object is published. While the bar Set is final and thus guaranteed to visible to all threads, the population of the map is not guaranteed to happen before the conclusion of constructor. This, however would be guaranteed to be thread safe regardless of how the object was created and made available. private final Set&lt;String&gt; bar; public Foo() { bar = new HashSet&lt;String&gt;(Arrays.asList("one", "two", "three")); } Testing initialization safety of final fields https://stackoverflow.com/a/23995782/676877
answers question: http://stackoverflow.com/q/24263521
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37264029
has text: Why is it a list of `String`s, and not a list of `Employee`s?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24147871
score: 0

save
tags question: http://stackoverflow.com/q/24157685
tag name: save
tags question: http://stackoverflow.com/q/24120893
type: Tag
tags question: http://stackoverflow.com/q/24109077
tags question: http://stackoverflow.com/q/24230529
tags question: http://stackoverflow.com/q/24113453

http://stackoverflow.com/a/24257547
has body: Scan your input and store each number with it's count in a Map&lt;Interger, Integer&gt;. Then loop over the Map and put all keys with value>1 in the resulting Set See also here: https://stackoverflow.com/a/15217535/461499
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24257469

http://stackoverflow.com/q/24135560
has comment: http://stackoverflow.com/comment/37241243
has comment: http://stackoverflow.com/comment/37241203
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: ebean
has title: Updating an ArrayList still keeps its original values
tagged with: entity
tagged with: arraylist
has body: Good day! I'm having a problem when updating an entity. When I click the "update" button, the changes are saved. However, when I go a different page, the recently changed (or added) items are there but the old items (that should be changed or removed) are also there. Particularly the relatedTags (the name and notes are updating just fine). Why is it not persistent or permanent? Here is where the updating happens. Form&lt;Tag&gt; filledForm = tagForm.fill(Tag.find.byId(id)).bindFromRequest(); Tag editedTag = RelatedTag.findTag(id); if(filledForm.hasErrors()) { return badRequest(editTagForm.render(user, editedTag, filledForm, tags)); } else { List&lt;RelatedTag&gt; relatedTagsAlloc = new ArrayList&lt;RelatedTag&gt;(); java.util.Map&lt;String, String[]&gt; map = request().body().asFormUrlEncoded(); String[] relatedTags = map.get("relatedTags.tag.name"); String[] relationship = map.get("relatedTags.relationship"); String[] relatedNotes = map.get("relatedTags.relatedNotes"); if (relatedTags != null) { for (int i = 0; i &lt; relatedTags.length; i++) { if (RelatedTag.exists(relatedTags[i].trim().toLowerCase().replaceAll("\\s+", " "))) { relatedTagsAlloc.add(RelatedTag.findByLabel( relatedTags[i].trim().toLowerCase().replaceAll("\\s+", " "), relationship[i], relatedNotes[i].trim())); } else { Tag unknown = new Tag(relatedTags[i], ""); Tag.create(unknown); relatedTagsAlloc.add(RelatedTag.findByLabel( relatedTags[i].trim().toLowerCase().replaceAll("\\s+", " "), relationship[i], relatedNotes[i].trim())); } } editedTag.getRelatedTags().clear(); } editedTag.setName(filledForm.get().getName().toLowerCase().replaceAll("\\s+", " ")); editedTag.setRelatedTags(relatedTagsAlloc); editedTag.update(); Application.log(user, editedTag, action); writeToFile(editedTag); return ok(summary.render(user, editedTag)); } And here are the models: Tag model: package models; import java.sql.Timestamp; import java.util.*; import javax.persistence.*; import javax.validation.*; import play.data.Form; i…
has comment: http://stackoverflow.com/comment/37240961
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37241283
tagged with: jpa
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24183028
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24182965
answers question: http://stackoverflow.com/q/24182965
type: Answer
score: 1
type: AcceptedAnswer
has body: just use split to get pieces Try this String date = "2014-06-21T08:00:00"; String[] parts = date.split("T"); System.out.println("Date: " + parts[0]); System.out.println("Time: " + parts[1]); or String date = "2014-06-21T08:00:00"; System.out.println("Date: " + date.substring(0, date.indexOf('T'))); System.out.println("Time: " + date.substring(date.indexOf('T') + 1)); In your case else if (tagName.equals(TAG_TIME)) { if (item != null) { item.mTime_SV = pullParser.getAttributeValue(null, "from"); String[] parts = item.mTime_SV.split("T"); System.out.println("Date: " + parts[0]); System.out.println("Time: " + parts[1]); }
downvote count: 0

http://stackoverflow.com/comment/37257272
has text: you can actually try load your class on runtime from specified jar file/project, that might work
comment on: http://stackoverflow.com/q/24143966
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37431093
has text: But my virtual machine does not seem to have a console device.
comment on: http://stackoverflow.com/a/24228046
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/24180203
type: UnansweredQuestion
answer count: 1
linked to: http://stackoverflow.com/q/585599
tagged with: http-request
has comment: http://stackoverflow.com/comment/37324159
has answer: http://stackoverflow.com/a/24184483
has comment: http://stackoverflow.com/comment/37324041
tagged with: proxy
score: 0
has comment: http://stackoverflow.com/comment/37328646
tagged with: exception
tagged with: java
has comment: http://stackoverflow.com/comment/37328452
tagged with: inputstream
linked to: http://stackoverflow.com/q/62929
has comment: http://stackoverflow.com/comment/37323994
type: Question
has comment: http://stackoverflow.com/comment/37325794
has comment: http://stackoverflow.com/comment/37324440
has title: Proxy in Java : Socket Exception while reading an inputstream
has body: I am implementing a simple proxy server in Java. I read in the requests from the browser through a clientSocket in the following code snippet. Then I open an input stream and read in the responses through byte[] buffer. I am encountering an error while reading in a particular webpage running on my local server. The particular point of termination is the line int n = bis.read[buffer]; Could someone point out what is causing it and how to rectify it? Other Info: I am running this method in a SwingWorker object (Maybe its not relevant) Also the forwardRequest forwards the intercepted request. If you require anything else, shoot me an update or a comment The Stack Trace: ERROR java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:189) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.net.SocketInputStream.read(SocketInputStream.java:107) at Networker.doInBackground(Networker.java:67) at Networker.doInBackground(Networker.java:25) at javax.swing.SwingWorker$1.call(SwingWorker.java:296) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at javax.swing.SwingWorker.run(SwingWorker.java:335) @Override protected Void doInBackground() throws Exception { System.out.println("Starting the SimpleProxyServer ..."); while (true) { clientSocket = serverSocket.accept(); InputStream bis = clientSocket.getInputStream(); // reading the request and put it into buffer //BufferedReader br =new BufferedReader(new InputStreamReader(bis)); try { n = bis.read(buffer); } catch (Exception e) { System.err.println("ERROR"); e.printStackTrace(); } forwardReq(); //this forwards the intercepted request } }

http://stackoverflow.com/comment/37307110
has text: Yes same for me. Showing `//Field test/Sub.ID:Ljava/lang/String;` with java7.
score: 0
comment on: http://stackoverflow.com/q/24170682
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37489012
comment on: http://stackoverflow.com/q/24265689
has text: Yeah. Spring's `form` is usually used to construct forms from model objects (form backing objects), not simple request parameters. If you're not doing that, a normal ` ` is fine.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37363999
comment on: http://stackoverflow.com/q/24200949
has text: The time you spent writing this question would have been better spent typing "java array index out of bounds exception" in google. The top 10 hits have exactly the same problem you're having here.
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24213198
downvote count: 0
type: AcceptedAnswer
has body: Using ViewPager.getCurrentItem() you can retrieve what is the index of current Fragment and use it on your navigation logic.
answers question: http://stackoverflow.com/q/24211486
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24211486

http://stackoverflow.com/comment/37301492
type: AnswerComment
comment on: http://stackoverflow.com/a/24167350
type: Comment
has text: I my answer helped, you can simply accept it. This is a standard way of saying "Thank you" on StackOverflow :)
score: 0

http://stackoverflow.com/comment/37376064
type: Comment
type: QuestionComment
has text: The JsonMappingException is wrapping a NullPointerException. Since LinkedHashMap and ArrayList both accept nulls you should take a look at the JSON to see if there is an explicit null or missing attribute that could be causing a NullPointerException in InteractionJDO or Key. I know the App Engine Key class does not accept nulls so perhaps that's a good place to start, specifically the namespace attribute.
comment on: http://stackoverflow.com/q/24187073
score: 0

http://stackoverflow.com/comment/37412635
type: Comment
has text: If you are asking what advantages using a thread pool brings, I believe that is addressed [here](http://stackoverflow.com/questions/3286626/what-is-the-use-of-a-thread-pool-in-java) and [here](http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html). Creating Threads is expensive in terms of system resources, while reusing them is much cheaper.
comment on: http://stackoverflow.com/a/24216770
type: AnswerComment
score: 1

http://stackoverflow.com/comment/37488976
has text: Can you share the heap size configuration for your JVM, type of linux, operating system version and hardware config (specifically memory)?
comment on: http://stackoverflow.com/q/24257068
type: Comment
type: QuestionComment
score: 0

jpa
tags question: http://stackoverflow.com/q/24236437
tags question: http://stackoverflow.com/q/24118733
tags question: http://stackoverflow.com/q/24186767
tags question: http://stackoverflow.com/q/24247366
tags question: http://stackoverflow.com/q/24213984
tags question: http://stackoverflow.com/q/24166979
tags question: http://stackoverflow.com/q/24131354
tags question: http://stackoverflow.com/q/24212824
tags question: http://stackoverflow.com/q/24183862
tags question: http://stackoverflow.com/q/24141546
tags question: http://stackoverflow.com/q/24112859
tags question: http://stackoverflow.com/q/24193660
tags question: http://stackoverflow.com/q/24220932
tags question: http://stackoverflow.com/q/24151758
tags question: http://stackoverflow.com/q/24263187
tags question: http://stackoverflow.com/q/24156194
tags question: http://stackoverflow.com/q/24217855
tags question: http://stackoverflow.com/q/24167931
tags question: http://stackoverflow.com/q/24155743
tags question: http://stackoverflow.com/q/24266982
tags question: http://stackoverflow.com/q/24201485
tags question: http://stackoverflow.com/q/24163089
tags question: http://stackoverflow.com/q/24264265
tags question: http://stackoverflow.com/q/24175307
tags question: http://stackoverflow.com/q/24191541
tags question: http://stackoverflow.com/q/24245215
tags question: http://stackoverflow.com/q/24116768
tags question: http://stackoverflow.com/q/24232416
tags question: http://stackoverflow.com/q/24217409
tags question: http://stackoverflow.com/q/24222835
tags question: http://stackoverflow.com/q/24165541
tags question: http://stackoverflow.com/q/24244621
tags question: http://stackoverflow.com/q/24138694
tags question: http://stackoverflow.com/q/24180573
tags question: http://stackoverflow.com/q/24242871
tags question: http://stackoverflow.com/q/24215828
tags question: http://stackoverflow.com/q/24146225
tags question: http://stackoverflow.com/q/24218540
tag name: jpa
tags question: http://stackoverflow.com/q/24135559
tags question: http://stackoverflow.com/q/24157966
tags question: http://stackoverflow.com/q/24201845
tags question: http://stackoverflow.com/q/24208182
tags question: http://stackoverflow.com/q/24185090
tags question: http://stackoverflow.com/q/24163381
tags question: http://stackoverflow.com/q/24111137
tags question: http://stackoverflow.com/q/24133803
tags question: http://stackoverflow.com/q/24123330
tags question: http://stackoverflow.com/q/24164681
tags question: http://stackoverflow.com/q/24166292
tags question: http://stackoverflow.com/q/24141930
tags question: http://stackoverflow.com/q/24129016
tags question: http://stackoverflow.com/q/24137646
tags question: http://stackoverflow.com/q/24260533
tags question: http://stackoverflow.com/q/24210887
tags question: http://stackoverflow.com/q/24186909
tags question: http://stackoverflow.com/q/24209175
tags question: http://stackoverflow.com/q/24250383
tags question: http://stackoverflow.com/q/24170972
tags question: http://stackoverflow.com/q/24140540
tags question: http://stackoverflow.com/q/24116653
tags question: http://stackoverflow.com/q/24248468
tags question: http://stackoverflow.com/q/24177680
tags question: http://stackoverflow.com/q/24133101
tags question: http://stackoverflow.com/q/24264493
tags question: http://stackoverflow.com/q/24196239
type: Tag
tags question: http://stackoverflow.com/q/24163226
tags question: http://stackoverflow.com/q/24177732
tags question: http://stackoverflow.com/q/24134820
tags question: http://stackoverflow.com/q/24121390
tags question: http://stackoverflow.com/q/24135560
tags question: http://stackoverflow.com/q/24217522
tags question: http://stackoverflow.com/q/24116561
tags question: http://stackoverflow.com/q/24160433
tags question: http://stackoverflow.com/q/24168204
tags question: http://stackoverflow.com/q/24180898

http://stackoverflow.com/a/24210249
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24210164
downvote count: 0
has body: If you follow the second approach (i.e. catching the exception), then there is no meaning for the isFatal flag. If you simply throw and immediately catch the exception, then you are just displaying an error stack trace, and not allowing the exception to propagate up the sequence of method calls, and hence it cannot terminate the program in case it is fatal. You should throw the exception, and let the caller of the method handle it.
type: Answer

http://stackoverflow.com/comment/37440916
type: Comment
comment on: http://stackoverflow.com/q/24241045
score: 0
has text: Then "there is something rotten" in there. Please confirm, that you are not using more than one thread (as stated in the question), nor running your application multiple times. Also confirm what your problem "connections not being released" / "running out of connections" exactly means (you get error; connections are not closed - which is correct behavior, ...).
type: QuestionComment

http://stackoverflow.com/comment/37389606
type: QuestionComment
has text: Search SO a bit and you will find [lots](http://stackoverflow.com/questions/3714971/difference-between-singleton-class-and-static-class) and [lots](http://stackoverflow.com/questions/519520/difference-between-static-class-and-singleton-pattern) of questions about this.
score: 0
comment on: http://stackoverflow.com/q/24214148
type: Comment

http://stackoverflow.com/comment/37481308
type: AnswerComment
comment on: http://stackoverflow.com/a/24260629
has text: are you sure you simulated the same directory structure I have?
score: 0
type: Comment

http://stackoverflow.com/comment/37256959
type: Comment
score: 0
type: QuestionComment
has text: `@ElementCollection` and `@CollectionTable` should be only used for basic types and embeddables, for entities use `@OneToMany` or `@ManyToMany`. Note: you don't need `@MapKeyClass` and `targetEntity` for typed java.util.Map
comment on: http://stackoverflow.com/q/24138694

gson
tag name: gson
tags question: http://stackoverflow.com/q/24222676
tags question: http://stackoverflow.com/q/24257631
tags question: http://stackoverflow.com/q/24199393
tags question: http://stackoverflow.com/q/24125543
tags question: http://stackoverflow.com/q/24182073
tags question: http://stackoverflow.com/q/24233687
tags question: http://stackoverflow.com/q/24165285
tags question: http://stackoverflow.com/q/24184643
tags question: http://stackoverflow.com/q/24116810
tags question: http://stackoverflow.com/q/24190240
tags question: http://stackoverflow.com/q/24168154
tags question: http://stackoverflow.com/q/24259902
tags question: http://stackoverflow.com/q/24114382
tags question: http://stackoverflow.com/q/24154917
tags question: http://stackoverflow.com/q/24204628
tags question: http://stackoverflow.com/q/24115624
tags question: http://stackoverflow.com/q/24167620
tags question: http://stackoverflow.com/q/24123403
tags question: http://stackoverflow.com/q/24125695
tags question: http://stackoverflow.com/q/24242141
tags question: http://stackoverflow.com/q/24227563
type: Tag
tags question: http://stackoverflow.com/q/24197377
tags question: http://stackoverflow.com/q/24150314

http://stackoverflow.com/q/24149994
accepted answer: http://stackoverflow.com/a/32137232
tagged with: regex
possible better answer: http://stackoverflow.com/a/24155535
has body: I've googled for this and found out how to do with with other regex parsers: http://vim.wikia.com/wiki/Changing_case_with_regular_expressions http://www.regular-expressions.info/replacecase.html I've tried these and neither work. As an example, I want to use a regex to change this: private String Name; private Integer Bar = 2; To this: private String name; private Integer bar = 2; I tried something like this: replace: private (\S+) (\S+) with: private $1 $L$2 with: private $1 \L$2 with: &lt;etc.&gt; None of them work. Is it possible to do this in intellij, or is this a missing feature? This is just for educational purposes and the example is contrived. I just want to know if this is possible to do in intellij.
has comment: http://stackoverflow.com/comment/37268171
has comment: http://stackoverflow.com/comment/37268865
upvote count: 120
score: 120
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24155535
answer count: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37268153
has comment: http://stackoverflow.com/comment/37272354
favorite count: 0
type: Question
has title: How can I use a regex to replace upper case with lower case in Intellij IDEA?
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/29668046
has answer: http://stackoverflow.com/a/32137232

http://stackoverflow.com/comment/37408428
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24224353
score: 0
has text: What is the full error stacktrace? IT should say on what line the NullPointerException occurs

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/24171195
tags question: http://stackoverflow.com/q/24188142
tags question: http://stackoverflow.com/q/24212177
tags question: http://stackoverflow.com/q/24242175
tag name: jfreechart
tags question: http://stackoverflow.com/q/24233657

http://stackoverflow.com/comment/42756057
has text: Could you elaborate on that? I accepted this as the answer because it compiles from native gradle without any extra libraries added.
type: Comment
comment on: http://stackoverflow.com/a/26143126
type: AnswerComment
score: 0

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

http://stackoverflow.com/q/24167996
score: 0
tagged with: java
tagged with: hibernate
answer count: 1
has body: I am having simple scenario when I am getting Entity from DB and modify it. I dont know which fields are being modified so I am just getting the current entity from db and set all values by the new DTO(newModifiedUserDTO). The code is getting cluttered, ugly and long. Maybe you could advice me(Using java 8's lambda's or any other Technic how to make this code shorter and effective ? @Transactional @Override public void modifyUserEntity(UserEntityDTO newModifiedUserDTO) { UserEntity oldUserEntity = usersRepository.findByUsername(newModifiedUserDTO.getUsername()); oldUserEntity.getExternalUsersEntity().setFirstName(newModifiedUserDTO.getExternalUsersEntity().getFirstName()); oldUserEntity.getExternalUsersEntity().setLastName(newModifiedUserDTO.getExternalUsersEntity().getLastName()); oldUserEntity.getExternalUsersEntity().setEnteredCompany(newModifiedUserDTO.getExternalUsersEntity().getEnteredCompany()); oldUserEntity.getExternalUsersEntity().setCountry(newModifiedUserDTO.getExternalUsersEntity().getCountry()); oldUserEntity.getExternalUsersEntity().setState(newModifiedUserDTO.getExternalUsersEntity().getState()); oldUserEntity.getExternalUsersEntity().setCity(newModifiedUserDTO.getExternalUsersEntity().getCity()); oldUserEntity.getExternalUsersEntity().setAddress1(newModifiedUserDTO.getExternalUsersEntity().getAddress1()); oldUserEntity.getExternalUsersEntity().setAddress2(newModifiedUserDTO.getExternalUsersEntity().getAddress2()); oldUserEntity.getExternalUsersEntity().setZipCode(newModifiedUserDTO.getExternalUsersEntity().getZipCode()); oldUserEntity.getExternalUsersEntity().setTelephone(newModifiedUserDTO.getExternalUsersEntity().getTelephone()); oldUserEntity.getExternalUsersEntity().setFax(newModifiedUserDTO.getExternalUsersEntity().getFax()); oldUserEntity.getExternalUsersEntity().setShippingCountry(newModifiedUserDTO.getExternalUsersEntity().getShippingCountry()); oldUserEntity.getExternalUsersEntity().setShippingState(newModifiedUserDTO.getExternalUsersEntity…
type: Question
has comment: http://stackoverflow.com/comment/37302782
has answer: http://stackoverflow.com/a/24168061
has title: How to modify Hibernate entity effectively(Using Java8 lambda's or anything else)
type: UnansweredQuestion
tagged with: entities
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/37302102
has comment: http://stackoverflow.com/comment/37301647
has comment: http://stackoverflow.com/comment/37301825

http://stackoverflow.com/a/24183620
score: 27
answers question: http://stackoverflow.com/q/24179874
has comment: http://stackoverflow.com/comment/105133701
accepted answer of: http://stackoverflow.com/q/24179874
type: AcceptedAnswer
downvote count: 0
has body: Say you visit example.com:9000/login?param=test, then within your controller function: public static Result login() { // set to "/login" -- The URI path without query parameters. String path = request().path(); // set to "/login?param=test" -- The full URI. String uri = request().uri(); // set to "example.com:9000" -- The host name from the request, with port (if specified by the client). String host = request().host(); ... }
upvote count: 27
type: Answer
has comment: http://stackoverflow.com/comment/95255970

http://stackoverflow.com/comment/37326221
has text: May I ask you where have you seen nested actions ? Any official documentation, online tutorial, what ? For a successful living, don't create monsters :)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24181325

http://stackoverflow.com/a/24200664
type: Answer
answers question: http://stackoverflow.com/q/24200663
score: 0
has body: The Problem is in the org.hornetq.utils.DeflaterReader, where byte[] readBuffer = new byte[2 * len]; So you have to be careful with setting the size of the property minLargeMessageSize, because you can get a Java heap space!

http://stackoverflow.com/q/24240295
tagged with: unit-testing
type: Question
tagged with: jooq
has title: Create an arbitary table like object for jOOQ unit testing
accepted answer: http://stackoverflow.com/a/24258590
has body: I have an issue using jOOQ's MockDataProvider to mock a SQL JOIN in a unit test. The JOIN implemented with jOOQ selects a single column containing UUIDs. Thus the result type is Result&lt;Record1&lt;UUID&gt;&gt;. In the associated unit test I would like to mock this result using the MockDataProvider, but I can't find a proper way to initialize the Result, as I can't find a way to create a table like object I could pass to the newResult method. I know that there are some table methods in DSL, but the signatures just seem to be wrong for my use case. Also as the unit test is not runnable at this point, I'm not sure that the way I create the UUID field is correct. This is my code: private class MyProvider implements MockDataProvider { @Override public MockResult[] execute(final MockExecuteContext ctx) throws SQLException { final MockResult[] mockResults = new MockResult[1]; final DSLContext db = DSL.using(SQLDialect.POSTGRES); final Result&lt;Record1&lt;UUID&gt;&gt; result = db.newResult(&lt;some table object here&gt;); final Field&lt;UUID&gt; uuidField = DSL.fieldByName(UUID.class, "uuid"); final Record1&lt;UUID&gt; record = db.newRecord(uuidField); record.setValue(uuidField, ID); result.add(record); mockResults[0] = new MockResult(1, result); return mockResults; } }
has answer: http://stackoverflow.com/a/24258590
type: AnsweredQuestion
tagged with: mocking
tagged with: sql
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/56768913
type: QuestionComment
has text: Is the application entirely in English / other Latin language?
comment on: http://stackoverflow.com/q/24262576
type: Comment
score: 0

http://stackoverflow.com/q/24151523
score: -2
tagged with: collision-detection
has answer: http://stackoverflow.com/a/24151978
has body: I'm doing collision but when I press the key to move it crashes and says that my isBlocked boolean has something wrong and I cannot figure it out, heres the class: public class Map_Test { private boolean[][] blocked; private static final int SIZE = 32; TiledMap map_test = null; int PlayerX; int PlayerY; public void init() throws SlickException{ try { map_test = new TiledMap("res/untitled.tmx"); } catch (SlickException e) { e.printStackTrace(); } blocked = new boolean[map_test.getWidth()][map_test.getHeight()]; for (int xAxis=0;xAxis&lt;map_test.getWidth(); xAxis++) { for (int yAxis=0;yAxis&lt;map_test.getHeight(); yAxis++) { int tileID = map_test.getTileId(xAxis, yAxis, 0); String value = map_test.getTileProperty(tileID, "blocked", "false"); if ("true".equals(value)) { blocked[xAxis][yAxis] = true; } } } } public void update(GameContainer gc, int delta) throws SlickException { //PlayerX = Player.X; //PlayerY = Player.Y; Input i = gc.getInput(); if (i.isKeyDown(Input.KEY_W)) { //if (!isBlocked(Player.X, Player.Y - delta * 0.1f)) { Player.X+=Player.speed *delta; //} } if (i.isKeyDown(Input.KEY_S)) { //if (!isBlocked(Player.X, Player.Y + SIZE + delta * 0.1f)) { Player.X+=Player.speed *delta; //} } if (i.isKeyDown(Input.KEY_A)) { //if (!isBlocked(Player.X - delta * 0.1f, Player.Y)) { Player.X+=Player.speed *delta; //} } if (i.isKeyDown(Input.KEY_D)) { //if (!isBlocked(Player.X + SIZE + delta * 0.1f, Player.Y)) { Player.X+=Player.speed *delta; //} } } public void render(Graphics g) throws SlickException{ map_test.render(0, 0); } public boolean isBlocked(float x, float y) { int xBlock = (int)x / SIZE; int yBlock = (int)y / SIZE; return blocked[xBlock][yBlock]; } } I have been staring at it for a while and thought someone on this website must have the answer, if you do It would be nice thanks.
type: UnansweredQuestion
upvote count: 0
tagged with: java
tagged with: slick2d
downvote count: 2
answer count: 1
favorite count: 0
type: Question
has title: Java Tile Collision Not Working?

android-fragments
tags question: http://stackoverflow.com/q/24149470
tags question: http://stackoverflow.com/q/24129619
tags question: http://stackoverflow.com/q/24208422
tags question: http://stackoverflow.com/q/24217621
tags question: http://stackoverflow.com/q/24243161
tags question: http://stackoverflow.com/q/24195337
tags question: http://stackoverflow.com/q/24224373
tags question: http://stackoverflow.com/q/24177773
tags question: http://stackoverflow.com/q/24186124
tags question: http://stackoverflow.com/q/24259218
type: Tag
tags question: http://stackoverflow.com/q/24167977
tags question: http://stackoverflow.com/q/24246789
tags question: http://stackoverflow.com/q/24123266
tags question: http://stackoverflow.com/q/24219020
tags question: http://stackoverflow.com/q/24164341
tags question: http://stackoverflow.com/q/24126243
tags question: http://stackoverflow.com/q/24143789
tags question: http://stackoverflow.com/q/24208202
tags question: http://stackoverflow.com/q/24211486
tags question: http://stackoverflow.com/q/24111605
tags question: http://stackoverflow.com/q/24110416
tags question: http://stackoverflow.com/q/24199947
tags question: http://stackoverflow.com/q/24157605
tags question: http://stackoverflow.com/q/24141694
tags question: http://stackoverflow.com/q/24229398
tags question: http://stackoverflow.com/q/24203900
tags question: http://stackoverflow.com/q/24162287
tags question: http://stackoverflow.com/q/24224415
tag name: android-fragments
tags question: http://stackoverflow.com/q/24175391
tags question: http://stackoverflow.com/q/24162927
tags question: http://stackoverflow.com/q/24156954

java
tags question: http://stackoverflow.com/q/24175203
tags question: http://stackoverflow.com/q/24125524
tags question: http://stackoverflow.com/q/24141051
tags question: http://stackoverflow.com/q/24245277
tags question: http://stackoverflow.com/q/24255334
tags question: http://stackoverflow.com/q/24120880
tags question: http://stackoverflow.com/q/24242543
tags question: http://stackoverflow.com/q/24191296
tags question: http://stackoverflow.com/q/24181972
tags question: http://stackoverflow.com/q/24198928
tags question: http://stackoverflow.com/q/24174719
tags question: http://stackoverflow.com/q/24164735
tags question: http://stackoverflow.com/q/24235941
tags question: http://stackoverflow.com/q/24223103
tags question: http://stackoverflow.com/q/24209525
tags question: http://stackoverflow.com/q/24213922
tags question: http://stackoverflow.com/q/24213561
tags question: http://stackoverflow.com/q/24206036
tags question: http://stackoverflow.com/q/24116476
tags question: http://stackoverflow.com/q/24222937
tags question: http://stackoverflow.com/q/24219152
tags question: http://stackoverflow.com/q/24123585
tags question: http://stackoverflow.com/q/24111507
tags question: http://stackoverflow.com/q/24254001
tags question: http://stackoverflow.com/q/24245089
tags question: http://stackoverflow.com/q/24240000
tags question: http://stackoverflow.com/q/24266629
tags question: http://stackoverflow.com/q/24139636
tags question: http://stackoverflow.com/q/24263847
tags question: http://stackoverflow.com/q/24255331
tags question: http://stackoverflow.com/q/24173117
tags question: http://stackoverflow.com/q/24198788
tags question: http://stackoverflow.com/q/24220082
tags question: http://stackoverflow.com/q/24165440
tags question: http://stackoverflow.com/q/24184485
tags question: http://stackoverflow.com/q/24165939
tags question: http://stackoverflow.com/q/24152852
tags question: http://stackoverflow.com/q/24202523
tags question: http://stackoverflow.com/q/24158129
tags question: http://stackoverflow.com/q/24138201
tags question: http://stackoverflow.com/q/24158642
tags question: http://stackoverflow.com/q/24193487
tags question: http://stackoverflow.com/q/24178488
tags question: http://stackoverflow.com/q/24116785
tags question: http://stackoverflow.com/q/24118719
tags question: http://stackoverflow.com/q/24109240
tags question: http://stackoverflow.com/q/24113170
tags question: http://stackoverflow.com/q/24187558
tags question: http://stackoverflow.com/q/24148364
tags question: http://stackoverflow.com/q/24219643
tags question: http://stackoverflow.com/q/24204059
tags question: http://stackoverflow.com/q/24119065
tags question: http://stackoverflow.com/q/24196214
tags question: http://stackoverflow.com/q/24245682
tags question: http://stackoverflow.com/q/24141219
tags question: http://stackoverflow.com/q/24119551
tags question: http://stackoverflow.com/q/24110920
tags question: http://stackoverflow.com/q/24168847
tags question: http://stackoverflow.com/q/24266303
tags question: http://stackoverflow.com/q/24226933
tags question: http://stackoverflow.com/q/24107331
tags question: http://stackoverflow.com/q/24238352
tags question: http://stackoverflow.com/q/24132806
tags question: http://stackoverflow.com/q/24153742
tags question: http://stackoverflow.com/q/24114578
tags question: http://stackoverflow.com/q/24112035
tags question: http://stackoverflow.com/q/24190456
tags question: http://stackoverflow.com/q/24243057
tags question: http://stackoverflow.com/q/24205100
tags question: http://stackoverflow.com/q/24261680
tags question: http://stackoverflow.com/q/24193588
tags question: http://stackoverflow.com/q/24171144
tags question: http://stackoverflow.com/q/24266495
tags question: http://stackoverflow.com/q/24220970
tags question: http://stackoverflow.com/q/24242224
tags question: http://stackoverflow.com/q/24202721
tags question: http://stackoverflow.com/q/24205905
tags question: http://stackoverflow.com/q/24147372
tags question: http://stackoverflow.com/q/24226534
tags question: http://stackoverflow.com/q/24131354

http://stackoverflow.com/q/24228148
tagged with: eclipse
has title: Custom eclipse builder
answer count: 2
has answer: http://stackoverflow.com/a/24229325
type: UnansweredQuestion
downvote count: 0
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/24228397
favorite count: 0
type: Question
has body: I am trying to create custom builder, that will do something. I have looked across a lot of docs and still have troubles with getting it work. I suppose that I misunderstand something. I am guided by this. 1) I have created a plugin project. 2) Manifest: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: EScript_Builder Bundle-SymbolicName: eScript_Builder; singleton:=true Bundle-Version: 1.0.0.qualifier Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources Bundle-RequiredExecutionEnvironment: JavaSE-1.6 3) Plugin.xml: <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <parameter name="optimize" value="true"/> <parameter name="comment" value="escript Builder"/> 4) Builder: public class Builder extends IncrementalProjectBuilder { @Override protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException { IProject project = getProject(); System.out.println(project.getFullPath()); File f = new File("D:" + File.separator + "hurray!"); //Check that builder worked try { f.createNewFile(); } catch (IOException e) { e.printStackTrace(); } return null; } } After that, I have added escript_builder.Builder to .project of a test application, but if I go to project->properties->builders it is said "Missing builder(escript_builder.Builder)". Also, I tried to export it as plugin and do project->properties->builders->new->program, but during build got an exception "escript_builder.Builder is not a valid win32 application". Thank You for any help or guidance!
has comment: http://stackoverflow.com/comment/37416672
tagged with: java

http://stackoverflow.com/comment/37316749
type: Comment
has text: array index starts from 0, if we have int[] a = {1, 2, 3}; then to access last element we use a[2]
type: AnswerComment
comment on: http://stackoverflow.com/a/24154272
score: 0

http://stackoverflow.com/comment/37479360
comment on: http://stackoverflow.com/q/24261326
score: 0
has text: @JonSkeet So using 500 or 1000 entries in my Hashtable will not decrease the efficiency .?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37460279
type: QuestionComment
score: 0
has text: Hmm. That definitely doesn't look like it should prevent Swing from painting. Sorry, I don't know what the problem could be, then.
comment on: http://stackoverflow.com/q/24250717
type: Comment

http://stackoverflow.com/q/24173463
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/24173545
tagged with: variable-assignment
has answer: http://stackoverflow.com/a/24187596
answer count: 10
downvote count: 49
favorite count: 0
upvote count: 145
type: Question
score: 96
accepted answer: http://stackoverflow.com/a/24173494
has title: Why does i = i + i give me 0?
has answer: http://stackoverflow.com/a/24232261
has body: I have a simple program: public class Mathz { static int i = 1; public static void main(String[] args) { while (true){ i = i + i; System.out.println(i); } } } When I run this program, all I see is 0 for i in my output. I would have expected the first time round we would have i = 1 + 1, followed by i = 2 + 2, followed by i = 4 + 4 etc. Is this due to the fact that as soon as we try to re-declare i on the left hand-side, its value gets reset to 0? If anyone can point me into the finer details of this that would be great. Change the int to long and it seems to be printing numbers as expected. I'm surprised at how fast it hits the max 32-bit value!
linked to: http://stackoverflow.com/q/5317732
has answer: http://stackoverflow.com/a/24173592
has answer: http://stackoverflow.com/a/24173494
has answer: http://stackoverflow.com/a/24173496
has answer: http://stackoverflow.com/a/24180808
has answer: http://stackoverflow.com/a/24173982
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24194900
possible better answer: http://stackoverflow.com/a/24173592
has answer: http://stackoverflow.com/a/24183502

http://stackoverflow.com/comment/55837672
comment on: http://stackoverflow.com/a/28603878
score: 0
type: AnswerComment
has text: Retrieving the pins of a particular user: GET http://widgets.pinterest.com/v3/pidgets/users/eecolor/pins/ it is giving only 50 records
type: Comment

http://stackoverflow.com/comment/37341781
comment on: http://stackoverflow.com/a/24189598
has text: Like I said, manually insert the blank line(s) where you want them. The formatter has no option to insert empty lines at the end of methods or classes.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24214154
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37390128
has comment: http://stackoverflow.com/comment/37449133
has title: Bizzare JFileChooser situation, the right click menu text is blank
score: 1
tagged with: java
tagged with: user-interface
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37389629
has comment: http://stackoverflow.com/comment/37391214
has body: I am using a bare bones JFileChooser on Redhat 6 with the code: JFileChooser testFileChooser = new JFileChooser("Test"); testFileChooser.showOpenDialog(this); The JFileChooser works as expected. In the file selection area, if I right click, I get a dialog with three rows, one with an arrow. There is no text describing what the rows does. The first row switches between list and detail views. The second row appears to do nothing and the third row creates a new folder. When I googled about this problem there appears to be no way to access or inspect this right-click popup dialog of the JFileChooser. I do not understand how it could break in the first place like this. I need ideas for how to fix or workaround this problem please.
tagged with: jfilechooser
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/50843589
has comment: http://stackoverflow.com/comment/37455204
has comment: http://stackoverflow.com/comment/37389590
type: UnansweredQuestion

http://stackoverflow.com/comment/37373805
comment on: http://stackoverflow.com/q/24206203
type: Comment
has text: you got the rights to create that file in that location?
type: QuestionComment
score: 0

http://stackoverflow.com/q/24241395
type: Question
linked to: http://stackoverflow.com/q/16288850
type: AnsweredQuestion
score: 0
has title: java - need help for keycode_home
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/24241495
answer count: 1
has body: i need help in my app which shows a toast when home button is pressed, back button is pressed and it check if the phone have got the nav bar MainActivity.java package com.example.myapp; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; public class MainActivity extends Activity { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_HOME)) { Toast.makeText(getApplicationContext(), "goodbye! (home button pressed)", Toast.LENGTH_LONG).show(); //doesn't work here finish(); return true; } if ((keyCode == KeyEvent.KEYCODE_BACK)) { Toast.makeText(getApplicationContext(), "goodbye! (back button pressed)", Toast.LENGTH_LONG).show(); finish(); return true; } return false; } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK); boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME); if (hasBackKey &amp;&amp; hasHomeKey) { // no navigation bar Toast.makeText(getApplicationContext(), "no nav bar", Toast.LENGTH_LONG).show(); } else { // navigation bar Toast.makeText(getApplicationContext(), "nav bar", Toast.LENGTH_LONG).show(); } if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long…
has answer: http://stackoverflow.com/a/24241495
duplicate of: http://stackoverflow.com/q/16288850

http://stackoverflow.com/a/24228237
downvote count: 0
has comment: http://stackoverflow.com/comment/37426844
answers question: http://stackoverflow.com/q/24228102
has comment: http://stackoverflow.com/comment/37416673
has comment: http://stackoverflow.com/comment/37415690
type: Answer
has comment: http://stackoverflow.com/comment/37415978
has body: Your ActionListener basically do nothing, try to move the JOptionPane Dialog inside actionPerform method. exitBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int selectedOption = JOptionPane.showConfirmDialog(null, "Do you want to close the window?", "Choose", JOptionPane.YES_NO_OPTION); if (selectedOption == JOptionPane.YES_OPTION) { System.exit(1); } } });
has comment: http://stackoverflow.com/comment/37415724
has comment: http://stackoverflow.com/comment/37433761
has comment: http://stackoverflow.com/comment/37415777
upvote count: 2
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24228102

http://stackoverflow.com/a/24255545
accepted answer of: http://stackoverflow.com/q/24255492
has comment: http://stackoverflow.com/comment/37469794
has comment: http://stackoverflow.com/comment/37472787
has comment: http://stackoverflow.com/comment/37473515
has body: Basically, you're block the Event Dispatching Thread, preventing it from updating the screen. Until the gamePlay method exists (and the actionPerformed method exists), nothing will be painted to the screen. Take a look at Concurrency in Swing for more details. Generally, you should consider using a javax.swing.Timer to perform basic animation in Swing. You can use a Thread, but it just complicates the matter Have a look at How to use Swing Timers for more details Also, remember, Swing is not thread safe. If you need to update the UI, you must do it from within the context of the Event Dispatching Thread Updated... Okay, so this is really, really complicated. Essentially, a javax.swing.Timer waits outside of the EDT for a specified period of time and then triggers an update in such away that the registered ActionListeners are notified within the context of the EDT. What this means is, when you start a Timer, the code will continue running while the Timer waits... For example... Timer timer = new Timer(PERIOD, new ActionListener() { public void actionPerformed(ActionEvent evt) { // Executed later... } }); timer.start(); // Not waiting, continue execution... This means, based on you code, you will either need to devise some kind of "execute after" chain, or setup your animation better, for example... private void gamePlay(int us) { String h1 = ""; String h2 = ""; int c; do { c = aiMove(); } while (computer.accessMoves(c).getPP() &lt;= 0); if (user.accessMoves(us).getPP() &lt;= 0) { JOptionPane.showMessageDialog(frame, "The move you selected has no PP left. Select another."); return; } long lastTime = System.currentTimeMillis(); if (user.getSpeed() &gt;= computer.getSpeed()) { //if user's speed is quicker, computer gets attacked first computer.updateHealth(user, us); userMove.setText("You used: " + user.accessMoves(us).getName()); user.accessMoves(us).lowerPP(); h2 = healthBar(computer); //health bar is changed //...... MoveAnimationHandler handler = new MoveAnimationHa…
has comment: http://stackoverflow.com/comment/37471322
type: Answer
has comment: http://stackoverflow.com/comment/37470618
has comment: http://stackoverflow.com/comment/37503761
has comment: http://stackoverflow.com/comment/37501228
has comment: http://stackoverflow.com/comment/37472650
has comment: http://stackoverflow.com/comment/37501287
has comment: http://stackoverflow.com/comment/37471494
has comment: http://stackoverflow.com/comment/37469888
answers question: http://stackoverflow.com/q/24255492
has comment: http://stackoverflow.com/comment/37512177
has comment: http://stackoverflow.com/comment/37511961
has comment: http://stackoverflow.com/comment/37471288
upvote count: 1
has comment: http://stackoverflow.com/comment/37469702
has comment: http://stackoverflow.com/comment/37468415
has comment: http://stackoverflow.com/comment/37472699
has comment: http://stackoverflow.com/comment/37470542
has comment: http://stackoverflow.com/comment/37468890
has comment: http://stackoverflow.com/comment/37501574
has comment: http://stackoverflow.com/comment/37472914
has comment: http://stackoverflow.com/comment/37470668
has comment: http://stackoverflow.com/comment/37474255
score: 1
has comment: http://stackoverflow.com/comment/37508872
has comment: http://stackoverflow.com/comment/37469316
has comment: http://stackoverflow.com/comment/37469671
has comment: http://stackoverflow.com/comment/37471462
has comment: http://stackoverflow.com/comment/37470335
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37473042
has comment: http://stackoverflow.com/comment/37500288
has comment: http://stackoverflow.com/comment/37512020
has comment: http://stackoverflow.com/comment/37468832
has comment: http://stackoverflow.com/comment/37468457
has comment: http://stackoverflow.com/comment/37511227
has comment: http://stackoverflow.com/comment/37469774
has comment: http://stackoverflow.com/comment/37511272
has comment: http://stackoverflow.com/comment/37483713
has comment: http://stackoverflow.com/comment/37512257
has comment: http://stackoverflow.com/comment/37468398
has comment: http://stackoverflow.com/comment/37472391
has comment: http://stackoverflow.com/comment/37469640
has comment: http://stackoverflow.com/comment/37473192
has comment: http://stackoverflow.com/comment/37501825
has comment: http://stackoverflow.com/comment/37470653

http://stackoverflow.com/q/24113133
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37199086
has body: EDIT: FORGOT THE CODE SNIPPET _ ADDED HERE I am trying to learn Java from the book 'Learning Java' that has the following code snippet listed as an example for interface callbacks. In this code snippet, there is only 1 class implementing the interface TextReceiver. My question is - since this code is instantiating the interface directly, if there was another class that implemented the interface TextReceiver and provided a whole different method body to the interface method receivetext than the one in TickerTape, then how would java resolve the reference to the method receivetext in the sendText method of TextSource? This seems like it would introduce ambiguity - also, it seems credence to what I have seen online about not being able to instantiate interfaces - but wanted to confirm before assuming interface TextReceiver { void receiveText( String text ); } class TickerTape implements TextReceiver { public void receiveText( String text ) { System.out.println("TICKER:\n" + text + "\n"); } } class TextSource { TextReceiver receiver; TextSource( TextReceiver r ) { receiver = r; } public void sendText( String s ) { receiver.receiveText( s ); } } I tried just writing this up myself to figure this out, but got stuck with issues compiling since all of these classes were in the same class. I know this sounds n00bish - but I figured you guys might have quick guidance to offer. Thanks in advance!!!
upvote count: 1
favorite count: 0
type: Question
has title: method resolution when instantiating an interface
has comment: http://stackoverflow.com/comment/37199093
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24113368
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24113153
has answer: http://stackoverflow.com/a/24113153
has comment: http://stackoverflow.com/comment/37199085
accepted answer: http://stackoverflow.com/a/24113368

http://stackoverflow.com/a/24246102
answers question: http://stackoverflow.com/q/24245955
type: Answer
has body: The first thing I saw were the new checks for the username and password to contain text. Maybe try to debug if they both are set correctly and if a Twitter Object is returned from the Application, or simply null, because of those checks.
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24245955

http://stackoverflow.com/comment/37262757
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24147313
has text: I doubt that. The refactoring tools tend to be localized to a single class as opposed to global for all classes in a package.

http://stackoverflow.com/q/24115646
tagged with: servlets
score: 0
answer count: 2
tagged with: jstl
upvote count: 1
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/24119569
has title: What's the difference between the methods findAttribute() and getAttribute() in servlet?
has answer: http://stackoverflow.com/a/52175999
favorite count: 0
type: Question
tagged with: jakarta-ee
has body: If I've set "cart" as a session attribute, then what's the difference between the methods pageContext.findAttribute("cart") and session.getAttribute("cart") in servlet file ? Do they do the same thing in this case?
type: UnansweredQuestion

http://stackoverflow.com/comment/37400562
type: AnswerComment
score: 1
has text: @Mascros But you have not yet initialised the Card objects in the array. Try adding `cards[i] = new Card();` as the first line inside your for-loop.
type: Comment
comment on: http://stackoverflow.com/a/24220124

http://stackoverflow.com/q/24197291
upvote count: 0
type: UnansweredQuestion
downvote count: 2
has body: I am using eclipse for an android app and the users input a value that is the used in a formula. When they dont enter the value, it will error out so i want any blank inputs to be changed to zeros. heres the code i have: EditText numAA=(EditText)findViewById(R.id.numAAAn); Double num1=Double.parseDouble(numAA.getText().toString()); if ((EditText)findViewById(R.id.numAAAn) == null) { numAA=0; } And it has a error on the 0 that says "type mismatch: cannot convert from int to edittext" so im assuming it wants it converted but im not sure how. I tired adding quotes around the 0 but that didnt work either.
favorite count: 0
has comment: http://stackoverflow.com/comment/37356867
type: Question
score: -2
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24197321
has answer: http://stackoverflow.com/a/24197334
tagged with: eclipse
has answer: http://stackoverflow.com/a/24197702
has title: Converting a blank input to a zero?
answer count: 3

http://stackoverflow.com/a/24131317
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24130865
has body: I believe what you're looking for is JScrollPane#setWheelScrollingEnabled(boolean handleWheel)

http://stackoverflow.com/comment/37273235
comment on: http://stackoverflow.com/q/24152414
score: 2
type: Comment
type: QuestionComment
has text: You can only have 64k of bytecode in a method in Java. Move the data out of the method to fields, or to resource files.

base64
tags question: http://stackoverflow.com/q/24263713
tags question: http://stackoverflow.com/q/24239474
tag name: base64
tags question: http://stackoverflow.com/q/24181186
type: Tag

http://stackoverflow.com/q/24196477
has title: Java - Retrieving User account application is running under
has comment: http://stackoverflow.com/comment/37355422
has comment: http://stackoverflow.com/comment/37355583
has comment: http://stackoverflow.com/comment/37355441
has comment: http://stackoverflow.com/comment/37355603
answer count: 0
has comment: http://stackoverflow.com/comment/37355350
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37355701
has body: I've got a web application running on a Windows Server 2008 machine. The app is running under spring tcserver. When the server group setup the box they created a service account that I run the application under. They also created a admin account for me. Within the app through java it's executing a web service. Most of the time the app works fine. Every once in a while if I'm logged onto the server with the admin account I'll get a HTTP status code 403 as a response when using the app. After a while (sometimes 10 mins, sometimes 30 mins) it will start working again. Talking to other developers @ work they're saying that it's an issue on the remote server that the web service resides on. I've sent the errors to the owner of the webservice to see if they see any issues from their side. Being that it's only occurred when I'm logged on to the server I'm skeptical whether it could be somehow using my profile instead. Through task manager I can see the app running under the correct account. So long story short, is there a way to retrieve the actual account the app is running under. When I try System.getproperty("user.name") this just returns system. It returns that the times when I get the error &amp; also when it's working properly. Is there another method of retrieving the user account. Also let me know if you think I'm wasting my time &amp; that you also think it's an issue on the remote server. Any other suggestions please let me know. Thanks
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37355541
tagged with: java

http://stackoverflow.com/a/24125124
has comment: http://stackoverflow.com/comment/37482991
has body: java.sql.Connection has a method called setReadOnly, which does exactly what it says: DB.withConnection{ implicit connection =&gt; connection.setReadOnly(true) ... } An exception will be thrown when trying to execute write queries. You could also wrap DB.withConnection to clean things up across the application: def withReadOnlyConnection[T](block: =&gt; T): T = { DB.withConnection{ implicit connection =&gt; connection.setReadOnly(true) block(connection) } } And use it just like DB.withConnection: def listThings: List[Stuff] = { withReadOnlyConnection{ implicit connection =&gt; SQL(...) } } Of course, it would still be better to have a separate database user with the limited permissions. Edit: For Java it's not going to be as pretty, but the same thing applies: Connection connection = DB.getConnection(); connection.setReadOnly(true); // Do something with this connection.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24114883
has comment: http://stackoverflow.com/comment/37482177

http://stackoverflow.com/a/24147919
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24147671
type: Answer
has body: The ActionListener of newTicketButton should create the new frame by calling the constructor of NewTicketWindow (same thing you are doing in the main of NewTicketWindow): JButton newTicketButton = new JButton("New Ticket"); newTicketButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { NewTicketWindow newTicketWindow = new NewTicketWindow(); newTicketWindow.setVisible(true); } catch (Exception ex) { ex.printStackTrace(); } } }); Also you need to add the newTicketButton to the home window: frame.add(newTicketButton);
downvote count: 0

http://stackoverflow.com/q/24257736
has comment: http://stackoverflow.com/comment/37473794
accepted answer: http://stackoverflow.com/a/24265854
tagged with: jsp
has answer: http://stackoverflow.com/a/24265854
has title: Error on Scriplet Include in Tomcat 8
answer count: 1
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: scriptlet
has comment: http://stackoverflow.com/comment/37734728
has body: I recently found that the support for static includes &lt;%@include file="reuse.html"%&gt; and scriptlets have been discontinued with Tomcat 8. I understand why this was done, but I cannot understand how they would remove this feature in it's entirety without providing a similar alternative. Please note that I understand the differences between a dynamic and a static include and that a static include is compiled directly into it's containing page which offers some performance benefits. Further more is it possible to adjust the compiled jsp's? If I wanted to declare an additional utility or object alongside the servletcontext, request and response on the compiled jsp?
has comment: http://stackoverflow.com/comment/37472379
type: Question
has comment: http://stackoverflow.com/comment/37479100
has comment: http://stackoverflow.com/comment/37475767

http://stackoverflow.com/q/24220668
has answer: http://stackoverflow.com/a/24221184
type: UnansweredQuestion
has body: I am using com.lowagie.text.FontFactory to register Greek Font to use in a PDF file. But, while registering itself I am getting java.io.EOFException.I would appreciate if anyone may have any insight into this. Thanks FontFactory.register("/classes/fonts/LiberationSans-Regular.ttf","Greek-Regular"); Error Stack: ExceptionConverter: java.io.EOFException at com.lowagie.text.pdf.RandomAccessFileOrArray.readFully(Unknown Source) at com.lowagie.text.pdf.RandomAccessFileOrArray.readFully(Unknown Source) at com.lowagie.text.pdf.TrueTypeFont.readStandardString(Unknown Source) at com.lowagie.text.pdf.TrueTypeFont.getAllNames(Unknown Source) at com.lowagie.text.pdf.TrueTypeFont.process(Unknown Source) at com.lowagie.text.pdf.TrueTypeFont.&lt;init&gt;(Unknown Source) at com.lowagie.text.pdf.BaseFont.getAllFontNames(Unknown Source) at com.lowagie.text.FontFactoryImp.register(Unknown Source) at com.lowagie.text.FontFactory.register(Unknown Source) at com.gxs.activefoundation.delegate.DefaultPdfReportDelegateImpl.&lt;clinit&gt;(DefaultPdfReportDelegateImpl.java:212)
has title: FontFactory (lowagie), Java, getting java.io.EOFException when trying to use Greek-Regular
tagged with: internationalization
score: 0
tagged with: fonts
has comment: http://stackoverflow.com/comment/37402505
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
tagged with: itext
type: Question

http://stackoverflow.com/q/24243240
tagged with: inheritance
possible better answer: http://stackoverflow.com/a/24243368
type: AnsweredQuestion
score: 3
tagged with: builder
linked to: http://stackoverflow.com/q/17164375
tagged with: oop
answer count: 2
has title: Extending classes using Builder pattern
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24372759
has comment: http://stackoverflow.com/comment/37444660
linked to: http://stackoverflow.com/q/21086417
favorite count: 0
has answer: http://stackoverflow.com/a/24243368
type: Question
has answer: http://stackoverflow.com/a/24372759
has body: I am trying to extend a class a, into aX. So, I also extend aBuilder. However, while I am able to create an object of class a using : aBuilder f = new aBuilder(); f.bi = i; f.bs = s; a atry = f.withI(i).withS(s).build(); The same doesn't work for aX. When I try to do this : aXBuilder fb = new aXBuilder(); aX aXtry = fb.withI(i).withS(s).withB(b).build(); I get an error (The method withB(Boolean) is undefined for the type a.aBuilder). Should I instead rewrite all the stuff for aX, instead of simply adding new stuff? I don't want to do that because that will lead to a lot of duplicacy in my code. The classes a and aX are as given below: class a { protected String s; protected int i; public void getdata() { System.out.println(this.s); System.out.println(this.i); } protected a(aBuilder fb) { this.s = fb.bs; this.i = fb.bi; } public static class aBuilder { public aBuilder() { } protected String bs; protected int bi; public aBuilder withS(String s) { this.bs = s; return this; } public aBuilder withI(Integer i) { this.bi = i; return this; } public a build() { return new a(this); } } } class aX extends a { protected Boolean b; public void getData() { System.out.println(this.s); System.out.println(this.i); System.out.println(this.b); } protected aX(aXBuilder axb) { super(axb); this.b = axb.bb; } public static class aXBuilder extends aBuilder { protected Boolean bb; public aXBuilder() { } public aXBuilder withB(Boolean b) { this.bb = b; return this; }; public aX build() { return new aX(this); } } }
downvote count: 0

http://stackoverflow.com/q/24207264
has body: I am using maps and I need them to keep the order objects were put into them but they keep sorting themselves at their will. How do I stop that or is there another collection for that? I got around it by using two ArrayLists but I want to do it with one collection. import java.util.HashMap; import java.util.Map; public class Test { public static void main(String[] args) { Map&lt;String, String&gt; map = new HashMap&lt;&gt;(); map.put("b", "Item One"); map.put("a", "Item Two"); map.put("c", "Item Three"); System.out.println(map); } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24207338
score: 0
has answer: http://stackoverflow.com/a/24207338
has comment: http://stackoverflow.com/comment/37375780
possible better answer: http://stackoverflow.com/a/24207340
linked to: http://stackoverflow.com/q/2973751
tagged with: java
linked to: http://stackoverflow.com/q/21974361
duplicate of: http://stackoverflow.com/q/683518
has answer: http://stackoverflow.com/a/24207340
has comment: http://stackoverflow.com/comment/37375812
has comment: http://stackoverflow.com/comment/37375781
type: Question
has title: Map sorts automatically
duplicate of: http://stackoverflow.com/q/2973751
linked to: http://stackoverflow.com/q/19164699
answer count: 2
has comment: http://stackoverflow.com/comment/37375921
tagged with: dictionary
tagged with: collections
linked to: http://stackoverflow.com/q/683518

http://stackoverflow.com/q/24174443
tagged with: java
tagged with: user-interface
has answer: http://stackoverflow.com/a/24174489
has comment: http://stackoverflow.com/comment/37508362
has answer: http://stackoverflow.com/a/24174504
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37314150
type: UnansweredQuestion
has body: So I am trying to make a calculator in Java and I have it so that when you clikc the 123456789 or . buttons it will add it to the text field. The problem is that once I add the 6 character it will show "null". Here is my code: import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JTextField; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.SwingConstants; import java.awt.Font; public class Calculator { private JFrame frame; private JTextField textField; //Variables private double plus; private double minus; private double divide; private double multiply; //Check for button clicks private int plusClick; private int munisClick; private int multiplyClick; private int divideClick; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Calculator window = new Calculator(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Calculator() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setResizable(false); frame.setBounds(100, 100, 242, 315); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton equalsButton = new JButton("="); equalsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); equalsButton.setBounds(185, 202, 41, 74); frame.getContentPane().add(equalsButton); JButton additionButton = new JButton("+"); additionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); additionButton.setBounds(185, 163, 41, 38); frame.getContentPane().add(additionButton); JButton subtractionButton = new JButton("-"); subtractionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); subtracti…
tagged with: swing
has comment: http://stackoverflow.com/comment/37314116
score: 0
has title: I'm Trying To Make A Calculator in Java with a GUI
has comment: http://stackoverflow.com/comment/37314107

http://stackoverflow.com/q/24212177
linked to: http://stackoverflow.com/q/2602696
downvote count: 1
favorite count: 0
type: Question
has body: I have been using Jfreechart in a package under development. The JFreechart version being used so far was 1.0.13. Now I'd like to see how it behaves in a newer version, in this case 1.0.17. So, I downloaded the new version and places it in the folder HOME\jfreechart\jfreechart-1.0.17\ I did not remove the older version which still resides in HOME\jfreechart\jfreechart-1.0.13\ I changed the classpath accordingly to reference the version 1.0.17 jar files. I keep getting the errors :42: package org.jfree.ui does not exist import org.jfree.ui.RefineryUtilities; ^ .:49: package org.jfree.ui does not exist import org.jfree.ui.RefineryUtilities; ^ 51: package org.jfree.ui does not exist import org.jfree.ui.RefineryUtilities; ^ .:39: package org.jfree.ui does not exist import org.jfree.ui.RefineryUtilities; and so on. When I change the classpath back to reference v 1.0.13, everything is back to normal and works fine. The specific classpath references for v 1.0.17 are HOME%\jfreechart\jfreechart-1.0.17\lib\jfreechart-1.0.17.jar;%ADB_HOME%\jfreechart\jfreechart-1.0.17\lib\jcommon-1.0.21.jar; The specific classpath references for v 1.0.13 are HOME%\jfreechart\jfreechart-1.0.13\lib\jfreechart-1.0.13.jar;%ADB_HOME%\jfreechart\jfreechart-1.0.13\lib\jcommon-1.0.16.jar; I did not delete the older version. Further details: Windows 8.1 machine, java 1.6, work on notepad++ (not eclipse). Any suggestions as to proper procedure to upgrate JFreechart? Thank you
has comment: http://stackoverflow.com/comment/37386181
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37395884
has comment: http://stackoverflow.com/comment/37392481
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/37389302
has comment: http://stackoverflow.com/comment/37388484
linked to: http://stackoverflow.com/q/15299898
has title: JFreechart installing newer version
tagged with: java
upvote count: 1
tagged with: jfreechart

http://stackoverflow.com/comment/37391067
comment on: http://stackoverflow.com/q/24214944
type: Comment
has text: Yes declared in outher but change in inner I want take `wartosc` from inner class event
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37266347
type: AnswerComment
has text: @user3580294 I don't see any other issue. Using a single random also saves memory and processing power.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24149081

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

http://stackoverflow.com/a/24248518
type: Answer
has comment: http://stackoverflow.com/comment/37457303
has comment: http://stackoverflow.com/comment/37458275
score: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24248449
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24248449
has body: You're doing nothing wrong. The constructor is called many times during the injection process. The fields are injected into the managed bean only once it's been constructed. When you do constructor level injection, your constructor needs to read: private ReadCommand readCommand; @Inject public Controller(ReadCommand readCommand) { this.readCommand = readCommand; if(this.readCommand == null) { ... } }
has comment: http://stackoverflow.com/comment/37456518
upvote count: 5

http://stackoverflow.com/q/24158170
tagged with: jpa-2.0
upvote count: 3
score: 3
has body: I'm having problems generating the querydsl metamodel (i.e. the Q-classes) for an Entity comming from a jar included in the dependencies for my project. The class (BaseEntity) is an abstract baseclass for most of my entities (annotated with @MappedSuperclass) and for project reasons and dependencies to other projects this baseclass has to be in a separate jar. When I now include this jar as a dependency for the project which contains my non-abstract entities and try to generate the metamodel (using the com.mysema.maven:apt-maven-plugin) it doesn't recognize the BaseEntity and complains with "Cannot find symbol" QBaseEntity. I kindof solved this by making maven unpack the source file (i.e. BaseEntity.java) into an additional source folder of the dependent project but this is kind of ugly as I have to always remember to change the version number in case of releases and also have the source dependency in my pom and it's also not very intuitive. So my question(s) is/are: Can I make querydsl generate the metamodel for the class from the jar somehow without copying the source to the dependent project? If this is not possible: can I make querydsl metamodel generation operate on the .class file rather than on the .java source file (with that I wouldn't need the source dependency and could only extract the .class file from the existing dependency) Any help is greatly appreciated, thanks
tagged with: querydsl
tagged with: java
has answer: http://stackoverflow.com/a/53861822
favorite count: 0
type: Question
has title: Create (querydsl) metamodel for Entity from jar
answer count: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24189252

http://stackoverflow.com/a/24106746
has body: JAVA is compatible for all database there is no restriction for that. if you are looking for free one RDMS:MYSQL,orcale NOSQL:mongoDb
type: Answer
answers question: http://stackoverflow.com/q/24106728
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/52083012
type: Comment
score: 0
has text: Updating the ecj.jar file to version ecj-4.4.2.jar worked for me
type: QuestionComment
comment on: http://stackoverflow.com/q/24110620

http://stackoverflow.com/q/24138538
has answer: http://stackoverflow.com/a/24138792
tagged with: interface
tagged with: java
answer count: 3
has title: Could I define a 'Interface' for 'Class' instead of 'Object' in java?
has answer: http://stackoverflow.com/a/24138584
type: Question
has comment: http://stackoverflow.com/comment/37246355
score: 0
has body: We know 'interface' in java provide a common way to access objects who implementing it, but i wonder if there's a way like interface which not just for accessing the object's method, but also for accessing the class's method(static method). I want to use it to invoke an array of different classes's static factory method. Does java provide something like it?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37246217
has answer: http://stackoverflow.com/a/24138601

http://stackoverflow.com/comment/37284094
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24158695
has text: When I toString(10) those numbers I get positive values of 78187493530 and 1040260167834 so it looks more like a bug to me. But no matter, I can live with a bug - I just want to know if it's safe to strip the leading zero.
type: Comment

http://stackoverflow.com/comment/37323469
comment on: http://stackoverflow.com/q/24162688
type: Comment
type: QuestionComment
score: 0
has text: Check the selected answer in the duplicate question-- there is a link to some src code which should help you.

exiftool
tags question: http://stackoverflow.com/q/24177062
tag name: exiftool
type: Tag

http://stackoverflow.com/q/24243348
type: Question
has answer: http://stackoverflow.com/a/24243457
possible better answer: http://stackoverflow.com/a/24243457
has answer: http://stackoverflow.com/a/76578270
has comment: http://stackoverflow.com/comment/37446815
downvote count: 0
upvote count: 21
has comment: http://stackoverflow.com/comment/37460423
has answer: http://stackoverflow.com/a/24251559
favorite count: 0
has comment: http://stackoverflow.com/comment/37461009
has answer: http://stackoverflow.com/a/63229131
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37444951
has body: I want to write a new line using a FileOutputStream; I have tried the following approaches, but none of them are working: encfileout.write('\n'); encfileout.write("\n".getbytes()); encfileout.write(System.getProperty("line.separator").getBytes());
answer count: 5
has comment: http://stackoverflow.com/comment/37444824
score: 21
tagged with: newline
tagged with: java
has comment: http://stackoverflow.com/comment/37448108
has comment: http://stackoverflow.com/comment/37444795
tagged with: fileoutputstream
has answer: http://stackoverflow.com/a/64230295
has title: How to write new line in Java FileOutputStream
accepted answer: http://stackoverflow.com/a/24251559
has comment: http://stackoverflow.com/comment/37444669

http://stackoverflow.com/a/24125096
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24124280
has body: I'm guessing you don't have the text *n@domain* in you're field. Rather you have n@domain somewhere in the middle of a term (or so you believe). There are a few problems you are likely to run into. I will assume your field uses StandardAnalyzer. First, no wildcards in phrase queries. field:"query terms" is a phrase query, meaning a match can span multiple (post-analysis) terms. Query parser syntax does not include any support of wildcards in phrase queries. As such that asterisks in your query were just that, literal asterisks. Second, now you are searching for email:*n@domain*, much better, but still no luck. Wildcard queries bypass analysis, and chances are your email is analyzed in the index. For an entry like: "test@domain.com", you actually probably ave three terms "test", "domain" and "com". You can make the field un-analyzed to search like what you have indicated here, but that's really up to you to determine if that is the correct approach. Once you've got that worked out, you may have something working, but may notice that performance if terrible. Leading wildcard are often disabled by default, because they lead to awful performance, since they require a linear scan of all terms in order to enumerate matches, rather than making effective use of the index. There are strategies to allow leading wildcards without the brutal hit to performance, such as ReversedWildcardFilter
score: 2
has comment: http://stackoverflow.com/comment/37307169
upvote count: 2
answers question: http://stackoverflow.com/q/24124280
downvote count: 0

http://stackoverflow.com/a/24331397
score: 1
type: Answer
has body: there is no suppose to be any problem updating in high frequency a EditText using Handler + delayed Runnable or AasyncTask with onProgressUpdate() callback. I can tell you that I did it lot's of times, with interval of 30-100 milliseconds, and it worked great. that's what leading me to believe you are doing something else wrong. please post your code. my feeling is that you are performing other code that blocks the UI thread for not reasonable amount of time (more then few milliseconds), and because of that - the part of the code that running your EditText update on the UI thread is limited. blocking the main thread usually happens when performing in it IO file operations, database writings, image decodings or other heavy calculations, so if you have one of those on the main thread - they would be the blame.
answers question: http://stackoverflow.com/q/24226933
has comment: http://stackoverflow.com/comment/37872504
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37636303

http://stackoverflow.com/comment/37477575
score: 0
comment on: http://stackoverflow.com/q/24258827
type: Comment
type: QuestionComment
has text: Then you need to provide more code. Show us the code segment which is refering to `myPanel` and everything 'between' them. There must be some other NamingContainer in between!

http://stackoverflow.com/a/24208098
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24207613
has body: The whole InputStream implementation could be avoided if you allow your method to accept an java.io.Writer. Instead of appending Strings to the in-memory StringBuilder, you append them to the provided Writer. public void exportAsCsv(CqlQuery query, Writer writer) { Iterator&lt;String&gt; result = queryService.execute(.....); for (String nextLine : result) { writer.append(nextLine); } } If you really want an InputStream, though, you could try something like this: public InputStream exportAsCsv(CqlQuery query) { Iterator&lt;String&gt; result = queryService.execute(.....); return new SequenceInputStream(asStreamEnum(result)); } private Enumeration&lt;InputStream&gt; asStreamEnum(final Iterator&lt;String&gt; it) { return new Enumeration&lt;InputStream&gt;() { @Override public boolean hasMoreElements() { return it.hasNext(); } @Override public InputStream nextElement() { try { return new ByteArrayInputStream(it.next().getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } }; } I haven't actually tested this approach yet, so be warned; conceptually, though, I think this is what you're after.
type: Answer
accepted answer of: http://stackoverflow.com/q/24207613
has comment: http://stackoverflow.com/comment/37396755

http://stackoverflow.com/comment/37252043
score: 0
type: Comment
type: AnswerComment
has text: So first remove the items from the list with list.remove(position) and save it again.
comment on: http://stackoverflow.com/a/24131775

http://stackoverflow.com/q/24147372
has comment: http://stackoverflow.com/comment/37262900
upvote count: 0
downvote count: 2
has body: I like creating public helpers for private members when creating functions. I made a public helper public void create(String key, String value) { ... } for a private member private void create(String key, String value) { ... } Now, I am overloading the private member and know I need to do so in Java by Method signature (type or quantity) and I am unable to overload by return type. Thus, I decide to modify my private member to accept a boolean argument. private void create(String key, String value, boolean status) { ... } I admit this parameter is not one I plan to use or consider. Have I become complacent to accept poor coding behavior? The public helper merely calls the private member passing supplied arguments public void create(String key, String value) { create(key, value, true); }
has comment: http://stackoverflow.com/comment/37264073
has comment: http://stackoverflow.com/comment/37263774
has comment: http://stackoverflow.com/comment/37263396
answer count: 1
has comment: http://stackoverflow.com/comment/37263708
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37263764
has comment: http://stackoverflow.com/comment/37262908
has answer: http://stackoverflow.com/a/24148166
tagged with: overloading
accepted answer: http://stackoverflow.com/a/24148166
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37263586
has comment: http://stackoverflow.com/comment/37263668
linked to: http://stackoverflow.com/q/16149285
tagged with: standards
has comment: http://stackoverflow.com/comment/37263925
score: -2
tagged with: java
has title: Method Overloading; Naming Helper Method
has comment: http://stackoverflow.com/comment/37262980
has comment: http://stackoverflow.com/comment/37263888
has comment: http://stackoverflow.com/comment/37263664
has comment: http://stackoverflow.com/comment/37263874
has comment: http://stackoverflow.com/comment/37264914
has comment: http://stackoverflow.com/comment/37263486

http://stackoverflow.com/comment/37401938
score: 0
type: AnswerComment
has text: can you do it in the context in which I am trying to instead of just showing the value of field
type: Comment
comment on: http://stackoverflow.com/a/24220968

http://stackoverflow.com/comment/37416291
type: Comment
has text: I like your design! Your export job is nicely decouppled, you have no swing components in there.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24228513

http://stackoverflow.com/comment/37476702
comment on: http://stackoverflow.com/q/24260019
score: 0
type: Comment
type: QuestionComment
has text: Can you try with `this.logo = new ImageView("/assets/img/myImage.jpg");`? That should start looking from the root of your folder.

http://stackoverflow.com/comment/37489788
comment on: http://stackoverflow.com/q/24265573
score: 0
type: Comment
type: QuestionComment
has text: yes. the request: localhost:8080/rest/images

http://stackoverflow.com/q/24106844
score: 0
has title: Updating multiple JFrame elements faster while looping through 2d Array
answer count: 0
has comment: http://stackoverflow.com/comment/37188369
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37188807
type: Question
has body: I'm creating a version of Conway's game of life and it's working fine, however when the the 2D array gets larger you can see the game updating line by line (as it is looping through the array). The method below is what I'm using to update the game. cellList is the array containing each cell's state. 1 = alive, 0 = dead. The method is drawing a rectangle for each cell in the array. Is there a way to loop through the array faster? This is the first time I've really used swing for a project so I'm not familiar with what else I could use. Thanks! public void paintCells() { Graphics g = getGraphics(); for(int x=0;x&lt;cellList.length;x++) { for(int y=0;y&lt;cellList.length;y++) { int rectX = winX/width * y; int rectY = winY/height * x; int rectWidth = winX/width; int rectHeight = winY/height; if(cellList[x][y] == 1) { g.setColor(Color.GREEN); g.fillRect(rectX, rectY, rectWidth, rectHeight); } else { g.setColor(Color.BLACK); g.fillRect(rectX, rectY, rectWidth, rectHeight); } } } Solved Viewing the program on a monitor connected by HDMI updated arrays as big as 700x700 smoothly. I think the main cause of the problem was the fact that I was using an older monitor connected by VGA.
has comment: http://stackoverflow.com/comment/37187170
has comment: http://stackoverflow.com/comment/37187232
tagged with: multidimensional-array
type: UnansweredQuestion
tagged with: arrays
has comment: http://stackoverflow.com/comment/37188961
has comment: http://stackoverflow.com/comment/37188988
tagged with: optimization

http://stackoverflow.com/a/24143818
type: Answer
has comment: http://stackoverflow.com/comment/37256490
score: 2
has body: Create a HashMap mapping strings to Action objects: Map&lt;String,Action&gt; map = new HashMap&lt;String,Action&gt;(); map.put("MOVE", new ActionMove()); map.put("KILL", new ActionKill()); And then get the prefered value: Action a = map.get(type); a.perform(); Or whatever you need. If you're looking for classes with static methods, you can do reflection, but you're doing it wrong. You probably want to modify your code to use objects instead of classes.
answers question: http://stackoverflow.com/q/24143765
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/37423703
type: Comment
has text: Are you taking care to be sure that your `Thread.sleep(...)` being called off of the Swing event thread?
type: QuestionComment
comment on: http://stackoverflow.com/q/24232462
score: 0

http://stackoverflow.com/a/24204760
has comment: http://stackoverflow.com/comment/37371464
upvote count: 1
has body: Something similar does happen behind the scenes (at least with .NET). NGen can cache native images in the native image cache, so that your code won't have to be compiled a second time on that machine. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead of using the just-in-time (JIT) compiler to compile the original assembly.
answers question: http://stackoverflow.com/q/24204638
has comment: http://stackoverflow.com/comment/37370977
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37370883
downvote count: 0

http://stackoverflow.com/a/24258523
score: 2
upvote count: 2
downvote count: 0
has body: A simple way to set the libraries of an EAR package is to create a lib folder right under the the EAR root and put your libraries inside. In this case you will have something like this in your EAR: META-INF/MANIFEST.MF META-INF/application.xml MyWebService1.war MyWebService2.war lib/commons-codec-1.2.jar lib/MyWebService1.jar lib/MyWebService2.jar EJB_Bean.jar
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37656133
accepted answer of: http://stackoverflow.com/q/24256803
type: Answer
answers question: http://stackoverflow.com/q/24256803

http://stackoverflow.com/q/24214650
has answer: http://stackoverflow.com/a/24214736
favorite count: 0
has body: please compare two code snippets: snippet1: class Ideone { public static void main (String[] args) throws java.lang.Exception { Child&lt;String&gt; p =new Child&lt;String&gt;(); p.m("1"); } } class Parent &lt;T&gt;{ void m(T t){ } } class Child&lt;T extends CharSequence&gt; extends Parent&lt;String&gt;{ void m(T t){ } } result(online compiler): Main.java:13: error: reference to m is ambiguous, both method m(T#1) in Parent and method m(T#2) in Child match p.m("1"); ^ where T#1,T#2 are type-variables: T#1 extends Object declared in class Parent T#2 extends CharSequence declared in class Child snippet2(only one change!!!): class Ideone { public static void main (String[] args) throws java.lang.Exception { Parent&lt;String&gt; p =new Child&lt;String&gt;(); p.m("1"); } } class Parent &lt;T&gt;{ void m(T t){ } } class Child&lt;T extends CharSequence&gt; extends Parent&lt;String&gt;{ void m(T t){ } } this code compiles good!(online compiler) please clarify this diference.
type: Question
has answer: http://stackoverflow.com/a/24214732
accepted answer: http://stackoverflow.com/a/24214717
downvote count: 0
tagged with: overriding
has comment: http://stackoverflow.com/comment/37390503
tagged with: type-erasure
has answer: http://stackoverflow.com/a/24214717
possible better answer: http://stackoverflow.com/a/24214732
type: AnsweredQuestion
tagged with: overloading
answer count: 3
has comment: http://stackoverflow.com/comment/37390537
score: 1
tagged with: java
upvote count: 1
tagged with: generics
has title: java generic inheritance. overloading or overriding

http://stackoverflow.com/comment/118154254
type: AnswerComment
comment on: http://stackoverflow.com/a/24207431
score: 0
type: Comment
has text: Could you provide, please, detailed analysis or examples showing how this improves performance? Or links to articles/researches?

http://stackoverflow.com/q/24142788
has comment: http://stackoverflow.com/comment/37254077
tagged with: java
has title: emulate key press on remote machine
type: Question
has body: My automated test needs to emulate a keyboard press on a remote machine (something like CTRL+V) Testing framework is java based so, is it possible (and how) to do that in java?
score: 0
tagged with: keypress
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/24143001

http://stackoverflow.com/q/24260863
tagged with: variables
downvote count: 1
has comment: http://stackoverflow.com/comment/37478206
has comment: http://stackoverflow.com/comment/37477892
favorite count: 0
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/37477946
score: 1
tagged with: java
has body: I have a problem in this client TCP/IP program, in the "paint" part, the X and Y variables are always = 0 Why is that? how can i fix it to take the values sent by the Server? import java.io.*; import java.net.*; import java.applet.*; import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.Scanner; public class TCPClient extends java.applet.Applet { public static int X; public static int Y; public static void main(String argv[]) throws Exception { //while (true){ InetAddress IPHost = InetAddress.getLocalHost(); Socket ClientSocket = new Socket(IPHost, 6789); DataOutputStream outToSurver = new DataOutputStream(ClientSocket.getOutputStream()); InputStreamReader innSocket = new InputStreamReader (ClientSocket.getInputStream()); BufferedReader inFromServer = new BufferedReader(innSocket); TCPClient.X = Integer.parseInt(inFromServer.readLine()); TCPClient.Y = Integer.parseInt(inFromServer.readLine()); Point Location = new Point(X,Y); System.out.println("The location is at :" + Location); ClientSocket.close(); //} } public void paint( Graphics g ) { g.drawString( "My Map", TCPClient.X, TCPClient.Y); System.out.println("X="+TCPClient.X+"Y="+TCPClient.Y); } }
has comment: http://stackoverflow.com/comment/37478042
tagged with: paint
has comment: http://stackoverflow.com/comment/37477965
has comment: http://stackoverflow.com/comment/37478261
answer count: 0
upvote count: 2
type: UnansweredQuestion
has title: Variable equals zero and doesn't change in the "paint" part

http://stackoverflow.com/a/24162793
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24162460
has body: The solution is to provide a FakeApplication (of course...) For example, by the wrapping class WithApplication : WithApplication app = new WithApplication(); app.startPlay(); Configuration.root().getString(key); app.stopPlay();
answers question: http://stackoverflow.com/q/24162460
type: Answer
has comment: http://stackoverflow.com/comment/61305929

http://stackoverflow.com/comment/37300855
type: QuestionComment
comment on: http://stackoverflow.com/q/24166747
has text: Indeed, don't create a pool per request. A single pool must exist in the app. Per request, you add the callable to the pool.
score: 0
type: Comment

http://stackoverflow.com/q/24236361
type: UnansweredQuestion
has body: I am using the JDI to debug a program. I am trying to change the value of a field in a certain ObjectReference. I have the Field object, as I can find it through ObjectReference.referencetype().allFields() However, I cannot modify that field using ObjectReference.setValue(Field paramField, Value paramValue) since that only works on Fields inside this class or its direct superclass -- does not included higher classes up the hierarchy. Is it possible to change the value of a Field in a class higher than the direct super class? If so, I would appreciate any help to do so! Thank you, Dean EDIT: I am getting the following Error thrown at the line where I call ObjectReference.setValue(): Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.sun.tools.jdi.MirrorImpl.validateMirror(MirrorImpl.java:49) at com.sun.tools.jdi.ObjectReferenceImpl.setValue(ObjectReferenceImpl.java:214)
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24243445
tagged with: java
tagged with: jdi
has answer: http://stackoverflow.com/a/31561245
type: Question
has title: JDI - ObjectReference.setValue() on an inherited field

http://stackoverflow.com/a/24881901
type: Answer
has body: Make a phone call programatically using Libgdx Look if this answer is good for you. I'm using libgdx and I'm trying to make able the app to do phonecall using both android and iOS. But, if in Android is simple doing this using the native, in the other hand I cannot find a way to do the same for iOS in java without using objective c.
answers question: http://stackoverflow.com/q/24149942
score: 0

http://stackoverflow.com/comment/37466518
type: QuestionComment
comment on: http://stackoverflow.com/q/24254507
score: 0
has text: 1) Please post the "massive error" messages. 2) You should never have an empty catch block like you show above, not unless you also like driving your car with your eyes closed.
type: Comment

http://stackoverflow.com/a/24119047
accepted answer of: http://stackoverflow.com/q/24118882
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24118882
has body: Easiest way to do this is with two left outer self joins. Use Coalesce to display not found when the build_id was not found. SELECT DISTINCT a.Name, COALESCE(a1.build_id,'Not Found'), COALESCE(a2.buildId,'Not Found') FROM Artifact a LEFT OUTER JOIN Artifact a1 ON a1.Name = a.Name LEFT OUTER JOIN Artifact a2 ON a2.Name = a.Name WHERE a1.Environment = 'UAT 2' AND a2.Environment = 'SIT 2'
type: Answer
score: 0

http://stackoverflow.com/q/24199640
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24199719
has body: comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JComboBox comboBox = (JComboBox) event.getSource(); Object selected = comboBox.getSelectedItem(); switch(selected.toString()){ //some actions based on String picked default: break; } } }); i dont know which parameter must have .removeActionListener() method to remove action listener and change content of comboBox.
tagged with: combobox
has answer: http://stackoverflow.com/a/24199719
has title: remove action listener form comboBox , but cant find parameter
answer count: 2
has comment: http://stackoverflow.com/comment/37361260
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/24199705
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24199705

http://stackoverflow.com/q/24182096
upvote count: 1
tagged with: java
has title: What is fragment_main?
linked to: http://stackoverflow.com/q/22289164
has body: I've recently setup eclipse and the android SDK on a new computer but I fear something has gone wrong when setting it up. When I create a new android project with a blank activity two files I've never seen before appear: fragment_main.xml and appcompat_v7_2 What are they and do I need to worry about them?
has comment: http://stackoverflow.com/comment/37327226
linked to: http://stackoverflow.com/q/22261288
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37327313
tagged with: android
score: -3
has comment: http://stackoverflow.com/comment/37327275
possible better answer: http://stackoverflow.com/a/24182180
tagged with: eclipse
downvote count: 4
has answer: http://stackoverflow.com/a/24182180
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24182201
answer count: 2
accepted answer: http://stackoverflow.com/a/24182201

http://stackoverflow.com/comment/37486171
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24265004
has text: The complaint about serialVersionUID says that a file is read, serialized (saved) from java objects having a version 2, whereas your classes have a version 1. Start looking for newer classes. Sorry.
type: Comment

http://stackoverflow.com/comment/37285441
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24159385
has text: The method was just to show that I'm casting to a `B` as an interim step. And so for some `B`s it can work at runtime.

http://stackoverflow.com/q/24241360
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37442522
upvote count: 1
has title: Eclipse Android Imported existing projects Accidently replaced and project all gone
has comment: http://stackoverflow.com/comment/37441790
has body: I updated the ADT and imported the projects. Unfortunately, I replaced the projects/folder. All of sudden, all the files in the folder became 0 bytes, including files in sub folders and all the current auto backups. Is there any other way to recover?and why this all 0bytes happened? I had tested decompiling my apk from mobile with this and Differente decompilers. but, couldn't all the codes and obstucted codes. and most of the decompiler resulted errors.
favorite count: 0
has comment: http://stackoverflow.com/comment/37441524
has comment: http://stackoverflow.com/comment/37443055
has comment: http://stackoverflow.com/comment/37441964
score: 1
has comment: http://stackoverflow.com/comment/37441176
tagged with: android
tagged with: java
tagged with: decompiling
tagged with: dex2jar
has answer: http://stackoverflow.com/a/24241476
type: Question
tagged with: apktool
linked to: http://stackoverflow.com/q/3593420
has comment: http://stackoverflow.com/comment/37442170
has comment: http://stackoverflow.com/comment/37441600
type: UnansweredQuestion

http://stackoverflow.com/comment/37241768
score: 0
type: Comment
type: AnswerComment
has text: Ok but the question here would be, how many times the guy expect to create the schema?. I never have to worry about to let Hibernate to create the schema because is something that I do just one time per machine.
comment on: http://stackoverflow.com/a/24136007

http://stackoverflow.com/comment/37299074
has text: @AndrewThompson Its not due as an assignment, I'm doing it on my own time. I want people on multiple platforms to be able to use the applet which will be hosted on my website. I am aware that Java Web Start is a viable option so I may look into that more, however default Java runtime settings don't allow self-signed Web Start apps to run so I would have to spend hundreds on a signed certificate for people to use it without changing their settings.
score: 0
comment on: http://stackoverflow.com/q/24144497
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37341050
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24188984
has text: Thank you so much :) Don't worry, I can handle Lisp-like languages and RPN (being Polish myself, huh). I can't test your solution (because it's commercial). Your solution is pretty similar in what I would expect of implementing an ANTLR grammar and working from there. After a day's worth of research I can see how complex the problem is. I'm marking your answer as a solution, because it does extensively answer my question, better than any other answer to a similar question to mine ever has in my opinion.

http://stackoverflow.com/comment/37192895
comment on: http://stackoverflow.com/a/24109594
type: AnswerComment
has text: @Runemoro//Sympa je savais pas.Merci a toi.
score: 0
type: Comment

http://stackoverflow.com/comment/37852618
type: AnswerComment
has text: Are you sure you are calling the exact same methods, and you have the same things going on? Do you try to send the Packet only after the connection has been made? Try sending the Packet in the Connected callback like I did in the example.
score: 0
comment on: http://stackoverflow.com/a/24452428
type: Comment

http://stackoverflow.com/q/24259394
has answer: http://stackoverflow.com/a/25256776
upvote count: 6
tagged with: google-bigquery
tagged with: java
tagged with: google-cloud-storage
has comment: http://stackoverflow.com/comment/37514401
has body: I want to upload data from Google Cloud Storage to table in Big Query. There is my code to create job: public class LoadStorageToBigQuery { // /////////////////////// // USER GENERATED VALUES: you must fill in values specific to your // application. // // Visit the Google API Console to create a Project and generate an // OAuth 2.0 Client ID and Secret (http://code.google.com/apis/console). // Then, add the Project ID below, and update the clientsecrets.json file // with your client_id and client_secret // // /////////////////////// private static final String PROJECT_ID = "gavd.com:compute"; private static final String CLIENTSECRETS_LOCATION = "/client_secrets.json"; private static final String RESOURCE_PATH = ("E:/Work On/ads/Cloud/Dev/Source/BigQueryDemo02" + CLIENTSECRETS_LOCATION).replace( '/', File.separatorChar); static GoogleClientSecrets clientSecrets = loadClientSecrets(); // Static variables for API scope, callback URI, and HTTP/JSON functions private static final List&lt;String&gt; SCOPES = Arrays .asList("https://www.googleapis.com/auth/bigquery"); private static final String REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob"; private static final HttpTransport TRANSPORT = new NetHttpTransport(); private static final JsonFactory JSON_FACTORY = new JacksonFactory(); private static GoogleAuthorizationCodeFlow flow = null; /** * @param args * @throws IOException * @throws InterruptedException */ public static void main(String[] args) throws IOException, InterruptedException { System.out.println(CLIENTSECRETS_LOCATION); // Create a new BigQuery client authorized via OAuth 2.0 protocol Bigquery bigquery = createAuthorizedClient(); // Print out available datasets to the console listDatasets(bigquery, "publicdata"); JobReference jobId = startQuery(bigquery, PROJECT_ID); System.out.println("Job ID = " + jobId); JobReference jobRef = startQuery(bigquery, PROJECT_ID); checkQueryResults(bigquery, PROJECT_ID, jobRef); } /** * Creates an authorized BigQuery client service u…
favorite count: 0
type: Question
answer count: 2
has title: How to load data from Cloud Storage into BigQuery using Java
has answer: http://stackoverflow.com/a/24281088
has comment: http://stackoverflow.com/comment/37516305
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37550201
has comment: http://stackoverflow.com/comment/37513547
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/37551404
has comment: http://stackoverflow.com/comment/37554433

http://stackoverflow.com/comment/37304279
type: Comment
has text: jjs I still can't get your question exactly. Can you please clarify it.
type: AnswerComment
comment on: http://stackoverflow.com/a/24148244
score: 0

http://stackoverflow.com/q/24109280
has body: I'm stuck with this. I have to send messages to a server to receive the data that I need. There is a field after the message's header which is "Length": The length is the total number of bytes in the payload, which includes all instances of the Param and Delim fields and excludes the header and framing characters. The length is a 4-byte unsigned long in network order (big endian). The only two examples in the documentation are these: if payload is 5022=LoginUser|5028=abc|5029=def|5026=1 the length field is &lt;0x00>&lt;0x00>&lt;0x00>&lt;0x27> if payload is 5022=Subscribe|4=558|5026=2 the length field is &lt;0x00>&lt;0x00>&lt;0x00>&lt;0x1B> I've tried some approaches without success. Any idea on how to handle with this would be very appreciated. Thank You
score: -1
has answer: http://stackoverflow.com/a/24109406
possible better answer: http://stackoverflow.com/a/24109406
has answer: http://stackoverflow.com/a/24109351
accepted answer: http://stackoverflow.com/a/24109351
type: AnsweredQuestion
answer count: 2
upvote count: 0
tagged with: java
downvote count: 1
favorite count: 0
type: Question
has title: how can i calculate the length of a string in 4-byte unsigned long in network order (big endian) in Java

http://stackoverflow.com/comment/37344186
score: 1
type: Comment
type: AnswerComment
has text: Right, but my point is that if the end result that the OP wants is a `List`, then they're going to need a `List<Integer>` -- you can't have a `List<int>`. So in that case, a `Stream<Integer>` works just fine. It has equivalent `concat` and `distinct` methods, too.
comment on: http://stackoverflow.com/a/24189656

http://stackoverflow.com/q/24117871
has answer: http://stackoverflow.com/a/24170464
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7745959
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37317358
score: 0
tagged with: batch-file
has body: I want to automate a batch file. Which takes two arguments run-time one after another. Following are the manual steps i do to execute this batch file-- 1-Execute a ext.bat file from command line. 2- Asks for a path- Please enter the path for code 3-Manual entry-- c:/ 4- Press enter key. 5- Asks for folder name. Please enter the directory name 6-Manual entry-- mydir 7-Press enter key. Is there any way similar expect(works only with .sh script). Adding following more details --- This Batch file internally calls a standalone java class -- Following is the batch file @echo off setlocal set classpath=C:\Users\abc\Documents\jar\instance.jar;%classpath% "%JAVA_HOME%"\bin\java nstance.ABCUtil That asks two questions one by one. following is the calling part in the class. This ABCUtil class final Console console = System.console(); // Read Instance absolute directory from the console final String DirHome = console.readLine(abc.HOME_ABSOLUTE_path); final String Dir = console.readLine(abc.HOME_ABSOLUTE_DIR_name); so it will take value only from console ... I can not call like this. this wont work. java ABCUtil path dir Note - I can not install any additional tools to do this like TCL ,cygwin ETC. My M/C has os- windows 7 64 bit Please help-- Dear Masters....
tagged with: windows
tagged with: java
has answer: http://stackoverflow.com/a/24178974
has answer: http://stackoverflow.com/a/24181858
answer count: 4
has title: Need to automate a batch file which takes two arguments runtime one after another
has comment: http://stackoverflow.com/comment/37319703
linked to: http://stackoverflow.com/q/615948
has comment: http://stackoverflow.com/comment/37322196
possible better answer: http://stackoverflow.com/a/24124036
tagged with: batch-processing
accepted answer: http://stackoverflow.com/a/24178974
tagged with: expect
has answer: http://stackoverflow.com/a/24124036
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/24139038
has body: I need to validate a date with format yyyy/MM/dd using a regex pattern. I already have a regex for the format dd/MM/yyyy. (0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d) I'm using the validation from this link http://www.mkyong.com/regular-expressions/how-to-validate-date-with-regular-expression. I need the validation for yyyy/MM/dd. Can anyone help me?
upvote count: 3
score: -2
downvote count: 5
has answer: http://stackoverflow.com/a/24139273
has comment: http://stackoverflow.com/comment/37247083
favorite count: 0
has title: Regex pattern for date format yyyy/MM/dd
has answer: http://stackoverflow.com/a/45953451
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27801625
has comment: http://stackoverflow.com/comment/37246923
has answer: http://stackoverflow.com/a/48206557
has answer: http://stackoverflow.com/a/48208810
tagged with: java
has comment: http://stackoverflow.com/comment/37246924
has answer: http://stackoverflow.com/a/28764050
tagged with: regex
accepted answer: http://stackoverflow.com/a/24298777
possible better answer: http://stackoverflow.com/a/27801625
has comment: http://stackoverflow.com/comment/37247793
has answer: http://stackoverflow.com/a/24298777
type: Question
has answer: http://stackoverflow.com/a/29237446
has comment: http://stackoverflow.com/comment/37246913
answer count: 8

http://stackoverflow.com/q/24238293
tagged with: ieee-754
has body: Java is totally compatible with IEEE 754 right? But I'm confused about how java decide the sign of float point addition and substraction. Here is my test result： double a = -1.5; double b = 0.0; double c = -0.0; System.out.println(b * a); //-0.0 System.out.println(c * a); //0.0 System.out.println(b + b); //0.0 System.out.println(c + b); //0.0 System.out.println(b + c); //0.0 System.out.println(b - c); //0.0 System.out.println(c - b); //-0.0 System.out.println(c + c); //-0.0 I think in the multiplication and division, the sign is decided like: sign(a) xor sign(b), but I wonder why 0.0 + -0.0 = 0.0, how does Java decide the sign in addition and substraction? Is it described in IEEE 754? Also I found Java can somehow distinguish the similarities between 0.0 and -0.0, since System.out.println(c == b); //true System.out.println(b == c); //true How does "==" in java works? Is it treated as a special case?
upvote count: 8
has answer: http://stackoverflow.com/a/24247967
answer count: 5
has answer: http://stackoverflow.com/a/24238344
possible better answer: http://stackoverflow.com/a/24238344
has answer: http://stackoverflow.com/a/28883018
has title: 0.0 and -0.0 in Java (IEEE 754)
score: 8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37435116
tagged with: java
has answer: http://stackoverflow.com/a/24238359
accepted answer: http://stackoverflow.com/a/24238359
downvote count: 0
has answer: http://stackoverflow.com/a/25339310
tagged with: floating-point
has comment: http://stackoverflow.com/comment/37438577
favorite count: 0
type: Question

http://stackoverflow.com/q/24244771
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24245092
type: UnansweredQuestion
score: 1
has title: Strategy or dessign pattern to restrict creation of objects
tagged with: java
has body: Let´s say I have implemented the class Dog: public class Dog { private String breed; private Set&lt;Colour&gt; colours; } I have also implemented a function to parse information about available dogs from an external file. Afterwards, I have a collection of Dog objects (e.g. doberman, chihuahua, husky, golden). Within each dog, there is the name of the breed and a set of available colours for each breed (e.g. for golden: yellow, cinamon, white). Moreover, I want to let the user create House objects. Each House might contain a Dog as an attribute, but I want to restrict the options, so the user must be able to create only dogs specified within my collection. The user must not be able to create a "yorkshire" or a "beagle", nor green or blue chihuahuas. Which strategy or dessign pattern should I use? Extra: I am developing a library (or framework, it is not clear yet). My task is to offer an API, a bunch of functions the user might need.
tagged with: restriction
answer count: 1
downvote count: 0
upvote count: 1
tagged with: design-patterns

powermock
type: Tag
tags question: http://stackoverflow.com/q/24113794
tag name: powermock
tags question: http://stackoverflow.com/q/24158975
tags question: http://stackoverflow.com/q/24141580

http://stackoverflow.com/comment/37359746
has text: Any one aware of such scenario, please reply, its extremely urgent for me
comment on: http://stackoverflow.com/q/24126497
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24264283
type: AcceptedAnswer
downvote count: 0
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24263769
type: Answer
answers question: http://stackoverflow.com/q/24263769
has body: The use of raw types, i.e. generic types without specifying a type argument exists for backward compatibility with pre-Generic code only. Therefore, you can’t use generic methods together with a raw type. This is a design decision made when Generics were introduced. You are using the raw type NumberHolder of the generic type NumberHolder&lt;N extends Number&gt;. When invoking the method getNumberName() on a raw type, the generic signature is ignored and an Optional (the raw type of Optional&lt;String&gt;) is used. Then, when assigning the return value of the raw type Optional to a variable of the generic type Optional&lt;String&gt;, a warning is generated. You don’t need to specify an actual type for the type parameter when you don’t use it. Just changing the declaration of numberHolder from NumberHolder numberHolder to NumberHolder&lt;?&gt; numberHolder would be enough. Then, it is not a raw type anymore and the generic signature of its method will be used, making the warning disappear.

http://stackoverflow.com/comment/37375136
comment on: http://stackoverflow.com/a/24206870
score: 0
has text: Thank you. I definitely looked passed this.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37354935
score: 1
comment on: http://stackoverflow.com/a/24196218
type: Comment
has text: Doesn't answer the question... "I am trying to make a loop that iterates until the wage entered is an integer". Also, nextInt is bad for stdin, it doesn't look at the whole line to see that it's valid, and it leaves any other words/integers on the line.
type: AnswerComment

http://stackoverflow.com/comment/37363550
score: 0
has text: Any suggestions on how to redesign my code? I've had this happen in regular activities as well, so I'm not sure if it is related to fragment.
type: Comment
comment on: http://stackoverflow.com/a/24179743
type: AnswerComment

http://stackoverflow.com/comment/37447012
type: AnswerComment
has text: @Pavan Could you explain why it's not what you're looking for so the answer can be amended/another answer provided?
comment on: http://stackoverflow.com/a/24243457
score: 0
type: Comment

http://stackoverflow.com/comment/37279740
score: 2
comment on: http://stackoverflow.com/q/24156445
type: Comment
type: QuestionComment
has text: GMail most likely does that automatically. You would have to send a HTML mail and use the tag `` to make it a "real" link

http://stackoverflow.com/comment/37232607
score: 0
has text: Are you sure that `if (!char.IsLetter(t))` will not prevent str to have `-`? `Character.isLetter` returns false for `-` which causes immediate return of false with code `if (!Character.isLetter(t)) return false;`.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24130941

http://stackoverflow.com/a/24187383
upvote count: 2
downvote count: 0
has body: It could be a little hard to give a thorough answer to this but I know that at least for using Maven/m2e Eclipse needs to be run in a JDK.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24187120

http://stackoverflow.com/comment/37362172
comment on: http://stackoverflow.com/q/24200123
has text: Please show the code of your pojo
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24211427
has answer: http://stackoverflow.com/a/24211453
tagged with: jackson
has answer: http://stackoverflow.com/a/24211488
has title: Jackson: Configuring an Entity for both Xml and JSON formats
favorite count: 0
tagged with: rest
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: http://stackoverflow.com/tag/xml
type: Question
upvote count: 2
score: 2
has body: I can have an Entity which supports JSON format with the help of @JsonPropertyOrder. XML support can be get by using @XmlRootElement, @XmlAttribute, @XmlElement. How can I configure an entity which supports both XML and JSON formats?
answer count: 2
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/tag/rdf
tags question: http://stackoverflow.com/q/24167256
tags question: http://stackoverflow.com/q/24166518
tags question: http://stackoverflow.com/q/24116853
type: Tag
tags question: http://stackoverflow.com/q/24247503
tags question: http://stackoverflow.com/q/24244317
tags question: http://stackoverflow.com/q/24139012
tag name: rdf

http://stackoverflow.com/q/24184085
has body: What does this command mean? oo-cgroup-read memory.failcnt And why the results vary so much?! from 35000 to 80000 after some time The interesting moment that there is no relationship between application speed and that number...
tagged with: openshift
type: AnsweredQuestion
tagged with: jsf
score: 1
tagged with: java
downvote count: 0
answer count: 1
upvote count: 1
has title: Openshift - What does this command mean? oo-cgroup-read memory.failcnt
favorite count: 0
type: Question
tagged with: cloud
has answer: http://stackoverflow.com/a/24185833
accepted answer: http://stackoverflow.com/a/24185833

http://stackoverflow.com/comment/37309636
comment on: http://stackoverflow.com/a/24172037
score: 2
type: Comment
has text: Not sure if it's a problem for the OP, but if he also hopes to get the MainClass instances that are not A, B nor C instances by passing MainClass.class, that won't work. In that case, he'll have to check that the classes are equal.
type: AnswerComment

http://stackoverflow.com/comment/37232436
has text: +1, however, how do you know the OP is using Java 8?
type: AnswerComment
comment on: http://stackoverflow.com/a/24130595
type: Comment
score: 0

http://stackoverflow.com/q/24196627
has answer: http://stackoverflow.com/a/24196666
type: AnsweredQuestion
has title: complicated sql query returning empty result
tagged with: join
tagged with: sql
score: 1
has body: My database looks like this tickets table ------------- ticket_id title description department_id status_id priority_id assignee_id creator_id departments table ------------------ dep_id dep_name status table ------------ status_id status_name priority table --------------- pr_id pr_name users table ----------- u_id username password salt email firstName lastName department_id userlevel_id userlevels table ----------------- ul_id ul_name I need to load all tickets given the asignee id. My query looks like this SQLQuery q = q.createSQLQuery("SELECT t.*,d.*,s.*,p.*,u.*,a.* FROM tickets t, departments d, status s, priority p, users u, attachments a WHERE t.department_id=d.dep_id AND t.status_id=s.stat_id AND t.priority_id=p.pr_id AND t.assignee_id=u.u_id AND t.creator_id=u.u_id AND t.tick_id=a.ticket_id AND assignee_id=?"); q.setInt(0, some_valid_assignee_id); List&lt;Object&gt; result = q.list(); But it's returning an empty object list. Can anyone point me in the right direction, thanks!!
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/24196648
answer count: 2
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/24196666
possible better answer: http://stackoverflow.com/a/24196648
favorite count: 0

http://stackoverflow.com/a/24134674
accepted answer of: http://stackoverflow.com/q/24129053
score: 0
type: AcceptedAnswer
has body: Yes, of course it's possible. Not just for this specific case, but in every GUI framework I know of, if you can add a listener for some event, you can add many such listeners.
type: Answer
answers question: http://stackoverflow.com/q/24129053

http://stackoverflow.com/comment/37248045
type: QuestionComment
has text: Just call `getArrlstValues();`, not `obj.getArrlstValues();`.
score: 0
comment on: http://stackoverflow.com/q/24139537
type: Comment

http://stackoverflow.com/comment/37257894
has text: @ABFORCE do you want to put the answer as an answer? so that I can give you the credits :)
score: 0
comment on: http://stackoverflow.com/q/24143750
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24205194
has comment: http://stackoverflow.com/comment/37395363
answers question: http://stackoverflow.com/q/24204628
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37398344
accepted answer of: http://stackoverflow.com/q/24204628
has comment: http://stackoverflow.com/comment/37397903
upvote count: 2
has comment: http://stackoverflow.com/comment/37399224
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37398471
has body: I am only intrested in the status_code value of the response so creating a pojo class is a waste. Then why do you need to use Gson in the first place. Quoting gson docs "It can be used to convert a JSON string to an equivalent Java object" To just get the status_code your first method should work. Using Gson public class Response { Res response; } Then have public class Res { public String status_code; public String message; public String response_for; public Res(){} } Then InputStreamReader isr = new InputStreamReader (is); Gson gson = new Gson(); Response lis = new Gson().fromJson(isr, Response.class); Log.i("Response is ",""+lis.response.status_code); Log.i("Message is ",""+lis.response.message); Log.i("Response_for is ",""+lis.response.response_for); The Log 06-13 17:55:52.126: I/Response is(8776): 200 06-13 17:55:52.126: I/Message is(8776): User successfully registered. 06-13 17:55:52.126: I/Response_for is(8776): register
has comment: http://stackoverflow.com/comment/37395146
score: 2

http://stackoverflow.com/comment/37447908
score: 0
has text: @DaveNewton: And of course the basic argument: If Maven just makes things more complicated, why would people use it?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24242917

http://stackoverflow.com/comment/37214480
has text: I am trying to get the min and max values of the subset of an Array of maps. The map is not changed, but the method is called repeatedly whenever the position of the map element pointer "index" is pointing to increases. Also, I believe that I have included the code, which should tell you what I am trying to do exactly.
comment on: http://stackoverflow.com/q/24120045
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24461344
answers question: http://stackoverflow.com/q/24239332
has body: You can use the endpoint https://www.googleapis.com/oauth2/v1/tokeninfo to determine if an OAuth2 token is still valid. More information is available in the OAuth2 guide.
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/71507886
upvote count: 2
has comment: http://stackoverflow.com/comment/71413588
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24239332

http://stackoverflow.com/a/24261409
has body: Hashtable is (as good as) deprecated. Use HashMap or ConcurrentHashMap based on whether you want your data to be threadsafe or not.
downvote count: 0
answers question: http://stackoverflow.com/q/24261326
upvote count: 1
score: 1
type: Answer

http://stackoverflow.com/comment/37243076
score: 0
type: Comment
type: AnswerComment
has text: I don't know if this is the only item in the menu but perhaps you can try playing around with the ordering. android:orderInCategory="1"
comment on: http://stackoverflow.com/a/24135377

http://stackoverflow.com/q/24245393
favorite count: 0
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37449895
answer count: 2
has comment: http://stackoverflow.com/comment/37451135
upvote count: 8
score: 8
tagged with: ejb
has answer: http://stackoverflow.com/a/24273023
downvote count: 0
accepted answer: http://stackoverflow.com/a/24301361
has body: I'm observing an unusual behaviour and I would like to understand what is happening. Imagine a simple setup. First I have a stateless bean that just returns something: @Stateless public class SimpleService{ private Map&lt;String, String&gt; map; @PostConstruct public init(){ map = new HashMap&lt;&gt;(); } public Map&lt;String,String&gt; getMap(){ return map; } } Then I have a another stateless bean that does some processing @Stateless public class ProcessService{ private static final Logger log = LoggerFactory.getLogger(ProcessService.class); private static final int MAX = 2000; @Inject private SimpleService simpleService; @TransactionAttribute(TransactionAttributeType.REQUIRED) public void process(){ final long start = System.currentTimeMillis(); for(int i=0; i&lt;MAX; i++){ simpleService.getMap(); } final long end = System.currentTimeMillis(); log.info(MessageFormat.format("Process took {0} ms", end - start)); } } Then I have a simple CDI bean to call the process method. Result: When I call the process method several times in a row, the process time keeps increasing: Process took 900 ms Process took 1,100 ms Process took 1,200 ms Process took 1,400 ms And it keeps going up every time the method is called. How can that be explained? I'm using Java JDK 1.7.0_25 and JBOSS EAP 6.1. EDIT By the way, the only way to 'reset' the processing time for the method is to restart the server.
has comment: http://stackoverflow.com/comment/37449037
has answer: http://stackoverflow.com/a/24301361
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37450565
has comment: http://stackoverflow.com/comment/37448562
possible better answer: http://stackoverflow.com/a/24273023
has title: EJB method takes more time to return after each call
tagged with: java
tagged with: jboss
tagged with: jboss7.x

http://stackoverflow.com/q/24201647
answer count: 2
has comment: http://stackoverflow.com/comment/37365842
upvote count: 1
has comment: http://stackoverflow.com/comment/37366206
has comment: http://stackoverflow.com/comment/37365807
has comment: http://stackoverflow.com/comment/37365148
has comment: http://stackoverflow.com/comment/37366469
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/24202488
has comment: http://stackoverflow.com/comment/37366407
has comment: http://stackoverflow.com/comment/37365133
has comment: http://stackoverflow.com/comment/37366331
has answer: http://stackoverflow.com/a/24202488
has comment: http://stackoverflow.com/comment/37365140
has comment: http://stackoverflow.com/comment/37365193
type: Question
accepted answer: http://stackoverflow.com/a/24237901
has title: Throws NullPointerException while retrieving data from SharedPreferences
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37366455
has answer: http://stackoverflow.com/a/24237901
has body: First of all, sorry for my bad English ! I have an Activity ( say MainActivity.java ) and a class ( say AsynkTaskClass.java ). AsynkTaskClass.java contains an AsynkTask. I am calling this AsynkTask from MainActivity.java. Before calling this AsynkTask, I am saving some data using SharedPreferences. From the onPostExecute function of AsynkTask, I am calling a normal function ( say displaySharedData() )which defined in MainActivity.java. There I am trying to retrieve the data I stored using SharedPreferences. Then It shows a NullPointerException. But I can access the Shared data from anywhere other than this displaySharedData() function. This is the Log Output: W/dalvikvm(3896): threadid=1: thread exiting with uncaught exception E/AndroidRuntime(3896): FATAL EXCEPTION: main E/AndroidRuntime(3896): java.lang.NullPointerExceptionE/AndroidRuntime(3896): at com.samApp.project.samApp.ui.MainActivity.displaySharedData(MainActivity.java:52) E/AndroidRuntime(3896): at com.samApp.project.samApp.s3.AsynkTaskClass$UploadImage.onPostExecute(AsynkTaskClass.java:264) E/AndroidRuntime(3896): at com.samApp.project.samApp.s3.AsynkTaskClass$UploadImage.onPostExecute(AsynkTaskClass.java:1) E/AndroidRuntime(3896): at android.os.AsyncTask.finish(AsyncTask.java:417) E/AndroidRuntime(3896): at android.os.AsyncTask.access$300(AsyncTask.java:127) E/AndroidRuntime(3896): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429) E/AndroidRuntime(3896): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(3896): at android.os.Looper.loop(Looper.java:130) E/AndroidRuntime(3896): at android.app.ActivityThread.main(ActivityThread.java:3683) E/AndroidRuntime(3896): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(3896): at java.lang.reflect.Method.invoke(Method.java:507) E/AndroidRuntime(3896): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) E/AndroidRuntime(3896): at com.android.internal.os.ZygoteInit.main…
has comment: http://stackoverflow.com/comment/37365432
has comment: http://stackoverflow.com/comment/37365747
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37366114
has comment: http://stackoverflow.com/comment/37366058
score: 0
has comment: http://stackoverflow.com/comment/37365243
has comment: http://stackoverflow.com/comment/37365803

http://stackoverflow.com/comment/37195486
type: QuestionComment
comment on: http://stackoverflow.com/q/24111219
score: 1
type: Comment
has text: You've got the label in the wrong place. Don't guess how to do something like this; read the documentation.

http://stackoverflow.com/q/24128256
has title: Parsing a nameless JSON array in Java
has answer: http://stackoverflow.com/a/24128294
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24131546
has body: I'm trying to parse a nameless JSONArray returned from a POST request this format: [{"key": value}, {"key": value}, {"key": value}] I assumed I would just be able to call the array using this segment of code: JSONArray resArr = result.getJSONArray(""); where result is the JSONObject returned by the POST, but I'm getting Cannot parse json request result: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1] Is there some other way to call getJSONArray so that I can get an JSONArray without a key?
type: UnansweredQuestion
tagged with: arrays
score: -1
answer count: 2
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3

http://stackoverflow.com/comment/37215175
has text: **Don't** use `setPreferredSize()` method at all.
comment on: http://stackoverflow.com/q/24121806
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/37455873
type: Comment
score: 0
type: QuestionComment
has text: I would really appreciate if you could show me both examples.
comment on: http://stackoverflow.com/q/24249136

http://stackoverflow.com/comment/37348550
comment on: http://stackoverflow.com/a/24192318
type: Comment
has text: valid path is c:\, c:\newfolder, \\casdfhn\share
score: 0
type: AnswerComment

http://stackoverflow.com/q/24188472
answer count: 1
tagged with: jdbc
has title: Why doesn't Java seem to respect my classpath?
type: Question
has answer: http://stackoverflow.com/a/24188543
has comment: http://stackoverflow.com/comment/37339583
has body: I have the jt400.jar in my directory: /path /jt400.jar /Test.java The contents of Test.java: import java.sql.*; //import com.ibm.as400.*; // To be uncommented later public class Test { public static void main(String[] args) throws Exception { String url = "jdbc:as400//myserver.domain.com;DSN=DB2;Uid=name;Pwd=password;"; Connection conn = DriverManager.getConnection(url); } } I compile this: $ javac -cp jt400.jar Test.java And try to run: $ java -cp jt400.jar Test.java Which produces: Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:as400://myserver.domain.com;DSN=DB2;Uid=name;Pwd=password; at java.sql.DriverManager.getConnection(DriverManager.java:635) at java.sql.DriverManager.getConnection(DriverManager.java:213) at Killer.main(Test.java:8) Now, inside jt400.jar I have verified: $ jar -tf jt400.jar | grep class | grep AS400 | grep Driv com/ibm/as400/access/AS400JDBCDriver.class Yet, when I uncomment the import line, I get Test.java:3: package com.ibm.as400 does not exist import com.ibm.as400.*; So either I completely misunderstand Java's classpath and import mechanism, or it sure seems like it's not respecting the classpath that I provide. How can I solve this problem? I haven't been able to find anything useful on Google or Stackoverflow, but I don't spend much time in Java so I'm sure I'm doing something wrong.
downvote count: 0
accepted answer: http://stackoverflow.com/a/24188543
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37339595
score: 3
has comment: http://stackoverflow.com/comment/37339647
upvote count: 3
tagged with: java

text
tags question: http://stackoverflow.com/q/24104938
tags question: http://stackoverflow.com/q/24204902
tags question: http://stackoverflow.com/q/24227411
tags question: http://stackoverflow.com/q/24192824
tags question: http://stackoverflow.com/q/24113453
tags question: http://stackoverflow.com/q/24247144
type: Tag
tags question: http://stackoverflow.com/q/24108378
tags question: http://stackoverflow.com/q/24110930
tag name: text
tags question: http://stackoverflow.com/q/24230927
tags question: http://stackoverflow.com/q/24185516
tags question: http://stackoverflow.com/q/24207354

http://stackoverflow.com/comment/37334561
has text: That was perfect. Thank you so much! One more question MikeM, is there a simple way to get it to swap duplicates? Right now it just hangs.
score: 0
comment on: http://stackoverflow.com/a/24186049
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37512796
type: Comment
type: QuestionComment
has text: @Baz I'm tring to develop a eclipse plugin and except the main window of eclipse which have min, max button all windows doesn't. From my understanding the OS settings apply for all application not only for swt, and all others have those buttons.
comment on: http://stackoverflow.com/q/24265298
score: 0

http://stackoverflow.com/q/24219669
tagged with: android
tagged with: java
tagged with: send
tagged with: connection
score: 0
has title: Losing String while sending from an android app to a java server
answer count: 0
has comment: http://stackoverflow.com/comment/37402504
tagged with: string
has body: I am writing an android app that handles a connection with an Java server. I can connect to the server (I see it in my console. And I have a savetylog). But now if I send a message from the app to the server, it will get lost on it's way to the server. I don´t see the message on my server. Else on the other way. Any ideas? Here is the code for the GUI: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.WindowConstants; import javax.swing.SwingUtilities; /** * This code was edited or generated using CloudGarden's Jigloo * SWT/Swing GUI Builder, which is free for non-commercial * use. If Jigloo is being used commercially (ie, by a corporation, * company or business for any purpose whatever) then you * should purchase a license for each developer using Jigloo. * Please visit www.cloudgarden.com for details. * Use of Jigloo implies acceptance of these licensing terms. * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE. */ public class Server_Fenster_OBDII extends javax.swing.JFrame { private JButton BtnStart; private JLabel jL; private JButton jBtnBeenden; private JTextField jTFNachricht; private JTextArea jTAVerlauf; private JScrollPane jScrollPane02; private JScrollPane jScrollPane01; private JButton jBtnLoeschen; private JButton jBtnSenden; private JLabel jLNachricht; private JComboBox jCBBefehle; private JLabel jLSpinner; private JScrollPane scrollPane; private TCPServer mServer; /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { SwingUtilities.invokeLater(new Run…
has comment: http://stackoverflow.com/comment/37403469
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/37400818
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24220268
has text: Upcasting is legal, but useless. Using `Object o = (Object) string;` is the same as doing `Object o = string;`.

http://stackoverflow.com/q/24228605
downvote count: 0
has body: I want to write a client based on Netty that connects to a server. The client will be running behind a corporate firewall with a HTTP proxy. I can not find any info if Netty supports connections over proxies OOB or not. In previously situations when I have written clients I always end up doing this support myself when the socket is created but with Netty beeing a popular framework I was hoping that it would support connection over proxies. (The protocol I shall implement is not based on HTTP)
favorite count: 0
type: Question
score: 3
tagged with: network-programming
tagged with: netty
has title: Use Netty as a client from behind a proxy?
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24239087
tagged with: java
answer count: 1

http://stackoverflow.com/comment/37191240
type: AnswerComment
comment on: http://stackoverflow.com/a/24109048
type: Comment
score: 0
has text: In case you need algorithm for various number of digits, my answer below does just that.

http://stackoverflow.com/comment/37426979
type: AnswerComment
comment on: http://stackoverflow.com/a/24234095
type: Comment
has text: thanks, it works. I just wonder that this works: @String.format("%.2f",product.vkBrutto)
score: 0

http://stackoverflow.com/comment/37427965
comment on: http://stackoverflow.com/a/24234209
type: AnswerComment
score: 0
has text: i need the generated html please so i can help further
type: Comment

http://stackoverflow.com/comment/37466816
comment on: http://stackoverflow.com/q/24254527
score: 1
has text: @Mike K, that is because the encoded values are in hex.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37287446
comment on: http://stackoverflow.com/q/24160206
score: 0
type: Comment
type: QuestionComment
has text: This behavior is correct though not every programmer is aware of this.

http://stackoverflow.com/q/24198906
linked to: http://stackoverflow.com/q/3006150
accepted answer: http://stackoverflow.com/a/24199017
favorite count: 0
has answer: http://stackoverflow.com/a/24199058
type: Question
possible better answer: http://stackoverflow.com/a/24199059
has answer: http://stackoverflow.com/a/24199017
linked to: http://stackoverflow.com/q/16205481
linked to: http://stackoverflow.com/q/2592501
has answer: http://stackoverflow.com/a/24199059
score: -2
linked to: http://stackoverflow.com/q/11425236
tagged with: datetime
has body: I've got an object with a field timestamp with type java.sql.Timestamp;. And I need to get objects with yesterday date from a collection. How to get them? I mean I need something like this for(int i = 0; i &lt; items.size(); i++) { (if the items.get(i).date == yesterday_date) (get object) }
duplicate of: http://stackoverflow.com/q/11425236
has comment: http://stackoverflow.com/comment/37359943
has title: get yesterday date from timestamp
type: AnsweredQuestion
answer count: 3
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/14938253
downvote count: 2
has comment: http://stackoverflow.com/comment/37388609

http://stackoverflow.com/comment/37410830
comment on: http://stackoverflow.com/a/24225552
has text: How? It would change every label, not just one.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37333827
type: QuestionComment
has text: You are compiling java 5 or later source code with JDK 1.3.
score: 0
comment on: http://stackoverflow.com/q/24185409
type: Comment

http://stackoverflow.com/comment/37433075
has text: @user2901181 Andrew has set up a simple timer which ticks every second, he then uses a counter to determine how many times the timer has ticked, when it gets to or exceeds 30 (30 seconds) he switches screen states. You can use this counter to determine how many seconds are left (30 - counter)
type: Comment
comment on: http://stackoverflow.com/a/24237069
score: 5
type: AnswerComment

http://stackoverflow.com/comment/102982599
comment on: http://stackoverflow.com/a/24111546
type: AnswerComment
has text: Thanks for pointing that out! I believe that this answer predates the feature change that you linked here - I didn’t realize that the Java folks were working on revising this!
score: 1
type: Comment

http://stackoverflow.com/comment/37279110
comment on: http://stackoverflow.com/a/24155666
score: 0
type: AnswerComment
type: Comment
has text: Did you try removing the resources entry in pom.xml and doing a clean install. Also just make sure the file is present in the war file created.

http://stackoverflow.com/comment/37437847
has text: You could use [Map#entrySet()](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html#entrySet())
comment on: http://stackoverflow.com/q/24239769
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37528256
comment on: http://stackoverflow.com/a/24212801
has text: Thanks Chris! A shame it can't be done in one query, but that works just fine.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37427118
comment on: http://stackoverflow.com/a/24234100
has text: Ah well spotted. 1+. Another reason to use the `@Override` annotation to be sure that your method is in fact a true override.
score: 3
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37445056
type: Comment
score: 0
type: QuestionComment
has text: Nope got a bevy of more errors
comment on: http://stackoverflow.com/q/24242715

http://stackoverflow.com/comment/37465180
comment on: http://stackoverflow.com/q/24253175
score: 0
type: Comment
type: QuestionComment
has text: Although it might seem like a formality to a new programmer, creating self-explaining variable and method names is extremely important. I'm not able to help you because I don't understand what totalmoney1, totalmoney and firstmoney are meant to be used for. I would recommend to focus on better names =)

http://stackoverflow.com/comment/37242641
score: 0
type: Comment
type: QuestionComment
has text: @ Greg: yes I am using that extension point and created my custom decorator. But the decorate() api is not at all getting called.I am using IlightWeightDecorator interface
comment on: http://stackoverflow.com/q/24133364

http://stackoverflow.com/comment/37434131
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24237692
has text: there is any way to add item for description on listview dynamically!

http://stackoverflow.com/comment/38304398
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24672158
type: Comment
has text: True, but the issue is getting the image to display in Eclipse's hover. I've already tried MathJax, and Eclipse doesn't execute JS in the hovers. This works for the HTML output only (which I'm not using).

http://stackoverflow.com/comment/37210536
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24119556
has text: Yes, try one of these: https://www.google.com/search?q=java+soap+client&oq=java+soap+client&aqs=chrome..69i57j0l5.8135j0j7&sourceid=chrome&es_sm=122&ie=UTF-8
score: 0

http://stackoverflow.com/comment/37252377
has text: 1. The url is http://localhost:8080/pdf/example.pdf 2.The error displaying is " file http://localhost:8080/pdf/example.pdf is not found "
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24141235

design-patterns
tags question: http://stackoverflow.com/q/24108052
tags question: http://stackoverflow.com/q/24221465
tags question: http://stackoverflow.com/q/24203310
tags question: http://stackoverflow.com/q/24174973
tags question: http://stackoverflow.com/q/24214148
tags question: http://stackoverflow.com/q/24143765
tags question: http://stackoverflow.com/q/24199383
tags question: http://stackoverflow.com/q/24228649
tags question: http://stackoverflow.com/q/24201356
tag name: design-patterns
tags question: http://stackoverflow.com/q/24264366
tags question: http://stackoverflow.com/q/24185342
tags question: http://stackoverflow.com/q/24222799
tags question: http://stackoverflow.com/q/24238251
tags question: http://stackoverflow.com/q/24212445
tags question: http://stackoverflow.com/q/24167848
tags question: http://stackoverflow.com/q/24262045
tags question: http://stackoverflow.com/q/24228650
tags question: http://stackoverflow.com/q/24159156
tags question: http://stackoverflow.com/q/24128779
tags question: http://stackoverflow.com/q/24239198
tags question: http://stackoverflow.com/q/24244771
tags question: http://stackoverflow.com/q/24187902
tags question: http://stackoverflow.com/q/24122365
tags question: http://stackoverflow.com/q/24151021
type: Tag
tags question: http://stackoverflow.com/q/24251024

http://stackoverflow.com/q/24172298
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37342805
has body: The key codes I get for characters such as ` and / on Windows (or at least on my Windows machine) is different on my laptop with Ubuntu. I use KeyEvent.getKeyCode() to get the key code and java.awt.Robot.keyPress() to get the key however it's not the same or it gives an invalid key code exception. My code is as simple as public void keyPressed(KeyEvent e){ code = e.getKeyCode(); } on the Windows machine and bot.keyPress(code); on the Ubuntu machine. I need to make the keys pressed match. How can I do this?
tagged with: awt
score: 2
has comment: http://stackoverflow.com/comment/37310363
tagged with: keyevent
answer count: 0
has title: Java key codes don't match between OS's or computers
tagged with: java
has comment: http://stackoverflow.com/comment/37310702
has comment: http://stackoverflow.com/comment/37310198
downvote count: 0
has comment: http://stackoverflow.com/comment/37312638
favorite count: 0
has comment: http://stackoverflow.com/comment/37310549
type: Question
upvote count: 2

http://stackoverflow.com/q/24182150
has comment: http://stackoverflow.com/comment/37329005
favorite count: 0
accepted answer: http://stackoverflow.com/a/24405322
type: Question
has answer: http://stackoverflow.com/a/24405322
upvote count: 2
has comment: http://stackoverflow.com/comment/37329782
has comment: http://stackoverflow.com/comment/37328945
has comment: http://stackoverflow.com/comment/37330771
has comment: http://stackoverflow.com/comment/37327699
tagged with: php
has comment: http://stackoverflow.com/comment/37329074
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37329190
has title: Retrieve data from php
score: 2
has comment: http://stackoverflow.com/comment/37329445
tagged with: java
has body: I have a small piece of code that makes a connection with a webpage. When I login Iretrieve the user_id from the database and put that in a textbox. Then I want to retrieve the Firstname and Lastname from the database but when I do that I get a &lt;br/&gt; from the webpage. I cannot find out why I get the &lt;br/&gt; instead of the firstname. This is my php code to handle the request that I get from Java $user_id = $_SESSION['user']; $voornaam = $con-&gt;select('voornaam', 'users', 'id', $user_id); $achternaam = $con-&gt;select('achternaam', 'users', 'id', $user_id); echo $voornaam; public function select($detail, $table, $row, $value) { $query = mysqli_query($this-&gt;connect, "SELECT `$detail` FROM `$table` WHERE `$row` = '$value'"); $associate = mysqli_fetch_assoc($query); return $associate[$detail]; } And this is the code that I use to send the data to php public static String Select() { String mysql_type = "2"; // 2 = Select try { String urlParameters = "mysql_type=" + mysql_type; URL url = new URL("http://localhost:8080/HTTP_Connection/index.php"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); writer.write(urlParameters); writer.flush(); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); while((line = reader.readLine())!= null) { return line; } writer.close(); reader.close(); return reader.readLine(); } catch (IOException iox) { iox.printStackTrace(); return null; } } Can someone explain to me why I get the &lt;br/&gt; instead of the first name? Thanks in advance
answer count: 1
downvote count: 0
tagged with: mysql

http://stackoverflow.com/a/24186685
upvote count: 4
answers question: http://stackoverflow.com/q/24186592
type: Answer
score: 4
has body: Read the official documentation. The Maven Installation Instructions for Windows are pretty simple to follow. Windows Unzip the distribution archive, i.e. apache-maven-3.2.1-bin.zip to the directory you wish to install Maven 3.2.1. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.2.1 will be created from the archive. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.2.1. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven 2.0.9, also be sure that the M2_HOME doesn't have a '\' as last character. In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin. Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven. In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven available in the command line. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.7.0_51 and that %JAVA_HOME%\bin is in your Path environment variable. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.
downvote count: 0
has comment: http://stackoverflow.com/comment/69946055

http://stackoverflow.com/a/24165749
downvote count: 0
type: Answer
has body: You will need to use algebra to solve the two equations, and it will get a little bit messy. First you have to write out the ellipse (1) (x/h)^2 + (y/v)^2 = 1 and the line in the format (2) y = ax + b First, shift over your coordinate axis so the ellipse is centered on the origin. You can do that by subtracting mid from the line. Once you have calculated the points of intersection, shift them back by adding mid. You can calculate the linear slope from delta-y/delta-x from the starting and ending points of the line. You will have to check if the slope is vertical. If the slope is vertical, you just have to check whether or not the x-value of the line points falls in the location of the ellipse, and then easily calculate the values. Draw it out on paper and see how to calculate it. Assume now that the slope is not vertical. Since you know y in terms of x from the line, square that and substitute into (1). Simplifying gives a quadratic equation. (3) ((ah)^2+v^2)x^2 + (2abh^2)x + ((hb)^2-(hv)^2) = 0 Using the quadratic formula gives the two values for the x coordinates of the intersection. If there are two real values for x, there are two intersections. If there is only one real solution for x, there is one intersection. If there are no real solutions for x, there is no intersection. Given ax^2 + bx + c = 0, x is given by x = (1/2a)(-b +- Sqrt(b^2 - 4ac)) Let D = b^2 - 4ac If D &lt; 0, there are no intersections If D = 0, there is one intersection If D > 0, there are two intersections Once you have calculated the values of the x intersection, substitute the values of x into (2) to get the y values. Now, you need to make sure that these points fall within the line. To do this, just check that the x and y components of the calculated points satisfy x1 &lt;= x &lt;= x2 and y1 &lt;= y &lt;= y2 where x1 is the smallest and x2 the largest x-endpoint of the line, and y1 is the smallest and y2 the largest y-endpoint of the line. Here is an example method that I made public stat…
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24164485

http://stackoverflow.com/q/24220970
has comment: http://stackoverflow.com/comment/37402169
score: 0
has comment: http://stackoverflow.com/comment/37403409
has body: I would like to know that if I have following project structure: main project (parent) |--pom.xml sub project (module 1) |--pom.xml sub project 2 (module 2) |--pom.xml Is it possible to push to repository all changes with their current structure by only applying push command to parent project? Would it be also wise to do so? If not, then why? Would it be better to push each of those project individually?
has comment: http://stackoverflow.com/comment/37401943
tagged with: java
accepted answer: http://stackoverflow.com/a/24230392
has comment: http://stackoverflow.com/comment/37404320
has answer: http://stackoverflow.com/a/24230392
answer count: 1
tagged with: maven
tagged with: git
has title: How to Push Maven Project With Modules Using Git?
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/37421755
comment on: http://stackoverflow.com/q/24231460
type: Comment
type: QuestionComment
has text: It's a market link not a http link, but even if I wanted http:// it would still treat the // as commenting out the rest
score: 0

long-integer
tags question: http://stackoverflow.com/q/24141688
tag name: long-integer
type: Tag
tags question: http://stackoverflow.com/q/24174088
tags question: http://stackoverflow.com/q/24265668
tags question: http://stackoverflow.com/q/24222419

awtrobot
tags question: http://stackoverflow.com/q/24245961
type: Tag
tags question: http://stackoverflow.com/q/24221576
tags question: http://stackoverflow.com/q/24245277
tags question: http://stackoverflow.com/q/24214213
tags question: http://stackoverflow.com/q/24240411
tags question: http://stackoverflow.com/q/24106182
tag name: awtrobot

http://stackoverflow.com/a/24170143
answers question: http://stackoverflow.com/q/24170083
type: Answer
has comment: http://stackoverflow.com/comment/37306909
score: 2
has body: src/main/resources is a default path that maven uses to holds resources. During compilation/build times, it takes everything in there and puts them at the root of the target runtime classpath. You need to specify the entry as classpath:/db.properties since it will be at the root (/) of the classpath.
has comment: http://stackoverflow.com/comment/37305737
has comment: http://stackoverflow.com/comment/37306876
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/37271236
type: Comment
type: QuestionComment
score: 0
has text: I have a UserMBLogged with SessionScope, when i need check if user is logged in i call this ManagedBean. I have a "Filter" that checks if user is logged in.
comment on: http://stackoverflow.com/q/24151464

http://stackoverflow.com/comment/40124785
score: 0
comment on: http://stackoverflow.com/q/24250094
type: Comment
has text: In my humble opinion, using obsolete versions of Java 3D isn't fine even for pure learning purposes because it leads to confusion, it's complicated to install and Harvey fixed some bugs that were there for several years, especially multi-threading bugs. Nevertheless, I admit that Java 3D is only in maintenance mode, no new feature will be implemented, it's not a secret but it doesn't mean that there is no commitment.
type: QuestionComment

http://stackoverflow.com/comment/59283239
type: QuestionComment
comment on: http://stackoverflow.com/q/24174947
score: 0
type: Comment
has text: my main class is caesar, java com.company.caesar doesn't work. I can't figure out what is going on.......

http://stackoverflow.com/a/24207864
has comment: http://stackoverflow.com/comment/37377018
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24207548
has comment: http://stackoverflow.com/comment/37377071
has comment: http://stackoverflow.com/comment/37376857
has body: Use the following statement to get the upper-case letters at the end: String caps = str.replaceAll(".*?([A-Z]+)[^A-Z]*$", "$1"); The regex captures the target, which is then returned as a backreference. Also - Bug alert! if (answer2 == "II" | answer2 == "III") { You can't use == to compare Strings in Java! Use .equals() instead: if (answer2.equals("II") || answer2.equals("III")) {
type: Answer

http://stackoverflow.com/q/24109126
has comment: http://stackoverflow.com/comment/37191986
has answer: http://stackoverflow.com/a/24109782
accepted answer: http://stackoverflow.com/a/24109659
tagged with: java
downvote count: 0
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/24109659
score: 1
upvote count: 1
has body: I've implemented an Object cache like so: // Dictionary with weak keys &amp; values private Map&lt;Object, WeakReference&lt;Object&gt;&gt; cache = new WeakHashMap&lt;&gt;(); private Object checkCache(Object obj) { // If it's in the cache, returned the cached copy. if (cache.containsKey(obj)) return cache.get(obj).get(); // Store it in, and return it. cache.put(obj, new WeakReference&lt;&gt;(obj)); return obj; } Picture the following race-condition scenario: cache.containsKey(obj) returns true The garbage collector kicks in and reaps the object in the cache. null is returned. The questions are: Can this really happen? AFAIK the GC can kick in at any time. Can Java GC be disabled for a single method call? synchronized doesn't seem to prevent GC. Are there any work-arounds? Thanks in advance!
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37191354
tagged with: race-condition
has comment: http://stackoverflow.com/comment/37271639
has title: Java: Racing against the garbage collector
has comment: http://stackoverflow.com/comment/37191457
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24109782
answer count: 2

http://stackoverflow.com/a/24175894
score: 1
accepted answer of: http://stackoverflow.com/q/24175853
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24175853
has body: Use the SUM() function in conjunction with a WHERE player IN ... clause that restricts the summing to only those records in the specified clan. SELECT SUM(kills) FROM Stats WHERE player IN (?, ?, ?) Note: You need to insert the correct number of '?' for the number of players in your array, then set those parameters to the player names from your array. Integer kills = 0; if(members.size() &gt; 0) { StringBuilder sql = new StringBuilder("SELECT SUM(kills) FROM Stats WHERE player in (?"); for(int index = 1; index &lt; members.size(); index++) { sql.append(",?"); } sql.append(")"); try { final PreparedStatement sel = conn.prepareStatement(sql.toString()); for (int index = 0; index &lt; members.size(); index++) { sel.setString(index + 1, members.get(index)); } final ResultSet rs = sel.executeQuery(); kills = rs.getRow() != 0 ? rs.getInt(1) : 0; } catch (final SQLException e) { e.printStackTrace(); } }
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24250144
tagged with: java
duplicate of: http://stackoverflow.com/q/15105357
tagged with: email
tagged with: smtp
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37459736
has title: Could not connect to SMTP host: smtp.gmail.com, port: 587;
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15105357
tagged with: gmail
tagged with: jakarta-mail
has body: I can't seem to send email using java and was hoping you guys could help. Here's the code I'm using now (I've actually tried several examples and none of them work). import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class Mail { static Properties mailServerProperties; static Session getMailSession; static MimeMessage generateMailMessage; public static void main(String args[]) throws AddressException, MessagingException { generateAndSendEmail(); System.out.println("\n\n ===&gt; Your Java Program has just sent an Email successfully. Check your email.."); } public static void generateAndSendEmail() throws AddressException, MessagingException { //Step1 System.out.println("\n 1st ===&gt; setup Mail Server Properties.."); mailServerProperties = System.getProperties(); mailServerProperties.put("mail.smtp.port", "587"); // TLS Port mailServerProperties.put("mail.smtp.auth", "true"); // Enable Authentication mailServerProperties.put("mail.smtp.starttls.enable", "true"); // Enable StartTLS System.out.println("Mail Server Properties have been setup successfully.."); //Step2 System.out.println("\n\n 2nd ===&gt; get Mail Session.."); getMailSession = Session.getDefaultInstance(mailServerProperties, null); generateMailMessage = new MimeMessage(getMailSession); generateMailMessage.addRecipient(Message.RecipientType.TO, new InternetAddress("test@google.com")); generateMailMessage.addRecipient(Message.RecipientType.CC, new InternetAddress("test@google.com")); generateMailMessage.setSubject("Greetings from Crunchify.com.."); String emailBody = "Test email by Crunchify.com JavaMail API example. " + "&lt;br&gt;&lt;br&gt; Regards, &lt;br&gt;Crunchify Admin"; generateMailMessage.setContent(emailBody, "text/html"); System.out.println("Mail Session has been …
downvote count: 0
answer count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/37319211
score: 61
type: AnswerComment
comment on: http://stackoverflow.com/a/24173496
has text: Interesting way to write a for loop :)
type: Comment

http://stackoverflow.com/a/24131905
has body: Try this: Add like this SharedPreferences sharedPref = getSharedPreferences("resturantFile",Activity.MODE_PRIVATE) instead of SharedPreferences sharedPref = getSharedPreferences("resturantFile",0). For example: The way to save SharedPreferences sp = getSharedPreferences("your_prefs", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putInt("your_int_key", yourIntValue); editor.commit(); The way to retrieve data in another activity: SharedPreferences sp = getSharedPreferences("your_prefs", Activity.MODE_PRIVATE); int myIntValue = sp.getInt("your_int_key", -1); If that is not working for you then try this one: Change the default value -1 to 0, int myIntValue = sp.getInt("your_int_key", 0); For more information use this question.
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37315139
accepted answer of: http://stackoverflow.com/q/24131348
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24131348
has comment: http://stackoverflow.com/comment/37428227

http://stackoverflow.com/q/24218852
type: Question
possible better answer: http://stackoverflow.com/a/24218998
upvote count: 2
has title: What is the difference between "ParentClass objectName1= new SubClass() " and "SubClass objectName2 = new SubClass()"?
downvote count: 0
has body: I was wondering if there is any functional difference between those two ways of creating an object in a class that extends from another. I'm just working with basic Inheritance, nothing complex beyond Cat extends Mammal and that kind of things.
answer count: 5
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37398088
has answer: http://stackoverflow.com/a/24218941
linked to: http://stackoverflow.com/q/15596193
has answer: http://stackoverflow.com/a/24218948
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24218948
has answer: http://stackoverflow.com/a/24219065
has comment: http://stackoverflow.com/comment/37398281
has answer: http://stackoverflow.com/a/24218998
tagged with: java
has answer: http://stackoverflow.com/a/24218950
linked to: http://stackoverflow.com/q/383947
favorite count: 0

http://stackoverflow.com/q/24242224
tagged with: java
has comment: http://stackoverflow.com/comment/37442431
has comment: http://stackoverflow.com/comment/37443001
answer count: 1
has comment: http://stackoverflow.com/comment/37442862
downvote count: 3
has comment: http://stackoverflow.com/comment/37442744
has comment: http://stackoverflow.com/comment/37442406
has comment: http://stackoverflow.com/comment/37442513
has comment: http://stackoverflow.com/comment/37446100
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37443850
has comment: http://stackoverflow.com/comment/37446087
has body: I invoke using java some web service which returns some values to me. Those values are some attribute names which I successful receive. I put the returned values in database. For example the values I retrieved are: DSLAM port Interfejs na ISP So when I look in the database those values are stored in DB as DSLAM port and Interfejs na ISP. That is how I received them and that is how they are stored in DB (so only with one blank space between the words). So I'm receiving those values from a web service but when I try to do a comparison additional in the class: if ( attribute.trim().equalsIgnoreCase("Interfejs na ISP") ) { System.out.println("attr2"); } or if ( attribute.trim().equalsIgnoreCase("DSLAM port") ) { System.out.println("attr3"); } I am not having the System Print lines to my console, if is always false. What can be the problem and how can I solve it? This is a really strange behavior for me. Attributes are stored correctly and only when I try to compare it I get strange behavior. The if clause is never true. Can there be some issue with the language format? Additionally if I try with single word: if (attribute.trim().equalsIgnoreCase("Telefon")) { System.out.println("attr5"); } Then it writes in System Out. So with sinlge word it seems it does not have problems
has comment: http://stackoverflow.com/comment/37442442
has comment: http://stackoverflow.com/comment/37443269
has answer: http://stackoverflow.com/a/24257964
tagged with: if-statement
has comment: http://stackoverflow.com/comment/37443509
has title: Java String comparison issue with blank spaces
has comment: http://stackoverflow.com/comment/37472640
score: -3
has comment: http://stackoverflow.com/comment/37442428
has comment: http://stackoverflow.com/comment/37442461
has comment: http://stackoverflow.com/comment/37442472
has comment: http://stackoverflow.com/comment/37444338
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37442829

http://stackoverflow.com/a/24235943
downvote count: 0
has body: Don't use Reader and Writer unless you know the input is text. Use InputStream and OutputStream. Don't use ready(), or, for Sotirios' benefit, available() either. Neither of them is a valid test for end of stream. They both concern whether the input can be read without blocking, which isn't the same thing at all. See the Javadoc. You're not detecting end of stream correctly. If read() returns -1 you're still copying that to the output. Copying a single character or single byte at a time is extremely slow. The canonical way to copy streams in Java is as follows: while ((count = in.read(buffer)) &gt; 0) { out.write(buffer, 0, count); } where count is an int, and buffer is a byte[] of any size greater than zero, typically 8192.
accepted answer of: http://stackoverflow.com/q/24235493
answers question: http://stackoverflow.com/q/24235493
type: Answer
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/37286512
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24160160
has text: This question has already been asked before
score: 0

http://stackoverflow.com/comment/37386958
score: 0
has text: Does this belong on [codereview.se]?
comment on: http://stackoverflow.com/q/24212822
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37247460
type: AnswerComment
comment on: http://stackoverflow.com/a/24137219
has text: @Kent thanks for your answer. I am trying not to think of this problem in Landau notation, since the smaller the constant factors in front of the nlog(n), the better in my application. Therefore performing insertion sort with binary search at a first glace looks very promising, but since I am working on an ArrayList, for each inserted element, I might have to shift some O(n) elements which will make it just as fast/slow as my original approach. So I will stick to that for now. Thanks again for thinking it through with me.
score: 0
type: Comment

http://stackoverflow.com/a/24176054
has body: Java knows that final variables cannot be changed. You've declared x,y to both be final. Therefore it knows that the loop cannot terminate, because x &lt; y is always true.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24176030

http://stackoverflow.com/comment/37448002
comment on: http://stackoverflow.com/q/24211206
score: 0
type: QuestionComment
has text: Nope. I changed to %a (this is a batch file btw) and every line says "The system cannot find the path specified."
type: Comment

http://stackoverflow.com/comment/37305017
type: Comment
comment on: http://stackoverflow.com/a/24156154
score: 0
type: AnswerComment
has text: @KickButtowski potentially. could you plz specify what you mean?

http://stackoverflow.com/comment/37361345
comment on: http://stackoverflow.com/q/24199679
type: QuestionComment
has text: you can find it here: http://stackoverflow.com/questions/1158777/renaming-a-file-using-java
score: 0
type: Comment

http://stackoverflow.com/a/24153544
score: 1
downvote count: 0
type: Answer
upvote count: 1
has body: The oracle jdbc developers guide contains the mapping from jdbc types to oracle data types. There is a section specific to the DATE data type due to its complexity. It has the following note: In Oracle Database 11g, if you have an index on a DATE column to be used by a SQL query, then to obtain faster and accurate results, you must use the setObject method in the following way: Date d = parseIsoDate(val); Timestamp t = new Timestamp(d.getTime()); stmt.setObject(pos, new oracle.sql.DATE(t,(Calendar)UTC_CAL.clone()));
answers question: http://stackoverflow.com/q/24116476

http://stackoverflow.com/comment/37259957
has text: I'm not understanding if it is a possible thing to do what I'd like to do
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24145374
type: QuestionComment

http://stackoverflow.com/comment/37405654
type: AnswerComment
has text: Please see my revised answer with output. Are you sure you fixed the return statement at the very bottom of the method?
comment on: http://stackoverflow.com/a/24222812
type: Comment
score: 0

http://stackoverflow.com/a/48740124
answers question: http://stackoverflow.com/q/24240896
downvote count: 0
score: 14
has body: tl;dr LocalDateTime.parse( "15-05-2014 00:00:00" , DateTimeFormatter.ofPattern( "dd-MM-uuuu HH:mm:ss" ) ) .atZone( ZoneId.of( "Asia/Kolkata" ) ) .toInstant() java.time The Answer by Meno Hochschild is correct but shows classes that are now outdated. DateTimeFormatter f = DateTimeFormatter.ofPattern( "dd-MM-uuuu HH:mm:ss" ) ; LocalDateTime ldt = LocalDateTime.parse( "15-05-2014 00:00:00" , f ) ; ldt.toString(): 2014-05-15T00:00 Apparently you are certain that string represents a moment in India time. Tip: You should have included the zone or offset in that string. Even better, use standard ISO 8601 formats. Assign the India time zone. ZoneId z = ZoneId.of( "Asia/Kolkata" ) ; ZonedDateTime zdt = ldt.atZone( z ) ; zdt.toString(): 2014-05-15T00:00+05:30[Asia/Kolkata] To see the same moment, the same point on the timeline, through the wall-clock time of UTC, extract an Instant. Instant instant = zdt.toInstant() ; instant.toString(): 2014-05-14T18:30:00Z About java.time The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, &amp; SimpleDateFormat. The Joda-Time project, now in maintenance mode, advises migration to the java.time classes. To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310. With a JDBC driver complying with JDBC 4.2 or later, you may exchange java.time objects directly with your database. No need for strings or java.sql.* classes. Where to obtain the java.time classes? Java SE 8, Java SE 9, and later Built-in. Part of the standard Java API with a bundled implementation. Java 9 adds some minor features and fixes. Java SE 6 and Java SE 7 Much of the java.time functionality is back-ported to Java 6 &amp; 7 in ThreeTen-Backport. Android Later versions of Android bundle implementations of the java.time classes. For earlier Android, the ThreeTenABP project adapts ThreeTen-Backport (menti…
type: Answer
upvote count: 14

http://stackoverflow.com/q/24114214
has comment: http://stackoverflow.com/comment/37201134
tagged with: properties-file
has comment: http://stackoverflow.com/comment/37201035
has comment: http://stackoverflow.com/comment/37201112
answer count: 2
has comment: http://stackoverflow.com/comment/37201148
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24114439
has comment: http://stackoverflow.com/comment/37201040
score: 0
has title: Java Properties - can't find existing properties file
has answer: http://stackoverflow.com/a/24114456
tagged with: java
has comment: http://stackoverflow.com/comment/37201176
has body: I'm using the following references, since this is the first time I've used Java Properties. http://docs.oracle.com/javase/tutorial/essential/environment/properties.html http://www.mkyong.com/java/java-properties-file-examples/ I'm attempting to run the following at the beginning of my program start, so the user only has to select the database file path once. After selecting it once, every subsequent program run should automatically use the config.properties file and get the database path. Unfortunately, input == null is continually firing on every program run, even after selecting the correct database path in the previous program run and confirming the properties file contains the database path information. Am I doing something wrong below? Properties prop = new Properties(); InputStream input = null; String filename = "config.properties"; input = this.getClass().getClassLoader().getResourceAsStream(filename); if (input == null) { fileChooser.setDialogTitle("Choose the database file"); fileChooser.setAcceptAllFileFilterUsed(false); FileFilter filter = new FileNameExtensionFilter("S3DB Files", "S3DB"); fileChooser.addChoosableFileFilter(filter); int ret = fileChooser.showDialog(null, "Select File"); File file = null; if (ret == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); dbc = new DBConnect(file.getAbsolutePath()); } OutputStream output = null; try { output = new FileOutputStream("config.properties"); // set the properties value prop.setProperty("database", file.getAbsolutePath()); // save properties to project root folder prop.store(output, null); } catch (IOException io) { io.printStackTrace(); } finally { if (output != null) { try { output.close(); } catch (IOException e) { e.printStackTrace(); } } } } else { try { prop.load(input); dbc = new DBConnect(prop.getProperty("database")); } catch(Exception e) { JOptionPane.showMessageDialog(null, e.toString(), "Properties Read/Write Exception Occured (PRGRYADDView())", JOptionPane.ERROR_MESSAGE)…
has comment: http://stackoverflow.com/comment/37200997
type: Question

http://stackoverflow.com/a/46113306
has body: Here is my CODE: String sourceFileName = "./jasper_report_template.jasper"; Map parameters = new HashMap(); String printFileName = null; try { printFileName = JasperFillManager.fillReportToFile(sourceFileName, parameters, beanArrayDataSource); if(printFileName != null){ //JasperPrintManager.printReport( printFileName, true); /** 1- export to PDF*/ JasperExportManager.exportReportToPdfFile(printFileName, "C://Users/zanderkong/Desktop/sample_report.pdf"); /**3- export to Excel sheet*/ RXlsExporter xlsExporter = new JRXlsExporter(); xlsExporter.setExporterInput(new SimpleExporterInput(printFileName)); xlsExporter.setExporterOutput(new SimpleOutputStreamExporterOutput("C://Users/zanderkong/Desktop/sample_report.xls")); SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(true); configuration.setDetectCellType(true); configuration.setCollapseRowSpan(false); xlsExporter.setConfiguration(configuration); xlsExporter.exportReport(); } } catch (JRException e) { e.printStackTrace(); }
type: Answer
answers question: http://stackoverflow.com/q/24117878
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/37305002
type: Comment
type: QuestionComment
has text: Could you show us that code? Are you using a `sun/plugin/dom/exception/InvalidStateException`?
comment on: http://stackoverflow.com/q/24169576
score: 1

http://stackoverflow.com/q/24254435
has comment: http://stackoverflow.com/comment/37466389
tagged with: eclipse
type: Question
score: 0
type: UnansweredQuestion
answer count: 1
has body: When the app is loading, instead of a proper splash screen it just shows, the best way to describe it, when you go to install an app from the Play store, the black screen with the icon in the top left corner and some text, that's all it shows when launching my app... I narrowed it down to activity_game.xml as when looking in the Graphical Layout of that file, it just shows a boring black screen with text. How would I change this to incorporate a full screen image on splash instead? Let's say for example, the image is called 'loading.png' Content of activity_game.xml is below; &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=".GameActivity" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;/RelativeLayout&gt; --- Edit - Thanks Rod, works to the point I now get a black screen on launch, I copied loading.png into the drawable folder and use the code like this; &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".GameActivity" &gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/loading" android:adjustViewBounds="true" android:scaleType="fitXY" /&gt; &lt;/RelativeLayout&gt; Not sure why it is not loading the image?
has title: Android splash screen not appearing correctly
has comment: http://stackoverflow.com/comment/37466409
has answer: http://stackoverflow.com/a/24254490
tagged with: android
tagged with: java

http://stackoverflow.com/q/24125303
score: 0
has comment: http://stackoverflow.com/comment/37221986
tagged with: java
tagged with: jboss
type: Question
has body: I am trying to deploy a .war file on Jboss-7.1.1 and getting the following error in stacktrace. I have searched about it on web but not sure the cause of this exception 23:01:20,483 WARN [org.jboss.as.server.deployment] (MSC service thread 1-6) Class Path entry p6psy.jar in "/D:/development_environment/servers/Final_jboss/jboss-as-7.1.0.Final/standalone/deployments/SSOAdminTool.war/WEB-INF/lib/xapool.jar" does not point to a valid jar for a Class-Path reference. 23:01:20,800 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."SSOAdminTool.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."SSOAdminTool.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "SSOAdminTool.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.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_18] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_18] at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_18] Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011093: Could not load component class org.displaytag.filter.ResponseOverrideFilter at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:113) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:54) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) […
has comment: http://stackoverflow.com/comment/37221596
answer count: 0
type: UnansweredQuestion
has title: JBoss-7 deployment failed
has comment: http://stackoverflow.com/comment/37250854
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37299328

http://stackoverflow.com/comment/37355441
comment on: http://stackoverflow.com/q/24196477
score: 0
type: Comment
type: QuestionComment
has text: who do you see owner in your task manager

http://stackoverflow.com/comment/37429989
score: 0
has text: Nah, for my money, I'd go with @MadProgrammer's answer. The cost of the code is minimal. 1+.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24235557

http://stackoverflow.com/a/24185254
has comment: http://stackoverflow.com/comment/37489555
answers question: http://stackoverflow.com/q/24184940
type: AcceptedAnswer
has body: You should save files inside your development server. Don't save the file outside the project directory. It will not works. SO maintain a directory for files inside your project directory. For example, If path seems like below, yourproject/htmlfile yourproject/Report0.pdf then Download If path seems like below, yourproject/htmlfile yourproject/files/Report0.pdf then Download try by giving full link. Download
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37333591
has comment: http://stackoverflow.com/comment/37333389
accepted answer of: http://stackoverflow.com/q/24184940
has comment: http://stackoverflow.com/comment/37333937
has comment: http://stackoverflow.com/comment/37334919

http://stackoverflow.com/comment/37199671
has text: crust is already a String no need to check for it
comment on: http://stackoverflow.com/q/24113492
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/49459763
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24116672
has text: What did you end yo using? Could you confirm the memory overhead for Nashorn?

http://stackoverflow.com/a/24112962
type: Answer
has comment: http://stackoverflow.com/comment/37198752
has comment: http://stackoverflow.com/comment/37198779
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24112945
has body: This new ImageIcon("imgtest.jpg", "description...") creates an instance. The getImage() method is invoked on that instance and then all references to that instance are lost. The object can then be garbage collected if it is unreachable. Remember, all you need to invoke an instance method is an expression that resolves to an object reference. A variable of a reference type is one such expression. A constructor invocation is another such expression. An invocation of a method with a return type of some reference type is also such an expression.
score: 3
has comment: http://stackoverflow.com/comment/37198901
upvote count: 3
answers question: http://stackoverflow.com/q/24112945
downvote count: 0

http://stackoverflow.com/q/24107034
accepted answer: http://stackoverflow.com/a/24107194
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37187445
has comment: http://stackoverflow.com/comment/37187461
tagged with: java
has comment: http://stackoverflow.com/comment/37187426
has title: How to make atomic group work with alternations in java regex?
tagged with: regex
has body: I have seen simple demo of atomic group. The regex : a(?&gt;bc|b)d I try to run it on java 7 and it doesn't work as expected because it matches in this demo: Pattern pattern = Pattern.compile("a(?&gt;bc|b)d"); Matcher matcher = pattern.matcher("abd"); System.out.println("matches="+matcher.matches()); Prints: matches=true But atomic group is to avoid trying all alternatives. How to turn on atomic group in java?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24107194

http://stackoverflow.com/comment/133811858
has text: It's very difficult to debug a crash without a stack trace. See [Unfortunately MyApp has stopped. How can I solve this?](/q/23353173) for Android-specific advice, and [What is a stack trace, and how can I use it to debug my application errors?](/q/3988788) for advice on what to do once you have the stack trace. If you still need help, edit your question to include the **complete stack trace**, as well as **which line of your code** the stack trace points to.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24177275
type: Comment

http://stackoverflow.com/q/24193648
score: 2
tagged with: barcode
tagged with: decode
tagged with: detect
has title: Scan, detect and decode UPC code from an image
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: zxing
favorite count: 0
type: Question
has body: I am working on Android development where once I get byte array from Google Glass frame, I am trying to scan array using Zxing library and trying to detect 1d barcode(UPC code). I have tried this code snippet. BufferedImage image = ImageIO.read(game); BufferedImageLuminanceSource bils = new BufferedImageLuminanceSource(image); HybridBinarizer hb = new HybridBinarizer(bils); BitMatrix bm = **hb.getBlackMatrix();** MultiDetector detector = new MultiDetector(bm); DetectorResult dResult = detector.detect(); if(dResult == null) { System.out.println("Image does not contain any barcode"); } else { BitMatrix QRImageData = dResult.getBits(); Decoder decoder = new Decoder(); DecoderResult decoderResult = decoder.decode(QRImageData); String QRString = decoderResult.getText(); System.out.println(QRString); } It works fine for QRcode, detects and decodes QR code well. But does not detect UPC code. I also tried this code snippet, InputStream barCodeInputStream = new FileInputStream(game); BufferedImage barCodeBufferedImage = ImageIO.read(barCodeInputStream); BufferedImage image = ImageIO.read(game); LuminanceSource source = new BufferedImageLuminanceSource(image); BinaryBitmap bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(source)); RSSExpandedReader rssExpandedReader = new RSSExpandedReader(); int rowNumber = bitmap.getHeight()/2; BitArray row = **bitmap.getBlackRow(0, null);** Result theResult = rssExpandedReader.decodeRow(rowNumber, row, new Hashtable()); and in both I am getting "Exception in thread "main" com.google.zxing.NotFoundException". Does anyone know how to fix this issue? getBlackMatrix() - Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or may not apply sharpening. Therefore, a row from this matrix may not be identical to one fetched using getBlackRow(), so don't mix and match between them. getBlackRow()- Converts one row of lumi…
has comment: http://stackoverflow.com/comment/37383785
has comment: http://stackoverflow.com/comment/37377156
linked to: http://stackoverflow.com/q/10583622
upvote count: 2

jar
tags question: http://stackoverflow.com/q/24217239
tags question: http://stackoverflow.com/q/24179314
tags question: http://stackoverflow.com/q/24224217
tag name: jar
tags question: http://stackoverflow.com/q/24198011
tags question: http://stackoverflow.com/q/24221361
tags question: http://stackoverflow.com/q/24141904
tags question: http://stackoverflow.com/q/24106137
tags question: http://stackoverflow.com/q/24180819
tags question: http://stackoverflow.com/q/24117960
tags question: http://stackoverflow.com/q/24117615
tags question: http://stackoverflow.com/q/24173337
tags question: http://stackoverflow.com/q/24151301
tags question: http://stackoverflow.com/q/24232034
tags question: http://stackoverflow.com/q/24145858
tags question: http://stackoverflow.com/q/24159170
tags question: http://stackoverflow.com/q/24158889
tags question: http://stackoverflow.com/q/24259160
tags question: http://stackoverflow.com/q/24228520
tags question: http://stackoverflow.com/q/24202859
tags question: http://stackoverflow.com/q/24263941
tags question: http://stackoverflow.com/q/24123764
tags question: http://stackoverflow.com/q/24190657
tags question: http://stackoverflow.com/q/24188850
tags question: http://stackoverflow.com/q/24119416
tags question: http://stackoverflow.com/q/24196236
tags question: http://stackoverflow.com/q/24110310
tags question: http://stackoverflow.com/q/24239791
tags question: http://stackoverflow.com/q/24183359
tags question: http://stackoverflow.com/q/24203442
tags question: http://stackoverflow.com/q/24252043
tags question: http://stackoverflow.com/q/24246431
type: Tag
tags question: http://stackoverflow.com/q/24250697
tags question: http://stackoverflow.com/q/24249754
tags question: http://stackoverflow.com/q/24173901
tags question: http://stackoverflow.com/q/24130900
tags question: http://stackoverflow.com/q/24155761
tags question: http://stackoverflow.com/q/24179375
tags question: http://stackoverflow.com/q/24159456
tags question: http://stackoverflow.com/q/24170645
tags question: http://stackoverflow.com/q/24169576
tags question: http://stackoverflow.com/q/24117842
tags question: http://stackoverflow.com/q/24128137
tags question: http://stackoverflow.com/q/24144160
tags question: http://stackoverflow.com/q/24262962
tags question: http://stackoverflow.com/q/24108844
tags question: http://stackoverflow.com/q/24169396
tags question: http://stackoverflow.com/q/24142560
tags question: http://stackoverflow.com/q/24141943
tags question: http://stackoverflow.com/q/24159980
tags question: http://stackoverflow.com/q/24116785
tags question: http://stackoverflow.com/q/24218889
tags question: http://stackoverflow.com/q/24106508
tags question: http://stackoverflow.com/q/24264811
tags question: http://stackoverflow.com/q/24165281

http://stackoverflow.com/q/24110872
upvote count: 1
tagged with: variables
has body: Hopefully this is a simple answer that I am just failing to understand. Full code is public static void mystery(int[] list) { for( int i = list.length - 1; i&gt;1; i --) { if (list[i] &gt; list[i - 1]) { list[i -1] = list[i] - 2; list[i]++; } } } } and lets say we are using a list of [2,3,4]. I know that it will output 2,2,5 but I am unclear how to actually work through it. I understand that the list.length is 3 here, and I understand that the for loop will only run once, but I am very unclear what happens at the list[i - 1] = list[i] - 2; area. Should it be list[2-1] = list[2] - 2? How does the two being outside the bracket effect it differently? Much thanks.
tagged with: list
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37195116
has comment: http://stackoverflow.com/comment/37195009
has answer: http://stackoverflow.com/a/24111050
has title: understanding list[i-1] vs list[i]-1
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: arrays
downvote count: 0
answer count: 1

http://stackoverflow.com/a/24142721
upvote count: 1
answers question: http://stackoverflow.com/q/24142608
has comment: http://stackoverflow.com/comment/37254339
has comment: http://stackoverflow.com/comment/37253973
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37254036
has body: You cannot use for (String s : data) {}. You have no where mentioned that data is a List of Strings. Declare it as List&lt;String&gt; data = new ArrayList&lt;String&gt;();. Hope you are using Java 1.5 or higher. Also you need to give an absolute file path. String path = "D:/Sample/Employee.txt" //whatever path you are using File file = new File(path); File parent_directory = file.getParentFile(); if (parent_directory != null) { parent_directory.mkdirs(); }
downvote count: 0

http://stackoverflow.com/q/24150965
has body: I am writing a Java program for school for the problem below. Every time that I try to compile the program, it gives me compile errors that make no sense. If anyone can help me figure out what the problem is, I would appreciate it. Problem: A non-governmental organization needs a program to calculate the amount of financial assistance for needy families. The formula is as follows: -- If the annual household income is between $30,000 and $40,000 and the household has at least three children, the amount is $1,000 per child. -- If the annual household income is between $20,000 and $30,000 and the household has at least two children, the amount is $1,500 per child. -- If the annual household income is less than $20,000, the amount is $2,000 per child. Implement a method for this computation. Write a program that asks for the household income and number of children for each applicant, printing the amount returned by your method. Use -1 as a sentinel value for the input. My program: import java.util.Scanner; /** This program computes the financial assistance that a family can receive based on their income and the number of children. */ public class FinancialAidCalc { public static void main(String[] args) { /** This declares the variables for the main method. */ int income = 0; int children = 0; int financialAid = 0; /** This creates the method to request the household income amount. @param income the amount of houshold income that the user inputs @return the household income */ public static int householdIncome(int income) { do { Scanner in = new Scanner(System.in); System.out.print("Please enter the total household income. Enter -1 to quit."); int income = in.nextInt(); } while (income &lt; -1); if (income &gt;= 0) {return income;} if (income = -1) {return;} } } /** This creates the method to request the number of children in the household. @param children the number of children in the houshold that the user inputs @return the number of children */ public static int noO…
has comment: http://stackoverflow.com/comment/37270235
has answer: http://stackoverflow.com/a/24151078
tagged with: java
score: -1
type: Question
answer count: 2
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37270164
downvote count: 1
has answer: http://stackoverflow.com/a/24151080
favorite count: 0
has title: How do I fix the compiling errors in my program?

http://stackoverflow.com/q/24122075
has comment: http://stackoverflow.com/comment/37217903
score: 2
type: AnsweredQuestion
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37217229
has title: The import com.badlogic cannot be resolved in Java Project Libgdx Setup
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37217773
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37216697
has comment: http://stackoverflow.com/comment/37218379
upvote count: 2
has comment: http://stackoverflow.com/comment/37217167
has comment: http://stackoverflow.com/comment/37217423
tagged with: libgdx
has comment: http://stackoverflow.com/comment/37217976
has answer: http://stackoverflow.com/a/24123620
has body: I've just tried to setup Libgdx to start making games, i followed this tutorial https://www.youtube.com/watch?v=S9fs1PVTyUc&amp;feature=youtu.be in conjunction with the libgdx grdale setup. However an error shows up in the Java project which says: The import com.badlogic cannot be resolved I am using Eclipse for Java IDE. I believe I have the Android SDK installed. I think it may be to do with the setup but i think the latest updates are there and i tried deleting '.m2'ccahe, which is not there any more btw after i deleted it (not been replaced), but this didnt work. Any ideas? heres my code for the java proect: import com.badlogic.gmx.Game; public class GameMain extends Game{ }//'com.badlogic 'gets an error and so does 'Game'
accepted answer: http://stackoverflow.com/a/24123620
has comment: http://stackoverflow.com/comment/37217509

http://stackoverflow.com/q/24155857
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37279435
downvote count: 0
has body: I am using org.springframework.version -- >3.1.0.RELEASE and my datasource is like below &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" scope="prototype"&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt; &lt;property name="username" value="test"/&gt; &lt;property name="password" value="test123"/&gt; &lt;property name="maxActive" value="100"/&gt; &lt;property name="maxIdle" value="30"/&gt; &lt;property name="maxWait" value="16000"/&gt; &lt;property name="timeBetweenEvictionRunsMillis" value="30000"/&gt; &lt;property name="minEvictableIdleTimeMillis" value="60000"/&gt; &lt;property name="testOnBorrow" value="true"/&gt; &lt;property name="validationQuery" value="SELECT 1"/&gt; &lt;/bean&gt; Here is below code to create jdbctemplate... BasicDataSource bds = (BasicDataSource) ctx.getBean("dataSource"); bds.setUrl("jdbc:mysql://address=(protocol=tcp)(host=xx.xx.xx.xx)(port=3306 )/" + db + "?autoreconnect=true); JdbcTemplate jt = new JdbcTemplate(bds); I searched and this the url suggested to connect to IPv6 address. I am able to connect thro DriverManager.getConnection but not thro this datasource....Am i missing anything here Exception Caused by: java.net.UnknownHostException: address=(protocol=tcp)(host=xx.xx.xx.xx) at java.net.InetAddress.getAllByName0(InetAddress.jav a:1215) at java.net.InetAddress.getAllByName(InetAddress.java :1127) at java.net.InetAddress.getAllByName(InetAddress.java :1063) at com.mysql.jdbc.StandardSocketFactory.connect(Stand ardSocketFactory.java:243) I am using Centos-6.2 x86_64, I have checked the /etc/hosts and everything looks fine.
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37282367
has title: Connect to IPv6 mysql using java
upvote count: 1
has comment: http://stackoverflow.com/comment/37282577
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/24225389
answer count: 1
has comment: http://stackoverflow.com/comment/37410423
has title: connecting to a php api from java
has comment: http://stackoverflow.com/comment/37414733
tagged with: post
type: Question
has answer: http://stackoverflow.com/a/24227990
has comment: http://stackoverflow.com/comment/37411584
tagged with: api
tagged with: php
linked to: http://stackoverflow.com/q/3324717
accepted answer: http://stackoverflow.com/a/24227990
has comment: http://stackoverflow.com/comment/37410415
has body: I am trying to connect to an api written in php from a java client. For simplicity of the issue, I reduced the api to the following: (which simply returns the request given to the server) &lt;?php error_reporting(E_ALL); ini_set('display_errors',1); define('DATA_PATH', realpath(dirname(__FILE__).'/data')); $applications = array( 'APP001' =&gt; '28e336ac6c9423d946ba02d19c6a2632', //randomly generated app key for php client 'APP002' =&gt; '38e336ac6c9423d946ba02d19c6a2632' // for java app ); require_once 'models/TodoItem.php'; echo"request"; foreach ($_REQUEST as $result) { echo $result; echo "&lt;br&gt;"; } echo"end"; exit(); I am sending the request as follows: (string param is the string in the code snippet after this) URL url; HttpURLConnection connection = null; try { url = new URL(APP_URI); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", "" + Integer.toString(param.getBytes().length)); connection.setRequestProperty("Content-Language", "en-US"); connection.setUseCaches (false); connection.setDoInput(true); connection.setDoOutput(true); //Send request DataOutputStream wr = new DataOutputStream ( connection.getOutputStream ()); wr.writeBytes (param); wr.flush (); wr.close (); //Get Response InputStream is = connection.getInputStream(); // read from input stream The request string being passed is as follows: (a json object with 2 params, one of which is another json object) {"app_id":"APP002","enc_request":"{\"username\":\"nikko\",\"action\":\"checkUser\",\"userpass\":\"test1234\",\"controller\":\"todo\"}"} The reply is as follows, which consist only of the start and end tags I'm manually echoing and no content: requestend Why am I not getting any content on the server side?
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/12099067
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/24186414
upvote count: 1
has body: If you want to create an Applet then you should first read a tutorial like that: http://docs.oracle.com/javase/tutorial/deployment/applet/ But you will run into problems using a Microsoft Access database from an Applet. Access is not a client server database. There is no Access server you can start and access the database via network connection. There are two alternatives: Change your database to a real client server database like Apache Derby or MySQL and connect to the database via network directly from the applet. But there will be some limitations. Usually the database server should be running on the same host as the web server containing the applet (depending on browser security settings). If the client is behind a firewall, the client may not be allowed to connect to the database port. But in a local network this could be an option. Implement a server side service which hides the database access (e.g. REST or SOAP with a Tomcat server). If your service runs at the same HTTP port from which your applet is delivered then there is no firewall restriction. Though it would be possible to use a Microsoft Access database at server side, it is not recommended. Access is a desktop database not a server database. So even in this case you should change your database.
type: Answer
answers question: http://stackoverflow.com/q/24183125
score: 1
downvote count: 0

http://stackoverflow.com/comment/37426062
comment on: http://stackoverflow.com/a/24232295
type: Comment
score: 0
type: AnswerComment
has text: Thanks for quick reply.. Already tried that but still showing on the top left of the screen.. Can you maybe edit the code? maybe I am doing it wrong.. thanks

http://stackoverflow.com/comment/39656150
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24235099
score: 0
has text: What do you mean by "remote IP and port" ? Do you want to configure a chained proxy ? Question seems a bit unclear...

http://stackoverflow.com/a/24239762
accepted answer of: http://stackoverflow.com/q/24239642
type: AcceptedAnswer
has body: You cannot set the modality of a JFrame; the second window must be a JDialog. Therefore, change the second JFrame to a JDialog and use the method setModalityType() on it.
answers question: http://stackoverflow.com/q/24239642
score: 6
upvote count: 6
type: Answer
downvote count: 0

http://stackoverflow.com/a/24266242
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24261325
has comment: http://stackoverflow.com/comment/77034119
has comment: http://stackoverflow.com/comment/53596477
upvote count: 52
score: 51
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37510190
has body: One of which is selecting blocks between {}, (), or [] or jumping between the opening/closing of a block. Let's assume you have cursor on itemA. Ctrl+W -> selected: itemA Ctrl+W -> selected: method2(itemA) Ctrl+W -> selected: item1, method2(itemA), item3, item4, item5 Ctrl+W -> selected: method(item1, method2(itemA), item3, item4, item5) And so on. After that it would select whole method, class etc. Honestly this is the shortcut which I use most frequently. Unfortunately I sometimes try to use that in other applications - each web browser closes tab by pressing Ctrl+W :) Another thing is: Ctrl + { Ctrl + } It jumps to opening / closing bracket
answers question: http://stackoverflow.com/q/24261325
has comment: http://stackoverflow.com/comment/128485570
has comment: http://stackoverflow.com/comment/57188359
type: Answer

http://stackoverflow.com/comment/37453409
type: AnswerComment
type: Comment
has text: ah shoot... how do you tell?
comment on: http://stackoverflow.com/a/24233277
score: 0

http://stackoverflow.com/a/24174472
has body: For the Java code you have, it looks like the simplest way to translate it into Clojure would be to skip all the iterating and just return the final value: (defn calculate [coll] (odd? (count coll))) If you want something more elaborate I guess you could do something like (defn calc [coll flag] (if (empty? coll) flag (recur (rest coll) (not flag)))) and call it with (defn calculate [coll] (calc coll false)) This kind of recursion isn't the most idiomatic style, and it's kind of crazy for this problem, but it demonstrates how instead of mutating variables you write an expression that when evaluated produces the value passed into the next iteration (see the recur call in the example above). It would be better style to rewrite this like (defn calculate ([coll flag] (if (empty? coll) flag (recur (rest coll) (not flag)))) ([coll] (calculate coll false))) so there's only one function name to deal with. (I left the other way in thinking it would likely be clearer to read for somebody new to Clojure.) I second the comment suggesting you look at 4clojure. It's a good way to get practice, and once you have a solution you can learn from what other users did.
score: 7
type: AcceptedAnswer
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24174306
downvote count: 0
answers question: http://stackoverflow.com/q/24174306
type: Answer

http://stackoverflow.com/a/27264262
upvote count: 1
has body: Android 5.0 solved your problem. Here is new API using which you can execute shell commands.Check here : executeShellCommand (String command) Enjoy!!!
answers question: http://stackoverflow.com/q/24233877
type: Answer
score: 1
downvote count: 0

http://stackoverflow.com/comment/37345564
type: Comment
comment on: http://stackoverflow.com/a/24191441
score: 0
type: AnswerComment
has text: My project A has few common classes which are used in B and C. I think this work even work if - project A dependency is not found while building B or C and it automatically build A.

http://stackoverflow.com/q/24144558
answer count: 1
tagged with: google-plus
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24144634
tagged with: android
tagged with: java
has title: Handling Google+ logins in Android
type: Question
tagged with: google-play-services
score: 0
has body: I have implemented a way for the users to sign in to the application with their Google+ account. In the examples on Google Developers webpage, the login process is connected to the Activity lifecycle: the user is logged in when the Activity starts and logged out when the Activity closes. The application has one Activity where the login and sign out functionalities can be executed. Though, I might need access to the Google+ services in other activities. To achieve this, I'd need to use the connect method on every Activity and the other methods too. I think this is bad, repeating code. How do I implement this in a good way? The complete sign in system looks this. public class MainActivity extends Activity implements ConnectionCallbacks, OnConnectionFailedListener { private GoogleApiClient googleApiClient; private boolean intentInProcess = false; private int PLUS_SIGN_IN = 63640; private boolean signInClicked = false; private ConnectionResult connectionResult; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); googleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(Plus.SCOPE_PLUS_LOGIN) .build(); } @Override protected void onStart() { super.onStart(); googleApiClient.connect(); } @Override protected void onStop() { super.onStop(); if(googleApiClient.isConnected()) { googleApiClient.disconnect(); } } private void resolveSignInErrors() { if(connectionResult.hasResolution()) { try { intentInProcess = true; connectionResult.startResolutionForResult(this, PLUS_SIGN_IN); } catch(SendIntentException e) { intentInProcess = false; googleApiClient.connect(); } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == PLUS_SIGN_IN) { if(requestCode != RESULT_OK) { signInClicked = false; } intentInProcess = false; if(!googleApiClient.isConnecting()) {…
accepted answer: http://stackoverflow.com/a/24144634

http://stackoverflow.com/comment/37299929
type: Comment
has text: It this the whole code? Do you set p to something else than `null` somewhere else?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24167186

http://stackoverflow.com/a/24242877
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24242809
has body: by giving full path to your CSS or JS or any static resources like Image folder as below &lt;link rel="stylesheet" href="${pageContext.servletContext.contextPath}/resources/css/style.css"&gt; try this one it may help you
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37427153
type: QuestionComment
comment on: http://stackoverflow.com/q/24234185
has text: Your reference is to an `A`. So even though the runtime type is a `C` the compiler has no way of knowing that. You can only access methods defined on an `A` from a reference to an `A`.
score: 1
type: Comment

http://stackoverflow.com/a/24123079
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24122894
has body: Is Text a class in your own code base? If so, could you make it implement CharSequence which java.util.String already does (in later versions of Java - not sure since when). Then your one ctor would be: public MyObject(Iterable&lt;? extends CharSequence&gt; values) { ... } (I am assuming your real code is doing more in the ctor than just printing the objects; otherwise why would you be creating an MyObject instance in the first place?)

http://stackoverflow.com/comment/37269330
comment on: http://stackoverflow.com/q/24149963
has text: Rather than making JSON string from JSON object. Try it in reverse order it means create JSON object form JSON string that will help you to make it more clear.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24116015
type: AnsweredQuestion
upvote count: 3
downvote count: 0
tagged with: java
tagged with: bit-manipulation
answer count: 1
has body: Hi there is a method for calculating some checksum which is written in Java. Here is the code: 01 public String getChecksum() { 02 String checkSumBuffer = getMessageHeader() + getConversationHeader() + getTransactionHeader() + operationInformation; 03 char[] res = new char[4]; 04 for (int j = 0; j &lt; res.length; j++) { 05 for (int i = j; i &lt; checkSumBuffer.length(); i = i + 4) { 06 res[j] = (char) (res[j] ^ checkSumBuffer.charAt(i)); 07 } 08 res[j] = (char) ((~res[j]) &amp; 0x00ff); 09 } 10 String strCheckSum = ""; 11 for (int i = 0; i &lt; 4; i++) { 12 strCheckSum = strCheckSum + Integer.toHexString((int) res[i]); 13 } 14 checksum = strCheckSum.toUpperCase(); 15 return checksum; 16 } and this is the PHP equivalent code: 00 public function getChecksum() { 01 $checkSumBuffer = $this-&gt;getMessageHeader() . $this-&gt;getConversationHeader() . $this-&gt;getTransactionHeader() . $this-&gt;operationInformation; 02 $res = array(0,0,0,0); // array with 4 elements 03 for ($j = 0; $j &lt; count($res); $j++) { 04 for ($i = $j; $i &lt; strlen($checkSumBuffer); $i = $i + 4) { 05 $res[$j] = $res[$j] ^ $checkSumBuffer[$i]; 06 } 07 $res[$j] = ((~$res[$j]) &amp; 0x00ff); 08 } 09 $strCheckSum = ""; 10 for ($i = 0; $i &lt; 4; $i++) { 11 $strCheckSum = $strCheckSum . dechex($res[$i]); 12 } 13 $this-&gt;checksum = strtoupper($strCheckSum);*/ 14 return $this-&gt;checksum; 15 } But there is a problem in the PHP code. this is the output for each method: java output: C0E8F098 php output: FEFEFFFF I think the problem is that the res variable in java code is of type char, while in php code it is of type int. If that is the problem, How can I achieve that? I thought I can use chr function which takes an ASCII code and returns the character. But it doesn't work and the output is: 0000 What differences should I look in these codes to solve it?
accepted answer: http://stackoverflow.com/a/24116771
tagged with: bitwise-operators
favorite count: 0
type: Question
score: 3
has title: Converting a bitwise operation Java code to PHP
tagged with: php
has answer: http://stackoverflow.com/a/24116771

http://stackoverflow.com/comment/37251564
type: QuestionComment
comment on: http://stackoverflow.com/q/24141401
score: 0
type: Comment
has text: http://stackoverflow.com/questions/100107/reasons-of-getting-a-java-lang-verifyerror

http://stackoverflow.com/q/24123008
upvote count: 0
tagged with: java
has title: Reading programs gives values of 0
has answer: http://stackoverflow.com/a/24123315
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24123156
has body: so whats going on is that im trying to read this PlayerData.txt file: Dirk-Nowitzki (Dallas-Mavericks) 24 11 5 Dwayne-Wade (Miami-Heat) 36 8 6 LeBron-James (Miami-Heat) 20 8 10 Shawn-Marion (Dallas-Mavericks) 20 6 6 Chris-Bosh (Miami-Heat) 12 4 5 Jason-Terry (Dallas-Mavericks) 16 3 6 DeShawn-Stevenson (Dallas-Mavericks) 12 3 5 Mario-Chalmers (Miami-Heat) 9 1 4 Peja-Stojakovic (Dallas-Mavericks) 2 1 1 Mike Miller (Miami-Heat) 7 2 3 im reading the three integers, which are points, rebounds, and assists respectively and im printing them out in the output window, but im getting 0's for all of my integer values. im pretty sure that this is a pretty easy fix and im making beginner mistakes, but i just dont know where.... can someone please tell me what im doing wrong and/or what i need to do to fix it? thanks in advance. Here's my code (ps im not allowed to use bufferreader or arraylist): import java.util.Scanner; import java.io.*; public class CPT { public static void main(String[] args) throws IOException{ Scanner scan = new Scanner (new File("PlayerData.txt")); int Points[] = new int[10]; int Rebounds[] = new int[10]; int Assists[] = new int[10]; for (int i=0;i&lt;=10;i++){ while (scan.hasNextInt()){ Points[i]=scan.nextInt(); } while (scan.hasNextInt()){ Rebounds[i]=scan.nextInt(); } while (scan.hasNextInt()){ Assists[i]=scan.nextInt(); } } for (int i=0;i&lt;=9;i++){ System.out.print(Points[i]+"\t"+Rebounds[i]+"\t"+Assists[i]+"\n"); } } }
tagged with: arrays
accepted answer: http://stackoverflow.com/a/24123037
has answer: http://stackoverflow.com/a/24123586
answer count: 4
has answer: http://stackoverflow.com/a/24123037
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37217095
possible better answer: http://stackoverflow.com/a/24123315

http://stackoverflow.com/comment/37425443
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24216323
has text: Ok, thanks for the suggestion, i'll give that a try. I did see that before but when I looked at the documentation it didn't look like it did what I wanted.

http://stackoverflow.com/comment/37395749
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24217432
has text: Thanks for guide me, I try to learn server push/coment programming.

http://stackoverflow.com/q/24111228
has answer: http://stackoverflow.com/a/24112340
answer count: 6
has answer: http://stackoverflow.com/a/24111292
has comment: http://stackoverflow.com/comment/37195550
possible better answer: http://stackoverflow.com/a/24111287
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24111376
has answer: http://stackoverflow.com/a/24111287
upvote count: 2
has body: My job is to write a recursive version to this method. From what I understand Recursion is starting with a base call (if something then return) followed by an else which unwinds back to the original base. Like starting with a deck, adding on to the deck then removing cards from the deck until you are back to the original deck. With that in mind here it is. public static long fact(int n) { long result = 1; while(n &gt; 0) { result = result * n; n = n - 1; } return result; } //my recursive version: public static void recFact(int n) { if(n==0) { return n; // ir 0 it really doesn't matter right? } else { return recFact(n-1); } } This is just an example test problem for an exam I have coming up, just want to make sure I have a handle on recursion. Did I do this right? If not what am I missing? please no answers in questions, just tell me what I did wrong and maybe some advice on better ways to understand it. Thanks.
has comment: http://stackoverflow.com/comment/37195555
downvote count: 1
has answer: http://stackoverflow.com/a/24111337
favorite count: 0
has answer: http://stackoverflow.com/a/24111288
type: Question
tagged with: recursion
has title: Java Recursion - Did I do this right?
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24111292

http://stackoverflow.com/q/24113895
upvote count: 2
has body: In the below JSON object I want to parse without knowing key name. object also contains another object within it. {"status":"ok","description":"Request was successful.","account":{"renewal_upper_limit":0,"id":10066,"email":"raj@gmail.com","full_name":" Raj","phone":"99000000","format_time":"America","format_date":"Asia","reports_time_range":"24 hours","dashboard_time_range":"24H"}}
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37200461
tagged with: http://stackoverflow.com/tag/json
downvote count: 2
linked to: http://stackoverflow.com/q/4201011
answer count: 1
has comment: http://stackoverflow.com/comment/37200458
has comment: http://stackoverflow.com/comment/37200553
has comment: http://stackoverflow.com/comment/37200471
favorite count: 0
tagged with: parsing
type: Question
has comment: http://stackoverflow.com/comment/37200602
has comment: http://stackoverflow.com/comment/37200409
linked to: http://stackoverflow.com/q/12870332
has title: How to parse JSON object without knowing key using java?
has comment: http://stackoverflow.com/comment/37200444
accepted answer: http://stackoverflow.com/a/24113926
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37200530
has answer: http://stackoverflow.com/a/24113926
has comment: http://stackoverflow.com/comment/37200638

http://stackoverflow.com/comment/37955419
has text: I added some info about it as an additional note. When I first started using the CF AJAX calls in CF8, it seemed really difficult to test/debug those features. Gradually I found these two. I think that the _cf_nodebug variable can show up in the AJAX debugging window and that's where I discovered that one.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24213882
type: AnswerComment

http://stackoverflow.com/q/24162723
has comment: http://stackoverflow.com/comment/37294420
type: UnansweredQuestion
tagged with: spring
has title: Spring Security: How to redirect to login page if user is logged in via rememberme cookie but authenticated fully is needed
has comment: http://stackoverflow.com/comment/37293527
tagged with: remember-me
answer count: 0
tagged with: java
downvote count: 0
tagged with: authentication
has comment: http://stackoverflow.com/comment/37295258
score: 1
upvote count: 1
has body: I want to use authentication via LDAP and Rememberme. If a user is authenticated via Rememberme, but the page requires full authentication, the user should be redirected to the login page. This is my configuration so far &lt;security:http access-decision-manager-ref="de.test.security.core_accessDecisionManager"&gt; &lt;security:intercept-url pattern="/login.html" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt; &lt;security:intercept-url pattern="/index.jsp" access="IS_AUTHENTICATED_REMEMBERED" /&gt; &lt;security:intercept-url pattern="/*" access="IS_AUTHENTICATED_FULLY" /&gt; &lt;security:form-login login-page='/login.html' authentication-failure-url="/login.html?error=true" /&gt; &lt;security:logout delete-cookies="JSESSIONID" /&gt; &lt;security:access-denied-handler error-page="/login.html" /&gt; &lt;security:remember-me services-ref="de.test.security.auth.rememberme_services" key="${de.test.security.auth.rememberme_key}" /&gt; &lt;/security:http&gt; the problem is, every access deny leads to a redirect to login.html, but I just want a redirect when authentication fully is needed and the user has just authenticated via Rememberme. Can anyone tell me how I can achieve such behaviour?
tagged with: spring-security
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37293465

http://stackoverflow.com/a/24187398
has comment: http://stackoverflow.com/comment/37338176
has body: Eclipse uses its own compiler to compile Java code. It is different than the javac compiler that comes with a JDK. In fact, you don't need a JDK to compile and run normal Java projects in Eclipse. A JRE is obviously needed to reference the required Java libraries. However if you are using Maven or some other tools that sometimes depend on a JDK component, then you need to install a JDK on your machine. For example, Maven has an option to rely on the tools.jar that comes shipped with a JDK.
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37337880
accepted answer of: http://stackoverflow.com/q/24187120
answers question: http://stackoverflow.com/q/24187120
has comment: http://stackoverflow.com/comment/37340304

http://stackoverflow.com/comment/37364305
comment on: http://stackoverflow.com/q/24200913
has text: When I click on the TableHeader, I want to select/deselct all checkboxes in the rows.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/81264943
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24209447
has text: This should not be the accepted answer, you should not need to write code to do this!
score: 1

regex
tags question: http://stackoverflow.com/q/24220864
tags question: http://stackoverflow.com/q/24257705
tags question: http://stackoverflow.com/q/24115303
tags question: http://stackoverflow.com/q/24175976
tags question: http://stackoverflow.com/q/24138371
tags question: http://stackoverflow.com/q/24216859
tags question: http://stackoverflow.com/q/24125054
tags question: http://stackoverflow.com/q/24227120
tags question: http://stackoverflow.com/q/24225871
tags question: http://stackoverflow.com/q/24186561
tags question: http://stackoverflow.com/q/24236355
tags question: http://stackoverflow.com/q/24227968
tags question: http://stackoverflow.com/q/24119656
tags question: http://stackoverflow.com/q/24142890
tags question: http://stackoverflow.com/q/24225391
tags question: http://stackoverflow.com/q/24157054
tags question: http://stackoverflow.com/q/24256200
tags question: http://stackoverflow.com/q/24193672
tags question: http://stackoverflow.com/q/24263847
tags question: http://stackoverflow.com/q/24219643
tags question: http://stackoverflow.com/q/24184773
tags question: http://stackoverflow.com/q/24146019
tags question: http://stackoverflow.com/q/24229911
tags question: http://stackoverflow.com/q/24127405
tags question: http://stackoverflow.com/q/24234068
tags question: http://stackoverflow.com/q/24198504
tag name: regex
tags question: http://stackoverflow.com/q/24131893
tags question: http://stackoverflow.com/q/24218305
tags question: http://stackoverflow.com/q/24184581
tags question: http://stackoverflow.com/q/24175240
tags question: http://stackoverflow.com/q/24207378
tags question: http://stackoverflow.com/q/24200186
tags question: http://stackoverflow.com/q/24139038
tags question: http://stackoverflow.com/q/24130664
tags question: http://stackoverflow.com/q/24149927
tags question: http://stackoverflow.com/q/24256195
tags question: http://stackoverflow.com/q/24256196
tags question: http://stackoverflow.com/q/24210175
tags question: http://stackoverflow.com/q/24149994
tags question: http://stackoverflow.com/q/24209170
tags question: http://stackoverflow.com/q/24182227
tags question: http://stackoverflow.com/q/24155988
tags question: http://stackoverflow.com/q/24176553
tags question: http://stackoverflow.com/q/24202447
tags question: http://stackoverflow.com/q/24107034
tags question: http://stackoverflow.com/q/24220984
tags question: http://stackoverflow.com/q/24142411
tags question: http://stackoverflow.com/q/24239573
tags question: http://stackoverflow.com/q/24223097
tags question: http://stackoverflow.com/q/24106058
tags question: http://stackoverflow.com/q/24170875
tags question: http://stackoverflow.com/q/24222730
tags question: http://stackoverflow.com/q/24207548
tags question: http://stackoverflow.com/q/24204902
tags question: http://stackoverflow.com/q/24192199
tags question: http://stackoverflow.com/q/24265110
tags question: http://stackoverflow.com/q/24134020
tags question: http://stackoverflow.com/q/24227971
tags question: http://stackoverflow.com/q/24156703
tags question: http://stackoverflow.com/q/24218863
tags question: http://stackoverflow.com/q/24238240
tags question: http://stackoverflow.com/q/24155520
tags question: http://stackoverflow.com/q/24142532
tags question: http://stackoverflow.com/q/24192220
tags question: http://stackoverflow.com/q/24246164
tags question: http://stackoverflow.com/q/24237683
tags question: http://stackoverflow.com/q/24215186
tags question: http://stackoverflow.com/q/24109669
tags question: http://stackoverflow.com/q/24256478
tags question: http://stackoverflow.com/q/24142960
tags question: http://stackoverflow.com/q/24117823
tags question: http://stackoverflow.com/q/24256230
tags question: http://stackoverflow.com/q/24256204
tags question: http://stackoverflow.com/q/24138894
tags question: http://stackoverflow.com/q/24177407
tags question: http://stackoverflow.com/q/24124033
tags question: http://stackoverflow.com/q/24183134
tags question: http://stackoverflow.com/q/24120454
tags question: http://stackoverflow.com/q/24147177

http://stackoverflow.com/a/24230002
upvote count: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24229911
type: AcceptedAnswer
has body: In other words you want to replace ; with &amp;# only if there is digit right after it. In that case you can use look-ahead mechanism like str = str.replaceAll(";(?=\\d)","&amp;#"); ;(?=\\d) means exactly what I described earlier: accept ; ONLY if there is \\d after it, but do not include this \\d in match so only ; part will be replaced.
answers question: http://stackoverflow.com/q/24229911
score: 2
type: Answer
has comment: http://stackoverflow.com/comment/37418896

http://stackoverflow.com/comment/37311517
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24173012
has text: It's possible that the fact that object comparisons could end up being significantly more expensive than primitive comparisons might have played a role. I'm not familiar with either Timsort nor dual-pivot quicksort, so I can't say for sure. The javadoc does mention a number-of-comparisons advantage for Timsort, but seeing as there is no such thing for the other sorts, I can't really draw any conclusions.
score: 0

http://stackoverflow.com/comment/37296948
has text: Important moment of Fork/Join. It not create amount of threads==amount of forks. It create only 2 threads if your computer has only two core.
type: Comment
comment on: http://stackoverflow.com/a/24165642
type: AnswerComment
score: 0

http://stackoverflow.com/a/24180723
score: 0
has body: using StringUtils and add an separation and insert into specific column ArrayList&lt;String&gt; allRecordCount = scrapAllRecord(); Label EEFL = new Label(7, 3, StringUtils.join(allRecordCount, ',')); sheet.addCell(new Label(EEFL));
type: Answer
answers question: http://stackoverflow.com/q/24176560

http://stackoverflow.com/comment/37346043
comment on: http://stackoverflow.com/q/24191380
type: Comment
has text: @ben75 not a duplicate as I am not setting any part of the UI from the Thread.
type: QuestionComment
score: 0

http://stackoverflow.com/q/24227184
has title: Input segmentation method
answer count: 1
type: Question
tagged with: android
tagged with: java
has body: I am currently trying to find a way to have an input such as "stuff,things,this,that" and then be able to take each separate part and split them into different values so i can use them for different things. Such as placing them into their own TextView locations or to set a timer depending on an input but still be able to use the other information fully. I have seen this done before using eclipse and i am currently trying to get the code from them but i have gotten no response so far. Thanks for any help in advance, I have a feeling this is going to be a tough one to do. EDIT: I want to use it to edit the values of the results &lt;TextView android:id="@+id/LocationFixed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/location" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/LocationResult" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/locationResult" /&gt; &lt;TextView android:id="@+id/TimeFixed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/time" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/TimeResult" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/timeResult" /&gt; &lt;TextView android:id="@+id/CostFixed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cost" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/CostResult" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/costResult" /&gt;
accepted answer: http://stackoverflow.com/a/24227198
has answer: http://stackoverflow.com/a/24227198
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/24257450
has comment: http://stackoverflow.com/comment/37516973
has comment: http://stackoverflow.com/comment/37552600
type: Answer
has comment: http://stackoverflow.com/comment/37551006
accepted answer of: http://stackoverflow.com/q/24257449
score: 37
has comment: http://stackoverflow.com/comment/37509777
has comment: http://stackoverflow.com/comment/37509722
answers question: http://stackoverflow.com/q/24257449
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37509673
has comment: http://stackoverflow.com/comment/37552540
has comment: http://stackoverflow.com/comment/37509616
has comment: http://stackoverflow.com/comment/37509632
downvote count: 1
has comment: http://stackoverflow.com/comment/37517648
has body: Creating Relationships with Annotations Assume all classes annotated with @Entity and @Table Uni-directional One to One Relationship public class Foo{ private UUID fooId; @OneToOne private Bar bar; } public class Bar{ private UUID barId; //No corresponding mapping to Foo.class } Bi-Directional One to One Relationship managed by Foo.class public class Foo{ private UUID fooId; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "barId") private Bar bar; } public class Bar{ private UUID barId; @OneToOne(mappedBy = "bar") private Foo foo; } Uni-Directional One to Many Relationship using user managed join table public class Foo{ private UUID fooId; @OneToMany @JoinTable(name="FOO_BAR", joinColumns = @JoinColumn(name="fooId"), inverseJoinColumns = @JoinColumn(name="barId")) private List&lt;Bar&gt; bars; } public class Bar{ private UUID barId; //No Mapping specified here. } @Entity @Table(name="FOO_BAR") public class FooBar{ private UUID fooBarId; @ManyToOne @JoinColumn(name = "fooId") private Foo foo; @ManyToOne @JoinColumn(name = "barId") private Bar bar; //You can store other objects/fields on this table here. } Very commonly used with Spring Security when setting up a User object who has a list of Role's that they can perform. You can add and remove roles to a user without having to worry about cascades deleting Role's. Bi-directional One to Many Relationship using foreign key mapping public class Foo{ private UUID fooId; @OneToMany(mappedBy = "bar") private List&lt;Bar&gt; bars; } public class Bar{ private UUID barId; @ManyToOne @JoinColumn(name = "fooId") private Foo foo; } Bi-Directional Many to Many using Hibernate managed join table public class Foo{ private UUID fooId; @OneToMany @JoinTable(name="FOO_BAR", joinColumns = @JoinColumn(name="fooId"), inverseJoinColumns = @JoinColumn(name="barId")) private List&lt;Bar&gt; bars; } public class Bar{ private UUID barId; @OneToMany @JoinTable(name="FOO_BAR", joinColumns = @JoinColumn(name="barId"), inverseJoinColumns …
upvote count: 38

moxy
tags question: http://stackoverflow.com/q/24148848
tag name: moxy
tags question: http://stackoverflow.com/q/24257653
tags question: http://stackoverflow.com/q/24138534
type: Tag
tags question: http://stackoverflow.com/q/24232708

http://stackoverflow.com/comment/37431601
type: Comment
type: QuestionComment
has text: You should have found the answer in the document that mentioned these.
score: 1
comment on: http://stackoverflow.com/q/24236437

http://stackoverflow.com/comment/37485510
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24251047
has text: Nothing goes wrong, persay, but I haven't been able to implement a loop to create an array under "@Parameters". Using the code above, I could manually enter the values, but when I tried to store them in an array and pass them in, I was unable to. @John

http://stackoverflow.com/comment/37451679
has text: Were you able to get your expected output?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24245304
score: 0

http://stackoverflow.com/comment/37377827
type: Comment
comment on: http://stackoverflow.com/q/24206569
score: 0
type: QuestionComment
has text: The project got large (with about 20 classes) but it can be reproduced with already exported *.jar file (running from terminal). It can be found on my dropbox shared link: https://www.dropbox.com/s/o8kdfmfrehz86dr/LibGDX_Fade.jar

http://stackoverflow.com/q/24238023
type: Question
possible better answer: http://stackoverflow.com/a/24238069
has comment: http://stackoverflow.com/comment/37434662
has comment: http://stackoverflow.com/comment/37434647
accepted answer: http://stackoverflow.com/a/24238412
linked to: http://stackoverflow.com/q/6542242
score: -1
has answer: http://stackoverflow.com/a/24238412
tagged with: list
has title: Return type of List<E> toArray() method
tagged with: oop
has body: According to here, the List&lt;E&gt;.toArray() method returns Object[]. It can't return T[] unless you use &lt;T&gt; T[] toArray(T[] a). Why cannot it return E[] since we declared it as List&lt;E&gt;?
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/6542242
tagged with: java
answer count: 2
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24238069
favorite count: 0

http://stackoverflow.com/a/24225303
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24225275
has body: Try changing your query to this: "SELECT UserTable.Hash, UserTable.UserID, UniversitiesList.UniName, HousingList.HousingName " + "FROM UserTable " + "INNER JOIN UniversitiesList " + "ON UserTable.UserUni = UniversitiesList.UniID " + "INNER JOIN HousingList " + "ON UserTable.UserHousing = HousingList.HousingID " + "WHERE UserTable.UserName = John" As written, you're only asking for the columns in your UserTable, not the other tables. The joins look ok from what I can tell...
answers question: http://stackoverflow.com/q/24225275
has comment: http://stackoverflow.com/comment/37410273
type: Answer
has comment: http://stackoverflow.com/comment/37410187
has comment: http://stackoverflow.com/comment/37410227
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/24214764
has title: Inner classes with the same name as an outer class?
favorite count: 0
type: Question
upvote count: 15
tagged with: inner-classes
answer count: 5
downvote count: 2
has answer: http://stackoverflow.com/a/24214852
has answer: http://stackoverflow.com/a/24215067
has comment: http://stackoverflow.com/comment/37391774
accepted answer: http://stackoverflow.com/a/24214835
has answer: http://stackoverflow.com/a/24214835
has body: Constraints: I have a maven source code generator that I wrote that is creating POJO classes from some data files that have nested namespaces. I want each namespace to be nested as an inner class. In some cases out of my control I end up with inner classes that are the same simple name as the outermost class. All the classes must be public scope as this is for a type safe wrapper over something like a properties file, but hierarchical.. I can't change the names otherwise I am changing the names meaning and the namespace that is enclosing data. Given than I have the following code: public class A { public class B { public class A { } } } Inner classes should append the name of the outer class to form a unique namespace such as A$B$A.class, I haven't found a valid reason for this not to compile. Is there any trick to get this to compile?
score: 13
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24214832
has comment: http://stackoverflow.com/comment/37391142
possible better answer: http://stackoverflow.com/a/24215491
tagged with: java
has comment: http://stackoverflow.com/comment/37390726
has answer: http://stackoverflow.com/a/24215491

http://stackoverflow.com/comment/37400156
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24219915
has text: As I wrote I am not familiar with all your details (as you did not provide them). Use my answer as an idea, a sketch, rather than as a final/literal solution. Given the current state of your question, I doubt anyone would be able to provide a final/literal solution.
type: Comment

java-8
tags question: http://stackoverflow.com/q/24114176
tags question: http://stackoverflow.com/q/24254209
tags question: http://stackoverflow.com/q/24240179
tags question: http://stackoverflow.com/q/24263769
tags question: http://stackoverflow.com/q/24168771
tags question: http://stackoverflow.com/q/24140758
tags question: http://stackoverflow.com/q/24137904
tags question: http://stackoverflow.com/q/24183246
tags question: http://stackoverflow.com/q/24265763
tags question: http://stackoverflow.com/q/24122672
tags question: http://stackoverflow.com/q/24215258
tags question: http://stackoverflow.com/q/24151326
tags question: http://stackoverflow.com/q/24202236
tags question: http://stackoverflow.com/q/24188824
tags question: http://stackoverflow.com/q/24146285
tags question: http://stackoverflow.com/q/24167996
tags question: http://stackoverflow.com/q/24202473
tags question: http://stackoverflow.com/q/24173737
tags question: http://stackoverflow.com/q/24216205
tags question: http://stackoverflow.com/q/24243170
tags question: http://stackoverflow.com/q/24232931
tags question: http://stackoverflow.com/q/24208890
tags question: http://stackoverflow.com/q/24232784
tags question: http://stackoverflow.com/q/24219087
tag name: java-8
tags question: http://stackoverflow.com/q/24254096
tags question: http://stackoverflow.com/q/24128045
tags question: http://stackoverflow.com/q/24112715
tags question: http://stackoverflow.com/q/24162637
tags question: http://stackoverflow.com/q/24251183
tags question: http://stackoverflow.com/q/24210420
tags question: http://stackoverflow.com/q/24222155
type: Tag
tags question: http://stackoverflow.com/q/24196082
tags question: http://stackoverflow.com/q/24198561
tags question: http://stackoverflow.com/q/24199148
tags question: http://stackoverflow.com/q/24231464
tags question: http://stackoverflow.com/q/24151813
tags question: http://stackoverflow.com/q/24262576
tags question: http://stackoverflow.com/q/24228279
tags question: http://stackoverflow.com/q/24213152
tags question: http://stackoverflow.com/q/24152109
tags question: http://stackoverflow.com/q/24125949

http://stackoverflow.com/comment/37348110
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24192816
type: Comment
has text: I have used public List getList1(Connection conn){....} public List getList2(Connection conn) {....} . I believe this is what you are saying...

http://stackoverflow.com/comment/37352092
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24175176
type: AnswerComment
has text: Have you read through this [post](http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error)? I've run into issues related to R.java because I often do a ctrl-shift-O to add imports. There was one time Eclipse mistakenly added a `import android.R`, which will throw everything off.

http://stackoverflow.com/q/24124714
has comment: http://stackoverflow.com/comment/37220446
has body: Can anyone please clear me, what does this exception mean: Exception in thread "main" java.text.ParseException: Unparseable date: "06.10.2013 00:00". That was found such a date in file 06.10.2013 that cannot be parsed? must it be always 06/10/2013? I got it, when i convert String[] to Timestamp while reading file. But I have two formats in a file like 03/10/2013 and 03.10.2013, which must I use then, instead of this: SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); String[] temp = line.split(","); SimpleDateFormat dateFormat = new SimpleDateFormat( "MM/dd/yyyy HH:mm" ); java.util.Date parsedDate = dateFormat.parse(temp[0]); java.sql.Timestamp timestamp = new java.sql.Timestamp( parsedDate.getTime()); for (int i = 1; i &lt; temp.length; i++) { o.setTimestamp(timestamp); i have default both of formats in my file 06.10.2013 15:00:00 and 06/10/2013 15:00:00
has title: Unparseable date while converting to timestamp
has comment: http://stackoverflow.com/comment/37220434
type: Question
has comment: http://stackoverflow.com/comment/37220291
has comment: http://stackoverflow.com/comment/37220371
score: 0
has comment: http://stackoverflow.com/comment/37220312
answer count: 1
accepted answer: http://stackoverflow.com/a/24124760
has comment: http://stackoverflow.com/comment/37220313
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24124760

http://stackoverflow.com/comment/37341621
type: AnswerComment
has text: If you don't change it programmatically then why include it in the code? Try my code and tell if it worked.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24189513

http://stackoverflow.com/comment/37202293
type: QuestionComment
comment on: http://stackoverflow.com/q/24114880
score: 0
type: Comment
has text: Can you show a little more of what you are trying to do? What do you mean "return all data elements of an object"? How do you know there are 3 of them? What is `item`? It may be that there is a better answer; for example, if `item` is an array and you want to make it into a string, you can use `Arrays.toString(item)`.

http://stackoverflow.com/a/24170896
downvote count: 0
answers question: http://stackoverflow.com/q/24170825
type: Answer
has body: It looks like you are closing your reader (reader.close();) inside of the while loop. As @rlinden just mentioned, be sure to reset your loop variables. Where you currently have reader.close(); make sure to set t = 0; for the next loop or take @user184994's sage advice. Either way, you'll need to move reader.close(); outside of (below) the outermost while loop. Is there any more code missing above this block? That could have a big effect on how the reader is functioning. Please post your new / edited code below the first block of code so I can see where any new problems are. Mark them with the tag Update: I'll watch for edits and provide more advice if possible.
score: 4
upvote count: 4

http://stackoverflow.com/q/24222861
tagged with: wildcard
has comment: http://stackoverflow.com/comment/37405997
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/37405793
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37405814
has comment: http://stackoverflow.com/comment/37405920
has body: please research following code snippet: class Ideone { public static void main (String[] args) throws java.lang.Exception { List&lt;Integer&gt; listIntegers = null; List&lt;Object&gt; listObjects = null; MyClass mcls =new MyClass (); SomeReference ref = mcls.method(listIntegers,listObjects));//which SomeReference may be? } } class MyClass { &lt;T&gt; T method(List&lt;? extends T&gt; arg1, List&lt;? super T&gt; arg2) { return null; } } What can I write in return statement of method with name method except null; Object? Number? Integer?
has answer: http://stackoverflow.com/a/24223145
accepted answer: http://stackoverflow.com/a/24223145
tagged with: java
has comment: http://stackoverflow.com/comment/37405946
tagged with: generics
type: Question
has title: How to understand what type was selected instead of T in generic method?
has comment: http://stackoverflow.com/comment/37405821
answer count: 1
tagged with: type-inference

http://stackoverflow.com/a/24140322
type: Answer
accepted answer of: http://stackoverflow.com/q/24135504
has body: You can use lookupUsers(long[]) to bulk retrieve your friends and get access to their screen names, e.g.: final IDs friendIds = twitter.getFriendsIDs(MyId, cursor); final ResponseList&lt;User&gt; users = twitter.lookupUsers(friendIds.getIDs()); for (User u : users) { System.out.println(u.getScreenName()); } Note that you can retrieve up to a maximum of 100 users at a time using the lookupUsers API call, so you may have to split the ids up if you have more than 100 friends.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24135504
has comment: http://stackoverflow.com/comment/37253207
has comment: http://stackoverflow.com/comment/37253423

http://stackoverflow.com/q/24132781
tagged with: java
has answer: http://stackoverflow.com/a/24147902
has comment: http://stackoverflow.com/comment/37235982
has comment: http://stackoverflow.com/comment/37236230
has answer: http://stackoverflow.com/a/24132813
has body: I am getting this exception but when I look into my MAVEN DEPENDENCIES folder I could see all the classes being downloaded properly by the pom.xml. Jun 10, 2014 9:43:49 AM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_05\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.8.0_05/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_05/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_05/bin/../jre/lib/amd64;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Java\jdk1.8.0_05\bin;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;d:\Program Files (x86)\ZipGenius 6\;.;D:\Program Files\TortoiseSVN\bin;.;C:\ANT;.;E:\Software\BB 10 IDE\bbndk\sdkinstall.bat;.;E:\ADT_BUNDLE_SETUP\adt-bundle-windows-x86-20130729\sdk\platform-tools\;.;D:\BB7InstallationFolder\webworks;.;E:\ADT_BUNDLE_SETUP\adt-bundle-windows-x86-20130729\sdk\tools;.;D:\Tomcat 7.0\bin;.;C:\Users\sandhiya.sankara\AppData\Roaming\npm;;D:\eclipse;;. Jun 10, 2014 9:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:HelloWorld' did not find a matching property. Jun 10, 2014 9:43:49 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Jun 10, 2014 9:43:49 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Jun 10, 2014 9:43:49 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed…
has comment: http://stackoverflow.com/comment/37236082
has comment: http://stackoverflow.com/comment/37235791
type: UnansweredQuestion
has title: Class Not Found Exception in Spring MVC
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/24134556
has comment: http://stackoverflow.com/comment/37235883
has comment: http://stackoverflow.com/comment/37236283
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37236293
score: 0
answer count: 3

http://stackoverflow.com/a/26142243
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24235099
downvote count: 0
upvote count: 1
has body: The remote IP and port are retrieved from the "Host" field in the request sent to LittleProxy. e.g. A request with the header below: POST http://x.x.x.x:1234 HTTP/1.1 Authorization: Basic cjknkcjenkjljvbt== Host: x.x.x.x:1234 Accept: */* Proxy-Connection: Keep-Alive User-Agent: MyNode/test Content-Type: text/xml Content-Length: 1079 Expect: 100-continue would be forwarded by LittleProxy to remote host x.x.x.x, port 1234. Knowing this, one way to ensure that your requests are channeled through the Proxy to the right remote host/port is to modify the requests being sent by your client application Alternatively, use LittleProxy filters to edit the request header; change it to your desired remote IP/port HttpProxyServer server = DefaultHttpProxyServer.bootstrap() .withPort(8080) .withFiltersSource(new HttpFiltersSourceAdapter() { public HttpFilters filterRequest(HttpRequest originalRequest, ChannelHandlerContext ctx) { return new HttpFiltersAdapter(originalRequest) { @Override public HttpResponse clientToProxyRequest(HttpObject httpObject) { // Modify header, replace remote IP/Port return null; } @Override public HttpResponse proxyToServerRequest(HttpObject httpObject) { // TODO: implement your filtering here return null; } @Override public HttpObject serverToProxyResponse(HttpObject httpObject) { // TODO: implement your filtering here return httpObject; } @Override public HttpObject proxyToClientResponse(HttpObject httpObject) { // TODO: implement your filtering here return httpObject; } }; } }) .start(); I've had success with the first approach (modifying requests from clients)

http://stackoverflow.com/q/24125118
type: UnansweredQuestion
has body: i want to move and rename a file using Java. I tried this code but it fails to rename: Any Help please, Thank you public class MoveAndRenameFile { public MoveAndRenameFile(){ //Current Date and Time DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); { File file = new File("C:\\FolderA\\Client.pdf"); File newFile = new File(("C:\\FolderB\\Clientx.pdf")); if(file.renameTo(newFile)+dateFormat.format(date)){ System.out.println("File rename success");; }else{ System.out.println("File rename failed"); } }
has comment: http://stackoverflow.com/comment/37221243
has title: Move and Rename file using Java
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/37221191
has answer: http://stackoverflow.com/a/24125214
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37221757
has comment: http://stackoverflow.com/comment/37221134
favorite count: 0
type: Question

http://stackoverflow.com/q/24229704
has answer: http://stackoverflow.com/a/24279584
tagged with: spring
has comment: http://stackoverflow.com/comment/37457976
has comment: http://stackoverflow.com/comment/37438201
has comment: http://stackoverflow.com/comment/37477215
tagged with: grails
has comment: http://stackoverflow.com/comment/37505565
has title: Error initializing the application with Spring Security: net/sf/ehcache/Ehcache not found
type: AnsweredQuestion
tagged with: java
answer count: 1
downvote count: 1
score: -1
favorite count: 0
type: Question
tagged with: ehcache
tagged with: acl
has body: I want to use the Spring Security ACL plugin with mongodb. When I run my app I get the following error: 2014-06-15 14:08:04,325 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: net/sf/ehcache/Ehcache Message: net/sf/ehcache/Ehcache Line | Method -&gt;&gt; 2451 | privateGetDeclaredMethods in java.lang.Class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 1810 | getDeclaredMethods in '' | 334 | innerRun . . . . . . . . in java.util.concurrent.FutureTask$Sync | 166 | run in java.util.concurrent.FutureTask | 1145 | runWorker . . . . . . . . in java.util.concurrent.ThreadPoolExecutor | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . . . . . . . . . in java.lang.Thread Caused by ClassNotFoundException: net.sf.ehcache.Ehcache -&gt;&gt; 175 | findClass in org.codehaus.groovy.tools.RootLoader - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 423 | loadClass in java.lang.ClassLoader | 147 | loadClass . . . . . . . . in org.codehaus.groovy.tools.RootLoader | 356 | loadClass in java.lang.ClassLoader | 2451 | privateGetDeclaredMethods in java.lang.Class | 1810 | getDeclaredMethods in '' | 334 | innerRun . . . . . . . . in java.util.concurrent.FutureTask$Sync | 166 | run in java.util.concurrent.FutureTask | 1145 | runWorker . . . . . . . . in java.util.concurrent.ThreadPoolExecutor | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . . . . . . . . . in java.lang.Thread How should I run this?
accepted answer: http://stackoverflow.com/a/24279584
upvote count: 0

http://stackoverflow.com/q/24223125
has answer: http://stackoverflow.com/a/24223177
tagged with: android
tagged with: java
score: -1
answer count: 2
type: UnansweredQuestion
downvote count: 2
tagged with: junit
upvote count: 1
has body: Here is my java code, it should reverse a string: public String reverse(String str) { String reverse = new StringBuffer(str).reverse().toString(); return reverse; } Now here is my JUNIT test code: public class myUnitTest{ @Test public void test_reverse(){ assertTrue() &lt;-- I dont know what I should write } } Apologize for this question to be so basic, but I am really stuck here
has answer: http://stackoverflow.com/a/24223198
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37406154
has title: New to junit - how to write test script for method returning a value

http://stackoverflow.com/q/24266770
tagged with: jframe
score: 1
upvote count: 1
tagged with: user-interface
tagged with: swing
favorite count: 0
type: Question
tagged with: jlabel
has body: I'm trying to display which OS my JFrame application runs on a JLabel component. I can easily detect OS type. How can i send it to JLabel on my gui to display OS's name? Below you can see my GUI and code. I need to display OS's name on JLabel4 component. (It's shown as "..." in the GUI) my GUI: Janus.java /* * 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 janus; import my.janus.JanusUI; /** * * @author Timur */ public class Janus { /** * @param args the command line arguments */ private static String OS = System.getProperty("os.name").toLowerCase(); public Janus(){ JanusUI gui = new JanusUI(); gui.setVisible(true); detectOS(); } public static void main(String[] args) { // TODO code application logic here Janus obj = new Janus(); } // this one prints OS type public static void detectOS(){ if(isMac()){ System.out.println("operating system detected as Mac"); } else if(isWindows()){ System.out.println("operating system detected as Windows"); } else if(isLinux()){ System.out.println("operating system detected as Linux"); } else if(isSolaris()){ System.out.println("operating system detected as Solaris"); } else { System.out.println("isMac() returned false"); } } // detecting os as mac public static boolean isMac(){ return (OS.indexOf("mac") &gt;= 0); } // detecting os as windows public static boolean isWindows(){ return (OS.indexOf("mac") &gt;= 0); } // detecting os as unix-linux public static boolean isLinux(){ return (OS.indexOf("mac") &gt;= 0); } // detecting os as solaris public static boolean isSolaris(){ return (OS.indexOf("mac") &gt;= 0); } } JanusUI.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package my.janus; /** * * @author Timur */ public class JanusUI extends javax.swing.JFrame { /** *…
tagged with: java
has answer: http://stackoverflow.com/a/24266987
has title: setting JLAbel's text at load
accepted answer: http://stackoverflow.com/a/24266987
has answer: http://stackoverflow.com/a/24267156
possible better answer: http://stackoverflow.com/a/24267156
type: AnsweredQuestion
answer count: 2
downvote count: 0

tomcat
tags question: http://stackoverflow.com/q/24202703
tags question: http://stackoverflow.com/q/24191950
tags question: http://stackoverflow.com/q/24121637
tags question: http://stackoverflow.com/q/24241177
tags question: http://stackoverflow.com/q/24175714
tags question: http://stackoverflow.com/q/24138120
tags question: http://stackoverflow.com/q/24113647
tags question: http://stackoverflow.com/q/24144289
tags question: http://stackoverflow.com/q/24215446
tags question: http://stackoverflow.com/q/24152856
tags question: http://stackoverflow.com/q/24142497
tags question: http://stackoverflow.com/q/24256385
tags question: http://stackoverflow.com/q/24121747
tags question: http://stackoverflow.com/q/24223103
tags question: http://stackoverflow.com/q/24139636
tags question: http://stackoverflow.com/q/24184485
tags question: http://stackoverflow.com/q/24118426
tags question: http://stackoverflow.com/q/24211217
tags question: http://stackoverflow.com/q/24230963
tags question: http://stackoverflow.com/q/24233324
tags question: http://stackoverflow.com/q/24180554
tags question: http://stackoverflow.com/q/24211087
tags question: http://stackoverflow.com/q/24166056
tags question: http://stackoverflow.com/q/24146028
tags question: http://stackoverflow.com/q/24167274
tags question: http://stackoverflow.com/q/24140728
tags question: http://stackoverflow.com/q/24182367
tags question: http://stackoverflow.com/q/24155113
tags question: http://stackoverflow.com/q/24177071
type: Tag
tags question: http://stackoverflow.com/q/24106622
tags question: http://stackoverflow.com/q/24221361
tags question: http://stackoverflow.com/q/24121786
tags question: http://stackoverflow.com/q/24185781
tags question: http://stackoverflow.com/q/24113861
tags question: http://stackoverflow.com/q/24160582
tags question: http://stackoverflow.com/q/24180979
tags question: http://stackoverflow.com/q/24247515
tags question: http://stackoverflow.com/q/24209021
tags question: http://stackoverflow.com/q/24130403
tags question: http://stackoverflow.com/q/24136084
tags question: http://stackoverflow.com/q/24155615
tags question: http://stackoverflow.com/q/24180573
tags question: http://stackoverflow.com/q/24205858
tags question: http://stackoverflow.com/q/24218525
tags question: http://stackoverflow.com/q/24244781
tags question: http://stackoverflow.com/q/24137805
tags question: http://stackoverflow.com/q/24158640
tags question: http://stackoverflow.com/q/24175703
tags question: http://stackoverflow.com/q/24106134
tags question: http://stackoverflow.com/q/24207883
tags question: http://stackoverflow.com/q/24186888
tags question: http://stackoverflow.com/q/24188341
tags question: http://stackoverflow.com/q/24160177
tags question: http://stackoverflow.com/q/24113350
tags question: http://stackoverflow.com/q/24178488
tags question: http://stackoverflow.com/q/24153742
tags question: http://stackoverflow.com/q/24190456
tags question: http://stackoverflow.com/q/24205100
tags question: http://stackoverflow.com/q/24205905
tags question: http://stackoverflow.com/q/24197722
tags question: http://stackoverflow.com/q/24185466
tags question: http://stackoverflow.com/q/24159136
tags question: http://stackoverflow.com/q/24186529
tag name: tomcat
tags question: http://stackoverflow.com/q/24180575
tags question: http://stackoverflow.com/q/24111169
tags question: http://stackoverflow.com/q/24179569
tags question: http://stackoverflow.com/q/24122646
tags question: http://stackoverflow.com/q/24152780
tags question: http://stackoverflow.com/q/24141235
tags question: http://stackoverflow.com/q/24122883
tags question: http://stackoverflow.com/q/24125378
tags question: http://stackoverflow.com/q/24153152
tags question: http://stackoverflow.com/q/24151464
tags question: http://stackoverflow.com/q/24109200
tags question: http://stackoverflow.com/q/24125326
tags question: http://stackoverflow.com/q/24124193
tags question: http://stackoverflow.com/q/24232745
tags question: http://stackoverflow.com/q/24244817

http://stackoverflow.com/comment/37239986
comment on: http://stackoverflow.com/a/24134193
has text: Try using: `Pattern p = Pattern.compile(str, Pattern.UNICODE_CHARACTER_CLASS);`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37682671
score: 1
comment on: http://stackoverflow.com/a/24228037
has text: I'm not trying to keep revision history. I'm just trying to get audit info working for a ManyToMany join table. I do not have an Entity object for the join table since it is inferred through the ManyToMany annotation. Therefore I cannot set the Auditing annotations or extend AbstractAuditable.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37453060
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24234982
score: 0
has text: Yeah, sorry. I was off by a factor of two there. Try `4503599627370496.0` instead. Regarding your second example, indeed that's true. If you want correct rounding with that trick, you need to replace the multiplication by `0.01` by a division by `100.0`. If you want five significant figures over the whole range of `float`, you might want to `switch` over the thing's exponent, in some branches do a test against (the closest `float` to) a power of ten, and replace `100.0` with the appropriate power of ten in the above. As you can tell, this is icky, but it'll probably go faster.

http://stackoverflow.com/q/24141688
favorite count: 0
has title: TreeSet custom comparator with long values
type: Question
has body: I have a TreeSet&lt;MyObject&gt; where MyObject has a method getID(). The getID() method returns a long which I want to use to sort the MyObjects within the custom comparator of a TreeSet Comparator&lt;MyObject&gt; comparator = new Comparator&lt;MyObject&gt;() { public int compare(MyObject a0, MyObject a1) { return a0.getID()-a1.getID(); } }; TreeSet&lt;MyObject&gt; set = new TreeSet&lt;MyObject&gt;(comparator); However the method compare must return an intand I'm comparing longs. Is there a way I can get around this?
tagged with: comparator
tagged with: long-integer
possible better answer: http://stackoverflow.com/a/24141987
has comment: http://stackoverflow.com/comment/37251986
has answer: http://stackoverflow.com/a/24141794
accepted answer: http://stackoverflow.com/a/24141794
type: AnsweredQuestion
score: 0
answer count: 3
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37251920
downvote count: 1
has answer: http://stackoverflow.com/a/24141962
has answer: http://stackoverflow.com/a/24141987

http://stackoverflow.com/comment/37209543
comment on: http://stackoverflow.com/q/24119055
score: 1
type: Comment
type: QuestionComment
has text: The question would be improved if you showed your efforts so far and/or explained at what point you have trouble. The phrase "struggled for 2 hours but couldn't do it" covers too many possible things that could be wrong. Perhaps you only need one small correction to one of your attempts?

http://stackoverflow.com/comment/37419351
has text: Its autoboxing... Java will convert int to long with out explicit casting...
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24230269

http://stackoverflow.com/comment/37219290
comment on: http://stackoverflow.com/a/24124081
has text: Should probably use the non-greedy version in case there are multiple occurrences of the tag pair: `str = str.replaceAll(" [^<]*? ","");`
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/37426859
type: Comment
has text: Ok, instead of `frame.setBounds(x,y,width,height);` try to use `htmleditor.setBounds(x,y,width,height);` before add html editor to frame.
type: AnswerComment
comment on: http://stackoverflow.com/a/24232295
score: 0

http://stackoverflow.com/comment/37332532
type: QuestionComment
comment on: http://stackoverflow.com/q/24184992
score: 2
has text: Did you put hibernate-core.jar onto your classpath?
type: Comment

http://stackoverflow.com/comment/37315601
comment on: http://stackoverflow.com/q/24175159
score: 0
type: Comment
type: QuestionComment
has text: This is really not a good place to use OOP, but I can help you... Right now I'm kinda busy, but I'll try...

http://stackoverflow.com/comment/37261706
score: 0
type: QuestionComment
type: Comment
has text: Your english is rather hard to interpret, but if I am understanding you, you want to read in a file from an SMB share? As long as the drive is mapped locally somehow, why would Java/Spring care? The OS would handle reading the files.
comment on: http://stackoverflow.com/q/24146018

http://stackoverflow.com/q/24125531
answer count: 1
downvote count: 3
tagged with: background
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37221907
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24599143
has body: I think this is the wrong forum for these kind of question but here goes anyway. I have basic java knowledge, and I have managed to write a very simple mmo bot for wildstar. All it does is use the Robot class to move the mouse around the screen to open the ingame interface and queue for battleground, then enter and just afk there until it ends and repeats the process. All this is done by checking for colors. Now there are a core feature I would like to add, and Ive been searching for a few days but it seems like you cant do what I want in java. I want to send keys to the game while its in the background so i can use computer for other stuff in the meanwhile (why is java so bad!? ), I dont know c# or c++. Is there a way for me to do this with java or am i stuck with a useless language.
score: -3
tagged with: key
has title: |Ultra noob| possible to send keys to background window?
tagged with: java

http://stackoverflow.com/a/28661297
answers question: http://stackoverflow.com/q/24223925
type: Answer
has body: I answered this question here which it is a complete answer. JAVA - Xuggler - Play video while combining an MP3 audio file and a MP4 movie
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24223925
score: 0

http://stackoverflow.com/comment/37354847
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24189482
has text: Ok, but be certain of the thread in which you issue UI update calls. Making them outside the EDT can lead to unpredictable behavior, and inserting a sleep() can mask the fact that you are calling from the wrong thread. Using invokeWait() never hurts; if it happens to be called FROM the EDT, it detects that and handles it.

http://stackoverflow.com/comment/37398148
score: 0
type: Comment
type: AnswerComment
has text: You don't have to create the xml file since it is android's xml file. It is already available to you. I just referenced it to show you how you can get finer control of the text. I'll edit the answer to show how you can use this in your activity.
comment on: http://stackoverflow.com/a/24216238

http://stackoverflow.com/q/24118719
has title: Reading a file from my desktop and printing each line from it
possible better answer: http://stackoverflow.com/a/24118762
answer count: 6
has answer: http://stackoverflow.com/a/24118762
accepted answer: http://stackoverflow.com/a/24118960
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24118927
has answer: http://stackoverflow.com/a/24118960
has answer: http://stackoverflow.com/a/24118954
has answer: http://stackoverflow.com/a/24118739
tagged with: java
has body: dear all here i have this code: File file = new File("flowers_petal.txt"); Scanner in = new Scanner(file); while(in.hasNext()){ String line = in.nextLine(); System.out.println(line); I want to read from a file and print each line, but this code doesn't work because of some exceptions (throw exception??), how can i put it in a way that it would read from the flowers.txt file, which is on my desktop and will print each line from this file in the console?
has answer: http://stackoverflow.com/a/24119059
type: Question
has comment: http://stackoverflow.com/comment/37208934
has comment: http://stackoverflow.com/comment/37209020

http://stackoverflow.com/q/24199528
favorite count: 0
has title: Need Tips for Algorithm
type: Question
has comment: http://stackoverflow.com/comment/37361071
tagged with: algorithm
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/363681
tagged with: java
score: -3
has body: i am wondering if you could help me in my project. I would to ask your opinion of what algorithm is best to used in generating random numbers that ranges from 1 to 9.. Its a game like "Sphere Break" a famous mini game of FFx-2. Please refer to the picture for Need Opinions Please!! Need Help Badly. My problem is that i want a certain algorithm to generate random numbers from 1 - 9 like in the picture every gameplay = another set of random coins... P.S. i am developing an android game using unity !! thx for the response
tagged with: random
upvote count: 0
downvote count: 3
answer count: 1
has answer: http://stackoverflow.com/a/24199548
has comment: http://stackoverflow.com/comment/37361043
linked to: http://stackoverflow.com/q/363681

http://stackoverflow.com/a/24256714
type: Answer
score: 0
has body: Try this. I think you should recalculate the total money. Because number of shops is 21, is correct. Please recalculate total money; it can never be 210000. public class investmentCalculation { private int income; private int shop; private int firstMoney; private int totalMoney1; private int shopsAdded; public investmentCalculation() { income = 10000; shop = 3; firstMoney = 30000; totalMoney1 = 0; shopsAdded = 0; } // here the method to achieve the goal public int SetFor() { for (int i = 0; i &lt; 7; i++) { totalMoney1 += income * shop; shopsAdded = totalMoney1 / firstMoney; //Calculate how many shops can be added with the money you have. shop += shopsAdded; //Increment the shops by the newly added shops. totalMoney1 -= firstMoney * shopsAdded; //Decrement the cost required to form the new shops. } System.out.println("the total money is: " + totalMoney1); return shop; } /** this class to test the investmentCalculation */ public static void main(String[] args) { investmentCalculation TT = new investmentCalculation(); int A = TT.SetFor(); System.out.println("the shops are: " + A); } }`
answers question: http://stackoverflow.com/q/24253175

http://stackoverflow.com/q/24144872
downvote count: 0
upvote count: 1
tagged with: swing
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24145016
type: UnansweredQuestion
tagged with: java
has body: In JavaScript, I entered a code which opens a Paint JFrame. I made a separate JFrame to change the colour. The button says 'Change Colour' which I plan to write a code which goes to the next colour when clicked. However, I do not know how to make a keypress detection. This is my code: import javax.swing.*; public class PaintApp extends javax.swing.JFrame { public static void main(String[] args) { JFrame main=new JFrame("Tessellating Pi - Paint"); PaintInterface pi=new PaintInterface(); main.add(pi); main.setSize(1000,1000); main.setVisible(true); JFrame j=new JFrame("Colour Chooser"); JButton c=new JButton("Change Colour"); j.add(c); j.setSize(150,100); j.setVisible(true); } }
has answer: http://stackoverflow.com/a/24144991
has title: How do I detect a button press in a normal Java file?
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has comment: http://stackoverflow.com/comment/37274254
has comment: http://stackoverflow.com/comment/37258309
score: 1

http://stackoverflow.com/comment/37207588
type: Comment
comment on: http://stackoverflow.com/q/24117993
type: QuestionComment
has text: You want to access it where client side/server side..? using what..?
score: 1

http://stackoverflow.com/a/24115402
has body: This rule is not working correctly. In later versions it was disabled. The recent version of PMD (5.1.1) has a rule called GuardLogStatementJavaUtil, which does the same thing, but that one works. UPDATE: I've tried with the following code: private static final Log log = LogFactoryImpl.getLog("apache.commons.logger"); private static final Logger logger = Logger.getLogger("java.util.logger"); public static void main(String[] args) { if (log.isInfoEnabled()) { log.info("jebediah"); } if (logger.isLoggable(Level.INFO)) { logger.info("kerman"); } } After running PMD I got two warning messages: 1) At the line log.info("jebediah"); I get the following error message: Java Logging -> GuardLogStatementJavaUtil 2) At the line logger.info("kerman"); I get the following error message: Jakarta Commons Logging -> GuardLogStatement Looks like whatever I do, I'll get a warning.
has comment: http://stackoverflow.com/comment/37205199
type: Answer
has comment: http://stackoverflow.com/comment/37365957
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24114677

http://stackoverflow.com/a/24138244
has body: In your servlet class use : public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ String s = request.getParameter("value1"); String s1 = request.getParameter("value"); } in JSP don't do like that, instead do : &lt;form action="name" method="post"&gt; //here action=name is name of your servlet class name &lt;input type="text" name="value"&gt; &lt;input type="text" name="value1"&gt; &lt;input type="submit" value="Send"&gt; &lt;/form&gt;
has comment: http://stackoverflow.com/comment/37246081
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37245862
has comment: http://stackoverflow.com/comment/37246352
has comment: http://stackoverflow.com/comment/37245757
score: 1
has comment: http://stackoverflow.com/comment/37245730
type: Answer
has comment: http://stackoverflow.com/comment/37246004
has comment: http://stackoverflow.com/comment/37245960
answers question: http://stackoverflow.com/q/24138026
has comment: http://stackoverflow.com/comment/37246182
has comment: http://stackoverflow.com/comment/37246300
has comment: http://stackoverflow.com/comment/37246276

spring-aop
tags question: http://stackoverflow.com/q/24159524
tags question: http://stackoverflow.com/q/24121117
tags question: http://stackoverflow.com/q/24144336
tag name: spring-aop
tags question: http://stackoverflow.com/q/24259712
type: Tag

http://stackoverflow.com/comment/37345143
comment on: http://stackoverflow.com/a/24191187
has text: Im not using XML, so how would I do this
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37400657
type: QuestionComment
comment on: http://stackoverflow.com/q/24190962
type: Comment
score: 0
has text: I dont have other configuration except web.xml. The @Controller annotation do the rest I guess

merge
type: Tag
tag name: merge
tags question: http://stackoverflow.com/q/24212472

http://stackoverflow.com/a/24163727
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24163594
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37294391
answers question: http://stackoverflow.com/q/24163594
downvote count: 0
has comment: http://stackoverflow.com/comment/37297496
score: 1
type: Answer
has body: I think you mean that the second fails and the first does not. When you have int a=5 you are declaring a new variable a. That variable is only valid inside the scope in which it is declared, in both these cases that means inside the if block. When you have curly brackets around the if statement then you can have statements after that make use of your variable a. When you don't have those brackets there then you are declaring a completely useless variable since it will immediately go out of scope and be thrown away.
has comment: http://stackoverflow.com/comment/37295333
has comment: http://stackoverflow.com/comment/37293520

http://stackoverflow.com/comment/37309307
score: 0
has text: Reading apache source may help you on how to get it done in vanilla java.
comment on: http://stackoverflow.com/q/24171935
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37452701
type: QuestionComment
has text: This is too opinion/discussion-based for SO's format. You _might_ be able to get it focused enough for SO if you provide a specific example and ask specific questions about it, but even then it's probably too opinion-based.
score: 1
comment on: http://stackoverflow.com/q/24247461
type: Comment

http://stackoverflow.com/comment/37477697
type: Comment
type: QuestionComment
has text: @Duncan It takes data from some service, and save them to files. Yes it can modify the data btw that two actions. But that really doesn't matter in this case
score: 0
comment on: http://stackoverflow.com/q/24260498

http://stackoverflow.com/q/24196082
has answer: http://stackoverflow.com/a/24203010
has comment: http://stackoverflow.com/comment/37355085
has comment: http://stackoverflow.com/comment/37354698
has comment: http://stackoverflow.com/comment/37354878
has comment: http://stackoverflow.com/comment/37355198
has body: It just says: Returns a sequential Stream with this collection as its source. This method should be overridden when the spliterator() method cannot return a spliterator that is IMMUTABLE, CONCURRENT, or late-binding. (See spliterator() for details.) But I can't find any code showing how it creates and returns the new Stream. double average = roster .stream() .filter(p -&gt; p.getGender() == Person.Sex.MALE) .mapToInt(Person::getAge)`enter code here` .average() .getAsDouble(); roster is a List&lt;Person&gt; instance of ArrayList&lt;Person&gt; Person is a simple class that represents a person
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37355162
has comment: http://stackoverflow.com/comment/37354994
has comment: http://stackoverflow.com/comment/37354770
has comment: http://stackoverflow.com/comment/37354795
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37355392
score: -3
has comment: http://stackoverflow.com/comment/37355219
has comment: http://stackoverflow.com/comment/37354704
has comment: http://stackoverflow.com/comment/37354663
tagged with: java-8
has comment: http://stackoverflow.com/comment/37355416
downvote count: 6
has comment: http://stackoverflow.com/comment/37354952
has comment: http://stackoverflow.com/comment/37355123
has comment: http://stackoverflow.com/comment/37355377
has comment: http://stackoverflow.com/comment/37354892
has comment: http://stackoverflow.com/comment/37354735
upvote count: 3
tagged with: java
has title: What is the default implementation of .stream() in java 8?
answer count: 1

http://stackoverflow.com/comment/37208106
type: QuestionComment
has text: if there is a form first select that form and then select submit.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24117993

http://stackoverflow.com/q/24231503
tagged with: listener
type: Question
answer count: 0
downvote count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has title: how to avoid the selection using ctrl + shift and clicking in a Jtable
tagged with: jtable
tagged with: listselectionlistener
tagged with: java
has body: we are using a JTable where we allow multi selection only when some datas are same otherwise not allowed to Multi-select. This is achieved by overriding ChangeSelection method of Jtable. But if ctrl+shift &amp; clicking in this table, it selects all the elements between those to selection even the data doesn't matches because ChangeSelection method is not triggered when user has clicked with pressing Ctrl+Shift. Can someone give idea to how we can avoid this? Is this a requirement of JTable to avoid ctrl+shift selection? we also have ListSelectionListener to that table and overridden ValueChanged to save the selected rows.
score: 1
favorite count: 0

http://stackoverflow.com/comment/37197289
comment on: http://stackoverflow.com/q/24112111
score: 1
type: Comment
type: QuestionComment
has text: Go ahead. Write more code. If you get a specific problem - come back with the exact question.

http://stackoverflow.com/a/24225769
has body: The data structure that you are referring to is an array containing references. In the diagram below, b[0], b[1] and b[2] are references towards the arrays [A,B,C], [D], and [E,F] respectively. Therefore, b.length = 3, as it contains three references. +------+ +---+---+---+ | | ---&gt; | A | B | C | =&gt; b[0].length=3 (its elements are b[0][0]=A, b[0][1]=B, b[0][2]=C) | b[0] | +---+---+---+ | | +------+ +---+ | | ---&gt; | D | =&gt; b[1].length=1 (its only element is b[1][0]=D) | b[1] | +---+ | | +------+ +---+---+ | | ---&gt; | E | F | =&gt; b[2].length=2 (its elements are b[2][0]=E, b[2][1]=F) | b[2] | +---+---+ | | +------+ =&gt; b.length = 3 (its elements are b[0]=[A,B,C], b[1]=[D,E], b[2]=[F]) The nested for loops in your code will visit each cell in the diagram, from left to right, top to bottom. The purpose of i is to iterate over the rows, that is, to indicate that one must visit b[0], then b[1], then b[2]. The purpose of j is to iterate over the cells in one row, that is, to indicate that when i=0 we must visit columns 0, 1, and 2 to find A, B, and c. When i=1, j visits column 0 and finds D. Finally, when i=2, j visits columns 0 and 1 to find E and F.
type: Answer
answers question: http://stackoverflow.com/q/24224438
score: 0

http://stackoverflow.com/q/24153304
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24153376
tagged with: android-intent
has answer: http://stackoverflow.com/a/24153376
has title: startActivityForResults interferes with onTouchListener
downvote count: 1
favorite count: 0
type: Question
tagged with: android
tagged with: java
score: -1
type: AnsweredQuestion
has body: I am new to Java programming but have programmed in other languages. I am having an issue with what I think is losing view focus when returning from a new intent. The first time I run I want to collect information from the user, so I do Intent myIntent = new Intent(getApplicationContext(), UserInformation.class); startActivityForResult(myIntent, UserInformationRequest); This works fine. I jump to the intent, collect the data and return to onActivityResult. There I want to display the main screen and have the user move an image around, so I setup an onTouchListener @Override public void onActivityResult(int iRequestCode, int iResultCode, Intent UserInformationData) { super.onActivityResult(iRequestCode, iResultCode, UserInformationData); switch(iRequestCode) { case UserInformationRequest: setContentView(R.layout.main); doMoving(); } } public void doMoving() { ivImage =(ImageView) findViewById(R.id.image); ivImage.setOnTouchListener(this); } @Override public boolean onTouch(View View, MotionEvent event) { final int X = (int) event.getRawX(); final int Y = (int) event.getRawY(); switch (event.getAction() &amp; MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: _xDelta = (int) (X - ivImage.getTranslationX()); _yDelta = (int) (Y - ivImage.getTranslationY()); ivHomeImage.setVisibility(View.VISIBLE); break; case MotionEvent.ACTION_UP: ivHomeImage.setVisibility(View.INVISIBLE); break; case MotionEvent.ACTION_POINTER_DOWN: break; case MotionEvent.ACTION_POINTER_UP: break; case MotionEvent.ACTION_MOVE: ivImage.setTranslationX(X - _xDelta); ivImage.setTranslationY(Y - _yDelta); break; } return true; } } This does not work. If I skip calling the intent and go directly to the onTouchListener the image can be moved. I do understand why calling the Intent and returning leaves my MainActivity broken.

http://stackoverflow.com/comment/37454487
has text: i'm sorry, how can I provide the NPE stack trace from github?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24248209

http://stackoverflow.com/a/24210983
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24210850
score: 6
has body: You could use reflection or a map or... Alternatively, if you can use Java 8, you could pass a lambda to point to the member that you are interested in. It is not as short as what you wanted, but not too bad either: public static int sumMembers(ASDF[] array, ToIntFunction&lt;ASDF&gt; member) { return Arrays.stream(array).mapToInt(member).sum(); } Sample use: public static void main(String[] args) { ASDF[] array = {new ASDF(), new ASDF()}; array[0].a = 1; array[1].a = 2; //THIS IS HOW YOU CALL IT int sum = sumMembers(array, a -&gt; a.a); }
upvote count: 6

http://stackoverflow.com/q/24254374
type: AnsweredQuestion
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/24254463
tagged with: java
has answer: http://stackoverflow.com/a/24254463
favorite count: 0
type: Question
has title: Observable Java class: clearChanged() and notify observers ... what order?
has body: If we look at the JavaDoc for the Observable notifyObservers() method, we read the following: "...then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed." This is pretty unambiguous (to me). What happens is that we notify each registered observer and THEN the clearChanged() method is invoked. However, in my testing, what I was finding was that the clearChanged() method was being invoked and THEN the registered observers were being called. The order which is documented is reversed from the order of what I seem to actually see. I then examined the source for Observable and seem to find that experienced behavior (clearChanged() and THEN notified observables is what is coded to happen). Given that this class has been around since Java 1.1, I must believe that I am somehow incorrect in my assumption that the observers are called and then clearChanged() is called. Can anyone see where my thinking is incorrect?
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24238377
answer count: 2
type: UnansweredQuestion
has title: Join a particular column in @JoinColumns
has answer: http://stackoverflow.com/a/24243883
has body: @ManyToOne @JoinColumns ({ @JoinColumn(name="ADDR_ID", referencedColumnName="ID"), @JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP") }) public Address getAddress() { return address; } How to join a particular column in @JoinColumns? For instance, if there is a composite PK in Address class containing ID and ZIP, how can I join only the "ID" column so that only a ADDR_ID column is created and not ADDR_ZIP? @MapsId("ID") is not working to refer to only ID and exclude ZIP. Is it possible in hibernate?
has comment: http://stackoverflow.com/comment/37451802
score: 0
has comment: http://stackoverflow.com/comment/37451436
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24247205
type: Question

http://stackoverflow.com/comment/37279287
comment on: http://stackoverflow.com/q/24156005
type: Comment
type: QuestionComment
score: 1
has text: I believe you need to do 4 backslashes, each one of the 2 you are trying to represent needs to be escaped.

deep-linking
tags question: http://stackoverflow.com/q/24131011
type: Tag
tag name: deep-linking

http://stackoverflow.com/comment/37318025
has text: @PaulHicks I have tried that. That is why I am here.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24176662

http://stackoverflow.com/q/24218945
accepted answer: http://stackoverflow.com/a/35517189
has answer: http://stackoverflow.com/a/65915684
has comment: http://stackoverflow.com/comment/37519207
has comment: http://stackoverflow.com/comment/37519304
tagged with: newline
has answer: http://stackoverflow.com/a/35517189
has body: Using Java/Scala. I am sending this string (an sms message) to a user mobile number by a Twilio Account. var body = "Hello from Govind Singh Nagarkoti! Your verification code is " + code This goes out to the user mobile, in 1 line. I want a newline after the first sentence. I want the user to receive: "Hello from Govind Singh Nagarkoti! Your verification code is 240190" How can I enter a line break?
has answer: http://stackoverflow.com/a/57252456
has answer: http://stackoverflow.com/a/41349627
type: AnsweredQuestion
upvote count: 19
has answer: http://stackoverflow.com/a/24219023
tagged with: playframework
has comment: http://stackoverflow.com/comment/37398341
tagged with: java
has comment: http://stackoverflow.com/comment/37398185
downvote count: 0
answer count: 7
possible better answer: http://stackoverflow.com/a/41349627
score: 19
has answer: http://stackoverflow.com/a/37106489
has title: How do I add a line break in my Twilio SMS message?
favorite count: 0
has answer: http://stackoverflow.com/a/24219931
type: Question
tagged with: twilio
tagged with: scala

http://stackoverflow.com/a/24277133
has comment: http://stackoverflow.com/comment/37519543
has comment: http://stackoverflow.com/comment/37735167
answers question: http://stackoverflow.com/q/24235251
score: 0
type: Answer
has body: socket.setSoLinger( (SO_LINGER &gt;= 0) ,SO_LINGER ); Get rid of this line completely, in both server and client. This is the other way to provoke connection resets, besides what I said in comments. Just remove it. You don't need it. It's a problem, not a solution.
has comment: http://stackoverflow.com/comment/37735280
has comment: http://stackoverflow.com/comment/39309865
has comment: http://stackoverflow.com/comment/37574449

http://stackoverflow.com/a/24266356
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24261544
has comment: http://stackoverflow.com/comment/37498633
type: Answer
accepted answer of: http://stackoverflow.com/q/24261544
has body: The problem appears to be that jasypt is looking for the class org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProvider‌​Impl which is no longer available for versions of Hibernate 4.3.x and above. Try reverting to Hibernate 4.2.13.Final and retry.
score: 1
upvote count: 1

http://stackoverflow.com/comment/37425859
comment on: http://stackoverflow.com/a/24233210
type: Comment
score: 0
type: AnswerComment
has text: Is one of you able to clarify what alterations I would have to make to the AsyncTask to make that work?

http://stackoverflow.com/q/24124415
has answer: http://stackoverflow.com/a/24124469
has comment: http://stackoverflow.com/comment/37219793
tagged with: java
has answer: http://stackoverflow.com/a/24124596
has answer: http://stackoverflow.com/a/24124478
score: -1
has comment: http://stackoverflow.com/comment/37220079
answer count: 3
upvote count: 0
has body: If i have following code for a Java program class Dotcom{ private int positions[];// position is reference variable at class level //some other instance variables // suppose here we have setter for initialising "positions" public void Somefun (){ int modifier [positions.length]; // code for initialising "modifier" positions = modifier; } } So my question is that when Somefun function returns then the portion of memory to which modifier is referencing will be eligible for garbage collection as modifier is destroyed.So does the statement positions = modifier; makes sense as now to which area of memory positions is referencing?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37220277
has title: Is it safe to assign reference variable,which is of method level to Class level reference variable?
downvote count: 1
tagged with: member-functions
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37219859

http://stackoverflow.com/q/24204677
has answer: http://stackoverflow.com/a/24204937
accepted answer: http://stackoverflow.com/a/24204937
tagged with: swing
has body: the following code has been generated with the eclispe gui builder: import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JSeparator; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.UnsupportedLookAndFeelException; import org.apache.log4j.Logger; public class MainWindow { /** * Logger */ private static final Logger log = Logger.getLogger(MainWindow.class); /** * main JFrame */ private JFrame frame; /** * JTextPane */ private JTextPane textPane; private JTextField textField; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { setLookAndFeel(); MainWindow window = new MainWindow(); // window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public MainWindow() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setSize(450,368); // frame.setBounds(100, 100, 580, 261); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu mnMain = new JMenu("Main"); menuBar.add(mnMain); JMenuItem about = new JMenuItem("About"); mnMain.add(about); about.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new HelpWindow(); } }); JMenuItem mntmExit = new JMenuItem("Exit"); mnMain.add(mntmExit); mntmExit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(-1); } }); textPane = new JTextPane(); JButton btnRun = new JButton("Run…
type: AnsweredQuestion
has title: EclipseWindow Builder - JFrame cannot be scaled
possible better answer: http://stackoverflow.com/a/24205273
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24205273
tagged with: eclipse
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/q/24168246
score: 5
upvote count: 5
has title: Replicate Java's PBEWithMD5AndDES in Python 2.7
possible better answer: http://stackoverflow.com/a/44509919
tagged with: encryption
has body: If it's not immediately obvious, let me start by saying I am not a crypto person. I have been tasked with replicating the behavior of Java's PBEWithMD5AndDES (MD5 digest with DES encryption) in Python 2.7. I do have access to Python's cryptography toolkit PyCrypto. Here is the Java code whose behavior I am trying to replicate: import java.security.spec.KeySpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import java.security.spec.AlgorithmParameterSpec; import javax.crypto.spec.PBEParameterSpec; import javax.crypto.Cipher; import javax.xml.bind.DatatypeConverter; public class EncryptInJava { public static void main(String[] args) { String encryptionPassword = "q1w2e3r4t5y6"; byte[] salt = { -128, 64, -32, 16, -8, 4, -2, 1 }; int iterations = 50; try { KeySpec keySpec = new PBEKeySpec(encryptionPassword.toCharArray(), salt, iterations); SecretKey key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec); AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterations); Cipher encoder = Cipher.getInstance(key.getAlgorithm()); encoder.init(Cipher.ENCRYPT_MODE, key, paramSpec); String str_to_encrypt = "MyP455w0rd"; byte[] enc = encoder.doFinal(str_to_encrypt.getBytes("UTF8")); System.out.println("encrypted = " + DatatypeConverter.printBase64Binary(enc)); } catch (Exception e) { e.printStackTrace(); } } } For the given values, it outputs the following: encrypted = Icy6sAP7adLgRoXNYe9N8A== Here's my ham-handed attempt to port the above to Python, encrypt_in_python.py: from Crypto.Hash import MD5 from Crypto.Cipher import DES _password = 'q1w2e3r4t5y6' _salt = '\x80\x40\xe0\x10\xf8\x04\xfe\x01' _iterations = 50 plaintext_to_encrypt = 'MyP455w0rd' if "__main__" == __name__: """Mimic Java's PBEWithMD5AndDES algorithm to produce a DES key""" hasher = MD5.new() hasher.update(_password) hasher.update(_salt) result = hasher.digest() for i in range(1, _iterations): hasher = MD5.new() hashe…
has answer: http://stackoverflow.com/a/44509919
has comment: http://stackoverflow.com/comment/37312567
has comment: http://stackoverflow.com/comment/64002525
has answer: http://stackoverflow.com/a/38291555
accepted answer: http://stackoverflow.com/a/24251226
type: AnsweredQuestion
tagged with: python-2.7
tagged with: des
downvote count: 0
has answer: http://stackoverflow.com/a/49120396
tagged with: java
tagged with: md5
has comment: http://stackoverflow.com/comment/64002521
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24251226
type: Question

http://stackoverflow.com/a/24111118
has body: You need a data storage mechanism. Shared Preferences, the SQLLiteDB or a server/backend like Parse.com would allow you easy data manipulation. Hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/24110905
score: 0

http://stackoverflow.com/comment/37269006
has text: As @Budius said this isn't normal. It seems as though you are locking up your thread which is exactly what isn't supposed to happen.
score: 2
comment on: http://stackoverflow.com/q/24150321
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37251981
has text: could you please explain a bit more?
comment on: http://stackoverflow.com/q/24141501
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24159758
downvote count: 0
favorite count: 0
type: Question
type: UnansweredQuestion
has title: How many Number of objects Created
answer count: 2
linked to: http://stackoverflow.com/q/17494176
has answer: http://stackoverflow.com/a/24160254
upvote count: 3
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/24159803
has body: In the below example, how many number of objects will be created? And also Explain the logic regarding the same? class test { public static void main(String args[]) { // 1 Integer Object Integer i=10; // 1 Integer Object Integer j=10; // sum of Integer Object Integer k=i+j; } } As per my knowledge it will create 2 objects. 1st for Integer i=10 it internally converts to Integer.valueOf(10) and then calls the valueof method of Integer and these internally calls the IntegerCache and gets the object by creation of it and stores in cache. similar for j as already it is cached it points to same object then the k object will be created. So total 2 . But some are saying that Integer values with in -127 to +128 we will get objects from cache. 1st for Integer i=10 it internally converts to Integer.valueOf(10) and then calls the valueof method of Integer and these internally calls the IntegerCache and gets the object by cache. similar for j from cache. and K value 20 also from cache. So objects will be zero. So I am not sure whether it is 0 or 2. If anyone knows please let me know.

http://stackoverflow.com/q/24174156
tagged with: java
has body: Using Apache POI 3.9, I want to map some values to an Excel template that looks similar to this: Looks pretty easy, at least for the Seller table in which I can map the values from my bean without problems. However, the issue I am facing is related to the Products table because I need to set the data from my bean for each column which makes the logic a little bit complex since during the loop process I'll need to look for the next column letter: e.g. My first product data will be set under B7 then at C7, D7, E7, etc until the loop ends. (Just to know, for this example template I am just showing the "Name" attribute of the product but each one has around 35 attributes in real life, that's why I am not showing the data in rows since the table won't look so friendly to the user in horizontal view). So, my question is: What happen If my products count is more than the total letters of the alphabet, how can I get the right column and cell during the loop process to set my product bean data following Excel column distribution? With "Excel column distribution" I mean the following: e.g. In Excel, when going to the column which contains the last letter of the alphabet "Z" then the columns continue showing AA, AB, AC, etc. Is it possible? This is what I've tried (using dummy data) and this will work until getting into the letter "Z" column: Empty Excel template used in this code snippet can be downloaded at: https://www.dropbox.com/s/eo0s54o9vkqhlbl/template.xls package com.app.test; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.use…
has title: Excel column distribution behavior during loop process, is it possible?
accepted answer: http://stackoverflow.com/a/24174236
tagged with: apache-poi
type: AnsweredQuestion
score: 0
answer count: 1
tagged with: export-to-excel
has answer: http://stackoverflow.com/a/24174236
type: Question

http://stackoverflow.com/q/24177758
has title: How to change session attribute value without using form fields
type: Question
upvote count: 0
answer count: 2
downvote count: 2
type: UnansweredQuestion
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/37319832
has answer: http://stackoverflow.com/a/24177854
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/24178879
tagged with: jboss
has body: In my knowledge we can use hidden form fields to change session values by manipulating hidden form field values using JavaScript. My question is can we do same without using hidden form fields. I searched for this and i don't find a answer for this. Thanks.
has comment: http://stackoverflow.com/comment/37320054
tagged with: servlets
favorite count: 0

http://stackoverflow.com/comment/37486441
score: 0
type: AnswerComment
has text: `Files.list` present only since Java 8, please, mention it.
comment on: http://stackoverflow.com/a/24265043
type: Comment

http://stackoverflow.com/a/24108884
has comment: http://stackoverflow.com/comment/37285295
has comment: http://stackoverflow.com/comment/37212459
answers question: http://stackoverflow.com/q/24107027
has comment: http://stackoverflow.com/comment/37271995
has comment: http://stackoverflow.com/comment/39156192
has comment: http://stackoverflow.com/comment/37212992
upvote count: 1
has comment: http://stackoverflow.com/comment/37272840
has comment: http://stackoverflow.com/comment/37272010
has comment: http://stackoverflow.com/comment/37271851
has comment: http://stackoverflow.com/comment/37212641
downvote count: 0
score: 1
type: Answer
has body: The description is in no way sufficient to give a profound answer. But based on the documentation of the method that causes the error, it seems that removing components from such a layout is simply not supported. You could use a different layout manager. Maybe a CardLayout could be helpful. In doubt, it should always be possible to introduce an additional container. I'll try to sketch the idea here, although nobody knows what your code looks like: class GUI { private JPanel containerA = new JPanel(new GridLayout(1,1)); void init() { ... // Here "grid" is the component that has the DesignGridLayout: grid.add(containerA); containerA.add(splitPaneA); } void whenTheButtonIsClicked() { containerA.removeAll(); containerA.add(splitPaneB); containerA.revalidate(); } }
has comment: http://stackoverflow.com/comment/37212701

http://stackoverflow.com/a/24212286
accepted answer of: http://stackoverflow.com/q/24212191
score: 7
type: AcceptedAnswer
downvote count: 0
has body: You really want a topological sort. The conditions are really edges in a graph, and the numbers are nodes. A topological sort will produce an order that preserves all the constraints.
answers question: http://stackoverflow.com/q/24212191
has comment: http://stackoverflow.com/comment/37385940
type: Answer
has comment: http://stackoverflow.com/comment/37386587
has comment: http://stackoverflow.com/comment/37386298
upvote count: 7

http://stackoverflow.com/comment/37233129
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24131245
type: QuestionComment
has text: Please post the full stack trace and any relevant implementation details of your `PropertiesPlaceholderConfigurer`.

http://stackoverflow.com/q/24214954
has comment: http://stackoverflow.com/comment/37391664
type: Question
has comment: http://stackoverflow.com/comment/37391423
tagged with: memory-management
has title: Android Java : Efficient redrawing for game?
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37391184
has comment: http://stackoverflow.com/comment/37391542
score: 0
has body: I would like to know what's the most power-efficient/memory-efficient way to invalidate onDraw() method. When my game is drawn every 50 miliseconds (using invalidate in a runnable), it looks smooth but I get GC_FOR_ALLOC size of 25% - 15%. Is this bad or good, or am I worrying too much about nothing?
answer count: 0
tagged with: java

http://stackoverflow.com/q/24223275
tagged with: public-key-encryption
tagged with: encryption
has answer: http://stackoverflow.com/a/24224570
accepted answer: http://stackoverflow.com/a/24224570
favorite count: 0
score: 14
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/45083824
has title: When to use X509EncodedKeySpec vs RSAPublicKeySpec?
has answer: http://stackoverflow.com/a/45083824
tagged with: java
has comment: http://stackoverflow.com/comment/82949397
upvote count: 14
type: Question
has body: I have a certificate in a text file, its contents look like: -----BEGIN PUBLIC KEY----- xxxx xxxx xxxx -----END PUBLIC KEY----- I believe this is a pem encoded certificate? So I want to load it now, I'm trying the following: X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec( readFileToByteArray("keyfile")); but I get an InvalidKeySpecException. If I load the file, cut off the begin/end header/footer, then base64 decode the 'xxxx' contents, I don't get any complaints: String contents = readFileToString("keyfile"); contents = contents.replace("-----BEGIN PUBLIC KEY-----", ""); contents = contents.replace("-----END PUBLIC KEY-----", ""); byte[] prepared = Base64.decode(contents); // ok. X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(prepared); is this the right way to load the key file? I see there's also a RSAPublicKeySpec class, which, based on the name, seems like something I'd be interested in here. But I believe it is only for generating certificates, not reading existing ones? Thanks
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/50215489

http://stackoverflow.com/q/24122382
type: AnsweredQuestion
has title: How to configure Maven2 to publish to Artifactory?
has body: Currently I have a Maven2 project that builds a JAR when you run: mvn clean package I need to now tweak the pom.xml to publish this JAR (myapp.jar) to an Artifactory server running at: http://myartifactory/artifactory/simple/myorg/myapp/0.1 I tried adding a element to my pom.xml but nothing is being published with this config: myartifactory http://myartifactory/artifactory/simple/ Any ideas as to how I could get publishing to work? For simplicity's sake, pretend that this Artifactory repo is authenticated to accept publishes/writes from a user with a username=foo and password=bar.
tagged with: java
answer count: 1
downvote count: 0
tagged with: artifactory
has comment: http://stackoverflow.com/comment/136548260
score: 29
has comment: http://stackoverflow.com/comment/37216613
tagged with: publish
favorite count: 0
has comment: http://stackoverflow.com/comment/37216255
type: Question
tagged with: maven
accepted answer: http://stackoverflow.com/a/24135640
has answer: http://stackoverflow.com/a/24135640
upvote count: 29

http://stackoverflow.com/comment/37238147
comment on: http://stackoverflow.com/a/24124765
score: 0
type: AnswerComment
type: Comment
has text: Please see this link and try to suggest your opinion there. [link](http://stackoverflow.com/questions/24134080/issue-with-executing-native-sql-query-in-hibernate)

http://stackoverflow.com/comment/37279113
comment on: http://stackoverflow.com/q/24154923
score: 0
type: Comment
has text: BTW - do the 4 different tables have 4 different groups of table column headers?
type: QuestionComment

http://stackoverflow.com/comment/37383529
has text: Throwing an exception from `main()` will print the stacktrace without any extra code. This means that the behavior of both examples is identical. The first one is a lot less typing.
comment on: http://stackoverflow.com/q/24211099
type: Comment
type: QuestionComment
score: 6

http://stackoverflow.com/comment/37484291
type: AnswerComment
score: 0
has text: I repeat what I would like to get. I have stored in the db the date 2014-06-18 10:00:00. When I ask for the date 2014-06-18, I have to get that row despite the time
comment on: http://stackoverflow.com/a/24263718
type: Comment

http://stackoverflow.com/q/24228675
has comment: http://stackoverflow.com/comment/70626228
has title: How to construct REST dto's?
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
has comment: http://stackoverflow.com/comment/37431666
downvote count: 0
has answer: http://stackoverflow.com/a/24230030
upvote count: 1
has comment: http://stackoverflow.com/comment/37416464
favorite count: 0
type: Question
tagged with: rest
has comment: http://stackoverflow.com/comment/37418947
type: UnansweredQuestion
has body: I am in the process of building a REST api which accepts a set of arguments, processes it and gives a boolean response. My question is how do I build a dto object. I can create a Java POJO in one of the applications and use it as REST parameter but that creates a dependency on this application. Is there a better way to pass an object as REST parameter? note: the reason I am not using path params because my dto object might contain a list of objects as well and I am not sure how to pass that using path param.

http://stackoverflow.com/a/24175035
downvote count: 0
has comment: http://stackoverflow.com/comment/37315010
has comment: http://stackoverflow.com/comment/59283359
type: Answer
has comment: http://stackoverflow.com/comment/37314996
has comment: http://stackoverflow.com/comment/37315032
accepted answer of: http://stackoverflow.com/q/24174947
type: AcceptedAnswer
score: 19
upvote count: 19
answers question: http://stackoverflow.com/q/24174947
has body: Start by making sure you are at the directory above the top level package If the class belongs to the package com.foo.bar, you want to be in the directory above com. In your case, you want to be in the directory above startPack. Then you need to use the fully qualified name to run the class... java statPack.mainClass For example...

http://stackoverflow.com/q/24214584
has title: JTable cant accept the values from String array
has body: Hey guys i am building a java application in which i have a jtable and i would like to have fixed columns from a string array. My code is: final String[] names = { "Id", "Description", "Type", "Price per Unit", "Quantity" }; JTable table = new JTable(new AbstractTableModel() { @Override public String getColumnName(int c) { return "lol"; } public int getRowCount() { return products.size(); } public int getColumnCount() { return 5; } public Object getValueAt(int row, int col) { Product p = products.get(row); if(col == 0){ return p.getId(); } if(col == 1){ return p.getDescription(); } if(col == 2){ if(p.getClass() == Service.class){ return "Service"; }else{ return "Item"; } } if(col == 3){ if(p.getClass() == Service.class){ Service service = (Service)p; return service.getNumberOfHours(); }else{ Item item = (Item) p; return item.getPricePerItem(); } } if(col == 4){ if(p.getClass() == Service.class){ Service service = (Service)p; return service.getPricePerHour(); }else{ Item item = (Item) p; return item.getQuantity(); } } return null; } }); the values from string[] do not show but the rest of the data is fine. Thanks in advance.
has comment: http://stackoverflow.com/comment/37390363
score: -1
accepted answer: http://stackoverflow.com/a/24214629
type: AnsweredQuestion
tagged with: jtable
has comment: http://stackoverflow.com/comment/37390431
has answer: http://stackoverflow.com/a/24214629
tagged with: abstracttablemodel
upvote count: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37390377
tagged with: swing
downvote count: 1
favorite count: 0
type: Question

jchart2d
tags question: http://stackoverflow.com/q/24244037
tag name: jchart2d
type: Tag
tags question: http://stackoverflow.com/q/24246800

swt
tags question: http://stackoverflow.com/q/24138782
tags question: http://stackoverflow.com/q/24165096
tags question: http://stackoverflow.com/q/24265298
tags question: http://stackoverflow.com/q/24247144
tags question: http://stackoverflow.com/q/24196127
tags question: http://stackoverflow.com/q/24215773
tags question: http://stackoverflow.com/q/24245071
tags question: http://stackoverflow.com/q/24106428
type: Tag
tags question: http://stackoverflow.com/q/24186246
tags question: http://stackoverflow.com/q/24129053
tags question: http://stackoverflow.com/q/24232139
tags question: http://stackoverflow.com/q/24240553
tags question: http://stackoverflow.com/q/24263920
tags question: http://stackoverflow.com/q/24185276
tags question: http://stackoverflow.com/q/24138049
tags question: http://stackoverflow.com/q/24207354
tags question: http://stackoverflow.com/q/24219360
tag name: swt
tags question: http://stackoverflow.com/q/24245554
tags question: http://stackoverflow.com/q/24261613
tags question: http://stackoverflow.com/q/24199047
tags question: http://stackoverflow.com/q/24253943
tags question: http://stackoverflow.com/q/24256485
tags question: http://stackoverflow.com/q/24117450

http://stackoverflow.com/q/24205443
has comment: http://stackoverflow.com/comment/37374142
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37386676
downvote count: 0
has comment: http://stackoverflow.com/comment/37372470
upvote count: 1
has answer: http://stackoverflow.com/a/24207692
has body: When i rum my application it will give me error MainActivity public class MainActivity&lt;XMPPConnection&gt; extends Activity { private ArrayList&lt;String&gt; messages = new ArrayList(); private Handler mHandler = new Handler(); private SettingsDialog mDialog; private EditText mRecipient; private EditText mSendText; private ListView mList; private XMPPConnection connection; public static String setConnection; /** * Called with the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Log.i("XMPPClient", "onCreate called"); setContentView(R.layout.activity_main); mRecipient = (EditText) this.findViewById(R.id.recipient); Log.i("XMPPClient", "mRecipient = " + mRecipient); mSendText = (EditText) this.findViewById(R.id.sendText); Log.i("XMPPClient", "mSendText = " + mSendText); mList = (ListView) this.findViewById(R.id.listMessages); Log.i("XMPPClient", "mList = " + mList); setListAdapter(); // Dialog for getting the xmpp settings mDialog = new SettingsDialog(this); new MyTask().execute(); // Set a listener to show the settings dialog Button setup = (Button) this.findViewById(R.id.setup); setup.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { new MyTask().execute(); } }); // Set a listener to send a chat text message Button send = (Button) this.findViewById(R.id.send); send.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String to = mRecipient.getText().toString(); String text = mSendText.getText().toString(); Log.i("XMPPClient", "Sending text [" + text + "] to [" + to + "]"); Message msg = new Message(to, Message.Type.chat); msg.setBody(text); ((org.jivesoftware.smack.XMPPConnection) connection).sendPacket(msg); messages.add(((org.jivesoftware.smack.XMPPConnection) connection).getUser() + ":"); messages.add(text); setListAdapter(); } }); } /** * Called by Settings dialog when a connection is establised with the XMPP server * * @param connection */ public vo…
has comment: http://stackoverflow.com/comment/37373963
has comment: http://stackoverflow.com/comment/37372569
has comment: http://stackoverflow.com/comment/37372219
score: 1
tagged with: android
tagged with: xmpp
tagged with: java
answer count: 1
favorite count: 0
type: Question
has title: Async Task runtime exception an error occured while executing doInBacground()

http://stackoverflow.com/a/24184676
has body: You are splitting s AT the letters. split uses for delimiters, so change your pattern [^a-z]
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24184581

http://stackoverflow.com/q/24251192
answer count: 2
has answer: http://stackoverflow.com/a/30664312
possible better answer: http://stackoverflow.com/a/30664312
has answer: http://stackoverflow.com/a/24251865
accepted answer: http://stackoverflow.com/a/24251865
has body: I have created an interceptor following the JBoss documentation. To test the interceptor, I put: @Interceptor @Transactional public class TransactionalInterceptor { @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { System.out.println("intercept!"); return ctx.proceed(); } } Now I wanted to test this interceptor in a unit test, using the WeldJUnit4Runner class. @RunWith(WeldJUnit4Runner.class) public class MyTest { @Test @Transactional // the interceptor I created public void testMethod() { System.out.println("testMethod"); anotherMethod(); } @Transactional public void anotherMethod() { System.out.println("anotherMethod"); } } Now the expected output would of course be intercept! testMethod intercept! anotherMethod But instead, the output is intercept! testMethod anotherMethod The main problem is that this is also true if I inject a bean into my test: The first method of the bean that I call gets intercepted, but if this method calls another method, the interceptor is not invoked. Any ideas at all are much appreciated! I just tried to modify my code as suggested by @adrobisch, and this works: @RunWith(WeldJUnit4Runner.class) public class MyTest { @Inject private MyTest instance; @Test @Transactional // the interceptor I created public void testMethod() { System.out.println("testMethod"); instance.anotherMethod(); } @Transactional public void anotherMethod() { System.out.println("anotherMethod"); } } The output is (as expected) intercept! testMethod intercept! anotherMethod However, the following does not work: @RunWith(WeldJUnit4Runner.class) public class MyTest { @Inject private MyTest instance; @Test // @Transactional &lt;- no interceptor here! public void testMethod() { System.out.println("testMethod"); instance.anotherMethod(); } @Transactional public void anotherMethod() { System.out.println("anotherMethod"); } } The output here is testMethod anotherMethod This seems to be according to spec, however! Everything is fine now.
type: AnsweredQuestion
score: 0
tagged with: weld-se
tagged with: java
tagged with: jboss
tagged with: weld
has title: CDI: Interceptor is not invoked when called from a JUnit test
has comment: http://stackoverflow.com/comment/37503780
type: Question
linked to: http://stackoverflow.com/q/17628405

recursion
type: Tag
tags question: http://stackoverflow.com/q/24176662
tags question: http://stackoverflow.com/q/24110820
tags question: http://stackoverflow.com/q/24148874
tags question: http://stackoverflow.com/q/24194896
tags question: http://stackoverflow.com/q/24148519
tags question: http://stackoverflow.com/q/24135195
tags question: http://stackoverflow.com/q/24111228
tags question: http://stackoverflow.com/q/24112875
tags question: http://stackoverflow.com/q/24140804
tag name: recursion
tags question: http://stackoverflow.com/q/24224666
tags question: http://stackoverflow.com/q/24241260
tags question: http://stackoverflow.com/q/24254534
tags question: http://stackoverflow.com/q/24138737
tags question: http://stackoverflow.com/q/24184852

http://stackoverflow.com/comment/37253350
type: AnswerComment
has text: it gives me error: "the method getText(int is undefined for the type ArrayList<Object>"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24141131

http://stackoverflow.com/a/24205056
downvote count: 2
type: Answer
has body: JIT compilation makes the code much faster while running than using an interpreter, but the initial cost can be prohibitive, depending on what is being done.
upvote count: 1
answers question: http://stackoverflow.com/q/24204638
score: -1

http://stackoverflow.com/comment/37354181
score: 0
type: AnswerComment
has text: Really, the "UB could mean deleting your hard drive" analogy hurts more than it helps
comment on: http://stackoverflow.com/a/24187596
type: Comment

http://stackoverflow.com/q/24245664
has comment: http://stackoverflow.com/comment/37455775
has comment: http://stackoverflow.com/comment/37451976
type: Question
tagged with: raspberry-pi
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37455404
score: 0
answer count: 1
has body: It may seems to be a beginner question, but I wrote a bit of code for my raspberry pi and wanted to execute terminal commands with java. So far so good. I got it finally figured out and got it working. But I also wanted my java function to give parametres to the function itself. But I can't figure out how to tell java how to use variables in strings. So heres my code: public static void rcswitch(int code,int unitcode, int onoff) throws InterruptedException, IOException { String command = "/bin/bash -c 'sudo /home/pi/rcswitch-pi/send code unitcode onoff'"; Process proc = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream())); String line = ""; while((line = reader.readLine()) != null) { System.out.print(line + "\n"); } proc.waitFor(); } It might not be the best option to use but it's working for me. Im currently giving the bash shell the following 'send' command but now I also wanted to use the given parametres. No matter how I write it down it doesn't seem to be working :( The code unitcode and onoff variables should be added after send with one space before each one. Thanks for your answer :)
has comment: http://stackoverflow.com/comment/37457986
has comment: http://stackoverflow.com/comment/37457333
has title: Executing terminal command with java using variables
tagged with: shell
tagged with: terminal
has answer: http://stackoverflow.com/a/24246371
tagged with: java

http://stackoverflow.com/q/24122586
favorite count: 0
type: Question
type: UnansweredQuestion
has body: What is the equivalent Java configuration for the Spring Security &lt;custom-filter&gt; tag? &lt;http&gt; &lt;custom-filter position="FORM_LOGIN_FILTER" ref="myFilter"/&gt; &lt;/http&gt; I tried http.addFilter( new MyUsernamePasswordAuthenticationFilter() ) where the class extends the default filter, but it always employs the formLogin default. My filter: import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; public class MyUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter{ // proof of concept of how the http.addFilter() works @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { if (!request.getMethod().equals("POST")) { throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); } System.out.println("running my own version of UsernmePasswordFilter ... "); String username = obtainUsername(request); String password = obtainPassword(request); if (username == null) { username = ""; } if (password == null) { password = ""; } username = username.trim(); UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); // Allow subclasses to set the "details" property setDetails(request, authRequest); return this.getAuthenticationManager().authenticate(authRequest); } } The relevant configuration piece: @Configuration @EnableWebMvcSecurity // annotate class configuring AuthenticationManagerBuilder @ComponentScan("com.kayjed") public class WebSec…
downvote count: 0
has answer: http://stackoverflow.com/a/25708102
has answer: http://stackoverflow.com/a/24144693
tagged with: spring-security
upvote count: 30
has title: How to represent the Spring Security "custom-filter" using Java configuration?
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37220148
tagged with: spring-java-config
score: 30
has answer: http://stackoverflow.com/a/27894366

http://stackoverflow.com/comment/37409068
score: 0
type: Comment
type: QuestionComment
has text: @PatriciaShanahan Already tried that, originally I had the bitwise one as the second one and then switched, no difference
comment on: http://stackoverflow.com/q/24224687

http://stackoverflow.com/a/24160424
score: 0
has body: If You are want to automate this kind of stuff, you can use Ant and preprocess your source code files with ReplaceRegExp task. We use this to compile the product version into the binaries. This is taken (and modified slightly) from the online doc: <fileset dir="${src.dir}" includes="**/*.java"/>
answers question: http://stackoverflow.com/q/24160160
type: Answer

http://stackoverflow.com/comment/37318825
has text: @ElliottFrisch thanks for the response but this code checks if it it a valid date or not so it should return false if i am using greater than 9999..is not it???but why it is returning true??
comment on: http://stackoverflow.com/q/24177111
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37306797
score: 1
type: Comment
type: QuestionComment
has text: What should be the result produced by your code?
comment on: http://stackoverflow.com/q/24170640

rmi
tags question: http://stackoverflow.com/q/24264947
tags question: http://stackoverflow.com/q/24137158
tags question: http://stackoverflow.com/q/24207723
tags question: http://stackoverflow.com/q/24154240
tags question: http://stackoverflow.com/q/24218483
tags question: http://stackoverflow.com/q/24193128
tag name: rmi
type: Tag
tags question: http://stackoverflow.com/q/24150925

http://stackoverflow.com/q/24152414
score: 0
tagged with: paint
has comment: http://stackoverflow.com/comment/37273226
has answer: http://stackoverflow.com/a/24152835
has comment: http://stackoverflow.com/comment/37273235
tagged with: java
has comment: http://stackoverflow.com/comment/37301322
answer count: 1
tagged with: applet
type: Question
has comment: http://stackoverflow.com/comment/37301256
has title: How Do I Fix a Code Too Large Error for a Java Applet?
tagged with: compiler-errors
tagged with: polygon
has body: import java.applet.Applet; import java.awt.*; public class ShadowApplet extends Applet { public void paint (Graphics page) { setBackground (Color.white); page.setColor(Color.black); int x[]={1,1,4,4}; int y[]={1,4,1,4}; page.fillPolygon(x,y,x.length); } } I have to draw a certain complex image with code in the above format except my arrays are hundreds and hundreds of point long and I have tens of polygons. And with the entry of my 26th polygon, my Java applet will no longer compile saying that my code is too large. How do I fix this?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37272791
has comment: http://stackoverflow.com/comment/37272864
has comment: http://stackoverflow.com/comment/37272953

http://stackoverflow.com/q/24113840
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
has title: How to decompress a RAR file in Android application with out of memory exception?
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/37278052
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25351016
has comment: http://stackoverflow.com/comment/37200981
tagged with: rar
has answer: http://stackoverflow.com/a/27042987
has body: I am writing an Android application for decompressing RAR files with the help of JunRar library. But during decompression of some type of RAR files, out of memory exceptions occur. Could somebody please help me to resolve this issue. I know, there is a problem with JunRar library, but if anyone found solution, please let me know. My analysis: If a RAR file is compressed with a PPM algorithm, this out of memory exception occurs because an attempt is made to allocate more memory than Android device VM has. startSubAllocator is allocating more memory than Android VM has by new byte [100] MB bytes. That exceeds available RAM of 96 MB of Android VM. Logs attached java.lang.OutOfMemoryError com.github.junrar.unpack.ppm.SubAllocator.startSubAllocator(SubAllocator.java:146) com.github.junrar.unpack.ppm.ModelPPM.decodeInit(ModelPPM.java:216) com.github.junrar.unpack.Unpack.readTables(Unpack.java:656) com.github.junrar.unpack.Unpack.unpack29(Unpack.java:165) com.github.junrar.unpack.Unpack.doUnpack(Unpack.java:120) com.github.junrar.Archive.doExtractFile(Archive.java:500) com.github.junrar.Archive.extractFile(Archive.java:442) com.github.junrar.testutil.ExtractArchive.extractArchive(ExtractArchive.java:73) com.github.junrar.testutil.ExtractArchive.extractArchive(ExtractArchive.java:29) com.letusread.util.DeCompressUtil.deCompress(DeCompressUtil.java:140) com.letusread.activity.FileListActivity$7.run(FileListActivity.java:338) java.lang.Thread.run(Thread.java:856)
has comment: http://stackoverflow.com/comment/37200498
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/37262488

http://stackoverflow.com/q/24140187
downvote count: 0
answer count: 3
has title: How to keep running my scheduler regardless of my server
score: 1
upvote count: 1
tagged with: scheduler
favorite count: 0
accepted answer: http://stackoverflow.com/a/24140560
has answer: http://stackoverflow.com/a/24140560
type: Question
has body: In my project i have a scheduler running, when I deploy my project on live server i have to stop the server deploy my changes and then to restart it. and in this whole process my scheduler reset. I want to run my scheduler in any case . Is this possible ?? If yes. How ?
has answer: http://stackoverflow.com/a/24145465
has comment: http://stackoverflow.com/comment/37249253
tagged with: java
has answer: http://stackoverflow.com/a/24140228
has comment: http://stackoverflow.com/comment/37249190
possible better answer: http://stackoverflow.com/a/24140228
type: AnsweredQuestion

http://stackoverflow.com/a/24183081
has comment: http://stackoverflow.com/comment/37329149
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37329167
has comment: http://stackoverflow.com/comment/37330482
downvote count: 0
has comment: http://stackoverflow.com/comment/37330753
answers question: http://stackoverflow.com/q/24183054
has body: What are your arrays holding? Strings? If so, then you can't do in Java == to compare strings. You need to use equals method. So your comparison will become: if (array1.get(i).equals(array2.get(i))) If they're holding other type of objects, then you need to make sure how equals method in those objects is defined.
type: Answer

http://stackoverflow.com/comment/37303523
type: QuestionComment
comment on: http://stackoverflow.com/q/24168946
type: Comment
has text: "SHOULD have thrown an error into the log," logging doesn't just happen by default, things are only logged if you log them. I agree with @user3580294, it does sound like it is probably swallowing all exceptions somewhere.
score: 1

http://stackoverflow.com/comment/37360072
has text: how can I do this with every element of a list rather than every character of a string?
comment on: http://stackoverflow.com/a/24198809
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24119225
tagged with: facebook-graph-api
type: Question
has answer: http://stackoverflow.com/a/24119289
type: UnansweredQuestion
tagged with: android
tagged with: facebook
has title: how to create a FB like from my app to a post in a FB page?
score: 0
has body: I have read that: 1) Doing like to external url The og.likes action can refer to any open graph object or URL, except for Facebook Pages or Photos. from SOF: you can only like Open Graph objects (URLs outside of Facebook) with this, not Facebook pages. 2) doing like to fb page Publishing ...it is not possible to like a Facebook Page via any API. You should use the Like Button if you want people to be able to like a page in your app. The server return to the client some FB posts urls in run time. So if I want to create "like" to a post in a FB page, I need to use the like button only?
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24119293

http://stackoverflow.com/comment/37441270
score: 0
type: Comment
type: QuestionComment
has text: put some code and also mention which technology you are using you only mentioned java but mention clearly jsp , servlet , or else...
comment on: http://stackoverflow.com/q/24241234

http://stackoverflow.com/a/24249185
type: Answer
has comment: http://stackoverflow.com/comment/37478063
score: 0
has body: Use a JOptionPane showing up on a specific event. For example the window closing event in the WindowListener. WindowListener wl = new WindowAdapter() { public void windowClosing(WindowEvent e) { // add the option pane code here } }; JFrame yourFrame = // your frame here yourFrame.addWindowListener(wl); A JOptionPane can be created as such: final JOptionPane optionPane = new JOptionPane( "The only way to close this dialog is by\n" + "pressing one of the following buttons.\n" + "Do you understand?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); Resulting option pane. Another alternative is to use one of the more specialized factory methods. int option = JOptionPane.showConfirmDialog(null,"Exit Application?"); if(option == JOptionPane.YES_OPTION) { System.exit(0); } When you add a new close handler like this i would suggest to deactivate the default handler using this code: yourFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); For more information about the setDefaultCloseOperation consult the documentation. Hope this helps
answers question: http://stackoverflow.com/q/24249093

http://stackoverflow.com/comment/37220102
type: AnswerComment
type: Comment
has text: Thanks for your answer. I couldn't find the frames with firebug or page source. Able to get your point when I **Inspected** in the firefox. Can you suggest any better-ways to find pagesource to avoid these problems?
score: 0
comment on: http://stackoverflow.com/a/24118931

http://stackoverflow.com/a/24116492
has comment: http://stackoverflow.com/comment/37204908
has body: If val was marked final (which would also prevent a subsequent assignment to null) then an NPE would not be possible: public final MyClass val = new MyClass(); Otherwise, yes, your code is brittle.
type: Answer
has comment: http://stackoverflow.com/comment/37205209
has comment: http://stackoverflow.com/comment/37204920
has comment: http://stackoverflow.com/comment/37205266
has comment: http://stackoverflow.com/comment/37313330
score: 3
has comment: http://stackoverflow.com/comment/37205415
upvote count: 3
answers question: http://stackoverflow.com/q/24116468
downvote count: 0
has comment: http://stackoverflow.com/comment/37204970

glassfish
tags question: http://stackoverflow.com/q/24187159
tags question: http://stackoverflow.com/q/24117040
tags question: http://stackoverflow.com/q/24135301
tags question: http://stackoverflow.com/q/24259984
tags question: http://stackoverflow.com/q/24147548
tags question: http://stackoverflow.com/q/24150521
tags question: http://stackoverflow.com/q/24221358
tags question: http://stackoverflow.com/q/24109509
tag name: glassfish
tags question: http://stackoverflow.com/q/24182416
tags question: http://stackoverflow.com/q/24222186
tags question: http://stackoverflow.com/q/24139798
tags question: http://stackoverflow.com/q/24245439
tags question: http://stackoverflow.com/q/24217448
tags question: http://stackoverflow.com/q/24237300
type: Tag

http://stackoverflow.com/comment/37289936
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24161848
score: 0
has text: : FATAL EXCEPTION: main : Process: com.vinnig.loginandplay, PID: 1022 : java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vinnig.loginandplay/com.vinnig.pages.AccountActivity}: java.lang.NullPointerException 06-11 07:36:25.914: E/AndroidRuntime(1022): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) : at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 06-11 07:36:25.914: E/AndroidRuntime(1022): at android.app.ActivityThread.access$800(ActivityThread.java:135)

http://stackoverflow.com/comment/37429533
has text: How do you "create fields?"
comment on: http://stackoverflow.com/q/24235290
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24181542
type: Answer
has body: I'm new too and for what I can say you can use your pom.xml to add all the dependencies that you need. For example, if you need to add spring context, you can just write its name and version. Maven thinks of how to find and import it. The syntax of the example is: org.springframework spring-context 3-0 For every dependence that you need, just write is groupId, artifactID and version, within the dependency tag and maven will think of everything. Hence you will have a list of these dependency tags in the pom.xml. Moreover, don't forget Maven use its structure ;)
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24178197
answers question: http://stackoverflow.com/q/24178197

http://stackoverflow.com/a/24207431
type: AcceptedAnswer
score: 32
has comment: http://stackoverflow.com/comment/40069127
downvote count: 0
has comment: http://stackoverflow.com/comment/37379058
accepted answer of: http://stackoverflow.com/q/24202473
has comment: http://stackoverflow.com/comment/37376815
has body: Keep in mind to develop against interface specifications -- not against the implementation. The implementation might change with the next Java version, whereas the specification should remain stable. The specification does not differentiate between sequential and parallel streams. For that reason, you should assume, that the combiner might be used. Actually, there are good examples showing that combiners for sequential streams can improve the performance. For example, the following reduce operation concatenates a list of strings. Executing the code without combiner has quadratic complexity. A smart execution with combiner can reduce the runtime by magnitudes. List&lt;String&gt; tokens = ...; String result = tokens.stream().reduce("", String::concat, String::concat);
has comment: http://stackoverflow.com/comment/40069322
has comment: http://stackoverflow.com/comment/118154254
has comment: http://stackoverflow.com/comment/104202181
answers question: http://stackoverflow.com/q/24202473
type: Answer
upvote count: 32
has comment: http://stackoverflow.com/comment/104202618
has comment: http://stackoverflow.com/comment/104200257
has comment: http://stackoverflow.com/comment/104201386

http://stackoverflow.com/comment/37403719
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24221922
type: QuestionComment
has text: What do you mean specifically by "frontend"? JSPs? Thymeleaf? HTML + JS files?

http://stackoverflow.com/q/24241344
has body: I do use the Google Maps API v2 to get my location on the map. Is it possible to write the correct address in the information of the marker? I didn't find anything useful in the internet.. Here is my code. Thanks in advance! @SuppressLint("NewApi") public class MainActivity extends Activity implements LocationListener { GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); } @Override public void onLocationChanged(Location location) { map.clear(); MarkerOptions mp = new MarkerOptions(); mp.position(new LatLng(location.getLatitude(), location.getLongitude())); mp.title("my position"); map.addMarker(mp); map.animateCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(location.getLatitude(), location.getLongitude()), 16)); } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } }
has title: show my address in Maps
score: 0
tagged with: android
tagged with: java
tagged with: location
type: Question
tagged with: google-maps
has answer: http://stackoverflow.com/a/24242843
type: UnansweredQuestion
tagged with: dictionary
answer count: 1
has comment: http://stackoverflow.com/comment/37440835

http://stackoverflow.com/q/24247776
has answer: http://stackoverflow.com/a/24249661
has body: This was a question asked in one of my job interviews: You have 2 different classes (that implements Runnable) say EvenThread &amp; OddThread. As the name suggests, the EvenThread prints only even numbers and the odd thread prints only odd numbers, consider a range of 0-100. class EvenThread implements Runnable { @Override public void run() { for (int i = 0; i &lt;= 10; i += 2) { System.out.println(i); } } } class OddThread implements Runnable { @Override public void run() { for (int i = 1; i &lt; 10; i += 2) { System.out.println(i); } } } public class EvenOdd { public static void main(String args[]) { Thread tEven = new Thread(new EvenThread()); Thread tOdd = new Thread(new OddThread()); tEven.start(); tOdd.start(); } } Now we need to enforce a mechanism in such a way that, the numbers are printed in sequence (i.e. 0, 1, 2, 3, 4,.... and so on). I have seen many similar questions in Stack Overflow, but they have just one class to print number and 2 synchronized methods are invoked in it. Could any of the experts please suggest?
has title: Printing Even and Odd numbers using 2 different classes
has comment: http://stackoverflow.com/comment/37453273
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/6259745
possible better answer: http://stackoverflow.com/a/24249661
score: 6
has comment: http://stackoverflow.com/comment/37453333
has comment: http://stackoverflow.com/comment/37453354
has comment: http://stackoverflow.com/comment/37453173
accepted answer: http://stackoverflow.com/a/24248120
upvote count: 6
has comment: http://stackoverflow.com/comment/37453419
has answer: http://stackoverflow.com/a/24248120
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38245505
answer count: 3
has comment: http://stackoverflow.com/comment/37454054
tagged with: java
tagged with: multithreading
tagged with: thread-synchronization
has comment: http://stackoverflow.com/comment/37453365
downvote count: 0

http://stackoverflow.com/q/24265313
downvote count: 1
favorite count: 0
has body: I understand that, in Java, there are no unsigned numbers, they're all signed with wizardry behind the scenes to make sense of it. So, I am puzzled by this, and it's probably that wizardry that I mentioned before that's eluding me. private static int broadcast = 0xffffffff; //4294967295 I'm using IntelliJ for an IDE, and in that, the above statement works fine. If I replace the hex number with the decimal #, I get a complaint that the number is too large. It's the same number, what am I missing? How I'm using it all: package com.company; import java.net.InetAddress; import java.net.UnknownHostException; public class Main { private final static int broadcast = 0xffffffff; //4294967295, or 255.255.255.255 private final static int firstClassE = 0xf0000000; //4026531840, or 240.0.0.0 public static int GetIntInetAddress(InetAddress toConvert) { final byte[] addr = toConvert.getAddress(); final int ipAddr = ((addr[0] &amp; 0xFF) &lt;&lt; (3 * 8)) + ((addr[1] &amp; 0xFF) &lt;&lt; (2 * 8)) + ((addr[2] &amp; 0xFF) &lt;&lt; (1 * 8)) + (addr[3] &amp; 0xFF); return ipAddr; } public static Boolean IsClassEAddress(InetAddress address) { int curAddr = GetIntInetAddress(address); System.out.println(String.format("curAddr: %d, firstClassE: %d, broadcast: %d", curAddr, firstClassE, broadcast)); return (curAddr &gt;= firstClassE &amp;&amp; curAddr &lt; broadcast) ? true : false; } public static void main(String[] args) throws UnknownHostException { String ip = "10.20.30.40"; InetAddress someIP = InetAddress.getByName(ip); if (IsClassEAddress(someIP)) { // Raise a flag System.out.println("Class E IP address detected."); } // Output of program is: // curAddr: 169090600, firstClassE: -268435456, broadcast: -1 } } In IntelliJ, there's another strange example of this behaviour. When I examine an address, the inspector is showing both the proper value and the negative value, as I've highlighted with red arrows in the pic below. Using Windows calc, I put in -84 and converted to hex and recei…
type: Question
has comment: http://stackoverflow.com/comment/37486480
has comment: http://stackoverflow.com/comment/37486461
has comment: http://stackoverflow.com/comment/37486416
score: -1
has answer: http://stackoverflow.com/a/24265415
possible better answer: http://stackoverflow.com/a/24265415
tagged with: int
has title: Java Int Confusion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37487156
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/24265377
accepted answer: http://stackoverflow.com/a/24265377
tagged with: java

http://stackoverflow.com/a/24188176
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37339313
answers question: http://stackoverflow.com/q/24186733
type: Answer
accepted answer of: http://stackoverflow.com/q/24186733
has comment: http://stackoverflow.com/comment/37342304
has body: JLabels are non-opaque by default. This means that whenever you change the text in the label, the background of the label must also be repainted. Therefore the panel that contains the label will also be repainted. Swing will usually determine a clipped area of the panel to be repainted. That is the rectangular area that contains the 3 labels will be repainted, not the entire panel. Post a SSCCE that demonstrates the problem if you need more help.
score: 1

http://stackoverflow.com/comment/37369405
type: Comment
has text: @blank Oh, by the way, when the exception is never thrown (When `Integer.parseInt()` receives `String` qualified as `Integer`) Using a `try{}` block DOES have better performance. But when the exception is thrown more than a dozen times, regex performance is drastically better. So it seems like this is more algorithm-ended, but preferably use regex anyway. :D
type: AnswerComment
comment on: http://stackoverflow.com/a/24200027
score: 1

http://stackoverflow.com/comment/131384438
comment on: http://stackoverflow.com/a/24855210
type: Comment
type: AnswerComment
score: 3
has text: On right click on Global Repository the "rebuild index" is not there - any idea how to get it?

http://stackoverflow.com/comment/37249808
score: 0
type: Comment
type: QuestionComment
has text: Please add the output of `mvn dependency:tree`. To troubleshoot you probably want to add a memory profiler to the app to see what is taking up the memory. Also you are using `spring-boot-starter-actuator` which by default keeps metrics in-memory, might be worth to see what happens without the actuator.
comment on: http://stackoverflow.com/q/24129446

http://stackoverflow.com/q/24115720
has answer: http://stackoverflow.com/a/24115750
has title: Why does method Queue#add() has boolean return value?
accepted answer: http://stackoverflow.com/a/24115757
has answer: http://stackoverflow.com/a/24115757
possible better answer: http://stackoverflow.com/a/24115750
tagged with: collections
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37204340
answer count: 3
has answer: http://stackoverflow.com/a/24119527
upvote count: 3
tagged with: java
downvote count: 0
has body: I revised knowledge about Queue. I watch to the Queue interface. method add has following declaration : boolean add(E e); In java doc writes following: * @return true (as specified by {@link Collection#add}) Hence this method can return only true!!! Why does not this method return value declared as void ? This method declaration is enough confusing for me.
tagged with: queue
favorite count: 0
type: Question

http://stackoverflow.com/comment/37464180
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24253171
has text: I understand that. I know in order to have an intersection of two sets i have to use retainAll() function. What i cant figure out is how to make a method to get an intersection of a SET of set of Strings(get it?) from inside a map.
type: Comment

http://stackoverflow.com/a/24124236
has comment: http://stackoverflow.com/comment/37219738
has body: Did you try overriding tomcat.version in your application.properties? Specifically, setting it to 8.0.3 makes spring boot run 8.0.3 instead of whatever the default is.
score: 1
has comment: http://stackoverflow.com/comment/113662392
type: Answer
answers question: http://stackoverflow.com/q/24124193
downvote count: 1
has comment: http://stackoverflow.com/comment/37220266
upvote count: 2
has comment: http://stackoverflow.com/comment/37223189
has comment: http://stackoverflow.com/comment/37220596

http://stackoverflow.com/a/24153087
type: AcceptedAnswer
downvote count: 0
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24153008
has comment: http://stackoverflow.com/comment/76071541
type: Answer
answers question: http://stackoverflow.com/q/24153008
has body: The following code assumes you have an existing and open Hibernate org.hibernate.Session: public void doWorkOnConnection(Session session) { session.doWork(new Work() { public void execute(Connection connection) throws SQLException { //use the connection here... } }); } Should you need information on how to use the above classes, please read the Hibernate 3.5 Javadoc. Specifically, read Session and then Work.

http://stackoverflow.com/a/24207995
answers question: http://stackoverflow.com/q/24207887
downvote count: 0
has comment: http://stackoverflow.com/comment/37377293
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24207887
type: Answer
has body: Is there anyway I can just hide the rows when the button is pressed and show them when the other button is pushed? Use a RowFilter for your table. So you need some data in the table that you will be able to specify a filter for. Every time you click the button you will need to change the filter for the new requirements. Read the section from the Swing tutorial on Sorting and Filtering for more information and working examples.
score: 2
upvote count: 2

http://stackoverflow.com/q/24217378
has answer: http://stackoverflow.com/a/24217569
has answer: http://stackoverflow.com/a/24217506
tagged with: android
tagged with: java
score: -3
accepted answer: http://stackoverflow.com/a/24217506
has comment: http://stackoverflow.com/comment/37395469
type: Question
upvote count: 0
has title: Get Portion of String
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24217516
has body: I need to get the values after "Swap:". I've already developed a method to get the output from a shell command so I have a string that contains everything you see in the picture but now from the string I want to get ONLY the value after the Swap: How can i do this? These value are variable and can be even all three 0.
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/37395456
has answer: http://stackoverflow.com/a/24217516

http://stackoverflow.com/comment/37355750
has text: What happens if you manually jar your app and then run the jar (ensuring directory structure)? I'm not an IDEA user, but I'm just thinking that maybe `META-INF/services/java.util.spi.ResourceBundleControlProvider` isn't on the runtime classpath, or it isn't being inspected.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24195777
score: 0

http://stackoverflow.com/q/24116810
type: Question
has answer: http://stackoverflow.com/a/24117022
tagged with: nullpointerexception
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: NullPointerExceptions when parsing Json using Gson on Android
score: 0
answer count: 1
tagged with: gson
has body: I'm a bit new to posting on StackOverflow. I've done a whole bunch of searching, and I can't seem to find an answer that helps me solve my specific problem. I am trying to parse this particular Json: https://ajax.googleapis.com/ajax/services/search/images?v=1.0&amp;q=fuzzy%20monkey%27 I'm new to Json, and I am using Google Gson in order to parse it. It compiles fine. However it doesn't seem as if my Java classes are being populated with the proper info from the Json (I keep getting NullPointerExceptions), which is probably due to my lack of knowledge about Json. In this code, the NullPointerException comes specifically from the final int N = response.results.size() line from my Main Activity. My Main Activity: public class MainActivity extends ActionBarActivity { public static InputStream json; @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(); } ResponseData response = new ResponseData(); new JsonAsync(this, response).execute(); final int N = response.results.size(); final TextView[] myTextViews = new TextView[N]; // create an empty array; for (int i = 0; i &lt; N; i++) { // create a new textview final TextView textView = new TextView(this); textView.setText("Image Name:" + response.results.get(i).titleNoFormatting); RelativeLayout myLayout = (RelativeLayout) findViewById(R.id.container); // add the textview to the linearlayout myLayout.addView(textView); // save a reference to the textview for later myTextViews[i] = textView; } } @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 //…

version
tags question: http://stackoverflow.com/q/24164929
type: Tag
tag name: version
tags question: http://stackoverflow.com/q/24114331

http://stackoverflow.com/comment/37281308
type: QuestionComment
comment on: http://stackoverflow.com/q/24157054
score: 0
type: Comment
has text: How should "foobarfoo" be split?

http://stackoverflow.com/comment/37477890
comment on: http://stackoverflow.com/q/24260759
type: Comment
type: QuestionComment
has text: Why are you looking to print it without looping through it? If there's a decent reason, use a regex replacement?
score: 0

http://stackoverflow.com/comment/37560123
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24303350
has text: Since you seem to have a deeper understanding of this subject could you do me a favor and comment on my own "Solution" where I'm wrong (even if it solved the problem?)

http://stackoverflow.com/q/24264918
has body: I have a Java class named Friend public class Friend { public String friendsUserName; public boolean isFavorite; public boolean isFriend; } I get Json file from the server containing JsonArray of this class Friend. I use Gson class to parse and map the Json to the ArrayList&lt;Friend&gt;.I have to sort the array in following manner Top level elements are Friend who are isFavorite and isFriend Then the ArrayList contains remaining Friend who are only isFriend Finally the ArrayList contains Friend where isFriend is False. So for that I can use the method described on this ComparatorChain Or I can use the following way to properly sort the ArrayList&lt;Friend&gt; public ArrayList&lt;Friend&gt; friendsList; public void sortArrayList() { ArrayList&lt;Friend&gt; favoriteList = new ArrayList&lt;Friend&gt;(); ArrayList&lt;Friend&gt; friendOnlyList = new ArrayList&lt;Friend&gt;(); ArrayList&lt;Friend&gt; nonFriendList = new ArrayList&lt;Friend&gt;(); for (int length = friendsList.size(), i = length - 1; i &gt;= 0; i--) { Friend friend = friendsList.get(i); if (friend.isFriend) { if (friend.isFavorite) { favoriteList.add(friend); } else { friendOnlyList.add(friend); } } else { nonFriendList.add(friend); } friendsList.remove(i); } addAllAndClear(favoriteList); favoriteList = null; addAllAndClear(friendOnlyList); friendOnlyList = null; addAllAndClear(nonFriendList); nonFriendList = null; } public void addAllAndClear(ArrayList&lt;Friend&gt; updatedList) { Collections.sort(updatedList, nameComparator); friendsList.addAll(updatedList); updatedList.clear(); updatedList = null; } Comparator&lt;Friend&gt; nameComparator = new Comparator&lt;FriendListResponse.Friend&gt;() { @Override public int compare(Friend lhs, Friend rhs) { return lhs.friendsUserName.compareTo(rhs.friendsUserName); }; }; Efficiency wise which should I follow the ComparatorChain or my own method. I am developing this for Android platform,so Memory Management and Efficiency is of topmost priority. P.S. I am no good …
has title: Android/Java how to efficiently use multiple comparator in an ArrayList
possible better answer: http://stackoverflow.com/a/24265026
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37486253
score: 0
has answer: http://stackoverflow.com/a/24265026
answer count: 2
accepted answer: http://stackoverflow.com/a/24265219
tagged with: sorting
has answer: http://stackoverflow.com/a/24265219
type: Question
tagged with: arraylist
tagged with: android
tagged with: java

http://stackoverflow.com/a/24217532
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24215446
has comment: http://stackoverflow.com/comment/37460053
has comment: http://stackoverflow.com/comment/37459763
has comment: http://stackoverflow.com/comment/37459934
has body: You should not even need to manually define a context. If you want your app to be deployed on the root, simply rename your war to ROOT.war and put it in webapps directory (deleting all occurences). Tomcat looks into the webapps directory (actually, it can be changed by the appBase attribute on the Host) to deploy war. See tomcat Documentation for more details.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24215446
upvote count: 2

http://stackoverflow.com/comment/37222312
score: 1
comment on: http://stackoverflow.com/q/24125283
has text: Why are you configuring both a `SessionFactory` and a `EntityManagerFactory`? Both are managing the same entities.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37327103
has text: and of course..When I ll get the required reputation... you totally have my vote!
comment on: http://stackoverflow.com/a/24181923
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37207890
comment on: http://stackoverflow.com/q/24118050
has text: [tag:cygwin] provides `find` and _backtick_ command substitution on `Windows`.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24161961
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24162100
score: -3
has comment: http://stackoverflow.com/comment/37289530
upvote count: 0
tagged with: java
downvote count: 3
answer count: 1
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
has title: Issues with getting strings from the internet
type: Question
has body: So I'm trying to get my app to take text from a string file on the internet and display that. But it keeps crashing without giving me errors, so I don't know where the problem is occurring. Here's a copy of my current code (no errors being shown by my ide) package cara.app; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.BufferedHttpEntity; import org.apache.http.impl.client.DefaultHttpClient; import android.os.Build; import android.os.Bundle; import android.annotation.SuppressLint; import android.app.Activity; import android.content.res.Resources; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { int itemNumber = 1; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Resources res = getResources(); final Button exit = (Button) findViewById(R.id.ExitBtn); exit.setText("Close"); exit.setHeight(100); exit.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); System.exit(0); } }); final Button button = (Button) findViewById(R.id.HomeBtn); button.setText("" + res.getString(R.string.News) + "\n\n" + res.getString(R.string.Story_Title_1) + "\n\n" + res.getString(R.string.Story_Title_2) + "\n\n" + res.getString(R.string.Story_Title_3) + "\n\n" + res.getString(R.string.Story_Title_4) + "\n\n" + res.getString(R.string.Story_Title_5)); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { OpenNews1(); } catch (ClientProtocolException e) { OpenNews(); e.printStackTrace(); } catch (IOException e) { OpenNews(); e.pr…
tagged with: android
has comment: http://stackoverflow.com/comment/37289525

http://stackoverflow.com/q/24232513
upvote count: 18
accepted answer: http://stackoverflow.com/a/24234998
has answer: http://stackoverflow.com/a/24232759
tagged with: static-methods
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/116042445
tagged with: abstract
has answer: http://stackoverflow.com/a/75694156
has comment: http://stackoverflow.com/comment/107364498
tagged with: java
downvote count: 2
score: 16
has answer: http://stackoverflow.com/a/50082686
favorite count: 0
type: Question
tagged with: go
has answer: http://stackoverflow.com/a/24234998
has title: Equivalence of abstract classes/methods (Java) in Google Go
has comment: http://stackoverflow.com/comment/116076420
tagged with: interface
has comment: http://stackoverflow.com/comment/116175153
possible better answer: http://stackoverflow.com/a/24232759
has answer: http://stackoverflow.com/a/50794357
answer count: 6
has answer: http://stackoverflow.com/a/39279776
has body: I am new to Go and I'm wondering how I can implement a structure similar to abstract classes &amp; methods in Java. In Java, I'd do the following: abstract class A{ static method1(){ ... method2(); ... } abstract method2(); } class B extends A{ method2(){ ... } } class C extends A{ method2(){ ... } } I know about interfaces and structs. I could build an interface and then a struct to implement method1. But what about method2? I know that I can embed one interface in another and also a struct as a field of another struct. But I don't see a way to implement my structure with those methods. The only solution I see is to implement method1 both in class B and class C. Isn't there another way? Note: of course in my case it's not just one method. Also I've got a hierarchy of abstract classes and don't really want to move everything down to the 'subclasses'. The examples I've found on the internet are mostly with only one method per interface. It would be great if one of you guys could give me a hint here! Thanks.

http://stackoverflow.com/q/24266625
has answer: http://stackoverflow.com/a/24273451
type: UnansweredQuestion
has body: I am working on a java plugin and I was wondering if anyone could help me. I need to import a plugin that goes by the name of "LogBlock" and it has a lot of files if I compile it. So I was wondering if theres a way to import it into my eclipse workspace. (Decompile it and be able to edit it). Sorry if this question is unclear, if you need any questions about this question answered just say so. Thanks!
tagged with: minecraft
type: Question
tagged with: java
tagged with: bukkit
has title: How to import a java plugin into your eclipse workspace
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/36185552

http://stackoverflow.com/comment/86985814
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24224316
score: 0
has text: @DavidHunsicker thanks for pointing that out. I figured out why my app was crashing fromt that.

http://stackoverflow.com/a/43862916
downvote count: 0
answers question: http://stackoverflow.com/q/24115885
has comment: http://stackoverflow.com/comment/95073063
has body: Here is my code which i use on grails code .Its gives me two different report in one pdf. String reportDir = Util.getReportDirectory() // my report directory Map reportParams = new LinkedHashMap() Map reportParams1 = new LinkedHashMap() String outputReportName="Test_Output_copy" reportParams.put('parameter name',"parameter") reportParams1.put('copy',"Customer's Copy") JasperReportDef reportDef1 = new JasperReportDef(name: 'testBillReport.jasper', fileFormat: JasperExportFormat.PDF_FORMAT, parameters: reportParams, folder: reportDir) JasperReportDef reportDef2 = new JasperReportDef(name: 'testBillReport.jasper', fileFormat: JasperExportFormat.PDF_FORMAT, parameters: reportParams1, folder: reportDir) List<JasperReportDef> jasperPrintList = new ArrayList<JasperReportDef>(); jasperPrintList.add(reportDef1); jasperPrintList.add(reportDef2); ByteArrayOutputStream report1 = jasperService.generateReport(jasperPrintList); response.setHeader("Content-disposition", "inline;filename="+outputReportName+'.pdf') response.contentType = "application/pdf" response.outputStream << report1.toByteArray()
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/24189105
has comment: http://stackoverflow.com/comment/37371147
tagged with: http://stackoverflow.com/tag/json
has body: I am trying to develop a RESTful webservice for a project I am involved in, and this is all very new to me. I am trying to add a basic authentication to the webserver (my idea is that every application that uses the service to have credentials). There won't be any web interface to access it, at least at this point. I have been following a tutorial from Spring (http://spring.io/guides/tutorials/rest/), trying to change some things, mostly because I am trying to use the most recent releases of spring. I am stuck at what apparently seems to be a pretty simple part, that is, only allowing the user to insert a new value to the system with a valid username and password, however for some reason I keep getting the error 403 when I run the particular test. Here is my configuration: @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter{ @Autowired protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("user").password("password").roles("USER"); } @Override protected void configure(HttpSecurity http) throws Exception { http.antMatcher("/aggregators/**").authorizeRequests() .anyRequest().hasRole("USER") .and().httpBasic(); } } And in the test class the error comes from the class that buildindividual() builds the JSON private ResponseEntity&lt;Individual&gt; buildIndividual() { HttpEntity&lt;String&gt; requestEntity = new HttpEntity&lt;String&gt;( RestDataFixture.standardIndividualJSON2(), getHeaders("user:password")); RestTemplate template = new RestTemplate(); ResponseEntity&lt;Individual&gt; entity = template.postForEntity( "http://localhost:8080/aggregators/individuals", requestEntity, Individual.class); return entity; } static HttpHeaders getHeaders(String auth) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); byte[] codedString = Base64.encode(auth.getBy…
tagged with: spring
has comment: http://stackoverflow.com/comment/44364001
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37368746
tagged with: java
answer count: 1
has title: Spring-Security Basic HTML authentication
tagged with: spring-security
has answer: http://stackoverflow.com/a/27987460
accepted answer: http://stackoverflow.com/a/27987460
type: Question

http://stackoverflow.com/q/24203087
downvote count: 0
score: 6
linked to: http://stackoverflow.com/q/19393505
has answer: http://stackoverflow.com/a/28740659
has answer: http://stackoverflow.com/a/54424156
favorite count: 0
linked to: http://stackoverflow.com/q/8398259
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22268898
has answer: http://stackoverflow.com/a/24205776
upvote count: 6
has body: I'm currently trying to work on the code mentioned on a previous post called Replacing a text in Apache POI XWPF. I have tried the below and it works but I don't know if I am missing anything. When I run the code the text is not replaced but added onto the end of what was searched. For example I have created a basic word document and entered the text "test". In the below code when I run it I eventually get the new document with the text "testDOG". I have had to change the original code from String text = r.getText(0) to String text = r.toString() because I kept getting a NullError while running the code. import java.io.*; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.xwpf.extractor.XWPFWordExtractor; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; public class testPOI { public static void main(String[] args) throws Exception{ String filepath = "F:\\MASTER_DOC.docx"; String outpath = "F:\\Test.docx"; XWPFDocument doc = new XWPFDocument(OPCPackage.open(filepath)); for (XWPFParagraph p : doc.getParagraphs()){ for (XWPFRun r : p.getRuns()){ String text = r.toString(); if(text.contains("test")) { text = text.replace("test", "DOG"); r.setText(text); } } } doc.write(new FileOutputStream(outpath)); } EDIT: Thanks for your help everyone. I browsed around and found a solution on Replace table column value in Apache POI
has title: Replacing a text in Apache POI XWPF not working
has comment: http://stackoverflow.com/comment/37416001
answer count: 4
tagged with: ms-word
has answer: http://stackoverflow.com/a/43044025
tagged with: apache-poi
tagged with: java
has comment: http://stackoverflow.com/comment/37372715
tagged with: apache

http://stackoverflow.com/a/24298777
accepted answer of: http://stackoverflow.com/q/24139038
upvote count: 2
has body: I have found the answer: ((?:19|20)\\d\\d)/(0?[1-9]|1[012])/([12][0-9]|3[01]|0?[1-9])
answers question: http://stackoverflow.com/q/24139038
downvote count: 0
type: AcceptedAnswer
score: 2
type: Answer

http://stackoverflow.com/q/24129693
score: 0
tagged with: java
answer count: 1
has body: I've following export in my .bash_profile export PATH=/export/to/path/tools:$PATH export PATH=/export/to/path/:$PATH and when i run my code through command line and through python, every thing works fine but same path is not recognized when i run my java code. (python and java are running code to achieve exact same functionality) Can you tell what additional step is required in Java to export these paths? I am on Mac env.
has answer: http://stackoverflow.com/a/24130172
tagged with: unix
has comment: http://stackoverflow.com/comment/37230244
accepted answer: http://stackoverflow.com/a/24130172
has comment: http://stackoverflow.com/comment/37230294
type: Question
has comment: http://stackoverflow.com/comment/37230524
has comment: http://stackoverflow.com/comment/37230690
tagged with: python
has title: Export Env variable from Java
type: AnsweredQuestion

http://stackoverflow.com/q/24162637
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24164159
has comment: http://stackoverflow.com/comment/37291587
has comment: http://stackoverflow.com/comment/37291951
tagged with: java-8
accepted answer: http://stackoverflow.com/a/24164159
type: AnsweredQuestion
has body: I have some code: Stream&lt;String&gt; previewImagesURLsList = uploadedVideoItemObj.getPreviewImagesURLsList().parallel(); Stream&lt;HashMap&lt;String, Object&gt;&gt; imagesStream = previewImagesURLsList .map(new Function&lt;String, HashMap&lt;String, Object&gt;&gt;() { @Override public HashMap&lt;String, Object&gt; apply(String fileName) { HashMap&lt;String, Object&gt; m = new HashMap&lt;&gt;(); m.put("preview_file", fileName); m.put("parent_id", gotId); return m; } }); HashMap&lt;String, Object&gt;[] filesArr = imagesStream.toArray(HashMap[]::new); I got on line HashMap&lt;String, Object&gt;[] filesArr = imagesStream.toArray(HashMap[]::new); an exception java.lang.IllegalStateException: source already consumed or closed at java.util.stream.AbstractPipeline.sourceSpliterator(AbstractPipeline.java:455) at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:255) at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438) at my.site.objects.videoitems.uploadedVideoItems.dao.impl.JdbcUploadedVideoItemDAO.insert(JdbcUploadedVideoItemDAO.java:79) at my.site.processors.files.threads.ServerUploadedFileProcessor.processFileServer(ServerUploadedFileProcessor.java:53) at my.site.processors.files.threads.ServerUploadedFileProcessor.call(ServerUploadedFileProcessor.java:28) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) I can't understand, where is bug. What means this exception and in what cases in can be throwed?
score: 3
tagged with: java-stream
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
has title: Java - java.lang.IllegalStateException: source already consumed or closed

http://stackoverflow.com/q/24114358
downvote count: 0
score: 1
upvote count: 1
tagged with: tcp
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37201408
accepted answer: http://stackoverflow.com/a/24114397
has body: I am sending a byte by a TCP connection, when I send a single negative number (like -30 in this example) I get three bytes: Client Side: PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()))); out.write((byte)-30); out.flush(); out.close(); Server Side: is = new DataInputStream(clientSocket.getInputStream()); is.readFully(bbb); for (int i=0;i&lt;bbb.length;i++) System.out.println(i+":"+bbb[i]); what i get is: 0:-17 1:-65 2:-94 but I sent just -30
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37201333
has title: sending negative bytes with tcp
has comment: http://stackoverflow.com/comment/37201312
has answer: http://stackoverflow.com/a/24114397
type: AnsweredQuestion

http://stackoverflow.com/comment/37311702
score: 0
has text: instead of String comparission try milli second difference
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24173153

http://stackoverflow.com/a/24199842
score: 0
answers question: http://stackoverflow.com/q/24199768
has body: Yo can replce all sop with fileoutput strem and write everything in file if you want to write log then you can use log4j String content = "This is the content to write into file"; File file = new File("filename.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close();
type: Answer

http://stackoverflow.com/comment/37331267
score: 0
has text: Ok. I tried now and it worked. I forgot i had to make a new person every time, now i feel bad for asking such a question. Thanks for the fast response.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24184139

http://stackoverflow.com/comment/139367354
comment on: http://stackoverflow.com/a/79039541
type: Comment
type: AnswerComment
score: 1
has text: It seems like those print statements are not relevant to OP's question.

http://stackoverflow.com/comment/37411725
type: Comment
comment on: http://stackoverflow.com/q/24226063
type: QuestionComment
has text: Post the _full_ stacktrace.
score: 0

http://stackoverflow.com/a/24180157
has body: Do you try to call a static function from an object? Have you tried it without the keyword static ? And you could remove the "String[] args" ....
score: 0
has comment: http://stackoverflow.com/comment/37324855
type: Answer
has comment: http://stackoverflow.com/comment/37329260
accepted answer of: http://stackoverflow.com/q/24179266
answers question: http://stackoverflow.com/q/24179266
type: AcceptedAnswer

class
tags question: http://stackoverflow.com/q/24192697
type: Tag
tags question: http://stackoverflow.com/q/24175530
tags question: http://stackoverflow.com/q/24131917
tags question: http://stackoverflow.com/q/24120446
tags question: http://stackoverflow.com/q/24126126
tags question: http://stackoverflow.com/q/24246278
tags question: http://stackoverflow.com/q/24198536
tags question: http://stackoverflow.com/q/24262467
tags question: http://stackoverflow.com/q/24169906
tags question: http://stackoverflow.com/q/24178171
tag name: class
tags question: http://stackoverflow.com/q/24154743
tags question: http://stackoverflow.com/q/24246569
tags question: http://stackoverflow.com/q/24122365
tags question: http://stackoverflow.com/q/24160206
tags question: http://stackoverflow.com/q/24106990
tags question: http://stackoverflow.com/q/24127638
tags question: http://stackoverflow.com/q/24189563
tags question: http://stackoverflow.com/q/24206828
tags question: http://stackoverflow.com/q/24113647
tags question: http://stackoverflow.com/q/24245367
tags question: http://stackoverflow.com/q/24229161
tags question: http://stackoverflow.com/q/24221077

http://stackoverflow.com/q/24209568
answer count: 2
accepted answer: http://stackoverflow.com/a/24209720
tagged with: validation
tagged with: java
has answer: http://stackoverflow.com/a/24209720
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/24212985
has comment: http://stackoverflow.com/comment/37380383
has answer: http://stackoverflow.com/a/24212985
has comment: http://stackoverflow.com/comment/37380587
has title: Continually Validating Integers
has body: I have a method I'm using to validate user-inputted values in a program. Whenever the user inputs a string into a JOptionPane, I call this method and pass in the inputted string, plus the maximum and minimum values I need their input to be between. First I check if the input is an integer by trying to parse the input string and catching exceptions, then I check if the integer is between the min and max. My problem is that if the user inputs another incorrect non-integer value after being prompted, I don't know how to check if the new value is correct or not. Here is the method, can anybody help? int checkInput(String input, int min, int max) { Boolean isInteger = false; Boolean inputAccepted = false; int userInput = 0; //will be set later while (!isInteger) { try { userInput = Integer.parseInt(input); } catch (NumberFormatException e) { userInput = Integer.parseInt(JOptionPane.showInputDialog("Please enter only integers between " + min + " and "+ max + ".")); isInteger = true; //the problem here is that it assumes the user inputted a correct value after being prompted... what if they enter another incorrect value? } } while (!inputAccepted) { if (userInput &lt; min || userInput &gt; max) { userInput = Integer.parseInt(JOptionPane.showInputDialog("Please enter only integers between " + min + " and "+ max + ".")); } else { inputAccepted = true; } } return userInput; }
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/24115745
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37203636
has answer: http://stackoverflow.com/a/24122073
score: 0
has comment: http://stackoverflow.com/comment/37203704
has comment: http://stackoverflow.com/comment/37203595
tagged with: android-sdk-2.3
tagged with: java
possible better answer: http://stackoverflow.com/a/24115859
accepted answer: http://stackoverflow.com/a/24115842
tagged with: eclipse
answer count: 4
has comment: http://stackoverflow.com/comment/37203688
type: Question
has title: No active compatible AVD's or devices found. --- getting this message only for SAMSUNG Devices
tagged with: android
has answer: http://stackoverflow.com/a/24115859
has body: I am new in android development. I have downloaded Android SDK + eclipse. and did the settings as mentioned here. I am using two mobile sets i) Micromax canvas A11 and ii) SAMSUNG Galaxy S3. For Micromax it is working properly. I can able to run my hello world application in micromax. But same app is not working in SAMSUNG. It gives me this error message [2014-06-09 13:03:14 - SamsungOne] No active compatible AVD's or devices found. Relaunch this configuration after connecting a device or starting an AVD. what to do... please help. And I have to develop application for SAMSUNG S3 only. And I referred other posts of stackoverflow. but getting the same error. In device manager it is showing like this ....
has answer: http://stackoverflow.com/a/24115842
has answer: http://stackoverflow.com/a/24115952
has comment: http://stackoverflow.com/comment/37203647

http://stackoverflow.com/a/24188751
type: Answer
upvote count: 10
has comment: http://stackoverflow.com/comment/37340032
has comment: http://stackoverflow.com/comment/37340122
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24188704
downvote count: 0
has body: assertSame(Object, Object) checks if both arguments refer to the same object. It performs boxing conversion to convert 200 to a valid reference type object. To do this, it does Integer.valueOf(200); and Integer.valueOf(code); which return new object references which do not reference the same object.
answers question: http://stackoverflow.com/q/24188704
has comment: http://stackoverflow.com/comment/37340238
score: 10

http://stackoverflow.com/comment/63765453
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/38168996
has text: What's the exception for?
score: 0

http://stackoverflow.com/q/24161248
tagged with: swing
tagged with: awt
tagged with: windowlistener
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24162113
score: 0
possible better answer: http://stackoverflow.com/a/24161423
has answer: http://stackoverflow.com/a/24162113
tagged with: java
has comment: http://stackoverflow.com/comment/37290162
has title: Why WindowListener in a Swing application?
has body: I am seeing the following code in a Swing demo application: WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); Why would you use this code to close the application? What would happen without it, and/or are there other (shorter) options to do this?
type: Question
answer count: 2
tagged with: jframe
has answer: http://stackoverflow.com/a/24161423

http://stackoverflow.com/q/24144073
has answer: http://stackoverflow.com/a/24144326
has answer: http://stackoverflow.com/a/24161287
has answer: http://stackoverflow.com/a/39905468
possible better answer: http://stackoverflow.com/a/24144326
accepted answer: http://stackoverflow.com/a/24161287
score: 168
upvote count: 168
favorite count: 0
type: Question
tagged with: maven
has title: Why does Maven warn me about encoding?
answer count: 4
type: AnsweredQuestion
tagged with: maven-archetype
has body: My goal is to create an archetype from a project. When I run a goal that does not involve the maven-archetype-plugin, I can't see any warning: [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-archetype-base --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-archetype-base --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] On the other end, when I run archetype:create-from-project, I get a couple: [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-archetype-base-archetype --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 10 resources [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-archetype-base-archetype --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 2 resources I know that the "standard" maven way is to use the project.build.sourceEncoding property. I tried adding some more properties to the pom in order to address this issue but none of them worked. Any ideas? Thanks. I have the following pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 my.group.id my-artifact 0.0.1 maven-archetype <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.source>1.7</maven.compiler.source> UTF-8 <project.build.sourceEncoding>${encoding}</project.build.sourceEncoding> <project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding> <project.resources.sourceEncoding>${encoding}</project.resources.sourceEncoding> <archetype.encoding>${encoding}</archetype.encoding…
has answer: http://stackoverflow.com/a/78537156
downvote count: 0
tagged with: java

http://stackoverflow.com/q/24256766
has answer: http://stackoverflow.com/a/24257398
type: Question
has comment: http://stackoverflow.com/comment/37471753
tagged with: spring
has comment: http://stackoverflow.com/comment/37470757
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37470833
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/37470663
has title: Spring not able to inject values through property tag
tagged with: java
answer count: 1
has body: I am using simple setter injection for setting values to a varaible in a class But when i try to run the application, the object returns me null values What could be the reason? Below are the files. Spring.XML &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans2.0.dtd"&gt; &lt;beans&gt; &lt;bean id = "triangle" class="com.test.Triangle"&gt; &lt;property name = "type" value = "Equilateral" /&gt; &lt;/bean&gt; &lt;/beans&gt; Triangle.java public class Triangle { private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } public void draw() { System.out.println(getType() + " Triangle drawn"); } } DrawingApplication.java package com.test; public class DrawingApplication { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml"); Triangle t = (Triangle) context.getBean("triangle"); t.draw(); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/37470622
upvote count: 1
has comment: http://stackoverflow.com/comment/37470632
favorite count: 0

http://stackoverflow.com/comment/74124856
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24672158
has text: Note from the future: cdn.mathjax.org is nearing its end-of-life, check https://www.mathjax.org/cdn-shutting-down for migration tips (and perhaps update your answer for future readers).
type: Comment

http://stackoverflow.com/q/24260937
has title: Unable to cancel async task execution
score: 0
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24261147
has comment: http://stackoverflow.com/comment/37478551
has comment: http://stackoverflow.com/comment/37478185
has body: Am getting exception when the user continuously clicking the button on which am calling the async task. So is there any way to cancel the execution of first async task execution on second time pressing the button. I hope u understand the problem. The codes am using is given below. On button click am using the following code GetData obj= new GetData(); String urls="http://pathramonline.com/?cat=46"; obj.execute(urls); My async task public class GetData extends AsyncTask&lt;String, Void, String&gt;{ @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub BufferedReader reader =null; String data =null; try{ HttpClient client = new DefaultHttpClient(); URI uri=new URI(params[0]); HttpGet get =new HttpGet(uri); HttpResponse response= client.execute(get); InputStream stream=response.getEntity().getContent(); reader = new BufferedReader(new InputStreamReader(stream)); StringBuffer buffer =new StringBuffer(""); String line=""; String newLine= System.getProperty("line.separator"); while((line=reader.readLine())!=null){ buffer.append(line+newLine); } reader.close(); data = buffer.toString(); return data; } catch(URISyntaxException e){ e.printStackTrace(); } catch(ClientProtocolException f){ f.printStackTrace(); } catch(IOException g){ g.printStackTrace(); } catch(Exception e) { // } finally{ if(reader!=null){ try{ reader.close(); } catch(Exception e){ } } } return null; } @Override protected void onCancelled() { } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); //TextView t3=(TextView)findViewById(R.id.textView3); if(result==null) { Intent home = new Intent(MainActivity.this,NoConnection.class); MainActivity.this.startActivity(home); MainActivity.this.finish(); } //Some actions } }
has comment: http://stackoverflow.com/comment/37478355
answer count: 2
has answer: http://stackoverflow.com/a/24261028
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/24112869
tagged with: java.util.scanner
accepted answer: http://stackoverflow.com/a/24112922
has answer: http://stackoverflow.com/a/24112922
answer count: 1
has body: After learning .Net, I decided to have my hand at Java. A little bit after recreating my Hello World, I decided to make a program that may have some limited use. It appears to run well enough until I give it the option to restart where input.nextline() seems to be completely ignored and it just loops indefinitely. Below I submit my small program designed to help my daughter in math. package sndgrdmth; import java.util.Scanner; import java.util.Random; public class sndgrd { public static void main(String[] args) { Boolean bool = true; Scanner input = new Scanner(System.in); Random rand = new Random(); while (bool == true) { System.out.println("Enter the highest number to add with:"); String str = input.nextLine(); while (isNum(str) == false) { System.out .println("Not a valid number.\rEnter your high number:"); str = input.nextLine(); } int i = Integer.parseInt(str); int counter = 0; int topCounter = 5; while (counter &lt; topCounter) { int a = rand.nextInt(i); int b = rand.nextInt(i); System.out.println(a + " + " + b + " = ?"); int j = input.nextInt(); if (j == a + b) { ++counter; System.out.println("Correct Answer " + counter + " of " + topCounter + "!!!"); } else { --counter; System.out.println("Incorrect Answer " + a + " + " + b + " = " + (a + b) + "\rLose one point."); } } System.out.println("Congrats! You Win! Do you want to play again? (Y/N)"); //The next line seems to get skipped. String repeat = input.nextLine(); if ((repeat == "N") || (repeat == "n")) { bool = false; }else{ bool = true; } } input.close(); } public static boolean isNum(String strNum) { boolean ret = true; try { Double.parseDouble(strNum); } catch (NumberFormatException e) { ret = false; } return ret; } }
type: AnsweredQuestion
has title: Issue with Scanner picking up an user input at end of program
tagged with: java
tagged with: input
type: Question
score: 0

http://stackoverflow.com/comment/37296629
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24165009
has text: And I figured it out... this is why hadoop needs to stop supporting multiple versions of itself or why I should stop jamming multiple tutorials together. Turns out my mapper needs to be set up like this for the way my mapper and record reader are set up to interact. public class WordSearchMapper extends Mapper<Text, Text, Text,IntWritable> { static String keyword; I only realized this after looking at my imports and seeing that reporter was from package org.apache.hadoop.mapred as opposed to org.apache.hadoop.mapreduce

http://stackoverflow.com/a/24156083
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/37279191
has body: filesList.split("\\"); should be filesList.split("\\\\");
has comment: http://stackoverflow.com/comment/37279274
type: Answer
has comment: http://stackoverflow.com/comment/37279214
answers question: http://stackoverflow.com/q/24156005
score: 2

http://stackoverflow.com/comment/37474214
type: Comment
comment on: http://stackoverflow.com/q/24159020
type: QuestionComment
score: 0
has text: Yep, just added build.xml content and 'package' folder content.

http://stackoverflow.com/comment/37479468
score: 1
has text: by removing [lines and root](http://stackoverflow.com/q/8843638/714968)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24261680

http://stackoverflow.com/comment/37202819
has text: I am not here making life difficult (despite the fact that it looks like)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24112256

http://stackoverflow.com/a/24198849
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24192842
type: Answer
has body: Instead of programatically clicking a button change it at least to use a AjaxSelfUpdatingTimerBehavior

http://stackoverflow.com/q/24206427
score: 0
type: UnansweredQuestion
answer count: 1
tagged with: apache-commons-daemon
type: Question
has answer: http://stackoverflow.com/a/25761370
has title: How to implement log file rotation in Apache Commons Daemon?
has body: Standard Unix daemons support the signal HUP to rotate log files. When ever a daemon receives the signal it closes all log files and reopens them. I have a daemon process in Java using Apache Commons Daemon. The daemon implementation supports three methods: init, start and stop. But I can not find any support for Unix signals. How to support the HUP signal to rotate log files?
tagged with: java
tagged with: unix
tagged with: daemon

http://stackoverflow.com/q/24238789
type: AnsweredQuestion
upvote count: 3
score: 3
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/37436116
downvote count: 0
has comment: http://stackoverflow.com/comment/37436019
has answer: http://stackoverflow.com/a/24239207
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24239341
has body: I have two classes representing travel segments - a Segment class and a Camp class. A Camp is technically a type of Segment but I can't change the entity design at this point so assume they are unrelated. Both Segments and Camps contain checkIn and checkOut Date fields. What I need to do is loop through a List of Segments and a List of Camps and call a certain function for each of the segments and camps in those lists. However, the function must be called in sequential date order for each of the segments and camps. Obviously I can sort the Lists of Segments and Camps separately but the problem arises if there's a Camp for which the function should be called in between Segments. So for example if I have the following: List of Segments Segment 1 - 10/16/14 Segment 2 - 10/24/14 List of Camps Camp 1 - 10/17/14 Camp 2 - 10/18/14 I'd need to perform an operation on the segments/camps in the following order: Segment 1 Camp 1 Camp 2 Segment 2 As I see it I have a few options to handle this but I'm wondering what is the most efficient / best way to do it. I could build some type of helper class that contains the fields of both Segments and Camps and create a list of objects of this helper class that contains either Segment or Camp detail. This is what I've got currently. I've decided to go with a Map approach of mapping Dates to Camps, so I iterate through the keys of the map (Dates) and see if any of those dates are before the segment date, and if so, perform the operation on them. Is there a better way to do this? It seems ugly and confusing to me. final Map&lt;Date, List&lt;Camp&gt;&gt; campMap = new HashMap(); for (Camp camp : pnr.getCamps()) { if (campMap.get(camp.getCheckInDate()) == null) { final List&lt;Camp&gt; camps = new ArrayList&lt;Camp&gt;(); camps.add(camp); campMap.put(camp.getCheckInDate(), camps); } else { campMap.get(camp.getCheckInDate()).add(camp); } } final List&lt;Date&gt; datesToDelete = new ArrayList&lt;Date&gt;(); for (Segment segment : pnr.getSegme…
accepted answer: http://stackoverflow.com/a/24239207
has title: Java - How to iterate through lists of separate objects by date?
has answer: http://stackoverflow.com/a/24239341

http://stackoverflow.com/q/24199148
has comment: http://stackoverflow.com/comment/37361763
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37361377
has title: Lambdas and functional interfaces with generic throw clauses
has comment: http://stackoverflow.com/comment/37368437
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37361303
has body: Consider this snippet of java 8 code: public class Generics { public static &lt;V, E extends Exception&gt; V f(CheckedCallable1&lt;V, E&gt; callable) throws E { return callable.call(); } public static &lt;V, E extends Exception&gt; V g(CheckedCallable2&lt;V, E&gt; callable) throws E { return callable.call(); } public static void main(String[] args) { f(() -&gt; 1); g(() -&gt; 1); } } interface Callable&lt;V&gt; { V call() throws Exception; } interface CheckedCallable1&lt;V, E extends Exception&gt; { V call() throws E; } interface CheckedCallable2&lt;V, E extends Exception&gt; extends Callable&lt;V&gt; { @Override V call() throws E; } The lambda at the call to f compiles fine, whereas the lambda at the call to g does not compile, but rather gives this compile error: Error:(10, 7) java: call() in &lt;anonymous Generics$&gt; cannot implement call() in CheckedCallable2 overridden method does not throw java.lang.Exception Why is this? It seems to me that both the CheckedCallable1.call and CheckedCallable2.call methods are equivalent: by the rules of type erasure, V becomes Object as it is unbounded, and E becomes Exception, as that's the upper type bound. So why does the compiler think the overridden method does not throw java.lang.Exception? Even disregarding type erasure, which is likely not relevant here because this is all happening at compile time, it still does not make sense to me: I don't see a reason why this pattern, if allowed, would result in, say, unsound java code. So can someone enlighten me as to why this isn't allowed? Update: So I found something that's maybe even more interesting. Take the above file, change each occurrence of Exception to IOException and add throws clause to main. Compile works! Change back to Exception: compile breaks! This compiles fine: import java.io.IOException; public class Generics { public static &lt;V, E extends IOException&gt; V f(CheckedCallable1&lt;V, E&gt; callable) throws E { return callable.call(); } public static &lt;V…
tagged with: generics
has comment: http://stackoverflow.com/comment/37361444
favorite count: 0
upvote count: 17
has comment: http://stackoverflow.com/comment/37360878
type: Question
score: 17
has comment: http://stackoverflow.com/comment/39875526
accepted answer: http://stackoverflow.com/a/24210879
has comment: http://stackoverflow.com/comment/37361486
has answer: http://stackoverflow.com/a/24210879
has comment: http://stackoverflow.com/comment/37361578
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/q/24198778
tagged with: java
linked to: http://stackoverflow.com/q/22914630
has body: I created a csv file with three columns in a row..in google bigquery in created a dataset with one table with csv file ....for this i completed my java code...but now i have to add a new column to existed row dynamically in java code..? // Main method for data print. @SuppressWarnings({ "rawtypes", "unchecked" }) public static void main(String[] args) throws IOException, InterruptedException { // Create a new BigQuery client authorized via OAuth 2.0 protocol Bigquery bigquery = createAuthorizedClient(); TableRow row = new TableRow(); row.set("Column1", "Sample23"); row.set("Column2", 7); row.set("Column3", "Sample25"); TableDataInsertAllRequest.Rows rows = new TableDataInsertAllRequest.Rows(); rows.setJson(row); List rowList = new ArrayList(); rowList.add(rows); TableDataInsertAllRequest content = new TableDataInsertAllRequest().setRows(rowList); TableDataInsertAllResponse response = bigquery.tabledata().insertAll(PROJECT_ID, DATASET_ID, TABLE_ID, content).execute(); System.out.println("Final response = " + response); }
possible better answer: http://stackoverflow.com/a/24210813
tagged with: google-bigquery
has answer: http://stackoverflow.com/a/24210813
favorite count: 0
accepted answer: http://stackoverflow.com/a/24209935
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24209935
upvote count: 0
tagged with: google-app-engine
score: -2
downvote count: 2
has title: How to Add new column dynamically to already existed table in bigquery..?
type: AnsweredQuestion

http://stackoverflow.com/a/24179711
answers question: http://stackoverflow.com/q/24140431
downvote count: 0
score: 1
upvote count: 1
has body: I am Social Media Developer at Aspose. I have reported your issue to Aspose.OCR developers through Aspose Support forums on your behalf. You can track the progress of the issue on below thread: http://www.aspose.com/community/forums/thread/552365/getting-blank-output-for-hand-writing-recognition.aspx
type: Answer

http://stackoverflow.com/comment/37254061
score: 0
has text: See also http://stackoverflow.com/questions/5305744/how-to-debug-servlet-using-eclipse
type: QuestionComment
comment on: http://stackoverflow.com/q/24141904
type: Comment

http://stackoverflow.com/q/24249093
type: AnsweredQuestion
downvote count: 2
upvote count: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24249185
has body: i developed a simple image editor in java, how can i do to show a message dialog when i click exit on a JFrame to ask the user if he want to save the work? thank's everybody
linked to: http://stackoverflow.com/q/7695064
favorite count: 0
type: Question
tagged with: netbeans
has answer: http://stackoverflow.com/a/24249933
accepted answer: http://stackoverflow.com/a/24249933
answer count: 2
tagged with: jframe
has title: how can i do showMessageDialog when i click exit on a JFrame
score: -1
has answer: http://stackoverflow.com/a/24249185
has comment: http://stackoverflow.com/comment/37455879

http://stackoverflow.com/a/58200081
has body: When using a hash algorithm that causes a lot of collisions, it is not appropriate to use a hash table because it will change lookup and insert from O(1) to O(log n).
answers question: http://stackoverflow.com/q/24261326
type: Answer
score: 0

http://stackoverflow.com/a/24213282
has comment: http://stackoverflow.com/comment/37388700
has comment: http://stackoverflow.com/comment/37503043
has comment: http://stackoverflow.com/comment/37503435
has comment: http://stackoverflow.com/comment/37503191
score: 2
has comment: http://stackoverflow.com/comment/37530285
has comment: http://stackoverflow.com/comment/37626940
has comment: http://stackoverflow.com/comment/37400297
has comment: http://stackoverflow.com/comment/37503501
has comment: http://stackoverflow.com/comment/37389187
upvote count: 2
has comment: http://stackoverflow.com/comment/37514551
has comment: http://stackoverflow.com/comment/37388914
has comment: http://stackoverflow.com/comment/37530806
downvote count: 0
has comment: http://stackoverflow.com/comment/37619470
has comment: http://stackoverflow.com/comment/37542871
has comment: http://stackoverflow.com/comment/37400781
answers question: http://stackoverflow.com/q/24213187
has comment: http://stackoverflow.com/comment/37389126
has comment: http://stackoverflow.com/comment/37538090
has body: Make sure that the new JDK is set in your CLASSPATH and PATH environment variables. Eclipse may still be using the old JDK1.6. You can call java -version to check the default version used on your machine. Also make sure that the eclipse.ini file in your Eclipse installation directory does not launch using JDK1.6. You can edit eclipse.ini so that it launches using JDK1.8: -vm /path/to/java1_8
has comment: http://stackoverflow.com/comment/37618104
type: Answer
has comment: http://stackoverflow.com/comment/37388494
has comment: http://stackoverflow.com/comment/37621225

http://stackoverflow.com/a/28544782
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24132601
score: 5
upvote count: 5
type: Answer
has body: The second argument of the API is "endRow" - by passing "currentRow+amount" you will not shift all rows starting from the insertion point up to the end. Rather, you will just shift "amount" rows - this could well cause an overwrite for all rows beyond "currentRow+amount" (if there are any). I would do it this way: sheet.shiftRows(currentRow, sheet.getLastRowNum()+1, amount, true,true);
answers question: http://stackoverflow.com/q/24132601
type: AcceptedAnswer

http://stackoverflow.com/comment/37438770
score: 0
has text: @Thilo Might be nice to get an update as to why the Java 8 compiler still allows this, since this behavior appears to be a bug...
comment on: http://stackoverflow.com/q/24240215
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37432263
type: AnswerComment
score: 0
has text: Add the `import java.text.NumberFormat` to the imports section
type: Comment
comment on: http://stackoverflow.com/a/24236504

http://stackoverflow.com/q/24248357
has comment: http://stackoverflow.com/comment/37455708
has comment: http://stackoverflow.com/comment/37455627
has comment: http://stackoverflow.com/comment/37456011
has body: I am implementing a Client Lookup Map where i am using ConcurrentHashamp. private ConcurrentHashMap&lt;String,SignupDTO&gt; map = new &lt;String,SignupDTO&gt; ConcurrentHashMap();* public SignupDTO get(String opcode) { return this.map.get(opcode); } public void set(String opcode,SignupDTO dto) { this.map.put(opcode, dto); } Here get and set function called from multiple thread to update and get client information. I have another function update() which is called from a specific thread after certain time and update the map with updated client information. public void update() { Connection connection = null; Statement stmt = null; ResultSet rs = null; try { connection = DatabaseManager.getInstance().getConnection(); stmt = connection.createStatement(); String sql= "select * from client"; rs = stmt.executeQuery(sql); while (rs.next()) { SignupDTO row = new SignupDTO(); ...... .......... this.map.put(key, row); } } } get and set operation on map will be thread safe or not? please help me.
tagged with: java
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/37454869
type: Question
has answer: http://stackoverflow.com/a/24249608
score: 0
has comment: http://stackoverflow.com/comment/37455145
type: UnansweredQuestion
has title: Set and Update concurrenthashmap from multiple thread
tagged with: multithreading
answer count: 1
has comment: http://stackoverflow.com/comment/37455038
tagged with: concurrenthashmap

http://stackoverflow.com/q/24160433
tagged with: java
tagged with: hibernate
tagged with: composite-primary-key
answer count: 1
tagged with: hql
type: Question
has title: Part of composite primary key also a foreign key
has body: I have two tables, one has a two part composite primary key where the first part is also the primary key of the other table. CustomerOfferAcceptance offer_id // primary key part 1 also a fk customer_id // primary key part 2 Offer id // primary key I would like to be able to join these two tables on offer_id and id. The code I have @Entity @Table(name = "customer_offer_acceptance", schema = "rz_customer") public class CustomerOfferAcceptance { @EmbeddedId private CustomerOfferPK key; @MapsId("offerId") @ManyToOne @JoinColumn(name="offer_id", referencedColumnName = "id") private Offer offer; } @Embeddable public class CustomerOfferPK implements Serializable { private static final long serialVersionUID = -8847738316352487377L; @Column(name = "customer_id") private String customerId; @Column(name = "offer_id") private String offerId; public CustomerOfferPK() { } public CustomerOfferPK(String customerId, String offerId) { super(); this.customerId = customerId; this.offerId = offerId; } } @Entity @Table(name = "offer", schema = "rz_customer") public class Offer implements Serializable{ private static final long serialVersionUID = -7842210981812803506L; @Id @Column(name="id") private String id; @OneToMany(cascade = CascadeType.ALL, mappedBy = "offer") private Collection&lt;CustomerOfferAcceptance&gt; CustomerOfferAcceptance; } I get an exception when parsing this query select o from persistence.domain.CustomerOfferAcceptance coa inner join persistence.domain.Offer o where coa.customer_id = :someId The exception: Caused by: java.lang.IllegalStateException: DOT node with no left-hand-side! at org.hibernate.hql.internal.ast.tree.DotNode.getLhs(DotNode.java:667) at org.hibernate.hql.internal.ast.tree.DotNode.getDataType(DotNode.java:644) at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:389) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3858) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromE…
tagged with: jpa
accepted answer: http://stackoverflow.com/a/24208605
has answer: http://stackoverflow.com/a/24208605
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/37419472
has text: @user3741402, the code at the bottom works fine, except it should be using BorderLayout.NORTH (instead of SOUTH). The point is the version you posted does not compile. Why do you expect us to spend time getting the code to compile???
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24225504
type: Comment

http://stackoverflow.com/comment/37239661
score: 0
type: AnswerComment
has text: Size( 20, 20*img.height/img.width );
comment on: http://stackoverflow.com/a/24134678
type: Comment

http://stackoverflow.com/comment/37246890
has text: You need to show the code for `SortList`
comment on: http://stackoverflow.com/q/24138947
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24219619
tagged with: java
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/29537551
tagged with: box2d
has comment: http://stackoverflow.com/comment/37403457
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39008234
tagged with: libgdx
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21293923
upvote count: 1
has comment: http://stackoverflow.com/comment/37401058
has title: Java, libgdx, box2d, Creating a Weld Joint When two objects collide
has body: I have 2 circles that are colliding. I want to weld them together when they collide. The code, within a beginContact function, is WeldJointDef def = new WeldJointDef(); def.collideConnected=false; Vector2 worldCoordsAnchorPoint = bodyA.getWorldPoint(new Vector2(0.0f,0.0f)); def.bodyA = bodyA; def.bodyB = bodyB; def.localAnchorA.set( def.bodyA.getLocalPoint(worldCoordsAnchorPoint) ); def.referenceAngle = def.bodyB.getAngle() - def.bodyA.getAngle(); def.initialize(def.bodyA, def.bodyB, worldCoordsAnchorPoint); world.createJoint(def); When the code runs, there is a c++ error, but it isn't very descriptive: AL lib: (EE) alc_cleanup: 1 device not closed Assertion failed! Program: C:\Program Files\Java\jre7\bin\javaw.exe File: /var/lib/jenkins/workspace/libgdx/extensions/gdx-box2d/gdx-box2d/jni/Box2D/Dynamics/b2World.cpp, Line 214 Expression: IsLocked() == false How do I get the weld to work? Or can you not create weld joints on the fly in this way?
score: 1

http://stackoverflow.com/comment/37403778
has text: Hard to pick the winning answer, i guess you can use the rep more then @Douglas :). The answer is pretty much the same.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24221680
type: AnswerComment

http://stackoverflow.com/a/24190290
type: Answer
has body: You can write custom deserializer for gson api you can implement JsonDeserializer for example: public class MyClass implements JsonDeserializer&lt;MyClass&gt;{ //fields and constructor @Override public MyClass deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { JsonObject jobject = (JsonObject) json; return new MyClass( jobject.get("a_num").getAsInt(), jobject.get("an_object").getAsString(), jobject.get("a_string").getAsString() ); } }
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37362485
answers question: http://stackoverflow.com/q/24190240

http://stackoverflow.com/a/24152648
upvote count: 3
downvote count: 0
has body: Well, this is because you are only reading one line from the file: scan = new Scanner(new FileReader(new File("files.txt"))); String nextLine = scan.nextLine(); In order to read the entire file you have to call scan.nextLine() until you reach the end of file. To check for end of file you can do a while loop and thus go through the whole file: Scanner input = new Scanner(new File("\""+filename+"\"")); while(input.hasNextLine()) { String data = input.nextLine(); //Do what you want with one line which is at each iteration stored in data }
type: Answer
has comment: http://stackoverflow.com/comment/37273818
answers question: http://stackoverflow.com/q/24152618
has comment: http://stackoverflow.com/comment/37273855
accepted answer of: http://stackoverflow.com/q/24152618
type: AcceptedAnswer
score: 3

email
tags question: http://stackoverflow.com/q/24266297
tags question: http://stackoverflow.com/q/24212514
tags question: http://stackoverflow.com/q/24156445
tags question: http://stackoverflow.com/q/24164318
tags question: http://stackoverflow.com/q/24198163
tags question: http://stackoverflow.com/q/24180618
tags question: http://stackoverflow.com/q/24146142
tags question: http://stackoverflow.com/q/24246391
tags question: http://stackoverflow.com/q/24129151
tags question: http://stackoverflow.com/q/24259421
tags question: http://stackoverflow.com/q/24250144
tags question: http://stackoverflow.com/q/24242594
tags question: http://stackoverflow.com/q/24193487
tags question: http://stackoverflow.com/q/24259966
tags question: http://stackoverflow.com/q/24199292
type: Tag
tag name: email

http://stackoverflow.com/q/24259508
upvote count: 17
type: Question
has comment: http://stackoverflow.com/comment/37475515
has body: I'm using spring 4.0.5, Hibernate 4.3.5 and JSF for web developpement in eclipse, and this is the content of my lib folder : When I run my project I get this error : java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/EMaEval]] at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799) 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(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/EMaEval]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.NoClassDefFoundError: org/springframework/core/io/Resource at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Unknown Source) at java.lang.Class.getDeclaredFields(Unknown Source) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:63) at org.apache.catalina.startup.Co…
has comment: http://stackoverflow.com/comment/37476053
has title: java.lang.ClassNotFoundException: org.springframework.core.io.Resource
accepted answer: http://stackoverflow.com/a/24259842
downvote count: 0
has answer: http://stackoverflow.com/a/41826542
answer count: 6
has answer: http://stackoverflow.com/a/24259842
tagged with: spring
has answer: http://stackoverflow.com/a/56815581
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/54321702
has answer: http://stackoverflow.com/a/62873392
possible better answer: http://stackoverflow.com/a/24259691
tagged with: java
has comment: http://stackoverflow.com/comment/37475615
has answer: http://stackoverflow.com/a/24259691
score: 17
has comment: http://stackoverflow.com/comment/37475780
favorite count: 0

http://stackoverflow.com/comment/37277914
type: Comment
type: QuestionComment
has text: I want to perform a task with click on LEFT_CTRL and s both.
comment on: http://stackoverflow.com/q/24155277
score: 0

file
tags question: http://stackoverflow.com/q/24260215
tags question: http://stackoverflow.com/q/24252043
type: Tag
tags question: http://stackoverflow.com/q/24157820
tags question: http://stackoverflow.com/q/24227597
tags question: http://stackoverflow.com/q/24144815
tags question: http://stackoverflow.com/q/24225351
tags question: http://stackoverflow.com/q/24184062
tags question: http://stackoverflow.com/q/24224633
tags question: http://stackoverflow.com/q/24224231
tags question: http://stackoverflow.com/q/24112035
tags question: http://stackoverflow.com/q/24138467
tags question: http://stackoverflow.com/q/24199679
tags question: http://stackoverflow.com/q/24201398
tags question: http://stackoverflow.com/q/24257335
tags question: http://stackoverflow.com/q/24231432
tag name: file
tags question: http://stackoverflow.com/q/24171539
tags question: http://stackoverflow.com/q/24200417
tags question: http://stackoverflow.com/q/24104938
tags question: http://stackoverflow.com/q/24141904
tags question: http://stackoverflow.com/q/24113593
tags question: http://stackoverflow.com/q/24156004
tags question: http://stackoverflow.com/q/24137701
tags question: http://stackoverflow.com/q/24114049
tags question: http://stackoverflow.com/q/24250413
tags question: http://stackoverflow.com/q/24159191
tags question: http://stackoverflow.com/q/24198730
tags question: http://stackoverflow.com/q/24175378
tags question: http://stackoverflow.com/q/24206203
tags question: http://stackoverflow.com/q/24168423
tags question: http://stackoverflow.com/q/24146305
tags question: http://stackoverflow.com/q/24113453
tags question: http://stackoverflow.com/q/24105371
tags question: http://stackoverflow.com/q/24249239
tags question: http://stackoverflow.com/q/24243596
tags question: http://stackoverflow.com/q/24129436

view
tags question: http://stackoverflow.com/q/24250887
tags question: http://stackoverflow.com/q/24135750
tags question: http://stackoverflow.com/q/24260222
tags question: http://stackoverflow.com/q/24243356
tags question: http://stackoverflow.com/q/24204694
tag name: view
type: Tag

http://stackoverflow.com/comment/82565678
type: Comment
comment on: http://stackoverflow.com/a/24125219
score: 0
type: AnswerComment
has text: And I think 'waiting' thread has a priority over 'blocked' thread in terms of order of execution when the notifier thread finishes it's critical section, right?

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/24128253
tags question: http://stackoverflow.com/q/24235456
tags question: http://stackoverflow.com/q/24129926
tags question: http://stackoverflow.com/q/24161326
tags question: http://stackoverflow.com/q/24237389
tags question: http://stackoverflow.com/q/24166210
tags question: http://stackoverflow.com/q/24211959
tags question: http://stackoverflow.com/q/24185353
tags question: http://stackoverflow.com/q/24212589
type: Tag
tags question: http://stackoverflow.com/q/24192822
tags question: http://stackoverflow.com/q/24128195
tags question: http://stackoverflow.com/q/24131513
tags question: http://stackoverflow.com/q/24260863
tags question: http://stackoverflow.com/q/24192561

http://stackoverflow.com/q/24109135
tagged with: pass-by-value
type: Question
has body: I am well aware that Java passes parameters by value, and how that since objects are kept in varaibles as references it is possible to change object values when those values are mutable. What I also understand is that class String contains objects that are immutable. So, to test my understand I decided to write a bit of code that would pass an object to a method as a parameter, change both its string and int variables, and then print it. I expected that, since the parameter is merely a copy, these changes would not affect the variable passed in. Does passing in an object as a parameter not copy the entire object into a new variable an simply passes that objects reference? This is counter to what I have been told by several sources. Here is the code in question: public class Test { public int testVar = 20; public String testString = "Hello"; public static void testCheck(Test test){ test.testString = new String("GoodBye"); test.testVar = 10; } public void printTest(){ System.out.println("testVar: " + testVar + " testString: " + testString); } public static void main(String[] args) { Test test1 = new Test(); test1.printTest(); testCheck(test1); test1.printTest(); } } Output: testVar: 20 testString: Hello testVar: 10 testString: GoodBye Expected: testVar: 20 testString: Hello testVar: 20 testString: Hello Thanks in advance.
has title: Counter Intuitive Object Parameter Behaviour
has answer: http://stackoverflow.com/a/24109303
tagged with: pass-by-reference
accepted answer: http://stackoverflow.com/a/24109303
tagged with: parameters
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24109191
score: 0
possible better answer: http://stackoverflow.com/a/24109191
answer count: 3
has answer: http://stackoverflow.com/a/24109188
tagged with: java

http://stackoverflow.com/q/24138392
accepted answer: http://stackoverflow.com/a/24142428
has answer: http://stackoverflow.com/a/24142428
tagged with: java
has body: I need to set current page path to canocical tag. Unfortunately I have some bugs here. On this code: &lt;% ResourceResolver resolver = slingRequest.getResourceResolver(); Externalizer externalizer = resolver.adaptTo(Externalizer.class); String canonUrl = externalizer.publishLink(resourceResolver, "http", currentPage.getPath()); %&gt; &lt;link rel="canonical" href="${canonUrl}" /&gt; I have this output: &lt;link rel="canonical" href="" /&gt; What is wrong. But if I setting canonical tag like this: &lt;link rel="canonical" href="${currentPage.path}" /&gt; I have this output: &lt;link rel="canonical" href="/content/example/eu/germany/de_de/about.html" /&gt; That's almost fine. And now, all I need it's just to add domain name(http://example.com/content/example/eu/germany/de_de/about.html). But how I can do this without hardcoding? Approach should works fine also on localized pages.
tagged with: adobe
type: AnsweredQuestion
score: 0
has title: Adobe CQ. Getting current page path
answer count: 2
tagged with: jstl
possible better answer: http://stackoverflow.com/a/24229399
tagged with: aem
tagged with: jsp
has answer: http://stackoverflow.com/a/24229399
has comment: http://stackoverflow.com/comment/37288209
type: Question

http://stackoverflow.com/a/24133352
answers question: http://stackoverflow.com/q/24132713
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: You don't have nearly enough texture coordinates. Since you use 24 vertices per cube, you also need 24 sets of texture coordinates. With 2 floats per set of texture coordinates, getTextureData() needs to return an array of 48 floats. In the code you posted, it returns an array of only 8 floats. When using vertex arrays/buffers to render geometry, you always need the same count for all attributes. In this case, 24 positions, 24 sets of texture coordinates, 24 colors (if you want to use colors), etc.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24132713

http://stackoverflow.com/comment/37416121
type: QuestionComment
type: Comment
has text: Is this file iside JAR or just in classpath? Is it writeable? What kid of exception do you get?
comment on: http://stackoverflow.com/q/24225351
score: 0

http://stackoverflow.com/q/24239332
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/46798369
possible better answer: http://stackoverflow.com/a/27126227
has comment: http://stackoverflow.com/comment/37440725
type: Question
has answer: http://stackoverflow.com/a/27126227
score: 3
has title: Google OAuth, handle a revoked authorization
has comment: http://stackoverflow.com/comment/37440307
tagged with: java
has answer: http://stackoverflow.com/a/24241642
tagged with: google-calendar-api
has comment: http://stackoverflow.com/comment/43284035
has comment: http://stackoverflow.com/comment/37440091
answer count: 4
has answer: http://stackoverflow.com/a/31045149
tagged with: google-oauth
has comment: http://stackoverflow.com/comment/46868076
has body: I've been using Google OAuth to let users authorize access to the Calendar Service for my Web Application. After a successful 3-legged auth flow, I was storing all user's credentials in a common file on the app Server. The next time the app needs to use the service, it will check if the credentials exist, and if yes, it will assume they are valid code works like that @Override public void _authorize(String userId) throws IOException { // Check if user has already authorised the service. Credential credents = flow.loadCredential(userId); // Checking if the given user is not authorized if (credents == null) { //Create credentials now. user will be redirected to authorise try { //Creating a LocalServer Receiver // Getting the redirect URI // Creating a new authorization URL // Setting the redirect URI // Building the authorization URL // Receiving authorization code // Exchanging it for an access token // Storing the credentials for later access credents = flow.createAndStoreCredential(response, id); } finally { // Releasing resources } } else { // Assume the credentials are valid. so there's nothing left to do here, let's get that client //Update: Nooooooot! the user might have revoked the authorization, so credents != null BUT they are invalid //TODO: handle an Exception here, and manage the revoked credentials } // Setting up the calendar service client client = new com.google.api.services.calendar.Calendar.Builder(httpTransport, jsonFactory, credents).setApplicationName(APPLICATION_NAME) .build(); } This works fine, as long as the user never changes his mind. But if the user decides to manually revoke the authorization using the Google Account security options, the com.google.api.services.calendar.Calendar retrieval will Fail. My question is : Is there a way to check if the credentials are still valid, before trying to use them ? Else, I can only guess that the failure to get the client object, is the only way to have my portal realize that the credentials are no m…
accepted answer: http://stackoverflow.com/a/24461344
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/24461344

http://stackoverflow.com/a/34059486
has body: allowCasualMultipartParsing="true" on context tag inside context.xml, it's work for me
downvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/65842769
score: 4
upvote count: 7
answers question: http://stackoverflow.com/q/24265573

http://stackoverflow.com/q/24188624
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24190187
has answer: http://stackoverflow.com/a/55412621
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24190187
has body: START EDIT please scroll down for the updated code END OF EDIT I've google and searched around SO for why this exception is occurring and I understand that it is caused by an object is reading a list and meanwhile an item was removed from the list. I've changed my code accordingly to the suggestions I've found but from time to time I still get this exception and it is crashing my app. And it looks randomly, I try to replicate the exception and 90% of the time I don't get the exception and not always following the same procedure, which makes it hard to debug. I'm using the observer pattern. Sometimes it happens with the unregister method, some othertimes with the register, other times with a method from the notify... it's pretty random to where it happens. I'm using an android asynctask to download few bytes from my server and the observer pattern is to update the GUI when needed. Here's my code: @Override public void register(final Observer newObserver) { Log.d(TAG, "(Register) Observer registred: " + newObserver.toString()); observers.add(newObserver); Log.d(TAG, "(Register) Number of registered observers: " + observers.size()); } @Override public void unregister(final Observer observer) { int indexObersver = observers.indexOf(observer); // Avoid java.util.ConcurrentModificationException // at java.util.ArrayList$ArrayListIterator.next(ArrayList.java) if(indexObersver &gt;= 0) { observers.remove(indexObersver); Log.d(TAG, "(Unregister) Unregistered Observer: " + observer.toString()); Log.d(TAG, "(Unregister) Now we have: " + observers.size() + " observers"); } else { Log.d(TAG, "(Unregister) Registered Observer not found"); } } @Override public void notifyObserverNewLocalBackup(BackupInfo backupInfo) { // Avoid java.util.ConcurrentModificationException // at java.util.ArrayList$ArrayListIterator.next(ArrayList.java) for( Iterator&lt; Observer &gt; it = observers.iterator(); it.hasNext() ; ) // for(Observer observer : observers) { Observer observer = it.next(); obse…
has comment: http://stackoverflow.com/comment/37339893
answer count: 4
favorite count: 0
score: 8
type: Question
has answer: http://stackoverflow.com/a/24190524
possible better answer: http://stackoverflow.com/a/24188702
upvote count: 8
has comment: http://stackoverflow.com/comment/37340529
has title: java.util.ConcurrentModificationException - ArrayList
has answer: http://stackoverflow.com/a/24188702
downvote count: 0
has comment: http://stackoverflow.com/comment/37339853
has comment: http://stackoverflow.com/comment/37340419

http://stackoverflow.com/q/24195364
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
has body: I have an error on my android program that I doesn't understand, I have check the syntax of the XML file but I didn't see any mistake. Here My errors: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.twitter/com.example.twitter.SettingsActivity}: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText Caused by: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText at com.example.twitter.SettingsActivity.onCreate(SettingsActivity.java:48) Here is the line of the error: lblName = (EditText) findViewById(R.id.txt_name); My activity: package com.example.twitter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.AsyncHttpResponseHandler; import com.loopj.android.http.RequestParams; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ListAdapter; public class SettingsActivity extends Activity { AlertDialogManager alert = new AlertDialogManager(); // Alert Dialog Manager RefreshManager refresh = new RefreshManager(); // Refresh Manager SessionManager session; // Session Manager Class private UsersDAO dao; // Init Posts DAO private ListAdapter PostAdapter; private ImageLoader imageLoader; private EditText lblName, lblUsername, lblDescription, lblEmail, lblLocalisation, lblWebsite; // Buttons Button validSignup; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.account); dao = new UsersDAO(this); // On se connecte a la BDD session = new SessionManager(getApplicationContext…
answer count: 2
upvote count: 2
tagged with: mobile
has comment: http://stackoverflow.com/comment/37353272
has title: android.widget.TextView cannot be cast to android.widget.EditText 5
downvote count: 0
has answer: http://stackoverflow.com/a/24195439
possible better answer: http://stackoverflow.com/a/24195439
has answer: http://stackoverflow.com/a/24200474
has comment: http://stackoverflow.com/comment/37353263
accepted answer: http://stackoverflow.com/a/24200474
linked to: http://stackoverflow.com/q/13674627
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37353427
tagged with: android
tagged with: java
tagged with: android-activity

http://stackoverflow.com/comment/37403290
type: Comment
type: QuestionComment
has text: Is it only the `username` thats repeated or also the `score` and `name`?
comment on: http://stackoverflow.com/q/24221721
score: 0

http://stackoverflow.com/a/24126755
has body: Your while and ifstatements towards the bottom of your code need to be fixed. Look at your while loop, it will stay looping as long as nodeChecker != null evaluates to true. However, nothing inside your loop changes its value, so it will always evaluate to true, which can lead to some problems. At the bottom, in your "if" statement, there are four things which could possibly be null: nodeChecker, getData(), getRole(), or "h". Since you are in the loop, we already know that nodeChecker is not null. "h" is trivially not null. If getRole() is null, there won't be an exception, because null == "h" will just evaluate to false. Thus, by exclusion, getData() must be evaluating to null. There are a few ways to get around this issue. One easy way is just adding an extra term in your if statement, as follows: Data data = nodeChecker.getData(); if (data != null &amp;&amp; data.getRole().equals("h") What this is doing is taking advantage of http://en.wikipedia.org/wiki/Short-circuit_evaluation. Basically, if data == null, the LHS of the if statement will evaluate to false. Since it is an "and" statement, since the LHS is false, the statement cannot equal true, so the RHS will not bother to evaluate. If data != null, the LHS would then equal true, and the RHS will be evaluated. This protects from the null exception which comes from calling the getRole() method on a null object. Also, make sure that you are using .equals() to check string equality, since "==" checks the equality of the references, while ".equals()" checks the equality of the value.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24114054
score: 0
answers question: http://stackoverflow.com/q/24114054
type: Answer

eclipse
tags question: http://stackoverflow.com/q/24148894
tags question: http://stackoverflow.com/q/24179668
tags question: http://stackoverflow.com/q/24251182
tags question: http://stackoverflow.com/q/24107305
tags question: http://stackoverflow.com/q/24226351
tags question: http://stackoverflow.com/q/24122075
tags question: http://stackoverflow.com/q/24178197
tags question: http://stackoverflow.com/q/24168406
tag name: eclipse
tags question: http://stackoverflow.com/q/24222172
tags question: http://stackoverflow.com/q/24156004
tags question: http://stackoverflow.com/q/24134676
tags question: http://stackoverflow.com/q/24203290
tags question: http://stackoverflow.com/q/24188916
tags question: http://stackoverflow.com/q/24209003
tags question: http://stackoverflow.com/q/24182622
tags question: http://stackoverflow.com/q/24227913
tags question: http://stackoverflow.com/q/24174882
tags question: http://stackoverflow.com/q/24148667
tags question: http://stackoverflow.com/q/24176026
tags question: http://stackoverflow.com/q/24160160
tags question: http://stackoverflow.com/q/24200346
tags question: http://stackoverflow.com/q/24221558
tags question: http://stackoverflow.com/q/24143966
tags question: http://stackoverflow.com/q/24149410
tags question: http://stackoverflow.com/q/24110397
tags question: http://stackoverflow.com/q/24261062
tags question: http://stackoverflow.com/q/24246278
tags question: http://stackoverflow.com/q/24254657
tags question: http://stackoverflow.com/q/24262882
tags question: http://stackoverflow.com/q/24110620
tags question: http://stackoverflow.com/q/24168368
tags question: http://stackoverflow.com/q/24220097
tags question: http://stackoverflow.com/q/24118613
tags question: http://stackoverflow.com/q/24117713
tags question: http://stackoverflow.com/q/24195423
tags question: http://stackoverflow.com/q/24218802
tags question: http://stackoverflow.com/q/24223783
tags question: http://stackoverflow.com/q/24121085
tags question: http://stackoverflow.com/q/24147575
tags question: http://stackoverflow.com/q/24226131
tags question: http://stackoverflow.com/q/24136623
tags question: http://stackoverflow.com/q/24220823
tags question: http://stackoverflow.com/q/24152109
tags question: http://stackoverflow.com/q/24165394
tags question: http://stackoverflow.com/q/24126553
tags question: http://stackoverflow.com/q/24105537
tags question: http://stackoverflow.com/q/24208598
tags question: http://stackoverflow.com/q/24164084
tags question: http://stackoverflow.com/q/24173880
tags question: http://stackoverflow.com/q/24250659
tags question: http://stackoverflow.com/q/24254487
tags question: http://stackoverflow.com/q/24148433
tags question: http://stackoverflow.com/q/24195142
tags question: http://stackoverflow.com/q/24138890
tags question: http://stackoverflow.com/q/24196340
tags question: http://stackoverflow.com/q/24157678
tags question: http://stackoverflow.com/q/24262852
tags question: http://stackoverflow.com/q/24170257
tags question: http://stackoverflow.com/q/24144489
tags question: http://stackoverflow.com/q/24168423
tags question: http://stackoverflow.com/q/24219894
tags question: http://stackoverflow.com/q/24109377
tags question: http://stackoverflow.com/q/24106037
tags question: http://stackoverflow.com/q/24207974
tags question: http://stackoverflow.com/q/24137297
tags question: http://stackoverflow.com/q/24218889
tags question: http://stackoverflow.com/q/24198771
tags question: http://stackoverflow.com/q/24263690
tags question: http://stackoverflow.com/q/24261224
tags question: http://stackoverflow.com/q/24252256
tags question: http://stackoverflow.com/q/24252999
tags question: http://stackoverflow.com/q/24174947
tags question: http://stackoverflow.com/q/24254435
tags question: http://stackoverflow.com/q/24206569
tags question: http://stackoverflow.com/q/24161152
tags question: http://stackoverflow.com/q/24204815
tags question: http://stackoverflow.com/q/24143355
tags question: http://stackoverflow.com/q/24250916
tags question: http://stackoverflow.com/q/24187120

http://stackoverflow.com/q/24125596
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24127408
type: Question
has answer: http://stackoverflow.com/a/24126800
has title: Trying to run an xslt for xml with eclipse but it does not work
upvote count: 1
answer count: 4
tagged with: xslt
possible better answer: http://stackoverflow.com/a/24126800
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37222478
has body: I am trying to run a .xslt to show some info from a .xml to an html page in eclipse. I run it, and eclipse produces a .out.xml file which when I try to run with chrome I get the message : This XML file does not appear to have any style information associated with it. I am completely new in this so I cannot figure out what is going on... XML FILE : <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="html_xml.xslt"?> sport <horse_power>222hp</horse_power> quattro 6_Manual luxury <horse_power>302hp</horse_power> front_wheel_drive 7_Automatic crossover_SUV <horse_power>302hp</horse_power> quattro 6_Manual XSLT FILE: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <xsl:strip-space elements="*"/> <xsl:template match="/"> Car Model Info <xsl:apply-templates mode="elem" select="/*"/> </xsl:template> <xsl:template mode="elem" match="/*"> <xsl:value-of select="name()"/> <xsl:apply-templates mode="child" select="/*/*"/> (c) <xsl:apply-templates mode="attr" select="/*/@*"/> (a) </xsl:template> <xsl:template mode="child" match="/*/*"> <xsl:value-of select="name()"/> </xsl:template> <xsl:template mode="attr" match="/*/@*"> <xsl:value-of select="name()"/> </xsl:template> </xsl:stylesheet> XSLT OUTPUT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <xsl:strip-space elements="*"/> <xsl:template match="/"> Car Model Info <xsl:apply-templates mode="elem" select="/*"/> </xsl:template> <xsl:template mode="elem" match="a:*"> <xsl:value-of select="name()"/> <xsl:apply-templates mode="child" select="/*/*"/> (c) <xsl:apply-templates mode="attr" select="/*/@*"/> (a) </xsl:template> <xsl:template mode="child" match="/*/*"> <xsl:value-of select="name()"/> </xsl:template> <xsl:template mode="child" match="/*/@*"> <xsl:value-of select="name()"/> </xsl:template> </xsl:stylesheet>
score: 1
has answer: http://stackoverflow.com/a/28830281
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/24127408
tagged with: eclipse
has answer: http://stackoverflow.com/a/49802995

http://stackoverflow.com/a/24202140
has comment: http://stackoverflow.com/comment/37366791
score: 0
answers question: http://stackoverflow.com/q/24200947
type: Answer
has body: You're trying to put the entire GrailsParameterMap instance into a prepared SQL query. You cannot do that and should instead create a new map with the subset of parameters that you want to pass to the SQL query.

http://stackoverflow.com/a/24710196
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24241177
type: Answer
accepted answer of: http://stackoverflow.com/q/24241177
has body: the error was in server.xml's "userRolesTable" it should be "userRoleTable"

http://stackoverflow.com/comment/40281913
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25741530
has text: Indeed. I had too many complications setting up a Spark EMR infrastructure, so I switched to Spark Standalone and now I am running my own complex application pretty quickly. Thanks for the tip!
type: AnswerComment

http://stackoverflow.com/comment/37246248
comment on: http://stackoverflow.com/q/24138467
has text: post the entire logcat then
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24220652
type: Question
upvote count: 4
answer count: 2
tagged with: xml-parsing
downvote count: 0
has comment: http://stackoverflow.com/comment/37401672
score: 4
has answer: http://stackoverflow.com/a/24220863
has comment: http://stackoverflow.com/comment/37401588
type: AnsweredQuestion
has body: I am not getting an idea how to get an element by its attribute. I tried something as below but getting error as the item(1) might change as the loop goes on. some field tags may be stripped off. so position might change. I want to get: Thu Jun 01 13:11:43 2014 Xml: <assets> 2013-12-20 Thu Jun 01 13:11:43 2014 en_US 2013-12-20 en_US Thu Jun 01 13:11:43 2014 <assets> java partial code: DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse("E:\\example.xml"); List<String> list = new ArrayList<>(); NodeList nList = doc.getElementsByTagName("document"); for (int i = 0; i < nList.getLength(); i++) { Node nNode = nList.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; Date date = new Date(eElement.getElementsByTagName("field").item(1).getTextContent()); System.out.println(date); Date date1 = new Date(2014 - 1900, 06 - 1, 04); if (date.compareTo(date1) == 1) { list.add(eElement.getAttribute("path").trim()); } } }
has title: how to get element by attribute using dom parser in java
tagged with: java
has comment: http://stackoverflow.com/comment/37401490
has answer: http://stackoverflow.com/a/24220968
possible better answer: http://stackoverflow.com/a/24220968
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
accepted answer: http://stackoverflow.com/a/24220863

http://stackoverflow.com/q/24213608
tagged with: opencsv
type: Question
linked to: http://stackoverflow.com/q/14503595
has title: Exporting resultset
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37388631
score: 0
has body: I'm very new to Java and am looking for some assistance. I have a resultset that I'm able to either print (without titles, but that's for a different time), or can produce a jtable. Ultimately, though, I want to be able to send it to excel. I don't really care whether it is a CSV or XLS, I just want to be able to get it to Excel. I downloaded OpenCSV and have it added to the build path, but I still can't get it to work. I've even tried forklifting multiple different version of code, but nothing still works. I have the code below. import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JTable; import java.math.BigDecimal; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; import java.text.ParseException; import java.util.ArrayList; import java.util.regex.Pattern; import java.io.*; public class RuneDW { public static void main(String[] args) throws SQLException, IOException { Connection conn = null; Statement stmt = null; ResultSet rs = null; JTable table = null; File file = File.createTempFile("test",".csv"); try { conn = DBUtil.getConnected(DBType.EDW); stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery("select trunc(acct_d) as acct_d, cust_ord_i, sls_q from fin_sls where rownum&lt;=13" + "and acct_d&gt;= sysdate-2"); ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(); ResultSetMetaData metadata = rs.getMetaData(); int numberOfColumns = metadata.getColumnCount(); while (rs.next()) { int i = 1; while(i &lt;= numberOfColumns) { arrayList.add(rs.getString(i++)); } System.out.println(rs.getString("acct_d")+rs.getString("cust_ord_i")+rs.getString("sls_q")); } } finally { } } }
answer count: 0
has comment: http://stackoverflow.com/comment/37388562

http://stackoverflow.com/comment/37319594
type: AnswerComment
comment on: http://stackoverflow.com/a/24177599
has text: Why `new Date(date1.getTimeInMillis()))` when `date1.getTime()` returns a `Date` object
type: Comment
score: 0

http://stackoverflow.com/comment/37468930
type: Comment
type: AnswerComment
has text: Oh yes I have just tried it. Run great, sorry again.
score: 0
comment on: http://stackoverflow.com/a/24255807

http://stackoverflow.com/q/24173308
linked to: http://stackoverflow.com/q/23620919
type: Question
has comment: http://stackoverflow.com/comment/37312173
has comment: http://stackoverflow.com/comment/37312907
answer count: 2
upvote count: 2
type: UnansweredQuestion
has title: Java spec changed for AND OR operator precedence?
has comment: http://stackoverflow.com/comment/37313264
duplicate of: http://stackoverflow.com/q/23620919
has answer: http://stackoverflow.com/a/24173412
has comment: http://stackoverflow.com/comment/37312754
downvote count: 1
tagged with: specifications
has comment: http://stackoverflow.com/comment/37312406
tagged with: operator-keyword
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37312374
has body: i have been studying for Oracle java certification exam for a while. today i came across a question asking which part of expression evaluates. it was sth like a() || b() &amp;&amp; c(). so far everything seems ok. &amp;&amp; operator precedence has higher priority then || operator and it evaluates first and then || operator evaluates. the problem arises when i try to run similar code on my windows 7/java 7 machine. when i run my code the || operator evalautes first. I checked a few books, and the one i study(manning java associate prep.) it says vice versa. what do you think whats wrong? here is my code you can check public class Dummy { public static void main(String[] arg) { boolean ax = method1() || method2() &amp;&amp; method3() ; } public static boolean method1(){ System.err.println("method1"); return false; } public static boolean method2(){ System.err.println("method2"); return false; } public static boolean method3(){ System.err.println("method3"); return true; } } Edit : what i get as output : method1 , method 2 What i expect : method2 , method1 edit 2: this is what the book says (manning OCA java Se 7 programmer 1 cert. guide) page 507 The expression (a >= 99 || a &lt;= 33 &amp;&amp; b == 10) has three operands together with the OR(||) and AND(&amp;&amp;) short-circuit operators. Because the short-circuit operator AND has higher operator precedence than the short-circuit operator OR, the expression is evaluated as follows: (a >= 99 || (a &lt;= 33 &amp;&amp; b == 10)) Evaluation of the preceding expression starts with the evaluation of (a &lt;= 33 &amp;&amp; b == 10). Because a &lt;= 33 evaluates to true, the operator &amp;&amp; evaluates the second operand (b == 10) to determine whether (a &lt;= 33 &amp;&amp; b == 10) will return trueor false. a &lt;= 33returns true and b == 10 returns false, so the expression (a &lt;= 33 &amp;&amp; b == 10)returns false. The original expression—(a >= 99 || (a &lt;= 33 &amp;&amp; b == 10)) is now reduced to the following e…
tagged with: operator-precedence
has answer: http://stackoverflow.com/a/24173359
favorite count: 0

http://stackoverflow.com/q/24192299
tagged with: parsing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24192471
score: 5
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/74914427
downvote count: 0
possible better answer: http://stackoverflow.com/a/74914427
has answer: http://stackoverflow.com/a/24214187
linked to: http://stackoverflow.com/q/5393847
has comment: http://stackoverflow.com/comment/37347337
has comment: http://stackoverflow.com/comment/37347316
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24192471
linked to: http://stackoverflow.com/q/19112357
upvote count: 5
tagged with: iso8601
has title: java.text.Parse Exception : Unparseable Date
tagged with: date
has body: I have the following code: String ModifiedDate = "1993-06-08T18:27:02.000Z" ; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); Date ModDate = sdf.parse(ModifiedDate); I am getting the following exception even though my date format is fine... java.text.ParseException: Unparseable date: "1993-06-08T18:27:02.000Z" at java.text.DateFormat.parse(DateFormat.java:337)

http://stackoverflow.com/comment/54245793
comment on: http://stackoverflow.com/a/28335240
type: AnswerComment
score: 0
has text: What do you mean `view treatment method`?
type: Comment

http://stackoverflow.com/q/24218305
answer count: 2
downvote count: 0
upvote count: 1
tagged with: string
has title: Interpret sentence and convert into their corresponding format
has answer: http://stackoverflow.com/a/24220991
favorite count: 0
type: Question
has body: There are some formats of inputs and their corresponding outputs 1. 7 years 10 months ---&gt; YRS:7 MNHS:10 2. 7 kgs 10 grms ---&gt; KGS:7 GRMS:10 3. 7 kilograms 10 grams ---&gt; KGS:7 GRMS:10 4. 7 thousand 9 hundread ---&gt; 7900 5. seven years ten months --&gt; YRS:7 MNHS:10 6. seven kgs ten grms ---&gt; KGS:7 GRMS:10 7. triple seven double five --&gt; 77755 I wrote separate modules for all by storing informations in **HashMap. And it is working fine.** Then I need to write one main module in which input is one sentence(utterance), and I need to replace all above substrings into corresponding substring output. For example, Input :- Dial number triple eight triple four three nine eight. Output :- Dial number 888444398. and many such utterances. My doubts :- I used numbers of HashMap for smaller modules to store meaning of keys, just like - triple means 3 times, double means 2 times and all. But this has limitation that if I need to add anything I have to add that entry in HashMap. Suggest some good technique for this. I am confused in main module, how to extract useful substring given in above examples from given utterances. So suggest some good technique for this also. Project Lanuguage : Java.
has answer: http://stackoverflow.com/a/24223283
tagged with: algorithm
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: regex
tagged with: nlp

http://stackoverflow.com/comment/37197413
has text: `Local Maven Repository = Local to the executor`, did you see what happens when you change that option? (hint: the default value is `~/.m2/repository` which means local to the user running jenkins = shared)
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24111870

http://stackoverflow.com/q/24155238
has title: Using Apache POI (java) to store excel cells in 2 dimensional array. Exception being returned despite me formatting all Excel cells as "text"
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/37278157
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: arrays
accepted answer: http://stackoverflow.com/a/24156591
has answer: http://stackoverflow.com/a/24156591
answer count: 1
tagged with: excel
type: Question
has body: I am extremely new to using Apache POI (and still new to Java too, infact!) and have come across an exception that I cannot determine how to fix. Obviously you cannot store 2 different datatypes in an array, so I selected every column with data and converted the cell format to "Text" in Excel. I then try to store this data in an array with the following: String cellData[][] = new String[rows][cols]; System.out.println(rows+" entries found with "+cols+" columns of data"); //iterate over every row and store cell data; for(int i=0; i&lt;rows; i++){ row = worksheet.getRow(i); if(row != null){ for(int j=0;j&lt;cols;j++){ cell = row.getCell(j); if(cell != null){ try{ cellData[i][j] = cell.getStringCellValue(); }catch(IllegalStateException e){ System.out.println("Cell data is not a string(text)"); } } } } } The output from this is countless rows of "Cell data is not a string(text)", where am I going wrong here? Forgive me for any oversights I am also new to Stackoverflow and want to become a valued member of the community here too :) Thanks for your advice! EDIT: Added e.printStackTrace() as requested. at exceltesting.ExcelTesting.main(ExcelTesting.java:80) java.lang.IllegalStateException: Cannot get a text value from a numeric cell at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:648) at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue(HSSFCell.java:725) at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSSFCell.java:708) Interestingly enough, when I change it from cell.getStringCellValue() to cell.getNumericCellValue() the IllegalStateException then changes to "Cannot get a numerical value from a text cell"... I think the excel document, despite converting the cells to text is not actually changing to string data and passing them as their inherent data type? Thanks again

http://stackoverflow.com/q/24202910
accepted answer: http://stackoverflow.com/a/24203603
tagged with: spring
type: AnsweredQuestion
score: 0
tagged with: java
has title: How to initialize and pass Properties class in spring contructor
answer count: 1
type: Question
has body: I have following class public ConsumerGroup(Properties props) { consumer = kafka.consumer.Consumer.createJavaConsumerConnector(new ConsumerConfig(props)); this.topic = props.getProperty("kafka.topic"); } in Spring xml I have &lt;bean id="kafkaConsumerGroup" class=" com.paypal.kafka.consumer.ConsumerGroup"&gt; &lt;constructor-arg index="0" value="pass the properties class" /&gt; &lt;/bean&gt; Using PropertyPlaceholderConfigurer only helps in passing individual property. How can I initialize Properties class from properties file and the pass it to constructor as a value?
has comment: http://stackoverflow.com/comment/37367333
has answer: http://stackoverflow.com/a/24203603

http://stackoverflow.com/q/24257774
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24280696
tagged with: web-services
has answer: http://stackoverflow.com/a/24280696
favorite count: 0
type: Question
has title: java axis web service client setMaintainSession on multiple services (cookies?)
has body: I'm implementing a client to a web service (and the guys maintaining the web service have been a litte unresponsive..) I've used axis and WSDL2Java to generate java classes and I can call their login-method on their authentication-service ok, and get a sessionId back (eg z4zojhiqkw40lj55kgtn1oya). However, it seems that i cannot use this sessionId as a parameter anywhere. Even a call to their hasSession()-method directly after login returned false. I managed to solve this by setting setMaintainSession(true) on the Locator-object for this service. But the problem is, that this first service, the Authentication-service, is only used for authentification. If I then call setMaintainSession(true) on eg ProductServiceLocator, and call some method on it, I will get an error because of unauthenticated session. I have to find a way to share the session between the services on the client side. Looking on their php code example-it seeems like they are storing the session in a cookie. How can I mimic this behaviour in my java client? php-code: $authentication = new SoapClient ( "https://webservices.24sevenoffice.com/authenticate/authenticate.asmx?wsdl", $options ); // log into 24SevenOffice if we don't have any active session. No point doing this more than once. $login = true; if (!empty($_SESSION['ASP.NET_SessionId'])){ $authentication-&gt;__setCookie("ASP.NET_SessionId", $_SESSION['ASP.NET_SessionId']); try{ $login = !($authentication-&gt;HasSession()-&gt;HasSessionResult); } catch ( SoapFault $fault ) { $login = true; } } if( $login ){ $result = ($temp = $authentication-&gt;Login($params)); // set the session id for next time we call this page $_SESSION['ASP.NET_SessionId'] = $result-&gt;LoginResult; // each seperate webservice need the cookie set $authentication-&gt;__setCookie("ASP.NET_SessionId", $_SESSION['ASP.NET_SessionId']); // throw an error if the login is unsuccessful if($authentication-&gt;HasSession()-&gt;HasSessionResult == false) throw new SoapFault("0", "Inval…
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: cookies
tagged with: java
tagged with: axis

http://stackoverflow.com/a/24219776
has comment: http://stackoverflow.com/comment/37399954
downvote count: 0
has comment: http://stackoverflow.com/comment/38896810
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/49702185
has comment: http://stackoverflow.com/comment/37399939
answers question: http://stackoverflow.com/q/24219170
accepted answer of: http://stackoverflow.com/q/24219170
type: Answer
has body: Of course you can, that's exactly what I did too. public interface FFListener { public void onClick(FFListenerButton flb); } And public class FFListenerButton extends FFButton { private FFListener ffListener; public FFListenerButton(Rectangle bounds, CharSequence text, FFListener ffListener) { super(bounds, text); this.ffListener = ffListener; } @Override protected void action() { ffListener.onClick(this); } } And public abstract class FFButton { private Rectangle bounds; private CharSequence text; private boolean selected; private boolean hidden; private boolean active; private boolean disabled; public FFButton(Rectangle bounds, CharSequence text) { this.bounds = bounds; this.text = text; this.hidden = false; this.active = false; this.disabled = false; } protected abstract void action(); public void execute() { if(disabled == false) { action(); } } public boolean contains(float x, float y) { return bounds.contains(x, y); } public float x() { return bounds.x; } public float y() { return bounds.y; } public float width() { return bounds.width; } public float height() { return bounds.height; } public void drawBounds(ShapeRenderer shapeRenderer) { if(hidden != true) { shapeRenderer.rect(x(), y(), width(), height(), 0, 0, 0); } } public CharSequence getText() { return text; } public FFButton setText(String text) { this.text = text; return this; } public void drawText(SpriteBatch batch) { if(hidden != true) { Resources.bitmapFont.draw(batch, getText(), x()+(width()/8), y()+height()*0.75f); //black magic, please adjust } } public boolean getSelected() { return selected; } public FFButton setSelected(boolean selected) { this.selected = selected; return this; } public boolean isActive() { return active; } public FFButton setActive(boolean active) { this.active = active; return this; } public boolean isHidden() { return hidden; } public FFButton setHidden(boolean hidden) { this.hidden = hidden; return this; } public Rectangle getBounds() { return bounds; } public boolean isDi…
upvote count: 8
has comment: http://stackoverflow.com/comment/49703402
score: 8

avro
type: Tag
tags question: http://stackoverflow.com/q/24153092
tag name: avro
tags question: http://stackoverflow.com/q/24177364

http://stackoverflow.com/comment/37213603
type: Comment
score: 0
has text: have you enabled debug mode in your samsung mobile by goging to Go to Settings → More → About Device Scroll down to Build Number Tap it repeatedly (tap 7 times). See the Developer options menu under Settings → More
type: AnswerComment
comment on: http://stackoverflow.com/a/24115842

rest
tags question: http://stackoverflow.com/q/24199241
tags question: http://stackoverflow.com/q/24141743
tags question: http://stackoverflow.com/q/24245649
tags question: http://stackoverflow.com/q/24226168
tags question: http://stackoverflow.com/q/24144289
tags question: http://stackoverflow.com/q/24127287
tags question: http://stackoverflow.com/q/24118707
tags question: http://stackoverflow.com/q/24251437
tags question: http://stackoverflow.com/q/24138114
tags question: http://stackoverflow.com/q/24230963
tags question: http://stackoverflow.com/q/24233324
tags question: http://stackoverflow.com/q/24184869
tags question: http://stackoverflow.com/q/24248450
tags question: http://stackoverflow.com/q/24223081
tags question: http://stackoverflow.com/q/24170556
tags question: http://stackoverflow.com/q/24195162
tags question: http://stackoverflow.com/q/24253106
tags question: http://stackoverflow.com/q/24187028
tags question: http://stackoverflow.com/q/24197377
tags question: http://stackoverflow.com/q/24116549
tags question: http://stackoverflow.com/q/24211427
tags question: http://stackoverflow.com/q/24106726
type: Tag
tags question: http://stackoverflow.com/q/24192893
tags question: http://stackoverflow.com/q/24232784
tags question: http://stackoverflow.com/q/24260777
tags question: http://stackoverflow.com/q/24170393
tags question: http://stackoverflow.com/q/24197134
tags question: http://stackoverflow.com/q/24228675
tags question: http://stackoverflow.com/q/24213922
tag name: rest
tags question: http://stackoverflow.com/q/24208894
tags question: http://stackoverflow.com/q/24144157
tags question: http://stackoverflow.com/q/24250294
tags question: http://stackoverflow.com/q/24119904
tags question: http://stackoverflow.com/q/24126463
tags question: http://stackoverflow.com/q/24192526
tags question: http://stackoverflow.com/q/24204285
tags question: http://stackoverflow.com/q/24174935
tags question: http://stackoverflow.com/q/24178045
tags question: http://stackoverflow.com/q/24193029
tags question: http://stackoverflow.com/q/24200999
tags question: http://stackoverflow.com/q/24246544
tags question: http://stackoverflow.com/q/24237705

bnd
tags question: http://stackoverflow.com/q/24185603
type: Tag
tag name: bnd

http://stackoverflow.com/comment/38062465
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24166056
has text: Still have the same problem.. I installed grails on the server but I have the same problem, the problem came from ImageTools plugin. Anyone have an alternative to ImageTools Plugin?! The developer don't offer support for it any more.. And am getting problems with it when I moved to a new server and new Java version..

http://stackoverflow.com/comment/37475364
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24258969
type: Comment
has text: Thanks, I am updating an specific panel inside my form, I dont want to update all because I also have other submits I cant make, and since I cannot use separate <h:form> inside my tab element, I have to process only parts of the code, I try to do it processing only certain panels

http://stackoverflow.com/a/24179827
answers question: http://stackoverflow.com/q/24179793
has comment: http://stackoverflow.com/comment/37323549
has comment: http://stackoverflow.com/comment/37323777
has comment: http://stackoverflow.com/comment/37323845
has comment: http://stackoverflow.com/comment/37323920
has body: The easiest way would be to override the toString() method of your class. This is not a very robust solution, but gets the job done. public class Category { public String name; @Override public String toString(){ return name; } }
has comment: http://stackoverflow.com/comment/37323974
type: Answer
has comment: http://stackoverflow.com/comment/37325013
has comment: http://stackoverflow.com/comment/37326907
has comment: http://stackoverflow.com/comment/37327139
upvote count: 6
has comment: http://stackoverflow.com/comment/37323646
has comment: http://stackoverflow.com/comment/37323866
has comment: http://stackoverflow.com/comment/37323555
has comment: http://stackoverflow.com/comment/37326774
has comment: http://stackoverflow.com/comment/37323491
has comment: http://stackoverflow.com/comment/37324030
has comment: http://stackoverflow.com/comment/37323693
has comment: http://stackoverflow.com/comment/37326968
score: 5
has comment: http://stackoverflow.com/comment/37324031
has comment: http://stackoverflow.com/comment/37323724
has comment: http://stackoverflow.com/comment/37323910
has comment: http://stackoverflow.com/comment/37324011
has comment: http://stackoverflow.com/comment/37323619
has comment: http://stackoverflow.com/comment/37323453
downvote count: 1

http://stackoverflow.com/q/24143357
tagged with: advantage-database-server
has title: Java + Advantage Database Server -> Login failed
score: 0
tagged with: java
answer count: 1
has body: this java app was working fine for years. It reads the data from an Advantage Database Server an accounting software uses. Since a recent update of that accounting software, all I get is a "Login failed" exception. As far as my knowledge goes, there's no way to "login" or use credentials to login to an Advantage Database Server.. address = "//localhost:6262"; catalog = "D:\bob50\DATA\DEMO"; Class.forName("com.extendedsystems.jdbc.advantage.ADSDriver"); this.connection = DriverManager.getConnection("jdbc:extendedsystems:advantage:"+address+";catalog="+catalog+";TableType=adt;LockType=proprietary;LockType=compatible;"); Does anyone know why "Login failed" would be triggered? The Advantage Database Server is running..
has answer: http://stackoverflow.com/a/24662513
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/37490213
comment on: http://stackoverflow.com/q/24265930
score: 0
has text: I'm not very familiar with JavaFX but I am not opposed to using it by any means if it is the better options, thanks for the suggestion.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37594806
has text: It work when I do this saving every taskAction independently, but not when I added them in a list in task object and then save the task.
score: 0
comment on: http://stackoverflow.com/a/24259456
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37377221
comment on: http://stackoverflow.com/q/24207806
has text: I'm running the tests on testNG, and I haven't had any problems
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37231940
has text: maybe there is a mismatch with names,or try to reload project?
comment on: http://stackoverflow.com/q/24129619
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37231154
score: 0
has text: Some algorithms may required keys with special properties, like DES for example. So the getInstance() method takes an algorithm parameter.
type: Comment
comment on: http://stackoverflow.com/q/24130154
type: QuestionComment

http://stackoverflow.com/a/24164248
score: 1
type: AcceptedAnswer
downvote count: 0
has body: The onClick method of OnClickListener has a parameter v. The value of v will be the View that was clicked, i.e. the ImageButton. All you have to do now is pass the View to EquipUnequip: ... btnSelected.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { EquipUnequip(w.WeaponID(), (ImageButton)v); } }); ... private void EquipUnequip(int WeaponId, ImageButton btnSelected) { if(Game.Weapons.get(WeaponId).CharacterID() == ChrSelected) { btnSelected.setImageResource(R.drawable.eqip_but_idle); } else { btnSelected.setImageResource(R.drawable.eqip_but_press); } } PS: This part seems a bit non-sensical to me: View view = new View(this); LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.menuweapons_row, null); Why do you create a new View just to do nothing with it and replace it with the result from the LayoutInflater? Edit If you really need the row of the View (and it never changes) here are 2 alternatives: Save row in the OnClickListener class MyOnClickListener implements OnClickListener { private final int rowIndex; MyOnClickListener(int rowIndex) { this.rowIndex = rowIndex; } @Override public void onClick(View v) { // do something with rowIndex } } and use it instead of your anonymus class or simply add a final variable outside your anonymus class: // currentRowIndex calculated by your program // i.e. incremented in every iteration final int rowIndex = currentRowIndex; btnSelected.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // do something with rowIndex } }); Add the info as tag to the button (currentRowIndex would be of type int): btnSelected.setTag(currentRowIndex); // attach Integer data to the view btnSelected.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int rowIndex = (Integer)v.getTag(); // do something with rowIndex } });
upvote count: 1
has comment: http://stackoverflow.com/comment/37310201
has comment: http://stackoverflow.com/comment/37298217
answers question: http://stackoverflow.com/q/24163726
type: Answer
has comment: http://stackoverflow.com/comment/37331996
has comment: http://stackoverflow.com/comment/37311297
accepted answer of: http://stackoverflow.com/q/24163726

http://stackoverflow.com/a/24301251
downvote count: 0
upvote count: 1
has body: Check if this post of mine helps. It has step by step procedure of using a decorator http://subhankarc.blogspot.in/2012/05/decorator-in-eclipse-jface-treeviewer.html
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24196127

http://stackoverflow.com/a/24148675
score: 0
has body: What you have here is an example of infinite recursion, as there is nothing there to allow us to exit the recursive loop. As others have previously said, this will cause a stack overflow error, as the JVM will continually create and assign a memory allocation to the Test object until it runs out of space in memory.
answers question: http://stackoverflow.com/q/24148519
type: Answer

http://stackoverflow.com/a/24139975
score: 0
answers question: http://stackoverflow.com/q/24115722
has body: Like is written here http://jasperreports.sourceforge.net/sample.reference/hibernate/ One of these middle-tier tools dedicated to data access is Hibernate (today: Hibernate 3.3) (...) ... is it possible that newest jasperreports 5.6 believes that actual version of hibernate is 3.3 and not 4.3? oO Two weeks working on a solution and nothing :/
type: Answer

combinations
tags question: http://stackoverflow.com/q/24213068
type: Tag
tag name: combinations

http://stackoverflow.com/a/24134992
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/83068560
has comment: http://stackoverflow.com/comment/58476907
score: 14
type: Answer
accepted answer of: http://stackoverflow.com/q/24121580
has body: Yep, you can use a DoughnutChart class. *DoughnutChart.java** import javafx.collections.ObservableList; import javafx.geometry.Bounds; import javafx.scene.Node; import javafx.scene.chart.PieChart; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; public class DoughnutChart extends PieChart { private final Circle innerCircle; public DoughnutChart(ObservableList&lt;Data&gt; pieData) { super(pieData); innerCircle = new Circle(); // just styled in code for demo purposes, // use a style class instead to style via css. innerCircle.setFill(Color.WHITESMOKE); innerCircle.setStroke(Color.WHITE); innerCircle.setStrokeWidth(3); } @Override protected void layoutChartChildren(double top, double left, double contentWidth, double contentHeight) { super.layoutChartChildren(top, left, contentWidth, contentHeight); addInnerCircleIfNotPresent(); updateInnerCircleLayout(); } private void addInnerCircleIfNotPresent() { if (getData().size() &gt; 0) { Node pie = getData().get(0).getNode(); if (pie.getParent() instanceof Pane) { Pane parent = (Pane) pie.getParent(); if (!parent.getChildren().contains(innerCircle)) { parent.getChildren().add(innerCircle); } } } } private void updateInnerCircleLayout() { double minX = Double.MAX_VALUE, minY = Double.MAX_VALUE; double maxX = Double.MIN_VALUE, maxY = Double.MIN_VALUE; for (PieChart.Data data: getData()) { Node node = data.getNode(); Bounds bounds = node.getBoundsInParent(); if (bounds.getMinX() &lt; minX) { minX = bounds.getMinX(); } if (bounds.getMinY() &lt; minY) { minY = bounds.getMinY(); } if (bounds.getMaxX() &gt; maxX) { maxX = bounds.getMaxX(); } if (bounds.getMaxY() &gt; maxY) { maxY = bounds.getMaxY(); } } innerCircle.setCenterX(minX + (maxX - minX) / 2); innerCircle.setCenterY(minY + (maxY - minY) / 2); innerCircle.setRadius((maxX - minX) / 4); } } DoughnutChartSample.java import javafx.application.Application; import javafx.collections.*; import javafx.scene.Scene; import javafx.scen…
has comment: http://stackoverflow.com/comment/83083364
upvote count: 14
answers question: http://stackoverflow.com/q/24121580

http://stackoverflow.com/comment/37423883
type: QuestionComment
comment on: http://stackoverflow.com/q/24232351
score: 0
type: Comment
has text: @Pasoon: Actually the code that you pasted here, doesn't belongs to `Swing`, it belongs to `AWT`. So why the question is tagged with `Swing`?

http://stackoverflow.com/q/24238251
tagged with: undo
downvote count: 0
tagged with: design-patterns
tagged with: memento
has answer: http://stackoverflow.com/a/24238312
has body: I am reading about Memento design pattern. I came across an example which talks about Calculator undo functionality. I am able to achieve the Calculator Undo with the below code: Calculator public class Calculator implements Cloneable { int num1; int num2; int result; Stack&lt;Calculator&gt; states = new Stack&lt;&gt;(); public void setNum1(int num1) { this.num1 = num1; } public void setNum2(int num2) { this.num2 = num2; } public void setResult(int result) { this.result = result; } public int add() throws CloneNotSupportedException{ result = num1 + num2; states.add((Calculator) this.clone()); System.out.println("Caclulation done. "); return result; } public void undo(){ states.pop(); Calculator calc = states.peek(); this.setNum1(calc.num1); this.setNum2(calc.num2); this.setResult(calc.result); System.out.println("Undo done. "); } public void displayState(){ System.out.println("Current State: " + num1 + " + " + num2 + " = " + result); } } CalculatorTest Calculator calc = new Calculator(); calc.setNum1(10); calc.setNum2(11); calc.add(); calc.displayState(); calc.setNum1(12); calc.setNum2(13); calc.add(); calc.displayState(); calc.setNum1(16); calc.setNum2(17); calc.add(); calc.displayState(); calc.undo(); calc.displayState(); calc.undo(); calc.displayState(); Output Caclulation done. Current State: 10 + 11 = 21 Caclulation done. Current State: 12 + 13 = 25 Caclulation done. Current State: 16 + 17 = 33 Undo done. Current State: 12 + 13 = 25 Undo done. Current State: 10 + 11 = 21 It works well for the undo. Why would I use Memento pattern for this scenario?
has title: What is the need for Memento Design Pattern in Calculator undo scenario
tagged with: java
answer count: 1
score: 1
upvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/37287705
has text: You really [shouldn't use `md5`](http://stackoverflow.com/questions/401656/secure-hash-and-salt-for-php-passwords)
comment on: http://stackoverflow.com/q/24160989
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/24173737
has comment: http://stackoverflow.com/comment/37312744
tagged with: java-8
tagged with: arraylist
has title: ArrayList.get(index) not returning a variable?
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37312823
tagged with: java
accepted answer: http://stackoverflow.com/a/24173811
answer count: 1
has answer: http://stackoverflow.com/a/24173811
has body: I am writing a neural net in Java, and I'm having trouble with an ArrayList.get() not returning a variable. double train(ArrayList&lt;Double&gt; inputVector, double desiredOutput) { double result = output(inputVector); double error = desiredOutput - result; double delta = learningRate_ * error * result * (1.0 - result); for (int i = 0; i &lt; outputLayer_.weights_.size(); i++) { outputLayer_.weights_.get(i).doubleValue() += delta * lastOutput_.get(i); } ArrayList&lt;Double&gt; hiddenDelta = new ArrayList&lt;Double&gt;(); for (int j = 0; j &lt; hiddenLayer_.size(); j++) { double HiddenDelta = delta * outputLayer_.weights_.get(j + 1) * lastOutput_.get(j + 1) * (1 - lastOutput_.get(j + 1)); for (int l = 0; l &lt; hiddenLayer_.get(j).weights_.size(); l++) { hiddenLayer_.get(j).weights_.get(l) += HiddenDelta * inputVector.get(l); } } The Error I get is on both of the lines that try to +=, each inside a for loop (1st and third) It tells me that a variable is expected. I am using JDK 8, with Intellij. I used the following to create the weights list: ArrayList&lt;Double&gt; weights_ = new ArrayList&lt;Double&gt;(); Every List is initialized in a similar form.
type: Question
has comment: http://stackoverflow.com/comment/37312746

http://stackoverflow.com/q/24221938
score: 0
tagged with: java
answer count: 1
tagged with: integer
type: Question
has title: What is the equivalent of "integer" from java in javascript?
has body: I have this in java: int minimo = Integer.MAX_VALUE; how would it look in javascript? Is there an equivalent of n"integer" in javascript? var minimo = Integer.MAX_VALUE; ?
linked to: http://stackoverflow.com/q/307179
tagged with: javascript
duplicate of: http://stackoverflow.com/q/307179
has answer: http://stackoverflow.com/a/24221975
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24221975

http://stackoverflow.com/comment/37373759
comment on: http://stackoverflow.com/q/24206036
score: 1
has text: @nasyia - If you have a solution to your problem don't forget to accept the answer that helped you most by clicking the grey tick.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37211867
score: 0
comment on: http://stackoverflow.com/q/24119916
type: Comment
type: QuestionComment
has text: What is the bottleneck when decompressing? Could be something else like unbuffered input.

clojure
tags question: http://stackoverflow.com/q/24199873
tags question: http://stackoverflow.com/q/24227963
tags question: http://stackoverflow.com/q/24223216
tags question: http://stackoverflow.com/q/24167317
tags question: http://stackoverflow.com/q/24252640
tag name: clojure
type: Tag
tags question: http://stackoverflow.com/q/24174306
tags question: http://stackoverflow.com/q/24172983
tags question: http://stackoverflow.com/q/24235123

http://stackoverflow.com/q/24149834
has body: Let's say I have a task with processing 1 million sentences. For each sentence, I need to do something with it, and it makes no matter what particular order they are processed in. In my Java program I have a set of futures partitioned from my main chunk of work with a callable that defines the unit of work to be done on a chunk of sentences, and I'm looking for a way to optimize the number of threads I allocate to work through the big block of sentences, and later recombine all the results of each thread. What would be the maximum number of threads I could use that would give me optimal performance in terms of speed before I saw diminishing returns? Also, what causes the logic that the more threads allocated, ie more being able to be done at once, to be incorrect?
possible better answer: http://stackoverflow.com/a/24157555
answer count: 3
accepted answer: http://stackoverflow.com/a/24149948
tagged with: java
tagged with: multithreading
downvote count: 0
has answer: http://stackoverflow.com/a/24149948
has title: Choosing optimal number of Threads for parallel processing of data
favorite count: 0
type: Question
tagged with: performance
score: 9
upvote count: 9
has answer: http://stackoverflow.com/a/24150937
has answer: http://stackoverflow.com/a/24157555
tagged with: future
has comment: http://stackoverflow.com/comment/37267910
tagged with: parallel-processing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1718465

http://stackoverflow.com/comment/37219104
type: Comment
type: QuestionComment
score: 0
has text: So this is actually a pretty hard problem. Look at this http://codereview.stackexchange.com/questions/12262/create-a-list-of-all-possible-combinations-of-elements-into-n-groups-from-a-set . Grab all of the possible combinations then add each number combination up and check if its greater then your number.
comment on: http://stackoverflow.com/q/24123822

http://stackoverflow.com/a/24220968
answers question: http://stackoverflow.com/q/24220652
type: Answer
has comment: http://stackoverflow.com/comment/37401938
has comment: http://stackoverflow.com/comment/37401976
has comment: http://stackoverflow.com/comment/37402116
has comment: http://stackoverflow.com/comment/37401988
upvote count: 3
downvote count: 0
score: 3
has body: Here is an XPath solution which doesn't use deprecated Date() constructors: String xml = "&lt;assets&gt; ... &lt;/assets&gt;"; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new InputSource(new StringReader(xml))); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "//document/metadata/field[@name='Test/Content/Modified']/text()"; NodeList dates = (NodeList) xPath.compile(expression).evaluate(doc, XPathConstants.NODESET); for(int i = 0; i &lt; dates.getLength(); i++) { String dateString = dates.item(i).getNodeValue(); System.out.println(dateString); // the original string SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy"); Date date = dateFormat.parse(dateString); System.out.println(date); // the date string of the parsed date } This prints (in my time zone): Thu Jun 01 13:11:43 2014 Sun Jun 01 13:11:43 BRT 2014 Thu Jun 01 13:11:43 2014 Sun Jun 01 13:11:43 BRT 2014 The original string date has an incorrect day of the week value for the month/year.

http://stackoverflow.com/q/24258625
favorite count: 0
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37473868
tagged with: performance
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37473828
has comment: http://stackoverflow.com/comment/37474884
score: 1
tagged with: java
answer count: 1
has title: Java android performance array: access class getter directly or create local copy
downvote count: 0
has comment: http://stackoverflow.com/comment/37473891
has answer: http://stackoverflow.com/a/24258724
has body: From a performance point of view, i have a class someClass { private List&lt;type&gt; data; public List&lt;type&gt; getData() { return data; } } class someOtherClass { private someClass instance; private someMethod() { // heavy loop for (...) { } } } is more efficient in a heavy loop calling directly (maybe more than one time) instance.getData().get(index).someOtherMethod(); or is more appropriate to make something like this before the loop: localData = someClass.getData(); and use localData for every need inside the loop? EDIT: supposing that the getData() method does some other things, the compiler optimization is still valid? class someClass { private List&lt;type&gt; data; public List&lt;type&gt; getData() { makeSomething(); return data; } }

http://stackoverflow.com/q/24260019
has answer: http://stackoverflow.com/a/63854160
has title: JavaFX Image not showing in stage
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/55565445
tagged with: image
has answer: http://stackoverflow.com/a/24260629
tagged with: javafx-2
type: AnsweredQuestion
tagged with: fxml
has answer: http://stackoverflow.com/a/47042512
tagged with: javafx-8
score: 5
has comment: http://stackoverflow.com/comment/37477260
downvote count: 0
possible better answer: http://stackoverflow.com/a/24260629
has body: I've tried several times and several ways but I can't make my image show on stage as I want. I think it might has to do with the path where java looks for resources, but i'm not sure, since I'm just starting using visual libraries (JavaFX in this case). Here's my directory structure: MyProject |_assets | |_img | |_myImage.jpg | |_some |_other |_folders | |_src |_ve |_org |_project |_MyProject.java |_StratPage.fxml |_StartPageController.java I need to retreive myImage.jpg to be rendered, and I've tried the following: 1) Pure fxml approach: &lt;ImageView id="logo" fx:id="logo" fitHeight="99.0" fitWidth="99.0" layoutX="14.0" layoutY="18.0" pickOnBounds="true" preserveRatio="true"&gt; &lt;image&gt; &lt;Image url="@../../../../assets/img/myImage.jpg" /&gt; &lt;/image&gt; &lt;/ImageView&gt; 2) Using both fxml and java. Declaring the ImageView element with fx:id="logo", and injecting the image from StartPageController.java like this: public class StartPageController implements Initializable { @FXML private ImageView logo; @Override public void initialize(URL url, ResourceBundle rb) { this.logo = new ImageView("file:../../../../assets/img/myImage.jpg"); } } Neither way produce any exception, i just does not show the image. I have no idea what to do. I would really appreciate your help. UPDATES: First I tried giving up on having the proposed directory structure, and placed the image file in the same folder of StartPageController.java. By doing logo = new ImageView(new Image(getClass().getResourceAsStream("myImage.jpg"))) I'm not getting any exception, but the image is not rendering, which suggest me it's not about finding the resource, but about rendering the image. Could it be the lack of any library? I'm on a Windows 8 environment, using Netbeans 8.0. Thanks again for your answers. Second I just deactivated packaging and distributing the app in the project properties in Netbeans. Now the images are rendering correctly, but I don't consider the issue solved, since when I ne…
has comment: http://stackoverflow.com/comment/37476702
has answer: http://stackoverflow.com/a/24260617
favorite count: 0
accepted answer: http://stackoverflow.com/a/47042512
type: Question
answer count: 5

http://stackoverflow.com/comment/37400626
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24220268
has text: @OliCharlesworth i am asking How compiler validate this?
type: QuestionComment

http://stackoverflow.com/q/24119973
tagged with: spring-mvc
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37211971
answer count: 1
linked to: http://stackoverflow.com/q/15746371
has comment: http://stackoverflow.com/comment/37211569
has comment: http://stackoverflow.com/comment/37211742
has comment: http://stackoverflow.com/comment/37213308
linked to: http://stackoverflow.com/q/4331532
type: Question
has comment: http://stackoverflow.com/comment/37211398
has body: I've two classes public class User { private int id; priavte List&lt;Hobby&gt; hobbies; //setter getter } public class Hobby { private int id; private String hobbyName; //setter getter } now i want to create form for User.java my form.jsp is &lt;form:form method="POST" action="saveEmployee.html" commandName="user" name="register-form" id="register-form" cssClass="smart-green"&gt; &lt;form:select path="hobbies" multiple="true" size="3"&gt; &lt;form:option value="1"&gt;Cricket&lt;/form:option&gt; &lt;form:option value="2"&gt;Computer Games&lt;/form:option&gt; &lt;form:option value="3"&gt;Tennis&lt;/form:option&gt; &lt;form:option value="4"&gt;Music&lt;/form:option&gt; &lt;/form:select&gt; &lt;/form:form&gt; myController.java @RequestMapping(value = "/saveEmployee.html", method = RequestMethod.POST) public ModelAndView addEmployee( @ModelAttribute("user") User user BindingResult result) { System.out.println(user.getChoice()); // giving null // usrDao.saveUser(user); return new ModelAndView("redirect:add.html", model); } How could i get the value for List from my form so that i could get the value?
has comment: http://stackoverflow.com/comment/37211779
type: UnansweredQuestion
has title: form creation in spring mvc issue
tagged with: spring
has answer: http://stackoverflow.com/a/24135021
has comment: http://stackoverflow.com/comment/37211481

http://stackoverflow.com/a/24245135
type: Answer
score: -1
answers question: http://stackoverflow.com/q/24245089
has body: It does not work because your huge pages are only 2MB (2048 kB) and your heap size is a minimum of 2 GB.
downvote count: 3
has comment: http://stackoverflow.com/comment/43251848
has comment: http://stackoverflow.com/comment/37450953
upvote count: 2

http://stackoverflow.com/comment/37318514
type: QuestionComment
has text: Why? Why do you want to test databinding? Don't you trust the ~ 12000 tests that are fired for the spring framework when building? You should be setting the parameter not the attributes. and you should be setting those on the MockHttpServletRequest instead of the wrapping request.
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24176478

http://stackoverflow.com/q/24218455
favorite count: 0
type: Question
tagged with: java
has title: Create skeleton from commandline
type: AnsweredQuestion
has body: I am following the steps in the Getting Started Guide and am getting a MissingProjectException error from Maven (missing pom.xml file). I have downloaded and installed the JavaSE jdk and Maven. I successfully compiled and ran the PlayN demo showcase for both desktop and html5. I tinkered with the demo "hello" app. Now I want to create my own little game starting from a standard PlayN project skeleton. How do I do that from the commandline? (Win7, Java 1.8, Maven 3.2.1) I am returning to Java after a decade and have no experience with Maven so I do not know if the guide has unstated prerequisites like copying a default pom.xml file from someplace. (following successful compilation of playn demo showcase in playn-samples)... PS C:\dev\playn-samples&gt; cd .. PS C:\dev&gt; PS C:\dev&gt; mkdir mygame Directory: C:\dev Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 6/14/2014 5:41 PM mygame PS C:\dev&gt; cd .\mygame Paste in the command as per the Getting Started Guide "Generating a skeleton project"... PS C:\dev\mygame&gt; mvn archetype:generate -DarchetypeGroupId=com.googlecode.playn -DarchetypeArtifactId=playn-archetype -DarchetypeVersion=1.8 [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.276 s [INFO] Finished at: 2014-06-14T17:41:37+09:00 [INFO] Final Memory: 4M/94M [INFO] ------------------------------------------------------------------------ [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\dev\mygame). Please verify you invoked Maven from the correct directory. -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible soluti…
downvote count: 0
tagged with: maven
accepted answer: http://stackoverflow.com/a/24218658
score: 1
upvote count: 1
tagged with: playn
answer count: 1
has answer: http://stackoverflow.com/a/24218658

http://stackoverflow.com/comment/37273795
has text: One thing MadProgrammer, I just note that its is java.awt.Color which works very well, but asking this out of curiosity, is there also a javax.swing.Color? I searched by couldn't find it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24152952
type: AnswerComment

http://stackoverflow.com/q/24234740
has body: Is there any way to use ListSelectionListener or MouseAdapter to get information about selected value (if value is a String for example), is there any built-in method for that? I only know how to get proper indexes but not the content or content.toString() I'm adding element like this: { DefaultListModel listModel; listModel.addElement(name); } @Edit Thank you for you for help. I solved my problem by doing this (for future generations so they wouldn't need to search as I did): list.addMouseListener(new MouseAdapter(){ @Override public void mouseClicked(MouseEvent e) { System.out.println("Mouse click."); int index = list.getSelectedIndex(); System.out.println("Index Selected: " + index); String s = (String) list.getSelectedValue(); System.out.println("Value Selected: " + s.toString()); } });
tagged with: listselectionlistener
downvote count: 0
has title: JList - getting value from Click
tagged with: jlist
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24235169
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37428205
type: UnansweredQuestion
tagged with: swing
upvote count: 4
score: 4

http://stackoverflow.com/q/24113263
tagged with: post-increment
has comment: http://stackoverflow.com/comment/37199325
downvote count: 1
duplicate of: http://stackoverflow.com/q/7911776
favorite count: 0
has title: Java increment operator
linked to: http://stackoverflow.com/q/7911776
has comment: http://stackoverflow.com/comment/37199426
has comment: http://stackoverflow.com/comment/37199305
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37199283
tagged with: increment
has comment: http://stackoverflow.com/comment/37199757
linked to: http://stackoverflow.com/q/19216118
has body: I'm reading Sams Teach Yourself Java and on the page about incrementing and decrementing the author says int x = 7; x = x++; "In this example, the statement x = x++ increments the x variable from 7 to 8." However the output is not 8, but 7 when complied. (no surprise there) But then why does x++; by itself give the output 8?
has comment: http://stackoverflow.com/comment/37199597
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/37199292
answer count: 0
has comment: http://stackoverflow.com/comment/37199668
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37199270
has comment: http://stackoverflow.com/comment/37199371

http://stackoverflow.com/comment/37295589
comment on: http://stackoverflow.com/q/24164597
score: 0
type: Comment
type: QuestionComment
has text: @ThaMe90 your answer is right too. ths!

http://stackoverflow.com/comment/37408985
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24224372
type: QuestionComment
has text: Dr. Heinz M. Kabutz did a [newsletter](http://www.javaspecialists.eu/archive/Issue220.html) on this recently.

http://stackoverflow.com/q/24206725
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/24207842
tagged with: java
downvote count: 0
favorite count: 0
type: Question
has title: JNI Accessing Object's Instance Variables
has answer: http://stackoverflow.com/a/24207842
has answer: http://stackoverflow.com/a/24207182
possible better answer: http://stackoverflow.com/a/24207182
tagged with: java-native-interface
tagged with: http://stackoverflow.com/tag/c
score: 4
has body: I am trying write in a instance object variable on Java: public class Test { public Test () { System.load("path_lib"); this.jni_result = 0; } public PrintVar() { JniTest(); System.out.println("jni_result: " + Long.toString(this.jni_result)); } private native long JniTest(); private long jni_result; } In C code I created the function to write in a variable static void SetErrorVariable(JNIEnv *env, jobject jobj, long error) { /* Get a reference to jctf object's class */ jclass TestClass = env-&gt;GetObjectClass(jobj); /* Get the Field ID of the instance variables "jni_result" */ jfieldID fidError = env-&gt;GetFieldID(TestClass, "jni_result", "J"); /* Change the variable "jni_result" */ jlong jerror = (jlong) error; env-&gt;SetLongField(TestClass, fidError, jerror); } JNIEXPORT jlong JNICALL Java_Test_JniTest(JNIEnv *env, jobject jobj) { SetErrorVariable(env, jobj, -5) return (jlong) -5; } I can read the return of JniTest when I change the return in C code, but the variable I cant change, I read several tutorials of JNI but I didnt find other way to do that, where am I wronging?
upvote count: 4
has comment: http://stackoverflow.com/comment/60811893
tagged with: c++

http://stackoverflow.com/comment/37318262
type: Comment
comment on: http://stackoverflow.com/q/24176749
score: 0
type: QuestionComment
has text: try to get distinct data from table.

http://stackoverflow.com/a/24181115
has body: Edit: It appears the poster may actually be asking why can't Objects be static in Java?, in which case, the answer is "they can" and I have added that to the answer at the bottom. If however the question is why can't Objects be allocated on the stack as they can in C++ then the first part of this answer attempts to deal with that: I guess it boils down to the design goals of the Java language. Because java has a garbage collector it doesn't really need to have stack allocated objects. Trying to make things simpler, safer, familiar, while keeping them fast and consistent were design goals of the Java language designers. Quoting from here http://www.oracle.com/technetwork/java/simple-142339.html (emphasis is mine): Simplicity is one of Java's overriding design goals. Simplicity and removal of many "features" of dubious worth from its C and C++ ancestors keep Java relatively small and reduce the programmer's burden in producing reliable applications. To this end, Java design team examined many aspects of the "modern" C and C++ languages to determine features that could be eliminated in the context of modern object-oriented programming. One of those features that the designers decided was of "dubious worth" (or unnecessarily complicated the language or its Garbage Collection processes) were stack-allocated Objects. These online chapters cover the design goals of the Java language in-depth. Reviewing the comments I believe that I may have misinterpretted the original poster's question because the question seems to be confusing the two completely orthogonal concepts of allocating Objects on the stack with statically allocated Objects. Stack allocation refers to value Objects that exist only within their current scope and occupy space on the stack. Static allocation refers to instances that exist per Class - Objects that can exist for the lifetime of the application and are initialized within a static allocation block. Java doesn't support the former concept (except with p…
score: 2
has comment: http://stackoverflow.com/comment/37353612
has comment: http://stackoverflow.com/comment/37326224
upvote count: 2
has comment: http://stackoverflow.com/comment/37349901
has comment: http://stackoverflow.com/comment/37326475
has comment: http://stackoverflow.com/comment/37325781
downvote count: 0
has comment: http://stackoverflow.com/comment/37328262
has comment: http://stackoverflow.com/comment/37328170
has comment: http://stackoverflow.com/comment/37325679
has comment: http://stackoverflow.com/comment/37326109
has comment: http://stackoverflow.com/comment/37326155
type: Answer
has comment: http://stackoverflow.com/comment/37364409
answers question: http://stackoverflow.com/q/24179497

http://stackoverflow.com/q/24193689
type: UnansweredQuestion
has title: Recognise input made with Sikuli/Selenium
score: -1
has body: I've been messing around with Sikuli and Selenium. Yesterday I tried using it to log in on a certain page. This page uses an Java applet for login in so naturally I used Sikuli for the input of text. Now, this java applet works very well when i log in manually, however, when I try to log in using my application, the page returns a cryptic message. I've been trying all kinds of stuff and the only thing I can think of is that they somehow recognise that the input of text is made by sikuli, and not a real human. My question is, how does this work?
has comment: http://stackoverflow.com/comment/37353975
upvote count: 0
has answer: http://stackoverflow.com/a/24199831
tagged with: java
answer count: 1
tagged with: selenium
downvote count: 1
tagged with: applet
favorite count: 0
type: Question
tagged with: sikuli

http://stackoverflow.com/comment/37486836
has text: I use Maven 3.0.3 and maven-war-plugin 2.4. I use IntelliJ and the command line - with the same result. Could you tell me which part of my POM you wish to inspect and how it is relevant to my problem ? I'd like to avoid bloating the question.
score: 0
comment on: http://stackoverflow.com/q/24265427
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24179409
type: Question
has body: I have two classes BaseEntity (annotated with @MappedSuperclass) and sub-class BaseEntityTest annotated with @Entity. When I run the app and try to access the DB through openJPA I get this error: java.lang.NoClassDefFoundError: Could not initialize class za.co.sci.core.entities.BaseEntityTest at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_51] at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_51] Here are the classes: @MappedSuperclass public class BaseEntity { } @Entity public class BaseEntityTest extends BaseEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } I have tried with both classes in my persistence.xml as well as only the subclass. I am using openJPA version 2.3.0, but have tried with 2.2.2 as well. Full stack trace: 20:25:18,079 ERROR [org.jboss.as.ejb3] (default task-27) javax.ejb.EJBTransactionRolledbackException: Unexpected Error 20:25:18,079 ERROR [org.jboss.as.ejb3.invocation] (default task-27) JBAS014134: EJB Invocation failed on component AddressManager for method public abstract java.util.List za.co.sci.core.remote.IManagerRemote.getAll(): javax.ejb.EJBTransactionRolledbackException: Unexpected Error at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:157) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final] at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:253) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final] at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:342) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final] at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processIn…
tagged with: openjpa
has comment: http://stackoverflow.com/comment/37323078
has comment: http://stackoverflow.com/comment/37360671
has title: NoClassDefFoundError when using MappedSuperclass and OpenJPA
has comment: http://stackoverflow.com/comment/37322725
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37373655
has comment: http://stackoverflow.com/comment/37348360
accepted answer: http://stackoverflow.com/a/28085377
has comment: http://stackoverflow.com/comment/37322853
has answer: http://stackoverflow.com/a/28085377
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37323012
tagged with: noclassdeffounderror
has comment: http://stackoverflow.com/comment/37473191
favorite count: 0

http://stackoverflow.com/a/24151233
score: 1
has body: Lacking the existence of a @JsonWrapped annotation, my personal preferred solution here would be to use the converter functionality of @JsonSerialize (looks like you'd need Jackson 2.3+ for this; the annotation is supported in 2.2.2 but I got unexpected runtime errors). Basically, a converter lets you do a pre-serialization transformation from one data structure to another. This lets you work with simple data classes rather than mucking about creating a custom serializer. First, model your DTO how you want it to be serialized: public static class UserDto { private final Name name; private UserDto(Name name) { this.name = name; } public static UserDto fromUser(User user) { return new UserDto(Name.fromUser(user)); } public Name getName() { return name; } public static class Name { private final String first; private final String middle; private final String last; private Name(String first, String middle, String last) { this.first = first; this.middle = middle; this.last = last; } public static Name fromUser(User user) { return new Name(user.getFirst(), user.getMiddle(), user.getLast()); } public String getFirst() { return first; } public String getMiddle() { return middle; } public String getLast() { return last; } } } Next, create a simple Converter class (I nested it in UserDto): public static class Converter extends StdConverter&lt;User, UserDto&gt; { @Override public UserDto convert(User value) { return UserDto.fromUser(value); } } Then, use that converter class in your mixin: @JsonSerialize(converter = UserDto.Converter.class) public interface UserMixin { }
answers question: http://stackoverflow.com/q/24150609
type: Answer
accepted answer of: http://stackoverflow.com/q/24150609
has comment: http://stackoverflow.com/comment/37297609
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/40909515
score: 1
has body: With eclipse or any other IDE, just right click on your main spring boot application and click "debug as java application"
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24113939
upvote count: 2

http://stackoverflow.com/a/24155649
answers question: http://stackoverflow.com/q/24155428
has body: Static initialization block is being ran when JVM (class loader) loads StaticClass (when it is first time referenced in code). For more details about refer static block in java
type: Answer
score: 0

http://stackoverflow.com/comment/37209419
has text: What does `listaMensajesRecibidos.getSelectedValue()` do? Are you sure it reads data from DB?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24118935
type: Comment

http://stackoverflow.com/q/24192303
has answer: http://stackoverflow.com/a/24193601
accepted answer: http://stackoverflow.com/a/24193601
has title: Transforming JSON data to match new Java model
score: 1
upvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
favorite count: 0
type: Question
has body: My java application makes use of complex object graphs that are jackson annotated and serialized to json in their entirety for client side use. Recently I had to change one of the objects in the domain model such that instead of having two children of type X it will instead contain a Set&lt;X&gt;. This changed object is referenced by several types of objects in the model. The problem now is that I have a large quantity of test data in json form for running my unit tests that I need to convert to this new object model. My first thought for updating the json files was to use the old version java object model to deserialize the json data, create new objects using the new version object model, hydrate the new objects from the old objects and then finally serialize the new objects back to json. I realized though that the process of programmatically creating matching object graphs and then hydrating those object graphs could be just as tedious as fixing the json by hand since the object graphs are relatively deep and its not a simple clone. I'm wondering how I can get around fixing these json files entirely by hand? I'm open to any suggestions even non-java based json transformation or parsing tools.
tagged with: jackson
type: AnsweredQuestion
downvote count: 0

global
type: Tag
tags question: http://stackoverflow.com/q/24175530
tags question: http://stackoverflow.com/q/24194650
tag name: global

http://stackoverflow.com/comment/37205194
comment on: http://stackoverflow.com/q/24115091
type: Comment
type: QuestionComment
has text: Not that I'm aware of...
score: 0

http://stackoverflow.com/a/24221184
has body: Your question is invalid, for the following reasons: You are using my name in your code (I am the Lowagie known from the com.lowagie packages). This means that you're using an obsolete version of iText that contains plenty of known bugs that have been fixed in the last five years. I've written a proof of concept (POC) using your code snippet in a recent version of iText and I can't reproduce the problem. For the POC, I have downloaded LiberationSans-Regular.ttf from this site: http://www.fontsquirrel.com/fonts/Liberation-Sans I have copy pasted your code snippet and I've taken a simple Greek word to write a small standalone app named LiberationSans. The resulting PDF looks like this: LiberationSans.pdf (please check if it shows the Greek word for "Brides"). No exception was encountered: Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("LiberationSans.pdf")); document.open(); FontFactory.register("resources/fonts/LiberationSans-Regular.ttf","Greek-Regular"); Font f = FontFactory.getFont("Greek-Regular", "Cp1253", true); Paragraph p = new Paragraph("\u039d\u03cd\u03c6\u03b5\u03c2", f); document.add(p); Note that Liberation Sans isn't a Greek font as you claim. It's a font that contains a number of glyphs, among others glyphs from the Greek alphabet. Also note that you may want to replace "Cp1253" in my example with BaseFont.IDENTITY_H (this results in more future-proof PDFs). Long story short: there is a reason why we advise people not to use old versions of iText. Please read http://itextpdf.com/salesfaq for more info.
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24220668
score: 1
type: Answer

http://stackoverflow.com/q/24229646
has comment: http://stackoverflow.com/comment/37427892
type: UnansweredQuestion
has body: Login form have wrong action parameter value for j_spring_security_check. Spring 3 have not translated it to valid url for login page. part of resulted login page &lt;form id="command" name="f" action="&lt;c:url value='j_spring_security_check'/&gt;;" method="POST"&gt; ... &lt;/form&gt; spring-security.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"&gt; &lt;http auto-config="true" use-expressions="true"&gt; &lt;intercept-url pattern="/j_spring_security_check" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt; &lt;intercept-url pattern="/login" access="permitAll" /&gt; &lt;intercept-url pattern="/logout" access="permitAll" /&gt; &lt;intercept-url pattern="/accessdenied" access="permitAll" /&gt; &lt;intercept-url pattern="/**" access="hasRole('ROLE_USER')" /&gt; &lt;form-login login-page="/login" login-processing-url="/j_spring_security_check" default-target-url="/main" authentication-failure-url="/accessdenied" /&gt; &lt;logout logout-success-url="/logout" /&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="testuser" password="testpassword" authorities="ROLE_USER" /&gt; &lt;/user-service&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; &lt;global-method-security pre-post-annotations="enabled" /&gt; &lt;/beans:beans&gt; login.jsp &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %&gt; &lt;%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %&gt; &lt;html&gt…
answer count: 1
has comment: http://stackoverflow.com/comment/37435568
has answer: http://stackoverflow.com/a/24230772
type: Question
score: 0
has title: Cannot use j_spring_security_check value in form
tagged with: java
has comment: http://stackoverflow.com/comment/37426867
has comment: http://stackoverflow.com/comment/37419825

http://stackoverflow.com/q/24216180
has answer: http://stackoverflow.com/a/24216504
has answer: http://stackoverflow.com/a/24216741
tagged with: android
has body: I have one activity that contains text view, buttons, spinner and list view my main XML file contains : &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffff00" tools:context="com.example.taxitabriz.MainActivity" tools:ignore="MergeRootFrame" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="8dp" android:text="@string/app_name" android:textSize="35dp" android:textStyle="bold" android:textColor="#996600" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:id="@+id/linearlayout1" &gt; &lt;Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#996600" android:text="@string/exit" android:background="@drawable/backbutton" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#996600" android:text="@string/about" android:background="@drawable/backbutton" /&gt; &lt;/LinearLayout&gt; &lt;Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@+id/textView1" android:layout_marginTop="19dp" /&gt; &lt;ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/spinner1" android:layout_above="@+id/linearlayout1" android:layout_alignParentRight="true" android:layout_weight="49.94" &gt; &lt;/ListView&gt; and p…
has answer: http://stackoverflow.com/a/24216461
accepted answer: http://stackoverflow.com/a/24216461
type: AnsweredQuestion
has title: how can i change fontcolor and font type of my listview
downvote count: 0
possible better answer: http://stackoverflow.com/a/24216238
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24216238
has answer: http://stackoverflow.com/a/24216257
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
answer count: 5

http://stackoverflow.com/q/24235485
has title: Maintaining Java 6 and Java 7 together on Mac OS Mavericks
type: Question
type: UnansweredQuestion
has body: There have been various posts in several places about how hard it is it deal with Java on the mac. I had installed Java 7 some time ago on my mac with os mavericks, but then found that certain software ( like Open Office) can't run without Java 6, so after a lot of work I rolled that back. Now I would like to use pydev with Eclipse. However this software requires Java 7. How do I maintain both versions of Java on the same machine? Thanks
answer count: 1
has answer: http://stackoverflow.com/a/24235839
tagged with: operating-system
tagged with: osx-mavericks
tagged with: java
downvote count: 0
score: 1
upvote count: 1
tagged with: macos
favorite count: 0

http://stackoverflow.com/comment/37213254
score: 0
type: AnswerComment
type: Comment
has text: If the webService is a thirdparty service and shall work always as you expect it, definitely you need to use a mock(I suggest you mockito). You have to realize that what you want to test, is how you serialize and deserialize the information that you send and receive from that WS. In any case the example that I paste to you is perfectly valid to make a request to whatever web service.
comment on: http://stackoverflow.com/a/24119124

http://stackoverflow.com/a/24136162
accepted answer of: http://stackoverflow.com/q/24117897
has comment: http://stackoverflow.com/comment/37248697
answers question: http://stackoverflow.com/q/24117897
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37247772
has body: The ^ character is not allowed in URL, probably SOAPUI is encoding the URL for you. I think the case representation is importat for URL escape characters try with uppercase %5E instead of lowercase %5e. EDIT: I just make a try configuring a TCP monitor on my localhost and making a SOAP request from SOAPUI to http://localhost:8091?type=entry&amp;version=1.0&amp;Sender.Service=SenderService&amp;Interface=sampleurl/ABC^ServiceRequest. In the TCP monitor I see %5E instead of ^ so it seems that SOAPUI is encoding the URL properly, you can see this in the image below: Hope this helps,
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/24124295
tagged with: libgdx
has comment: http://stackoverflow.com/comment/37219541
has body: How can I switch the screen and still save the progress of the current game? For example I have an additional screen, when you press tab key, that shows some information about the player (attributes, stats, etc.), but when you switch the screen again to resume your game the show method is called again and you lose everything... The only method I know is that before you hide the screen to save the game in some format and load it in show but I highly doubt that this is the proper way to do it, as there would be a real performance issue when you switch the screens very fast... I need a way to keep the data from the previous screen and not initialize it every time the screen is showed. This would also apply to the skill tree and inventory which also needs to be saved for the entire game session. The filed loading from save game file format should be done only once not every time a screen changes. Any ideas?
answer count: 0
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: java
downvote count: 0
favorite count: 0
type: Question
has title: LibGDX Saving progress when switching screen

http://stackoverflow.com/comment/37432194
has text: Also, the code you provided is neither accurate or on topic...
type: Comment
comment on: http://stackoverflow.com/q/24236738
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37353482
type: AnswerComment
has text: Thank you. I turns out, I need to put the java IN FRONT of others directory, not BEHIND others directory like your picture did. Thank you for the picture :)
comment on: http://stackoverflow.com/a/24194862
type: Comment
score: 0

http://stackoverflow.com/comment/37241962
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24135045
has text: Right, why do you create the thread that takes pictures inside the `OnPictureTaken`? Wouldn't it be easier and cleaner to create the `thread` and put the `while` loop in `takePictures` and leave the callback method relatively simple? I've written a code that does exactly what you're trying to do like this and it worked just fine from the git-go.

http://stackoverflow.com/q/24225305
has body: I want to add possibility to pause/resume to my game. Unfortunately my solution only pauses the game, but does not resume it (when I click resume button nothing happens - the image is still). I also tried to call wait/notify methods on thread, but it also did not work - I got Exception in thread "AWT-EventQueue-0" java.lang.IllegalMonitorStateException. What is the best solution to make pause/resume? Game Loop public void run() { init(); long startTime; long reTime; long waitTime; while (running) { startTime = System.nanoTime(); int CarPosX = car.zwrocPolozenieX(); int CarPosY = car.zwrocPolozenieY(); update(b, CarPosX, CarPosY); render(b); //draw(); repaint(); if(b&lt;4390) { b=b+szybkoscMapy; } reTime = System.nanoTime() - startTime; waitTime = targetTime - reTime/100000000; try { Thread.sleep(waitTime); } catch(Exception e) { } } } public void init() { if(thread == null) { thread = new Thread(this); thread.start(); } b=0; running = true; image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); g = (Graphics2D) image.getGraphics(); map = new Map(levelNumber); car = new Car(map); car.setxpos(338); car.setypos(150); } Listeners pause_button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { bp.running = false; } }); resume_button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { bp.running = true; } });
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/24225386
favorite count: 0
has title: Swing animation pause and resume
type: Question
linked to: http://stackoverflow.com/q/14886232
score: 1
tagged with: java
tagged with: animation
type: AnsweredQuestion
tagged with: game-loop
linked to: http://stackoverflow.com/q/9849950
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24225386

http://stackoverflow.com/a/24137400
downvote count: 0
type: Answer
has body: Your code isn't good. Don't do this. That's a lot of code when three static final Strings would do perfectly well. Even better, you should externalize these things. No username or password for database? Oh, my. If you're using Tomcat, the right thing to do is to use a JNDI connection pool. Tomcat has detailed docs to show you how. Let me take another guess: You're writing JSPs with scriptlets in them. Another "don't do". Learn JSTL if you must use JSPs. I can't tell anything from that stack trace. Is there anything else?
score: 2
answers question: http://stackoverflow.com/q/24137297
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37244736
has comment: http://stackoverflow.com/comment/37244874
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24137297

http://stackoverflow.com/a/43260536
downvote count: 0
has body: Looks like you might be building your jar incorrectly. Files from 'src/main/resources' would be expected at the root of the jar file. If your jar file contains the 'src/main/resources' directory, something's off with your build.
type: Answer
answers question: http://stackoverflow.com/q/24192908
score: 2
upvote count: 2

http://stackoverflow.com/comment/37200486
comment on: http://stackoverflow.com/q/24113818
score: 0
type: QuestionComment
type: Comment
has text: Close vote because this question shows no effort on searching and finding the answer before posting on SO.

http://stackoverflow.com/comment/37226463
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24127681
has text: @DSlomer64 from where swing come into picture here.

http://stackoverflow.com/comment/37242032
type: QuestionComment
score: 0
has text: why cant you use `oracle sequences` instead of triggers
comment on: http://stackoverflow.com/q/24136223
type: Comment

http://stackoverflow.com/q/24235194
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/37429265
score: 0
tagged with: java
has title: Retrieving Data from App Engine
answer count: 1
type: Question
has body: I am a beginner in GAE and my application is doing the insert, but is not returning datafrom database. No error appears in the log. What is wrong? Follows my Factory class: import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class EMFService { public static final EntityManagerFactory emfInstance = Persistence.createEntityManagerFactory("transactions-optional"); private EMFService(){} public static EntityManagerFactory get() { return emfInstance; } } Follows my Select class: public List<Pessoa> listPessoas() { EntityManager em = EMFService.get().createEntityManager(); List<Pessoa> lista; try { Query q = em.createQuery("select p from Pessoa p"); lista = (List<Pessoa>) q.getResultList(); } finally { em.close(); } return lista; } Follows my JSP Page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Pessoas Nome Idade <c:forEach items="${pessoas}" var="pessoa"> <c:out value="${pessoa.nome}" /> <c:out value="${pessoa.idade}" /> </c:forEach>
has comment: http://stackoverflow.com/comment/37430010
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24235466

coding-style
type: Tag
tag name: coding-style
tags question: http://stackoverflow.com/q/24210131

http://stackoverflow.com/comment/37358319
type: Comment
type: QuestionComment
has text: is it possible to send me ur email so that i can unzip code and send u?
score: 0
comment on: http://stackoverflow.com/q/24197350

http://stackoverflow.com/q/24119782
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37212007
has title: Inserting into database with auto increment
has answer: http://stackoverflow.com/a/24119838
tagged with: java
has comment: http://stackoverflow.com/comment/37211488
tagged with: mysql
has comment: http://stackoverflow.com/comment/37211181
type: Question
has comment: http://stackoverflow.com/comment/37211216
has comment: http://stackoverflow.com/comment/37211519
type: UnansweredQuestion
has body: I need to store some values into my table using prepared statements. I have a column in my table called id, and it is set to auto increment. I do not need any input from the user for this column. The other values are all gotten from the user. Edit: There are 2 IDs. One from the user and one that is auto generated from the database. The one automatically generated by the database is the primary key. Am I doing this right? Thanks. Prepared Statement: DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `insert_details`(IN id varchar(45),IN username varchar(45),IN name varchar(45)) BEGIN insert into details (id,username,name) values (id ,username,name); END Code: PreparedStatement preparedStatement = connect.prepareStatement("CALL INSERT_DETAILS(?,?,?)"); preparedStatement.setLong(1, userID); preparedStatement.setString(2, username); preparedStatement.setString(3, name); preparedStatement .executeUpdate();
has answer: http://stackoverflow.com/a/24119854
has comment: http://stackoverflow.com/comment/37211307

swing
tags question: http://stackoverflow.com/q/24110190
tags question: http://stackoverflow.com/q/24225504
tags question: http://stackoverflow.com/q/24158642
tags question: http://stackoverflow.com/q/24110920
tags question: http://stackoverflow.com/q/24107331
tags question: http://stackoverflow.com/q/24261680
tags question: http://stackoverflow.com/q/24202721
tags question: http://stackoverflow.com/q/24134581
tags question: http://stackoverflow.com/q/24144872
tags question: http://stackoverflow.com/q/24180099
tags question: http://stackoverflow.com/q/24189152
tags question: http://stackoverflow.com/q/24215065
tags question: http://stackoverflow.com/q/24251500
tags question: http://stackoverflow.com/q/24199636
tags question: http://stackoverflow.com/q/24159240
tags question: http://stackoverflow.com/q/24115907
tags question: http://stackoverflow.com/q/24108644
tags question: http://stackoverflow.com/q/24239642
tags question: http://stackoverflow.com/q/24182802
tags question: http://stackoverflow.com/q/24216790
tags question: http://stackoverflow.com/q/24246494
tags question: http://stackoverflow.com/q/24119743
tags question: http://stackoverflow.com/q/24213993
tags question: http://stackoverflow.com/q/24143382
tags question: http://stackoverflow.com/q/24213048
tags question: http://stackoverflow.com/q/24191250
tags question: http://stackoverflow.com/q/24202474
tags question: http://stackoverflow.com/q/24234740
tags question: http://stackoverflow.com/q/24231925
tags question: http://stackoverflow.com/q/24175473
tags question: http://stackoverflow.com/q/24210293
tags question: http://stackoverflow.com/q/24224455
tags question: http://stackoverflow.com/q/24109621
tags question: http://stackoverflow.com/q/24233657
tags question: http://stackoverflow.com/q/24184670
tags question: http://stackoverflow.com/q/24254507
tags question: http://stackoverflow.com/q/24250717
tags question: http://stackoverflow.com/q/24167527
tags question: http://stackoverflow.com/q/24202118
tags question: http://stackoverflow.com/q/24227347
tags question: http://stackoverflow.com/q/24228513
tags question: http://stackoverflow.com/q/24179643
tags question: http://stackoverflow.com/q/24158585
tags question: http://stackoverflow.com/q/24153450
tags question: http://stackoverflow.com/q/24222618
tags question: http://stackoverflow.com/q/24234164
tags question: http://stackoverflow.com/q/24235289
tags question: http://stackoverflow.com/q/24185342
tags question: http://stackoverflow.com/q/24217961
tags question: http://stackoverflow.com/q/24163370
tags question: http://stackoverflow.com/q/24222292
tags question: http://stackoverflow.com/q/24235557
tags question: http://stackoverflow.com/q/24214584
tags question: http://stackoverflow.com/q/24113614
tags question: http://stackoverflow.com/q/24237030
tags question: http://stackoverflow.com/q/24246800
tags question: http://stackoverflow.com/q/24180839
tags question: http://stackoverflow.com/q/24152945
tags question: http://stackoverflow.com/q/24201481
tags question: http://stackoverflow.com/q/24253358
tags question: http://stackoverflow.com/q/24193404
tags question: http://stackoverflow.com/q/24235456
tags question: http://stackoverflow.com/q/24121806
tags question: http://stackoverflow.com/q/24157794
tags question: http://stackoverflow.com/q/24247194
tags question: http://stackoverflow.com/q/24248757
tags question: http://stackoverflow.com/q/24200913
tags question: http://stackoverflow.com/q/24167805
tags question: http://stackoverflow.com/q/24151663
tags question: http://stackoverflow.com/q/24151636
tags question: http://stackoverflow.com/q/24105539
tags question: http://stackoverflow.com/q/24226938
tags question: http://stackoverflow.com/q/24210905
tags question: http://stackoverflow.com/q/24153800
tags question: http://stackoverflow.com/q/24125336
tags question: http://stackoverflow.com/q/24113659
tags question: http://stackoverflow.com/q/24258721
tags question: http://stackoverflow.com/q/24173866
tags question: http://stackoverflow.com/q/24158432
tags question: http://stackoverflow.com/q/24124410

http://stackoverflow.com/comment/37337978
score: 0
has text: @antak Aaand there we go. If your keys are larger than 8 byte signed you have a problem, because only integers in that range are cached. Meaning `synchronized(128){}` is a no op, since it's equivalent to `synchronized(new Integer(128))`
type: QuestionComment
comment on: http://stackoverflow.com/q/24175558
type: Comment

http://stackoverflow.com/q/24189485
type: Question
accepted answer: http://stackoverflow.com/a/24189584
downvote count: 0
tagged with: scala
has answer: http://stackoverflow.com/a/24194497
score: 6
tagged with: sorting
has answer: http://stackoverflow.com/a/24189656
has body: I use List(1, 2, 3, 4) ::: List(1, 2, 5) distinct for this issue. It returns List(1, 2, 3, 4, 5). How to achieve the same functionality in java and do it very efficiently and elegantly ???
has title: How to achieve this scala operation in java efficiently
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24189584
possible better answer: http://stackoverflow.com/a/24194497
answer count: 3
tagged with: java
upvote count: 6
has comment: http://stackoverflow.com/comment/37341941
favorite count: 0

http://stackoverflow.com/comment/37309415
type: Comment
score: 0
type: AnswerComment
has text: 3. If i use the & I can make another login after some hours to check the state of the process? how? 2. At home I've Mac OS, at university ubuntu. The scp command [is this?](http://www.hypexr.org/linux_scp_help.php)
comment on: http://stackoverflow.com/a/24171160

spring
tags question: http://stackoverflow.com/q/24175664
tags question: http://stackoverflow.com/q/24156688
tags question: http://stackoverflow.com/q/24126222
tags question: http://stackoverflow.com/q/24179859
tags question: http://stackoverflow.com/q/24200095
tags question: http://stackoverflow.com/q/24170083
tags question: http://stackoverflow.com/q/24106726
tags question: http://stackoverflow.com/q/24245478
tags question: http://stackoverflow.com/q/24210992
tags question: http://stackoverflow.com/q/24150498
tags question: http://stackoverflow.com/q/24116768
tags question: http://stackoverflow.com/q/24143447
tags question: http://stackoverflow.com/q/24260145
tags question: http://stackoverflow.com/q/24256766
tags question: http://stackoverflow.com/q/24178045
tags question: http://stackoverflow.com/q/24116496
tags question: http://stackoverflow.com/q/24159524
tags question: http://stackoverflow.com/q/24225969
tags question: http://stackoverflow.com/q/24232552
tags question: http://stackoverflow.com/q/24145758
tags question: http://stackoverflow.com/q/24237015
tags question: http://stackoverflow.com/q/24139466
tags question: http://stackoverflow.com/q/24168522
tags question: http://stackoverflow.com/q/24185559
tags question: http://stackoverflow.com/q/24164798
tags question: http://stackoverflow.com/q/24244817
tags question: http://stackoverflow.com/q/24212514
tags question: http://stackoverflow.com/q/24259712
tag name: spring
tags question: http://stackoverflow.com/q/24165541
tags question: http://stackoverflow.com/q/24256291
tags question: http://stackoverflow.com/q/24179777
tags question: http://stackoverflow.com/q/24180337
tags question: http://stackoverflow.com/q/24262194
tags question: http://stackoverflow.com/q/24128577
tags question: http://stackoverflow.com/q/24195586
tags question: http://stackoverflow.com/q/24153379
tags question: http://stackoverflow.com/q/24200346
tags question: http://stackoverflow.com/q/24165782
tags question: http://stackoverflow.com/q/24253700
tags question: http://stackoverflow.com/q/24213823
tags question: http://stackoverflow.com/q/24146225
tags question: http://stackoverflow.com/q/24248025
tags question: http://stackoverflow.com/q/24262575
tags question: http://stackoverflow.com/q/24230349
tags question: http://stackoverflow.com/q/24244781
tags question: http://stackoverflow.com/q/24116561
tags question: http://stackoverflow.com/q/24220458
tags question: http://stackoverflow.com/q/24202779
tags question: http://stackoverflow.com/q/24246352
tags question: http://stackoverflow.com/q/24168588
tags question: http://stackoverflow.com/q/24131327
tags question: http://stackoverflow.com/q/24123683
tags question: http://stackoverflow.com/q/24169300
tags question: http://stackoverflow.com/q/24233821
tags question: http://stackoverflow.com/q/24194724
tags question: http://stackoverflow.com/q/24265950
tags question: http://stackoverflow.com/q/24197141
tags question: http://stackoverflow.com/q/24143460
tags question: http://stackoverflow.com/q/24178112
tags question: http://stackoverflow.com/q/24212981
tags question: http://stackoverflow.com/q/24239558
tags question: http://stackoverflow.com/q/24109189
tags question: http://stackoverflow.com/q/24167590
tags question: http://stackoverflow.com/q/24225512
tags question: http://stackoverflow.com/q/24113570
tags question: http://stackoverflow.com/q/24141783
tags question: http://stackoverflow.com/q/24113647
tags question: http://stackoverflow.com/q/24226168
tags question: http://stackoverflow.com/q/24165285
tags question: http://stackoverflow.com/q/24148809
tags question: http://stackoverflow.com/q/24138786
tags question: http://stackoverflow.com/q/24215446
tags question: http://stackoverflow.com/q/24182080
tags question: http://stackoverflow.com/q/24137038
tags question: http://stackoverflow.com/q/24127287
tags question: http://stackoverflow.com/q/24159407
tags question: http://stackoverflow.com/q/24167025
tags question: http://stackoverflow.com/q/24208828
tags question: http://stackoverflow.com/q/24210092

http://stackoverflow.com/a/24219547
answers question: http://stackoverflow.com/q/24219038
has body: I recommend the localtunnel.me utility; it gives you a publicly-accessible URL that forwards to a local machine and is great for testing postbacks and Web hooks.
type: Answer
score: 0

http://stackoverflow.com/a/24115363
answers question: http://stackoverflow.com/q/24115303
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer
has body: You cannot just add {0,20} to the whole regex as it will mean from 0 to 20 occurrence of each email address. You can use it like this using lookahead to enforce length: ^(?=.{1,20}$)[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$
has comment: http://stackoverflow.com/comment/37203022
accepted answer of: http://stackoverflow.com/q/24115303
score: 1

http://stackoverflow.com/a/24132726
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37236882
accepted answer of: http://stackoverflow.com/q/24132514
has body: You can use Collection.sort(). for sorting any kind of ArrayLsit Object. Collections.sort(listOfStringArrays,new Comparator&lt;String[]&gt;() { public int compare(String[] strings, String[] otherStrings) { return strings[1].compareTo(otherStrings[1]); } });
has comment: http://stackoverflow.com/comment/37237688
answers question: http://stackoverflow.com/q/24132514
score: 1
has comment: http://stackoverflow.com/comment/37238774
type: Answer
has comment: http://stackoverflow.com/comment/37238250
has comment: http://stackoverflow.com/comment/37235758
downvote count: 0

http://stackoverflow.com/q/24161364
score: 0
answer count: 0
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/37308414
tagged with: background
type: Question
has comment: http://stackoverflow.com/comment/37312954
type: UnansweredQuestion
tagged with: multithreading
has body: Everything work find when i run the code without background Thread(TASK CLASS) I want to update the tableview with the query results that the search method returns which is dataResource.search(parameters, sectionToRun) Note: Everything is run under FXMLController This is code snippet below i'm using as the Task Thread: @FXML public TableView&lt;Record&gt; tblRecords; // i made this public so can access it // in the TACK CLASS @FXML private void onActionSearch(ActionEvent event) { final Map&lt;String, String&gt; parameters = new HashMap&lt;&gt;(); ; final int sectionToRun; // This keep track of the part of the if branch // of the query to execute String query = ""; fullName = txtFullName.getText().trim(); insurance = txtInsurance.getText().trim(); age = txtAge.getText().trim(); String day = cboSearchDay.getSelectionModel().getSelectedItem(); String month = cboSearchMonth.getSelectionModel().getSelectedItem(); String year = cboSearchYear.getSelectionModel().getSelectedItem(); if (fullName.trim().isEmpty() &amp;&amp; insurance.trim().isEmpty()) { lblSearchMessage .setText("Please enter a name or insurance number to search."); kit.beep(); return; } // String dob = null; String date = day + "-" + month + "-" + year; if (!insurance.isEmpty()) { sectionToRun = 1; // query 1 parameters.put("insuranceId", insurance); } else if (!fullName.isEmpty() &amp;&amp; !age.isEmpty() &amp;&amp; CalendarUtil.parse(date) != null) { parameters.put("name", fullName); parameters.put("dob", dob); sectionToRun = 2; // query 2 } else if (!fullName.isEmpty() &amp;&amp; !age.isEmpty() &amp;&amp; CalendarUtil.parse(date) == null) { parameters.put("name", fullName); parameters.put("age", age); sectionToRun = 3; // query 3 } else if (!fullName.isEmpty() &amp;&amp; age.isEmpty() &amp;&amp; CalendarUtil.parse(date) != null) { parameters.put("name", fullName); parameters.put("dob", dob); sectionToRun = 4; // query 4 } else if (!fullName.isEmpty() &amp;&amp; age.isEmpty() &amp;&amp; CalendarUtil.parse(…
has title: How to update tableview using javafx concurrency
has comment: http://stackoverflow.com/comment/37310360

http://stackoverflow.com/comment/37374665
score: 0
has text: Ok I will add it, but my problem is I'm not sure how to compute it in a good way, I know how to get x and y and I'm able to use them but I'm not sure how to limit each button, because it's a triangle so I was thinking maybe I should loop to get the border or something but still not sure at all...
comment on: http://stackoverflow.com/q/24196946
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37473696
type: AnswerComment
has text: Sorry, I am new on stack overflow. Thanks again.:)
score: 0
comment on: http://stackoverflow.com/a/24257900
type: Comment

jpanel
tags question: http://stackoverflow.com/q/24213048
tags question: http://stackoverflow.com/q/24175473
tags question: http://stackoverflow.com/q/24220410
tags question: http://stackoverflow.com/q/24167527
tags question: http://stackoverflow.com/q/24168300
tags question: http://stackoverflow.com/q/24247194
tags question: http://stackoverflow.com/q/24129926
tags question: http://stackoverflow.com/q/24255492
tags question: http://stackoverflow.com/q/24211266
tags question: http://stackoverflow.com/q/24144880
tags question: http://stackoverflow.com/q/24241455
tags question: http://stackoverflow.com/q/24145876
tags question: http://stackoverflow.com/q/24227357
tags question: http://stackoverflow.com/q/24158642
tags question: http://stackoverflow.com/q/24203426
tags question: http://stackoverflow.com/q/24152120
tags question: http://stackoverflow.com/q/24213006
tags question: http://stackoverflow.com/q/24186733
tags question: http://stackoverflow.com/q/24206860
tag name: jpanel
type: Tag
tags question: http://stackoverflow.com/q/24207183
tags question: http://stackoverflow.com/q/24203277
tags question: http://stackoverflow.com/q/24220822
tags question: http://stackoverflow.com/q/24176008
tags question: http://stackoverflow.com/q/24134680
tags question: http://stackoverflow.com/q/24249489
tags question: http://stackoverflow.com/q/24129531
tags question: http://stackoverflow.com/q/24110920
tags question: http://stackoverflow.com/q/24180099

http://stackoverflow.com/q/24112424
has body: So I have created a very basic show-off type of bot, it runs off of the Skype API and requires Skype to be running in order for it to work properly. I have tested the bot by hosting it off of my own computer no problem, the issue is that I don't want to have my computer running 24/7. That's why I looked at OVH.com for hosting. I would like to get a small $3 VPS and host the bot off of that. I have tried on my other servers with them (Centos/Debian) to get Skype running but it seems to be quite the struggle. So in end I need something (OS/Program/Whatever) to get this bot hosted on an OVH vps using one of their provided operating systems.
tagged with: bots
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24112559
type: Question
tagged with: skype
type: UnansweredQuestion
has title: Hosting a Java Skype Bot
tagged with: hosting

http://stackoverflow.com/a/24211264
has body: First, I do not believe the exception you have pasted is the "real" error but is rather a symptom of another error. It is failing to activate the change, i.e. install your .ear file. That exception is not helpful. If I had to guess there is another error somewhere in the logs. Generally duped jars on the classpath will cause a NoClassDefFoundError or a ClassNotFoundException. Check for those. Second, if you are having classes conflict between your deployments and the default weblogic classpath, you can try adding this to your weblogic.xml to force it to use the libraries in your ear: &lt;wls:prefer-application-packages&gt; &lt;wls:package-name&gt;package.that.conflicts.*&lt;/wls:package-name&gt; &lt;/wls:prefer-application-packages&gt;
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24183325
score: 1
upvote count: 1

http://stackoverflow.com/q/24222991
has comment: http://stackoverflow.com/comment/37640839
has body: Normally, Java optimizes the virtual calls based on the number of implementations encountered on a given call side. This can be easily seen in the results of my benchmark, when you look at myCode, which is a trivial method returning a stored int. There's a trivial static abstract class Base { abstract int myCode(); } with a couple of identical implementation like static class A extends Base { @Override int myCode() { return n; } @Override public int hashCode() { return n; } private final int n = nextInt(); } With increasing number of implementations, the timing of the method call grows from 0.4 ns through 1.2 ns for two implementations to 11.6 ns and then grows slowly. When the JVM has seen multiple implementation, i.e., with preload=true the timings differ slightly (because of an instanceof test needed). So far it's all clear, however, the hashCode behaves rather differently. Especially, it's 8-10 times slower in three cases. Any idea why? UPDATE I was curious if the poor hashCode could be helped by dispatching manually, and it could a lot. A couple of branches did the job perfectly: if (o instanceof A) { result += ((A) o).hashCode(); } else if (o instanceof B) { result += ((B) o).hashCode(); } else if (o instanceof C) { result += ((C) o).hashCode(); } else if (o instanceof D) { result += ((D) o).hashCode(); } else { // Actually impossible, but let's play it safe. result += o.hashCode(); } Note that the compiler avoids such optimizations for more than two implementation as most method calls are much more expensive than a simple field load and the gain would be small compared to the code bloat. The original question "Why doesn't JIT optimize the hashCode like other methods" remains and hashCode2 proofs that it indeed could. UPDATE 2 It looks like bestsss is right, at least with this note calling hashCode() of any class extending Base is the same as calling Object.hashCode() and this is how it compiles in the bytecode, if you add an explicit hashCode in Base that wou…
has comment: http://stackoverflow.com/comment/37411048
linked to: http://stackoverflow.com/q/4885095
favorite count: 0
has comment: http://stackoverflow.com/comment/37410831
has answer: http://stackoverflow.com/a/24340078
type: Question
has answer: http://stackoverflow.com/a/24416940
has title: Why is hashCode slower than a similar method?
has comment: http://stackoverflow.com/comment/37406291
has answer: http://stackoverflow.com/a/25750313
tagged with: performance
has comment: http://stackoverflow.com/comment/37406186
answer count: 5
upvote count: 38
tagged with: hashcode
has comment: http://stackoverflow.com/comment/37405868
has comment: http://stackoverflow.com/comment/37411064
has answer: http://stackoverflow.com/a/24322244
has comment: http://stackoverflow.com/comment/37410985
has comment: http://stackoverflow.com/comment/37406245
has comment: http://stackoverflow.com/comment/37422954
has comment: http://stackoverflow.com/comment/37422447
score: 36
has comment: http://stackoverflow.com/comment/37423949
has answer: http://stackoverflow.com/a/24341846
type: UnansweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/37421269

http://stackoverflow.com/q/24153472
has body: I'm attempting the create a directory programmaticly to build out the Android Photo Capture app here. I tried creating a class to create the directory before define the path, but Eclipse is throwing the error Syntax error on token "mkdirs", Identifier expected after this token. Should I be running the mkdirs() code elsewhere in the file? public class PhotoCaptureExample extends Activity { public class Dir { File folder = new File(Environment.getExternalStorageDirectory().toString()+"/DrawIn"); folder.mkdirs(); } protected Button _button; Thank you!
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/24153524
has answer: http://stackoverflow.com/a/24153598
type: Question
has title: Syntax error on token "mkdirs", Identifier expected after this token
answer count: 2
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/comment/37243597
type: Comment
comment on: http://stackoverflow.com/a/24136935
type: AnswerComment
has text: @user3725086 RE your first comment: *exactly*, now think about the implications of adding that `-` character to the text field that you then read in later.
score: 0

http://stackoverflow.com/a/24118960
score: 0
has body: Here you go.. Full code sample. Assuming you put you file in C:\some_folder import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class FileReader { public static void main(String args[]) { File file = new File("C:\\some_folder\\flowers_petal.txt"); Scanner in; try { in = new Scanner(file); while (in.hasNext()) { String line = in.nextLine(); System.out.println(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } } }
accepted answer of: http://stackoverflow.com/q/24118719
type: Answer
answers question: http://stackoverflow.com/q/24118719
type: AcceptedAnswer

http://stackoverflow.com/comment/37232325
type: Comment
has text: Can you print the concatenated strings? Something else is likely at play here.
comment on: http://stackoverflow.com/a/24128294
type: AnswerComment
score: 0

http://stackoverflow.com/a/24225534
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24121921
answers question: http://stackoverflow.com/q/24121921
type: Answer
has body: I've updated the documentation in the source repository to clarify that the log4j-api jar must be added to the jconsole pluginpath. The manual page will show this correctly in the next release (rc2). Thanks for reporting this.

http://stackoverflow.com/q/24196239
has comment: http://stackoverflow.com/comment/37373523
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/57816986
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/3113885
has answer: http://stackoverflow.com/a/24196731
tagged with: java
tagged with: hibernate
tagged with: composite-primary-key
tagged with: jpa
tagged with: mysql
has comment: http://stackoverflow.com/comment/98327953
has comment: http://stackoverflow.com/comment/37355806
favorite count: 0
type: Question
has title: JPA 2.0 (Hibernate) generates incorrect join table PK for @OneToMany with @JoinTable
has body: I've using JPA 2.0 with Hibernate 4.3.5 and trying to use Hibernate to auto generate my tables. I've created the following entry in my Contact entity: /** * Address */ @Valid @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinTable(name = "contact_address", joinColumns = @JoinColumn(name = "contact_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "address_id", referencedColumnName = "id")) @OrderColumn private List&lt;Address&gt; addresses; Hibernate is properly creating the contact table, but the join table is created without the correct PK: CREATE TABLE `contact_address` ( `contact_id` bigint(20) NOT NULL, `address_id` bigint(20) NOT NULL, `addresses_order` int(11) NOT NULL, PRIMARY KEY (`contact_id`), UNIQUE KEY `UK_mvvtppjfu6d0lcjm83u5youn8` (`address_id`), CONSTRAINT `FK_4fntyt0q2l6vkfg7t38pg4i94` FOREIGN KEY (`contact_id`) REFERENCES `contact` (`id`), CONSTRAINT `FK_mvvtppjfu6d0lcjm83u5youn8` FOREIGN KEY (`address_id`) REFERENCES `address` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; The PK listed here is only the contact_id, which is incorrect. That will not allow me to have multiple addresses assigned. Rather, the PK should be a composite PK of contact_id, address_id. Is Hibernate at fault, or is there something wrong in my JPA annotation? This is a one-way association. As noted by a couple of people, technically speaking, I don't need a join table for a @OneToMany, but given that I need to use the Address entity in other entity objects, it is cleaner for me to use join tables for all the associations. I have managed to hack around a solution using the @ManyToMany association and specifying a unique constraint on the join columns, but I am trying to understand if there is something wrong with my JPA or if it is a Hibernate bug.
type: UnansweredQuestion

http://stackoverflow.com/comment/37358224
comment on: http://stackoverflow.com/a/24190057
has text: @DaoWen I've added some details. Let me know what you think.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24158640
has answer: http://stackoverflow.com/a/24159002
possible better answer: http://stackoverflow.com/a/24158913
has title: OutOfMemoryError on OpenShift
tagged with: java
has answer: http://stackoverflow.com/a/24158913
has body: I have a Tomcat Java application running on OpenShift (1 small gear) that consists of two main parts: A cron job that runs every minute, parses information from the web and saves it into a MongoDB database, and some servlets to access that data. After deploying the app, it runs fine, but sooner or later the server will stop and I cannot access the servlets anymore (the HTTP request takes very long, and if it finishes, it returns a Proxy Error). I can only force stop the app using the rhc command line and restart it. When I look at the jbossews.log file, I see multiple occurences of this error: Exception in thread "http-bio-127.5.35.129-8080-Acceptor-0" java.lang.OutOfMemoryError: unable to create new native thread Is there anything I can do to prevent this error without needing to upgrade to a larger gear with more memory?
type: AnsweredQuestion
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24159002
tagged with: tomcat
tagged with: openshift
has comment: http://stackoverflow.com/comment/37286484
type: Question
has comment: http://stackoverflow.com/comment/37283625

http://stackoverflow.com/comment/37384875
has text: I have discovered that I can fix each of my other sample codes (aka projects) by going into each one clicking "fix setup" when autofix gives me the option. But, I remain mystified.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24211457

sigar
tag name: sigar
type: Tag
tags question: http://stackoverflow.com/q/24204309
tags question: http://stackoverflow.com/q/24173399

http://stackoverflow.com/q/24121793
tagged with: methods
has comment: http://stackoverflow.com/comment/37221165
tagged with: jvm
type: Question
has comment: http://stackoverflow.com/comment/37221171
has comment: http://stackoverflow.com/comment/37220981
has comment: http://stackoverflow.com/comment/37220018
has comment: http://stackoverflow.com/comment/37215559
has title: JVM String methods implementation
tagged with: implementation
has comment: http://stackoverflow.com/comment/37214955
answer count: 1
downvote count: 0
tagged with: string
upvote count: 7
accepted answer: http://stackoverflow.com/a/24125284
has comment: http://stackoverflow.com/comment/37215846
favorite count: 0
has comment: http://stackoverflow.com/comment/37221213
has answer: http://stackoverflow.com/a/24125284
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37221063
has comment: http://stackoverflow.com/comment/37214940
score: 7
tagged with: java
has body: String class has some methods that i cannot understand why they were implemented like this... replace is one of them. public String replace(CharSequence target, CharSequence replacement) { return Pattern.compile(target.toString(), Pattern.LITERAL).matcher( this).replaceAll(Matcher.quoteReplacement(replacement.toString())); } Are there some significant advantages over a simpler and more efficient (fast!) method? public static String replace(String string, String searchFor, String replaceWith) { StringBuilder result=new StringBuilder(); int index=0; int beginIndex=0; while((index=string.indexOf(searchFor, index))!=-1){ result.append(string.substring(beginIndex, index)+replaceWith); index+=searchFor.length(); beginIndex=index; } result.append(string.substring(beginIndex, string.length())); return result.toString(); } Stats with Java 7: 1,000,000 iterations replace "b" with "x" in "a.b.c" result: "a.x.c" Times: string.replace: 485ms string.replaceAll: 490ms optimized replace = 180ms Code like the Java 7 split method is heavily optimized to avoid pattern compile / regex processing when possible: public String[] split(String regex, int limit) { /* fastpath if the regex is a (1)one-char String and this character is not one of the RegEx's meta characters ".$|()[{^?*+\\", or (2)two-char String and the first char is the backslash and the second is not the ascii digit or ascii letter. */ char ch = 0; if (((regex.value.length == 1 &amp;&amp; ".$|()[{^?*+\\".indexOf(ch = regex.charAt(0)) == -1) || (regex.length() == 2 &amp;&amp; regex.charAt(0) == '\\' &amp;&amp; (((ch = regex.charAt(1))-'0')|('9'-ch)) &lt; 0 &amp;&amp; ((ch-'a')|('z'-ch)) &lt; 0 &amp;&amp; ((ch-'A')|('Z'-ch)) &lt; 0)) &amp;&amp; (ch &lt; Character.MIN_HIGH_SURROGATE || ch &gt; Character.MAX_LOW_SURROGATE)) { int off = 0; int next = 0; boolean limited = limit &gt; 0; ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); while ((next = indexOf(ch, off)) != -1) { if (!limited || list.size() &lt; limit - 1) { lis…

http://stackoverflow.com/q/24245456
has body: I am trying to implement and run a Spark application on Amazon's Elastic MapReduce (EMR). So far I have been able to deploy and run a cluster with a "Spark Installation" bootstrap action using the following link: s3://elasticmapreduce/samples/spark/0.8.1/install-spark-shark.sh The script can be accessed from this internet direction. In order to upload the .jar application to the cluster, I have created a step configuration as follows: HadoopJarStepConfig customConfig = new HadoopJarStepConfig() .withJar("s3://mybucket/SparkApp.jar") .withMainClass("SparkApp.java"); StepConfig customJarStep = new StepConfig() .withName("Run custom jar") .withActionOnFailure(ActionOnFailure.CONTINUE) .withHadoopJarStep(customConfig); Finally, the following code shows the actual Spark application extracted from the wordcount example provided by the Spark team (For the 0.8.1 version). As you may notice, the code imports different spark libraries to be able to run the application. The libraries are: spark-core_2.9.3-0.8.1-incubating.jar (and) scala-library-2.9.3.jar import scala.Tuple2; import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.FlatMapFunction; import org.apache.spark.api.java.function.Function2; import org.apache.spark.api.java.function.PairFunction; import java.util.Arrays; import java.util.List; public class SparkApp { public static void main(String[] args) throws Exception { JavaSparkContext ctx = new JavaSparkContext("local", "JavaWordCount", System.getenv("SPARK_HOME"), System.getenv("SPARK_EXAMPLES_JAR")); JavaRDD&lt;String&gt; lines = ctx.textFile("c3://murquiabucket/wordcount.txt", 1); JavaRDD&lt;String&gt; words = lines.flatMap(new FlatMapFunction&lt;String, String&gt;() { public Iterable&lt;String&gt; call(String s) { return Arrays.asList(s.split(" ")); } }); JavaPairRDD&lt;String, Integer&gt; ones = words.map(new PairFunction&lt;String, St…
has comment: http://stackoverflow.com/comment/37530338
has title: Spark Java error NoClassDefFoundError on Amazon Elastic MapReduce
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25741530
tagged with: emr
tagged with: apache-spark
has comment: http://stackoverflow.com/comment/37596767
score: 1
has answer: http://stackoverflow.com/a/25741530
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40248044
upvote count: 1
tagged with: mapreduce
has comment: http://stackoverflow.com/comment/37530601
has comment: http://stackoverflow.com/comment/37555049
has comment: http://stackoverflow.com/comment/37490898
favorite count: 0
type: Question

http://stackoverflow.com/a/24156979
has body: The problem comes out to be the host. I did not specify the host in the java code that used to generate the cmd command. I needed to have -h 192.168.0.44 in cmd command, so the java code snippet should look like: File dbBackUpFile = new File("db.sql"); File mysqlDir = new File("\\\\192.168.0.44\\xampp\\mysql"); File mysqlBinDir = new File(mysqlDir, "bin"); File mysqlumpFile = new File(mysqlBinDir, "mysqldump.exe"); String dbUser = "myUserName"; String dbPass = "myPassword"; String dbName = "myDbName"; String dbIp = "192.168.0.44"; String executeCmd = ""; executeCmd = mysqlumpFile + " " + dbName + " -u " + dbUser + " -h " + dbIp + " --password=" + dbPass + " " + " -r \"" + dbBackUpFile.getAbsolutePath() + "\"";
score: 0
answers question: http://stackoverflow.com/q/24138607
accepted answer of: http://stackoverflow.com/q/24138607
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37245640
type: AnswerComment
has text: Ran this query: insert into Table values (8,'PRINCE GEORGE\\'S') and i got this error: [Error Code: -104, SQL State: 42601] ILLEGAL SYMBOL "S". SOME SYMBOLS THAT MIGHT BE LEGAL ARE:. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.13.127
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24122523

http://stackoverflow.com/q/24135687
score: 0
accepted answer: http://stackoverflow.com/a/24148438
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/24148438
answer count: 1
type: Question
tagged with: java
tagged with: nimbus
has title: how to create Nimbus L&F live template in Intellij IDEA
type: AnsweredQuestion
has body: i want to create a live template in Intellij IDEA to add Nimbus Look and Feel in my Code when use "nmbs+Tab" abbreviation. here is the code : try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(CURRENT.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(CURRENT.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(CURRENT.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(CURRENT.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } because this live template is based on current class name to work correctly, the problem is how can i get and replace current class name with the "CURRENT" word in the code? Thanks.

http://stackoverflow.com/comment/37283839
type: AnswerComment
comment on: http://stackoverflow.com/a/24133054
score: 0
type: Comment
has text: I added the code for the ArrayAdapter and I'll gladly up vote your answer if you can help.

http://stackoverflow.com/a/24152294
has body: I would suggest using Picasso instead. With Picasso, it's only one line of code to load an image into an ImageView from a URL. Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
has comment: http://stackoverflow.com/comment/37273024
upvote count: 1
has comment: http://stackoverflow.com/comment/37272641
answers question: http://stackoverflow.com/q/24152150
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/37294816
type: QuestionComment
has text: I don't know; that is the problem.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24163997

http://stackoverflow.com/comment/37235926
type: Comment
has text: may be you need to split you string into an array of tokens, by doing String arr[] = yourString.split(",") and then Vector<String> v = new Vector<String>(Arrays.asList(arr));
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24132557

http://stackoverflow.com/q/24155088
has title: LDAP attributes with JNDI.LDAP
favorite count: 0
has answer: http://stackoverflow.com/a/24155120
type: AnsweredQuestion
tagged with: ldap
tagged with: java
type: Question
score: 2
accepted answer: http://stackoverflow.com/a/24155120
upvote count: 2
answer count: 1
downvote count: 0
has body: I am using LDAP module for log in my webapps. I could check the login successfully with the below code. env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "LDAP://my-company.com:389/ou=people,ou=intranet,dc=company,dc=com"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "uid="+ user +",dc=company,dc=com"); env.put(Context.SECURITY_CREDENTIALS, pwd); try { // Create initial context DirContext ctx = new InitialDirContext(env); // Close the context when we're done b = true; ctx.close(); } But I m trying to get attributes from the connection like, Firstname, commonname,mail id etc

http://stackoverflow.com/q/24156047
downvote count: 0
possible better answer: http://stackoverflow.com/a/24156272
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24157195
has title: android binary xml exception when changing pictures
score: 1
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24156272
accepted answer: http://stackoverflow.com/a/24157195
has body: I'm developing an android app, it's about multilingual story. In this app I can switch from a language to another. Of course this application contains several images and texts. In the arabic language some photos need to be flipped, in the following code I'm flipping 4 images: if (i == 0) { rightImages[i].setImageResource(R.drawable.coverar); } if (i == 1) { rightImages[i].setImageResource(R.drawable.page1ar); } if (i == 4)// for the arabic flipped pages { rightImages[i].setImageResource(R.drawable.page6_flipped); leftImages[i].setImageResource(R.drawable.page7_flipped); } if (i == 8)// for the arabic flipped pages { rightImages[i].setImageResource(R.drawable.page14_flipped); leftImages[i].setImageResource(R.drawable.page15_flipped); } if (i != 4 &amp;&amp; i != 8) { linLay[i].removeAllViews(); linLay[i].addView(rightImages[i]); linLay[i].addView(leftImages[i]); } It's crashing and it's giving me the following error : android.view.InflateException : Binary XML file line #26: Error inflating class &lt;unknown&gt; The strange about it is that it won't crash when I change page6_flipped,page7_flipped,page14_flipped,page15_flipped to page6,page7,page14,page15. Please note that I'm using the tablet galaxy note 10.1 2014 edition, on the other hand it isn't crashing on other tablets ( Samsung P7500 Galaxy Tab 10.1 , toshiba at7-a, samsung galaxy tab 3 10.1). Any help please ?
favorite count: 0
tagged with: inflate-exception
type: Question
answer count: 2

http://stackoverflow.com/comment/37339616
type: Comment
has text: @MrEngineer13 Can you suggest any method to find the keycode for ^
type: QuestionComment
comment on: http://stackoverflow.com/q/24187593
score: 0

http://stackoverflow.com/comment/37426093
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24233659
score: 3
has text: [Your code works fine in both cases.](https://ideone.com/xM43Qy)

http://stackoverflow.com/a/24187596
has comment: http://stackoverflow.com/comment/37354181
has comment: http://stackoverflow.com/comment/37398384
has comment: http://stackoverflow.com/comment/37354565
has comment: http://stackoverflow.com/comment/37412008
has body: Since I don't have enough reputation I cannot post the picture of the output for the same program in C with controlled output, u can try yourself and see that it actually prints 32 times and then as explained due to overflow i=1073741824 + 1073741824 changes to -2147483648 and one more further addition is out of range of int and turns to Zero . #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main() { static int i = 1; while (true){ i = i + i; printf("\n%d",i); _getch(); } return 0; }
has comment: http://stackoverflow.com/comment/37356511
downvote count: 2
answers question: http://stackoverflow.com/q/24173463
has comment: http://stackoverflow.com/comment/37354016
has comment: http://stackoverflow.com/comment/37415631
has comment: http://stackoverflow.com/comment/37342728
type: Answer
score: 4
upvote count: 6
has comment: http://stackoverflow.com/comment/37354169

http://stackoverflow.com/comment/37338380
has text: Tomcat working good. I can run all applications on Java in Eclipse. When Tomcat start page does not show up in the browser. I reinstall Java, Eclipse and Tomcat.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24186529

http://stackoverflow.com/comment/37379968
has text: Also, [here](http://www.asciitable.com/) are ascii and extended ascii tables.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24209407
type: Comment

http://stackoverflow.com/comment/37266477
has text: thanks a lot but is there any method to pass "IST" insted of "Asia/Kolkata" means only code
comment on: http://stackoverflow.com/a/24149026
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/24252025
has comment: http://stackoverflow.com/comment/37462023
has body: You should use the defaul project layout: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html The pom.xml is placed in the projects root-folder.
answers question: http://stackoverflow.com/q/24251952
score: 0
type: Answer

http://stackoverflow.com/comment/37481948
has text: System.getProperty("user.dir") can show you your current working directory. If that path is someplace lower than your working dir then you might have to append some ../.. to the File constructor arg
comment on: http://stackoverflow.com/q/24262882
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37252715
comment on: http://stackoverflow.com/a/24141991
has text: No, it's not WebSphere. It is some handmade server.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24261564
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37509013
has body: You haven't configured the number of reducers to run. You can configure it using below API job.setNumReduceTasks(10); //change the number according to your cluster Also, you can set while executing from commandline -D mapred.reduce.tasks=10 Hope this helps.
answers question: http://stackoverflow.com/q/24261425

http://stackoverflow.com/q/24104928
tagged with: java
answer count: 1
tagged with: jtextfield
downvote count: 1
favorite count: 0
type: Question
has body: How to display a text in a JTextField ot jLabel with 2 colors. for example: 1 0 0 0 1 1 1 0 1 textField.setForeground(Color.RED ,BLUE); Positioning individual RED for example
accepted answer: http://stackoverflow.com/a/24104997
upvote count: 5
tagged with: swing
score: 4
has title: Different font color in a JTextField
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24104997

http://stackoverflow.com/q/24225015
linked to: http://stackoverflow.com/q/6343166
has answer: http://stackoverflow.com/a/24225313
has body: So i got the source code from here to test this out and i am not getting any output or response from the server like i'm supposed to. Does anyone know why this is happening? I have a feeling that in the second "try" something is not working and its going into the execption ex with nothing in it. Is this correct? Anyways please help me out in getting this to give me a response/output. public class HttpPostExample extends Activity { TextView content; EditText fname, email, login, pass; String Name, Email, Login, Pass; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_http_post_example); content = (TextView)findViewById( R.id.content ); fname = (EditText)findViewById(R.id.name); email = (EditText)findViewById(R.id.email); login = (EditText)findViewById(R.id.loginname); pass = (EditText)findViewById(R.id.password); Button saveme=(Button)findViewById(R.id.save); saveme.setOnClickListener(new Button.OnClickListener(){ public void onClick(View v) { try{ // CALL GetText method to make post method call GetText(); } catch(Exception ex) { content.setText(" url exeption! " ); } } }); } // Create GetText Metod public void GetText() throws UnsupportedEncodingException { // Get user defined values Name = fname.getText().toString(); Email = email.getText().toString(); Login = login.getText().toString(); Pass = pass.getText().toString(); // Create data variable for sent values to server String data = URLEncoder.encode("name", "UTF-8") + "=" + URLEncoder.encode(Name, "UTF-8"); data += "&amp;" + URLEncoder.encode("email", "UTF-8") + "=" + URLEncoder.encode(Email, "UTF-8"); data += "&amp;" + URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode(Login, "UTF-8"); data += "&amp;" + URLEncoder.encode("pass", "UTF-8") + "=" + URLEncoder.encode(Pass, "UTF-8"); String text = ""; BufferedReader reader=null; // Send data try { // Defined URL where to send data …
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37409711
linked to: http://stackoverflow.com/q/23454905
tagged with: post
type: Question
has comment: http://stackoverflow.com/comment/37409830
has title: Not getting an output like im supposed to
has comment: http://stackoverflow.com/comment/37409654
answer count: 1
tagged with: php
accepted answer: http://stackoverflow.com/a/24225313

http://stackoverflow.com/a/24148326
score: 1
has body: Yes; by default type information is considered to be metadata, and not data to expose to POJOs; similar to how Java type information is distinct from actual properties (albeit accessible via getClass()). But you can expose type discriminator if you want to by using @JsonTypeInfo(visible=true).
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24141489
has comment: http://stackoverflow.com/comment/37435046
type: Answer
has comment: http://stackoverflow.com/comment/37414573
has comment: http://stackoverflow.com/comment/37501858
answers question: http://stackoverflow.com/q/24141489

http://stackoverflow.com/a/24211825
has body: Your activity_main.xml must have a ListView with id @android:id/list Quoting docs ListActivity has a default layout that consists of a single, full-screen list in the center of the screen. However, if you desire, you can customize the screen layout by setting your own view layout with setContentView() in onCreate(). To do this, your own view MUST contain a ListView object with the id "@android:id/list" (or list if it's in code) But in your code where are you having setListAdapter?. You can as well extend Activity instead of ListAcitvity
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/63941321
answers question: http://stackoverflow.com/q/24211794
has comment: http://stackoverflow.com/comment/37385045
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37385078
has comment: http://stackoverflow.com/comment/63941539
has comment: http://stackoverflow.com/comment/37385006

http://stackoverflow.com/q/24258721
downvote count: 2
answer count: 1
upvote count: 1
tagged with: swing
favorite count: 0
tagged with: jbutton
type: Question
tagged with: object
tagged with: java
has title: how to call object dynamically in jButton action?
has body: i want to do something like this private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int i = 0; NewClass[] obj = new NewClass[i]; obj[i] = new NewClass(args..); i++; } every time the button clicks, it creates a new object.
score: -1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24258880
has answer: http://stackoverflow.com/a/24258880

http://stackoverflow.com/a/24176580
downvote count: 0
has body: The warnings look very much like you're trying to run Liberty Profile under Java8. Liberty profile does not (yet) support Java8, so as far as I know your only current supported option is to go back to Java7.
has comment: http://stackoverflow.com/comment/75928679
accepted answer of: http://stackoverflow.com/q/24176382
type: Answer
answers question: http://stackoverflow.com/q/24176382
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37332278
type: AcceptedAnswer

http://stackoverflow.com/comment/37230947
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24129926
has text: @redFIVE yeah, I'm gonna quit while I'm behind on this one
type: Comment

http://stackoverflow.com/comment/37301502
score: 0
type: Comment
type: QuestionComment
has text: @Patrick Thanks for response. Can you show me how to do this? In addition, why would it be different if I wanted to use it not just in `mainActivity`?
comment on: http://stackoverflow.com/q/24167848

http://stackoverflow.com/a/24169975
answers question: http://stackoverflow.com/q/24169816
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24169816
has comment: http://stackoverflow.com/comment/37308545
has comment: http://stackoverflow.com/comment/37318117
type: Answer
has body: You can try handler class - Handler handlerTimer = new Handler(); int count = 0; Runnable runnable = new Runnable(){ public void run() { if(count==0) findViewById(R.id.textView1).setVisibility(00000004); else if(count==1) findViewById(R.id.textView2).setVisibility(00000004); else if(count==2) findViewById(R.id.textView3).setVisibility(00000004); else if(count==3) findViewById(R.id.textView4).setVisibility(00000004); count++; if(count&lt;4) handler.postDealyed(runnable, 8000) }}; Or you can you use ScheduledThreadPoolExecutor ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); int count=0; scheduler.scheduleAtFixedRate (new Runnable() { public void run() { if(count==0) findViewById(R.id.textView1).setVisibility(00000004); else if(count==1) findViewById(R.id.textView2).setVisibility(00000004); else if(count==2) findViewById(R.id.textView3).setVisibility(00000004); else if(count==3) findViewById(R.id.textView4).setVisibility(00000004); count++; } }, 0, 8, TimeUnit.SECONDS); For more information
has comment: http://stackoverflow.com/comment/37306399
score: 0
has comment: http://stackoverflow.com/comment/37306298

http://stackoverflow.com/q/24150609
upvote count: 2
tagged with: pojo
accepted answer: http://stackoverflow.com/a/24151233
tagged with: jackson
has comment: http://stackoverflow.com/comment/37269550
has answer: http://stackoverflow.com/a/24151233
has comment: http://stackoverflow.com/comment/37269771
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
answer count: 1
favorite count: 0
has title: Can I use mapped Jackson Mixin properties to create a JSON subclass when deserializing?
has body: I have JSON output correctly annotated and mapped with mixins for the User class with appropriate setters and getters for those properties: public class User { String first; String middle; String last; ... } When I use my Mixin: public interface UserMixin { @JsonProperty("first") void setFirst(String first); @JsonProperty("middle") void setMiddle(String middle); @JsonProperty("last") void setLast(String last); } After registering the mixin and writing the User class using the ObjectMapper I get: "User" : { "first" : "William", "middle" : "S", "last" : "Preston" } So to this point, for brevity, I lied a little bit - User as cited above is a large, legacy DTO class that is resistant towards modification. And, while the mixin works great, our customer would rather see something like: "User" : { "Name" : { "first" : "William", "middle" : "S", "last" : "Preston" } ... } I repeat, the DTO is resistant to change. Ideally I'd refactor the DTO and do it correctly. What I think I'm asking - is there some combination of Mixin/Annotation I can use to sub-class "Name" from already existing data in the User class? There's no Name subclass ... but all of the pieces necessary to "write out" the JSON in this format exist.
type: Question

http://stackoverflow.com/a/24269150
type: Answer
answers question: http://stackoverflow.com/q/24266629
score: 0
has body: Provided you are running windows and have JNA, the following code will allow you to determine if the Console is ready to print. Usage: Call WinConsoleUtils.updatePos() each time after you print to the console or read from the console. Call WinConsoleUtils.isReadytoWrite() to determine if the console is ready to print or not. If it returns true, then you can print to the console without destroying the user's input. You will have to repeatedly poll to determine if the console is ready to write to yet. If you want to retrieve the current position of the cursor call WinConsoleUtils.getCursorPoition(). import com.sun.jna.Native; import com.sun.jna.Pointer; import java.awt.Point; public class WinConsoleUtils { private final static Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("Kernel32", Kernel32.class); private static final Pointer STDIN= INSTANCE.GetStdHandle(-11); private static Point LAST_POS= new Point(); public static Point getCursorPosition(){ Kernel32.CONSOLE_SCREEN_BUFFER_INFO info = new Kernel32.CONSOLE_SCREEN_BUFFER_INFO(); INSTANCE.GetConsoleScreenBufferInfo(STDIN,info); Point pos = new Point(info.dwCursorPosition.X,info.dwCursorPosition.Y); return pos; } public static void updatePos(){ LAST_POS = getCursorPosition(); } public static boolean isReadytoWrite(){ return LAST_POS.equals(getCursorPosition()); } } and import com.sun.jna.Library; import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; import java.util.List; public interface Kernel32 extends Library{ public boolean GetConsoleScreenBufferInfo(Pointer hConsoleOutput, CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); public Pointer GetStdHandle(int i); public static class CONSOLE_SCREEN_BUFFER_INFO extends Structure { public COORD dwSize, dwCursorPosition; public short wAttributes; public SMALL_RECT srWindow; public COORD dwMaximumWindowSize; @Override protected List getFieldOrder() { return Arrays.asList(new String[]{"dwSize","dwCursorPosition","wAttributes","srWindow"…

http://stackoverflow.com/q/24199636
upvote count: 1
tagged with: swing
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37361503
tagged with: actionlistener
has title: Cant add ChangeListener to JSpinner
accepted answer: http://stackoverflow.com/a/24199838
has comment: http://stackoverflow.com/comment/37361495
has comment: http://stackoverflow.com/comment/37361648
has answer: http://stackoverflow.com/a/24199838
has comment: http://stackoverflow.com/comment/37361458
has body: This may be a very simple question but I have an AbstractTable and in one of my columns I am trying to add a ChangeListener but it's giving me an error the error is: The method actionListener(ChangeListener) in the type JSpinner is not applicable for the arguments (new ChangeListener(){}) Here is my code where I am trying to add the JSpinner in the column: }else if (col == 4){ Date today = new Date(); //Creates new default date (Todays Date) final JSpinner Spinner = new JSpinner(new SpinnerDateModel(today, null, null, Calendar.MONTH)); // Creates Date Spinner Spinner.addChangeListener(new ChangeListener() { //Error Here @Override public void stateChanged(ChangeEvent e) { // handle click } }); value = Spinner;
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37361423
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/37361517
tagged with: jspinner
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37361573
answer count: 1
has comment: http://stackoverflow.com/comment/37361448
downvote count: 0

http://stackoverflow.com/comment/37311215
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24171171
score: 0
has text: Sorry, i don't know how to do. :(

http://stackoverflow.com/comment/37248963
has text: Ok, I did it. I added the code block so that everyone can see more of my code. I unfortunately cannot poste my whole code, since it is not allowed.
comment on: http://stackoverflow.com/q/24106428
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24217408
type: Question
has comment: http://stackoverflow.com/comment/37395434
type: UnansweredQuestion
has body: I wrote a java utility function to convert yyyy/mm/dd as follows public static long gettimestamp(String dateString) { SimpleDateFormat df = new SimpleDateFormat("yyyy/mm/dd"); Date date; try { date = df.parse(dateString); } catch (java.text.ParseException e) { return 0; } long epoch = date.getTime(); return (epoch / 1000); } On passing 2014/06/12 - it gives 1389465360 (=Jan 11, 2014) which is wrong. Am I passing format in wrong way ?
has answer: http://stackoverflow.com/a/39111158
linked to: http://stackoverflow.com/q/38922754
tagged with: datetime
answer count: 2
has title: Parse yyyy/mm/dd to epoch timestamp using SimpleDateFormat in java
has answer: http://stackoverflow.com/a/24217423
score: 1
tagged with: simpledateformat
tagged with: java
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/37428134
type: AnswerComment
comment on: http://stackoverflow.com/a/24234542
has text: With the change I suggested? Doing some reading and regarding `org.springframework.orm.hibernate4.annotation.AnnotationSessionFactoryBean`, it can't find that class because it was removed in Hibernate 4, so doesn't exist.
type: Comment
score: 0

http://stackoverflow.com/comment/37470624
has text: I see, that makes sense. Lowercase view is like an instance of View? I'll mark as accepted in ten mins.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24256777
type: AnswerComment

http://stackoverflow.com/comment/37313351
has text: Try casting your 2's to shorts. (short)2*arr...
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24173965

http://stackoverflow.com/comment/37265678
has text: My system has used Rabbitmq as message bus, in fact every component communicates through message bus. I am familiar with these message patterns, however, my system was integrated with many thridparty vendors's product, it's impossible to make request idempotent because vendor's product is out of my control.
type: AnswerComment
comment on: http://stackoverflow.com/a/24129537
type: Comment
score: 0

http://stackoverflow.com/q/24194128
type: Question
has comment: http://stackoverflow.com/comment/37350737
upvote count: 12
downvote count: 12
has answer: http://stackoverflow.com/a/24194198
possible better answer: http://stackoverflow.com/a/24194172
has comment: http://stackoverflow.com/comment/41059084
has comment: http://stackoverflow.com/comment/62314890
tagged with: swift
has comment: http://stackoverflow.com/comment/37350687
has comment: http://stackoverflow.com/comment/52595447
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37350762
tagged with: arrays
answer count: 3
has comment: http://stackoverflow.com/comment/37350834
has title: Swift vs Java - speed at filling big array
has body: I just did a small speed comparison between Java and Swift on filling a big array. I came up with following results: Swift import Foundation let start = CFAbsoluteTimeGetCurrent() var intArray = Int[]() for var i = 0; i <= 300000; ++i { intArray.append(0) } let timeTaken = CFAbsoluteTimeGetCurrent() - start println(timeTaken) Result: 1.66182696819305 Java long start = System.currentTimeMillis(); int[] intArray; int i = 0; intArray = new int[300000]; for (i = 0; i < 300000; i++) { intArray[i]=0; } System.out.println("Time: "+(System.currentTimeMillis()-start)+"ms"); Result: Time: 3ms This was kind of shocking me; is Swift 550x slower then Java.. or am I using some not-optimized code?
linked to: http://stackoverflow.com/q/351565
has comment: http://stackoverflow.com/comment/37350864
favorite count: 0
has comment: http://stackoverflow.com/comment/37350848
has answer: http://stackoverflow.com/a/24194172
has comment: http://stackoverflow.com/comment/37351042
has answer: http://stackoverflow.com/a/48343003
tagged with: performance
accepted answer: http://stackoverflow.com/a/24194198

http://stackoverflow.com/comment/37355051
comment on: http://stackoverflow.com/q/24196307
score: 0
has text: @JigarJoshi Do you care to explain further how that might help the OP?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24239642
upvote count: 3
tagged with: java
tagged with: swing
linked to: http://stackoverflow.com/q/6309407
downvote count: 1
tagged with: awt
accepted answer: http://stackoverflow.com/a/24239762
favorite count: 0
type: Question
has body: I have a parent window which will start another window.When the child window is started, I want it to display like a modal dialog. import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class ModalDialogTest { public void createUI(){ JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); JPanel mainPanel = new JPanel(); mainPanel.setBorder(BorderFactory.createEmptyBorder(200, 200, 200, 200)); JButton openButton = new JButton("Open a frame"); openButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub AnotherWindow anotherWindow = new AnotherWindow(); anotherWindow.createUI(); } }); mainPanel.add(openButton,BorderLayout.CENTER); frame.add(mainPanel,BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { ModalDialogTest modelDialogTest = new ModalDialogTest(); modelDialogTest.createUI(); } class AnotherWindow{ public void createUI(){ JFrame frame = new JFrame("Dialog"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); JPanel mainPanel = new JPanel(); mainPanel.setBorder(BorderFactory.createEmptyBorder(100, 100, 100, 100)); JLabel label = new JLabel("I want to be a modal dialog"); mainPanel.add(label,BorderLayout.CENTER); frame.add(mainPanel,BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } } } The demo above describes the process of my app and the architecture is just the same.So what is the solution?
has title: How to realise the effect of the modal dialog
has answer: http://stackoverflow.com/a/24239973
possible better answer: http://stackoverflow.com/a/24239809
has answer: http://stackoverflow.com/a/24239809
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24239762
answer count: 3

http://stackoverflow.com/comment/37370674
comment on: http://stackoverflow.com/q/24204472
score: 0
type: Comment
type: QuestionComment
has text: You can test if the source of the problem is with the ADT emulator, by using a whole different emulator and checking whether the problem still exists. For this, I'd recommend you to try Genymotion (I'm not affiliated with them...) as it generally performs better than the "stock" emulator.

http://stackoverflow.com/comment/37481582
score: 0
comment on: http://stackoverflow.com/q/24262630
type: QuestionComment
has text: It would help if you could post the exception message and stacktrace.
type: Comment

http://stackoverflow.com/a/24253171
type: Answer
has comment: http://stackoverflow.com/comment/37464887
has comment: http://stackoverflow.com/comment/37464204
has comment: http://stackoverflow.com/comment/37464859
has comment: http://stackoverflow.com/comment/37464484
has comment: http://stackoverflow.com/comment/37464584
score: 0
has comment: http://stackoverflow.com/comment/37465161
has comment: http://stackoverflow.com/comment/37464959
has comment: http://stackoverflow.com/comment/37464506
has comment: http://stackoverflow.com/comment/37464685
has comment: http://stackoverflow.com/comment/37486298
has comment: http://stackoverflow.com/comment/37470699
has comment: http://stackoverflow.com/comment/37465114
has comment: http://stackoverflow.com/comment/37464399
has comment: http://stackoverflow.com/comment/37465036
has comment: http://stackoverflow.com/comment/37464324
has comment: http://stackoverflow.com/comment/37464938
has comment: http://stackoverflow.com/comment/37464551
has body: It's already mentioned here Set Interface Bulk Operations in Oracle Java Tutorials and explained in detail along with examples. s1.retainAll(s2) — transforms s1 into the intersection of s1 and s2. (The intersection of two sets is the set containing only the elements common to both sets.) To calculate the union, intersection, or set difference of two sets nondestructively (without modifying either set), the caller must copy one set before calling the appropriate bulk operation. Set&lt;Type&gt; intersection = new HashSet&lt;Type&gt;(s1); intersection.retainAll(s2);
has comment: http://stackoverflow.com/comment/37465024
has comment: http://stackoverflow.com/comment/37464180
has comment: http://stackoverflow.com/comment/37464755
has comment: http://stackoverflow.com/comment/37464420
has comment: http://stackoverflow.com/comment/37464644
answers question: http://stackoverflow.com/q/24253132
has comment: http://stackoverflow.com/comment/37464827

http://stackoverflow.com/comment/37322665
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24179375
type: Comment
has text: It contains a package with .class files and a META-INF folder for the manifest file.

http://stackoverflow.com/comment/37255877
has text: How do you expect this plugin to use your classes even if it could access them?
comment on: http://stackoverflow.com/q/24143355
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24131361
has body: You cannot add annotations to anything at runtime. The best you can do here is create a class that has the annotations. You can then test your code with classes that have the annotations and classes that don't.
accepted answer of: http://stackoverflow.com/q/24131327
type: Answer
has comment: http://stackoverflow.com/comment/37233352
answers question: http://stackoverflow.com/q/24131327
has comment: http://stackoverflow.com/comment/37233340
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37233315
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37233297

http://stackoverflow.com/q/24193928
has comment: http://stackoverflow.com/comment/37356142
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24209211
has body: I'm using hibernate to call the Postgres array_agg function. The problem is that I need to call the function with an order by included. I cannot pass the order by through hibernate in the correct syntax so I need to create a function that does exactly what array_agg does with ordering being automatic. Here's what I need to duplicate in a function: array_agg(table.TEXT order by table.text asc) I've tried and tried but I cannot figure it out - and google isn't helping much. Thanks in advance!
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/24209211
type: Question
possible better answer: http://stackoverflow.com/a/24195569
tagged with: java
tagged with: hibernate
has title: How to override Postgres' array_agg(expression) function?
has answer: http://stackoverflow.com/a/24195569
has comment: http://stackoverflow.com/comment/37351661

http://stackoverflow.com/q/24189193
tagged with: arraylist
has title: Dynamically adding elements to ArrayList in Groovy
has answer: http://stackoverflow.com/a/24189321
score: 57
upvote count: 57
possible better answer: http://stackoverflow.com/a/24189497
tagged with: java
has answer: http://stackoverflow.com/a/24189497
accepted answer: http://stackoverflow.com/a/24189321
type: AnsweredQuestion
tagged with: list
answer count: 2
tagged with: groovy
has body: I am new to Groovy and, despite reading many articles and questions about this, I am still not clear of what is going on. From what I understood so far, when you create a new array in Groovy, the underlying type is a Java ArrayList. This means that it should be resizable, you should be able to initialize it as empty and then dynamically add elements through the add method, like so: MyType[] list = [] list.add(new MyType(...)) This compiles, however it fails at runtime: No signature of method: [LMyType;.add() is applicable for argument types: (MyType) values: [MyType@383bfa16] What is the proper way or the proper type to do this?
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/37422847
comment on: http://stackoverflow.com/q/24231873
type: QuestionComment
score: 0
type: Comment
has text: Alvin the Code is in the GitHub Link there are several different classes and pages that would be cumbersome to put into this setting, also I would love to write it to a database I know full well how to do that, I agree that the flat file seems a bit ridiculous, but for the purposes of my education (and I am sure that somewhere someday someone will want something to do so as I have had the request before) this is a school assignment that has gone awry. I have all of the code correct to my knowledge but I still can't get anything kicking, any ideas on how I would overwrite security features

http://stackoverflow.com/comment/37223769
comment on: http://stackoverflow.com/a/24125198
score: 0
type: Comment
type: AnswerComment
has text: Thanks to answer, but this is not the problem... I have tried this. The problem is, when my dialog shows, a new viewstate is created. When i work with this new dialog, jsf changes and update this viewstate but not the others (in case i have many dialogs, each dialog have your viewstate). So, when i close my dialog and click in the main page (with a non-updated viewstate) the stacktrace is shown. I found this link about this problem: http://www.irian.at/en/blog/-/blogs/jsf-ajax-and-multiple-forms

http://stackoverflow.com/comment/37470668
has text: Thanks, I'm sorry that the code is so hard to fix and I really appreciate you helping me try to.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24255545
score: 0

http://stackoverflow.com/comment/37451554
score: 0
comment on: http://stackoverflow.com/a/24246885
type: Comment
type: AnswerComment
has text: Yes Zoran - thanks a lot that is the solution. Fala ti mnogu :)

http://stackoverflow.com/a/24237692
answers question: http://stackoverflow.com/q/24237501
has body: Create one setSelected(int position) method in the your list adapter. and from your onlistitemclick call it passing the clicked position. edit your adapter code as following. int selectedPosition = -1; public void setSelected(int position) { selectedPosition= position; notifyDataSetChanged(); } public View getView(int position, View convertView, ViewGroup parent) { // your adapter code if(position==selectedPosition) description.setVisibility(View.VISIBLE); return convertView; }
has comment: http://stackoverflow.com/comment/37434777
has comment: http://stackoverflow.com/comment/37434742
type: Answer
has comment: http://stackoverflow.com/comment/37434131
score: 0

http://stackoverflow.com/q/24149773
score: 1
tagged with: macos
favorite count: 0
has title: Can't update Coldfusion to Java 1.7 on OSX 10.9
has comment: http://stackoverflow.com/comment/37350430
type: Question
linked to: http://stackoverflow.com/q/20366358
accepted answer: http://stackoverflow.com/a/24943951
has comment: http://stackoverflow.com/comment/37267951
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24943951
answer count: 1
has body: Running OSX 10.9.3 with ColdFusion 9.0.1. Was running on Java 1.6 and now trying to update to Java 1.7. I've updated CF with the proper hotfix for 1.7 compatibility. I installed the 64-bit 1.7 JDK as well. Now I have Java in two places: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk When I run java -version I get 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) but when I restart CF it comes up and reports Java Version 1.6.0_65 Java Vendor Apple Inc. Java Vendor URL http://www.apple.com/ Java Home /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home I changed the symlink in /System/Library/Frameworks/JavaVM.framework/Versions to CurrentJDK@ -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/ but a CF restart still reports Apple's 1.6. I also tried updating the jvm.config and setting java.home (which was previously blank) to /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre and a restart and still no luck. Where is CF looking for the JVM and how to make CF see 1.7?
has comment: http://stackoverflow.com/comment/37301500
tagged with: coldfusion
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/24942062

http://stackoverflow.com/q/24193651
accepted answer: http://stackoverflow.com/a/24247527
has comment: http://stackoverflow.com/comment/37350007
favorite count: 0
type: Question
has body: How can I enable and disable a link based on some value match in a JSP page. So I have a column called person having values in as A, T, L etc. and based on each value a link in JSP page needs to get disabled and enabled say- I wanted to disable a settings link on my JSP page if the value from Servlet response is A or enable if the value from servlet is T Servlet code- public void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws Exception { HttpSession session = req.getSession(true); String person= profile.getPerson(); // person = 'A' (assume) req.setAttribute("pers", person); // 'A' is sent to JSP this.getServletContext().getRequestDispatcher( "/myPage.jsp" ).forward( req, response ); } ProfileVO.java-- @Entity @Table(name = "profile") public class ProfileVO implements Serializable { private static final long serialVersionUID = 1L; @NotNull private String person; private String email; public String getPerson() { return person; } public void setPerson(String person) { this.person = person; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Profile") .append(", email='").append(email).append('\'') .append(", person='").append(person).append('\'') .append('}'); return sb.toString(); } HTML code-- Settings | Terms & Conditions In HTML code, I needed to enable/disable the link on settings based on the value I get from a servlet. How should I do that using JQuery?? or is there any other way I can check value in JSP or Jquery to disable or enable a settings link as soon as a person logs in?
has answer: http://stackoverflow.com/a/24247527
has comment: http://stackoverflow.com/comment/37349787
has comment: http://stackoverflow.com/comment/37349877
has answer: http://stackoverflow.com/a/24194617
has comment: http://stackoverflow.com/comment/37350292
tagged with: javascript
has comment: http://stackoverflow.com/comment/37351643
tagged with: servlets
score: -1
has comment: http://stackoverflow.com/comment/37350078
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37349913
answer count: 2
has title: Enable and disable a "link" using JQuery
possible better answer: http://stackoverflow.com/a/24194617
upvote count: 0
tagged with: java
tagged with: jsp
tagged with: jquery
linked to: http://stackoverflow.com/q/3788946
downvote count: 1

http://stackoverflow.com/q/24114880
tagged with: methods
downvote count: 1
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/37202293
type: Question
has body: I have created a String method that uses a loop to return all data elements of an object. The problem is, since it is a return statement, it will go through the loop once and then exit the method once the return statement has been executed. I have looked over StackOverflow and the internet and have not been able to assist myself into figuring out this problem. Code: public String display() { for (int i=0; i&lt;count; i++) //assume count has the value of 3 { return "Name: "+item[i].getName(); //this is the issue; only loops once, then exits method //also assume that an object item[] has been initialised with 3 positions } }
tagged with: return
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/24114904
upvote count: 0
has comment: http://stackoverflow.com/comment/37202206
accepted answer: http://stackoverflow.com/a/24126530
has title: Java: Displaying all elements from an array
has answer: http://stackoverflow.com/a/24126530
has comment: http://stackoverflow.com/comment/37202289
type: AnsweredQuestion
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24114982
has answer: http://stackoverflow.com/a/24114904
tagged with: loops

http://stackoverflow.com/comment/37184046
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24105208
has text: By default, objects are initialised to `null` unless you explicitly initialise them yourself. Have you actually initialised the `JRadioButton` objects before you try to use them?

http://stackoverflow.com/a/24149682
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24149519
score: 1
type: Answer
has body: If the test is to expect a particular exception will arise with certain data, then yes, it should pass if that particular exception is thrown. If the test is to expect a particular exception will arise with certain data, or there is no expectation of an exception, then yes, it should fail if any exception outside of expected is thrown. Do not handle the thrown exceptions yourself unless you have to (and if you have to, that's a test smell - revisit why you're handling exceptions). The best way to indicate to JUnit that you expect an exception is to use the expected field on the @Test annotation. For example, let's say you were testing a Roman numeral converter, and said that anything not in the normal Roman numerals was an illegal argument (namely, P). @Test(expected = IllegalArgumentException.class) public void method_takesIllegalArgument_throwsIllegalArgumentException() { convertRomanNumeralToNumber("PXL"); }

api
tags question: http://stackoverflow.com/q/24233375
tag name: api
tags question: http://stackoverflow.com/q/24232043
tags question: http://stackoverflow.com/q/24194892
tags question: http://stackoverflow.com/q/24147234
type: Tag
tags question: http://stackoverflow.com/q/24251024
tags question: http://stackoverflow.com/q/24225389

http://stackoverflow.com/a/24478301
type: Answer
answers question: http://stackoverflow.com/q/24142979
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: If you pass a Bindings created with ScriptEngine.createBindings, Nashorn will store the updated value in the Bindings. (I tested.) According to the OpenJDK wiki and this OpenJDK bug, this behavior difference between Rhino and Nashorn is expected. Nashorn is not intended to be 100% drop-in compatible with Rhino.
has comment: http://stackoverflow.com/comment/37906288
accepted answer of: http://stackoverflow.com/q/24142979

http://stackoverflow.com/a/24149010
has body: It definitely makes sense to have a field for the button, since the actionPerformed() method needs to access the button to meke it visible or hidden. But you get a NullPointerException, which means that the btnAdd field is not initialized. And indeed, instead of doing this.btnAdd = new JButton("Add"); or simply btnAdd = new JButton("Add"); which would initialize the btnAdd field, you're doing JButton btnAdd = new JButton("Add"); That declares and initializes a local variable, which happens to have the same name as the btnAdd field, leaving this field uninitialized. Side notes: you should learn using layout managers instead of hard-coding bounds of components, making your app ugly on machines with different settings from yours. And you should also try not mixing data access code, using JDBC, with UI code. Delegate the data access to another object.
type: Answer
answers question: http://stackoverflow.com/q/24148894
has comment: http://stackoverflow.com/comment/37266321
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24148894
has comment: http://stackoverflow.com/comment/37266403
has comment: http://stackoverflow.com/comment/37267651

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

http://stackoverflow.com/comment/37445560
score: 0
has text: Is RGB the original colour space? If original one is YCbCr (e. g. JPEG image), than job is already done - just pull raw Y plane.
comment on: http://stackoverflow.com/q/24241699
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37323825
has text: Greg-449 is right, when you create your UIJob by calling its constructor, nothing will be injected into it. He should post an answer.
comment on: http://stackoverflow.com/q/24162328
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25291838
answers question: http://stackoverflow.com/q/24105852
has comment: http://stackoverflow.com/comment/51322549
downvote count: 0
upvote count: 7
has body: I was also facing the same problem but found the solution, This problem occurs due to jar issue since IBM_JAVA is constant public static final boolean IBM_JAVA = JAVA_VENDOR_NAME.contains("IBM"); and this constant is define in class org.apache.hadoop.util.PlatformName but this package structure and class is define in two jars: hadoop-core hadoop-auth but the class present in hadoop-core does not have this constant. IBM_JAVA And your application trying to search in hadoop-core jar. So add hadoop-auth jar in your application.
score: 7
type: Answer
has comment: http://stackoverflow.com/comment/51322585

http://stackoverflow.com/q/24124149
has answer: http://stackoverflow.com/a/24146668
tagged with: jackson
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24355515
answer count: 2
has title: How to JSON-marshal JAXBElement-wrapped responses without the JAXBElement wrapper?
linked to: http://stackoverflow.com/q/24040084
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
tagged with: jaxbelement
has comment: http://stackoverflow.com/comment/37258034
has body: I have an http service that is using Spring (v4.0.5). Its http endpoints are configured using Spring Web MVC. The responses are JAXB2-anotated classes that are generated off of a schema. The responses are wrapped in JAXBElement as the generated JAXB classes do not sport @XmlRootElement annotations (and the schema cannot be modified to doctor this). I had to fight a bit with getting XML marshalling ti work; in any case, it is working. Now I am setting up JSON marshalling. What I am running into is getting JSON-documents that feature the JAXBElement "envelope". { "declaredType": "io.github.gv0tch0.sotaro.SayWhat", "globalScope": true, "name": "{urn:io:github:gv0tch0:sotaro}say", "nil": false, "scope": "javax.xml.bind.JAXBElement$GlobalScope", "typeSubstituted": false, "value": { "what": "what", "when": "2014-06-09T15:56:46Z" } } What I would like to get marshalled instead is just the value-object: { "what": "what", "when": "2014-06-09T15:56:46Z" } Here is my JSON marshalling config (part of the spring context configuration): <constructor-arg type="java.lang.String" value="yyyy-MM-dd'T'HH:mm:ss'Z'" /> <constructor-arg type="java.lang.String" value="UTC" /> I am hoping that this can be accomplished by configuring the ObjectMapper. I guess alternatively rolling out my own serializer may work. Thoughts? Suggestions?
favorite count: 0
possible better answer: http://stackoverflow.com/a/24355515
type: Question
score: 9
accepted answer: http://stackoverflow.com/a/24146668
has comment: http://stackoverflow.com/comment/37261438
upvote count: 9
has comment: http://stackoverflow.com/comment/37221935

http://stackoverflow.com/a/24178961
has body: It seems to be a known issue: https://hibernate.atlassian.net/browse/HHH-9106 There is no feedback as to "why" this is not fixed. I have tried rolling back the EventCache (which is the one throwing the exception) to the 4.1.2 version which contains far less checking. I have tried fiddling with the DefaultMergeEventListener to no avail. I have no time to dig deeper so I have had to remove all the cascading from my @ManyToOne relationships to prevent this issue from popping up.
accepted answer of: http://stackoverflow.com/q/24177680
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24177680
type: AcceptedAnswer

http://stackoverflow.com/q/24240871
upvote count: 3
type: UnansweredQuestion
tagged with: java
downvote count: 0
has title: Obtaining access tokens by Sign in with Twitter for GET search/tweets
favorite count: 0
type: Question
has body: I am new to development with Android and Twitter. As mentioned in the documentation, an individual is allowed to search 180 keywords in a 15-minute window, and a particular application is allowed to search 450 keywords within 15 minutes. After obtaining access tokens, we were able to search for 450 keywords within 15 minutes, but we weren't able to search for 180 keywords within 15 minutes. How would I obtain this using the Sign-In with Twitter? These are the references I've used so far: https://dev.twitter.com/docs/auth/obtaining-access-tokens https://dev.twitter.com/docs/auth/implementing-sign-twitter How would I achieve the same functionality?
score: 3
tagged with: android
tagged with: twitter
answer count: 0

http://stackoverflow.com/q/24138786
tagged with: java
answer count: 1
tagged with: spring-data
has answer: http://stackoverflow.com/a/24145024
favorite count: 0
accepted answer: http://stackoverflow.com/a/24145024
type: Question
upvote count: 5
score: 5
tagged with: spring-data-cassandra
tagged with: spring
has body: I am using Spring Data Cassandra 1.0.0. I have managed to persist and read back my entity. However, now I want to do a query that only returns 1 field of the entity. This is what I have tried: public Optional&lt;DateTime&gt; getTimeOfOldestIntervalTrafficDataMessage( MessageSource messageSource, IntegrationPeriod integrationPeriod, TrafficDataType trafficDataType ) { Select select = QueryBuilder.select( "message_time" ).from( "messages", "data_message" ); select.where( QueryBuilder.eq( "message_source_id", messageSource.getId().getId() ) ) .and( QueryBuilder.eq( "data_type", trafficDataType.name() ) ) .and( QueryBuilder.eq( "integration_period", integrationPeriod.name() ) ); List&lt;Date&gt; result = cassandraOperations.select( select, Date.class ); if (result.size() &gt; 0) { return Optional.of( new DateTime( FluentIterable.from( result ).toSortedSet( Ordering.natural() ).first() ) ); } else { return Optional.absent(); } } cassandraOperations is a CassandraTemplate instance. So I only select message_time from the data_message table. This is a timestamp column, so I pass in a Date.class to the select() method, but this gives the following exception: org.springframework.data.mapping.model.MappingException: No mapping metadata found for java.util.Date at org.springframework.data.cassandra.convert.MappingCassandraConverter.readRow(MappingCassandraConverter.java:111) at org.springframework.data.cassandra.convert.MappingCassandraConverter.read(MappingCassandraConverter.java:202) at org.springframework.data.cassandra.core.CassandraConverterRowCallback.doWith(CassandraConverterRowCallback.java:47) at org.springframework.data.cassandra.core.CassandraTemplate.select(CassandraTemplate.java:455) at org.springframework.data.cassandra.core.CassandraTemplate.select(CassandraTemplate.java:253) at com.mycomp.app.infrastructure.cassandra.CassandraMessageRepository.getTimeOfOldestIntervalTrafficDataMessage(CassandraMessageRepository.java:130) How should I query for just 1 field? PS: …
type: AnsweredQuestion
tagged with: cassandra
has title: How to query for only 1 field with Spring Data Cassandra?
downvote count: 0

http://stackoverflow.com/comment/37403551
comment on: http://stackoverflow.com/q/24221753
score: 0
type: Comment
type: QuestionComment
has text: Because a capture-of is different from a template type.

http://stackoverflow.com/comment/37481036
comment on: http://stackoverflow.com/q/24261277
type: Comment
has text: @trashgod I haven't changed any defaults.
type: QuestionComment
score: 0

http://stackoverflow.com/q/24225994
type: Question
has answer: http://stackoverflow.com/a/24228508
has body: First time posting with SOF. We are trying to migrate IBM RAD based web project to Eclipse STS. I am able to get rid of most of the errors after checking out the code but the bindings file is throwing the exception: Resource reference with name 'jdbc/xyz' not found Web.xml version is 2.5. Any pointers would be helpful. Thanks
type: UnansweredQuestion
tagged with: spring
tagged with: ibm-rad
score: 2
upvote count: 2
tagged with: websphere
downvote count: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37420531
tagged with: eclipse
has title: Eclipse workspace error
favorite count: 0

http://stackoverflow.com/comment/37261342
comment on: http://stackoverflow.com/a/24146460
type: Comment
score: 0
type: AnswerComment
has text: This is exactly what I was looking for. But I do agree that it would be wasteful to loop through twice. Do you have an example of a more "correct" way of accomplishing this?

http://stackoverflow.com/comment/120466478
type: Comment
score: 0
type: AnswerComment
has text: Your original answer is an easy workaround for me until I upgrade to Spring Boot 2.5.x so I can leverage the new Deduction-based Polymorphism from Jackson 2.12. Thank you.
comment on: http://stackoverflow.com/a/50013090

http://stackoverflow.com/q/24138783
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24139692
tagged with: java
type: Question
tagged with: apache-poi
has body: I am working on a java code where I have to compare two excel sheets regardless of the format ( xls or xlsx) and copy the rows that differ to a new excel sheet. Then I read about WorkbookFactory which would accept both format. Below is the code snippet I created : Please help!! import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.IndexedColors; class Compare extends CopyRow { //&lt;-------VARIABLES DECLARATION &amp; INITIALISATION-----&gt; Workbook outputWorkbook,workbook1,workbook2; Sheet excel1Sheet,excel2Sheet,newSheet; public void compare(String fileA,String fileB) { try { if(fileA.endsWith(".xls")outputWorkbook = new XSSFWorkbook(new FileInputStream("C:/Documents and Settings/eclipse/workspace/CompareExcelV2/output.xls")); else outputWorkbook = new XSSFWorkbook(new FileInputStream("C:/Documents and Settings/eclipse/workspace/CompareExcelV2/output.xlsx")) workbook1 = WorkbookFactory.create(new File(fileA)); workbook2 = WorkbookFactory.create(new File(fileB)); CellStyle excel1Red = new workbook1.createCellStyle(); **//ERROR HERE** CellStyle excel2Green = new workbook2.createCellStyle(); **//ERROR HERE** CellStyle newStyle = new outputWorkbook.createCellStyle();**//ERROR HERE** } catch {} } I am not able to create CellStyle. I get the following error: workbook1 cannot be resolved to a type workbook2 cannot be resolved to a type outputWorkbook cannot be resolved to a type
answer count: 1
has title: How to create CellStyle for workbook that is created using WorkbookFactory?
accepted answer: http://stackoverflow.com/a/24139692
tagged with: excel

http://stackoverflow.com/comment/37235317
type: QuestionComment
comment on: http://stackoverflow.com/q/24132413
type: Comment
score: 0
has text: @MadProgrammer Did you try closing the child window?

http://stackoverflow.com/q/24166056
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38062465
has body: I have problem with my tomcat application, after changing the server and installing the last version of tomcat7 my application won't read/load jpg files.. I installed imageio and jai on the server, try to change java version but every time I have the same error.. Anybody have an idea? Error: One factory fails for the operation "jpeg" Occurs in: javax.media.jai.ThreadSafeOperationRegistry java.lang.reflect.InvocationTargetException 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 javax.media.jai.FactoryCache.invoke(FactoryCache.java:122) at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674) at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473) at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332) at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102) 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 javax.media.jai.FactoryCache.invoke(FactoryCache.java:122) at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674) at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473) at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332) at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819) at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867) at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179) The whole error log can be found here -> http://paste.ubuntu.com/7653452/. Update: The problem is related to grails…
has comment: http://stackoverflow.com/comment/37597685
tagged with: grails
has comment: http://stackoverflow.com/comment/37298579
has comment: http://stackoverflow.com/comment/37519127
tagged with: grails-plugin
score: 3
tagged with: jai
has comment: http://stackoverflow.com/comment/37597923
has answer: http://stackoverflow.com/a/38330638
has title: Java JPG codec won't work
tagged with: java
has comment: http://stackoverflow.com/comment/37451379
has comment: http://stackoverflow.com/comment/37297846
answer count: 1
has comment: http://stackoverflow.com/comment/37478297
linked to: http://stackoverflow.com/q/1906673
has comment: http://stackoverflow.com/comment/37581574
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37597631
upvote count: 3
has comment: http://stackoverflow.com/comment/37451487
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/q/24231460
accepted answer: http://stackoverflow.com/a/24231723
type: Question
has comment: http://stackoverflow.com/comment/37421883
has comment: http://stackoverflow.com/comment/37421755
has title: Creating a simple link to the Play store from Eclipse
has comment: http://stackoverflow.com/comment/37421899
has comment: http://stackoverflow.com/comment/37421792
has comment: http://stackoverflow.com/comment/37421657
has comment: http://stackoverflow.com/comment/37421975
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37421956
score: 0
has comment: http://stackoverflow.com/comment/37422004
tagged with: java
answer count: 1
has body: I have been trying to link to the play store, with no luck, each time I use this code; market://search?q=pub:"+devName and http://play.google.com/store/search?q=pub:"+devName It is taking the // and commenting out the rest of the code! How do I get Eclipse to ignore the // as all it is doing is keeping the market: And the rest of the code is commented out because it thinks the // is trying to ignore the text. If I use this; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=com.example.android")); startActivity(intent); It puts an error on startActivity saying it is undefined for the type 'myApp.java'
has comment: http://stackoverflow.com/comment/37422026
tagged with: eclipse
has answer: http://stackoverflow.com/a/24231723

http://stackoverflow.com/comment/37225206
type: Comment
type: QuestionComment
has text: `public int getRandListSize() { return randListSize; } public void setRandListSize(int randListSize) { this.randListSize = randListSize; } ` I used the automatic way of eclipse to do it ^^ I think I'll have the same problem with my seed, because it will be loaded from a "password.txt" file (turned into bytes)
score: 0
comment on: http://stackoverflow.com/q/24127099

http://stackoverflow.com/q/24201226
has answer: http://stackoverflow.com/a/24267446
type: Question
has title: Mallet java: get probability distribution of a documents collection
tagged with: mallet
answer count: 1
has body: I would like to get a single probability distribution for a collection of documents, as I need to be able to use the KL-Divergence, is this possible? In this example: http://mallet.cs.umass.edu/topics-devel.php with the method getTopicProbabilities() I get the probability distribution of each instance, but if I wanted to get a single distribution for a collection of documents? Could this be the topic distribution of the documents? TopicInferencer inferencer = model.getInferencer(); double[] testProbabilities = inferencer.getSampledDistribution(testing.get(0), 10, 1, 5);
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24267446
tagged with: topic-modeling

http://stackoverflow.com/comment/37274693
type: AnswerComment
comment on: http://stackoverflow.com/a/24142434
score: 1
type: Comment
has text: Good one! I thought I had to resort to Map<String, Metadata> metadata, and make an XmlAdapter for that. Thanks a bunch!

http://stackoverflow.com/comment/37302354
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24168116
has text: If you type composition vs. inheritance into google you'll find a lot of existing articles written about this. The chance that whoever answers this question will write a better explanation than all the ones already out there is very low

http://stackoverflow.com/comment/37395199
comment on: http://stackoverflow.com/a/24216875
has text: 'Owner owner = new Owner(ownername,ownerid);' - dont forget the semi colon :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24231196
has body: Try this: DBCursor cursor = collection.find(new BasicDBObject("prices.type", "carpet"), new BasicDBObject("prices", 1)); try { while (cursor.hasNext()){ DBObject doc = cursor.next(); ArrayList&lt;BasicDBObject&gt; prices= (ArrayList&lt;BasicDBObject&gt;) doc.get("prices"); double minPrice = -1; for(BasicDBObject dbObject: prices){ if (!dbObject.get("type").equals("carpet")) continue; double price= (Double) dbObject.get("price"); if (minPrice == -1) { minPrice = price; continue; } if (price&lt; minPrice ) minPrice = price; } for (BasicDBObject dbObject: prices){ if (dbObject.get("type").equals("carpet") &amp;&amp; (((Double) dbObject.get("price")) == minPrice)){ collection.update(new BasicDBObject("_id", doc.get("_id")), new BasicDBObject("$pullAll", new BasicDBObject("prices", Arrays.asList(dbObject)))); System.out.println(dbObject); } } } } finally { cursor.close(); } My solution can be not very well )) but I wanted show you an alternate variant
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24222545

http://stackoverflow.com/comment/37297056
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24165598
score: 0
has text: This is an exam, thank you all for the effort to explain!

http://stackoverflow.com/comment/37393633
comment on: http://stackoverflow.com/a/24216172
type: AnswerComment
score: 0
type: Comment
has text: @AndonM.Coleman: I experimented with direct vs. non-direct buffers on Android recently, since I couldn't find clear documentation on when direct buffers are needed. My theory, which was confirmed by these experiments, is that direct buffers are only required in cases where the memory has to live beyond the API call. The only case I could find for that is using `glVertexAttribPointer()` with client side vertex arrays. For everything else, non-direct buffers seem fine. Very possible that other Java platforms would behave differently than Android, though.

http://stackoverflow.com/q/24202447
tagged with: regex
accepted answer: http://stackoverflow.com/a/24202562
has answer: http://stackoverflow.com/a/24202509
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37366734
answer count: 2
has answer: http://stackoverflow.com/a/24202562
score: 1
downvote count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/24202509
favorite count: 0
has comment: http://stackoverflow.com/comment/37366516
has body: Is it possible to create java regex that could define if one word (base) contains all letters from another word (sample frow which regex is created) exactly? For example Input: base = 'Subexpressions', sample1 = 'Nubs' Output: True Input: base = 'Subexpressions', sample2 = 'Expert' Output: False Explanation: base contains all letters from sample1 but doesn't contain 't' from sample2.
type: Question
has title: Java - Regex to get if word contains all letters of another one
has comment: http://stackoverflow.com/comment/37366785
tagged with: java

http://stackoverflow.com/q/24147599
has comment: http://stackoverflow.com/comment/37263376
upvote count: 1
score: -4
has answer: http://stackoverflow.com/a/24147699
has answer: http://stackoverflow.com/a/24147680
favorite count: 0
has comment: http://stackoverflow.com/comment/37263357
has comment: http://stackoverflow.com/comment/37263365
type: Question
has answer: http://stackoverflow.com/a/24147665
has body: want to add the elements of two arrays. Just like, suppose string1=123 and string2=456 the result will be, result= string1+string2=579; how could i do this in java. please help. I have tried but failed. My code is: import java.util.Scanner; class sAdd{ double result=0; String line1,line2; void input(){ System.out.println("Enter The String"); Scanner sc=new Scanner(System.in); line1 = sc.nextLine(); System.out.println("Enter The String2"); line2 = sc.nextLine(); } void calc(){ char[] ch=line1.toCharArray(); char[] ch1=line2.toCharArray(); int d=line1.length(); System.out.println(d); for(int i=0;i&lt;d;i++){ double myd1= (char)(ch[i] - '0'); System.out.println(myd1); double myd2= (char)(ch1[i] - '0'); System.out.println(myd2); result = result+(myd1+myd2); System.out.println(result); } } } public class StrngCalc extends sAdd { /** * @param args the command line arguments */ public static void main(String[] args) { sAdd f = new sAdd(); f.input(); f.calc(); } }
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37264322
tagged with: java
has title: want to add two string elemants, how could i do that?
has comment: http://stackoverflow.com/comment/37263335
answer count: 3

http://stackoverflow.com/q/24261242
tagged with: javascript
has body: In my browser, i opened number of tabs, in one tab i opened my website (like www.aaa.com), in my website has one hyperlink to open another website (like www.xyz.com). Now i am ready to LOGOUT my website, in this time my requirement is whenever i signedout my website, the www.xyz.com tab also closed, How to do it, i search a lot in google but i didn't get any relative answer. I am using java technologies. Please any one help me . Thanks &amp; Regards Chakri
tagged with: jquery
has comment: http://stackoverflow.com/comment/37478587
favorite count: 0
type: Question
has title: How to close the tab it contains some url ("www.xyz.com") in java
has answer: http://stackoverflow.com/a/24261268
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/html
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37478641
answer count: 1
downvote count: 0
tagged with: jsp

http://stackoverflow.com/comment/37443733
comment on: http://stackoverflow.com/q/24242715
score: 0
type: Comment
has text: What is the connection string you are using?
type: QuestionComment

http://stackoverflow.com/comment/37464975
type: Comment
has text: Your program may have something keeping the file open. First thing I recommend is to remove the 8 layers of TRY and make it a simple try{...}catch(Exception ex){ex.printStacktrace();} This will handle all of those. You are just going to give yourself a headache later.
comment on: http://stackoverflow.com/a/24253574
type: AnswerComment
score: 0

http://stackoverflow.com/a/24239363
has comment: http://stackoverflow.com/comment/37437097
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24239305
downvote count: 0
has comment: http://stackoverflow.com/comment/37437060
has comment: http://stackoverflow.com/comment/37437218
score: 8
accepted answer of: http://stackoverflow.com/q/24239305
has comment: http://stackoverflow.com/comment/37437105
upvote count: 8
has comment: http://stackoverflow.com/comment/37437023
type: Answer
has comment: http://stackoverflow.com/comment/37437075
has body: Collections.frequency is useful here: public static &lt;T&gt; boolean hasDuplicates(List&lt;T&gt; list, T element) { return Collections.frequency(list, element) &gt; 1; } This is linear in time, so it might be slow on large lists. However, if you need to use a List, you cannot perform much better, at most you can take advantage of early exit to reduce average running time: public static &lt;T&gt; boolean hasDuplicates(List&lt;T&gt; list, T element) { int count = 0; for (T other: list) { // Ugly, but necessary to ensure null-safety boolean areEquals = (other == null)? element == null : other.equals(element); if (areEquals) { count += 1; if (count &gt; 1) { return true; } } } return false; }

http://stackoverflow.com/comment/37368600
type: Comment
score: 0
type: AnswerComment
has text: And are you setting any explicit `Accept` header? Also I would say it is pretty uncommon to not return any value from handler method... (`void` is interpretted as `null`). There might be problem with finding correct HandlerMethodReturnValueHandler => hence error about unsupported response content type...
comment on: http://stackoverflow.com/a/24201631

http://stackoverflow.com/comment/37486617
type: Comment
type: AnswerComment
has text: I think I read the answer of the other question wrong. Do you know if System.getProperty("os.arch") works fine for all systems besides windows?
comment on: http://stackoverflow.com/a/24265247
score: 0

http://stackoverflow.com/a/24212371
answers question: http://stackoverflow.com/q/24209345
score: 0
accepted answer of: http://stackoverflow.com/q/24209345
has body: It is not possible to "assign a query-string to a prepared statement". A prepared statement is created with a query-string as is shown in your code: each call to connection.prepareStatement(sqlstatement) creates a new prepared statement. This is also why the error "too many open cursors" occurs: the previously created pstmt is never closed. To re-use the prepared statements, instantiate the Process class and give it an init method (and corresponding close method) that is called once to setup the prepared statements that might be used (and are closed when work is done): PreparedStatement insertTable1; PreparedStatement insertTable2; void init(Connection c) { insertTable1 = c.prepareStatement(INSERT_TABLE1_QUERY); insertTable2 = c.prepareStatement(INSERT_TABLE2_QUERY); } void close() { insertTable1.close(); insertTable2.close(); } void condition1(Connection c, arg1, arg2) { insertTable1.setString(1, value1); insertTable1.setInt(2, value2); insertTable1.executeUpdate(); c.commit(); } void condition2(Connection c, arg1, arg2) { insertTable2.setString(1, value1); insertTable2.setInt(2, value2); insertTable2.executeUpdate(); c.commit(); }
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/q/24261680
upvote count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24278012
linked to: http://stackoverflow.com/q/8843638
tagged with: swing
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10298360
answer count: 1
has title: Java JTable groupings
tagged with: awt
score: 2
tagged with: java
tagged with: user-interface
has comment: http://stackoverflow.com/comment/37479468
has comment: http://stackoverflow.com/comment/37479696
favorite count: 0
has body: I'd like to get some ordering into my JTable. Currently I have one large JTable containing all items. But since I'm dealing with (sub)selections I'd like to make some grouping. Expressing this in textual form: +---------------------------------------------------------------+ | Heading1 Heading2 Heading3 Heading4 | +---------------------------------------------------------------+ |+-------------------------------------------------------------+| || Subheading with a button to collapse/expand || |+-------------------------------------------------------------+| | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | |+-------------------------------------------------------------+| || Subheading with a button to collapse/expand || |+-------------------------------------------------------------+| | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | |+-------------------------------------------------------------+| || Subheading with a button to collapse/expand || |+-------------------------------------------------------------+| | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | | Itemx Itemx Itemx Itemx | +---------------------------------------------------------------+ Expressing this in HTML5: jsfiddle Experimental SSCCE: import java.awt.BorderLayout; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; public class Main extends JPanel { public class TestGroup extends JPanel { public TestGroup() { super(new GridBagLayout()); int i; for (i = 0; i &lt; 50; i++…
has comment: http://stackoverflow.com/comment/37479365
type: Question

http://stackoverflow.com/a/24133301
has body: int temp=data[data.length-1]; for(int i=data.length-1;i&gt;=1;i--) { data[i+1] = data[i]; } data[0]=temp;
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24131465
type: Answer

http://stackoverflow.com/q/24210905
has title: Hangman method with Swing
type: Question
has comment: http://stackoverflow.com/comment/37383127
has comment: http://stackoverflow.com/comment/37383266
tagged with: java
has comment: http://stackoverflow.com/comment/37383261
type: UnansweredQuestion
has body: I have all of the necessary instance variables and all of the other classes in place, but I need help figuring out a way to set the user's progress in solving the word's TextField to initially show as many underscores as the letters in the secretWord. I was thinking something like, //One for each letter theWordField.setText("" + theWordField.getText().replace( theWordField.substring((secretWord.indexOf("A")), secretWord.indexOf("A")), _)); But you cant use substring in the TextField and I dont know how else to do it
tagged with: methods
has answer: http://stackoverflow.com/a/24211102
tagged with: textfield
score: 0
answer count: 3
upvote count: 1
tagged with: swing
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24211090
has answer: http://stackoverflow.com/a/24211036

http://stackoverflow.com/a/24235535
type: Answer
has comment: http://stackoverflow.com/comment/37431129
score: 4
has body: Readers and Writers are for reading character streams (i.e., text). Pictures and videos are binary data, not text, and will probably be corrupted if you pass them through character streams. This is because, depending on the character set, there is not necessarily a reversible mapping between bytes and characters. Some byte sequences are gibberish if interpreted as characters, then gibberish gets written back to the file. Use the InputStream and OutputStream that you open directly, instead of wrapping them up as a Reader and Writer, and it will work correctly. These are byte streams and can handle any type of data. E.g., InputStream input = new FileInputStream(file); OutputStream out = new FileOutputStream(copy); P.S. This will still be quite slow. You can wrap the streams in a BufferedInputStream and BufferedOutputStream for a simple way to improve performance, although the one-line copy APIs will probably still be faster.
answers question: http://stackoverflow.com/q/24235493
has comment: http://stackoverflow.com/comment/37430934
downvote count: 1
upvote count: 5

http://stackoverflow.com/q/24260759
type: Question
has answer: http://stackoverflow.com/a/24260892
has comment: http://stackoverflow.com/comment/37478053
upvote count: 0
has comment: http://stackoverflow.com/comment/37478124
type: UnansweredQuestion
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/24260831
answer count: 6
has answer: http://stackoverflow.com/a/24260852
has answer: http://stackoverflow.com/a/24260846
has comment: http://stackoverflow.com/comment/37477890
has answer: http://stackoverflow.com/a/24261308
has comment: http://stackoverflow.com/comment/37477912
has title: Getting array of Field Names of a class
tagged with: java
has answer: http://stackoverflow.com/a/24261066
has body: I want to get array of field names in the User class. e.g. name,age. I tried following code - import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; public class Test { public static void main(String[] args) { Field[] fields = User.class.getDeclaredFields(); ArrayList&lt;Field&gt; utilList = new ArrayList&lt;Field&gt;(Arrays.asList(fields)); System.out.println(utilList); } } class User{ String name; int age; } But it is printing [java.lang.String prac1.User.name, int prac1.User.age]. I need to print [name,age] with square bracket Without looping through it. Square brackets can be attached after and before, but that is not the way I need it.It should come on its own. Is it possible somehow using overriding toString methods?
has comment: http://stackoverflow.com/comment/37477987
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/24107194
has body: It seems that you misunderstood example from http://www.regular-expressions.info/atomic.html You need to understand that purpose of atomic group is to prevent backtracking so it is impossible to change already matched substring with new substring. But match will not be found for first case of alternation then it is OK to test next case of alternation. So for string abd and regex a(?&gt;bc|b)c regex parts | matched String parts ---------------+---------------------- a | a (?&gt;bc|b) | b - it happens because `bc` can't be matched so next case | from alternation inside atomic group is used d | d In case of regex from linked article a(?&gt;bc|b)c and String abc you will get regex parts | matched String parts ---------------+---------------------- a | a (?&gt;bc|b) | bc &lt;--------+ c | nothing - c was already matched and "possessed" by atomic | group so `c` can't be used here and because c a(?&gt;bc|b)c ^ couldn't be matched you will see false as result of "abc".matches("a(?&gt;bc|b)c")
answers question: http://stackoverflow.com/q/24107034
accepted answer of: http://stackoverflow.com/q/24107034
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37434979
comment on: http://stackoverflow.com/a/24236340
score: 0
has text: See my update. What part is exactly unclear, or is it causing more exceptions.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24234050
has answer: http://stackoverflow.com/a/24769972
tagged with: applet
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37698748
accepted answer: http://stackoverflow.com/a/24769972
tagged with: java
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/37699509
has body: I'm running a Java Applet on a Python-CGI server and it's giving a java.lang.ClassNotFoundException from my JNLP file in both Google Chrome and Internet Explorer. On loading the HTML files (for Google Chrome and IE), however, I get a 200 request from my .class file and I've referenced the .class file in my HTML files and my JNLP file the same way and their in the same directory (classes.Template). I did some research, but couldn't find anything that helped me. Files: localhost:8070/Java%20Applets/Template: /classes, /Applet.jar, /Display.html, /IE.html, /info.jnlp, /manifest.txt localhost:8070/Java%20Applets/Template/classes: /Template.class, /Template.java http://devdoodle.net/dev/152/ Error message: http://devdoodle.net/dev/153/
has title: java.lang.ClassNotFoundException even though class can be accessed in other places

http://stackoverflow.com/comment/37464422
comment on: http://stackoverflow.com/q/24253296
score: 0
has text: What happens to the log print? Is it print there?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24171999
has comment: http://stackoverflow.com/comment/37309422
favorite count: 0
type: Question
answer count: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/24172434
accepted answer: http://stackoverflow.com/a/24172037
downvote count: 0
has answer: http://stackoverflow.com/a/24172434
has answer: http://stackoverflow.com/a/24172037
has title: Java abstracting the use of instanceof for collecting classes from List
has comment: http://stackoverflow.com/comment/37309552
type: AnsweredQuestion
score: 2
tagged with: java
has body: Suppose I have the following hierarchy of classes: public class MainClass { } class A extends MainClass { } class B extends MainClass { } class C extends MainClass { } Now suppose I have a List&lt;MainClass&gt; classes which looks like: {A, MainClass, A, B, B, MainClass, C, A, C, B, A} I want to be able to pick out sublists of objects by their class. For example, I would like to be able to extract only those classes in this list of class A (but not class MainClass). As such, using isAssignableFrom(A.class) will not work for me. My current method looks like: public &lt;T extends MainClass&gt; List&lt;T&gt; getClasses(List&lt;MainClass&gt; classes, Class classToCollect) { List&lt;T&gt; subclasses = new ArrayList&lt;T&gt;(); for (MainClass clazz : classes) { if (clazz.getClass().isInstance(classToCollect)) { subclasses.add((T)clazz); } } return subclasses; } This still doesn't work and passes back an empty list. What gives here?
has comment: http://stackoverflow.com/comment/37309806

http://stackoverflow.com/comment/37243376
type: Comment
has text: It is quite interesting! Though it does not solve directly the question as this code does not read TIFF. Using WritableImage seems great, if I remember, it uses hardware acceleration.
type: AnswerComment
comment on: http://stackoverflow.com/a/24135889
score: 0

http://stackoverflow.com/a/24171781
type: Answer
has comment: http://stackoverflow.com/comment/37343776
upvote count: 2
score: 1
type: AcceptedAnswer
downvote count: 1
has body: I think this is a very good usecase where thinking about unit tests forces you to design your app better. I think you can break down your logic of processing the files into smaller units(functions or different classes if possible). Then you should try to write "unit-tests" for each of those units. On the side note, for checking if the exception was thrown in your unit tests - your method should be throwing the exceptions and all clients of that method (your other code that uses that method, your unit tests) should expect that exception to be thrown and either catch it or re-throw it as you deem fit. In case of unit tests - you can catch that exception and put some validation assertion there. You can have an invalid assertion just after making the call to this method and if the exception is not thrown, then your unit test will move to next line and it will fail there. See below: your unitTest() { try { // make a call to the method you want to test yourMethod.call(inputToAllowException); Assert.assertEquals(1 , 0); // you should not reach here if the exception was thrown } catch(YourException ye) { //assertion or print to say exception was thrown } }
has comment: http://stackoverflow.com/comment/37312995
accepted answer of: http://stackoverflow.com/q/24171551
answers question: http://stackoverflow.com/q/24171551

http://stackoverflow.com/comment/37450338
type: QuestionComment
comment on: http://stackoverflow.com/q/24246164
has text: @Seidr don't understand, why are saying that it's incorrect. It successfully finds all substring like `[id123|Alex]` or `[club3123|this awesome club]`
type: Comment
score: 0

http://stackoverflow.com/comment/37481417
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24262474
has text: StringTemplate has a single `char` pair for delimiters. You could replace `{{`/`}}` with a special unused Unicode char, like `◄` and `►`.

testng
tag name: testng
tags question: http://stackoverflow.com/q/24175344
tags question: http://stackoverflow.com/q/24246228
tags question: http://stackoverflow.com/q/24154321
tags question: http://stackoverflow.com/q/24138998
tags question: http://stackoverflow.com/q/24136623
type: Tag
tags question: http://stackoverflow.com/q/24126618

http://stackoverflow.com/q/24180345
tagged with: css
has body: table class="s-table table table-bordered table-striped table-hover"> Select I have tried x path expression as //div[@class='row-fluid']/table/tbody/tr[1]/td[7]/div/div[2]/div[2]/div/a/span //*[@id='div_2_1_2_1_7_1_1_r6']/a/span Also tried CSS selector as div[id='div_2_1_2_1_7_1_1_r6'] a[class='p-action-link'] span any of above identification is not working please let me know if any one has best solutions for the above problem!
has comment: http://stackoverflow.com/comment/37325150
tagged with: webdriver
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24183685
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37324271
has title: CSS expression is not working for Select link
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/24181177
tagged with: java
has comment: http://stackoverflow.com/comment/37324404

http://stackoverflow.com/a/24190433
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24178668
has comment: http://stackoverflow.com/comment/37440419
answers question: http://stackoverflow.com/q/24178668
has body: You can't do anything in native Air, which would be the runtime that would expose such an API. You can do a native system app (Windows or Mac) and that app leverages two processes that communicate with eachother. The main process would spawn two processes Air client Smart Card Reader writer So the main app would work as a HUB between the two. Maybe it's worth to look at a FlashPlayer app that runs in the browser and communicates with a Java Applet via ExternalInterface.
type: AcceptedAnswer

http://stackoverflow.com/comment/37203171
score: 0
type: Comment
type: AnswerComment
has text: @ZoharYosef another thing to look out for is Eclipse settings. It's quite possible that your workspace is configured to give an error in such a case, and in your friend's workspace it's configured to forgive. Look at workspace -> preferences -> Java -> Compiler -> Errors/Warnings. Enjoy the Hummus in Tel Aviv. Shalom
comment on: http://stackoverflow.com/a/24115129

http://stackoverflow.com/q/24249136
has comment: http://stackoverflow.com/comment/37455971
downvote count: 1
has comment: http://stackoverflow.com/comment/37455987
favorite count: 0
has body: For example, I have a method which computes two numbers with some of the following operation "addition, subtraction, multiplication, division" and returns result. public int sum(int a, int b) { return a + b; } Is there a way I can test time of execution of the method, if it didn't take longer than 0.5s to calculate?
has comment: http://stackoverflow.com/comment/37456065
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/37455799
tagged with: execution-time
has comment: http://stackoverflow.com/comment/37455948
type: Question
accepted answer: http://stackoverflow.com/a/24249178
upvote count: 2
has comment: http://stackoverflow.com/comment/37455873
has title: JUnit: testing speed of calculating
has answer: http://stackoverflow.com/a/24249178

http://stackoverflow.com/q/24164013
tagged with: cxf
tagged with: java
tagged with: soap
tagged with: jboss
accepted answer: http://stackoverflow.com/a/24282469
type: Question
has body: Currently we are migrating from AS5 to AS6 and for now everything works fine exept SOAP request creation. I know that Jboss 6 is using "jbossws-cxf..." libs. The problem is that now I'm getting strange beghavior of SOAP request: ID: 6 Address: Some Address Encoding: UTF-8 Content-Type: text/xml Headers: {SOAPAction=["http://....."], Accept=[*/*]} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body> SomeId SomeUN SomePWD </soap:Body></soap:Envelope> -------------------------------------- 2014-06-11 13:42:29,715 INFO [org.apache.cxf.interceptor.LoggingInInterceptor] (http-127.0.0.1-8080-5) Inbound Message ---------------------------- ID: 6 Response-Code: 500 Encoding: UTF-8 Content-Type: text/xml; charset=utf-8 Headers: {content-type=[text/xml; charset=utf-8], X-AspNet-Version=[2.0.50727], Date=[Wed, 11 Jun 2014 10:43:09 GMT], Content-Length=[924], X-Powered-By=[ASP.NET], Server=[Microsoft-IIS/7.5], Cache-Control=[private]} Payload: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault> soap:Client Invalid SOAP message due to XML Schema validation failure. The element 'GetInfo' in namespace 'http://...' has invalid child element 'ID' in namespace 'http://....'. List of possible elements expected: 'Cred, Auth' in namespace 'http://....'. http://.... <exception code="00010222" xmlns="http://...." /> </soap:Fault></soap:Body></soap:Envelope> 2014-06-11 13:42:29,958 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web]. [localhost].[/HelloWorld].[resteasy-servlet]] (http-127.0.0.1-8080-5) Servlet.service() for servlet resteasy-servlet threw exception: org.jboss.resteasy.spi.UnhandledException: javax.xml.ws.soap.SOAPFaultException: Invalid SOAP message due to XML Schema validation failure. The element 'GetInfo' in namespace 'http://...' has invalid child elem…
answer count: 1
tagged with: web-services
has answer: http://stackoverflow.com/a/24282469
type: AnsweredQuestion
has title: Migration from Jboss 5 to Jboss 6 causes SOAP request error
score: 0

http://stackoverflow.com/a/67449876
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/119220066
type: Answer
has comment: http://stackoverflow.com/comment/119220041
has comment: http://stackoverflow.com/comment/119220135
has comment: http://stackoverflow.com/comment/119219767
answers question: http://stackoverflow.com/q/24224272
has body: DateTimeFormatter.ofLocalizedDateTime Use it to obtain a locale-specific date format for the ISO chronology. Demo: import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; import java.util.Locale; public class Main { public static void main(String[] args) { DateTimeFormatter dtfLocalized = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.SHORT); // Test LocalDateTime date = LocalDateTime.now(); System.out.println(dtfLocalized.withLocale(Locale.US).format(date)); System.out.println(dtfLocalized.withLocale(Locale.UK).format(date)); System.out.println(dtfLocalized.withLocale(Locale.CHINESE).format(date)); System.out.println(dtfLocalized.withLocale(Locale.GERMAN).format(date)); System.out.println(dtfLocalized.withLocale(Locale.forLanguageTag("tr")).format(date)); System.out.println(dtfLocalized.withLocale(Locale.getDefault()).format(date)); } } Output: 5/8/21, 6:54 PM 08/05/2021, 18:54 2021/5/8 下午6:54 08.05.21, 18:54 8.05.2021 18:54 08/05/2021, 18:54 Note: If you want to format just the date part, replace DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.SHORT) with DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT). Learn more about the the modern date-time API* from Trail: Date Time. * For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time functionality to Java 6 & 7. If you are working for an Android project and your Android API level is still not compliant with Java-8, check Java 8+ APIs available through desugaring and How to use ThreeTenABP in Android Project.
has comment: http://stackoverflow.com/comment/119219986
has comment: http://stackoverflow.com/comment/119220031
has comment: http://stackoverflow.com/comment/119220285
score: 3

http://stackoverflow.com/comment/37273861
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24152844
has text: That is not a good idea (in fact, I have a mind to say it's a terrible idea). In any case I've updated the answer to include the rules used with JSONObject. You'll have to write a custom function to perform similar escaping (such escaping is not guaranteed to be followed in any particular `JSON.stringify` implementation), and then create a function to UTF-8 encode or UTF-8-encoded-length-guess the result - the length in byte counting can be done merely by looking at the code point magnitudes. You'll also need to deal with whitespace between JSON tokens.

http://stackoverflow.com/a/24229598
answers question: http://stackoverflow.com/q/24229398
score: 1
type: Answer
downvote count: 0
upvote count: 1
has body: I think you can try FragmentActivity as like- public class Grupos extends FragmentActivity because Base class for activities that want to use the support-based Fragment and Loader APIs. (android.support.v4.app.FragmentActivity)
has comment: http://stackoverflow.com/comment/37418545

http://stackoverflow.com/q/24127748
type: Question
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/37226673
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37236350
downvote count: 0
has title: How to change content of a JTextArea after user prompt
score: 1
upvote count: 1
has body: This is my first question on stackoverflow. So hopefully you are not as that strict to me :). Well, I read many posts about the JTextArea problem but I could not get the solution there. I read things about swing workers, propertychangelisteners and other stuff. I am still quite unsure in these parts of programming. I use NETBEANS 8.0. My program is about translating after the prompt of a user from one language in another. And if a String variable for the JTextArea is filled with content the JTextArea itself should update its text. I have implemented a Getter Method to get the translated string. Thus the initialization of the GUI Frame with a JTextArea: public class MF extends javax.swing.JFrame implements int_mainframe { protected static String str_output = null; private javax.swing.JTextArea jTextArea; @Override public void setStrOutput(String string) { str_output = string; jTextArea.setText(str_output); } public MF() { initComponents(); } private void initComponents() { jTextArea = new javax.swing.JTextArea(); } java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new MF().setVisible(true); } }); } The String Variable for this class is filled with content in class stacystart main method: public static void main(String[] args) { MF mf = new MF(); mf.setStrOutput(str_output); } I am getting frustrated to that even though the function is so simple. Need help please!
tagged with: java
answer count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37236403
has answer: http://stackoverflow.com/a/24128026
favorite count: 0

http://stackoverflow.com/a/24222980
upvote count: 1
has body: I propose you to use this library (details here): dependencies { compile 'com.shamanland:facebook-like-button:0.1.8' } This library implements 'like' action using WebView and &lt;iframe&gt;-based facebook plugin. Look at the screenshots:
type: Answer
answers question: http://stackoverflow.com/q/24117458
downvote count: 0
score: 1

http://stackoverflow.com/q/24135559
type: AnsweredQuestion
has body: I'm currently working on a project with the following scheme: Profile ------- CODE | CHAR(6) CODE_FUNCTION | CHAR(2) Function -------- CODE | CHAR(2) The most important part here is the foreign key from Profile to Function (CODE_FUNCTION => CODE). However, not each profile has a function, so in some cases the CODE_FUNCTION is just a blank row (" "). I mapped the function (in Profile) by using: @OneToOne @JoinColumn(name = "CODE_FUNCTION", referencedColumnName = "CODE") private Function function; And in the Function table the code is mapped by using: @Id @Column(name = "CODE_FUNCTION") private String code; This is working properly when the profile has a function, however, the moment the function code is not entered, I'm getting the following error: Caused by: javax.persistence.EntityNotFoundException: Unable to find org.example.entities.Function with id at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$JpaEntityNotFoundDelegate.handleEntityNotFound(EntityManagerFactoryBuilderImpl.java:181) at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:218) at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:274) at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:150) at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1070) at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:989) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:716) at org.hibernate.type.EntityType.resolve(EntityType.java:502) at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:170) at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:144) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1114) at org.hibernate.loader.Loader.processResultSet(Loader.java:972) at org.hibernate.loader.Loader.doQuery(Loader.java:920) at org.hibernate.loader.L…
linked to: http://stackoverflow.com/q/203493
answer count: 2
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/48303191
tagged with: jpa
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37240932
possible better answer: http://stackoverflow.com/a/48303191
has title: Treat empty string in JoinColumn as null
has comment: http://stackoverflow.com/comment/37240859
accepted answer: http://stackoverflow.com/a/25173077
has answer: http://stackoverflow.com/a/25173077

http://stackoverflow.com/a/24248634
accepted answer of: http://stackoverflow.com/q/24244477
answers question: http://stackoverflow.com/q/24244477
has comment: http://stackoverflow.com/comment/37457599
has comment: http://stackoverflow.com/comment/37496739
type: AcceptedAnswer
type: Answer
has body: Your problem is that you are consuming everything in the filter and closing it before passing it back from the createComponents call. You are, I assume, trying to debug how analysis works with this: try { shiFilter.reset(); while( shiFilter.incrementToken() ) { token = cta.toString(); System.out.println( token ); } shiFilter.end(); shiFilter.close(); } catch ( IOException ioe ) { ioe.printStackTrace(); } Note, though, that when you are done with it, shiFilter is at the end of the stream, and has been closed. You now pass it back from the method, in the TokenStreamComponents, when Lucene will now attempt to use it to index the documents. It will call reset() first, and will throw the indicated exception for trying to use an already closed resource. If you want to debug this, I'd recommend just creating an instance of your custom analyzer, and call analyzer.tokenStream to get the stream for debugging output. If you really need to debug by iterating through the filter instance, rather than the analyzer, you'll need to build a separate one, rather than consuming the stream in createComponents.
has comment: http://stackoverflow.com/comment/37458216
score: 0

http://stackoverflow.com/comment/37350404
has text: I was assuming Java 7.
comment on: http://stackoverflow.com/a/24193647
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/81787554
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24205765
type: Comment
has text: @JonSkeet [CDATA sections cannot nest.](https://www.w3.org/TR/xml/#sec-cdata-sect)

http://stackoverflow.com/q/24135414
type: Question
score: 0
tagged with: jtextarea
answer count: 1
tagged with: swing
tagged with: awt
has title: Check state and Uncheck state of JCheckBox MenuItem ActinListner
has body: I have WordWrap checkBox MenuItem.By default it is unchecked(false) state.When I run the program and click on New menuitem and write some text after I click on WordWrap menuItem,The WordWrap state in not changed for first two times.I want to change the state(checked) for first time only.I had tried that but not working. Here is code: public class CheckBoxMenuItem extends javax.swing.JFrame { int i=0; JTextArea textArea; JScrollPane scrollpane; public CheckBoxMenuItem() { initComponents(); WordWrap.setSelected(false); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tabbedPane = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); Create = new javax.swing.JMenuItem(); WordWrap = new javax.swing.JCheckBoxMenuItem(); 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); WordWrap.setSelected(true); WordWrap.setText("WordWrap"); WordWrap.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WordWrapActionPerformed(evt); } }); jMenu1.add(WordWrap); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 2…
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24135498
has answer: http://stackoverflow.com/a/24135498

http://stackoverflow.com/q/24213806
has body: I'm trying to build a project on a new laptop with an empty .m2/repository directory. I get the following error: BUILD FAILED /home/awills/Dropbox/Jasig/portal/uPortal/build.xml:635: The following error occurred while executing this line: /home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1437: The following error occurred while executing this line: /home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1372: The following error occurred while executing this line: /home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1315: The following error occurred while executing this line: /home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1318: The following error occurred while executing this line: /home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1375: The following error occurred while executing this line: /home/awills/Dropbox/Jasig/portal/uPortal/build.xml:1227: Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'net.sf.ehcache:ehcache-web:jar': Cannot find parent: net.sf.ehcache:ehcache-web-parent for project: null:ehcache-web:jar:null for project null:ehcache-web:jar:null net.sf.ehcache:ehcache-web:jar:2.0.4 from the specified remote repositories: central (http://repo1.maven.org/maven2), sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots), apache-snapshots (http://repository.apache.org/snapshots) Path to dependency: 1) org.jasig.portal:uportal-war:war:4.1.0-SNAPSHOT 2) org.jasig.resourceserver:resource-server-utils:jar:1.0.38 The project is mature and this dependency has not changed recently. The build was working recently. I don't understand the bit about for project: null:ehcache-web:jar:null -- where is it getting the nulls? The net.sf.ehcache:ehcache-web:2.0.4 pom begins as follows... <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.…
favorite count: 0
type: Question
tagged with: ehcache
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/28497455
has title: Trouble with ehcache dependencies from Maven Central
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24221975
answers question: http://stackoverflow.com/q/24221938
type: Answer
accepted answer of: http://stackoverflow.com/q/24221938
score: 2
has body: JavaScript has only one number type Number. It automatically switches between floats and integers as needed. Use Number.MAX_SAFE_INTEGER to get the max integer value and Number.MAX_VALUE to get the max float value. For me these are 9007199254740991 and 1.7976931348623157e+308
upvote count: 2
type: AcceptedAnswer
downvote count: 0

jsoup
tags question: http://stackoverflow.com/q/24105324
type: Tag
tags question: http://stackoverflow.com/q/24233095
tag name: jsoup
tags question: http://stackoverflow.com/q/24180169
tags question: http://stackoverflow.com/q/24165670
tags question: http://stackoverflow.com/q/24233274
tags question: http://stackoverflow.com/q/24153408
tags question: http://stackoverflow.com/q/24227968
tags question: http://stackoverflow.com/q/24198602
tags question: http://stackoverflow.com/q/24122747
tags question: http://stackoverflow.com/q/24256694
tags question: http://stackoverflow.com/q/24218239
tags question: http://stackoverflow.com/q/24224828
tags question: http://stackoverflow.com/q/24218422
tags question: http://stackoverflow.com/q/24154668
tags question: http://stackoverflow.com/q/24151640
tags question: http://stackoverflow.com/q/24225412
tags question: http://stackoverflow.com/q/24114569
tags question: http://stackoverflow.com/q/24181535
tags question: http://stackoverflow.com/q/24204017

http://stackoverflow.com/comment/37385151
comment on: http://stackoverflow.com/q/24211736
has text: By the way, this code is nonsense. A simple `arrayOfByte[0] = (byte)(paramShort>>>8)` would do the same…
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37417289
comment on: http://stackoverflow.com/q/24229175
type: QuestionComment
has text: BTW - what has this really got to do with Swing, or anything to do with speech? Voice controlled file browsing desktop app.?
score: 1
type: Comment

http://stackoverflow.com/comment/37305437
score: 0
comment on: http://stackoverflow.com/a/24161255
type: AnswerComment
has text: Sorry, i thought i added this as a comment
type: Comment

http://stackoverflow.com/q/24191068
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24194313
upvote count: 1
has title: (Android) API-specific styles?
has comment: http://stackoverflow.com/comment/37344814
has answer: http://stackoverflow.com/a/24194313
favorite count: 0
has body: For my Android app, I want my app to have translucent status and navigation bars on KitKat (API level 19). How do I make it so level 19 API operating systems have transparent status/navigation bars, while non-KitKat ones to have normal bars.
type: Question
has comment: http://stackoverflow.com/comment/37346514
score: 1
tagged with: android
tagged with: java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37346320

http://stackoverflow.com/comment/37211555
comment on: http://stackoverflow.com/a/24119951
score: 0
type: AnswerComment
type: Comment
has text: GSON and jackson have a more developed api, its easier using them than plain ol json

http://stackoverflow.com/comment/37415384
type: Comment
has text: You're also using different versions of java mail. It doesn't work from 1.4ea (ea stands for early access, so it's some kind of beta version), while it does work with java mail 1.4.7. Try upgrading the dependency in you maven project to the latest version of java mail 1.x.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24227492

http://stackoverflow.com/q/24210368
has comment: http://stackoverflow.com/comment/37382098
has comment: http://stackoverflow.com/comment/37382338
has comment: http://stackoverflow.com/comment/37382251
tagged with: programming-languages
favorite count: 0
has body: If we declare an interface, we have to specify the variable names as well. For example in this sample public interface ZipCodeServer { public String getCityName(int zipCode); } what is the purpose of zipCode. Ideally I would only like to have public interface ZipCodeServer { public String getCityName(int); } without specifying its name. If I dont declare its name, I get a compile time error. Can anyone point me the exact purpose of declaring the variable names in an interface mandatorily EDIT: I am not actually trying to convince anyone the variable names should not be there. I am asking what is the purpose of making it mandatory. Is it useful for any purpose to the compiler?
has answer: http://stackoverflow.com/a/26325586
tagged with: oop
type: Question
tagged with: interface
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37382041
has answer: http://stackoverflow.com/a/24217967
has title: How are variable names useful in a declaration in an interface?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37384970
tagged with: language-design
upvote count: 3
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/37456518
type: Comment
comment on: http://stackoverflow.com/a/24248518
type: AnswerComment
has text: Thank you for your time. Can I inject in myField and to get myField in constructor in such way that the myField has already bean initialized via CDI container?
score: 0

http://stackoverflow.com/a/24235303
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24235273
has comment: http://stackoverflow.com/comment/37429344
has comment: http://stackoverflow.com/comment/37429378
type: Answer
has body: The code you provided here works perfectly. This error happens when you use Eclipse as IDE and try to run code that doesn't even compile. Check your Problems view in Eclipse, and fix the compilation errors before executing the application.

http://stackoverflow.com/comment/37407125
score: 0
type: AnswerComment
has text: I am an absolute beginner to Java) so I dont quite understand your code) can you help me with the first way: also tracking the second smallest number??
type: Comment
comment on: http://stackoverflow.com/a/24223687

http://stackoverflow.com/q/24143750
score: 1
tagged with: java
has body: I'm writing an app that loads javascript dynamically using rhino(or a browser); I got 2 files: // in a file called fooDefinition.js var definition = { foo: function(data){return bar(data)}, loadFile: "barLib.js" } now, bar() is defined like this: // in a file called barLib.js function bar(data){ return data + " -&gt; bar!"; } This is what I want to do: load fooDefinition.js into the environment read the value of loadFile (in this case: "barLib.js") and load the file (NOTE: load the file through external mechanism, not through javascript itself!) call foo external mechanism &amp; example usage (Java pseudo code): // assume engine is a statefull engine (rhino for example) String str = /*content of fooDefinition.js*/; engine.eval(str); String fileToLoad = engine.eval("definition.loadFile"); engine.load(IOUtils.readFileToString(new File(fileToLoad))); String result = engine.eval("definition.foo('myData')"); I've tried this in Google Chrome's JS console and no error was thrown I wonder is this the correct way of accomplish such task? TL;DR: Are the attributes of an object loaded and checked when the object is defined?
has title: JavaScript scope resolve time
has comment: http://stackoverflow.com/comment/37257588
has comment: http://stackoverflow.com/comment/37257655
type: Question
accepted answer: http://stackoverflow.com/a/24144955
has comment: http://stackoverflow.com/comment/37256616
has comment: http://stackoverflow.com/comment/37255969
has comment: http://stackoverflow.com/comment/37257835
has answer: http://stackoverflow.com/a/24144955
has comment: http://stackoverflow.com/comment/37258029
answer count: 1
has comment: http://stackoverflow.com/comment/37257370
downvote count: 0
tagged with: javascript
upvote count: 1
has comment: http://stackoverflow.com/comment/37257511
favorite count: 0
tagged with: scope
has comment: http://stackoverflow.com/comment/37257735
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37257963
has comment: http://stackoverflow.com/comment/37256549
has comment: http://stackoverflow.com/comment/37257894

http://stackoverflow.com/q/24137251
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37244274
has body: I generated a keystore file using the keytool included with JDK 7, signed my app with it and uploaded it to the Google Play Store for beta testing. My beta testers are getting a "Error - Package file was not signed correctly" error, which I believe is because JDK 7's jarsigner uses a different algorithm? I have switched to the JDK 6 jarsigner and passed in the -sigalg SHA1withRSA and -digestalg SHA1 switches to set the algorithm that Android requires. However, my beta testers are still getting the same error. My question is: Can you use the JDK 6 jarsigner tool with a keystore file created with the JDK 7 keytool? I would just generate a new keystore with the JDK 6 keytool, but I don't want have to re-create my Google Play listing if at all possible..
has comment: http://stackoverflow.com/comment/37248041
score: 0
tagged with: sign
tagged with: jarsigner
tagged with: java
has title: Sign app with JDK7 keystore
tagged with: keytool
type: Question

http://stackoverflow.com/a/24575064
has body: Master is not the newest available version. It's a scary branch of which nobody really knows what's in there and what's not. The 1.3 branch would be the newest right now. However, in 1.3 they want to add multidb support and therefor JPA / DB configurations won't always be backwards compatible (for now, since they are still working on that). See the mailing list thread on the 1.3 release candidate for more information.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24118733

parsing
tags question: http://stackoverflow.com/q/24106623
tags question: http://stackoverflow.com/q/24224828
tags question: http://stackoverflow.com/q/24192299
tags question: http://stackoverflow.com/q/24218422
tags question: http://stackoverflow.com/q/24196882
tag name: parsing
tags question: http://stackoverflow.com/q/24179163
tags question: http://stackoverflow.com/q/24185887
tags question: http://stackoverflow.com/q/24113895
tags question: http://stackoverflow.com/q/24146890
tags question: http://stackoverflow.com/q/24186954
tags question: http://stackoverflow.com/q/24156948
tags question: http://stackoverflow.com/q/24254393
tags question: http://stackoverflow.com/q/24230554
tags question: http://stackoverflow.com/q/24238055
type: Tag

http://stackoverflow.com/a/24198797
answers question: http://stackoverflow.com/q/24198771
upvote count: 2
has comment: http://stackoverflow.com/comment/37360792
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37360835
type: Answer
accepted answer of: http://stackoverflow.com/q/24198771
has body: There are several ways, one would be to use a StringBuilder for example... String str = "abcdefg"; StringBuilder sb = new StringBuilder(str.length()); for (char c : str.toCharArray()) { sb.append(c); System.out.println(sb); } This simply takes each character in turn and appends it to the StringBuilder and prints the result...as an example ;)
has comment: http://stackoverflow.com/comment/37359558
score: 2

jtable
tags question: http://stackoverflow.com/q/24126920
tags question: http://stackoverflow.com/q/24136428
tags question: http://stackoverflow.com/q/24248757
tags question: http://stackoverflow.com/q/24170096
tag name: jtable
tags question: http://stackoverflow.com/q/24215065
tags question: http://stackoverflow.com/q/24115907
tags question: http://stackoverflow.com/q/24218516
tags question: http://stackoverflow.com/q/24216790
tags question: http://stackoverflow.com/q/24246494
tags question: http://stackoverflow.com/q/24184670
type: Tag
tags question: http://stackoverflow.com/q/24235557
tags question: http://stackoverflow.com/q/24214584
tags question: http://stackoverflow.com/q/24146479
tags question: http://stackoverflow.com/q/24158009
tags question: http://stackoverflow.com/q/24228243
tags question: http://stackoverflow.com/q/24218546
tags question: http://stackoverflow.com/q/24145802
tags question: http://stackoverflow.com/q/24228208
tags question: http://stackoverflow.com/q/24228714
tags question: http://stackoverflow.com/q/24241455
tags question: http://stackoverflow.com/q/24202721
tags question: http://stackoverflow.com/q/24207887
tags question: http://stackoverflow.com/q/24263744
tags question: http://stackoverflow.com/q/24231503
tags question: http://stackoverflow.com/q/24215709

http://stackoverflow.com/q/24237506
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: java
tagged with: gxt
has body: List&lt;ColumnConfig&lt;Vo, ?&gt;&gt; l = new ArrayList&lt;ColumnConfig&lt;Vo, ?&gt;&gt;(); l.add(numColumn); l.add(subjectColumn); l.add(nameColumn); l.add(dateColumn); ColumnModel&lt;Vo&gt; cm = new ColumnModel&lt;Vo&gt;(l); Grid&lt;Vo&gt; grid = new Grid&lt;Vo&gt;(store, cm) { @Override protected void onAfterFirstAttach() { super.onAfterFirstAttach(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { loader.load(); } }); } }; grid.addCellClickHandler(new CellClickHandler() { @Override public void onCellClick(CellClickEvent event) { // TODO Auto-generated method stub contentPanel.clear(); contentPanel.add(readPanel(contentPanel)); } });` When I click on cell, I want to get the data in the cell corresponding. The current state, When you click on of the cell, switch to a different view of the structure. And I succeeded to connect to the database. However, I want to get the data of cell or row. How to get values of grid in GXT? (example Site:http://www.sencha.com/examples/#ExamplePlace:paginggrid)
possible better answer: http://stackoverflow.com/a/24237953
accepted answer: http://stackoverflow.com/a/24250031
tagged with: grid
type: Question
has answer: http://stackoverflow.com/a/24250031
tagged with: gwt
has title: How to get values of grid in GXT?
has answer: http://stackoverflow.com/a/24237953

http://stackoverflow.com/comment/37316062
type: Comment
type: AnswerComment
has text: I can't do it that way. The point of this is the dialog should display when the BUILD button is pressed. Your example does not allow it to be created again.
comment on: http://stackoverflow.com/a/24175356
score: 0

http://stackoverflow.com/comment/37468614
type: Comment
type: QuestionComment
has text: you can launch a 32 bit process in a 64 bit environment, but as you mentioned you might not be able to use the additional memory, you can use `Runtime.getRuntime().exec()` to run a 32bit or a 64 bit application, a 32 bit process in 64bit windows will have a *32 against its name in the task manager..
comment on: http://stackoverflow.com/q/24255533
score: 1

http://stackoverflow.com/comment/37208439
type: Comment
type: QuestionComment
has text: Now you described your intentions it is clear that you logic will not work as you will not be counting line separators, so your result will be off by `line.separator.length * lineNumber`
comment on: http://stackoverflow.com/q/24117547
score: 1

http://stackoverflow.com/q/24238573
upvote count: 1
has body: Can anybody tell How to find Day Light Starting Date and End Date in year in android .I have tried in this way but true will come for all the date.I want to find DST start date and end date inyear TimeZone tz = TimeZone.getTimeZone("America/Denver"); Date date = new GregorianCalendar (2014, 3, 9).getTime(); boolean inDs = tz.inDaylightTime (date); Thanks
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/3159023
type: UnansweredQuestion
tagged with: android
downvote count: 0
has title: Not able to find Day Light Starting Date and End Date in year in android
linked to: http://stackoverflow.com/q/1449500
has comment: http://stackoverflow.com/comment/37436026
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/24179668
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24202348
tagged with: emf
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
upvote count: 2
has title: Set value knowing the EObject and its EAttribute
accepted answer: http://stackoverflow.com/a/24202348
score: 2
has body: I want to set the value of an object EObject knowing it's EAttribute. Is that possible? I can use reflections, build the method name and invoke it, but is there a better way to achieve that? Maybe some EMF Util classes? public static Object invokeMethodBy(EObject object, EAttribute attribute, Object...inputParameters){ String attrName = attribute.getName().substring(0, 1).toUpperCase() + attribute.getName().substring(1); Object returnValue = null; try { returnValue = object.getClass().getMethod("set"+attrName, boolean.class).invoke(object,inputParameters); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e1) { e1.printStackTrace(); } return returnValue; }
downvote count: 0

http://stackoverflow.com/q/24190684
type: Question
has title: Usergrid requests queing
tagged with: usergrid
has body: I've started to check USERGRID as front+back end solution for my last project. Actually, I'm focused on evaluating the performance of this framework. I couldn't find any information about the treatment of the REST requests arriving to the server. Are they queued? If yes, can its capacity be configured? Thanks in advance.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24515197
score: 0
tagged with: java
answer count: 1
tagged with: cassandra

http://stackoverflow.com/a/24205012
answers question: http://stackoverflow.com/q/24204966
has body: Just try with: String a = "narendar baddam"; String b = "narendar baddam"; a.replaceAll(" ", "").equals(b.replaceAll(" ", ""))
type: Answer
score: 0

http://stackoverflow.com/a/24356493
type: Answer
score: 2
has body: Can you use ContextBuilder.credentialsSupplier with a custom Supplier, similar to the following: Using AWS (S3) via jclouds - how to assume role
answers question: http://stackoverflow.com/q/24111845
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/24198122
score: 5
upvote count: 5
has body: The Document of a JTextArea (or JTextPane) always stores the newline string as "\n". So, when using a JTextArea the following code will work on all platforms: System.out.println(getText().replace("\n", "!")); However if you use the textArea.write(...) method, the "\n" will be replaced by the "line.separator" for your platform. Check out Text and New Lines which attempts to explain this behaviour in more detail.
type: Answer
has comment: http://stackoverflow.com/comment/37402179
accepted answer of: http://stackoverflow.com/q/24198009
has comment: http://stackoverflow.com/comment/37358496
has comment: http://stackoverflow.com/comment/37430772
answers question: http://stackoverflow.com/q/24198009
downvote count: 0
has comment: http://stackoverflow.com/comment/37377172
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37358454
has comment: http://stackoverflow.com/comment/37396756
has comment: http://stackoverflow.com/comment/37361500

http://stackoverflow.com/a/24237350
score: 1
type: AcceptedAnswer
has body: You have to remove the seconds in your pattern: new SimpleDateFormat("'Statistics since' MM/dd/yyyy hh:mm a");
accepted answer of: http://stackoverflow.com/q/24237337
answers question: http://stackoverflow.com/q/24237337
has comment: http://stackoverflow.com/comment/37433524
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37294870
has text: You should be capable to adapt [Generating random integers in a range with Java](http://stackoverflow.com/questions/363681/generating-random-integers-in-a-range-with-java) to `float` or `double` type.
score: 1
comment on: http://stackoverflow.com/q/24164596
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37483534
has text: Ah, indeed. You might want to print the exception's stack trace instead of ignoring it, and amending your question with the output, that would help.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24263795
type: Comment

http://stackoverflow.com/comment/37353770
type: QuestionComment
comment on: http://stackoverflow.com/q/24194794
score: 0
has text: What does `Juego` extend from? Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem, this will reduce the guess work and produce better response
type: Comment

http://stackoverflow.com/q/24193418
linked to: http://stackoverflow.com/q/5969387
has title: Blazeds Stream Message On Mobile 3G Service
has comment: http://stackoverflow.com/comment/37528956
has comment: http://stackoverflow.com/comment/37522312
favorite count: 0
type: Question
tagged with: blazeds
has body: I have a project that connect to BlazeDs for streaming message service and I cannot make it work on the 3G. Please if you know it is possible I would appreciate your help. I have working streaming messages and remote on Wi-Fi but the 3G only does remotes. When it try to subscribe to stream on the 3G it say &gt; [BlazeDS]15:59:55.259 Channel endpoint my-streaming-amf received &gt; request. [BlazeDS]15:59:55.261 Endpoint with id 'my-streaming-amf' &gt; received a duplicate streaming connection request from, FlexClient &gt; with id '4998DC8E-420B-87A3-58F0-3B71E040ABEB'. Faulting request. Please if you can help. I can give more information if you need. Thank you. EDIT: Please, this is serious question. For instance, it say [BlazeDS]17:02:08.479 Number of streaming clients for endpoint with id 'my-streaming-amf' is 1. BUT I am only testing one clientId so how can 1 be connected and I do not receive messages?
tagged with: iphone
type: UnansweredQuestion
tagged with: apache-flex
score: 0
answer count: 0
tagged with: 3g
upvote count: 1
tagged with: java
downvote count: 1

http://stackoverflow.com/q/24224825
score: 0
has body: A ${book.description} variable contains text with "\n" character incide, so I replace it to html tag to preserve new line (new paragrapf line) in jsp output. But in this case there is a danger of execution of the XSS code. Is there a way do it using c:out jsp tag and preserv new line in text? If I use c:out for output then all &lt; br/ >replaced to &amp; lt; br / &amp; gt; and there is no new line. &lt;c:set var="newline" value="&lt;%= \"\n\" %&gt;" /&gt; &lt;p&gt;${fn:replace(book.description, newline, "&lt;br /&gt;")}&lt;/p&gt;
has comment: http://stackoverflow.com/comment/37409537
type: UnansweredQuestion
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/37410031
linked to: http://stackoverflow.com/q/14514440
has comment: http://stackoverflow.com/comment/37414723
has answer: http://stackoverflow.com/a/24226850
has comment: http://stackoverflow.com/comment/37409467
has comment: http://stackoverflow.com/comment/37413233
tagged with: xss
has comment: http://stackoverflow.com/comment/37409576
has comment: http://stackoverflow.com/comment/37409488
has comment: http://stackoverflow.com/comment/37410016
tagged with: java
has comment: http://stackoverflow.com/comment/37409333
has comment: http://stackoverflow.com/comment/37409512
has comment: http://stackoverflow.com/comment/37409557
has comment: http://stackoverflow.com/comment/37471335
has title: Protecting from XSS and using c:out jsp tag
has comment: http://stackoverflow.com/comment/37459759
has comment: http://stackoverflow.com/comment/37409521
type: Question

http://stackoverflow.com/a/24149244
score: 0
has comment: http://stackoverflow.com/comment/37266715
answers question: http://stackoverflow.com/q/24149187
type: Answer
has body: I absolutely guarantee that Collections.shuffle() is not inserting null elements. They must already be in there before you shuffle. Your fill loop is horribly over-complicated and as a result broken. Just use i to generate the card for each suite. The other answer already explained what's wrong with the if statements. String[] suites = new String[] { "Hearts", "Clubs", "Spades", "Diamonds" }; for (int i = 0; i &lt; 14; i++) { for (String suite: suites) { pack.add(new Card(suite, i)); } }

http://stackoverflow.com/comment/37428800
has text: if it's 2121 - I don't know what that is referring to and how to find it... there are a few more statements below which I can append if anyone thinks it would help
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24225972

http://stackoverflow.com/q/24200186
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37362300
has title: java regex split string with white space(except when both left and right was number or - )
type: Question
tagged with: regex
accepted answer: http://stackoverflow.com/a/24200236
tagged with: capture-group
has answer: http://stackoverflow.com/a/24200236
score: 2
upvote count: 2
type: AnsweredQuestion
has body: I have this string how to split 5-28 14:00 - 5-28 18:00 the60s(.corp). I want to split it with white space except when the white space have number or - around them. The result I want was: 1. how 2. to 3. split 4. 5-28 14:00 - 5-28 18:00 5. the60s(.corp) Thanks. The following is my code: String str = "how do I split 5-28 14:00 - 5-28 18:00 the60s(.corp)"; str = str.replaceAll("\\s+(?!(?=-|\\d+))", "@"); First I replace the right white space with @ , then split the string with @. But it doesn't work.
tagged with: java
downvote count: 0

http://stackoverflow.com/q/24257314
type: AnsweredQuestion
has body: My service method Produces one of this MediaTypes it may produce pdf or excel file or other. @Produces({"application/pdf","application/vnd.ms-excel"... My Question My service returns response type with application/pdf always even if it produces excel. Why? Than I rearranged MediaTypes. @Produces({"application/vnd.ms-excel","application/pdf",... Now it's giving type application/vnd.ms-excel for all responses,again Why? I am using com.sun.jersey API for client and getting type by the use of clientResponse.getType() Probably I think I misunderstood the concept of @Produces annotation. Please Clarify. Following is code of my Service method. response = Response.ok((Object) file);//file is Object of File response.header("Content-Disposition","attachment; filename="+filename); //filename can be a.pdf b.xlsx etc return response.build();
has answer: http://stackoverflow.com/a/24257418
answer count: 3
downvote count: 0
tagged with: annotations
tagged with: jax-rs
possible better answer: http://stackoverflow.com/a/24257421
has title: @Produces annotation in JAX-RS
favorite count: 0
has answer: http://stackoverflow.com/a/24257421
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24264292
score: 4
upvote count: 4
accepted answer: http://stackoverflow.com/a/24257418

http://stackoverflow.com/comment/37642731
comment on: http://stackoverflow.com/a/24238229
score: 0
type: Comment
type: AnswerComment
has text: I already solved it. Actually I didn't, but I threw off Jetty and started using Tomcat, which is significately better for me. Thanks for all :)

http://stackoverflow.com/comment/37404347
has text: I am not sure, because I have not use `ActionBarActivity` yet, but in the [Documentation](http://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html) says that you need a `onCreateView()` method.
type: Comment
comment on: http://stackoverflow.com/q/24222206
score: 0
type: QuestionComment

http://stackoverflow.com/a/24155009
score: 0
has body: An instance of a Serializable class can be serialized using Java standard serialization mechanizm, that is written to a stream with java.io.ObjectOutputStream.writeObject and later read with java.io.ObjectInputStream.readObject
answers question: http://stackoverflow.com/q/24154954
type: Answer

http://stackoverflow.com/q/24163597
score: 0
answer count: 3
tagged with: java
tagged with: mysql
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24163815
has answer: http://stackoverflow.com/a/24163667
type: UnansweredQuestion
has body: I want to make a function in java that executes two queries, in which I want to do this: Example: String s ="CREATE TABLE ClassRoom(ID int AUTO_INCREMENT PK , name char (2) not null, section char (2) not null, numberSt int not null, )"; String s1 ="INSERT INTO ClassRoom VALUES (null,'5','A',25)"; pst = conn.prepareStatement(s); pst.executeUpdate(); pst = conn.prepareStatement(s1); pst.executeUpdate(); I want to put some values in the table when I create the table. The first time it works perfectly, but the second time s is not called as there is IF NOT EXISTS, but the s1 is called again another time. I want the s1 to be called only if the s has been executed or the table has been created. IF the table already exists i don't want to call s1 query.
has title: Executing the second query only the first query is executed
has answer: http://stackoverflow.com/a/24164691

http://stackoverflow.com/q/24159415
favorite count: 0
score: 1
tagged with: android
tagged with: java
tagged with: facebook-graph-api
tagged with: facebook-sdk-3.14.x
type: Question
answer count: 0
has title: Prevent to show state change of the Facebook login button
type: UnansweredQuestion
tagged with: facebook
downvote count: 0
upvote count: 1
has body: I am using the Facebook login button for authentication and followed pretty much the Facebook Login for Android tutorial. In the onSessionStateChange method I make a Graph API call to retrieve the User ID: Request request = Request.newMeRequest(session, new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { // ... } }); request.executeAsync(); In the meantime, I don't wish the Facebook Login Button does not change from Log in with Facebook to Log Out. Any idea how to achieve this in an easy way? I reckon it might be even possible in the layout XML file, but I have not found an appropriate attribute.

http://stackoverflow.com/q/24192674
has answer: http://stackoverflow.com/a/24192881
score: 2
tagged with: java
tagged with: javafx
answer count: 1
favorite count: 0
tagged with: observablelist
type: Question
upvote count: 2
has title: Loop through observable list
type: UnansweredQuestion
downvote count: 0
has body: I have a javafx table (carTable) that contains a single column: +-------------+ + Brand + +-------------+ This column is part of an observable list (carOL). This OL also contains 2 Lists ("Dates" and "Prices"). For each brand prices can be downloaded from the internet for a specific time window. eg: Audi 2014-01-01 2014-01-02 55000 90000 BMW 2014-01-01 2014-01-02 85000 70000 I now want to create a line chart with all this data, that compares price development between the different brands. What I have come up so far: @FXML private CategoryAxis xAxis = new CategoryAxis(); @FXML private NumberAxis yAxis = new NumberAxis(); @FXML private LineChart&lt;String, Number&gt; lc = new LineChart&lt;&gt;(xAxis,yAxis); Series&lt;String, Number&gt; series = new Series&lt;&gt;(); List&lt;String&gt; d = new ArrayList&lt;String&gt;(); List&lt;Double&gt; p = new ArrayList&lt;Double&gt;(); int id = 0; for (Car c : carOL) { d = c.getDate(); // returns array list with dates from OL p = c.getPrice(); // returns array list with prices from OL series.getData().add(new XYChart.Data&lt;&gt;(d.get(id), p.get(id))); id++; } lc.getData().add(series); This of course does not quite return what I want. I somehow need to be able to create separate "series" for each brand. Can anyone help?

http://stackoverflow.com/a/24380045
accepted answer of: http://stackoverflow.com/q/24221460
score: 1
answers question: http://stackoverflow.com/q/24221460
has body: For large spreadsheet handling, it is advisable to use SXSSF As far as what I can think of, Streaming classes is a bit slower compared to HSSF and XSSF, but is far more superior when it comes to memory management (Feel free to correct me).
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/37344275
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24188078
has text: @ajb I have linked to the Matrix code.
score: 0

elasticsearch
tags question: http://stackoverflow.com/q/24233193
tags question: http://stackoverflow.com/q/24165964
tags question: http://stackoverflow.com/q/24166536
tags question: http://stackoverflow.com/q/24266239
tags question: http://stackoverflow.com/q/24222356
tags question: http://stackoverflow.com/q/24254081
tags question: http://stackoverflow.com/q/24253224
type: Tag
tags question: http://stackoverflow.com/q/24230026
tags question: http://stackoverflow.com/q/24218688
tags question: http://stackoverflow.com/q/24225766
tag name: elasticsearch
tags question: http://stackoverflow.com/q/24214624
tags question: http://stackoverflow.com/q/24200568

parameters
tags question: http://stackoverflow.com/q/24239122
tag name: parameters
tags question: http://stackoverflow.com/q/24171144
tags question: http://stackoverflow.com/q/24109135
type: Tag
tags question: http://stackoverflow.com/q/24122298
tags question: http://stackoverflow.com/q/24109376
tags question: http://stackoverflow.com/q/24206013

http://stackoverflow.com/q/24147490
tagged with: hadoop
type: UnansweredQuestion
tagged with: apache
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37270230
has comment: http://stackoverflow.com/comment/37266376
has comment: http://stackoverflow.com/comment/37270084
upvote count: 1
has comment: http://stackoverflow.com/comment/37270612
has comment: http://stackoverflow.com/comment/37270968
favorite count: 0
tagged with: hive
has comment: http://stackoverflow.com/comment/37270516
has comment: http://stackoverflow.com/comment/37271224
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I'm creating a table using the twitter cloudera example, while I've successfully created the table and get the data, I'm encountering a problem. I can perform a select * from tweets; and returned the data, but when I go more deeper like a count(*) I'm receiving an error. Here's the table created: ADD JAR /cdh-twitter-example/hive-serdes/target/hive-serdes-1.0-SNAPSHOT.jar; CREATE EXTERNAL TABLE tweets ( id BIGINT, created_at STRING, source STRING, favorited BOOLEAN, retweet_count INT, retweeted_status STRUCT&lt; text:STRING, user:STRUCT>, entities STRUCT&lt; urls:ARRAY>, user_mentions:ARRAY>, hashtags:ARRAY>>, text STRING, user STRUCT&lt; screen_name:STRING, name:STRING, friends_count:INT, followers_count:INT, statuses_count:INT, verified:BOOLEAN, utc_offset:INT, time_zone:STRING>, in_reply_to_screen_name STRING ) ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe' LOCATION '/user/flume/tweets'; Here's the error and stack trace: hive> select count(*) from tweets; Total MapReduce jobs = 1 Launching Job 1 out of 1 Number of reduce tasks determined at compile time: 1 In order to change the average load for a reducer (in bytes): set hive.exec.reducers.bytes.per.reducer= In order to limit the maximum number of reducers: set hive.exec.reducers.max= In order to set a constant number of reducers: set mapred.reduce.tasks= Starting Job = job_1402410026954_0004, Tracking URL = http://bigdatalite.localdomain:8088/proxy/application_1402410026954_0004/ Kill Command = /usr/lib/hadoop/bin/hadoop job -kill job_1402410026954_0004 Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1 2014-06-10 13:07:28,078 Stage-1 map = 0%, reduce = 0% 2014-06-10 13:07:39,983 Stage-1 map = 100%, reduce = 0% 2014-06-10 13:07:41,071 Stage-1 map = 0%, reduce = 0% 2014-06-10 13:08:18,527 Stage-1 map = 100%, reduce = 100% Ended Job = job_1402410026954_0004 with errors Error during job, obtaining debugging information... Examining task ID: task_1402410026954_0004_m_000000 (and mo…
has title: Hive query error with Json
has comment: http://stackoverflow.com/comment/37271048
has answer: http://stackoverflow.com/a/60636541
type: Question

http://stackoverflow.com/q/24266629
has body: In every other console application, we have to print text while the user still types something in (e.g. a chat, a server console etc). My question is: How can one print text while the user is typing without destroying the format? Example: PlayerA joins the game while PlayerB is still typing a testmessage. Instead of this: PlayerA joined the game. [prompt]testmessage it looks like this: [prompt]testmePlayerA joined the game ssage I tested different scenarios, with System.out.println() and System.console().readLine(), but it still doesn't work. Does it need some weird, hacky workaround or is there a better solution?
tagged with: java
has answer: http://stackoverflow.com/a/24269150
favorite count: 0
type: Question
upvote count: 2
has title: Java console print text while user types
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/37492251
downvote count: 0
has comment: http://stackoverflow.com/comment/37489419
has comment: http://stackoverflow.com/comment/37492028
tagged with: console
has comment: http://stackoverflow.com/comment/37491989
score: 2

http://stackoverflow.com/q/24136173
tagged with: export
has answer: http://stackoverflow.com/a/24148232
type: UnansweredQuestion
answer count: 1
tagged with: jsp
tagged with: spring-mvc
score: 0
has body: I am just beginning to write an intranet based application using Spring framework. Wanted the following suggestions and clarifications. 1) Can i convert my project as an exe and deploy in neighbouring system? 2) If i can do that, should the neighbouring system also have tomcat and java installed or we can have the installer embedded in the exe? Kindly share your inputs and oblige. Thanks,
tagged with: java
has title: Java Spring framework intranet-application exporting
type: Question

http://stackoverflow.com/comment/37314868
has text: @camickr I hope, the way to accept an answer is to click the up arrow in the left hand side where tool tip says This answer is useful.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24174694
type: QuestionComment

http://stackoverflow.com/comment/37419750
score: 0
comment on: http://stackoverflow.com/a/24225121
type: AnswerComment
has text: There are no code examples because you don't need to write any code. Just place a .jnlp file in the same directory as your .jar file on the web server.
type: Comment

http://stackoverflow.com/comment/37442819
comment on: http://stackoverflow.com/q/24242395
type: QuestionComment
score: 3
has text: [You need to understand the basic difference between a break and a continue in that case](http://stackoverflow.com/q/462373/2024761).
type: Comment

http://stackoverflow.com/comment/37262178
has text: No, the code in the `if` condition always runs. It's the following block that won't run if the condition is `false`.
comment on: http://stackoverflow.com/a/24146002
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24131513
type: Question
tagged with: graphics
linked to: http://stackoverflow.com/q/14886232
accepted answer: http://stackoverflow.com/a/24131544
linked to: http://stackoverflow.com/q/23417786
tagged with: java
has answer: http://stackoverflow.com/a/24131544
has body: Can someone tell me what should I use for painting graphics on a JPanel: Canvas, or simply drawing everything in paintComponent()? I am painting hundreds of small images around 30 times per second, and I wonder which one would be the most lightweight, and in what conditions should I use both? Thanks.
tagged with: paintcomponent
has title: java what is heavier: Canvas or paintComponent()?
score: 2
type: AnsweredQuestion
tagged with: canvas
upvote count: 2
has comment: http://stackoverflow.com/comment/37233647
answer count: 1
has comment: http://stackoverflow.com/comment/37233761
downvote count: 0
has comment: http://stackoverflow.com/comment/37233803
tagged with: swing
has comment: http://stackoverflow.com/comment/37233948
favorite count: 0

http://stackoverflow.com/q/24232784
answer count: 2
has comment: http://stackoverflow.com/comment/37440241
downvote count: 1
tagged with: java-8
has comment: http://stackoverflow.com/comment/37425039
favorite count: 0
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/37435893
linked to: http://stackoverflow.com/q/22917462
tagged with: java
type: UnansweredQuestion
tagged with: lambda
score: 10
upvote count: 11
has answer: http://stackoverflow.com/a/38895136
has comment: http://stackoverflow.com/comment/37425188
has title: Jersey and Java 8 (Lambda expression)
tagged with: jersey
has answer: http://stackoverflow.com/a/38906556
has body: I use Jersey version 1.18.1 (com.sun.jersey), Spring and Java 8. If I put a Java 8 Lambda expression in a REST service, it crashes. If I remove the lambda expression, it works. @Service @Path("/hello") public class Hello { @GET public String hello() { new ArrayList&lt;String&gt;().stream().filter((str) -&gt; str.length() &gt; 0); return "hello"; } } I use com.sun.jersey (1.18.1 version). Full stacktrace: SEVERE: Allocate exception for servlet jersey-serlvet java.lang.ArrayIndexOutOfBoundsException: 52264 at jersey.repackaged.org.objectweb.asm.ClassReader.readClass(ClassReader.java:1976) at jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:464) at jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:420) at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(AnnotationScannerListener.java:138) at com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner$1.f(FileSchemeScanner.java:86) at com.sun.jersey.core.util.Closing.f(Closing.java:71) Please tell me how to fix it.
has comment: http://stackoverflow.com/comment/62717501

http://stackoverflow.com/comment/37643592
has text: @JeffreyBosboom Yes, you are correct problem was with size of queue used. Its size was 100 which reduced to number of thread count, and then problem of memory got solved.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24132032

http://stackoverflow.com/comment/37286635
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24160176
score: 0
has text: Thanks Michel but I am getting error as I am giving "@name" insted of name. FATAL ERROR: 'Could not compile stylesheet' Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:828) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:617) at xmltocsv.main(xmltocsv.java:26)

http://stackoverflow.com/a/24206643
answers question: http://stackoverflow.com/q/24181773
has body: The unchecked warning cannot be worked around with a direct conversion because Java can't statically define the type safety of the operation, as the content of the array is not know; the solution would be to make the content of the array known to java: Collection&lt;SVNLogEntry&gt; typesafe = new ArrayList&lt;SVNLogEntry&gt;(); for (Object o : repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true)) { typesafe.add((SVNLogEntry)o); } this comes with a performance penalty but allows the runtime to be sure of what the typed array content is and makes the warning disappear. However, if you are looking for an alternative to suppress the warning without using SuppressWarning, there is this other route (which applies to the project as a whole, sadly): To disable the warning without suppress warning, you have go to preferences, under java > compiler > error/warnings, where there is a Generic types fold containing these messages putting them to ignore should also remove the tooltip.
downvote count: 0
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24181773
type: AcceptedAnswer

http://stackoverflow.com/a/24494049
answers question: http://stackoverflow.com/q/24252256
accepted answer of: http://stackoverflow.com/q/24252256
has body: In Eclipse, click on Windows > Preferences, and then choose Maven in the left side. Check the box "Download repository index updates on startup". Optionally, check the boxes Download Artifact Sources and Download Artifact JavaDoc. Click OK. The warning won't appear anymore. Restart Eclipse.
type: AcceptedAnswer
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/70520667
upvote count: 385
score: 384

http://stackoverflow.com/comment/37201941
comment on: http://stackoverflow.com/q/24114279
has text: I posted full application context config and servlet context config. Thanks
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37385630
score: 0
has text: Nope I can't guarantee that I'm assuming that they are being run in the order written.
type: QuestionComment
comment on: http://stackoverflow.com/q/24207806
type: Comment

http://stackoverflow.com/a/24148438
accepted answer of: http://stackoverflow.com/q/24135687
upvote count: 1
has body: You should create the live template and paste your code into it, but replace CURRENT with $CURRENT$. Once you've done this, the Edit Variables option becomes available. Then, you should click this. You want to define an expression, such as className() for you $CURRENT$ variable. The whole process is described in the IntelliJ documentation.
type: Answer
answers question: http://stackoverflow.com/q/24135687
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24263063
has body: I think he/she meant for ooxml-schemas library and rest dependencies.
type: Answer
has comment: http://stackoverflow.com/comment/37482326
answers question: http://stackoverflow.com/q/24262080
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37484476
type: QuestionComment
has text: try java -cp /home/ermira/Downloads/weka-3-6-10/weka.jar -jar myjar.jar
comment on: http://stackoverflow.com/q/24261701
score: 0
type: Comment

http://stackoverflow.com/comment/37260893
type: Comment
type: QuestionComment
has text: Can you paste the full stacktrace? It seems like you are calling `clip.start()` without initializing `clip`.
comment on: http://stackoverflow.com/q/24146349
score: 0

http://stackoverflow.com/a/36179066
answers question: http://stackoverflow.com/q/24258995
has comment: http://stackoverflow.com/comment/60005190
type: Answer
has comment: http://stackoverflow.com/comment/60016293
has body: You cannot instantiate the type Robot. You should rather do : Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
downvote count: 0
has comment: http://stackoverflow.com/comment/60022068
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/86406136

http://stackoverflow.com/q/24205093
tagged with: logging
has body: As disscussed in this link : How to create a own Appender in log4j? For creating a custom appender in log4j 1.x we have to extend the AppenderSkeleton class and implements its append method. Similarly How we can create a custom appender in log4j2 as we dont have AppenderSkelton class to extend and all other appender extend AppenderBase class .
has answer: http://stackoverflow.com/a/40023542
score: 63
type: AnsweredQuestion
answer count: 3
accepted answer: http://stackoverflow.com/a/24220688
upvote count: 63
has title: How to Create a Custom Appender in log4j2?
tagged with: java
possible better answer: http://stackoverflow.com/a/55695950
has answer: http://stackoverflow.com/a/24220688
downvote count: 0
has answer: http://stackoverflow.com/a/55695950
linked to: http://stackoverflow.com/q/6072389
tagged with: log4j
tagged with: log4j2
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/20469810

http://stackoverflow.com/comment/37366006
has text: okay, guys question is solved. Thank you very much for your answer. I wull use winrun4j because the license for tanuki ist too expensive when i will update it..
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24201303

http://stackoverflow.com/a/24307308
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24222937
type: AcceptedAnswer
has body: So the issue was with the functions which I was using. I was using onHandleIntent(intent) which is the wrong function. Right one is onStartCommand(intent, flags, startId) for service. My bad sorry..
answers question: http://stackoverflow.com/q/24222937

http://stackoverflow.com/comment/37462367
comment on: http://stackoverflow.com/a/24249421
type: Comment
has text: the same error with this pattern SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss z");
type: AnswerComment
score: 0

http://stackoverflow.com/a/24144000
answers question: http://stackoverflow.com/q/24143440
type: AcceptedAnswer
downvote count: 0
has body: When Jackson is deserializing your JSON into an object of type A, it sees the following when deserializing for its B field List&lt;C&lt;?&gt;&gt; conditions; Neither you (the programmer), nor Jackson know what type C's parameters field should have. As such, it doesn't have enough information to deserialize like you would want it. Instead, it will use its default type which I believe is a LinkedHashMap (or something similar). Basically, your only option is to give it hints. (Custom) Serialize the object hierarchy with a String value of the Class to deserialize to. You can then have a different strategy for each of those types in your custom deserializer. Since you only have a few types, String or one of the Number classes, you might be better served writing a generic class C and X non generic classes for each of the types class C&lt;T&gt; {} class StringC extends C&lt;String&gt; {} class IntegerC extends C&lt;Integer&gt; {} and use some polymorphic type handling to serialize/deserialize.
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/24143440
has comment: http://stackoverflow.com/comment/94755593
upvote count: 4
has comment: http://stackoverflow.com/comment/37294799

jsf
tags question: http://stackoverflow.com/q/24200483
tags question: http://stackoverflow.com/q/24204375
tags question: http://stackoverflow.com/q/24118288
type: Tag
tags question: http://stackoverflow.com/q/24120921
tags question: http://stackoverflow.com/q/24140829
tags question: http://stackoverflow.com/q/24161456
tags question: http://stackoverflow.com/q/24152780
tags question: http://stackoverflow.com/q/24235036
tags question: http://stackoverflow.com/q/24260274
tags question: http://stackoverflow.com/q/24200753
tags question: http://stackoverflow.com/q/24250244
tags question: http://stackoverflow.com/q/24235298
tags question: http://stackoverflow.com/q/24192046
tags question: http://stackoverflow.com/q/24133968
tags question: http://stackoverflow.com/q/24192024
tag name: jsf
tags question: http://stackoverflow.com/q/24186888
tags question: http://stackoverflow.com/q/24151598
tags question: http://stackoverflow.com/q/24135992
tags question: http://stackoverflow.com/q/24197722
tags question: http://stackoverflow.com/q/24132308
tags question: http://stackoverflow.com/q/24265716
tags question: http://stackoverflow.com/q/24145253
tags question: http://stackoverflow.com/q/24222826
tags question: http://stackoverflow.com/q/24181186
tags question: http://stackoverflow.com/q/24151464
tags question: http://stackoverflow.com/q/24225969
tags question: http://stackoverflow.com/q/24110700
tags question: http://stackoverflow.com/q/24180314
tags question: http://stackoverflow.com/q/24110532
tags question: http://stackoverflow.com/q/24162832
tags question: http://stackoverflow.com/q/24256630
tags question: http://stackoverflow.com/q/24128353
tags question: http://stackoverflow.com/q/24179579
tags question: http://stackoverflow.com/q/24151016
tags question: http://stackoverflow.com/q/24178112
tags question: http://stackoverflow.com/q/24228783
tags question: http://stackoverflow.com/q/24142033
tags question: http://stackoverflow.com/q/24159289
tags question: http://stackoverflow.com/q/24195978
tags question: http://stackoverflow.com/q/24184085
tags question: http://stackoverflow.com/q/24235785

http://stackoverflow.com/q/24127684
type: UnansweredQuestion
downvote count: 0
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/24128266
has body: I have an API where representation of query and entity model is represented by the same class. A simplified version : class Model { private Long id; private Double a; private Double b; ... } The problem is that those properties together make no sense as query object. It does not need id altogether, and a, b are exclusive. Code is hard to understand without proper separation. My plan involves creating separate query classes: A and B for each type of key. What makes me worry though is that in order to avoid using instanceof (any code assuming knowledge of all query types) I will need to implement all cross cutting concerns in query objects. For example, mapping to WHERE clause as part of actual SQL query. To avoid client having implicit dependency on implementation my initial plan is to create server side classes that extend each POJO A and B and implement details there. This requires additional mapping layer to map from A to some other class that will implement a sqlQuery() operation (simplifying matters). Question: Since this seems is complex enough, is there some standard approach for this kind of problem? References, patterns welcome.
has title: Implementing CQRS with OOP in Java
tagged with: cqrs
tagged with: oop
score: 1
tagged with: java
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38730456

http://stackoverflow.com/q/24180772
accepted answer: http://stackoverflow.com/a/24181933
has answer: http://stackoverflow.com/a/24181933
has title: Logback logger logging twice
possible better answer: http://stackoverflow.com/a/59179137
score: 11
tagged with: logback
has comment: http://stackoverflow.com/comment/37325646
tagged with: slf4j
upvote count: 11
type: AnsweredQuestion
has body: I would like to use slf4j+logback for two purposes in my application - log and audit. For logging, I log the normal way: static final Logger logger = LoggerFactory.getLogger(Main.class); logger.debug("-> main()"); For Audit, I create a special named logger and log to it: static final Logger logger = LoggerFactory.getLogger("AUDIT_LOGGER"); Object[] params = { new Integer(1) /* TenantID */, new Integer(10) /* UserID */, msg}; logger.info("{}|{}|{}", params); logback configuration: %d{HH:mm:ss.SSS}|%msg%n %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n Problem: Messages logged through audit logger appear twice - once under the AUDIT_LOGGER and once under the root logger. 14:41:57.975 [main] DEBUG com.gammay.example.Main - -> main() 14:41:57.978|1|10|welcome to main 14:41:57.978 [main] INFO AUDIT_LOGGER - 1|10|welcome to main How can I make sure audit messages appear only once under the audit logger?
has answer: http://stackoverflow.com/a/59325446
answer count: 3
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37325065
has answer: http://stackoverflow.com/a/59179137
favorite count: 0
type: Question

http://stackoverflow.com/comment/37263159
score: 0
has text: Can you explain how this change could solve OP problem?
comment on: http://stackoverflow.com/a/24147219
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24151641
possible better answer: http://stackoverflow.com/a/24152068
tagged with: java
has title: Dynamically retrieving a listener instance by class
tagged with: generics
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24152068
has body: I've made a system for retrieving listener classes by passing a specific class to a getter method. As an example, you can call it like so: GlobalListener lis = /*Manager instance*/.getListener(GlobalListener.class); Where /*Manager instance*/ is an instance of my ListenerManager class that contains the following abbreviated content: public class ListenerManager { private final Project project; private final Map&lt;String, SubListener&gt; listeners = new HashMap&lt;&gt;(); /** * {@link ListenerManager} constructor * * @since 1.0.0 * @version 1.0.0 * * @param plugin The main {@link Project} instance */ public ListenerManager(Project project) { this.project = project; this.registerDefaults(); } private void registerDefaults() { SubListener[] list = new SubListener[] { new GlobalListener(this.project), new ItemListener(this.project) }; for (SubListener lis : list) { this.registerListener(lis); } } /** * Gets a listener by its string name. Returns null if the listener is * disabled or not registered. * * @since 1.0.0 * @version 1.0.0 * * @param &lt;T&gt; The SubListener class * @param listener An instance of the class type extending * {@link SubListener} to retrieve * @return The listener class, null if disabled or not registered */ public &lt;T extends SubListener&gt; T getListener(Class&lt;T&gt; listener) { return listener.cast(this.listeners.get(this.getListenerName(listener))); } /** * Retrieves a listener's name */ protected String getListenerName(Class&lt;? extends SubListener&gt; listener) { try { Method m = listener.getDeclaredMethod("getName"); return (String) m.invoke(null); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { this.project.getLogger().log(Level.SEVERE, "Error reflecting listener field for name!", ex); } return null; } /** * Registers a listener through the plugin manager and {@link ListenerManager} * * @since 1.0.0 * @version 1.0.0 * * @param &lt;T&gt; The {@lin…
accepted answer: http://stackoverflow.com/a/24152060
has answer: http://stackoverflow.com/a/24152060
type: AnsweredQuestion
score: 0
tagged with: reflection

http://stackoverflow.com/q/24149673
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24149826
has body: I am writing an Android app and I need to do something I would consider incredibly simple, yet am having the hardest time figuring out. How can I obtain the path to a JPG file so that I can upload it to a server? The file is snoopy.jpg and is in the res/drawable folder I've tried: File sourceFile = new File("android.resource://com.appname.something/drawable/snoopy"); But, that's not a file I've tried: File sourceFile = new File("drawable/snoopy"); and that doesn't work. I tried putting snoopy.jpg in the root of the app directory and attempting: File sourceFile = new File("/snoopy.jpg"); And that still didn't work. Any help would be greatly appreciated!
has title: Obtain path to file with filename
score: 0
has comment: http://stackoverflow.com/comment/37267914
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10174399
answer count: 1
has comment: http://stackoverflow.com/comment/37267753
duplicate of: http://stackoverflow.com/q/6301493
type: Question
duplicate of: http://stackoverflow.com/q/10174399

http://stackoverflow.com/comment/37194355
has text: Have you tried to restart eclipse? I had a similar error for `java.lang.Object` and restarting helped.
score: 0
comment on: http://stackoverflow.com/q/24110620
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37267674
type: Comment
score: 0
has text: Its not working. I tried. Can you please help.? Here is the link to full code. dropbox.com/s/yk3nwao2yvw0ww1/The%20Project.rar
type: QuestionComment
comment on: http://stackoverflow.com/q/24149285

http://stackoverflow.com/comment/37734728
has text: @Grep, Scriptlets are not deprecated. They're not going to be removed. They're obsolete but they're not going anywhere.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24257736

http://stackoverflow.com/comment/37197322
type: QuestionComment
has text: @AlexandreVandermonde It's strange that there's no append - are you sure the file is writable?
comment on: http://stackoverflow.com/q/24112096
score: 0
type: Comment

http://stackoverflow.com/q/24137930
has body: I have a custom notification with three buttons ("previous", "Play/pause", "Next"). I can catch click event only when there is one button, but with the three buttons i can't know which button of them is clicked. My question is "How to know which button is clicked?" my notification code private void initNotification() { String ns = Context.NOTIFICATION_SERVICE; int icon=R.drawable.tmc; long when=System.currentTimeMillis(); Notification notification=new Notification(icon, "The Music Class", when); NotificationManager mnNotificationManager=(NotificationManager)getSystemService(ns); RemoteViews conViews=new RemoteViews(getPackageName(),R.layout.notification); conViews.setImageViewResource(R.id.image, R.drawable.tmc); conViews.setTextViewText(R.id.title, Song_Title); notification.contentView=conViews; Intent nIntent=new Intent(this,MusicPlayerActivity.class); PendingIntent conPendingIntent=PendingIntent.getActivity(getBaseContext(), 0,nIntent,0); notification.contentIntent=conPendingIntent; notification.flags |= Notification.FLAG_NO_CLEAR; //Do not clear the notification // notification.defaults |= Notification.DEFAULT_LIGHTS; // LED // notification.defaults |= Notification.DEFAULT_VIBRATE; //Vibration // notification.defaults |= Notification.DEFAULT_SOUND; //this is the intent that is supposed to be called when the button is clicked Intent switchIntent = new Intent(getBaseContext(), switchButtonListener.class); PendingIntent pendingSwitchIntent = PendingIntent.getBroadcast(getBaseContext(), 0, switchIntent, 0); conViews.setOnClickPendingIntent(R.id.btnPlay, pendingSwitchIntent); mnNotificationManager.notify(NOTIFICATION_ID, notification); } switchButtonListener Class public static class switchButtonListener extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("Here", "I am here"); } } in my manifest file
score: 0
tagged with: java
answer count: 1
type: Question
has title: Handle buttons click event in custom notification in android
has comment: http://stackoverflow.com/comment/37245341
has comment: http://stackoverflow.com/comment/37245277
has answer: http://stackoverflow.com/a/24138112
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/24254838
tagged with: android
accepted answer: http://stackoverflow.com/a/24256219
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24256219
has comment: http://stackoverflow.com/comment/37469363
upvote count: 2
has title: LibGDX + Box2D | Camera too big
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37467161
favorite count: 0
has body: I use one camera at the moment to draw the Box2DDebugRenderer and one for drawing the map from the tmx. file. My problem is that, although the cameras have the SAME definition. The camera that is used for drawing the map is way too big on the screen. SCREENSHOT Of the Problem: Definition for box2dCam: b2dCam = new OrthographicCamera(); b2dCam.setToOrtho(false, Game.getWidth() / PPM, Game.getHeight() / PPM); b2dCam.update(); Definition for regular Camera: cam = new OrthographicCamera(); cam.setToOrtho(false, Game.getWidth() / PPM, Game.getHeight() / PPM); cam.update(); PPM (pixels per meter) is 32. Code Game-class (regular camera is getting defined there!): http://pastebin.com/FcCD5SLZ Code for Play-GameState (box2dCam get's defined and also both cams get moved to player position): http://pastebin.com/FcCD5SLZ Anybody has any idea why that happens?
type: Question
tagged with: libgdx

http://stackoverflow.com/comment/37455425
type: QuestionComment
comment on: http://stackoverflow.com/q/24247898
has text: Why are you securing your keystore? Isn't it a public key?
score: 0
type: Comment

http://stackoverflow.com/q/24242141
type: UnansweredQuestion
answer count: 1
upvote count: 1
linked to: http://stackoverflow.com/q/15974474
tagged with: postgresql
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
tagged with: gson
has title: How to store Gson object as a Json type in postgres
has body: I have datatype called "json" in postgres db. I wanted to insert data gson object from java code. How can i insert gson object data into json column of table in postgres database? Can any one help me? Thanks,
favorite count: 0
has answer: http://stackoverflow.com/a/24242423
type: Question

http://stackoverflow.com/comment/37199893
comment on: http://stackoverflow.com/q/24113170
type: QuestionComment
has text: Mind updating your question for clarity then? There's [this](https://stackoverflow.com/questions/2979383/java-clear-the-console) for a start
score: 0
type: Comment

http://stackoverflow.com/a/24177101
has comment: http://stackoverflow.com/comment/37400789
type: Answer
score: 0
has body: If you are transmitting data from java to android app in LAN then you can use TCp/UDP for real time data transfer between java and android app. In one of my project i was in same situation but i want to transfer string from android app to java application in pc. In LAN i use TCP. java app was listening for tcp connection and when android app send request to java app for connection then data was also transfer. you can use this scenario for your problem
answers question: http://stackoverflow.com/q/24176969

http://stackoverflow.com/comment/37197500
has text: Thanks McDowell, I changed Eclipse version to Juno, now it works!
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24110620
type: Comment

http://stackoverflow.com/q/24175664
score: 3
upvote count: 3
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/15971288
has comment: http://stackoverflow.com/comment/37316233
type: Question
has body: I am new to Spring and wanted your all assistance. I have run into the "expected single match bean but found two" exception. I have searched for the solution and think have understood the solution. Most solutions suggest using @Qualifier to resolve this exception. However I don't think it will solve my issue. Below is my class hierarchy: abstract class A{ @Autowired Client client; protected void doSomething(){ /* ....some code .... */ client.someStuff(); /* ....some code .... */ } /* ..... few abstract methods ......... */ } class B extends A{ public void action(){ doSomething() } } class C extends A{ public void action(){ doSomething() } } My .xml confirugration file is &lt;bean id="authClientA" class="com.xyz.Client"&gt; &lt;property name="auth" value="abc"&gt; &lt;/bean&gt; &lt;bean id="authClientB" class="com.xyz.Client"&gt; &lt;property name="auth" value="xyz"&gt; &lt;/bean&gt; &lt;bean id="beanA" class="ClassA"&gt; &lt;property name="client" ref="authClientA"&gt; &lt;/bean&gt; &lt;bean id="beanB" class="ClassB"&gt; &lt;property name="auth" ref="authClientB"&gt; &lt;/bean&gt; So basically, I have an abstract class which has a method which will be common to both the subclasses. This method uses the client reference but at run time will use different object. doSomething() is not overridden in the subclasses. So when I try to run this code, it gives me the exception for client reference. I dont think I can use @Qualifier because @Qualifier requires to specify bean name from .xml as parameter, but since the 'client' attribute is common, I cant use only one bean name. Can someone please assist in explaining if there is a way to get around. Duplicating the doSomething() method defeats the entire purpose of inheritance and will cause duplicate code across classes. I can't have the client attribute in the subclasses as it will become unknown to doSomething() method at compile time. Any ideas/suggestions/solutions will be helpful. Thanks in advance :)
type: UnansweredQuestion
answer count: 1
tagged with: spring
has title: Spring @Autowire with Inheritance
tagged with: inheritance
tagged with: autowired
favorite count: 0
has answer: http://stackoverflow.com/a/24175900

http://stackoverflow.com/comment/37579464
comment on: http://stackoverflow.com/q/24194606
type: QuestionComment
has text: Based on the function titles it seems there are many ways, can you humor me with an example?
type: Comment
score: 0

http://stackoverflow.com/comment/37323620
type: QuestionComment
score: 0
has text: @EJP If you want a pure OO language, try Smalltalk. Everything is an object in Smalltalk. This is not the case for Java, where primitive types (int, float) aren't objects by themselves.
type: Comment
comment on: http://stackoverflow.com/q/24179497

http://stackoverflow.com/a/24115934
downvote count: 0
answers question: http://stackoverflow.com/q/24115822
score: 3
has comment: http://stackoverflow.com/comment/37203988
has comment: http://stackoverflow.com/comment/37204345
has body: If you are using Eclipse IDE or IBM RAD, WSAD etc, Press Ctrl+Shift+T in eclipse window. Now type the name of the class file. It will show the contained jar. For eg: HttpExchange is present in rt.jar
type: Answer
has comment: http://stackoverflow.com/comment/37204118
accepted answer of: http://stackoverflow.com/q/24115822
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/24237683
type: Question
tagged with: split
upvote count: 2
tagged with: regex
type: AnsweredQuestion
score: 2
has body: I want to extract and split string which contains alpha and numeric characters separately. Eg String: 2Xccc7.08DD Output should be : [2,Xccc,7.08,DD] I tried it using this code but it does not work. myString.split("(\\d+|[a-zA-Z]+)");
tagged with: tokenize
has comment: http://stackoverflow.com/comment/37433996
accepted answer: http://stackoverflow.com/a/24237811
tagged with: java
has answer: http://stackoverflow.com/a/24237811
answer count: 1
has title: Extract Alpha and Numerics with decimals separately containg String using java regular expressions
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24248499
tagged with: nested
has answer: http://stackoverflow.com/a/24248565
accepted answer: http://stackoverflow.com/a/24249111
has answer: http://stackoverflow.com/a/24248580
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24248553
possible better answer: http://stackoverflow.com/a/24248553
tagged with: for-loop
has answer: http://stackoverflow.com/a/24248616
answer count: 5
tagged with: arrays
has body: So, I generate a 100 numbers between the range of 0 and 9. I store these 100 numbers in an array called 'array'. Then I have the array called 'count'. It has 10 elements, and I wanted to check the following: for each element in 'array' if it equals to 0-9 then count[0-9] increments by 1, count[0] = how many times number 0 appears and so on count[1] = 1, count[2] = 2... . I just keep getting the output of around 20k numbers and i suppose? the sum of each element?, no idea why. I was wondering if there is something major wrong with my for loop? import java.util.*; class RandomInt { public static void main(String[] args) { int size = 100; int max = 10; int[] array = new int[size]; int[] count = new int[max]; //count[0,0,0,0,0,0,0,0,0,0] int loop = 0; Random generator = new Random(); for (int i = 0; i &lt; size; i++) { array[i] = generator.nextInt(max); // Generates 100 random numbers between 0 and 9 and stores them in array[] System.out.print(array[i]); for (int x = 0; x &lt; size; x++) {// loop through 10 elements in count for(int j = 0; j &lt; 10; j++){ //loop through 100 elements in array if (array[x] == j) {// loop through each 100 elements of array[x] and if element array[x] = value count[j] += 1; // then count[x] = x + 1 System.out.print(count[j]); } } } } System.out.println("0 appears " + count[0] + " times."); } }
has comment: http://stackoverflow.com/comment/37454519
has title: Is there something wrong with my nested for-loop? counting and incrementing values of arrays
has answer: http://stackoverflow.com/a/24249111
type: AnsweredQuestion
score: 2
tagged with: random
downvote count: 0
tagged with: java

http://stackoverflow.com/a/24116640
has comment: http://stackoverflow.com/comment/37205293
answers question: http://stackoverflow.com/q/24116587
has comment: http://stackoverflow.com/comment/37205234
has body: The keyboard itself decides what to do with the ime options. Your keyboard may have decided not to display ime option strings. I don't blame them- having done it, morphing the enter key like that is a pain in the ass, and as many users complained about it as liked it. There's no way to force it to, it depends on that particular keyboard having decided to code it in.
has comment: http://stackoverflow.com/comment/37205219
type: Answer
has comment: http://stackoverflow.com/comment/37205158
score: 0

http://stackoverflow.com/q/24128543
type: UnansweredQuestion
downvote count: 0
answer count: 1
upvote count: 1
has body: I'd like to create a Java servlet that talks to an OpenID end-point, and returns JSON containing the user's email address { "email": "email@example.com" } if the user is logged-in, and a friendly error message such as { "error": "No user is logged in." }. From the client's (web browser's) point-of-view, a request is being made to the above servlet and one of the above two types of responses are received: no redirects, or login screens. How can this be achieved?
favorite count: 0
tagged with: openid
has answer: http://stackoverflow.com/a/24128770
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How to retrieve the current authenticated user using OpenID?
tagged with: servlets
type: Question

http://stackoverflow.com/comment/37195904
type: AnswerComment
comment on: http://stackoverflow.com/a/24110896
has text: I have super.paint(g) as the first line of the paint method in the tennisGame class.
type: Comment
score: 0

http://stackoverflow.com/comment/37211670
type: Comment
type: AnswerComment
has text: please refer this post answered by the logback author ceki http://stackoverflow.com/questions/7934829/logback-set-max-history-files-per-day
score: 0
comment on: http://stackoverflow.com/a/24119427

http://stackoverflow.com/a/24186731
score: -1
has comment: http://stackoverflow.com/comment/37336089
type: Answer
has body: deviceID[i] just gets the i'th element in deviceID and does nothing with it. deviceID = deviceID[i] is trying to assign an int to an object declared as a list, hence your error. What you want to do is: List&lt;int&gt; deviceID = new List&lt;int&gt;() for(int i = 292; i &lt;= 305; i++) { deviceID.add(i); } This should give you a list with only the numbers 292-305 in it
upvote count: 0
answers question: http://stackoverflow.com/q/24186437
downvote count: 1
has comment: http://stackoverflow.com/comment/37336610

http://stackoverflow.com/a/24241187
downvote count: 0
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24241059
type: Answer
has body: You could do it like this: final String locat = "london BLANCHE CAFE ET COCKTAIL BAR"; final String[] words = locat.split(" "); final StringBuilder newLocat = new StringBuilder(); for (int i = 0; i &lt; words.length; i++) { if ((i &gt; 0) &amp;&amp; (0 == (i % 3))) { newLocat.append('\n'); } newLocat.append(words[i]); if (i != (words.length - 1)) { newLocat.append(' '); } } System.out.println(newLocat);

http://stackoverflow.com/a/24256777
has comment: http://stackoverflow.com/comment/37470624
accepted answer of: http://stackoverflow.com/q/24256733
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24256733
has body: why does the method take (View view) instead of just (view)? View means it is a class and view is just a variable adding those 2 is making the view variable an object of View class that can call all of its method.
score: 1
has comment: http://stackoverflow.com/comment/37470662
type: Answer

http://stackoverflow.com/a/24261229
type: Answer
answers question: http://stackoverflow.com/q/24261062
has comment: http://stackoverflow.com/comment/37478613
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: If I got you right, option number 1 should work. You currently have a webapplication running on your local machine. So you can enter something like http://localhost:8080/myapp in your browser and see a webpage from your application. Next step to replace localhost with an ip adress or computer name. So still on the same computer the following should work: http://192.168.123.1:8080/myapp and http://mycomputer:8080/myapp. Of course I just made the ip address and the computer name up and you have the real values. These two urls should also work from a remote computer that is on the same network. Like the computer of you coworker, or the second computer in your home network. Possibly the next step would be to deploy your application on a cloud service. But that is a different story worth its own question.
accepted answer of: http://stackoverflow.com/q/24261062

http://stackoverflow.com/comment/37295168
type: Comment
has text: @Mohammadaltaani To mark an answer as accepted, click on the check mark beside the answer to toggle it from greyed out to filled in.And to upvote click upper arrow.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24164126

http://stackoverflow.com/comment/37501157
type: AnswerComment
has text: I included your answer in my question's test-code. And it's getting even weirder. As you can see in the first case it prodces an error and in the second case it works.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24263591

jquery
tags question: http://stackoverflow.com/q/24261242
tags question: http://stackoverflow.com/q/24148290
tags question: http://stackoverflow.com/q/24201326
tags question: http://stackoverflow.com/q/24203030
type: Tag
tag name: jquery
tags question: http://stackoverflow.com/q/24124983
tags question: http://stackoverflow.com/q/24193029
tags question: http://stackoverflow.com/q/24252739
tags question: http://stackoverflow.com/q/24140501
tags question: http://stackoverflow.com/q/24182282
tags question: http://stackoverflow.com/q/24130083
tags question: http://stackoverflow.com/q/24159879
tags question: http://stackoverflow.com/q/24113330
tags question: http://stackoverflow.com/q/24151037
tags question: http://stackoverflow.com/q/24108520
tags question: http://stackoverflow.com/q/24118155
tags question: http://stackoverflow.com/q/24182845
tags question: http://stackoverflow.com/q/24254182
tags question: http://stackoverflow.com/q/24120921
tags question: http://stackoverflow.com/q/24141156
tags question: http://stackoverflow.com/q/24193651
tags question: http://stackoverflow.com/q/24234137
tags question: http://stackoverflow.com/q/24264885
tags question: http://stackoverflow.com/q/24163560
tags question: http://stackoverflow.com/q/24217813
tags question: http://stackoverflow.com/q/24141219
tags question: http://stackoverflow.com/q/24175194

http://stackoverflow.com/q/24178037
answer count: 2
type: UnansweredQuestion
has title: How I affect another file with code from one?
tagged with: swing
has answer: http://stackoverflow.com/a/24178132
score: 0
tagged with: oop
has comment: http://stackoverflow.com/comment/37320398
has answer: http://stackoverflow.com/a/24178135
tagged with: java
has body: In NetBeans 8.0, I made a Paint Program and I needed the code from my main file to affect something in my other file, an interface file. How can I do this? My code: package paintapp; import java.awt.event.ActionEvent; import javax.swing.*; import java.awt.event.ActionListener; public class PaintApp extends javax.swing.JFrame { int colourR, colourG, colourB; static String Ccolour = "BLACK"; public static void main(String[] args) { JFrame main = new JFrame("Tessellating Pi - Paint"); PaintInterface pi = new PaintInterface(); main.add(pi); main.setSize(1000, 1000); main.setVisible(true); JFrame j = new JFrame("Colour Chooser"); JButton c = new JButton("Change Colour"); j.add(c); j.setSize(150, 100); j.setVisible(true); c.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if ("BLACK".equals(Ccolour)) { Ccolour = "RED"; //code to change code in interface to set colour to red } } } ); } } This is the Interface: import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.*; public class PaintInterface extends JPanel implements MouseListener, MouseMotionListener { static int x = 0, y = 0; @Override public void paint(Graphics g) { this.setBackground(Color.white); this.addMouseMotionListener(this); this.addMouseListener(this); g.setColor(Color.black); g.fillRect(x, y, 3, 3); } @Override public void mouseDragged(MouseEvent e) { x = e.getX(); y = e.getY(); repaint(); } @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseMoved(MouseEvent e) { } } I need to transmit the message to the Interface that I changed the colour. How do I do this? Is there an alternative method of doing this?
type: Question
tagged with: netbeans

http://stackoverflow.com/q/24143460
has comment: http://stackoverflow.com/comment/37258705
has comment: http://stackoverflow.com/comment/37257085
downvote count: 0
has comment: http://stackoverflow.com/comment/37257791
has comment: http://stackoverflow.com/comment/37256424
has answer: http://stackoverflow.com/a/24179772
tagged with: spring
has comment: http://stackoverflow.com/comment/37258032
has comment: http://stackoverflow.com/comment/37259082
has comment: http://stackoverflow.com/comment/37311734
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/24179772
upvote count: 3
tagged with: java
has title: Spring Webflow, the ID and version get stripped
answer count: 1
has body: I recently came across a strange error with Spring Webflow and I can't seem to find the problem, and noone ever experienced that, it seems. When starting my flow I load from the database an object which the user will then modify in the flow. As the object is loaded, every property is correctly binded: while debugging the on-entry function, the object has all properties set. After that, though, when the view has been rendered, the object's "id" and "version" fields suddenly become null, so &lt;form:hidden path="id" /&gt; or &lt;form:hidden path="version" /&gt; do not display anything. I don't know where to start and I don't want to put here useless code, so if you need some part of my code just ask. Additional informations: I also tried to forcefully modify those fields by using &lt;form:input path="id" /&gt; and trying to manually put some values inside and submitting the form, with no luck. Important update It seems that this problem happens with every "complex" object, let's say that MyForm has another class in it, called B. If that B contains only basic types such as Integer and String, they are correctly stored and retrieved with their id and version field, if that B has other kind of object fields in it (a C class), then their id and version disappears. Excerpt of the flow configuration that interests the view. Please note that every data is viewed correctly in the form except the id and version fields. FLOW: &lt;input name="idObj" /&gt; &lt;decision-state id="createOrEdit"&gt; &lt;if test="idObj== null" then="newObj" else="modObj" /&gt; &lt;/decision-state&gt; ... &lt;action-state id="modObj"&gt; &lt;evaluate expression="Search.findOne(idObj)" result="flowScope.form"/&gt; &lt;transition to="object" /&gt; &lt;/action-state&gt; &lt;view-state id="object" view="flow.object" model="form"&gt; &lt;on-entry&gt; &lt;evaluate expression="handler.prepare(flowScope.form)"/&gt; &lt;/on-entry&gt; &lt;!-- transitions omitted --&gt; &lt;/view-state&gt; VIEW: &lt;form:form mo…
has comment: http://stackoverflow.com/comment/37319652
favorite count: 0
type: Question
tagged with: spring-webflow

http://stackoverflow.com/a/24115084
downvote count: 0
score: 3
has body: You cannot cast from a referenced data-type to a primitive data-type i.e. you cannot: Object x = (int)a; You can however do: Object x = (Integer)a; because Integer is a class and int is a primitive data-type. If I assume it correctly, the functionality you want to achieve is get the integer's value from Object x which can be done as: Object x = (Integer)a; //Do something and somewhere else int z = ((Integer)x).intValue(); This may through a ClassCastException if it is not of Integer class.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/24115021

http://stackoverflow.com/q/24108591
has answer: http://stackoverflow.com/a/24121796
tagged with: jvm
has title: Overhead of enabling JVMTI *capability* to query local variables
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I'm working on a simple dynamic language that runs on the JVM. One of the required capabilities is this: only when an exception is thrown, I need to be able to query the local variables for all frames in the call stack at the time the exception is thrown. This capability is not available in standard Java or reflection. Thus I'm looking at the following idea: Write a simple JVMTI shared object in C When an exception gets thrown in Java-land, trigger a JVMTI function Code in the JVMTI lib suspends the Java thread that threw the exception, inspects the stack to pull out the locals, stores them somewhere accessible, and resumes the Java thread Other than in this one scenario, JVMTI would not be used at all. Code could potentially run for days without throwing an exception and I would hope it would run as fast as non-JVMTI enabled code. So my question is: in the mainstream JVM implementations (ie Oracle), what is the overhead of enabling the JVMTI features I need? For example, would doing so disable JIT'ing? My best guess of the JVMTI "capabilities" I need is: can_signal_thread can_get_source_file_name can_get_source_debug_extension can_access_local_variables
upvote count: 2
score: 2
tagged with: debug-symbols
downvote count: 0
tagged with: jvmti
tagged with: java
answer count: 1

http://stackoverflow.com/a/24126793
has body: Is there any documentation on this? It might help you Oracle Doc - Expressions, Statements, and Blocks Expression An expression is a construct made up of variables, operators, and method invocations, which are constructed according to the syntax of the language, that evaluates to a single value. Statements Statements are roughly equivalent to sentences in natural languages. A statement forms a complete unit of execution. The following types of expressions can be made into a statement by terminating the expression with a semicolon (;). Assignment expressions Any use of ++ or -- Method invocations Object creation expressions Such statements are called expression statements. In addition to expression statements, there are two other kinds of statements: declaration statements control flow statements A declaration statement declares a variable. For example // declaration statement double aValue = 8933.234; Blocks A block is a group of zero or more statements between balanced braces and can be used anywhere a single statement is allowed.
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24126719
score: 1

http://stackoverflow.com/a/24141758
has comment: http://stackoverflow.com/comment/37252276
score: 0
has body: Put: FragmentManager fragmentManager = getSupportFragmentManager(); instead of: FragmentManager fm = getFragmentManager(); Edit: If you are not using support library than this is probably not the reason for exception. I will give you example how do i do it: FragmentManager fragmentManager = getSupportFragmentManager(); Fragment fragment = (ListFragment) fragmentManager .findFragmentByTag("List"); if (fragment != null) { fragmentManager.beginTransaction() .add(R.id.fragment, fragment, "List").addToBackStack("List") .commit(); } So, i am not using findFragmentById. I am using findFragmentTag and when i replace (or add) fragment, i put a tag ("List"). ListFragment is custom fragment i created.
upvote count: 1
has comment: http://stackoverflow.com/comment/37254778
downvote count: 1
answers question: http://stackoverflow.com/q/24141694
type: Answer

http://stackoverflow.com/comment/37191749
type: AnswerComment
comment on: http://stackoverflow.com/a/24109252
has text: I close my app and and tried to rerun my codes nothing is shown up now.
type: Comment
score: 0

http://stackoverflow.com/comment/37202339
has text: Very possible that it seems to contain a singular `_id` value that is not being overwritten. That generates on the client by default. But what I am saying is there not the relevant code posted here for anyone to tell for sure. It certainly seems that way by the error being produced. It would be clearer if we could see the code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24114670
score: 1

http://stackoverflow.com/comment/37241327
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24116858
has text: Don't use a TextArea, use a virtualized control, i.e. [ListView](http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/ListView.html).
score: 0

http://stackoverflow.com/a/24225392
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37413751
has body: I think I understand what you're asking in which case it's really more of an arithmetic than a programming question but here it is anyway. Try a concrete example. If you have the sum with i from 1 to 10 of i % 3, what you are adding its 1 + 2 + 0 + 1 + 2 + 0 + 1 + 2 + 0 + 1. You can see that you have the same thing over and over so what you need to do is figure out what that is, figure out how many times you need to add it, then add on the leftover bit on the end.
type: Answer
answers question: http://stackoverflow.com/q/24224092
has comment: http://stackoverflow.com/comment/37420354
downvote count: 0

http://stackoverflow.com/a/24231109
has comment: http://stackoverflow.com/comment/37421314
has comment: http://stackoverflow.com/comment/37421535
has comment: http://stackoverflow.com/comment/37421330
has comment: http://stackoverflow.com/comment/37421209
type: Answer
has comment: http://stackoverflow.com/comment/37421182
answers question: http://stackoverflow.com/q/24231097
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37421549
has body: Change to Toast.makeText(this, String.valueOf(Counter), Toast.LENGTH_SHORT).show(); Counter is a int value ( should be named according to java naming conventions. c should be small not ins caps). It looks for resource with the id if not found you get ResourceNotFoundException. There is one that takes int which is a resource id. What you want is the one that takes CharacterSequence. If you look at the docs the second param is a CharacterSequence. So use String.valueOf(intvlaue) public static Toast makeText (Context context, CharSequence text, int duration) Added in API level 1 Make a standard toast that just contains a text view. Parameters context The context to use. Usually your Application or Activity object. text The text to show. Can be formatted text. duration How long to display the message. Either LENGTH_SHORT or LENGTH_LONG Edit: To the Edited post The views belong to the fragment. So you initialize views in onCreateView of Fragment using rootView.findViewById Or if you set fragment_main.xmlto activity get rid of the if block and the fragment related code. Your tutorial seems to be outdated. Follow NullPointerException accessing views in onCreate() Edit 2: Get rid of android:onClick="Button1Click" in fragment_main.xml for button Remove public void Button1Click(View view) { Counter+=1; Toast.makeText(this, "Added 1", Toast.LENGTH_SHORT).show(); countView.setText(String.valueOf(Counter)); } Then in Fragment public static class PlaceholderFragment extends Fragment { TextView countView; int Countter; public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); TextView countView = (TextView)(TrootView.findViewById(R.id.CountView); Button button = (TextView)(TrootView.findViewById(R.id.buttonid); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { Counter+=1; Toast.makeText(getAct…

orientation
tags question: http://stackoverflow.com/q/24238621
type: Tag
tag name: orientation

http://stackoverflow.com/comment/37422954
comment on: http://stackoverflow.com/q/24222991
score: 0
has text: @user3580294 Actually, I wanted to write a benchmark I promised in this [question](http://stackoverflow.com/q/4885095/581205), but stumbled upon this strangeness. It's just curiosity, no practical use for my job (apart from learning more being always good).
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24159289
favorite count: 0
type: Question
tagged with: jsf-2
accepted answer: http://stackoverflow.com/a/24159448
has answer: http://stackoverflow.com/a/24159448
downvote count: 0
answer count: 1
upvote count: 1
type: AnsweredQuestion
tagged with: jsf
has title: if else conditional in JSF
linked to: http://stackoverflow.com/q/4870462
score: 1
tagged with: java
has body: I tried apply rendered in order to check for if else conditional in JSF. (ref: Conditionally displaying JSF components) This part is my JSF index.html &lt;p:commandButton value="Update Hidden Label" action="#{carForm.updateBool}" /&gt; &lt;h:outputText value="Text A" /&gt; &lt;h:outputText value=" Text B" rendered="#{carForm.booleanValue}" /&gt; This is my java class private boolean booleanValue; public boolean isBooleanValue() { return booleanValue; } public void setBooleanValue(final boolean booleanValue) { this.booleanValue = booleanValue; } public void updateBool() { booleanValue = true; } when I tried click on "Update Hidden Label", it would update the booleanValue in java class to true, however in index.html page "Text B" is still not appear yet.

http://stackoverflow.com/comment/37309232
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24171653
has text: I knew there would be some performance penalty for doing that many queries, but I just didn't think it would be that severe. I'm thinking of just pulling the 2 columns that I'm interested in from "Table B" into a hash in memory (they're just integers). Can you suggest an alternative? Also, adding a table index is not an option for me.
score: 0

http://stackoverflow.com/a/24254740
type: Answer
answers question: http://stackoverflow.com/q/24247490
has body: When using an iframe, you will first have to switch to the iframe, before selecting the elements of that iframe You can do it using: driver.switchTo().frame(driver.findElement(By.id("frameId"))); //do your stuff driver.switchTo().defaultContent(); In case if your frameId is dynamic, and you only have one iframe, you can use something like: driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
score: 69
upvote count: 69
downvote count: 0
has comment: http://stackoverflow.com/comment/79674770

resin
tags question: http://stackoverflow.com/q/24191527
type: Tag
tag name: resin

http://stackoverflow.com/comment/37477672
has text: what I meant was gridlayout is gridlayout is scrollable. Also scrollview is scrollable. When user try to scroll your gridlayout which is inside scrollview what will you scroll gridlayout or scrollview?? This will bring inconsistency as which element is to receive the event of scrolling. Try searching scrollview inside scrollview
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24259157
score: 0

http://stackoverflow.com/q/24164498
has body: I have a maven antrun task specified in my pom file, and its job is to copy some files from one place to another on compile phase. However ant does not recognized eclipse.home variable ?.. i tried with other variables and i am just running blank? What variables does maven-antrun-plugin have?? my plugin: org.apache.maven.plugins maven-antrun-plugin 1.7 compile <fileset dir="${eclipse.home}/workspace/location/src/main/webapp/realtime" /> <fileset dir="${eclipse.home}/workspace/location/src/main/webapp/reports" /> run Thanks
tagged with: java
answer count: 1
tagged with: eclipse
type: Question
type: UnansweredQuestion
tagged with: ant
tagged with: maven
has title: maven ant task variable issue
has answer: http://stackoverflow.com/a/24164935
score: 0

http://stackoverflow.com/q/24264493
has title: jpql compare string as int
has body: I have object called info class info @Column(name="id") int id @Column(name="system") string system @Column(name="triesErrCount") string triesErrCount and same type in DB. Now triesErrCount is String (in the class and in DB (varchar)), but in my db it's all like numbers ("1","7","56"...). I try to get all infos that are less then 50, I try this: SELECT x from PaymentInfo x where x.triesErr &lt;=:triesErrAsString triesErrAsString = "50" in jpql But it's not working, I also try: class info @Column(name="id") int id @Column(name="system") string system @Transient string triesErrCount @Column(name="triesErrCount") int triesErrCountAsInt SELECT x from PaymentInfo x where x.triesErr &lt;=:triesErrAsInt triesErrAsInt = 50 But still not working. I'm using jpa 1.0. and OpenJPA 1.2.1
score: 0
type: UnansweredQuestion
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/24286283
tagged with: jpql
type: Question
has comment: http://stackoverflow.com/comment/37489069
tagged with: java
has comment: http://stackoverflow.com/comment/37487066
tagged with: db2
has comment: http://stackoverflow.com/comment/37486359

http://stackoverflow.com/q/24134372
type: Question
has comment: http://stackoverflow.com/comment/37238665
has comment: http://stackoverflow.com/comment/37241503
has comment: http://stackoverflow.com/comment/37239372
has title: Using Executer in a daemon process
tagged with: threadpool
has comment: http://stackoverflow.com/comment/37241860
tagged with: executorservice
has comment: http://stackoverflow.com/comment/37243985
has body: We have a daemon process which has to execute everytime and look for the new request to process.Since we have 5 servers where we need to execute the process, current daemon process is creating 5 threads by using newFixedThreadPool of executer service. Once the job is done we are shuttingdown the executer. When this job deployed in production unix server, after few days of running it hanged.Through the logs we see that all executer threads have finished their job but after executing shutdown it got hanged. I assume in this case,executer has not proprly shut down and since we are checking if it's terminated in a for loop.That loop could be running indefinately and hence no further processing. Please share your thoughts what could be the other reason. Code: do { executor = Executors.newFixedThreadPool(5); startTime=System.currentTimeMillis(); for (int i = 0; i &lt; str.length(); i++) { if(str.charAt(i)!='-'||str.charAt(i)!=','||str.charAt(i)!='.'||str.charAt(i)!='|') { if(str.charAt(i)=='5'||str.charAt(i)=='6'||str.charAt(i)=='7'||str.charAt(i)=='8'||str.charAt(i)=='9') { String s=str.substring(i, i+1); Runnable worker = new ExecuteThread(s,batchtype); executor.execute(worker); } } } executor.shutdown(); while (!executor.isTerminated()) { } } while(batchtype == 2); To resolve this i have included shutdownNow method now and thinking to remove infinite loop where we are checking if the executer is terminated. Please share your views if the below code would be sufficient to curb the error. do { executor = Executors.newFixedThreadPool(5); startTime=System.currentTimeMillis(); for (int i = 0; i &lt; str.length(); i++) { if(str.charAt(i)!='-'||str.charAt(i)!=','||str.charAt(i)!='.'||str.charAt(i)!='|') { if(str.charAt(i)=='5'||str.charAt(i)=='6'||str.charAt(i)=='7'||str.charAt(i)=='8'||str.charAt(i)=='9') { String s=str.substring(i, i+1); Runnable worker = new ExecuteThread(s,batchtype); executor.execute(worker); } } } executor.shutdown(); // FIX try { if (!executor.awaitTer…
has comment: http://stackoverflow.com/comment/37239738
has comment: http://stackoverflow.com/comment/37238723
answer count: 0
has comment: http://stackoverflow.com/comment/37239556
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37239113

http://stackoverflow.com/q/24147661
has comment: http://stackoverflow.com/comment/37265077
tagged with: java
has comment: http://stackoverflow.com/comment/37263770
has comment: http://stackoverflow.com/comment/37264307
type: Question
has comment: http://stackoverflow.com/comment/37263893
has title: HTTP conversation is not persistent
has comment: http://stackoverflow.com/comment/37266420
answer count: 0
has comment: http://stackoverflow.com/comment/37264986
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37263683
has comment: http://stackoverflow.com/comment/37267375
has comment: http://stackoverflow.com/comment/37265110
has comment: http://stackoverflow.com/comment/37264253
tagged with: http
has comment: http://stackoverflow.com/comment/37263501
has comment: http://stackoverflow.com/comment/37264165
has body: I need to build a Java server where the client sends an HTTP request, the server sends an HTTP response, the client sends another HTTP request, and the server sends a final response. However, after the server sends the first response to the request, the connection times out. I realized that the client isn't even reading my response until I close the input stream, but this ends the conversation prematurely. Here is the run method for my class ServerThread, which extends Thread. public void run() { try { l.add(index, serv.accept()); new ServerThread(serv, l, index + 1).start(); Socket socket = (Socket)l.get(index); index++; while(true) { while(socket.getInputStream().available() == 0) {} while(socket.getInputStream().available() &gt; 0) System.out.print((char)socket.getInputStream().read()); BufferedWriter b = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); b.write("HTTP/1.1 200 OK\n" + "Connection: keep-alive"); b.flush(); //b.close(); } } catch (IOException e) { } } Basically, this code accepts a client and blocks until there is information in the input stream. After there is information, it prints out the request and writes a 200 OK response to the client regardless of the request and keep the connection alive. When I comment out the b.close() call, the conversation hangs, but as soon as I stop the server, the client reads the response. How do I get around this?
has comment: http://stackoverflow.com/comment/37265390
score: 0
has comment: http://stackoverflow.com/comment/37265581

http://stackoverflow.com/q/24120045
has comment: http://stackoverflow.com/comment/37212174
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24120590
has comment: http://stackoverflow.com/comment/37211958
upvote count: 1
answer count: 1
downvote count: 1
has body: I need to find the minimum and maximum values as I iterate through the map element by element as shown ("index" is the position of the key Array of the map): /**even: lowest, odd: highest*/ private Double[] getLowestAndHighestValues(final int index, final int timeRange, ConcurrentSkipListMap&lt;String, Double&gt; ... maps){ if(maps != null &amp;&amp; maps.length &gt; 0){ ArrayList&lt;Object[]&gt; keyArrayList = new ArrayList&lt;&gt;(); for(int i = 0; i &lt; maps.length; i++){ try{ ConcurrentSkipListMap&lt;String, Double&gt; map = maps[i]; keyArrayList.add(map.keySet().toArray()); } catch(Exception e){ } } Double[] values = new Double[maps.length * 2]; for(int i = index - timeRange; i &lt; index; i++){ if(i &gt;= 0){ for(int x = 0; x &lt; maps.length; x++){ try{ if(x &gt;= 0){ ConcurrentSkipListMap&lt;String, Double&gt; map = maps[x]; if(map != null){ final Object[] keyArray = keyArrayList.get(x); final String key = (String) keyArray[i]; Double value = map.get(key); if(value != null &amp;&amp; !Double.isNaN(value)){ if(values[x * 2] == null){ values[x * 2] = value; } else{ if(values[x * 2] &gt; value){ values[x * 2] = value; } } if(values[(x * 2) + 1] == null){ values[(x * 2) + 1] = value; } else{ if(values[(x * 2) + 1] &lt; value){ values[(x * 2) + 1] = value; } } } } } } catch(Exception e){} } } } return values; } return null; } The crappy code shown above takes an awfully long time and is a real bottleneck, especially when I have to get the min and max of the subset of the map every time the index increments. Does anyone know how I can achieve the same thing (get the highest and lowest values of a subset of every map) faster? Thanks.
has title: Min & Max of subset of map
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24120590
tagged with: performance
tagged with: java
tagged with: optimization
has comment: http://stackoverflow.com/comment/37211833
has comment: http://stackoverflow.com/comment/37214480

http://stackoverflow.com/comment/37510526
has text: Thanks for the reply. But as you suggested I cannot make the logging code static, My web app start every minute and checks records in DB, I mean 50 to 100 processes vary for every minute and the logging info also has to be changed according to each record that is successful in that validations. But your info regarding the difference between them is very useful, Thank you.
score: 0
comment on: http://stackoverflow.com/a/24264979
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24252256
linked to: http://stackoverflow.com/q/14059685
accepted answer: http://stackoverflow.com/a/24494049
linked to: http://stackoverflow.com/q/5012567
downvote count: 1
favorite count: 0
type: Question
upvote count: 287
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24855210
score: 286
duplicate of: http://stackoverflow.com/q/14059685
tagged with: java
has answer: http://stackoverflow.com/a/24855210
has title: How do I enable index downloads in Eclipse for Maven dependency search?
tagged with: eclipse
has body: I am using Eclipse Luna with the m2e plug-in. When I search for dependencies, I get the following warning (also see the screenshot after): Index downloads are disabled, search result may be incomplete. How can I enable index downloads?
has answer: http://stackoverflow.com/a/24494049
answer count: 2
tagged with: maven

http://stackoverflow.com/comment/37264996
comment on: http://stackoverflow.com/q/24148429
type: Comment
has text: so please let me know how it is possible
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37444660
type: Comment
type: QuestionComment
has text: Did you have a look a those questions? http://stackoverflow.com/questions/21086417/builder-pattern-and-inheritance and http://stackoverflow.com/questions/17164375/subclassing-a-java-builder-class ?
score: 0
comment on: http://stackoverflow.com/q/24243240

http://stackoverflow.com/comment/37509013
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24261564
has text: but i need to output different output files for different keys(as amny keys I need seperate file)
type: Comment

http://stackoverflow.com/comment/37258809
score: 0
type: Comment
has text: Thanks.I think you are right.Because when I test this in Java SE.Eclipse reports a error.So this confuse me.
type: AnswerComment
comment on: http://stackoverflow.com/a/24145083

http://stackoverflow.com/a/24259425
type: Answer
has comment: http://stackoverflow.com/comment/37476513
accepted answer of: http://stackoverflow.com/q/24259358
has body: A Negative Lookahead ^ will not work where you have it (it is an anchor that tries to assert that we are at the beginning of the string). But you were close, and if you just add ?! at the beginning of ethe parentheses that follow, it turns into a negative lookahead: (String|int|char|boolean|double)\s+(?!(?:String|int|char|boolean|double)\b)[a-zA-Z]+ See demo Removed the brackets around \s and \w (unneeded). The negative lookbehind (?!(?:String|int|char|boolean|double)\b) asserts that what follows is not one of your types. If the assertion succeeds, the engine proceeds to match your var, specified by [a-zA-Z]+ For more on lookarounds, see the reference section. Reference Lookahead and Lookbehind Zero-Length Assertions Mastering Lookahead and Lookbehind
has comment: http://stackoverflow.com/comment/37477047
upvote count: 3
answers question: http://stackoverflow.com/q/24259358
downvote count: 0
has comment: http://stackoverflow.com/comment/37476830
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37475556
has comment: http://stackoverflow.com/comment/37475798
score: 3
has comment: http://stackoverflow.com/comment/37476852
has comment: http://stackoverflow.com/comment/37476935
has comment: http://stackoverflow.com/comment/37476729
has comment: http://stackoverflow.com/comment/37477213

http://stackoverflow.com/a/24124478
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24124415
type: Answer
has body: Your current code will not compile (Java doesn't have static arrays). You instead need: int[] modifier = new int[positions.length]; which creates a new block of memory on the heap for the int array and points modifier to it. Now when you do positions = modifier; positions is also pointed to that block of memory, and the block that positions used to point to can be garbage collected, assuming it isn't being referenced by another variable. It becomes easier to understand this if you think of all Java variables as pointers. Initial positions --------&gt (Allocated space 1) int[] modifier = new int[positions.length]; positions --------&gt (Allocated space 1) modifier --------&gt (Allocated space 2) positions = modifier; (Allocated space 1) positions --------&gt (Allocated space 2) &lt-------- modifier Notice that now nothing is referencing Allocated space 1, so it can be freed by the garbage collector.

http://stackoverflow.com/q/24136782
has title: What are the various Datalog implementations available in Java?
tagged with: datalog
score: 2
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24144229
favorite count: 0
type: Question
answer count: 2
upvote count: 2
has body: I am looking for a Jave implementation of Datalog that does not evaluate unnecessary rules. I looked at IRIS reasoner which seems to be the most stable one. However, it evaluates all the rules rather than only the ones being used. As an example: parent('homer', 'bart'). parent('abe', 'homer'). ancestor(?a, ?b) :- parent(?a, ?b). ancestor(?a, ?b) :- ancestor(?a, ?c), ancestor(?c, ?b). // query.. find all parent-child pairs. ?-parent(?x, ?y). I find that IRIS computes the relation ancestor even if it is never used. What other implementations are available for Java? Do any of those perform this optimization?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24359674

http://stackoverflow.com/a/24184446
type: Answer
has body: Some lists are unmodifiable. The operation of adding elements is then "unsupported". Java collections framework does not have a distinct type for unmodifiable lists or other unmodifiable collections. You never really know if it is allowed to add something. All you can do is to specify that the list that is passed must be modifiable.
accepted answer of: http://stackoverflow.com/q/24184256
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24184256
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/42258157
has body: Just to clarify for anyone looking at this later... localhost is always the machine you are sitting at - always. There is no way you will ever connect to a remote box using localhost. Also, the IP address 127.0.0.1 is equivalent to localhost, so don't use that either. You may see that the database binds to localhost or 127.0.0.1 on the database server. That is ok. Use the IP address of the server running the database in your database connection URL mysql:jdbc://&lt;IPOfServer&gt;:&lt;PortOfServer&gt;/&lt;DbName&gt;). You can find the IP address of the server by running the following command on the database server... Windows: ipconfig Linux: ifconfig Good luck!
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24208029
score: 2
upvote count: 2

http://stackoverflow.com/a/24211453
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37384986
upvote count: 1
has comment: http://stackoverflow.com/comment/37386443
has comment: http://stackoverflow.com/comment/37385181
has comment: http://stackoverflow.com/comment/37386361
has body: Just annotate the entity's properties with both annotations. When you perform serialization, you'll choose an ObjectMapper or the corresponding XmlMapper (or whatever it is called) based on the type you want.
answers question: http://stackoverflow.com/q/24211427
type: Answer

http://stackoverflow.com/comment/37405956
type: QuestionComment
type: Comment
has text: thx for voting down lol
comment on: http://stackoverflow.com/q/24222905
score: 0

http://stackoverflow.com/q/24235862
has title: Preset Map in Java
has body: I have an analytics program that receives many values from a HTTP GET request and maps them into a table. My question pertains to changing the shorthand names I assigned to variables in the request into more full names before I write them to a log file. What is the best way for mapping the shorthand (e.g uid: KG) to the full names (User ID: KG )? Currently I have a Map that puts all the relations in it ("uid": "User ID") on runtime. It uses a good number of calls to put every value in the map so I was wondering what is standard practice or most efficient, many put calls or is there a way to save a standard map to a file and load it in runtime?
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/24235949
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37430815
has answer: http://stackoverflow.com/a/24235949
has comment: http://stackoverflow.com/comment/37432189
type: Question
has comment: http://stackoverflow.com/comment/37430569

http://stackoverflow.com/comment/37432881
type: QuestionComment
comment on: http://stackoverflow.com/q/24236993
score: 0
type: Comment
has text: Why would the questions be different? "not possible" clearly implies "not supported" and vice versa. Swapping a word doesn't change the question.

http://stackoverflow.com/a/24240752
type: Answer
score: 0
has body: the internalNioBuffer() returns the same instance of ByteBuffer everytime where buffer.duplicate() will return duplicate which has separate limit and position. As duplicate() will create a new ByteBuffer instance, we use internalNioBuffer() where possible to reduce object creation.
answers question: http://stackoverflow.com/q/24209291

http://stackoverflow.com/q/24156111
upvote count: 4
answer count: 1
downvote count: 0
tagged with: tomcat7
has body: I've run an issue with Tomcat 7 and fabric. I'm able to stop tomcat remotely. Unfortunately, I'm not able to start it with python-fabric. It gives me an output and there's no sign of error but still tomcat is not starting up. This is my fabric command: @task def start_tomcat(): sudo('/opt/tomcat/bin/startup.sh') Ouput: [bw.node1] Executing task 'start_tomcat' Starting Tomcat [bw.node1] run: echo $JAVA_HOME [bw.node1] out: /usr/lib/jvm/java-1.6.0 [bw.node1] out: [bw.node1] sudo: ./startup.sh [bw.node1] out: sudo password: [bw.node1] out: Using CATALINA_BASE: /opt/tomcat [bw.node1] out: Using CATALINA_HOME: /opt/tomcat [bw.node1] out: Using CATALINA_TMPDIR: /opt/tomcat/temp [bw.node1] out: Using JRE_HOME: /usr/lib/jvm/java-1.6.0 [bw.node1] out: Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar [bw.node1] out: Done. Disconnecting from bw.node1... done. And still nothing is happening. I've also checked catalina.out and tomcat is not starting up.
favorite count: 0
type: Question
tagged with: automation
type: UnansweredQuestion
tagged with: java
tagged with: fabric
has title: Start Tomcat remotely with Fabric
score: 4
linked to: http://stackoverflow.com/q/8775598
has answer: http://stackoverflow.com/a/24160692

http://stackoverflow.com/comment/37390712
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24214771
has text: Thanks for answer, this is what I need! But is there a way to have more than one value in the keys (like String that follows pattern: Double,Double)?
score: 0

http://stackoverflow.com/comment/37215365
score: 0
has text: @shylendra.. Got the answer.. Posted. Thanks for supporting :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24115842

http://stackoverflow.com/q/24126920
linked to: http://stackoverflow.com/q/10250772
tagged with: printing
has body: i want to print something like this IMAGE TITLE JTABLE i know to print a jtable with the title in a messageFormat header but i dont know how to add the image The image is a logo
score: 1
upvote count: 1
tagged with: java
answer count: 1
has title: How to print a jtable with a image in the header?
tagged with: image
favorite count: 0
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24130674
tagged with: swing
accepted answer: http://stackoverflow.com/a/24130674
tagged with: jtable
type: AnsweredQuestion

http://stackoverflow.com/comment/37406593
comment on: http://stackoverflow.com/a/24223145
score: 0
type: Comment
type: AnswerComment
has text: it is only teoretical question

http://stackoverflow.com/a/24129116
has comment: http://stackoverflow.com/comment/37229102
has body: I reccomend to split your algorithm to different parts, so you can focus on smaller tasks at time. Find factors of number i. A method that gets a number and return an arrays of it's factors. Sum factors together. A simple method that takes an array and returns it's the sum. Main loop: just check if sum(factors(i)) == i You can start with the more easy ones (Hint: 2 and 3) and then maybe search for some not-totally-inefficient ways to implement 1
type: Answer
answers question: http://stackoverflow.com/q/24128937
score: 0

http://stackoverflow.com/a/24108734
score: 0
has body: super is a call to parent constructor, in your case constructor of Application. you cannot call a constructor from a static method.
has comment: http://stackoverflow.com/comment/37193119
type: Answer
answers question: http://stackoverflow.com/q/24108717

http://stackoverflow.com/comment/37400815
has text: Looking at @laune's answer: You don't compute all sequences, you're just searching for the longest one. Are you sure it's your task to compute all sequences?
comment on: http://stackoverflow.com/q/24220007
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37283507
has text: if some type (Transcript) has no known metadata then work out WHY it has no metadata? excluded it from persistence.xml "class" definitions perhaps? Not sure how that rates as a "total catastrophe" ...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24157966
score: 0

http://stackoverflow.com/comment/37339595
has text: There is `:` missing. Try `jdbc:as400://myserver.domain.com;DSN=DB2;Uid=name;Pwd=password;`
comment on: http://stackoverflow.com/q/24188472
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37423271
has text: I have changed that but still an error on 'new OptionScreen(this);' :The constructor OptionScreen(GameMain) is undefined
comment on: http://stackoverflow.com/a/24231972
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24116568
answers question: http://stackoverflow.com/q/24116510
type: Answer
has body: this should do the trick. if(blabla.contains(" ")){}; http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#contains(java.lang.CharSequence)
score: 0

http://stackoverflow.com/comment/37414122
type: QuestionComment
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) One way to get image(s) for an example is to hot-link to the images seen in [this answer](http://stackoverflow.com/a/19209651/418556).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24227357

http://stackoverflow.com/q/24176719
has answer: http://stackoverflow.com/a/24202301
has comment: http://stackoverflow.com/comment/37366707
has comment: http://stackoverflow.com/comment/37318084
has comment: http://stackoverflow.com/comment/37318004
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37365902
has comment: http://stackoverflow.com/comment/37366798
has comment: http://stackoverflow.com/comment/37318397
has comment: http://stackoverflow.com/comment/37318620
has comment: http://stackoverflow.com/comment/37365944
has comment: http://stackoverflow.com/comment/37318237
has comment: http://stackoverflow.com/comment/37366122
has comment: http://stackoverflow.com/comment/37366622
possible better answer: http://stackoverflow.com/a/24176862
tagged with: android
has comment: http://stackoverflow.com/comment/37318726
has comment: http://stackoverflow.com/comment/37318198
has comment: http://stackoverflow.com/comment/37318151
has comment: http://stackoverflow.com/comment/37366158
has comment: http://stackoverflow.com/comment/37318756
has title: JSON Paring - How to show second Level ListView
has comment: http://stackoverflow.com/comment/37318095
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37366482
has comment: http://stackoverflow.com/comment/37366080
has comment: http://stackoverflow.com/comment/37318410
answer count: 2
has comment: http://stackoverflow.com/comment/37366296
has comment: http://stackoverflow.com/comment/37318149
has comment: http://stackoverflow.com/comment/37318136
has comment: http://stackoverflow.com/comment/37365156
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37366692
accepted answer: http://stackoverflow.com/a/24202301
has comment: http://stackoverflow.com/comment/37366004
downvote count: 0
has body: I am parsing JSON data into ListView, and successfully parsed first level of JSON in MainActivity.java, where i am showing list of Main Locations, like: Inner Locations Outer Locations Now i want whenever i do tap on Inner Locations then in SecondActivity it should show Delhi and NCR in a List, same goes for Outer Locations as well, in this case whenever user do tap need to show USA JSON look like: { "all": [ { "title": "Inner Locations", "maps": [ { "title": "Delhi", "markers": [ { "name": "Connaught Place", "latitude": 28.632777800000000000, "longitude": 77.219722199999980000 }, { "name": "Lajpat Nagar", "latitude": 28.565617900000000000, "longitude": 77.243389100000060000 } ] }, { "title": "NCR", "markers": [ { "name": "Gurgaon", "latitude": 28.440658300000000000, "longitude": 76.987347699999990000 }, { "name": "Noida", "latitude": 28.570000000000000000, "longitude": 77.319999999999940000 } ] } ] }, { "title": "Outer Locations", "maps": [ { "title": "United States", "markers": [ { "name": "Virgin Islands", "latitude": 18.335765000000000000, "longitude": -64.896335000000020000 }, { "name": "Vegas", "latitude": 36.114646000000000000, "longitude": -115.172816000000010000 } ] } ] } ] } Note: But whenever i do tap on any of the ListItem in first activity, not getting any list in SecondActivity, why ? MainActivity.java:- @Override protected Void doInBackground(Void... params) { // Create an array arraylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Retrieve JSON Objects from the given URL address jsonobject = JSONfunctions .getJSONfromURL("http://10.0.2.2/locations.json"); try { // Locate the array name in JSON jsonarray = jsonobject.getJSONArray("all"); for (int i = 0; i &lt; jsonarray.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); jsonobject = jsonarray.getJSONObject(i); // Retrieve JSON Objects map.put("title", jsonobject.getString("title")); arraylist.add(map); } } catch (JSONException e) { Log.e("Error", e…
has comment: http://stackoverflow.com/comment/37366572
has comment: http://stackoverflow.com/comment/37318172
upvote count: 1
has answer: http://stackoverflow.com/a/24176862
has comment: http://stackoverflow.com/comment/37318029

http://stackoverflow.com/comment/37243852
has text: i know i can do this for the short way around but why calScreen.getText().matches(operations) didnt work for "-". it shouldn't be in the text field if the above code is work. it was working before until i add some new button but after i deleting it the problem still there
comment on: http://stackoverflow.com/a/24136935
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/24239769
has answer: http://stackoverflow.com/a/24239878
answer count: 4
has answer: http://stackoverflow.com/a/24240206
type: Question
has answer: http://stackoverflow.com/a/24240069
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/24240111
has title: How to get key of a specific value in Map
has body: I am trying to find max value in a Map and get its corresponding key. This is my maxMin = {3=0.1518355013623417, 2=0.11815917264727849, 1=0.2467498197744391, 4=0.04812703040826949} for(String keyset: maxMin.keySet()){ double values = maxMin.get(keyset); if (values &lt; min) { min = values; } if (values &gt; max) { max = values; } } And I found the max but how toget corresponding key?
tagged with: dictionary
has answer: http://stackoverflow.com/a/24240111
type: AnsweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/7146990
accepted answer: http://stackoverflow.com/a/24240069
has comment: http://stackoverflow.com/comment/37437847
has comment: http://stackoverflow.com/comment/37437756

http://stackoverflow.com/comment/37278722
score: 0
has text: Do you use an application server?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24155761

http://stackoverflow.com/comment/37483904
has text: Hi sorry I should have added a NETBEANS tag, I have the main class set correctly and have checked the manifest file to confirm it. The java file runs perfectly if you do it through command prompt java -jar helloworld.java but not if you double click it! I know it's something to do with my file association but I am 99% sure it's set correctly
comment on: http://stackoverflow.com/a/24263979
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37370593
has text: use JsonArray Object to parse nested json http://www.mkyong.com/java/json-simple-example-read-and-write-json/
comment on: http://stackoverflow.com/q/24204628
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24113564
has comment: http://stackoverflow.com/comment/37201184
type: UnansweredQuestion
downvote count: 0
answer count: 1
upvote count: 1
tagged with: swing
favorite count: 0
has body: I'm trying to write a program where the user can type in numbers but not letters or symbols. I have a textfield that is not editable because I want only acceptable user input keys to be displayed on the textfield. This is the basic structure of my code. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class SampleProgram extends JFrame implements ActionListener, KeyListener { private Container container; private JPanel panel; private JTextField textField; private JButton button; private String[] names = {"1", "2", "3", "4", "5", "6", "7", "8", "9"}; public SampleProgram() { container = getContentPane(); panel = new JPanel(); textField = new JTextField(); textField.setEditable(false); contain.add(textField); addKeyListener(this); button = new JButton("Some Action Button"); button.addActionListener(this); panel.add(button); container.add(panel); setResizable(false); setVisible(true); } public void keyPressed(KeyEvent event) {} public void keyReleased(KeyEvent event) {} public void keyTyped(KeyEvent event) { String action = String.valueOf(event.getKeyChar()); for (String s : names) if (action.equalsIgnoreCase(s)) { someAction(action); return; } } public void actionPerformed(ActionEvent event) { String action = ((JButton)event.getSource()).getText(); someAction(action); } private void someAction(String input) { textField.setText(input); } } This is the stripped down version of my code. My ActionListener is doing what it is supposed to do, but my KeyListener isn't working at all. I tried to add KeyListener to textField as well, but that didn't work either. How do I get my program to read in the user key input? To figure out the error, I tried putting in the code textField.setText(action) in the keyTyped method, and I learned that my code wasn't even entering the keyTyped method.
has answer: http://stackoverflow.com/a/24113635
score: 1
tagged with: java
has title: update textfield simultaneously with key event without text field
tagged with: keylistener
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/37199851

http://stackoverflow.com/a/24346567
score: 0
answers question: http://stackoverflow.com/q/24171544
has comment: http://stackoverflow.com/comment/37729283
has comment: http://stackoverflow.com/comment/37739245
has comment: http://stackoverflow.com/comment/37728698
has comment: http://stackoverflow.com/comment/39827764
has comment: http://stackoverflow.com/comment/37728106
has comment: http://stackoverflow.com/comment/39826495
has comment: http://stackoverflow.com/comment/37782805
type: Answer
has body: I'll start by answering your first question: Why it generate this for TreeMaps? The element local name is java.util.TreeMap_-1 because XStream attempted to serialize an anonymous inner class of java.util.TreeMap. As for the second question: How can i write a generic collections types into this output xml, that can be assembled into different jdks? You need to post more complete code to demonstrate the problem. Please see SSCCE.org to understand what code is necessary. As it stands, you have not provided a sufficient example for someone else to reproduce the problem. I'll make some educated guesses about the problem based on what you've provided. Out of the box, XStream provides a number of converters, including TreeMapConverter for java.util.TreeMap. When I run XStream's serialization against a TreeMap in my environment, I do not see either the KeySet inner class, nor an anonymous inner class being serialized: import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.mapper.MapperWrapper; import java.util.Date; import java.util.TreeMap; public class App { public static XStream getXStreamConfigured() { final XStream xstream = new XStream() { @Override protected MapperWrapper wrapMapper(final MapperWrapper next) { return new MapperWrapper(next) { @Override public boolean shouldSerializeMember( final Class definedIn, final String fieldName) { if (definedIn == Object.class) { return false; } return super.shouldSerializeMember(definedIn, fieldName); } }; } }; xstream.autodetectAnnotations(true); return xstream; } public static void main(String[] args) { XStream xs = getXStreamConfigured(); xs.toXML(new ExampleContainer().fill(), System.out); } public static class ExampleContainer { private TreeMap<String, Date> map = new TreeMap<>(); public ExampleContainer() { } public ExampleContainer fill() { map.put("a", new Date()); map.put("b", new Date()); map.put("c", new Date()); map.put("d", new Date()); return this; } } } That code gives me the following output:…

jackson
tags question: http://stackoverflow.com/q/24144743
tags question: http://stackoverflow.com/q/24187073
tags question: http://stackoverflow.com/q/24132884
tags question: http://stackoverflow.com/q/24130455
tags question: http://stackoverflow.com/q/24172701
tag name: jackson
tags question: http://stackoverflow.com/q/24211427
tags question: http://stackoverflow.com/q/24230526
tags question: http://stackoverflow.com/q/24192303
tags question: http://stackoverflow.com/q/24142892
tags question: http://stackoverflow.com/q/24188589
tags question: http://stackoverflow.com/q/24194410
tags question: http://stackoverflow.com/q/24179528
tags question: http://stackoverflow.com/q/24208087
tags question: http://stackoverflow.com/q/24122677
tags question: http://stackoverflow.com/q/24129931
tags question: http://stackoverflow.com/q/24115624
tags question: http://stackoverflow.com/q/24172323
tags question: http://stackoverflow.com/q/24226168
tags question: http://stackoverflow.com/q/24138667
tags question: http://stackoverflow.com/q/24192931
tags question: http://stackoverflow.com/q/24166101
tags question: http://stackoverflow.com/q/24151398
tags question: http://stackoverflow.com/q/24171649
tags question: http://stackoverflow.com/q/24141489
tags question: http://stackoverflow.com/q/24177364
tags question: http://stackoverflow.com/q/24221524
tags question: http://stackoverflow.com/q/24202714
tags question: http://stackoverflow.com/q/24167468
tags question: http://stackoverflow.com/q/24167117
tags question: http://stackoverflow.com/q/24187028
tags question: http://stackoverflow.com/q/24124149
type: Tag
tags question: http://stackoverflow.com/q/24157817
tags question: http://stackoverflow.com/q/24143440
tags question: http://stackoverflow.com/q/24114932
tags question: http://stackoverflow.com/q/24244824
tags question: http://stackoverflow.com/q/24263904
tags question: http://stackoverflow.com/q/24150609
tags question: http://stackoverflow.com/q/24263803

http://stackoverflow.com/comment/37334164
comment on: http://stackoverflow.com/q/24185466
score: 0
has text: Check the requirements for spring and hibernate versions your using. That Tomcat is *really old*. And maybe switch to a different CP.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37373215
has text: great! i take a look too.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24201035
type: AnswerComment

path
tags question: http://stackoverflow.com/q/24105611
tags question: http://stackoverflow.com/q/24206203
type: Tag
tags question: http://stackoverflow.com/q/24142560
tags question: http://stackoverflow.com/q/24126177
tags question: http://stackoverflow.com/q/24264942
tag name: path

jndi
tags question: http://stackoverflow.com/q/24164752
tags question: http://stackoverflow.com/q/24221358
type: Tag
tag name: jndi
tags question: http://stackoverflow.com/q/24150521

http://stackoverflow.com/comment/37185520
type: AnswerComment
comment on: http://stackoverflow.com/a/24105913
has text: @petaYAN: The threads are always executed with a `Runnable`, never with a `Callable`. When using an `ExecutorService`, the `Runnable` is created internally in the `ExecutorService`, and the `Runnable` can execute several `Callable`s.
score: 0
type: Comment

http://stackoverflow.com/q/24192561
tagged with: graphics
has answer: http://stackoverflow.com/a/24192732
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37347559
has answer: http://stackoverflow.com/a/24192606
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37347720
has comment: http://stackoverflow.com/comment/37347640
tagged with: java
has body: This what I am doing but is nothing is getting displayed on Jframe window. I have not extended class JFrame to do my, is it necessary to do so for displaying objects on window. public class testGraphics { static JFrame workingFrame = null; public static void main(String args[]) { JFrame workingManager = new JFrame("Hello"); workingManager.setSize(500, 500); workingManager.setVisible(true); Graphics g = workingManager.getGraphics(); JPanel jp = (JPanel) workingManager.getContentPane(); workingManager.paintComponents(g); g.fillOval(0, 0, 30, 30); g.drawOval(0, 50, 30, 30); g.setColor(Color.CYAN); } }
has title: Nothing is getting displayed on JFrame
has answer: http://stackoverflow.com/a/24193745
type: Question

http://stackoverflow.com/q/24250717
upvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/37461290
has comment: http://stackoverflow.com/comment/37461077
tagged with: swing
has comment: http://stackoverflow.com/comment/37460676
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37459417
has comment: http://stackoverflow.com/comment/37461519
type: Question
has comment: http://stackoverflow.com/comment/37460940
tagged with: timer
has comment: http://stackoverflow.com/comment/37461327
has body: I'm writing a swing program that has to repaint at intervals. For some reason, javax.swing.Timer seems to only be repainting once every 800-900ms even when I specify lower delays. (e.g. 100ms) I thought the delay might be due to the repaint() method taking 800ms to run, but I timed it and it only takes .3ms. I tried using Thread.sleep() and it repaints at the desired intervals. Can anyone help explain why this might be? What I'm trying to do seems like the intended purpose of javax.swing.Timer and so I'm confused as to why it would slow down the code so much. Main driver class: import java.awt.Dimension; import javax.swing.JFrame; public class GUIDriver{ public AnimationPanel animationPanel; public static void main(String[] args){ GUIDriver gui = new GUIDriver(); gui.createAndShowGUI(); } public void createAndShowGUI(){ animationPanel = AnimationPanel(50); JFrame frame = new JFrame("Animations"); frame.setContentPane(animationPanel); frame.setPreferredSize(new Dimension(1015, 840)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.validate(); frame.doLayout(); frame.setVisible(true); animationPanel.draw(); //only here when using Thread.sleep() method } } Custom JPanel extension: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Point2D; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; import java.text.SimpleDateFormat; import javax.imageio.ImageIO; import javax.swing.JPanel; import javax.swing.Timer; /** * This extension of the JPanel overrides the paintComponent method to provide a framework for * creating 2-D animations. */ @Sup…
has comment: http://stackoverflow.com/comment/37459464
has comment: http://stackoverflow.com/comment/37460124
has title: Java Swing Timer slower than expected
has comment: http://stackoverflow.com/comment/37459827
has comment: http://stackoverflow.com/comment/37461976
linked to: http://stackoverflow.com/q/180158
tagged with: java
has comment: http://stackoverflow.com/comment/37464130
has answer: http://stackoverflow.com/a/24252924
has comment: http://stackoverflow.com/comment/37459938
linked to: http://stackoverflow.com/q/24131513
has comment: http://stackoverflow.com/comment/37459682
has comment: http://stackoverflow.com/comment/37460179
has comment: http://stackoverflow.com/comment/37460640
has comment: http://stackoverflow.com/comment/37459753
score: 2
has comment: http://stackoverflow.com/comment/37462947
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37459552
has comment: http://stackoverflow.com/comment/37460279
linked to: http://stackoverflow.com/q/11959758
has comment: http://stackoverflow.com/comment/37460062
has comment: http://stackoverflow.com/comment/37460456
has comment: http://stackoverflow.com/comment/37459839
has comment: http://stackoverflow.com/comment/37461226
accepted answer: http://stackoverflow.com/a/24252924

http://stackoverflow.com/a/24263255
has comment: http://stackoverflow.com/comment/37484747
answers question: http://stackoverflow.com/q/24262956
score: 0
has body: Only use a thread if you want to do work repeatedly for a long time. I have never needed to start a thread. You should look at using an AsyncTask. AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers. It works by using a Thread from the ThreadPool. AsyncTask's are easy to stop, have a method to override for background tasks and one to override for post task work which is suitable for updating the UI (as long as the task was started by the UI thread).
type: Answer

http://stackoverflow.com/comment/37382492
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24210585
type: Comment
has text: You want to say that you copied my code, run it, but it does not work?

http://stackoverflow.com/q/24111266
has answer: http://stackoverflow.com/a/24111456
tagged with: java
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has title: Can't set a variable inside a while loop
has body: New to Java, sorry if this is a stupid question. I'd like to assign new values to a couple of variables from inside a while loop, but that's not working. I'm getting an error "The local variable newString may not have been initialized" when trying to compile. Here's an example: public class Test { public static String example() { String first; String second; String newString; int start = 1; while (start&lt;5) { if (start&lt;4) { first = "hello"; second = "world"; newString = first + second; } start += 1; } return newString; } public static void main(String[] args) { System.out.println(example()); } }
has comment: http://stackoverflow.com/comment/37195579
possible better answer: http://stackoverflow.com/a/24111366
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24111456
score: 0
has answer: http://stackoverflow.com/a/24111366
answer count: 3
has answer: http://stackoverflow.com/a/24111392

http://stackoverflow.com/comment/37281106
has text: I disagree : ``List(4)`` and ``List(1,2,4)`` does not even enter the loop. ``List(1,4)`` and ``List(1,2,4)`` does but you need to add ``4`` to the result.
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/24157117

http://stackoverflow.com/comment/37199875
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24113524
has text: Your loop in the method `unsortedInfo` is wrong. Look at the other loop you use and see if you can find what's wrong. Hint: you're off my by 1. :)
type: Comment

http://stackoverflow.com/comment/37209698
comment on: http://stackoverflow.com/a/24117543
score: 0
type: Comment
type: AnswerComment
has text: i am asking about if that file is already created then how u will access that?

http://stackoverflow.com/comment/37330225
type: QuestionComment
comment on: http://stackoverflow.com/q/24183354
has text: @feuerball my names.txt is https://projecteuler.net/project/names.txt I want to convert it into the String[] of the names.
score: 0
type: Comment

http://stackoverflow.com/q/24166297
tagged with: code-generation
has title: SWIG/java how to add a method to a SWIGTYPE* class
has comment: http://stackoverflow.com/comment/37336166
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24193610
linked to: http://stackoverflow.com/q/9994887
answer count: 2
has answer: http://stackoverflow.com/a/24193610
score: 1
tagged with: java
downvote count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/54839377
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/54839377
tagged with: swig
has body: swig generates the following kind of java classes: public class SWIGTYPE_p_my { private long swigCPtr; protected SWIGTYPE_p_my(long cPtr, boolean futureUse) { swigCPtr = cPtr; } protected SWIGTYPE_p_my() { swigCPtr = 0; } protected static long getCPtr(SWIGTYPE_p_my obj) { return (obj == null) ? 0 : obj.swigCPtr; } } I'd like to know if swigCPtr is null/0 but the methods are protected. Is there a simple way to add some methods like: public boolean isNull() { return swigCPtr==0L;} or changing getCPtr to public ? From the manual, I don't really get what kind of typemap I should use.

http://stackoverflow.com/comment/37430627
has text: Awesome that worked! Do you think it might be best to add an error statement if the user inputs a negative number?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24235851

http://stackoverflow.com/a/24168823
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24165305
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24165305
has body: This specific code is just a Log.debug. Couldn't find any bindings for address=hornetq.notifications on... We send notifications for things that happen on the servers, and you won't always have a listener for these notifications. on this case the notification message is just not being routed as you have no consumers.. which is perfectly fine. This has nothing to do with the error you're having... it's irrelevant. You should look for other clues on your test. I'm not giving this as an answer as it doesn't answer your question. I don't have enough info to do it. I would need more information to answer exactly why you're not receiving messages on your test.. but this specific message you posted has no direct relation.
type: Answer
has comment: http://stackoverflow.com/comment/37305370

http://stackoverflow.com/q/24126586
tagged with: java
downvote count: 0
has body: I am trying to set a button to green for 1 second, then back to red. But It won't change to green anymore, if I comment out the "change to red" part, it will turn green fine. I have used Log.d and it shows that there is a second difference between changing from "change to green" to "change to red" so you should see the green before the red, but for some reason this is not working. Any Ideas? public void level1() throws InterruptedException { int Low = 1000; int High = 3000; int t = r.nextInt(High-Low) + Low; Thread.sleep(t); handleTime.post(new Runnable() { @Override public void run() { int i = r.nextInt(5); switch(i) { case 1: try { setGreen(tLeft); tLActive = true; Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { tLActive = false; setRed(tLeft); } break; case 2: try { setGreen(tRight); tRActive = true; Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { tRActive = false; setRed(tRight); } break; case 3: try { setGreen(center); cActive = true; Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { cActive = false; setRed(center); } break; case 4: try { setGreen(bLeft); bLActive = true; Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { bLActive = false; setRed(bLeft); } break; case 5: try { setGreen(bRight); bRActive = true; Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { bRActive = false; setRed(bRight); } break; } } }); } private void setGreen(ImageButton b) { b.setBackgroundResource(R.drawable.green); Log.d("green", "green"); } private void setRed(ImageButton b) { b.setBackgroundResource(R.drawable.red); Log.d("red", "red"); }
upvote count: 1
accepted answer: http://stackoverflow.com/a/24126732
score: 1
has answer: http://stackoverflow.com/a/24126732
favorite count: 0
type: Question
tagged with: android-resources
has answer: http://stackoverflow.com/a/24126684
tagged with: android
has title: Android - change background resource twice with pause between
type: AnsweredQuestion
answer count: 2
possible better answer: http://stackoverflow.com/a/24126684

http://stackoverflow.com/comment/37844687
comment on: http://stackoverflow.com/a/24448129
type: Comment
has text: I am not using transport client, I am using node client. Transport client has ```InetSocketTransportAddress``` etc. which I don't. My code is from the node client sample in the link you gave: http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html#transport-client
score: 0
type: AnswerComment

http://stackoverflow.com/q/24210564
upvote count: 1
has comment: http://stackoverflow.com/comment/37382419
accepted answer: http://stackoverflow.com/a/24210824
favorite count: 0
has answer: http://stackoverflow.com/a/24210824
type: Question
type: AnsweredQuestion
has title: Java Runtime Environment 8 doesn't support <E> mechanism
tagged with: java
has comment: http://stackoverflow.com/comment/37387461
tagged with: eclipse
has body: is not supported by Java Runtime Environment 8. What is the alternative way to achieve it? I tried to create heap using ArrayList as follows: ArrayList&lt;E&gt;list = new ArrayList&lt;E&gt;(length); It doesn't work. Eclipse requested to change JRE environment to an older version...
linked to: http://stackoverflow.com/q/24015382
score: -1
has comment: http://stackoverflow.com/comment/37387176
has comment: http://stackoverflow.com/comment/37383048
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/37382967

http://stackoverflow.com/comment/37263396
type: QuestionComment
has text: Do both "create" methods do both have the same logic? If they differ in logic, why not using different names that would reflect their different behavior?
comment on: http://stackoverflow.com/q/24147372
score: 1
type: Comment

http://stackoverflow.com/comment/37218905
has text: Sorry, confused "exceeds" with "equals" myself. edited.
comment on: http://stackoverflow.com/q/24123822
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37197414
type: QuestionComment
has text: And the line # **78** in **RestaurantTest2.java** file is ... ?
comment on: http://stackoverflow.com/q/24112129
type: Comment
score: 0

http://stackoverflow.com/q/24123585
has body: I need to develop the simple skin disease diagnose system using image processing and neural network. To use images in neural network, image should be same standard and, To identify the skin disease we should apply some image processing technique as well. But I don't know what image processing technique apply first and what are they? As I read from references I think I need to apply image filtering technique, edge detection technique , etc... Can someone who is expert in this please specify the image processing technique step by step. no need coding I just want to know image processing technique names and there order. This is reference: reference
tagged with: edge-detection
type: Question
type: UnansweredQuestion
tagged with: neural-network
linked to: http://stackoverflow.com/q/19487016
has title: Java : image processing - how to get set of images to same standard
has answer: http://stackoverflow.com/a/24139909
score: 0
tagged with: java
answer count: 1
tagged with: image-processing

http://stackoverflow.com/comment/37264307
type: QuestionComment
has text: @ke4ktz Plus doing things low-level builds character. :)
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24147661

http://stackoverflow.com/comment/37209482
type: AnswerComment
has text: No reasons. Just design decision. And concept: leave some work to other developers.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24118453

http://stackoverflow.com/q/24139122
favorite count: 0
possible better answer: http://stackoverflow.com/a/24139217
has comment: http://stackoverflow.com/comment/37247355
has answer: http://stackoverflow.com/a/24139217
type: Question
tagged with: webcontent
accepted answer: http://stackoverflow.com/a/24139242
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24139242
tagged with: javascript
has comment: http://stackoverflow.com/comment/37247091
answer count: 4
has title: Accessing Java class from HTML web app
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24139353
has body: I have a dynamic web project. In src folder I have Java class with couple of methods. Let us suppose index.html file has two buttons.on click of the button how can I call the Java class. Is there any possibility of doing so?
has answer: http://stackoverflow.com/a/24139360

http://stackoverflow.com/q/24229521
has body: I am learning Java Threads these days and want to clear few basic doubts. My aim is to have 3 threads each printing their respective jobs Thread 1 will print series : 1 4 ... Thread 2 will print series : 2 5 ... Thread 3 will print series : 3 6 ... I have wrote below code, and things are working fine but want to verify is my code correct?? Also, is mapOfPrinter.wait() is same as synchronized (mapOfPrinter)? I mean to say, calling mapOfPrinter.wait(), makes the current thread (ie one who has acquired monitor) to release the lock and go in waiting state. Also, if any thread has acquired a lock then another thread who encounters synchronized (mapOfPrinter) has to wait for lock to be released. In both cases, waiting is same or it differs? If multiple threads are waiting for lock to be freed (mapOfPrinter here), then doing mapOfPrinter.notify() will awake which thread among waiting threads. how we can awake only particular thread among the list of threads waiting on same mutex? Let me know if I am not clear in explaining the question. public class Main { public static void main(String[] args) { Map&lt;String, Printer&gt; mapOfPrinter=new HashMap&lt;String, Printer&gt;(); Printer p1 = new Printer(1, mapOfPrinter); Printer p2 = new Printer(2, mapOfPrinter); Printer p3 = new Printer(3, mapOfPrinter); Thread t1 =new Thread(p1, "1"); Thread t2 =new Thread(p2, "2"); Thread t3 =new Thread(p3, "3"); mapOfPrinter.put("1", p1); mapOfPrinter.put("2", p2); mapOfPrinter.put("3", p3); t1.start(); t2.start(); t3.start(); } } class Printer implements Runnable{ int data; Map&lt;String, Printer&gt; mapOfPrinter; static volatile int seriesToPrint=1; public Printer(int data, Map&lt;String, Printer&gt; mapOfPrinter) { this.data=data; this.mapOfPrinter=mapOfPrinter; } @Override public void run() { while(true){ synchronized (mapOfPrinter) { if(seriesToPrint&gt;mapOfPrinter.size()){ seriesToPrint=1; } Thread currThread = Thread.currentThread(); if(!(currThread.getName().equals(String.valueOf(se…
has answer: http://stackoverflow.com/a/24229651
tagged with: java
answer count: 1
score: -1
downvote count: 1
favorite count: 0
type: Question
has title: Threads to print series in Sync
upvote count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37418925

http://stackoverflow.com/comment/37479316
comment on: http://stackoverflow.com/a/24240315
has text: +1 for "Since the specification 1.7, because of change we may say that this is bug in some implementation of compilers." But whether you agree or not and irrespective of what JLS of previous versions says I see it as a bug because it let me introduce one in my code. :P
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/24142497
tagged with: web.xml
type: Question
upvote count: 5
tagged with: tomcat7
tagged with: servlet-3.0
answer count: 1
tagged with: tomcat
downvote count: 1
accepted answer: http://stackoverflow.com/a/24150047
has body: I know from the Servlet 3 spec that web.xml is looked for in the WEB-INF/ directory. However, I believe there are other web.xml files. For instance, Tomcat has a web.xml file under $CATALINA_BASE/conf/. I think one can also put a web.xml file under $CATALINA_HOME/conf/. Am I correct that there can be multiple web.xml files? If so, what locations can they be in, and in what order order are they processed, and what are the semantics for "merging" them? (The Servlet spec speaks of merging web-fragment.xml files, but I assume that's a separate thing.)
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24150047
has title: Servlets: where are web.xml files searched for? How are multiple web.xml files merged?
favorite count: 0
score: 4

http://stackoverflow.com/comment/37314327
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24128589
type: Comment
has text: @Michael Is your `pushNotification` bean declared in the context that also declares the annotation config and property placeholder?

http://stackoverflow.com/q/24128145
has title: SQLite inserting before certain ID?
has answer: http://stackoverflow.com/a/24129140
type: AnsweredQuestion
score: 0
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/24129140
type: Question
has body: I have a database full of tweets. When the user clicks refresh, I want to grab tweets newer than an ID (which I know how to do). After I grab the tweets, I want to insert them before ID 0, so tweet with ID 0 is no longer the first tweet, and instead replaced with the newer tweets. I have searched and I have no idea how to do this. Here is the code I am using to add the user's timeline on first launch: public void addTimemline(Timeline timeline){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(COL_TEXT, timeline.getText()); values.put(COL_TWEET_ID, timeline.getTweetId()); values.put(COL_SCREEN_NAME, timeline.getTwitterScreenName()); values.put(COL_REAL_NAME, timeline.getRealName()); values.put(COL_FAVORITE_COUNT, timeline.getFavoriteCount()); values.put(COL_RETWEET_COUNT, timeline.getRetweetedCount()); values.put(COL_HASHTAG_ENTITIES, timeline.getHashtagEntities()); values.put(COL_USER_MENTION_ENTITIES, timeline.getUserMentionEntities()); values.put(COL_URL_ENTITIES, timeline.getUrlEntities()); values.put(COL_MEDIA_ENTITIES, timeline.getMediaEntities()); db.insertOrThrow(TABLE_TWEETS, null, values); db.close(); } Create statement: private static final String TABLE_TWEETS_CREATE = "create table "+TABLE_TWEETS+" (" + Tweets.COL_ROW_ID + " integer primary key autoincrement not null, " + Tweets.COL_TEXT + " text not null, " + Tweets.COL_TWEET_ID + " text," + Tweets.COL_SCREEN_NAME + " text," + Tweets.COL_REAL_NAME + " text," + Tweets.COL_FAVORITE_COUNT + " text," + Tweets.COL_RETWEET_COUNT + " text," + Tweets.COL_HASHTAG_ENTITIES + " text," + Tweets.COL_USER_MENTION_ENTITIES + " text," + Tweets.COL_URL_ENTITIES + " text," + Tweets.COL_MEDIA_ENTITIES + " text);";
tagged with: twitter4j
tagged with: android
tagged with: java

http://stackoverflow.com/a/24265043
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: As documented, getNameCount() returns: the number of elements in the path, or 0 if this path only represents a root component So in your case, the elements are "Users", "Heather", "Desktop", "Testing" and "Testing2" - not the names of the file within the directory. To list the files in a directory, you can use Files.list(Path) (in Java 8+) or Files.newDirectoryStream(Path) (in Java 7+). Or you can convert to a File and use the "old school" File.listFiles() method etc.
accepted answer of: http://stackoverflow.com/q/24264942
has comment: http://stackoverflow.com/comment/37486620
answers question: http://stackoverflow.com/q/24264942
type: Answer
has comment: http://stackoverflow.com/comment/37486441

http://stackoverflow.com/q/24168387
has comment: http://stackoverflow.com/comment/37303019
has comment: http://stackoverflow.com/comment/37302475
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37303323
has comment: http://stackoverflow.com/comment/37302624
favorite count: 0
has title: Confusion in floating-point modulus
accepted answer: http://stackoverflow.com/a/24168449
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37302324
has comment: http://stackoverflow.com/comment/37302838
has comment: http://stackoverflow.com/comment/37302747
has answer: http://stackoverflow.com/a/24168449
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37302383
tagged with: floating-point
has comment: http://stackoverflow.com/comment/37302784
tagged with: c++
type: Question
has body: I know C++ very well, but am a beginner in java. Here are two tested programs: The Java program gives output 3.2999997 import java.util.*; import java.lang.*; import java.io.*; class Test { public static void main(String args[]) { float f = 9.9f, m = 3.3f; float c = f % m; System.out.println(c); } } The C++ program gives output 8.88178e-16 #include &lt;iostream&gt; #include&lt;math.h&gt; int main() { float f = 9.9f, m = 3.3f; std::cout &lt;&lt; fmod (9.9,3.3); return 0; } I am satisfied with the C++ program's output, but why is Java not giving an answer around zero? How is this possible, since 3.3 * 3 = 9.9 I know Java considers float's precision as 6-7 decimal digits, but I do not know how this output came? I researched this question on web, but did not find the logic behind this.
has comment: http://stackoverflow.com/comment/37302339
has comment: http://stackoverflow.com/comment/37302264

http://stackoverflow.com/comment/37333815
type: Comment
has text: I just wanted to add a few statements; without deleting/changing any statements. I'm surprised it attracted such a wide attention.
type: AnswerComment
comment on: http://stackoverflow.com/a/24173496
score: 7

ms-word
tag name: ms-word
type: Tag
tags question: http://stackoverflow.com/q/24203087
tags question: http://stackoverflow.com/q/24143683
tags question: http://stackoverflow.com/q/24262080

http://stackoverflow.com/comment/37238288
comment on: http://stackoverflow.com/a/24128409
has text: Thanks, ach. I'm not going to produce 2 packages. I was referring to the inner setup of the web layers. I got my answer from your hint "If you don't need to scale Web/REST individually and don't need them on different release cycles/versioning". This, combined with chrylis's comment on mainaining the consistency for access actually got me to realize that i want a single JSON representation for both resource consumer types, and a facade for each to access the objects. Thank you very much.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37187790
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24106428
has text: I am writing `PlatformUI.getWorkbench().getDisplay().addFilter(SWT.Activate, shellListener)` and the shellListener is something like `Listener shellListener = new Listener(){ @Override public void handleEvent(Event e) {//do stuff}};` In the do stuff block, I am getting the Shell object and its text. But as described in the case above, if the title changes within a dialog, no event is thrown (or I am missing something).

if-statement
tags question: http://stackoverflow.com/q/24183953
tag name: if-statement
type: Tag
tags question: http://stackoverflow.com/q/24232762
tags question: http://stackoverflow.com/q/24217839
tags question: http://stackoverflow.com/q/24179586
tags question: http://stackoverflow.com/q/24131941
tags question: http://stackoverflow.com/q/24220405
tags question: http://stackoverflow.com/q/24220097
tags question: http://stackoverflow.com/q/24116570
tags question: http://stackoverflow.com/q/24242224

http://stackoverflow.com/comment/37512177
type: Comment
type: AnswerComment
has text: What i used was left = user.leftSide(); right = computer.rightSide(); backS.removeAll(); backS.add(left, 0); backS.add(right, 1); backS.revalidate(); backS.repaint();
comment on: http://stackoverflow.com/a/24255545
score: 0

http://stackoverflow.com/comment/37216628
has text: As far as I can see there is no stacktrace. and I'm not logging at the moment.
type: AnswerComment
comment on: http://stackoverflow.com/a/24122134
score: 0
type: Comment

http://stackoverflow.com/q/24200947
type: UnansweredQuestion
tagged with: java
answer count: 1
has title: Grails NotSerializableException on POST request
type: Question
tagged with: serialization
has answer: http://stackoverflow.com/a/24202140
has body: i keep getting this error when trying to run my grails application can anyone tell what could be the problem. Here is the method of the controller that causes this error and it gets its parameter through ajax call from a select in the view. def optionsBySelection() { log.error "hej11 ${params}" Sql sql = new Sql(dataSource) Map query = [params: params] def optSelection = sql.rows("select distinct :params from log_entry",query).each { row-&gt; log.error "hej22 ${row}" } render (template: "selection" , model: [optSelection]) as JSON } ERROR errors.GrailsExceptionResolver - NotSerializableException occurred when processing request: [POST] /admin/optionsBySelection - parameters: params: host org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap. Stacktrace follows: Message: org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap Line | Method -&gt;&gt; 1183 | writeObject0 in java.io.ObjectOutputStream - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 347 | writeObject in '' | 4401 | setSerializableObject in com.mysql.jdbc.PreparedStatement | 4083 | setObject in '' | 169 | setObject . . . . . . in org.apache.commons.dbcp.DelegatingPreparedStatement | 34 | optionsBySelection in se.su.it.monitor.AdminController | 195 | doFilter . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 1145 | runWorker . . . . . . in java.util.concurrent.ThreadPoolExecutor | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run . . . . . . . . . in java.lang.Thread
tagged with: exception
tagged with: spring
tagged with: grails
score: 0

http://stackoverflow.com/comment/37496529
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24246954
score: 0
has text: You should be able to `clear()` the `XYSeries` in the dataset; when you `add()` new values, the listening chart will update itself.

http://stackoverflow.com/a/24110172
has comment: http://stackoverflow.com/comment/37193659
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37193762
has comment: http://stackoverflow.com/comment/37194204
has body: To scroll the TextView is not necessarily housed inside ScrollView, TextView can scroll itself. Need to change the layout of TextView, adding attribute android: scrollbars = "vertical" activity and change the code, setting scrolling method import android.text.method.ScrollingMovementMethod; ... mTexView.setMovementMethod (new ScrollingMovementMethod ()); and ScrollView - remove. Example based on Skeleton App of the Android SDK. Instead add EditText TextView: </ TextView> Working code : import android.app.Activity; import android.os.Bundle; import android.text.method.ScrollingMovementMethod; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ScrollView; import android.widget.TextView; public class MainActivity extends Activity { TextView terminal; ScrollView terminalSView; Button button1; Button button2; Button button3; Button button4; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.terminal = (TextView) findViewById(R.id.outputTerminal); terminal.setMovementMethod(new ScrollingMovementMethod()); this.button1 = (Button) findViewById(R.id.button1); this.button2 = (Button) findViewById(R.id.button2); this.button3 = (Button) findViewById(R.id.button3); this.button4 = (Button) findViewById(R.id.button4); } // Defines the buttons behavior when clicked. public void buttonClicked(View v) { switch (v.getId()) { case R.id.button1: { this.terminal.append("Button1 clicked...\n"); break; } case R.id.button2: { runOnUiThread(new Runnable() { @Override public void run() { terminal.append("Button2 clicked...\n"); } }); break; } case R.id.button3: { runOnUiThread(new Runnable() { @Override public void run() { terminal.append("Button3 clicked...\n"); } }); break; } case R.id.button4: { this.terminal.append("Button4 clicked...\n"); break; } default: { break; } } } } Layout : <?xml version="1.0" encoding="utf-8"?> Resu…
has comment: http://stackoverflow.com/comment/37193797
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24109636

http://stackoverflow.com/a/24245646
has comment: http://stackoverflow.com/comment/104174140
score: 2
has comment: http://stackoverflow.com/comment/37490838
downvote count: 0
answers question: http://stackoverflow.com/q/24227597
has comment: http://stackoverflow.com/comment/37476357
has body: Instead of reading the entire file into memory all at once, you can accomplish the same thing with Files.copy(zips, outFile.toPath());. Documentation for the Files.copy method is here.
has comment: http://stackoverflow.com/comment/104173667
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/104215055

http://stackoverflow.com/comment/37239089
type: Comment
type: QuestionComment
has text: issue is in code line JButton.addActionListener(new ActionListener() { ???
comment on: http://stackoverflow.com/q/24134581
score: 0

http://stackoverflow.com/a/24236191
downvote count: 0
upvote count: 9
has body: This is because a byte can only store numbers ranging from -128 to 127, and 60 * 60 = 3,600, which is way over the byte's maximum storage, so it creates an Integer Overflow error. To fix this, you could use: public static void main(String[] args) { byte b1 = 60, b2 = 60; int product = b1 * b2; System.out.println(product); } A Byte can have 8 bits (binary digits), and 3600 is 111000010000 in binary form. (12 bits), so, the 4 extra bits in the beginning are dropped so it can fit in a byte, changing the binary to 00010000 instead of 111000010000, and 000100002 = 1610, so you get the output 16 instead of the desired 3600.
type: Answer
score: 9
answers question: http://stackoverflow.com/q/24236140

http://stackoverflow.com/comment/37361306
type: QuestionComment
comment on: http://stackoverflow.com/q/24198599
has text: Ok, now you could run it again but put an `if(low==24281)`, put a breakpoint there and then you should be able to go line by line and see what it does at that point and why does it stops.
score: 0
type: Comment

http://stackoverflow.com/a/26036465
downvote count: 1
has body: Problem is releated to com.fasterxml.jackson.databind.util.EnumResolver. it uses HashMap to hold enum values and HashMap doesn't support case insensitive keys. in answers above, all chars should be uppercase or lowercase. but I fixed all (in)sensitive problems for enums with that: https://gist.github.com/bhdrk/02307ba8066d26fa1537 CustomDeserializers.java import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.deser.std.EnumDeserializer; import com.fasterxml.jackson.databind.module.SimpleDeserializers; import com.fasterxml.jackson.databind.util.EnumResolver; import java.util.HashMap; import java.util.Map; public class CustomDeserializers extends SimpleDeserializers { @Override @SuppressWarnings("unchecked") public JsonDeserializer&lt;?&gt; findEnumDeserializer(Class&lt;?&gt; type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException { return createDeserializer((Class&lt;Enum&gt;) type); } private &lt;T extends Enum&lt;T&gt;&gt; JsonDeserializer&lt;?&gt; createDeserializer(Class&lt;T&gt; enumCls) { T[] enumValues = enumCls.getEnumConstants(); HashMap&lt;String, T&gt; map = createEnumValuesMap(enumValues); return new EnumDeserializer(new EnumCaseInsensitiveResolver&lt;T&gt;(enumCls, enumValues, map)); } private &lt;T extends Enum&lt;T&gt;&gt; HashMap&lt;String, T&gt; createEnumValuesMap(T[] enumValues) { HashMap&lt;String, T&gt; map = new HashMap&lt;String, T&gt;(); // from last to first, so that in case of duplicate values, first wins for (int i = enumValues.length; --i &gt;= 0; ) { T e = enumValues[i]; map.put(e.toString(), e); } return map; } public static class EnumCaseInsensitiveResolver&lt;T extends Enum&lt;T&gt;&gt; extends EnumResolver&lt;T&gt; { protected EnumCaseInsensitiveResolver(Class&lt;T&gt; enumClass, T[] enums,…
answers question: http://stackoverflow.com/q/24157817
type: Answer
score: 0
upvote count: 1

http://stackoverflow.com/q/24226868
has answer: http://stackoverflow.com/a/24227384
tagged with: java
accepted answer: http://stackoverflow.com/a/24226903
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24226903
answer count: 2
possible better answer: http://stackoverflow.com/a/24227384
upvote count: 0
tagged with: swing
score: -1
tagged with: joptionpane
type: AnsweredQuestion
has body: I'm creating a simple commission program with the data of the sales people already in the code. I just want to find a way to search for a NAME and return their name total salary. I've hit a roadblock for the past few hours trying to do this. public class SalesPeople { String personName; double annualSalary; double salesAmount; double percentComission; public SalesPeople(String xPersonName, double xAnnualSalary, double xSalesAmount, double xPercentComission) { personName = xPersonName; annualSalary = xAnnualSalary; salesAmount = xSalesAmount; percentComission = xPercentComission; } double totalSalary = annualSalary + (salesAmount * percentComission); public String getPersonName() { return personName; } public double getAnnualSalary() { return annualSalary; } public double getSalesAmount() { return salesAmount; } public double getPercentComission() { return percentComission; } public double getTotalSalary() { return totalSalary; } } In the last few lines of the class below are where I'm having trouble. import java.util.ArrayList; import javax.swing.JOptionPane; public class CommissionCalc { public static void main (String [] args ) { ArrayList&lt;SalesPeople&gt; salesList = new ArrayList&lt;SalesPeople&gt;(); // PersonName, AnnualSalary, SalesAmount, PercentComission SalesPeople salesPerson1 = new SalesPeople ("Bob", 30000, 5000, .09); SalesPeople salesPerson2 = new SalesPeople ("Jane", 40000, 7000, .10); salesList.add(salesPerson1); salesList.add(salesPerson2); String userInput; userInput = JOptionPane.showInputDialog("Enter the name of a sales person:"); if((salesList.get(0).getPersonName()).equals(userInput)) { for (int cnt = 0; cnt &lt; salesList.size(); cnt++) { if((salesList.get(cnt).getPersonName()).equals(userInput)) { System.out.println(salesList.get(cnt).getPersonName() + salesList.get(cnt).getTotalSalary()); } } } } } } } The name prints, but I'm getting a return of 0.0 on total salary. I just can't get it to return the Name and TotalSalary. Any help would …
has title: Java simple commission program, return data based on search (JOptionPane)

http://stackoverflow.com/q/24124167
answer count: 2
has body: public static void writeShortLE(DataOutputStream out, short value) { out.writeByte(value &amp; 0xFF); out.writeByte((value &gt;&gt; 8) &amp; 0xFF); } public static void writeIntLE(DataOutputStream out, int value) { out.writeByte(value &amp; 0xFF); out.writeByte((value &gt;&gt; 8) &amp; 0xFF); out.writeByte((value &gt;&gt; 16) &amp; 0xFF); out.writeByte((value &gt;&gt; 24) &amp; 0xFF); } I'm using the two methods above for writing a short and an int. My question is: how to write a float?
upvote count: 2
has comment: http://stackoverflow.com/comment/37219393
has comment: http://stackoverflow.com/comment/37220287
downvote count: 0
accepted answer: http://stackoverflow.com/a/24124244
tagged with: endianness
favorite count: 0
has answer: http://stackoverflow.com/a/24124244
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/58516103
tagged with: java
has answer: http://stackoverflow.com/a/58516103
has title: Writing float to file in little endian?
type: Question

http://stackoverflow.com/comment/37196989
type: AnswerComment
comment on: http://stackoverflow.com/a/24111748
score: 0
has text: Well, with the rest of my code, I'm expecting to match `product[0].getName()` with the parameter, and I know that the Strings are the same because, for example, the String "Smoothie" is being set as the name for `product[0]` and the parameter being given is being set to "Smoothie" as well.
type: Comment

http://stackoverflow.com/comment/37240431
comment on: http://stackoverflow.com/a/24134678
score: 0
type: AnswerComment
type: Comment
has text: Are there restrictions on the dimensions that can be passed to resize?

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

http://stackoverflow.com/q/24206746
answer count: 0
has title: Java Create SQlite DB without physical file
type: UnansweredQuestion
tagged with: sqlite
has comment: http://stackoverflow.com/comment/37374910
has body: I am using Java, Spring . Need to create Sqlite DB(with create table statements) On the Server(Java) and send DB to device. How can I create sqlite db and get InputStream or bytes array without creating physical file?
has comment: http://stackoverflow.com/comment/37374861
type: Question
tagged with: java
tagged with: spring
has comment: http://stackoverflow.com/comment/37374917
score: 0

http://stackoverflow.com/comment/37441109
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24240896
type: Comment
has text: thanks for replay, different timezone users entered From and To dates, i want convert that date values and use for further calculations.i did not printing to this values.

http://stackoverflow.com/comment/37195555
type: QuestionComment
comment on: http://stackoverflow.com/q/24111228
type: Comment
has text: You're close. Take a look at what you're doing in the `n==0` condition: are you sure that does the same things as the non recursive method? :)
score: 0

http://stackoverflow.com/a/24221007
accepted answer of: http://stackoverflow.com/q/24220967
score: 3
answers question: http://stackoverflow.com/q/24220967
type: Answer
has comment: http://stackoverflow.com/comment/37402048
upvote count: 3
has body: Scanner does not provide a constructor which takes an array as an argument. It provides a constructor which takes a single String (containing the data to scan), though. In case you want to scan a file (that's what it seems judging from your System.out), just pass a file argument to Scanner's constructor, as shown below. Change it from: Scanner scanner = new Scanner(args); to: Scanner scanner = new Scanner(new java.io.File(args[0]));
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37402027

http://stackoverflow.com/q/24205890
tagged with: plugins
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37395972
has comment: http://stackoverflow.com/comment/37377574
has comment: http://stackoverflow.com/comment/37395023
answer count: 0
downvote count: 0
has body: I am working on an Eclipse plugin and would like to make some of his suggestions to be compiler errors if not handled and so I created a Compilation Participant that always creates a compilation error. My code: public class compilerNotificator extends CompilationParticipant{ @Override public int aboutToBuild(@SuppressWarnings("unused") final IJavaProject project){ return 0; } @Override public boolean isActive(@SuppressWarnings("unused") final IJavaProject project){ return true; } @Override public void reconcile(final ReconcileContext context){ final CategorizedProblem[] problems = new CategorizedProblem[1]; problems[0] = new CategorizedProblem() { @Override public void setSourceStart(final int sourceStart) { // TODO Auto-generated method stub } @Override public void setSourceLineNumber(final int lineNumber) { // TODO Auto-generated method stub } @Override public void setSourceEnd(final int sourceEnd) { // TODO Auto-generated method stub } @Override public boolean isWarning() { // TODO Auto-generated method stub return true; } @Override public boolean isError() { // TODO Auto-generated method stub return true; } @Override public int getSourceStart() { // TODO Auto-generated method stub return 3; } @Override public int getSourceLineNumber() { // TODO Auto-generated method stub return 10; } @Override public int getSourceEnd() { // TODO Auto-generated method stub return 34; } @Override public char[] getOriginatingFileName() { // TODO Auto-generated method stub return null; } @Override public String getMessage() { // TODO Auto-generated method stub return "This is some fucked up shit"; } @Override public int getID() { // TODO Auto-generated method stub return 1000129; } @Override public String[] getArguments() { // TODO Auto-generated method stub return null; } @Override public String getMarkerType() { // TODO Auto-generated method stub return "Bad"; } @Override public int getCategoryID() { // TODO Auto-generated method stub return 5; } }; context.putProblems("test", pro…
upvote count: 1
type: UnansweredQuestion
score: 1
has title: Set line number for custom compiler error
has comment: http://stackoverflow.com/comment/37411439
favorite count: 0
has comment: http://stackoverflow.com/comment/37414449
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37381385

apache
tags question: http://stackoverflow.com/q/24185091
tags question: http://stackoverflow.com/q/24147490
tags question: http://stackoverflow.com/q/24125326
tag name: apache
tags question: http://stackoverflow.com/q/24194127
tags question: http://stackoverflow.com/q/24247780
tags question: http://stackoverflow.com/q/24234036
tags question: http://stackoverflow.com/q/24116173
tags question: http://stackoverflow.com/q/24158889
tags question: http://stackoverflow.com/q/24262852
tags question: http://stackoverflow.com/q/24159101
tags question: http://stackoverflow.com/q/24139636
tags question: http://stackoverflow.com/q/24230963
tags question: http://stackoverflow.com/q/24257546
tags question: http://stackoverflow.com/q/24184522
tags question: http://stackoverflow.com/q/24158939
type: Tag
tags question: http://stackoverflow.com/q/24136598
tags question: http://stackoverflow.com/q/24260528
tags question: http://stackoverflow.com/q/24175744
tags question: http://stackoverflow.com/q/24165787
tags question: http://stackoverflow.com/q/24162088
tags question: http://stackoverflow.com/q/24246278
tags question: http://stackoverflow.com/q/24203087
tags question: http://stackoverflow.com/q/24246258
tags question: http://stackoverflow.com/q/24243381
tags question: http://stackoverflow.com/q/24160177
tags question: http://stackoverflow.com/q/24266303
tags question: http://stackoverflow.com/q/24106352
tags question: http://stackoverflow.com/q/24237300
tags question: http://stackoverflow.com/q/24220324
tags question: http://stackoverflow.com/q/24132601

http://stackoverflow.com/comment/37336895
has text: It also seems that `itemModel.id` should be reduces to `id` as the parameter name.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24176478

database-metadata
tags question: http://stackoverflow.com/q/24197610
type: Tag
tag name: database-metadata
tags question: http://stackoverflow.com/q/24266513

http://stackoverflow.com/q/24233095
downvote count: 0
upvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24236586
type: Question
has answer: http://stackoverflow.com/a/24236586
tagged with: jsoup
has title: Finding un-tagged text with Jsoup
answer count: 1
has body: I searched for an answer on my dilemma but have come up short thus far - with no obvious solutions in my results (and I've spent quite a bit of time trying suggestions in various posts that seemed semi-related). Ok, now to the meat: I've got a snippet of html that I'd like to get some text from - but the problem is, the text doesn't appear to have a tag (and it's not a 100% occurrence - under certain understood circumstances does the text not have a tag) Example html below: &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : . . &lt;a href="?act=Q&amp;amp;ID=249629586" target="R"&gt;&lt;b&gt;Post title that I have removed&lt;/b&gt;&lt;/a&gt; &amp;lt; &lt;span class="hnd anon"&gt;PosterHandleIReplaced&lt;/span&gt; &amp;gt; &lt;font size="1"&gt;06/15 11:41&amp;nbsp;&amp;nbsp;&lt;/font&gt; &lt;/body&gt; &lt;/html&gt; So, the portion of text that I want to grab is between &lt;body&gt; and &lt;a href&gt;, here: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : . . But I'm not seeing a way to grab only that text. When I try to convert the document or element to text, it ends up converting the entire html block into a string and returning me that, which is not what I want. I suppose I could take that entire string and start parsing it out - but that seems like it would be ridiculously error prone - not to mention the : . . part can actually be longer - depending on where the response in the thread is located (if it's buried in the thread, it could look like : . . : . . : . . : . . etc). Any help would be greatly appreciated!

http://stackoverflow.com/a/24107534
type: Answer
answers question: http://stackoverflow.com/q/24106845
score: 0
has body: It's really bad habit doing string concatenate using String because it create n number of object w.r.t concatenate better use StringBuffer or StringBuilder depend upon you need Thread safe object or not below is the example of StringBuffer StringBuffer s=new StringBuffer(); s.append(resultSet.getString("name")); s.append(","); s.append(resultSet.getString("nameId")); s.append(","); s.append(resultSet.getString("zipcode")); System.out.println(s.toString);

http://stackoverflow.com/comment/37423607
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24230907
has text: Thanks a lot Craig. I agree with you. My app talks to many database like Sybase IQ, DB2, Postgres, ParAccel etc. I have same logic queries in different forms to support all these targets. So what do you suggest should I go with Postgres as unit test target. If all queries with expected end datasets works fine in Postgress I can assume it will work fine in all other dbs and it works as I did manual testing for them. Please guide. Your guidance will be a great help.
type: Comment

http://stackoverflow.com/a/24151599
upvote count: 21
score: 21
type: Answer
answers question: http://stackoverflow.com/q/24151398
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24151398
has body: You won't be able to rename keys in key-value JSON pairs. What you will need to do is create a new key-value pair with the same value but with a different key and remove the old one. JsonNode node = ...; ObjectNode object = (ObjectNode) node; object.set("MyNewFieldName", node.get("temperature")); object.remove("temperature");
type: AcceptedAnswer

http://stackoverflow.com/a/24254311
answers question: http://stackoverflow.com/q/24254264
score: 2
has body: Specify the encoding when creating InputStreamReader to read the file from the ftp, for example: BufferedReader br = new BufferedReader(new InputStreamReader(reader, "utf-8")); Otherwise, InputStreamReader uses default encoding. Also, specify the encoding when reading the downloaded file. FileReader uses default platform encoding. Use InputStreamReader and specify encoding, for example: BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "utf-8"));
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/a/24155980
has comment: http://stackoverflow.com/comment/37280040
has comment: http://stackoverflow.com/comment/37281301
type: Answer
has comment: http://stackoverflow.com/comment/37280221
has comment: http://stackoverflow.com/comment/37279249
score: -1
has comment: http://stackoverflow.com/comment/37279948
upvote count: 0
has comment: http://stackoverflow.com/comment/37279807
downvote count: 1
has body: Use getResourceAsStream() instead of getResource InputStream in = new InputStreamReader(FileLoader.class.getClassLoader().getResourceAsStream("file.txt") ); If its doesn't work The best way to look to a config file from a webapp is to implement the servlet method init(). Let’ try using the same code InputStream in = new InputStreamReader(FileLoaderServlet.class.getClassLoader().getResourceAsStream("file.txt") ); Refer https://haveacafe.wordpress.com/2008/10/19/how-to-read-a-file-from-jar-and-war-files-java-and-webapp-archive/
has comment: http://stackoverflow.com/comment/37279691
has comment: http://stackoverflow.com/comment/37279105
answers question: http://stackoverflow.com/q/24155761

http://stackoverflow.com/a/24236588
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24223110
has body: Here's the solution: I basically made a stand alone and I parsed your JSON like this: First : This is the method I used to parse the JSON: public String loadJSON(String someURL) { String json = null; HttpClient mHttpClient = new DefaultHttpClient(); HttpGet mHttpGet = new HttpGet(someURL); try { HttpResponse mHttpResponse = mHttpClient.execute(mHttpGet); StatusLine statusline = mHttpResponse.getStatusLine(); int statusCode = statusline.getStatusCode(); if (statusCode != 200) { return null; } InputStream jsonStream = mHttpResponse.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader( jsonStream)); StringBuilder builder = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { builder.append(line); } json = builder.toString(); } catch (IOException ex) { ex.printStackTrace(); return null; } mHttpClient.getConnectionManager().shutdown(); return json; } Second : Used Async Task to download the data: public class BackTask extends AsyncTask&lt;Void, Void, Void&gt; { String url; public BackTask(String URL) { super(); this.url = URL; } @Override protected Void doInBackground(Void... params) { getData(url); return null; } } Third: Method to get the data and parse it. I have made some comments for this part since it's a bit long than usual. public void getData(String URL) { try { JSONObject mainJsonObject = new JSONObject(loadJSON(URL)); // Log.d("JSON Data : ", mainJsonObject.toString()); String Status = mainJsonObject.getString("status"); Log.d("JSON Status : ", Status + "\n" + "---------------------"); JSONArray mainArray = mainJsonObject.getJSONArray("results"); // Log.d("JSON Array : ", mainArray.toString()); for (int i = 0; i &lt; mainArray.length(); i++) { JSONObject insideJsonObject = mainArray.getJSONObject(i); if (insideJsonObject != null) { String address_components = insideJsonObject .getString("address_components"); // Log.d("Inside JSON Array : ", address_components); JSONArray addressJSON = insideJsonO…

http://stackoverflow.com/comment/37366372
score: 0
has text: @gontard I don't know java8, but can you try making `observable` `final` and passing `observable` instead of `this`?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24202272

http://stackoverflow.com/q/24213993
has comment: http://stackoverflow.com/comment/37389760
type: Question
has comment: http://stackoverflow.com/comment/37392183
tagged with: java
accepted answer: http://stackoverflow.com/a/24214013
has body: import java.awt.*; import javax.swing.*; public class Crisis extends JFrame { public Crisis() { super("Crisis"); setLookAndFeel(); setSize(348, 400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panicButton = new JButton("Panic"); dontPanicButton = new JButton("Don't Panic"); blameButton = new JButton("Blame Others"); mediaButton = new JButton("Notify the Media"); saveButton = new JButton("Save Yourself"); JPanel pane = new JPanel(); BorderLayout moo = new BorderLayout(); pane.setLayout(moo); pane.add(panicButton, BorderLayout.NORTH); pane.add(dontPanicButton, BorderLayout.SOUTH); add(pane); FlowLayout flo = new FlowLayout(FlowLayout.CENTER,10,10); JPanel noo = new JPanel(); noo.setLayout(flo); noo.add(blameButton); noo.add(mediaButton); noo.add(saveButton); add(noo); setVisible(true); } public static void main(String[] arguments) { new Crisis(); } } panicButton and dontPanicButton don't show in GUI
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24214013
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/37389498
tagged with: swing
has comment: http://stackoverflow.com/comment/37389805
answer count: 1
favorite count: 0
has title: All buttons do not show

http://stackoverflow.com/a/24136935
accepted answer of: http://stackoverflow.com/q/24135759
has comment: http://stackoverflow.com/comment/37243597
has comment: http://stackoverflow.com/comment/37243755
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37244849
answers question: http://stackoverflow.com/q/24135759
has comment: http://stackoverflow.com/comment/37243922
has comment: http://stackoverflow.com/comment/37245067
has comment: http://stackoverflow.com/comment/37245478
score: 0
has body: Take a look at your btMinusActionPerformed method: private void btMinusActionPerformed(java.awt.event.ActionEvent evt) { // minus button firstNumber = Float.parseFloat(calScreen.getText()); OP = "-"; numberClick += 1; if (!calScreen.getText().equals("-") &amp;&amp; numberClick == 2){ btEqual.doClick(); } else { calScreen.setText("-"); // &lt;- What does this do? } } Then take a look at the btEqualActionPerformed method: private void btEqualActionPerformed(java.awt.event.ActionEvent evt) { // Result // What is getText() going to return if you pressed the minus button? secondNumber = Float.parseFloat(calScreen.getText()); { ... } // Omitted for brevity } Follow that through logically and you'll notice that when you click the buttons for 1, -, and 2, you will read in 1 and -2. You're already storing the operand in OP, so what you'll do is 1 - (-2), which does actually equal 3. Your problem is in btMinusActionPerformed - that's where you need to fix your code. Additionally, your operations regular expression isn't quite correctly defined. You haven't escaped either the - or the ., so they aren't going to work in the way that you expect them to. operations = "[+|\\-|x|/|0|\\.]", // ^ ^ // Note the escape characters at these two locations That should make your regex work in the way you intended for it to work. An alternative solution would be to remove: calScreen.setText("-"); From your btMinusActionPerformed method (and the corresponding lines from the other three operator's methods), which would mean that the regex wasn't necessary.
has comment: http://stackoverflow.com/comment/37245011
type: Answer
has comment: http://stackoverflow.com/comment/37243532
has comment: http://stackoverflow.com/comment/37244614
has comment: http://stackoverflow.com/comment/37244871
has comment: http://stackoverflow.com/comment/37245837
has comment: http://stackoverflow.com/comment/37243852
has comment: http://stackoverflow.com/comment/37243581
has comment: http://stackoverflow.com/comment/37243686
has comment: http://stackoverflow.com/comment/37244798
has comment: http://stackoverflow.com/comment/37243491

http://stackoverflow.com/a/24262170
answers question: http://stackoverflow.com/q/24261552
has comment: http://stackoverflow.com/comment/37481584
has body: Most probably is not related but change ${Machine.machineName} to ${machine.machineName}
has comment: http://stackoverflow.com/comment/37480424
has comment: http://stackoverflow.com/comment/37480838
score: 0
type: Answer

http://stackoverflow.com/comment/37237890
comment on: http://stackoverflow.com/q/24133773
score: 0
type: QuestionComment
has text: Why the solution you posted doesn't work?
type: Comment

http://stackoverflow.com/comment/37184273
type: QuestionComment
has text: Have you tried with `GET` request as well?
score: 0
comment on: http://stackoverflow.com/q/24105267
type: Comment

http://stackoverflow.com/comment/37252174
comment on: http://stackoverflow.com/q/24141720
has text: http://stackoverflow.com/questions/2262620/how-to-find-the-number-of-objects-in-the-heap has few options of counting objects in heap. You may check and scope it to request.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24237670
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24237720
has comment: http://stackoverflow.com/comment/37435145
has title: Syntax error in R.java in android
upvote count: 1
has body: I get the following syntax error in R.java public static final int abs__shareactionprovider_share_with_application=0x7f0a0007; /** Replace placeholder ID with your tracking ID */ public static final int ga_trackingId=0x7f0a000d; public static final int Î¤Î§Î¤_BYTECODE=0x7f0a0065; public static final int Î¤Î§Î¤_EMPTY=0x7f0a0064; public static final int Î¤Î§Î¤_EVERY_30_DAYS=0x7f0a0048; public static final int Î¤Î§Î¤_EVERY_7_DAYS=0x7f0a0047; public static final int Î¤Î§Î¤_EVERY_90_DAYS=0x7f0a0049; public static final int Î¤Î§Î¤_EVERY_DAY=0x7f0a0046; } I tried to delete these lines but nothing happens can you please help me solve this
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/37435298
has comment: http://stackoverflow.com/comment/37434118
has comment: http://stackoverflow.com/comment/37434401
has comment: http://stackoverflow.com/comment/37433973
answer count: 1
has comment: http://stackoverflow.com/comment/37433998
has comment: http://stackoverflow.com/comment/37435372
has comment: http://stackoverflow.com/comment/37433995
favorite count: 0
has comment: http://stackoverflow.com/comment/37434031
type: Question
has comment: http://stackoverflow.com/comment/37435194
has comment: http://stackoverflow.com/comment/37434248
tagged with: android

http://stackoverflow.com/comment/37327744
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24179643
has text: thanks (+1) for an SSCCE, [most of overrides at runtime required, it should be ...](http://stackoverflow.com/questions/9958004/change-font-at-runtime), again to look at custom L&F based on Nimbus, there is solved a few issues :-)

http://stackoverflow.com/q/24161944
downvote count: 0
upvote count: 1
has body: I am working on an app that inserts content of an XML file in MSSQL DB, everytime app server is started. The XML contains multiple records of related tables. The stored proc takes the XML file content as (TEXT) argument, creates a pointer (sp_xml_preparedocument) &amp; inserts into tables using OPENXML. I need to execute the procedure using JDBC (or may be SQLCMD) from the application server where the XML file resides. The XML file is around 160MB, right now I am sending the XML file by reading as a large String object to the CallableStatement, but its very time/space/resource consuming.
tagged with: sql-server
tagged with: callable-statement
score: 1
tagged with: java
answer count: 1
has title: What is the best approach to invoke a MSSQL procedure, which takes a large XML file as an argument?
tagged with: t-sql
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24176458

http://stackoverflow.com/comment/71540505
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24142768
has text: Fantastic finally added these so I can view the file database in fbvizualizer jdbc:h2:~/nexin;DB_CLOSE_DELAY=-1;MODE=MySQL;MV_STORE=FALSE;MVCC=FALSE

http://stackoverflow.com/comment/37332178
type: Comment
has text: Why not parse it as an int and check that the value is <2 or >5?
type: QuestionComment
comment on: http://stackoverflow.com/q/24184773
score: 4

http://stackoverflow.com/a/29679439
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/47501473
answers question: http://stackoverflow.com/q/24155628
has body: Adding largeHeap="true" in your manifest may help. This will allow your application to use more memory. See: http://developer.android.com/guide/topics/manifest/application-element.html
type: Answer

http://stackoverflow.com/q/24193672
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24193715
has comment: http://stackoverflow.com/comment/37349935
tagged with: regex
has answer: http://stackoverflow.com/a/24193715
type: AnsweredQuestion
has body: I'm having some issues with single-line regex (or DOTALL for Java guys). I want to match each one of these set directives on a document. My regex is this one: \{\%\s*set\s+(\S+)\s*\%\}.+\{\%\s*endset\s*\%\} And my target content to match looks something like this: {% set var1 %} some multiline really long content {% endset %} &lt;other random code&gt; {% set var2 %} some multiline other really long content {% endset %} The problem with this regex is that the first match (and only in the whole document) begins at {% set var1 %} and ends at {% endset %} from the second code block. I tried using lookahead and lookbehind with no results. Any suggestion? Thanks,
upvote count: 2
has comment: http://stackoverflow.com/comment/37349852
answer count: 1
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37350077
has title: Single line (DOTALL) regex matching more than I want

http://stackoverflow.com/q/24218756
has answer: http://stackoverflow.com/a/24218796
has comment: http://stackoverflow.com/comment/37397798
has title: How to serialize Object with JFrame inside and transfer it via network
tagged with: sockets
answer count: 1
has body: I have object Client, which has JFrame inside. I need to transfer Client via network, but JFrame contains a lot of UI objects such as text fields, buttons etc. When I try to do it I get java.io.NotSerializableException. I declared my JFrame as Serializable, but I will not to create custom UI objects to do it for each. How I can transfer my Client with JFrame inside via network? I found some solutions, but they all applicable for JFrame only, but not for more complex object.
tagged with: swing
linked to: http://stackoverflow.com/q/9874304
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37397753
accepted answer: http://stackoverflow.com/a/24218796
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37397978
type: Question
tagged with: serialization

http://stackoverflow.com/q/24265573
has answer: http://stackoverflow.com/a/24267170
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/34059486
has comment: http://stackoverflow.com/comment/37489314
tagged with: multipartform-data
downvote count: 0
has body: I wrote a simple controller for uploading files: @RestEndpoint public class ImageController { @Autowired GridFsTemplate mTemplate; @RequestMapping(value = "images", method = RequestMethod.POST) public @ResponseBody String testPhoto(@RequestParam String name, @RequestParam String directory, @RequestParam MultipartFile file) throws IOException { if(!file.isEmpty()){ final byte[] bytes = file.getBytes(); InputStream inputStream = new ByteArrayInputStream(bytes); mTemplate.store(inputStream, "name"); return "uploaded photo"; } return "failed"; } } @RestEndpoint annotation is: @Target({ ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented @Controller public @interface RestEndpoint { String value() default ""; } My ContextCOnfiguration class is: @Configuration @EnableWebMvc @ComponentScan( basePackages = "com.questter.site", useDefaultFilters = false, includeFilters = @ComponentScan.Filter({RestEndpoint.class, RestEndpointAdvice.class}) ) public class RestServletContextConfiguration extends WebMvcConfigurerAdapter { @Bean public CommonsMultipartResolver multiPartResolver(){ CommonsMultipartResolver resolver = new CommonsMultipartResolver(); return resolver; } ... } --- UPDATED --- web.xml file: <?xml version="1.0" encoding="UTF-8"?> Spring Application *.jsp *.jspf UTF-8 true /WEB-INF/jsp/base.jspf <trim-directive-whitespaces>true</trim-directive-whitespaces> text/html 30 true COOKIE <distributable /> ---- UPDATED ---- public class Bootstrap implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) throws ServletException { container.getServletRegistration("default").addMapping("/resource/*"); AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(RootContextConfiguration.class); container.addListener(new ContextLoaderListener(rootContext)); AnnotationConfigWebApplicationContext webContext = new AnnotationConfigWebApplicationContext(); webContext.register(We…
has comment: http://stackoverflow.com/comment/37488760
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37489454
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/50466054
upvote count: 8
has title: Unable to process parts as no multi-part configuration has been provided
tagged with: java
has answer: http://stackoverflow.com/a/46260779
tagged with: spring
accepted answer: http://stackoverflow.com/a/24267170
answer count: 4
possible better answer: http://stackoverflow.com/a/34059486
score: 8
has comment: http://stackoverflow.com/comment/37489788
has comment: http://stackoverflow.com/comment/37489742

http://stackoverflow.com/a/24240873
has comment: http://stackoverflow.com/comment/37443748
type: AcceptedAnswer
downvote count: 0
has body: You have basically two options : either you use a different name for each checkbox or you use spring tag &lt;form:checkbox&gt; instead of native &lt;checkbox&gt; If you don't posted data will not allow you to know exactly what boxes were actually checked (excepted in cases all and none) With the approach, you should use in your controller a @ModelAttribute annotated object containing a List&lt;Boolean&gt; and spring will automagically populate it with the values of your checkboxes. @RequestMapping(value = "/changeme", params = { "save" }) public String save(@ModelAttribute BoxesForm form, final ModelMap m) { // do what you need with form.getCheckboxes() ... m.addAttribute("centers", /*params*/); return "clustering"; } public class BoxesForm { List&lt;Boolean&gt; checkboxes; // getter and setter omitted ... }
upvote count: 1
answers question: http://stackoverflow.com/q/24239987
has comment: http://stackoverflow.com/comment/37444268
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24239987
has comment: http://stackoverflow.com/comment/37445027

http://stackoverflow.com/comment/37526613
has text: used libraries org.springframework.amqp:spring-rabbit:1.2.0.RELEASE com.rabbitmq:amqp-client:3.2.1
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24271589
type: AnswerComment

http://stackoverflow.com/comment/37615648
type: Comment
type: AnswerComment
has text: Its a plain text data stream, I am not sure what you mean by consistency requirements. It is stock tick data so it is only generating data from 9:30 - 4:30 EST but I am graphing/analyzing the data in my program.
comment on: http://stackoverflow.com/a/24216323
score: 0

http://stackoverflow.com/a/24185319
accepted answer of: http://stackoverflow.com/q/24181388
score: 2
has comment: http://stackoverflow.com/comment/37340372
has body: select_job = new PopupMenu(this, view); Here, view is the Anchor for the popup menu. You should pass the MenuItem, (R.id.popupmenu) as the anchor. I haven't done it myself (anchored a PopupMenu to a Actionbar item) but that should be the idea behind it, I think. From the Android Documents: public PopupMenu (Context context, View anchor) Added in API level 11 Construct a new PopupMenu. Parameters context : Context for the PopupMenu. anchor : Anchor view for this popup. The popup will appear below the anchor if there is room, or above it if there is not.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37334560
upvote count: 2
answers question: http://stackoverflow.com/q/24181388
downvote count: 0
has comment: http://stackoverflow.com/comment/37334707
type: Answer

http://stackoverflow.com/q/24185342
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37335004
answer count: 0
has comment: http://stackoverflow.com/comment/37370048
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37333654
downvote count: 0
upvote count: 1
tagged with: swing
tagged with: design-patterns
has title: Jlabel created from a template method pattern doesn't appear on application
has comment: http://stackoverflow.com/comment/37369969
has body: I am working on MVC and design pattern, so I am trying to put them all together to an application that creates JLabels dynamically and handles label text, fonts, alignment and color. As I conceived it, there is a Template that sets text, font, color and alignment to the label. I am using the template pattern here and the code goes like this import java.awt.*; import javax.swing.JFrame; import javax.swing.JLabel; public abstract class labelTemplate{ JLabel abstractJLabel = new JLabel(); textAlignmentView textAlignmentViewObject = new textAlignmentView(); public final void createLabel(){ setLabelText(); setLabelFont(); setLabelColor(); setLabelAlignment(); addLabelToContainer(); } //all by-default values public void setLabelText(){ abstractJLabel.setText(" "); } public void setLabelFont(){ Font abstractLabelFont = new Font("Times new Roman", Font.PLAIN, 14); abstractJLabel.setFont(abstractLabelFont); } public void setLabelColor(){ abstractJLabel.setForeground(Color.BLACK); } public void setLabelAlignment(){ abstractJLabel.setAlignmentX(Label.LEFT); abstractJLabel.setAlignmentY(Label.TOP_ALIGNMENT); } public void addLabelToContainer(){ textAlignmentViewObject.addJLabelToContainer(abstractJLabel); } } Now, there is a class that extends the template above import java.awt.Font; public class boldTextLeftAlignmentLabel extends labelTemplate{ //constructor public boldTextLeftAlignmentLabel(){} @Override public void setLabelText(){ abstractJLabel.setText("Έντονο κείμενο αριστερή στοίχηση"); } @Override public void setLabelFont(){ Font abstractLabelFont = new Font("Times new Roman", Font.BOLD, 14); abstractJLabel.setFont(abstractLabelFont); } } I am creating Model, View and Controller classes and I put a boldTextLeftAlignmentLabel label in the controller Model public class textAlignmentModel { //nothing in here for now } View import java.awt.*; import javax.swing.*; public class textAlignmentView extends JFrame{ Container textAlignmentViewContainer; public textAlignmentView(){…
tagged with: model-view-controller
tagged with: java
score: 1

http://stackoverflow.com/a/24192324
score: 2
type: Answer
answers question: http://stackoverflow.com/q/24192220
upvote count: 2
has body: You can use the following regex to get categories: \[\[Category:(.+)\]\] Then you can access to your groups to get the category values. Remember to add backslash to backslashes if you use on java strings: \\[\\[Category:(.+)\\]\\] You can see it working:
downvote count: 0

http://stackoverflow.com/a/24234982
has comment: http://stackoverflow.com/comment/37437497
type: Answer
answers question: http://stackoverflow.com/q/24233389
has comment: http://stackoverflow.com/comment/37453060
score: 1
has comment: http://stackoverflow.com/comment/37438807
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37430564
has body: As I understand you, you know that the float is within one float-ulp of an integer number of hundredths, and you know that you're well inside the range where no two integer numbers of hundredths map to the same float. So the information isn't gone at all; you just need to figure out which integer you had. To get two decimal places, you can multiply by 100, rint/Math.round the result, and multiply by 0.01 to get a close-by double as you wanted. (To get the closest, divide by 100.0 instead.) But I suspect you knew this already and are looking for something that goes a little faster. Try ((9007199254740992 + 100.0 * x) - 9007199254740992) * 0.01 and don't mess with the parentheses. Maybe strictfp that hack for good measure. You said five significant figures, and apparently your question isn't limited to MSFT share prices. Up until doubles can't represent powers of 10 exactly, this isn't too bad. (And maybe this works beyond that threshold too.) The exponent field of a float narrows down the needed power of ten down to two things, and there are 256 possibilities. (Except in the case of subnormals.) Getting the right power of ten just needs a conditional, and the rounding trick is straightforward enough. All of this is all going to be a mess, and I'd recommend you stick with the toString approach for all the weird cases.
has comment: http://stackoverflow.com/comment/37437319
has comment: http://stackoverflow.com/comment/37496227

http://stackoverflow.com/comment/37459347
score: 0
comment on: http://stackoverflow.com/a/24250583
type: Comment
type: AnswerComment
has text: Oh, I see, so I can't send a "http://www.example.com/test?xml=" so that I can pass multiple xml files? Just one output stream of an xml file, I suppose....

http://stackoverflow.com/a/24111292
upvote count: 3
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/24111228
has body: No, this recursive solution is not correct. For every positive n, you're just return rectFact(n-1), which will recourse until you reach 0, at which point it will return. In other words, your function will always return 0. You're missing the part where you multiply the current n with rectFact(n-1). Additionally, note that 0! is 1, not 0: public static int recFact(int n) { if(n==0) { return 1; } else { return n * recFact(n-1); } } And finally, since the if clause returns, the else is somewhat redundant. This doesn't affect the method's correctness, of course, but IMHO the code looks cleaner without it: public static int recFact(int n) { if(n==0) { return 1; } return n * recFact(n-1); }
answers question: http://stackoverflow.com/q/24111228
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24177339
upvote count: 5
type: Answer
has body: I work out follow CustomInjections Code like this public class PropsModule extends AbstractModule { private final Props props; private final InProps inProps; private PropsModule(Props props) { this.props = props; this.inProps = InProps.in(props); } public static PropsModule of(Props props) { return new PropsModule(props); } @Override protected void configure() { bindListener(Matchers.any(), new TypeListener() { @Override public &lt;I&gt; void hear(TypeLiteral&lt;I&gt; type, TypeEncounter&lt;I&gt; encounter) { Class&lt;? super I&gt; clazz = type.getRawType(); if (!clazz.isAnnotationPresent(WithProp.class)) return; for (Field field : clazz.getDeclaredFields()) { Prop prop = field.getAnnotation(Prop.class); if (prop == null) continue; encounter.register(new PropInjector&lt;I&gt;(prop, field)); } } }); } class PropInjector&lt;T&gt; implements MembersInjector&lt;T&gt; { private final Prop prop; private final Field field; PropInjector(Prop prop, Field field) { this.prop = prop; this.field = field; field.setAccessible(true); } @Override public void injectMembers(T instance) { try { Class&lt;?&gt; targetType = field.getType(); Object val = inProps.as(prop.value(), targetType); field.set(instance, val); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } } }
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24176493
answers question: http://stackoverflow.com/q/24176493

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/24256630
tags question: http://stackoverflow.com/q/24114790
tags question: http://stackoverflow.com/q/24153172
tags question: http://stackoverflow.com/q/24154554
tags question: http://stackoverflow.com/q/24222322
tags question: http://stackoverflow.com/q/24233184
tags question: http://stackoverflow.com/q/24241177
tags question: http://stackoverflow.com/q/24220652
tags question: http://stackoverflow.com/q/24141374
tags question: http://stackoverflow.com/q/24219440
tags question: http://stackoverflow.com/q/24106734
tags question: http://stackoverflow.com/q/24248420
tags question: http://stackoverflow.com/q/24215446
tags question: http://stackoverflow.com/q/24251126
tag name: xml
tags question: http://stackoverflow.com/q/24231344
tags question: http://stackoverflow.com/q/24248082
tags question: http://stackoverflow.com/q/24216180
tags question: http://stackoverflow.com/q/24153942
tags question: http://stackoverflow.com/q/24179101
tags question: http://stackoverflow.com/q/24229260
tags question: http://stackoverflow.com/q/24211794
tags question: http://stackoverflow.com/q/24138133
tags question: http://stackoverflow.com/q/24204177
tags question: http://stackoverflow.com/q/24146995
tags question: http://stackoverflow.com/q/24115831
tags question: http://stackoverflow.com/q/24249824
tags question: http://stackoverflow.com/q/24246365
tags question: http://stackoverflow.com/q/24145120
tags question: http://stackoverflow.com/q/24225432
tags question: http://stackoverflow.com/q/24252410
tags question: http://stackoverflow.com/q/24150326
tags question: http://stackoverflow.com/q/24108084
tags question: http://stackoverflow.com/q/24237888
tags question: http://stackoverflow.com/q/24266510
type: Tag
tags question: http://stackoverflow.com/q/24159979
tags question: http://stackoverflow.com/q/24223546
tags question: http://stackoverflow.com/q/24191925
tags question: http://stackoverflow.com/q/24112813
tags question: http://stackoverflow.com/q/24161944
tags question: http://stackoverflow.com/q/24162287
tags question: http://stackoverflow.com/q/24237276
tags question: http://stackoverflow.com/q/24215004
tags question: http://stackoverflow.com/q/24186166
tags question: http://stackoverflow.com/q/24118365
tags question: http://stackoverflow.com/q/24204893
tags question: http://stackoverflow.com/q/24185782
tags question: http://stackoverflow.com/q/24183744
tags question: http://stackoverflow.com/q/24169021
tags question: http://stackoverflow.com/q/24224285
tags question: http://stackoverflow.com/q/24129690
tags question: http://stackoverflow.com/q/24106623
tags question: http://stackoverflow.com/q/24195364
tags question: http://stackoverflow.com/q/24180819
tags question: http://stackoverflow.com/q/24181638
tags question: http://stackoverflow.com/q/24116586
tags question: http://stackoverflow.com/q/24116496
tags question: http://stackoverflow.com/q/24113529
tags question: http://stackoverflow.com/q/24127116
tags question: http://stackoverflow.com/q/24262979
tags question: http://stackoverflow.com/q/24133093
tags question: http://stackoverflow.com/q/24108378
tags question: http://stackoverflow.com/q/24258118
tags question: http://stackoverflow.com/q/24176343
tags question: http://stackoverflow.com/q/24217886
tags question: http://stackoverflow.com/q/24202623
tags question: http://stackoverflow.com/q/24116463
tags question: http://stackoverflow.com/q/24167833
tags question: http://stackoverflow.com/q/24153408
tags question: http://stackoverflow.com/q/24163564
tags question: http://stackoverflow.com/q/24216150
tags question: http://stackoverflow.com/q/24168673
tags question: http://stackoverflow.com/q/24227599
tags question: http://stackoverflow.com/q/24219987
tags question: http://stackoverflow.com/q/24128132
tags question: http://stackoverflow.com/q/24152433
tags question: http://stackoverflow.com/q/24218567
tags question: http://stackoverflow.com/q/24240000
tags question: http://stackoverflow.com/q/24241159

http://stackoverflow.com/a/24202485
type: Answer
answers question: http://stackoverflow.com/q/24201825
has body: The location of your endorsed jars is incorrect. It should be: %JAVA_HOME%\jre\lib\endorsed which in your case is: C:\Java\jdk1.7.0_55\jre\lib\endorsed Put the jaxb jars here, remove all others and re-try.
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/24129619
has comment: http://stackoverflow.com/comment/37230923
tagged with: crash
has answer: http://stackoverflow.com/a/24129803
has title: No view found for id 0x for fragment MyFragment
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/37230512
type: Question
has comment: http://stackoverflow.com/comment/37230744
has comment: http://stackoverflow.com/comment/37231940
tagged with: android-layout
score: 0
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/37230459
tagged with: android
tagged with: java
has body: I've a problem to call a new fragment in a FragmentManager. When I try to call the fragment in main activity, I receive this log and I don't know why: Process: com.robertot.timereport, PID: 31255 java.lang.IllegalArgumentException: No view found for id 0x7f07000a (com.robertot.timereport:id/content_frame) for fragment MyFragment{64c07710 #0 id=0x7f07000a} This is my MainActivity class: public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //... } private void LoadFragment(int position) { Fragment frgm = null; FragmentManager fm = getSupportFragmentManager(); switch(position) { case 1: frgm = new MyFragment(); fragmentTag = "newjob"; break; } fm.beginTransaction() .replace(R.id.content_frame, frgm, fragmentTag) // CRASH HERE .commit(); } } This is my activity_main xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/content_frame"&gt; &lt;/FrameLayout&gt; This is MyFragment class: public class MyFragment extends Fragment { private CardListView listView; private InterfaceProgressBar listenerProgrBar; @Override public void onAttach(Activity activity) { super.onAttach(activity); listenerProgrBar = (InterfaceProgressBar) activity; } @Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) { return inflater.inflate(R.layout.summary,container,false); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); listView = (CardListView) view.findViewById(R.id.cardlist); } @Override public void onResume() { super.onResume(); //...do works } } What am I doing wrong? Thanks for the support!

http://stackoverflow.com/q/24201825
has body: Im generating some classes from WSDL files with wsimport maven plugin @ Mule Anypoint Studio 3.5 with JDK 1.7_55 I'm using jaxb 2.2.7 and remove version 2.1.9 from mule libs and replaced by 2.2.7. When i compile, sometines works fine but others i take this error multiple times: The attribute required is undefined for the annotation type XmlElementRef I tried to create an endorsed folder in JDK and include .jars needed, Do you know any way to avoid this error or replace this libs correctly? I include this dependencies in pom.xml com.sun.xml.ws jaxws-tools 2.2.7 com.sun.xml.bind jaxb-impl 2.2.7 com.sun.xml.bind jaxb-xjc 2.2.7 javax.xml.bind jaxb-api 2.2.7 org.codehaus.mojo idlj-maven-plugin 1.2.1 wsimport is 2.2.7 to wsimport settings: <plugin> org.jvnet.jax-ws-commons jaxws-maven-plugin 2.2.1 <executions> wsdl-AMANSequenceService-exec wsimport -version -B-nv -Xdebug -B-XautoNameResolution -Xendorsed true ${basedir}/src/main/java ${basedir}/src/main/java true ${basedir}/src/main/resources/SICG/AMANSequenceService AMANSequenceService.wsdl ${basedir}/src/main/resources/SICG/external/binding.xjb
has answer: http://stackoverflow.com/a/24202485
has title: JAXB mixed versions? undefined 'required' attribute
answer count: 4
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26005103
tagged with: java-7
downvote count: 0
has comment: http://stackoverflow.com/comment/37365927
accepted answer: http://stackoverflow.com/a/24242553
favorite count: 0
has answer: http://stackoverflow.com/a/24242553
type: Question
has comment: http://stackoverflow.com/comment/37366207
has comment: http://stackoverflow.com/comment/37366181
upvote count: 8
possible better answer: http://stackoverflow.com/a/24202485
tagged with: java
has answer: http://stackoverflow.com/a/38530216
tagged with: mule
tagged with: jax-ws
tagged with: jaxb

http://stackoverflow.com/q/24242175
tagged with: jfreechart
has title: Show JfreeChart on Button Click in swing
favorite count: 0
type: Question
tagged with: charts
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24246954
downvote count: 0
tagged with: swing
score: 2
linked to: http://stackoverflow.com/q/5864490
tagged with: java
answer count: 1
has body: So below is my code I have created the histogram chart using JFree I wanted to show the out put on Button click this is the histogram of normalized image i wanted to do that the on botton click the jfreechart is open on the panel and save in Drive please help me out I am newbie code is below.......... package org.ivb.jfreechart.barchart; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.IntervalXYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.RefineryUtilities; public class Histogram extends ApplicationFrame { /** * */ private static final long serialVersionUID = 1L; public Histogram(final String title) throws IOException { super(title); IntervalXYDataset dataset = createDataset(); JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); } private IntervalXYDataset createDataset() throws IOException { BufferedImage imageA = ImageIO.read(new File("D://oriented.jpg")); int[] red = new int[imageA.getHeight() * imageA.getWidth()]; int[] redhisto = new int[256]; int[] pixel; int k = 0; for (int y = 0; y &lt; imageA.getHeight(); y++) { for (int x = 0; x &lt; imageA.getWidth(); x++) { pixel = imageA.getRaster().getPixel(x, y, new int[3]); red[k] = pixel[0]; k++; } } for (int x = 0; x &lt; red.length; x++) { int y = red[x]; redhisto[y]++; } final XYSeries series = new XYSeries("No of pixels"); for (int i = 0; i &lt; redhisto.length; i++) series.add(i, redhisto[i]); final XYSeriesCollection dataset = new XYSeriesCollection(series); return …

http://stackoverflow.com/comment/39886735
has text: have you found a root cause of that? I am facing similar issue when using AvroMultipleOutput but top error message: "Error could only be replicated to 0 nodes instead of minReplication (=1)"
type: Comment
comment on: http://stackoverflow.com/q/24218767
type: QuestionComment
score: 1

http://stackoverflow.com/a/24212435
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24212232
has body: It turns out the problem was with my manifest.mf file. I had changed the Codebase but not the Application-Library-Allowable-Codebase. Setting: "Application-Library-Allowable-Codebase: *" fixed my problem.
answers question: http://stackoverflow.com/q/24212232
type: Answer

http://stackoverflow.com/comment/37264364
type: AnswerComment
has text: this will refresh the page and we will lose the values from the page ,say text box value will be null . How can we handle this ?
comment on: http://stackoverflow.com/a/24148001
score: 0
type: Comment

http://stackoverflow.com/q/24224353
has body: I am trying to add some elements of 2 Lists in a TreeMap. I debugged the project and it seems that the put method for the TreeMap doesn't work, as it puts null for the Key and Value. Here is the code: package SubTest; import java.io.*; import java.util.*; public class Matrice implements Cloneable,Comparable&lt;Object&gt; { private int nrCol; private int nrLin; private Object [][] matrix; public Matrice(){ this.nrCol=0; this.nrLin=0; this.matrix=null; } public Matrice(int nrColoane, int nrLinii, Object[][]m){ this.nrCol=nrColoane; this.nrLin=nrLinii; this.matrix=new Object[this.nrLin][this.nrCol]; for(int i=0;i&lt;this.nrLin;i++) for(int j=0;j&lt;this.nrCol;j++) this.matrix[i][j]=m[i][j]; } public int getnrCol(){ return this.nrCol; } public void setnrCol(int c){ this.nrCol=c; } public int getnrLin(){ return this.nrLin; } public void setnrLin(int l){ this.nrLin=l; } public Object[][] getMatrix(){ return this.matrix; } public void citirefis(String fisier) throws FileNotFoundException, negativeNrLoc { BufferedReader bf=new BufferedReader(new FileReader(fisier)); List&lt;PasagerVIP&gt; vip=new ArrayList&lt;PasagerVIP&gt;(); List&lt;PasagerEc&gt; ec=new ArrayList&lt;PasagerEc&gt;(); String line=null; int nr=0; try{ while((line = bf.readLine()) !=null){ nr++; StringTokenizer token=new StringTokenizer(line," "); int n=0; String nume=null; String mycard=null; float nrloc=0; float varsta=0; int id=0; while(token.hasMoreElements()){ switch(n){ case 0: nume=token.nextToken(); break; case 1: nrloc=Float.parseFloat(token.nextToken()); break; case 2: varsta=Float.parseFloat(token.nextToken()); break; case 3: id=Integer.parseInt(token.nextToken()); break; case 4: mycard=token.nextToken(); break; } n++; } if(mycard.contains("vip")) { PasagerVIP v=new PasagerVIP(nume,nrloc,varsta,id,mycard); vip.add(v); } else if(mycard.contains("ec")){ PasagerEc e=new PasagerEc(nume,nrloc,varsta,id,mycard); ec.add(e); } } bf.close(); } catch(IOException eoef){ eoef.printStackTrace();} Map&lt;Float,O…
accepted answer: http://stackoverflow.com/a/24226727
has title: Why TreeMap put method doesn't work in Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37408417
tagged with: java
has comment: http://stackoverflow.com/comment/37408508
has comment: http://stackoverflow.com/comment/37408428
has comment: http://stackoverflow.com/comment/37408864
tagged with: treemap
has comment: http://stackoverflow.com/comment/37408574
has comment: http://stackoverflow.com/comment/37408464
type: Question
downvote count: 4
has answer: http://stackoverflow.com/a/24226727
upvote count: 0
has comment: http://stackoverflow.com/comment/37409164
score: -4
answer count: 1
has comment: http://stackoverflow.com/comment/37408950
has comment: http://stackoverflow.com/comment/37409075
has comment: http://stackoverflow.com/comment/37408480
favorite count: 0

http://stackoverflow.com/q/24238055
score: 0
has body: I have this string: file:/C:/workWaveMaker/projects/AAA/webapproot/WEB-INF/classes/custom/ My goal is to parse only the string AAA in this case, but I will face othere similar strings where AAA is not the string, but something different. Is there a way to solve this based for example on the recurrent string webapproot?
accepted answer: http://stackoverflow.com/a/24238091
has comment: http://stackoverflow.com/comment/37434720
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37434737
has answer: http://stackoverflow.com/a/24238091
has comment: http://stackoverflow.com/comment/37434746
tagged with: parsing
type: Question
has comment: http://stackoverflow.com/comment/37434755
has comment: http://stackoverflow.com/comment/37434731
has title: Substring in Java with recurrent substring
tagged with: substring
type: AnsweredQuestion

http://stackoverflow.com/a/24211049
has comment: http://stackoverflow.com/comment/68529418
accepted answer of: http://stackoverflow.com/q/24209861
type: Answer
answers question: http://stackoverflow.com/q/24209861
upvote count: 47
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/63146928
has comment: http://stackoverflow.com/comment/69384029
score: 47
has comment: http://stackoverflow.com/comment/37383572
has body: You havent enabled the my-location layer.Check this link for more details So please do googleMap.setMyLocationEnabled(true); before googleMap.getUiSettings().setMyLocationButtonEnabled(true); googleMap.getUiSettings().setCompassEnabled(true); This will make your setMyLocationButton come up.. And,the compass icon will appear only if you rotate the map to not align to north.

http://stackoverflow.com/a/24161838
accepted answer of: http://stackoverflow.com/q/24158862
has comment: http://stackoverflow.com/comment/37336794
answers question: http://stackoverflow.com/q/24158862
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has body: The Portlet API docs state that: The sendRedirect method can not be invoked after any of the following methods of the ActionResponse interface has been called: setPortletMode setWindowState setRenderParameter setRenderParameters You'll need to use another scope for storing the attribute.
type: Answer

http://stackoverflow.com/comment/37343306
score: 0
comment on: http://stackoverflow.com/q/24190311
type: Comment
has text: it's compiled and there are no errors with private vars, tho they are stored into the intent
type: QuestionComment

http://stackoverflow.com/comment/37290715
has text: As a side note, you really don't want to use that format for dates... in fact, you don't want to be using strings to store dates at all. You should be using an actual [`DATE` type](http://db.apache.org/derby/docs/10.5/ref/rrefsqlj18730.html).
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24154615

http://stackoverflow.com/a/24135666
accepted answer of: http://stackoverflow.com/q/24133968
score: 0
answers question: http://stackoverflow.com/q/24133968
has body: To define users and roles in the database, you first need to create a custom UserDetailsService accessing the database. Than you need to create the neccessary tables form the sql schema in the docs. For the access part you should use the expression language.
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/q/24242568
downvote count: 1
has comment: http://stackoverflow.com/comment/37443232
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37443546
has body: Hi I have an android app created which is a basic login screen which I want to take you to a new activity screen if logged in correctly. However I am having trouble with the redirect. Here is my code: package com.example.loginscreen; import android.app.Activity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { private EditText username=null; private EditText password=null; private TextView attempts; private Button login; int counter = 3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); username = (EditText)findViewById(R.id.editText1); password = (EditText)findViewById(R.id.editText2); attempts = (TextView)findViewById(R.id.textView5); attempts.setText(Integer.toString(counter)); login = (Button)findViewById(R.id.button1); } public void login(View view){ if(username.getText().toString().equals("mara") &amp;&amp; password.getText().toString().equals("mara")){ Toast.makeText(getApplicationContext(), "Login Successful!", Toast.LENGTH_LONG).show(); startActivity(new Intent(MainActivity.this,HomePage.class)); } else{ Toast.makeText(getApplicationContext(), "Wrong Credentials", Toast.LENGTH_SHORT).show(); attempts.setBackgroundColor(Color.RED); counter--; attempts.setText(Integer.toString(counter)); if(counter==0){ login.setEnabled(false); } } } @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; } } At the moment if you login with the wrong credentials everything works as it should but if you login correctly the app just exits and says that it has stopped working. I know the problem it with my…
has title: Android Java code to set redirect to new activity after login?
has comment: http://stackoverflow.com/comment/37443827
tagged with: android
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37444065
has comment: http://stackoverflow.com/comment/37443633
has comment: http://stackoverflow.com/comment/37443160
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24243053
upvote count: 0
has comment: http://stackoverflow.com/comment/37443906
answer count: 1
has answer: http://stackoverflow.com/a/24243053
has comment: http://stackoverflow.com/comment/37443911
has comment: http://stackoverflow.com/comment/37443565
tagged with: android-intent
has comment: http://stackoverflow.com/comment/37443079

http://stackoverflow.com/comment/37295359
has text: If there's one case to make for reflection in `.equals`, then it is when you have 27 fields. I just wouldn't ever do it either way because of the weak typing.
type: QuestionComment
comment on: http://stackoverflow.com/q/24164791
type: Comment
score: 0

http://stackoverflow.com/q/24175530
accepted answer: http://stackoverflow.com/a/24175560
upvote count: 0
linked to: http://stackoverflow.com/q/4646577
tagged with: java
has comment: http://stackoverflow.com/comment/37315942
has comment: http://stackoverflow.com/comment/37315995
answer count: 1
has answer: http://stackoverflow.com/a/24175560
tagged with: global
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37315987
type: Question
has title: Alternative to delcare global variables in Java
score: -1
has comment: http://stackoverflow.com/comment/37315976
has body: After reading global-variables-in-java, I found it's not suggested to declare global variables. However, what's a better approach if I want to declare constant variables viewed by all methods in all classes. How to make those variables' scope global? How and why, thank you!
has comment: http://stackoverflow.com/comment/37315986
has comment: http://stackoverflow.com/comment/37316003
has comment: http://stackoverflow.com/comment/37315968
tagged with: class
tagged with: scope
type: AnsweredQuestion
tagged with: constants
has comment: http://stackoverflow.com/comment/37316076

http://stackoverflow.com/comment/37266674
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24149077
has text: Use the class javax.swing.PopupFactory
type: Comment

http://stackoverflow.com/comment/37320701
has text: I suggest you not use `Float` or `float` if you can avoid it, try using `double`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24177407

http://stackoverflow.com/a/24279820
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24251593
has body: I think that what you see in the picture you posted is not a menu. Is a ListView. As far as I know ListView in Google GLASS works as you ask...

http://stackoverflow.com/comment/37476270
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24259219
score: 0
has text: @shayan pourvatan , I have post my log cat error above.

http://stackoverflow.com/q/24194892
has answer: http://stackoverflow.com/a/28603878
possible better answer: http://stackoverflow.com/a/28603878
tagged with: pinterest
has answer: http://stackoverflow.com/a/34065639
favorite count: 0
has body: I am trying to fetch Pinterest data, which would be the public info of the user(follower count etc), and all pins for a user. I know the v3 API are up now and v2 apis have been taken down. I found this link which gives me end points for exactly what I want: http://techslides.com/most-repinned-pinterest-pins-by-website/ But I am unable to get an access_token. I have asked pinterest for api access but they have not replied. And I am unable to sniff app data too. I also tried Pinterest's signature tester tool which is on their website but no luck. The link it generates doesn't work either. It returns a authorization failure. https://developers.pinterest.com/tools/signature/ I have access to APP-ID and Client-Secret. I need to know how can I get an access token/ API-KEY to get the following work fine for me: https://api.pinterest.com/v3/users/jessicamalba/?access_token=APIKEY EDIT Before I am told that is an duplicate of How to get access token for access Pinterest Api I would just say that it is not. This question was asked one year ago and was asked in respect to V2 api. Which now return a 404 status. So now here I am asking about the V3 api.
type: AnsweredQuestion
answer count: 3
linked to: http://stackoverflow.com/q/12870416
tagged with: java
score: 9
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/24687830
accepted answer: http://stackoverflow.com/a/24687830
downvote count: 0
tagged with: api
has title: How to obtain Pinterest V3 API-KEY or access_token

http://stackoverflow.com/comment/37383490
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24211067
has text: in this implementation, say i have 10 servlets. how exactly all those servlets know my global object? And when does AppListener runs? When i start my server it runs?

http://stackoverflow.com/comment/37404468
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24220398
has text: Might also want to add that `super()` works to call `default` and `private` constructors also, to "good design causes".

http://stackoverflow.com/a/24228667
downvote count: 0
upvote count: 1
score: 1
has body: In Java 8, interfaces can define default methods for this purpose.
type: Answer
answers question: http://stackoverflow.com/q/24228650

http://stackoverflow.com/q/24210293
tagged with: syntax-error
has comment: http://stackoverflow.com/comment/37382388
answer count: 3
has comment: http://stackoverflow.com/comment/37382124
has comment: http://stackoverflow.com/comment/37382070
tagged with: jcheckbox
has comment: http://stackoverflow.com/comment/37382032
tagged with: swing
score: -7
has comment: http://stackoverflow.com/comment/37381997
favorite count: 0
has answer: http://stackoverflow.com/a/24210713
type: Question
accepted answer: http://stackoverflow.com/a/24210713
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24210332
downvote count: 7
has title: Else without if error?
has answer: http://stackoverflow.com/a/24210332
has answer: http://stackoverflow.com/a/24210374
has comment: http://stackoverflow.com/comment/37381960
has body: I want to know why this code is giving me this problem, keep in mind that it has already worked in an earlier Form of the same project but it refuses to work here. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){ if (jCheckBox1.isSelected()== true) jCheckBox1.equals(56); if (jCheckBox2.isSelected()== true) jCheckBox2.equals(50); if (jCheckBox3.isSelected()== true) jCheckBox3.equals(56); if (jCheckBox4.isSelected()== true) jCheckBox4.equals(56); if (jCheckBox5.isSelected()== true) jCheckBox5.equals(56); if (jCheckBox6.isSelected()== true) jCheckBox6.equals(56); new Form6().setVisible(true); else if (jCheckBox1.isSelected()== false) jCheckBox1.equals(0); if (jCheckBox2.isSelected()== false) jCheckBox2.equals(0); if (jCheckBox3.isSelected()== false) jCheckBox3.equals(0); if (jCheckBox4.isSelected()== false) jCheckBox4.equals(0); if (jCheckBox5.isSelected()== false) jCheckBox5.equals(0); if (jCheckBox6.isSelected()== false) jCheckBox6.equals(0); JOptionPane.showMessageDialog(this, "Please Choose An Option and Try Again"); And if there is any way for me to calculate jCheckBox values using a different method then I'm very eager to learn. My Professor says he knows almost everything about java netbeans and stuff but so far he's not much of a help.
upvote count: 0

http://stackoverflow.com/comment/37224600
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24115945
has text: @OlegEstekhin If that's what you think the wiki article really says, or if the OP does, you both need to read it again. It doesn't.
type: Comment

http://stackoverflow.com/comment/37488872
has text: Apparently, that question you linked to does not have an accepted answer, therefore I cannot take it for correct. Please reconsider your close request @helderdarocha
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24266308
type: QuestionComment

http://stackoverflow.com/a/24265012
has comment: http://stackoverflow.com/comment/37486750
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37485989
has comment: http://stackoverflow.com/comment/37486880
answers question: http://stackoverflow.com/q/24264942
has body: It returns the number of elements in the path. Check Oracle Docs Example:- Path path = Paths.get("C:", "tutorial/Java/JavaFX", "Topic.txt"); System.out.println(path.getNameCount()); Returns: 4
has comment: http://stackoverflow.com/comment/37486137
type: Answer

http://stackoverflow.com/a/24176050
score: 0
answers question: http://stackoverflow.com/q/24176030
type: Answer
has body: It's showing unreachable cause since both x and y are declared final, there is no way they are going to change (they are constants), so the while will ALWAYS loop, and the "Hi" print will never be reached

http://stackoverflow.com/comment/37524078
type: QuestionComment
has text: As an aside you should never catch the base Exception. As others have said the Exception option is more expensive, but if you really need to catch an exception here you should catch NullReferenceException.
comment on: http://stackoverflow.com/q/24200012
score: 2
type: Comment

http://stackoverflow.com/q/24127638
tagged with: java
has comment: http://stackoverflow.com/comment/37226488
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37226270
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37226310
tagged with: casting
has comment: http://stackoverflow.com/comment/37226920
accepted answer: http://stackoverflow.com/a/24127770
tagged with: class
has title: need help casting classes
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24127770
has body: Here is my situation (not actual code, just a rough outline): class Base { public static Image img; } class A extends Base { A() { img = "code to get certain image here"; } } class B extends Base { B() { img = "code to get certain image2 here"; } } I have an array of Base some of which however will be A or B. I want to get the instance of img specific to the class. E.g. if it is an instance of A it will display the img defined in A. However I cannot just use if statements as I will be adding many different classes overtime and also I want the code which gets the image to not need to be changed to include more classes.
upvote count: 2

http://stackoverflow.com/comment/37269096
has text: What you're saying is indeed possible. But it's far more easier to just let one class paint both a circle and a square. Else you'd have to put the panels(sheets) on top of each other by using OverlayLayout or JLayeredPane and then give the upper one a transparent background (I'm willing to expain this if you really want to).
comment on: http://stackoverflow.com/a/24148215
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24172927
has comment: http://stackoverflow.com/comment/37311864
answers question: http://stackoverflow.com/q/24172606
has body: It seem your searchView gets assigned a null I found this question that might help you: MenuItemCompat.getActionView always returns null
score: 0
type: Answer

http://stackoverflow.com/q/24241281
has comment: http://stackoverflow.com/comment/37442114
tagged with: swing
has comment: http://stackoverflow.com/comment/37442063
has title: Swing hangs when being resized on a second display
favorite count: 0
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37441157
tagged with: java
has comment: http://stackoverflow.com/comment/37445578
has answer: http://stackoverflow.com/a/24244124
has body: Main thread calls GUI() function that adds frame, menus, menuitems, and a scrollpane with jtable (DefaultTableModel). If i place the running application to a second display/screen it hangs as soon i switch to a different application or when i try to resize it. public static void main(String[] args) { GUI(); } public static void GUI(){ JButton button; JMenuBar menuBar; JMenu menu, submenu; JMenuItem menuItem; window = new JFrame(); window.setResizable(false); //menu menuBar = new JMenuBar(); menu = new JMenu("Start"); submenu = new JMenu("New"); menu.add(submenu); menuItem = new JMenuItem("menu1"); menuItem.addActionListener(new buttonActionListener("m1")); submenu.add(menuItem); menuItem = new JMenuItem("menu2"); menuItem.addActionListener(new buttonActionListener("m2")); submenu.add(menuItem); menuItem = new JMenuItem("menu3"); menuItem.addActionListener(new buttonActionListener("m3")); submenu.add(menuItem); menuItem = new JMenuItem("menu4"); menuItem.addActionListener(new buttonActionListener("m4")); submenu.add(menuItem); menuBar.add(menu); //start menu = new JMenu("Options"); menuBar.add(menu); //options //top panel JPanel top = new JPanel(); button = new JButton("Paste"); button.addActionListener(new buttonActionListener("paste")); top.add(button); button = new JButton("Copy"); button.addActionListener(new buttonActionListener("copy")); top.add(button); JButton start = new JButton("Start"); start.addActionListener(new buttonActionListener("start")); top.add(start); //main panel with table main = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); DefaultTableModel model = new DefaultTableModel(); table = new JTable(model); //bottom panel JPanel bottom = new JPanel(); Creq = new JCheckBox(); Creq.setSelected(true); item= new JTextField("item"); comment = new JTextField("comment"); target= new JTextField("target"); req = new JTextField("requirement"); bottom.add(Creq); bottom.add(req); bottom.add(item);…
upvote count: 2
type: UnansweredQuestion
downvote count: 2
answer count: 1
tagged with: user-interface

http://stackoverflow.com/comment/66326085
has text: Hi @hsemarap i am using your answer but it's not working I am getting error on this line `WritableWorkbook copy = Workbook.createWorkbook(new File("temp.xls"), workbook);` ERROR is `java.io.FileNotFoundException: temp.xls: open failed: EROFS (Read-only file system)`
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24382211
type: Comment

http://stackoverflow.com/q/24134632
type: UnansweredQuestion
tagged with: android
has title: Android using Google account but without user interaction
has body: I try to develop parental control app and in setup page the parent enters his email to receive location of his kids. when use JavaMail API using Gmail authentication, need password and email to send email to the parent (and it is not professional way to ask user email and password of his email). And cannot be used intent because need without user interaction. So Can anyone Help me or gives me and suggestions I suggest send emails to user using Google account but without user interaction - If possible-
answer count: 0
tagged with: java
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/24168223
tagged with: mysql
has answer: http://stackoverflow.com/a/31043114
tagged with: liquibase
accepted answer: http://stackoverflow.com/a/24196802
favorite count: 0
type: Question
has title: Liquibase tried to apply all changeset, even if database is present
score: 11
tagged with: spring
has answer: http://stackoverflow.com/a/54889095
answer count: 4
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/63854991
has body: I am using Spring-Liquibase to perform any migration that is needed on the staging database. The applicationContext.xml looks like &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt; &lt;context:component-scan base-package="com.yahoo.comma"/&gt; &lt;bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;property name="changeLog" value="classpath:liquibase/changelog.xml"/&gt; &lt;property name="defaultSchema" value="pryme_dev"/&gt; &lt;/bean&gt; &lt;/beans&gt; When I deploy the war file, i see errors in log as INFO 6/11/14 9:32 AM:liquibase: Successfully acquired change log lock INFO 6/11/14 9:32 AM:liquibase: Reading from pryme_dev.DATABASECHANGELOG INFO 6/11/14 9:32 AM:liquibase: Reading from pryme_dev.DATABASECHANGELOG INFO 6/11/14 9:32 AM:liquibase: Reading from pryme_dev.DATABASECHANGELOG INFO 6/11/14 9:32 AM:liquibase: liquibase/changelog.xml: liquibase/2014/1-1.xml::05192014.1525::harith: Reading from pryme_dev.DATABASECHANGELOG SEVERE 6/11/14 9:32 AM:liquibase: liquibase/changelog.xml: liquibase/2014/1-1.xml::05192014.1525::harith: Change Set liquibase/2014/1-1.xml::05192014.1525::harith failed. Error: Error executing SQL CREATE TABLE pryme_dev.network (id INT NOT NULL, network_id BIGINT UNSIGNED NOT NULL, name VARCHAR(255) NOT NULL, display_name VARCHAR(255) NOT NULL, active TINYINT(1) DEFAULT 1 NOT NULL, created_at TIMESTAMP DEFAULT NOW() NOT NULL, updated_at TIMESTAMP DEFAULT '1970-01-01 00:00:01' NOT NULL, created_by VARCHAR(50) DEFAULT 'pryme_user' NULL, updated_by VARCHAR(50) DEFAULT 'pryme_user' NULL, CONSTRAINT PK…
has answer: http://stackoverflow.com/a/24196802
possible better answer: http://stackoverflow.com/a/31043114
tagged with: java
has comment: http://stackoverflow.com/comment/37303777
downvote count: 0

http://stackoverflow.com/comment/37468821
type: Comment
has text: It has to be `EEEE` and not `EEE`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24255816

http://stackoverflow.com/comment/64359360
has text: Hi, I have added permissions for everyone and seems working.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24139554

http://stackoverflow.com/a/24215784
has comment: http://stackoverflow.com/comment/48315455
has body: See this answer: https://stackoverflow.com/a/14021722/3735747 If you're doing this in Java, there's the DestinationSource class that will help: http://activemq.apache.org/maven/5.7.0/activemq-core/apidocs/org/apache/activemq/advisory/DestinationSource.html Create a connection and use the ActiveMQConnection type instead of the JMS Connection type. // Create a ConnectionFactory ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); // Create a Connection ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection(); Once you're connected, you can create a DestinationSource object and get the queues: DestinationSource ds = connection.getDestinationSource(); Set&lt;ActiveMQQueue&gt; queues = ds.getQueues(); for(ActiveMQQueue queue : queues){ try { System.out.println(queue.getQueueName()); } catch (JMSException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/86772033
has comment: http://stackoverflow.com/comment/37394168
has comment: http://stackoverflow.com/comment/37394020
type: Answer
has comment: http://stackoverflow.com/comment/48352068
has comment: http://stackoverflow.com/comment/37393991
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37398690
answers question: http://stackoverflow.com/q/24212496

http://stackoverflow.com/comment/37353510
has text: It's certainly an option. When I was in University (a whole 4 years ago now!) I only used a single workspace and simply had a variety of projects (appropriately named) for all the courses I was doing. The important thing is you can write and submit your work, the rest is fluff (you'll pick it up eventually through experience).
comment on: http://stackoverflow.com/q/24195423
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24133325
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/7404435
tagged with: spring
tagged with: logging
has answer: http://stackoverflow.com/a/24133451
score: 1
tagged with: java
has title: Can we change log4j logging level based on the content
answer count: 1
upvote count: 1
has body: Can we change log4j logging level based on content. Also, can this change be made at library level. Putting if condition around every log statement is not recommended. For example, let us assume we are logging the value of String testString. We want to set log level to info if testString contains futest, else keep it at debug.
tagged with: log4j
has comment: http://stackoverflow.com/comment/37236877

http://stackoverflow.com/comment/37288915
comment on: http://stackoverflow.com/q/24161326
type: QuestionComment
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) One way to get image(s) for an example is to hot-link to the images seen in [this answer](http://stackoverflow.com/a/19209651/418556).
score: 1
type: Comment

http://stackoverflow.com/q/24183935
accepted answer: http://stackoverflow.com/a/24219925
tagged with: maven
answer count: 1
favorite count: 0
has body: I couldn't find any mention of local datastore location config param in current Appengine java documentation. I remember some years ago there was this key: -Ddatastore.backing_store. However nothing is mentioned about this in current documentation. Onlysome old blogs mentioned it : http://turbomanage.wordpress.com/2011/06/25/preserving-the-datastore-in-gae-dev-mode/ What is the latest situation ? Has this config been deprecated? What is the current way to do that? What people use with Maven, to prevent datastore cleanup on each rebuild?
type: Question
tagged with: google-app-engine
tagged with: java
has title: Appengine local datastore location config for Java DevServer
has answer: http://stackoverflow.com/a/24219925
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/24212549
score: 1
answers question: http://stackoverflow.com/q/24212445
type: Answer
has comment: http://stackoverflow.com/comment/37386390
accepted answer of: http://stackoverflow.com/q/24212445
has body: Sounds like you are looking for the Non-virtual interface pattern: http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Non-Virtual_Interface
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37386655

http://stackoverflow.com/comment/37475644
has text: getText() is returning null
comment on: http://stackoverflow.com/q/24242920
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24116239
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/24116185
accepted answer of: http://stackoverflow.com/q/24116185
downvote count: 0
type: Answer
has body: static variable initialized when class is loaded into JVM on the other hand instance variable has different value for each instances and they get created when instance of an object is created either by using new() operator or using reflection like Class.newInstance(). So if you try to access a non static variable without any instance compiler will complain because those variables are not yet created and they don't have any existence until an instance is created and they are associated with any instance. So in my opinion only reason which make sense to disallow non static or instance variable inside static context is non existence of instance. So in your case you need to create MainNenu Object, then set the user name text, then show the menu. For Example: MainMenu menu = new MainMenu(); menu.setUserDispNameText(name); menu.setVisible(true); Read more here
score: 1

http://stackoverflow.com/q/24157678
tagged with: eclipse
has title: GWT refactoring: classes, modules, rename the whole project
downvote count: 0
score: 1
upvote count: 1
tagged with: refactoring
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24169011
favorite count: 0
type: Question
tagged with: gwt
has body: I am writing here because of desperation caused by refactoring a GWT project. My first try: After I read all the praises of the refactoring tool from Eclipse ( I am using it as IDE) I simply right clicked on a module ( what a fool i was ) and use the refactoring option. My project became unusable. First Conclusion: Found out that I need to start with the classes and then go up and refactor a module at a time. Second try: Refactored some classes, worked fine until I messed something related to a ui.xml file. Project unusable! Second Conclusion: Be careful at the ui.xml files! Third try: Went pretty well, but I got ahead of myself and tried to remove some comments or replace class names in comments. Predictable result : project unusable! Third Conclusion: Try again! Forth try: Fail! Fifth try: Fail! You get the picture. Can someone experienced with GWT please offer some guidelines about the mystical realm of refactoring?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37295496

http://stackoverflow.com/a/24262871
type: Answer
answers question: http://stackoverflow.com/q/24213324
score: 1
downvote count: 0
upvote count: 1
has body: You need: SimpleDateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); df.setTimeZone(TimeZone.getTimeZone("BRT")); DateFormat utcFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); Date d = df.parse("Fri Jun 13 10:24:01 BRT 2014"); System.out.println(utcFormat.format(d)); // output: 2014-06-13T12:24:01+0200 Consider following corrections: Locale.ENGLISH instead of Locale.getDefault() enables reliable parsing of english names like "Jun" or "Fri" Use pattern symbol z instead of literal 'BRT' because else the parser cannot interprete the string "BRT" as an abbreviation of a timezone name that is interpreting as Brazil Standard Time (in your case just parsing as literal hence not taking in account the timezone offset of UTC-03:00).

http://stackoverflow.com/q/24123266
tagged with: android-fragments
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37217630
type: Question
linked to: http://stackoverflow.com/q/12677244
has title: how to resume multiple fragments in the last state
accepted answer: http://stackoverflow.com/a/24123543
tagged with: android
has answer: http://stackoverflow.com/a/24123543
has body: I'm a beginner in Android and I need help please :( I have 3 fragments in the main activity and each of the fragments has 4 buttons. What i want to achieve is to keep the fragment's last state persistent while moving from any of fragment to another, with the help of backstack. How do I do it ? Thank you public class FragmentTraining extends SherlockFragmentActivity implements OnClickListener { Button fragOneBtn; Button fragTwoBtn; Button fragThreeBtn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_stack); initialize(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.new_fragment1: addFragmentToStack("id_one"); break; case R.id.new_fragment2: addFragmentToStack("id_two"); break; case R.id.new_fragment3: addFragmentToStack("id_three"); break; } } private void initialize() { fragOneBtn = (Button) findViewById(R.id.new_fragment1); fragTwoBtn = (Button) findViewById(R.id.new_fragment2); fragThreeBtn = (Button) findViewById(R.id.new_fragment3); fragOneBtn.setOnClickListener(this); fragTwoBtn.setOnClickListener(this); fragThreeBtn.setOnClickListener(this); } void addFragmentToStack(String tag) { Fragment newFragment = getFragmentManager().findFragmentByTag(tag); Log.d("debug", "newFragment: " + newFragment + " , tag: " + tag); if (newFragment == null) { newFragment = new FragmentInstances(); } FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.fl_container, newFragment, tag); ft.commit(); } }
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/37406908
score: 0
has text: Exactly as Boris said, I tried `Expense exp=(Expense)in.readObject(); while (exp != null){` which did not work. If I insist in doing it in a loop and not using a Collection how do I do that?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24223434

http://stackoverflow.com/comment/37286526
score: 2
comment on: http://stackoverflow.com/q/24159510
has text: For [example](http://stackoverflow.com/a/2234020/230513).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24262575
has comment: http://stackoverflow.com/comment/37481650
has answer: http://stackoverflow.com/a/24264551
has comment: http://stackoverflow.com/comment/37482745
type: AnsweredQuestion
score: 0
tagged with: mongodb
has title: Anyone knows Can I use org.springframework.core-3.0.5.RELEASE with spring-data-mongodb-1.0.0.M4?
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/37482491
tagged with: java
has body: It seems i just can't make this mongoTemplate bean to work in my project &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt; &lt;mongo:mongo id="mongo" replica-set="localhost:27017"&gt;&lt;/mongo:mongo&gt; &lt;mongo:db-factory dbname="test" mongo-ref="mongo" /&gt; &lt;bean id="natureRepository" class="com.orangeslate.naturestore.repository.NatureRepositoryImpl"&gt; &lt;property name="mongoTemplate" ref="mongoTemplate" /&gt; &lt;/bean&gt; &lt;!-- mongodb的主要操作对象，所有对mongodb的增删改查的操作都是通过它完成 --&gt; &lt;bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"&gt; &lt;constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /&gt; &lt;/bean&gt; &lt;!-- To translate any MongoExceptions thrown in @Repository annotated classes --&gt; &lt;context:annotation-config /&gt; log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'natureRepository' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class p…
has comment: http://stackoverflow.com/comment/37482454
accepted answer: http://stackoverflow.com/a/24264551
tagged with: spring
has comment: http://stackoverflow.com/comment/37481606

http://stackoverflow.com/a/24201564
accepted answer of: http://stackoverflow.com/q/24201524
has comment: http://stackoverflow.com/comment/37640857
answers question: http://stackoverflow.com/q/24201524
type: Answer
has body: I think this response to a similar but not identical question might help! Collision Detection between two images in Java Edit An example of this might be (I don't really do much Android dev, so excuse me if this doesn't work): Override onWindowFocusChanged(boolean focus) with something like this. import android.graphics.Rect; imageView1 = (ImageView) findViewById(R.id.imageView1); imageView2 = (ImageView) findViewById(R.id.imageView2); Rect rect1 = new Rect(); imageView1.getDrawingRect(rect1); Rect rect2 = new Rect(); imageView2.getDrawingRect(rect2); if (Rect.intersects(rect1, rect2) { //intersected }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37365552

http://stackoverflow.com/a/25368910
accepted answer of: http://stackoverflow.com/q/24243039
has body: Though the official java libary is not mavenized - I believe, You could try this https://github.com/likethecolor/Alchemy-API/blob/master/README.md
upvote count: 2
score: 2
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24243039
type: Answer

http://stackoverflow.com/comment/37424915
type: QuestionComment
score: 0
has text: @Genzotto i dont know how to get it, it should be in output when show_sql = true but it's not. criteria.toString() shows this: 'DetachableCriteria(CriteriaImpl(intellidom.entity.Users:this[][]))' but i think its not what you expected
comment on: http://stackoverflow.com/q/24222814
type: Comment

http://stackoverflow.com/comment/37364550
comment on: http://stackoverflow.com/q/24201183
type: QuestionComment
has text: You will eventually have to read files 3 times (one for each). I would create 3 classes `Author`, `Book` and `Magazine` to represent accordingly. Then, there could be a helper class that would read csv files to generate suitable lists of `Author` objects, `Book` objects and `Magazine` objects.
score: 1
type: Comment

http://stackoverflow.com/comment/37319163
type: Comment
type: QuestionComment
has text: In the JDK, several examples of good static only classes. Collections, Arrays...
comment on: http://stackoverflow.com/q/24177317
score: 1

http://stackoverflow.com/q/24220070
has body: Im trying to read deck.txt which is in the src directory of the application. The error I get is: Exception in thread "main" java.lang.NullPointerException at Deck.(Deck.java:15) at TwentyOne.main(TwentyOne.java:7) Line 7 in TwentyOne is just: Deck deck = new Deck(); The file has a single integer on each line and is 104 lines long. Where cards[i].suit.... is the line throwing the exception try (BufferedReader br = new BufferedReader(new FileReader("src/deck.txt"))) { for (int i = 0; i &lt; 104; i++) { cards[i].suit = Integer.parseInt(br.readLine()); cards[i].rank = Integer.parseInt(br.readLine()); } } catch (IOException e) { e.printStackTrace(); } To try see what was wrong I copied this code out of eclipse into another directory with the file, this time just println(br.readLine()) rather than assigning it to the array and it worked fine. Have I got the file in the wrong location or is there something else I'm missing? Thanks for your help
has comment: http://stackoverflow.com/comment/37400258
type: Question
has comment: http://stackoverflow.com/comment/37400240
score: 0
answer count: 1
tagged with: bufferedreader
has title: How do I fix this source not found error? Reading text file with buffered reader - Java
type: AnsweredQuestion
tagged with: ioexception
tagged with: java
tagged with: io
tagged with: input
accepted answer: http://stackoverflow.com/a/24220124
has answer: http://stackoverflow.com/a/24220124

http://stackoverflow.com/a/24237492
answers question: http://stackoverflow.com/q/24237283
score: 0
type: Answer
has body: Basically you just did simple copy paste mistakes that can be avoidable if you used methods. I'll tell you how but first here's how you can discover your mistake: System.out.println(String.format("%d * %d = %d",board[l][z], board2[z][t], board[l][z] * board2[z][t])); Add this just before doing the calculation for calculationMultiplication[l][t]. Try if you want... Anyway getting back to your mistakes, you have populated your first matrix only, the second one contain zeros (verify your code in the for loop for inserting random numbers into the second matrix), therefore any number multiplied by zero is equal to zero. I haven't looked at all your code, because it contain a lot of copy paste which confused you and could confuse any one as well, so here's a better way to avoid mistakes in printing the matrix and inserting random numbers: Printing: void printMatrix(int[][] matrix){ for(int row =0; row &lt; numOfRows; row++){ for(int col =0; col &lt; numOfCols; col++){ System.out.print(matrix[row][col]+" "); } System.out.println(); // new line } } Inserting: void insertMatrix(int[][] matrix){ for(int row =0; row &lt; numOfRows; row++){ for(int col =0; col &lt; numOfCols; col++){ matrix[row][col] = rand.nextInt(10); // rand must be declared outside any method } } } Putting all together: import java.util.*; public class Main { // create the grid final static int rowWidth = 9; final static int colHeight = 9; static Random rand; public static void main(String[] args) { rand = new Random(); int[][] board = new int[rowWidth][colHeight]; int[][] board2 = new int[rowWidth][colHeight]; int[][] calculationMultiplication = new int[rowWidth][colHeight]; // fill insertMatrxi(board); // display output printMatrix(board); System.out.println(); // fill insertMatrxi(board2); // display output printMatrix(board2); for (int l = 0; l &lt; rowWidth; l++) { for (int t = 0; t &lt; colHeight; t++) { for (int z = 0; z &lt; rowWidth; z++) { calculationMultiplication[l][t] += board[l][z] * board2[z]…

http://stackoverflow.com/comment/37240772
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24135509
score: 0
has text: Add with "database" you mean schema?

http://stackoverflow.com/comment/37491815
has text: Done. I gave an example of how it *could* be done. But feel free to edit with your working solution if you wish.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24251800

http://stackoverflow.com/comment/37577694
comment on: http://stackoverflow.com/q/24229219
type: Comment
type: QuestionComment
has text: You have written two url pattern. . In the web.xml. so I am not sure how to map the requests. . If u want multiple requests to mappings use * . I think url pattern is the issue.
score: 0

http://stackoverflow.com/comment/37211833
score: 2
comment on: http://stackoverflow.com/q/24120045
type: Comment
type: QuestionComment
has text: My eyes are bleeding. Maybe you should rethink your logic to use a second structure to hold min/max everytime you mutate the map.

http://stackoverflow.com/comment/37197197
has text: I sometimes suggest `JPanel` _because_ it has a UI delegate; older versions of `com.apple.laf.AquaPanelUI` are seen [here](http://stackoverflow.com/a/11338636/230513) and [here](http://stackoverflow.com/a/11724866/230513).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24111421
type: AnswerComment

http://stackoverflow.com/comment/37396193
score: 0
has text: So, the question may like 'Disable Java8 API from Intellij' or 'Warning Java8 API usage'. In eclipse this is possible, but in intellij, is this possible ?
type: Comment
comment on: http://stackoverflow.com/q/24217611
type: QuestionComment

http://stackoverflow.com/a/24199771
answers question: http://stackoverflow.com/q/24199679
upvote count: 14
type: AcceptedAnswer
type: Answer
score: 13
downvote count: 1
has body: Take a look at below code which check file in the folder and rename it. File dir = new File("D:/xyz"); if (dir.isDirectory()) { // make sure it's a directory for (final File f : dir.listFiles()) { try { File newfile =new File("newfile.txt"); if(f.renameTo(newfile)){ System.out.println("Rename succesful"); }else{ System.out.println("Rename failed"); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } I Hope It Will Help You
accepted answer of: http://stackoverflow.com/q/24199679

http://stackoverflow.com/q/24237389
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/24237519
has title: Java Game Image Buffering Leaves Tail
has body: I have the following class (Snippet), and in my render() method, I am doing buffering using BufferStrategy. The issue I am having is when I move an image, it leaves a tail. What Do I need to do with my code to make it so the tail doesn't show? Here is the code: public class Main extends JFrame implements Runnable{ private BufferStrategy bufferStrategy; public synchronized void start(){ Thread thread = new Thread(this); thread.start(); } public void run(){ // Main Game Loop this.render(); // End Main Game Loop } protected void render(){ if(bufferStrategy == null){ this.createBufferStrategy(3); bufferStrategy = this.getBufferStrategy(); } Graphics g = bufferStrategy.getDrawGraphics(); // Loop through a list of items to draw for(GameObject go : gameObjects){ Image sprite = go.getComponent(SpriteRenderer.class).getSprite(); Vector2 pos = go.getComponent(Transform.class).getPosition(); g.drawImage(sprite, (int)pos.x, (int)pos.y, this); } g.dispose(); bufferStrategy.show(); Toolkit.getDefaultToolkit().sync(); } } Edit I figured it out: Graphics g = bufferStrategy.getDrawGraphics(); super.paint(g);
score: 0
tagged with: java
type: Question
tagged with: graphics
tagged with: bufferstrategy
tagged with: buffer

http://stackoverflow.com/comment/37443067
type: AnswerComment
has text: @user3247825 , ok in that case you have instructed the program to stop executing the inner loop, thus running `System.out.println("Prime Number " + i);`before running the next iteration of the `outer` loop. With `continue outer;` you have told the program to jump to the top of the `outer loop` which will skip the execution of line `System.out.println("Prime Number " + i);`
comment on: http://stackoverflow.com/a/24242448
score: 0
type: Comment

http://stackoverflow.com/a/24118992
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37210066
has comment: http://stackoverflow.com/comment/37209753
answers question: http://stackoverflow.com/q/24118819
has comment: http://stackoverflow.com/comment/37209737
type: Answer
has comment: http://stackoverflow.com/comment/37209836
has body: In your onCreate(): setContentView(R.layout.activity_search_result); So the linear layout "tr" is referenced in activity_search_result, which is why the NPE when referenced for the textview. this happens for the activity, where as your linearlayout is probably defined inside the fragment layout, (please post fragment_search_result.xml, will remove or update the answer accordingly) so you should shift the findViewById in onCreateView like: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_search_result, container, false); //now declare linearlayout to be found in fragment_search_result.xml LinearLayout t1 = (LinearLayout) rootView.findViewById(R.id.linear_layout); TextView tr = new TextView(SearchResult.this); //tr.setId(95);// define id that must be unique tr.setText("TYPE:"); // set the text for the header tr.setTextColor(Color.WHITE); // set the color tr.setTypeface(null, Typeface.BOLD); tr.setPadding(5, 5, 5, 5); // set the padding (if required) t1.addView(tr); return rootView; }
has comment: http://stackoverflow.com/comment/37210011
downvote count: 0

http://stackoverflow.com/comment/37477576
comment on: http://stackoverflow.com/q/24260682
type: Comment
type: QuestionComment
has text: How did you insert this data in the first place ?
score: 0

http://stackoverflow.com/comment/37367585
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24202597
type: Comment
has text: Change `ArrayList a1 = new ArrayList();` to `List<String> a1 = new ArrayList<String>();` in your code. `Set s = new HashSet();` to `Set<String> s = new HashSet<String>();`

http://stackoverflow.com/q/24129151
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37229332
tagged with: java
tagged with: email
downvote count: 0
upvote count: 1
score: 1
answer count: 1
has title: Sending email using Java, connecting to a gmail host hangs
favorite count: 0
has comment: http://stackoverflow.com/comment/37229523
type: Question
has answer: http://stackoverflow.com/a/24129303
has body: I would like to send emails via Java code. I added in my library the following .JARs: log4j.jar, smtp.jar, mailapi.jar,ctivation.jar. And my Java class looks like this: import java.util.Properties; import javax.mail.*; import javax.mail.internet.*; public class SendEmail { public static void main(String [] args) { String to = "abcd@gmail.com"; String from = "web@gmail.com"; String host = "smtp.gmail.com"; Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", host); properties.setProperty("mail.smtp.starttls.enable", "true"); properties.setProperty("mail.smtp.auth", "true"); SmtpAuthenticator authentication = new SmtpAuthenticator(); javax.mail.Message msg = new MimeMessage(Session .getInstance(properties, authentication)); try { msg.setFrom(new InternetAddress(from)); msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); msg.setSubject("Subject"); msg.setText("Working fine..!"); System.out.println("fine1 !!"); Transport transport = Session.getDefaultInstance( properties , null).getTransport("smtp"); System.out.println("fine2 !!"); transport.connect("smtp.gmail.com" , 465 , "username", "password"); System.out.println("fine3 !!"); Transport.send(msg); System.out.println("fine!!"); } catch(Exception exc) { System.out.println(exc); } } } My SmtpAuthenticator class: import javax.mail.Authenticator; import javax.mail.PasswordAuthentication; public class SmtpAuthenticator extends Authenticator { public SmtpAuthenticator() { super(); } @Override public PasswordAuthentication getPasswordAuthentication() { String username = "user"; String password = "password"; if ((username != null) &amp;&amp; (username.length() &gt; 0) &amp;&amp; (password != null) &amp;&amp; (password.length() &gt; 0)) { return new PasswordAuthentication(username, password); } return null; } } When i run my Java application class it prints: fine1 !! fine2 !! And it hangs. How can I get rid of this problem?
tagged with: smtp
tagged with: jakarta-mail
accepted answer: http://stackoverflow.com/a/24129303

http://stackoverflow.com/comment/37195044
type: QuestionComment
score: 1
has text: Can you show `FileModel.getSubdirs` implementation or better the whole class?
comment on: http://stackoverflow.com/q/24110820
type: Comment

http://stackoverflow.com/a/24242048
has comment: http://stackoverflow.com/comment/37443036
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24241699
has comment: http://stackoverflow.com/comment/37443338
type: Answer
has comment: http://stackoverflow.com/comment/37459910
score: 0
has body: I don't know OpenCL at all, but is it possible you should only write a SINGLE gray value instead of three, here write_imageui(dst, (int2)(x,y), (uint4)(gray, gray, gray, 0)); I mean to remove ,gray,gray. I think this because you have CL_UNSIGNED_INT8 as the type, yet you are writing an unsigned 32-bit int. Btw, there are also other methods for calculating the gray value from RGB, see here and you may get better results than just averaging R + G + B if you use Gray = 0.21 R + 0.72 G + 0.07 B

http://stackoverflow.com/comment/37531269
score: 1
type: Comment
type: QuestionComment
has text: See also https://source.android.com/devices/graphics/architecture.html#activity
comment on: http://stackoverflow.com/q/24253321

http://stackoverflow.com/q/24145802
has answer: http://stackoverflow.com/a/24146025
tagged with: sql
type: UnansweredQuestion
answer count: 1
tagged with: swing
tagged with: ms-access
tagged with: java
has body: Im made a program that takes strings from the whole jtable and populates my database in ms access. But whenever i run it my database has [] instead of the actual information. How do i take the information in my jtable and use that to populate my database? import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class apples extends JPanel { static JTable table; static JFrame frame; static apples a; static ActionListener actionListener; static ActionListener actionListenerImport; static ActionListener actionListenerAddrow; static String[] columns = {"Fname","Lname"}; static String[][] data; static DefaultTableModel model = new DefaultTableModel(data, columns); public static void main(String[] args) { table = new JTable(model); frame = new JFrame(); table.setPreferredScrollableViewportSize(new Dimension(450, 200)); table.setFillsViewportHeight(true); JScrollPane jps = new JScrollPane(table); JPanel panel = new JPanel(new GridBagLayout()); panel.add(jps); GridBagConstraints c = new GridBagConstraints(); JButton b1 = new JButton("Start"); c.gridx = 1; c.gridy = 0; c.insets = new Insets(10, 10, 10, 10); panel.add(b1, c); JButton b2 = new JButton("Import"); c.gridx = 0; c.gridy = 0; c.insets = new Insets(10, 10, 10, 10); panel.add(b2, c); JButton b3 = new JButton("Add Row"); c.gridx = 3; c.gridy = 0; c.insets = new Insets(10,10,10,10); panel.add(b3, c); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(panel, BorderLayout.NO…
type: Question
tagged with: jtable
score: 0
has title: Database displaying []?

http://stackoverflow.com/q/24177773
favorite count: 0
has answer: http://stackoverflow.com/a/27057290
possible better answer: http://stackoverflow.com/a/27443406
has comment: http://stackoverflow.com/comment/49679330
has comment: http://stackoverflow.com/comment/37394730
has comment: http://stackoverflow.com/comment/37333110
type: Question
has body: I am developing PDF reader application. I am using Radaee PDF reader sdk. I am trying this sdk to open a PDF from the asset in android. I need some help for this. I am using some code like: m_vFiles = new PDFGridView(this, null); m_vFiles.PDFSetRootPath("/mnt"); m_vFiles.setOnItemClickListener(this); setContentView(m_vFiles); But it is taking the path of sd card and showing all the pdf file. One user has used this sdk. https://chat.stackoverflow.com/users/1503155/lazy-ninja
answer count: 2
tagged with: android
downvote count: 0
has comment: http://stackoverflow.com/comment/41010313
accepted answer: http://stackoverflow.com/a/27057290
has comment: http://stackoverflow.com/comment/80905175
linked to: http://stackoverflow.com/q/24183472
tagged with: performance
has answer: http://stackoverflow.com/a/27443406
tagged with: android-fragments
type: AnsweredQuestion
has title: How to use the Radaee Pdf reader sdk
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/62201136
score: 10
upvote count: 10

http://stackoverflow.com/q/24139636
type: UnansweredQuestion
tagged with: apache
answer count: 1
has title: VirtualHosting through Apache Tomcat 6.0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37327369
score: 0
has comment: http://stackoverflow.com/comment/37327513
tagged with: java
has comment: http://stackoverflow.com/comment/37248110
has comment: http://stackoverflow.com/comment/37248025
has answer: http://stackoverflow.com/a/24139946
type: Question
has body: I am having the domain(any three) and want that it should run with the same port that the tomcat is having(8080). I have done upto that the adding the domain name and appbase in SERVER.XML. &lt;Host name="www.hello.com" appBase="hello_webapps" unpackWARs="true" autoDeploy="true"/&gt; &lt;Host name="www.hi.com" appBase="hi_webapps" unpackWARs="true" autoDeploy="true"/&gt; &lt;Host name="www.bye.com" appBase="bye_webapps" unpackWARs="true" autoDeploy="true"/&gt; and change in the host file of etc xxx.xxx.x.xx www.hello.com xxx.xxx.x.xx www.hi.com xxx.xxx.x.xx www.bye.com XXX.XXX.X.XX is the ip address but by running www.hello.com:8080,it is giving the error 404.

http://stackoverflow.com/q/24120470
has comment: http://stackoverflow.com/comment/37212768
has comment: http://stackoverflow.com/comment/37212559
has comment: http://stackoverflow.com/comment/37214088
has answer: http://stackoverflow.com/a/24122243
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37212382
has comment: http://stackoverflow.com/comment/37212395
tagged with: swingworker
has comment: http://stackoverflow.com/comment/37212259
tagged with: jprogressbar
has body: I have this code: package com.cjburkey.downloads.wie_ein_chef; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.BufferedOutputStream; import java.io.File; import java.net.HttpURLConnection; import java.net.URL; import java.util.concurrent.ExecutionException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import javax.swing.SwingWorker; import net.lingala.zip4j.core.ZipFile; import net.lingala.zip4j.exception.ZipException; public class Download { final static JFrame frm = new JFrame(); final static JLabel status = new JLabel("Downloading..."); final static JButton cancel = new JButton("Cancel"); static File fileDown = null; static String dire = null; public Download(String site, File file, String dir) { fileDown = file; dire = dir; final JProgressBar current = new JProgressBar(0, 100); current.setSize(50, 100); current.setValue(0); current.setStringPainted(true); frm.setSize(640, 480); frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frm.setLayout(new FlowLayout()); frm.add(status); frm.add(current); frm.add(cancel); frm.pack(); frm.setLocationRelativeTo(null); frm.setResizable(false); frm.setVisible(true); final Worker worker = new Worker(site, file); worker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pcEvt) { if ("progress".equals(pcEvt.getPropertyName())) { current.setValue((Integer) pcEvt.getNewValue()); } else if (pcEvt.getNewValue() == SwingWorker.StateValue.DONE) { try { worker.get(); } catch (InterruptedException | ExecutionException e) { JOptionPane.showMessageDialog(frm, e.getMessage(), null, JOptionPane.ERROR_MESSAGE); frm.getContentPane().removeAll(); frm.dispose(); Home.frame.getContentPane().removeAll(); Home.frame.repaint(); new Home(); …
tagged with: swing
downvote count: 4
accepted answer: http://stackoverflow.com/a/24122243
type: AnsweredQuestion
upvote count: 0
tagged with: file-io
has title: Java Value must Be Between 0 and 100
tagged with: java
score: -4
answer count: 1
has comment: http://stackoverflow.com/comment/37212273
has comment: http://stackoverflow.com/comment/37212458

http://stackoverflow.com/a/24258439
has body: The copy() method of Configuration provides a way to create another configuration with all direct dependencies and no transitive dependencies in it. Have a look at the gradle dsl reference http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.artifacts.Configuration:copy() for details. A solution using the copy() method can look like this: task copyTestLibs(type: Copy) { into('libs-test') def javaProjects = subprojects.findAll { it.plugins.hasPlugin('java') } from javaProjects*.configurations.testCompile*.copy() }
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/37488133
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/24258111
has comment: http://stackoverflow.com/comment/37473958
has comment: http://stackoverflow.com/comment/37487858

http://stackoverflow.com/a/54536221
type: Answer
has body: answer from compiler indicates that regex syntax is invalid: (?P&lt;name&gt;regex) - is syntax for named groups (?&lt;=regex) / (?&lt;!regex) is positive/negative look-behind if unescaped, both '(' and '?' are special characters and don't make any sense together so non-arbitrary continuation required, like (?i) -- case-insensitive match (?s) -- single-line mode (?:regex) -- non-capturing group, etc
answers question: http://stackoverflow.com/q/24256204
score: 0

http://stackoverflow.com/a/24241342
has body: You can use DateTimeFormat instead. This should do it: DateTimeFormat inputFormat = DateTimeFormat.getFormat("EEE MMM dd HH:mm:ss z yyyy"); DateTimeFormat outputFormat= DateTimeFormat.getFormat("dd/MM/yyyy"); outputFormat.format(inputFormat.parse("Wed Apr 30 00:00:00 CEST 2014"));
type: Answer
has comment: http://stackoverflow.com/comment/37444100
has comment: http://stackoverflow.com/comment/37443923
has comment: http://stackoverflow.com/comment/37441135
has comment: http://stackoverflow.com/comment/37441081
downvote count: 0
has comment: http://stackoverflow.com/comment/37441015
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37443966
has comment: http://stackoverflow.com/comment/37441758
accepted answer of: http://stackoverflow.com/q/24241153
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24241153
has comment: http://stackoverflow.com/comment/37442249

http://stackoverflow.com/q/24117309
tagged with: java
has comment: http://stackoverflow.com/comment/37240266
tagged with: jaxb
has comment: http://stackoverflow.com/comment/37229910
type: Question
upvote count: 2
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: maven
favorite count: 0
has body: Im using jaxb2-maven-plugin to generate my web service sources from a WSDL. It works fine, but I have a little problem and it is that everytime I do a clean with maven, the class ObjectFactory.java is regenerated changing it's methods order. Looking on the internet I found that there is an issue opened with this error, however there is no solution yet. I was wondering if anyone has faced this problem and found a solution. Thanks!
has comment: http://stackoverflow.com/comment/37279621
has comment: http://stackoverflow.com/comment/37263947
has title: How to stop ObjectFactory regenerating every clean with maven

http://stackoverflow.com/comment/37347886
score: 0
has text: So, are you getting randomly generated values that are less than 1 or greater than 20 ?
type: AnswerComment
comment on: http://stackoverflow.com/a/24192509
type: Comment

http://stackoverflow.com/a/24255450
answers question: http://stackoverflow.com/q/24255268
type: Answer
score: 0
type: AcceptedAnswer
has body: There is no method which sets the initial filename for all versions of JDK 1.7. The set initial filename feature was only implemented for Java 1.7 update 40+. See RT-16111 "FileChooser: Need to be able to specify initial file name in save dialog" for more details.
accepted answer of: http://stackoverflow.com/q/24255268

http://stackoverflow.com/comment/37274753
type: AnswerComment
score: 0
type: Comment
has text: I have no idea how this class is created, and that is the problem.
comment on: http://stackoverflow.com/a/24153471

http://stackoverflow.com/q/24138402
has answer: http://stackoverflow.com/a/24138544
tagged with: aes
type: AnsweredQuestion
score: 0
duplicate of: http://stackoverflow.com/q/3862800
has title: AES encryption throwing "Illegal Key Size error"
tagged with: java
accepted answer: http://stackoverflow.com/a/24138544
tagged with: java-7
answer count: 1
type: Question
tagged with: encryption
has body: I'm trying to encrypt using AES. Below is my code snippet: private final static String ENCRYPTION_ALGORITHM = "AES"; private final static String CIPHER_TRANSFORMATION = "AES/CBC/PKCS5Padding"; private final static String ENCODING = "UTF-8"; private final static String KEY_STRING = "C0BAE23DF8B51807B3E17D21925FADF273A70181E1D81B8EDE6C76A5C1F1716E"; public static String encryptData(String plainText) { String keyString = KEY_STRING; String encryptedValue = null; byte[] keyValue = DatatypeConverter.parseHexBinary(keyString); Key key = new SecretKeySpec(keyValue, ENCRYPTION_ALGORITHM); Cipher cipher; byte[] encVal; try { cipher = Cipher.getInstance(CIPHER_TRANSFORMATION); cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(new byte[64])); encVal = cipher.doFinal(plainText.getBytes()); encryptedValue = (new BASE64Encoder()).encode(encVal); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | InvalidAlgorithmParameterException e) { System.out.println("Error in EncryptData.encryptData(): " + e.getMessage()); encryptedValue = null; } return encryptedValue; } Below is the error, which I'm getting while running in eclipse: Error in EncryptData.encryptData(): Illegal key size Any suggestions or what am I doing wrong?
linked to: http://stackoverflow.com/q/3862800

http://stackoverflow.com/comment/37332104
type: Comment
has text: Thank you!!! i was doing gl_Position = a_position * u_projectionViewMatrix; instead of gl_Position = u_projectionViewMatrix*a_position; it works fine now
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24184459

http://stackoverflow.com/comment/129743351
type: Comment
comment on: http://stackoverflow.com/a/30759385
type: AnswerComment
has text: @PhilippeGioseffi Without the helper method you will have to cast `s -> System.out.println(s + "1")` to `Consumer<String>`. And as we all know, casting kills kittens :)
score: 0

http://stackoverflow.com/comment/37410722
type: AnswerComment
comment on: http://stackoverflow.com/a/24225552
has text: Oh right yeah, I changed it really quick to see if it would make a difference.... it does, I changed it back to a grid.
score: 0
type: Comment

http://stackoverflow.com/a/24180725
downvote count: 0
has body: I suspect you just need to change the return type of the method: public static Variable&lt;?&gt; createVariable(String type) That basically says, "I'm returning a variable of some type, but I have no information about what the type argument is."
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/24180679
type: Answer

http://stackoverflow.com/comment/37272349
type: QuestionComment
comment on: http://stackoverflow.com/q/24152109
has text: Incidentally, you can use method references. Make sure your `button1Click` (for example) method takes an `ActionEvent` then just pass `MyClass::button1Click` to the method.
score: 0
type: Comment

http://stackoverflow.com/q/24150255
answer count: 0
type: UnansweredQuestion
has body: I'm working on Java Spring Hibernate Project with mysql. I'm trying to make some insert in cascade. The jobs are thrown on a cluster so they can occurs nearly at the same time and so there is a Deadlock problem. I have this error : Deadlock found when trying to get lock; try restarting transaction I found here that there is @RetryTransaction for spring developper. A way to configure here. They say that : The method's class must be woven (either at build time or runtime) using the AspectJ compiler with the RetryTransactionAspect aspect (included in the dellroad-stuff JAR file). What does it mean ? But i don't succeed to make it work. It never restart the transaction. What am i missing ? Thanks ! @Override @RetryTransaction @Transactional public void save(AnalyseResult analyseResult){ @SuppressWarnings("deprecation") final int attempt = RetryTransactionAspect.getAttempt(); System.out.println("#############"); System.out.println("Retry Transact : "+attempt); System.out.println("#############"); analyseResultDao.save(analyseResult); } In my BeanConfig.xml :
tagged with: spring
tagged with: deadlock
has comment: http://stackoverflow.com/comment/37274671
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37303746
tagged with: mysql
linked to: http://stackoverflow.com/q/2332768
type: Question
has title: Deadlock found when trying to get lock; try restarting transaction : @RetryTransaction

http://stackoverflow.com/comment/37450821
has text: I mean the less than or greater than keys.
comment on: http://stackoverflow.com/q/24246418
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24192416
has comment: http://stackoverflow.com/comment/37349999
tagged with: number-formatting
has comment: http://stackoverflow.com/comment/37352605
has comment: http://stackoverflow.com/comment/37350643
accepted answer: http://stackoverflow.com/a/53969987
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37350681
has title: Numberformat seems to ignore decimal places in Android - but only for US-Dollar and only in Germany
has comment: http://stackoverflow.com/comment/37348816
has answer: http://stackoverflow.com/a/53969987
has comment: http://stackoverflow.com/comment/37352276
has comment: http://stackoverflow.com/comment/37351853
upvote count: 3
score: 3
tagged with: java
answer count: 1
downvote count: 0
tagged with: string
has body: I'm having a really strange bug, where NumberFormat seemingly ignores the fraction digits I set. I'm using this rather simple method to format a double value representing a currency into a locale-specific String to show on screen: public static String formatValueString(String currencyISO, double value) { NumberFormat numberFormat = NumberFormat.getCurrencyInstance(); if (value != Math.floor(value)) { numberFormat.setMinimumFractionDigits(2); numberFormat.setMaximumFractionDigits(2); } else { numberFormat.setMinimumFractionDigits(0); numberFormat.setMaximumFractionDigits(0); } numberFormat.setCurrency(java.util.Currency.getInstance(currencyISO)); String result = numberFormat.format(value); return result; } It should show 2 decimal places only when needed, which according to the documentation of setCurrency should work: Sets the currency used by this number format when formatting currency values. The min and max fraction digits remain the same. Well.. It works most of the time. 2.0 with ISO "GBP" is correctly formated to "2 £" when the device language is set to German and "£2" when it's set to English in the US. However 2.0 with "USD" as ISO results in "2,00 $", when set to German. All other languages and all other currencies I have tested work as intended. I really have no idea, what I could be doing wrong for it to only not work in that one specific case. Any ideas? Edit: I tried this simplified version: public static String formatValueString(String currencyISO, double value) { NumberFormat numberFormat = NumberFormat.getCurrencyInstance(); numberFormat.setMinimumFractionDigits(0); numberFormat.setMaximumFractionDigits(0); numberFormat.setCurrency(java.util.Currency.getInstance(currencyISO)); String result = numberFormat.format(value); return result; } Same result, still shows 2 decimal places that shouldn't be there(again, only for US-Dollar in German), the Math.floor part is definitely not the problem. Edit 2: Doing this with screenshots now. Ignore all the commen…
has comment: http://stackoverflow.com/comment/37352238
has comment: http://stackoverflow.com/comment/37350226
has comment: http://stackoverflow.com/comment/37351892
favorite count: 0
has comment: http://stackoverflow.com/comment/37349676
type: Question
has comment: http://stackoverflow.com/comment/37363374
has comment: http://stackoverflow.com/comment/37350738
tagged with: android

http://stackoverflow.com/q/24187558
has comment: http://stackoverflow.com/comment/37337696
type: Question
has title: JSP include tag dynamically
has body: I got many custom tags, which I will include in my page depending on a string. I know I can make a choose/when list with each tag written out and switched by the given string, but it is not what I want. Something like this: &lt;control:${controlName} param=${param} /&gt;
tagged with: taglib
tagged with: tags
tagged with: jsp
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24187685
tagged with: java
has answer: http://stackoverflow.com/a/24187685
answer count: 1

http://stackoverflow.com/a/44172607
upvote count: 12
score: 12
downvote count: 0
type: Answer
has body: Best solution i found for static webpages and css is https://stackoverflow.com/a/39334398/6467734 and for loading code (including jsp) without restarting the server you can use Spring Boot Devtools dependency org.springframework.boot spring-boot-devtools true
answers question: http://stackoverflow.com/q/24221922

http://stackoverflow.com/comment/37408388
type: Comment
has text: One more thing will be necessary, which of the java `Date` class do you mean? `java.util.Date` or `java.sql.Date`
type: QuestionComment
comment on: http://stackoverflow.com/q/24224272
score: 0

http://stackoverflow.com/q/24233184
has answer: http://stackoverflow.com/a/24233211
type: AnsweredQuestion
has body: I have created CreateEvent activity @Override public void onClick(View v) { Intent in = new Intent(UserActivity.this, CreateEvent.class); startActivity(in); } }); In CreateEvent activity, I want to create listView and here is my code for it: @Override public void friendsDownlaoded(ArrayList&lt;User&gt; friends) { this.friends = friends; this.adapter = new InviteFriendAdapter(getLayoutInflater()); this.friendListview.setAdapter(adapter); removeRoation(); setUpContent(); } and here is code for InviteFriendAdapter, which is inner class and it can see ArrayList friends: private class InviteFriendAdapter extends BaseAdapter { private LayoutInflater inflater; public InviteFriendAdapter(LayoutInflater inflater) { this.inflater = inflater; } @Override public int getCount() { return friends.size(); } @Override public Object getItem(int i) { return friends.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View myView, ViewGroup vg) { FriendHolder frndHolder; User user = friends.get(position); if (myView == null) { myView = this.inflater.inflate(R.layout.invite_friends_event_item, null,false); ImageView img= (ImageView) findViewById(R.id.inviteCheckBox); frndHolder = new FriendHolder(); frndHolder.hisImage = (ImageView) findViewById(R.id.inviteCheckBox); frndHolder.hisNumber = (TextView) findViewById(R.id.inviteHisNumber); frndHolder.hisName = (TextView) findViewById(R.id.inviteHisName); myView.setTag(frndHolder); } else { frndHolder = (FriendHolder) myView.getTag(); } frndHolder.hisName.setText("aa"); frndHolder.hisNumber.setText("uUU"); return myView; } } private static class FriendHolder { TextView hisName; TextView hisNumber; ImageView hisImage; } I've checked ArrayList friends and it isn't null; The program throws NullPointException at adapters getView() and the reason is that when myView == null - (ImageView) findViewById(R.id.inviteCheckBox); returns null Here is xml file for item: &lt;?xml version="1.0" encoding=…
has comment: http://stackoverflow.com/comment/37425053
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/24233211
tagged with: listview
tagged with: http://stackoverflow.com/tag/xml
type: Question
score: 0
has title: Android - findViewById(int id) always returns null
answer count: 1
tagged with: baseadapter

http://stackoverflow.com/comment/37288333
score: 0
has text: There is no need of XML layout perhaps what i think
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24161231

http://stackoverflow.com/q/24178568
has body: When we are implementing InApp by Amazon inApp API, we call the initiatePurchaseUpdatesRequests(Offset offset) function by Purchasing Manager. In response, we get onPurchaseUpdatesResponse(PurchaseUpdatesResponse obj). I am confused about offset. If we are calling for first time then we can use Ofset.BEGINNING and in the response the method obj.getOffset(). The documentation says that this will return the Offset you're supposed to send. If it will return the old offset, then it means that the same Offset.BEGINNING will be sent every time. Also, I am confused about what the Offset is in the first place. Can someone clarify those points?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24248522
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/24196491
downvote count: 0
tagged with: amazon-web-services
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/24196491
has title: Amazon InApp Purchase
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/24248522

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

http://stackoverflow.com/comment/37204920
type: Comment
has text: Final prevents `val` from being assigned to something else; including `null`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24116492
score: 0

http://stackoverflow.com/a/24146935
downvote count: 0
has comment: http://stackoverflow.com/comment/37316522
has body: Since this appears to be homework, I won't provide a full solution, but as asked I'll provide some general considerations/tips. Taking the first test case as an example: capture the argument/parameter to the View constructor as a member variable. We will call that member variable text. capture each key-value relationship provided to add. Generally, this will be accomplished with a Mapping data structure. If that option isn't available to you, then you could always modify text directly with each call to add. perform the replacement of render. That is easily accomplished by the replace method. If text was modified in add then just return it. So all together without wrapping those implementation details into a View class, it would look something like @Test public void testString() { String text = "Hi, my name is {name}!"; final Map&lt;String, String&gt; placeHolderToReplacement = new HashMap&lt;&gt;(); placeHolderToReplacement.put("name", "Josh"); for (Map.Entry&lt;String, String&gt; entry : placeHolderToReplacement.entrySet()) { text = text.replace("{"+entry.getKey()+"}", entry.getValue()); } Assert.assertEquals("Hi, my name is Josh!", text); } I think that should give you enough of a starting point to solve the problem. Now, the post explicitly states String-Object pair. Does it have to be the exact same add method that takes the Collection of View objects and the String? You'll have to make the consideration of whether to provide an overloaded method vs a single method is acceptable. If it has to be the same method, then you'll need to perform the type checks yourself.
has comment: http://stackoverflow.com/comment/37316322
answers question: http://stackoverflow.com/q/24131893
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/37425144
type: AnswerComment
has text: java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1) OpenJDK Server VM (build 24.51-b03, mixed mode)
comment on: http://stackoverflow.com/a/24210335
type: Comment
score: 0

http://stackoverflow.com/comment/37226920
has text: You can't cast classes (or objects), you can only cast references. It's an important distinction.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24127638

http://stackoverflow.com/a/24266987
has body: Have a setter method in JanusUI setOSText() public void setOSText(string) { jLabel4.setText(string); } Have detectOS return the OS name: public static String detectOS(){ if(isMac()){ System.out.println("operating system detected as Mac"); return "Mac"; } ... ... } Call setOSText from your constructor: public Janus(){ JanusUI gui = new JanusUI(); gui.setVisible(true); String os = detectOS(); gui.setOSText(os); }
type: Answer
accepted answer of: http://stackoverflow.com/q/24266770
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24266770
downvote count: 0
score: 2

http://stackoverflow.com/q/24115083
answer count: 1
has comment: http://stackoverflow.com/comment/37205706
favorite count: 0
has answer: http://stackoverflow.com/a/24115308
has comment: http://stackoverflow.com/comment/37203570
type: Question
linked to: http://stackoverflow.com/q/5488072
tagged with: system.in
type: UnansweredQuestion
has body: Im currently creating a java program which should read the console and print it out, once again. The code looks like this: import java.io.IOException; public class printer { public static void main(String[] args){ int i; try { while ((i = System.in.read()) != -1) { char c = (char)i; System.out.print(c); } } catch (IOException e) { e.printStackTrace(); } } } The problem is, if you type this text below in the console you will get the first line printed, but since its a "\n" after the word "print" the program doesn't print the second line without me pressing Enter manually This is the text I want to print And now I pressed Enter And when i press enter, to get the second line, the result is: This is the text I want to print And now I pressed Enter Which is not how it normally looked like. I would prefer if the first line didn't print automatically. I want to press Enter and get both lines at the same time. Is that possible using while ((i = System.in.read()) != -1) like I do?
score: -1
has title: Java. System.in.read() and "\n" in console
duplicate of: http://stackoverflow.com/q/5488072
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37202760
downvote count: 1

http://stackoverflow.com/comment/37414239
type: Comment
has text: So you want know how to rescale an image?
type: QuestionComment
comment on: http://stackoverflow.com/q/24226976
score: 0

http://stackoverflow.com/q/24266737
answer count: 1
favorite count: 0
type: Question
tagged with: e4
tagged with: eclipse-rcp
accepted answer: http://stackoverflow.com/a/24267182
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/24267182
has body: Neither @Inject MyService[] services nor @Inject Collection&lt;MyService&gt; works to get multiple instances of the same service. It seems like the eclipse guys don't provide a "simple" solution, see: Bug 413147. Lars Vogel suggest: I think the correct solution for customers desire that functionality is to define an extended object supplier. Currently we have no plan to support the injection of multiple values via DI. But how to do it, i cant find anything about it? Or should i use a ServiceTracker instead?
tagged with: eclipse
type: AnsweredQuestion
has title: How to inject multiple instances of a services in eclipse e4?
score: 2
upvote count: 2
tagged with: java
downvote count: 0

http://stackoverflow.com/comment/37514509
type: Comment
type: AnswerComment
has text: Thanks Bharathi fr ur input but my doubt is.....The workspace (checked out code ) repository in the slave machine which includes report files is cleaned each time the job is run, so if the html publisher points to the absolute path also to get the reports it should have fetched the updated report htmls generated from the latest run .
comment on: http://stackoverflow.com/a/24244283
score: 0

web-inf
type: Tag
tags question: http://stackoverflow.com/q/24191572
tag name: web-inf

http://stackoverflow.com/a/24107708
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/76053882
score: 1
type: Answer
has body: The layout you want to use for that ArrayAdapter instance. Usually you can use a default one from android: android.R.layout.simple_list_item_1 Why it is only a TextView: because that's how the ArrayAdapter is implemented. It has to contain a TextView for sorting/filtering etc If you want a custom view you can create a custom adapter that extends ArrayAdapter and you override getView(...)
answers question: http://stackoverflow.com/q/24107684

http://stackoverflow.com/comment/37388502
has text: I cant use getIntent, as it is a Java Class
score: 0
comment on: http://stackoverflow.com/a/24211612
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24222665
type: Answer
has body: To store player's name and town's name, simply do: myConfigFile.set(townname, playername); But I suggest using player's UUID, istead of player's name, since in 1.8+ names will become changable! myConfigFile.set(townname, player.getUniqueId()); Then to get the town's owner: myConfigFile.getString(townname); You will find better answers and informations on Bukkit forums
has comment: http://stackoverflow.com/comment/37406324
has comment: http://stackoverflow.com/comment/37405476
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37405335
answers question: http://stackoverflow.com/q/24222626
accepted answer of: http://stackoverflow.com/q/24222626
score: 0

http://stackoverflow.com/q/24233364
has comment: http://stackoverflow.com/comment/37425714
has comment: http://stackoverflow.com/comment/37425681
has answer: http://stackoverflow.com/a/72006476
has answer: http://stackoverflow.com/a/57218503
accepted answer: http://stackoverflow.com/a/24233610
downvote count: 1
has comment: http://stackoverflow.com/comment/37425641
favorite count: 0
tagged with: resources
type: Question
has answer: http://stackoverflow.com/a/24233610
tagged with: classloader
answer count: 5
possible better answer: http://stackoverflow.com/a/52910501
upvote count: 5
has body: I read ~4 Stackoverflow Posts (1, 2) already, and did everything like it was explained there, but I get a NullPointerException while I try to load an Image. Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Input stream must not be null My package structure: Code where I try to load the image: Image image = new Image(this.getClass().getResourceAsStream("/regexgolf2/ui/img/edit.png")); I don't understand why It does not work.
linked to: http://stackoverflow.com/q/9867273
has answer: http://stackoverflow.com/a/52910501
has answer: http://stackoverflow.com/a/71675999
score: 4
tagged with: image
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37425453
has comment: http://stackoverflow.com/comment/37425522
has title: My resource does not load - "Input stream must not be null"
tagged with: java

http://stackoverflow.com/q/24260271
favorite count: 0
has body: I am trying to clear the HttpSession if the consumer close the browser window. I dont know how to do it, Please help me anyone Thanks &amp; Regards Chakri
type: Question
has comment: http://stackoverflow.com/comment/37477615
has answer: http://stackoverflow.com/a/24297481
has comment: http://stackoverflow.com/comment/37477269
linked to: http://stackoverflow.com/q/20853142
score: 5
answer count: 5
type: UnansweredQuestion
tagged with: jsp-tags
linked to: http://stackoverflow.com/q/805463
upvote count: 6
tagged with: jsp
tagged with: javascript
has title: How to clear the httpsession, if the user close the browser in java
has answer: http://stackoverflow.com/a/35957728
linked to: http://stackoverflow.com/q/3888902
has answer: http://stackoverflow.com/a/24260430
has comment: http://stackoverflow.com/comment/37476931
has answer: http://stackoverflow.com/a/31432022
linked to: http://stackoverflow.com/q/16272137
tagged with: java
has answer: http://stackoverflow.com/a/24260653
tagged with: http://stackoverflow.com/tag/html
downvote count: 1

http://stackoverflow.com/a/24180842
score: 1
upvote count: 1
has body: Solution, based on the accepted answer of Lukas Eder After creating the truststore and keystore (scroll down to [17 Apr 2013 9:04] Alexander Soklakov), I could generate the code with the following class, where I get an SSL database connection and use it for the JOOQ Generator: import java.sql.Connection; import org.jooq.util.GenerationTool; import org.jooq.util.jaxb.Configuration; import org.jooq.util.jaxb.Database; import org.jooq.util.jaxb.Generator; import org.jooq.util.jaxb.Target; import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; public class JooqGenerator { public static void main(String[] args) throws Exception { MysqlDataSource mysqlDS = new MysqlDataSource(); mysqlDS.setUseSSL(true); mysqlDS.setRequireSSL(true); mysqlDS.setClientCertificateKeyStoreUrl(".../keystore"); mysqlDS.setClientCertificateKeyStorePassword("keystore-pw"); mysqlDS.setTrustCertificateKeyStoreUrl(".../truststore"); mysqlDS.setTrustCertificateKeyStorePassword("truststore-pw"); mysqlDS.setServerName("server"); mysqlDS.setPort(3306); mysqlDS.setDatabaseName("databasename"); Connection connection = mysqlDS.getConnection("user", "password"); Configuration configuration = new Configuration() .withGenerator(new Generator() .withName("org.jooq.util.DefaultGenerator") .withDatabase(new Database() .withName("org.jooq.util.mysql.MySQLDatabase") .withIncludes(".*") .withExcludes("") .withInputSchema("databasename")) .withTarget(new Target() .withPackageName("my.package.name") .withDirectory("./src"))); GenerationTool tool = new GenerationTool(); tool.setConnection(connection); tool.run(configuration); } }
type: Answer
answers question: http://stackoverflow.com/q/24162481
downvote count: 0

http://stackoverflow.com/comment/37235009
comment on: http://stackoverflow.com/q/24132330
type: Comment
type: QuestionComment
has text: Functional difference? Yes, if you reference a field, as Java's fields aren't polymorphic. Yes, if you need a `MountainBike`-only member, as the code will compile one way but not the other. No, if you only reference methods.
score: 0

http://stackoverflow.com/q/24185091
tagged with: memory-leaks
tagged with: java
tagged with: hibernate
has body: My application seems to work alright, but when I stop the server I get these messages. I don´t manually start any thread, but I´m new to these technologies and I´m not sure how they work internally. I´m using C3p0 to create a pool of connections, and maybe there is a leak because the connections are not closing well, but I don´t know the right way to do it. But it seems for the ammount of messages that might be more problems. Please, could someone tell me what does this all means and how could I solve the memory leaks? Please excuse my deficient English. Thank you all. ... Information: Closing Spring root WebApplicationContext jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads Severe: The web application [/Consulta] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads Severe: The web application [/Consulta] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak. jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads Severe: The web application [/Consulta] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but has failed to stop it. This is very likely to create a memory leak. jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads Severe: The web application [/Consulta] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but has failed to stop it. This is very likely to create a memory leak. jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads Severe: The web application [/Consulta] appears to have started a thread named [MultiThreaded…
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/8677008
tagged with: apache
answer count: 1
has title: Memory leaks in a java web service using Hibernate
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/13532302
has answer: http://stackoverflow.com/a/24187375
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24187375
score: 1

http://stackoverflow.com/comment/37437162
type: Comment
comment on: http://stackoverflow.com/a/24205865
has text: I am going to test it out today. It looks quite promising. :-)
type: AnswerComment
score: 0

http://stackoverflow.com/a/24133550
answers question: http://stackoverflow.com/q/24132855
has body: PreparedStatement is used for giving dynamic parameter to query.Instead of using Prepared statement, use Statement. If you want to use Prepared Statement then ps=con.prepareStatement("update patient set sname=?, address=?, bloodgrp=?, history=?, roomtype=?, roomno=?, contact=?, doa=?.................); ps.setString(1,s1); ... .. . ps.executeUpdate();
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24132855
has comment: http://stackoverflow.com/comment/37283509
has comment: http://stackoverflow.com/comment/37279672
score: 0
has comment: http://stackoverflow.com/comment/37279766
type: Answer
has comment: http://stackoverflow.com/comment/37280227

jprogressbar
tags question: http://stackoverflow.com/q/24210134
type: Tag
tags question: http://stackoverflow.com/q/24120470
tag name: jprogressbar
tags question: http://stackoverflow.com/q/24127043

http://stackoverflow.com/q/24116398
downvote count: 0
has title: Smack API 4.0 encounter error "org/xmlpull/v1/XmlPullParserFactory" and "Cannot instantiate XMPPConnection"
answer count: 1
favorite count: 0
tagged with: smack
accepted answer: http://stackoverflow.com/a/24129326
type: Question
has answer: http://stackoverflow.com/a/24129326
has body: I'm writing the XMpp connection to my XMpp server by Eclipse added Smack API 4.0 import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; public class XmppManager { public static final String HOST = "localhost"; public static final int PORT = 5222; public static final String SERVICE = "chat"; public static void main (String[] arg){ ConnectionConfiguration connConfig = new ConnectionConfiguration(XmppManager.HOST, XmppManager.PORT, XmppManager.SERVICE); } } , but during on this, I encounter the error as below: Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserFactory at org.jivesoftware.smack.SmackConfiguration.processConfigFile(SmackConfiguration.java:321) at org.jivesoftware.smack.SmackConfiguration.processConfigFile(SmackConfiguration.java:316) at org.jivesoftware.smack.SmackConfiguration.&lt;clinit&gt;(SmackConfiguration.java:148) at org.jivesoftware.smack.ConnectionConfiguration.&lt;init&gt;(ConnectionConfiguration.java:65) at Snapp.XmppManager.main(XmppManager.java:18) Caused by: java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 5 more Besides, adding XMPPConnection under line ""Cannot instantiate XMPPConnection"" XMPPConnection connection = new XMPPConnection (connConfig); Java_Eclipse inform "Cannot instantiate XMPPConnection" error Have you experienced two issues as above before ? Please help me figure out the issue. Thanks.
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/a/24253883
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24253687
accepted answer of: http://stackoverflow.com/q/24253687
has body: you need pass dbConnect return value like parameter in the getData method something like: System.out.println("Connection to Database OK"); ResultSet data = Utility.getData(Utility.dbConnec());
type: Answer
has comment: http://stackoverflow.com/comment/37497481

signals
tags question: http://stackoverflow.com/q/24192998
type: Tag
tags question: http://stackoverflow.com/q/24210245
tag name: signals

http://stackoverflow.com/comment/37452984
type: Comment
comment on: http://stackoverflow.com/q/24247154
type: QuestionComment
has text: @Charles Wood : Yes, I am using GWT... so well, MVP more than MVC.
score: 0

http://stackoverflow.com/q/24221839
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24221888
tagged with: java
accepted answer: http://stackoverflow.com/a/24221888
answer count: 1
type: Question
tagged with: apache-flex
has title: FlexContext.getServletContext() is returning NPE
has body: I'm having an issue with Flex. The following java line is throwing NPE. ServletContext servletContext = FlexContext.getServletContext(); However, the following command works just fine and throws no exception. After the command executes, httpServletRequest is null (as expected). HttpServletRequest httpServletRequest = FlexContext.getHttpRequest();

http://stackoverflow.com/a/24164728
accepted answer of: http://stackoverflow.com/q/24164596
has body: As devnull says, simply a random number between 62 and 74 and divide by 10. Here's an example: Random r = new Random(); double d = (double) ((r.nextInt(75) + 62) / 10d); System.out.println(d);
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24164596
type: Answer

http://stackoverflow.com/comment/37434388
type: Comment
comment on: http://stackoverflow.com/a/24237811
has text: Sorry I want to Xccc as a one string
score: 0
type: AnswerComment

inheritance
tags question: http://stackoverflow.com/q/24261719
tags question: http://stackoverflow.com/q/24125894
tags question: http://stackoverflow.com/q/24137137
tags question: http://stackoverflow.com/q/24241014
tags question: http://stackoverflow.com/q/24233554
tags question: http://stackoverflow.com/q/24262690
tags question: http://stackoverflow.com/q/24221947
tags question: http://stackoverflow.com/q/24114263
tags question: http://stackoverflow.com/q/24218852
tags question: http://stackoverflow.com/q/24217645
tag name: inheritance
tags question: http://stackoverflow.com/q/24243240
tags question: http://stackoverflow.com/q/24247461
tags question: http://stackoverflow.com/q/24220082
tags question: http://stackoverflow.com/q/24168964
tags question: http://stackoverflow.com/q/24236273
tags question: http://stackoverflow.com/q/24178171
tags question: http://stackoverflow.com/q/24239645
tags question: http://stackoverflow.com/q/24188517
tags question: http://stackoverflow.com/q/24189082
tags question: http://stackoverflow.com/q/24132330
tags question: http://stackoverflow.com/q/24175664
tags question: http://stackoverflow.com/q/24132273
tags question: http://stackoverflow.com/q/24136339
type: Tag
tags question: http://stackoverflow.com/q/24113901
tags question: http://stackoverflow.com/q/24234185
tags question: http://stackoverflow.com/q/24106948
tags question: http://stackoverflow.com/q/24264317
tags question: http://stackoverflow.com/q/24155898

http://stackoverflow.com/comment/37400159
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24218863
type: QuestionComment
has text: If you have 2 questions, please ask them separately.

http://stackoverflow.com/a/24183356
score: 1
has comment: http://stackoverflow.com/comment/37345161
answers question: http://stackoverflow.com/q/24182964
has comment: http://stackoverflow.com/comment/37331606
downvote count: 0
type: Answer
upvote count: 1
has body: I just created a new GWT project and UiBinder file: &lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt; &lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"&gt; &lt;ui:style&gt; .important { font-weight: bold; } &lt;/ui:style&gt; &lt;g:HTMLPanel&gt; &lt;g:HTMLPanel&gt; First panel &lt;/g:HTMLPanel&gt; &lt;g:ScrollPanel height="100px"&gt; &lt;g:HTMLPanel&gt; aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt; aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt; aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt; aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt; &lt;/g:HTMLPanel&gt; &lt;/g:ScrollPanel&gt; &lt;/g:HTMLPanel&gt; &lt;/ui:UiBinder&gt; And Java file public class RetaTest extends Composite implements HasText { private static RetaTestUiBinder uiBinder = GWT .create(RetaTestUiBinder.class); interface RetaTestUiBinder extends UiBinder&lt;Widget, RetaTest&gt; { } public RetaTest() { initWidget(uiBinder.createAndBindUi(this)); } public RetaTest(String firstName) { initWidget(uiBinder.createAndBindUi(this)); } @Override public String getText() { // TODO Auto-generated method stub return null; } @Override public void setText(String text) { // TODO Auto-generated method stub } } And onModuleLoad public void onModuleLoad() { RootPanel.get().add(new RetaTest()); } It works.
has comment: http://stackoverflow.com/comment/37330232

http://stackoverflow.com/q/24230505
has title: Passing byte[] array to another view
has comment: http://stackoverflow.com/comment/37420245
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/24230705
has answer: http://stackoverflow.com/a/24230645
tagged with: java
has comment: http://stackoverflow.com/comment/37419978
has answer: http://stackoverflow.com/a/24230705
has comment: http://stackoverflow.com/comment/37419938
type: Question
linked to: http://stackoverflow.com/q/2091465
accepted answer: http://stackoverflow.com/a/24230645
answer count: 2
tagged with: android
has body: I have been at this for hours now and I just have no idea on how to pass a byte[] array to another view when I call OnItemClick. I have tried converting the byte array to a string and back but that doesn't work. I can't do get(position) like I could on a normal string array. Sorry if this is basic but I honestly have no clue on how to due this. @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { if (view.equals(footerView)) { footerView.showProgress(); List&lt;Status&gt; olderTimeline = loadOlderTweets(); insertTimeline(olderTimeline); attachAdapter(); } else { // i want to do something like this on the byte[] array result_pos = timeline_arg.get(position); Intent i = new Intent(getSherlockActivity(), TDetailActivity.class); i.putExtra("username", result_pos.get("username")); } }
has comment: http://stackoverflow.com/comment/37419993

http://stackoverflow.com/comment/86296171
has text: If you run the server with spring-boot:run, you won't be able to stop it by just pressing Red icon in console window.
comment on: http://stackoverflow.com/a/27924073
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/q/24127474
has comment: http://stackoverflow.com/comment/37225967
upvote count: 0
has answer: http://stackoverflow.com/a/24127513
answer count: 1
score: -3
has comment: http://stackoverflow.com/comment/37225957
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37226115
tagged with: reflection
has comment: http://stackoverflow.com/comment/37225968
tagged with: java
has title: Java Reflection checking String fields length
downvote count: 3
has comment: http://stackoverflow.com/comment/37225956
has comment: http://stackoverflow.com/comment/37225955
type: AnsweredQuestion
has body: There is a method: public List&lt;Field&gt; getAtLeastTenChar(Object o) { List&lt;Field&gt; FieldList = new ArrayList&lt;&gt;(); Class c = o.getClass(); Field[] mezok = c.getFields(); for(int i=0; i&lt;mezok.length; i++){ if(mezok[i].getType()==String){ if(mezok[i].length()&gt;10){ FieldList.add(mezok[i]) } } } } If o has String fields, I want to know, are these strings length reaches 10 character. If yes it puts these fields to the List end at the and returns the List. I think it could be done with reflection, but not sure about how to.
has comment: http://stackoverflow.com/comment/37244327
accepted answer: http://stackoverflow.com/a/24127513

http://stackoverflow.com/q/24131263
score: -4
answer count: 1
has answer: http://stackoverflow.com/a/24131505
accepted answer: http://stackoverflow.com/a/24131505
has title: translate coordinate method java
has comment: http://stackoverflow.com/comment/37233270
downvote count: 4
type: AnsweredQuestion
has body: I can't seem to get my transform method right. Any suggestions on how I could make the method translate the point better? i.e. when this method is invoked, it should be able to give the new point. Also I'm having issues creating the slope method...I know slope is y2-y1/x2-x1 but how would I make that into a method. Is there a Math class I can import for the slope? Thanks much appreciated import java.util.*; public class Point { private int x; // to store variables for x &amp; y private int y; private double slope; //default constructor public Point () { double x = 0; double y = 0; } //alternate constructor public Point (double x1, double y1) { double x = x1; double y = y1; } //set coordinates public void setCoord (double x1, double y1){ double x = x1; double y = y1; } //print method public void print () { System.out.print(x + "," + y); } //toString Method public String toString() { return "(" + x + "," + y + ")"; } public int getX() { return x; } public int getY() { return y; } public void equals () { if (x==y) System.out.println(" Coordinates are the same "); else { System.out.println(" Coordinates are different "); } } public void copy(Point temp) { x=temp.x; y=temp.y; } public Point getCopy() { Point temp = new Point(); temp.x = x; temp.y = y; return temp; } public void distanceFromOrigin(int x1, int y1) { double dx = x-x1; double dy = y-y1; } //calculate the distance from one point to another public void distance (double x1, double y1) { double distance = Math.sqrt((x * x1) + (y * y1)); } //shift the location of a point by a given amount public void transform (double dx, double dy) { double transform = ((x+dx) (y+dy)); } // returns true if any given point lines up horizontally with a given point. public boolean isHorizontal () { return true; } // returns true if any given point lines up vertically with a given point. public boolean isVertical () { return true; } // returns the slope of the line public double slope() { return slope; } }
tagged with: java
has comment: http://stackoverflow.com/comment/37233418
has comment: http://stackoverflow.com/comment/37233193
has comment: http://stackoverflow.com/comment/37233234
has comment: http://stackoverflow.com/comment/37233492
tagged with: methods
has comment: http://stackoverflow.com/comment/37233568
has comment: http://stackoverflow.com/comment/37233160
favorite count: 0
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/37233481

http://stackoverflow.com/q/24226922
tagged with: oop
type: AnsweredQuestion
tagged with: java
has body: What is the use of Object class in android. The documentation of android doesn't clearly clears what it means. eg ArrayList we use it store value of any type in particular key. But I am unable to find out whay is the analogy behind it. My last question is why to use that object class and in which circumstances we can use it
answer count: 3
score: 1
upvote count: 1
linked to: http://stackoverflow.com/q/4453349
favorite count: 0
possible better answer: http://stackoverflow.com/a/24226973
type: Question
has answer: http://stackoverflow.com/a/24226935
accepted answer: http://stackoverflow.com/a/24227020
has answer: http://stackoverflow.com/a/24226973
tagged with: android
downvote count: 0
has answer: http://stackoverflow.com/a/24227020
has title: Object class in android

http://stackoverflow.com/q/24198009
has body: Say I have a TextArea for users to input. And it is multilined. So, I write the following text into it. "Testing line and line and line" Well, something to be reminded here. To put line separator, user only presses Enter. Now, I want to replace all the line separators from the input text with "!". I expect the output to be "Testing!line!and!line!and!line" In order to do this, I used the following code. System.out.println(getText().replace(System.getProperty("line.separator"), "!")); However, the output is the same as the input text. But, if I replace the above code with System.out.println(getText().replace("\n", "!")); The output turns out to be as expected. Consider this as OS-independent. I tested this under Windows XP. How can I replace \n with something that is able to run in different OS. It is supposed to be System.getProperty("line.separator") but I don't get why it doesn't work here. Thanks.
tagged with: cross-platform
type: Question
accepted answer: http://stackoverflow.com/a/24198122
tagged with: newline
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24198122
upvote count: 1
has title: line.seperator does not replace \n
has comment: http://stackoverflow.com/comment/37358187
favorite count: 0
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/37358473
tagged with: java
has comment: http://stackoverflow.com/comment/37358190

http://stackoverflow.com/comment/37516638
comment on: http://stackoverflow.com/a/24256532
score: 0
type: Comment
has text: @user1182217 You can use `Pattern regex = Pattern.compile("(\".*?\")");` and use matcher to fetch grop 1.
type: AnswerComment

http://stackoverflow.com/a/24217326
has body: The mysql-connector-java-5.1.18-bin.jar must be inside of WEB-INF/lib folder
type: Answer
answers question: http://stackoverflow.com/q/24217306
score: 0

google-api-java-client
tags question: http://stackoverflow.com/q/24183160
tag name: google-api-java-client
tags question: http://stackoverflow.com/q/24171590
type: Tag
tags question: http://stackoverflow.com/q/24235762
tags question: http://stackoverflow.com/q/24141607
tags question: http://stackoverflow.com/q/24215145

http://stackoverflow.com/comment/37387946
comment on: http://stackoverflow.com/q/24213249
type: QuestionComment
type: Comment
score: 0
has text: shouldn't it be `new String(Base64. **DE** code(...))`? Looks like you're double ENCODING (once in php, once in android)

http://stackoverflow.com/q/24117713
favorite count: 0
has answer: http://stackoverflow.com/a/24118097
has answer: http://stackoverflow.com/a/45526703
has comment: http://stackoverflow.com/comment/37207056
has answer: http://stackoverflow.com/a/50087008
has comment: http://stackoverflow.com/comment/37207291
tagged with: java
has answer: http://stackoverflow.com/a/45429828
has answer: http://stackoverflow.com/a/24117799
has comment: http://stackoverflow.com/comment/139676627
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37208728
has comment: http://stackoverflow.com/comment/127021171
type: Question
linked to: http://stackoverflow.com/q/9050066
duplicate of: http://stackoverflow.com/q/16225177
has body: I downloaded eclipse-jee-kepler-SR1-linux-gtk-x86_64.tar.gz. This eclipse is built-in with java and my Lubuntu is 64-bit. Whenever I compile and run a simple code in java like this one below: public class Sample{ public static void main(String[] args){ System.out.println("YOLO"); } } I always get an Editor does not contain a main type. I put the file in a project folder called Sample. This eclipse should compile java code because its an IDE distribution specialized for java. How can i resolve this error? Any help would be much appreciated. Here's my project structure:
has answer: http://stackoverflow.com/a/48040786
has answer: http://stackoverflow.com/a/46598368
has answer: http://stackoverflow.com/a/24118148
has answer: http://stackoverflow.com/a/29203696
score: 62
upvote count: 63
linked to: http://stackoverflow.com/q/16225177
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/49089470
has answer: http://stackoverflow.com/a/50356392
has answer: http://stackoverflow.com/a/50844982
has answer: http://stackoverflow.com/a/28428413
has title: Editor does not contain a main type in Eclipse
downvote count: 1
answer count: 13

http://stackoverflow.com/q/24188824
has comment: http://stackoverflow.com/comment/37340494
accepted answer: http://stackoverflow.com/a/24190057
tagged with: java-8
linked to: http://stackoverflow.com/q/3546745
score: 9
answer count: 2
has body: The following compiles just fine in JDK8, but gives an incompatible types error with JDK7. List&lt;List&lt;? extends Number&gt;&gt; xs = Arrays.asList(Arrays.asList(0)); According to this answer, List&lt;List&lt;? extends Number&gt;&gt; doesn't have a supertype relationship to List&lt;List&lt;Integer&gt;&gt;. What changed in Java 8 that made this assignment work? I'm also having a hard time understanding why it doesn't work in Java 7. Both of these statements compile without type error using JDK7: List&lt;? extends Number&gt; xs = Arrays.asList(0); List&lt;? extends List&lt;? extends Number&gt;&gt; ys = Arrays.asList(Arrays.asList(0)); It seems very unintuitive to me that both of those work in JDK7, but the original example above does not. All of them of course will work in JDK8. I think to really understand what's going on here I'd need to understand why these examples are legal in Java 7 but the original example is not.
has comment: http://stackoverflow.com/comment/37365481
tagged with: java
has title: Difference of assignability with nested wildcards in Java 7/8 generics
downvote count: 0
has answer: http://stackoverflow.com/a/24190189
tagged with: generics
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24190057
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37341444
has comment: http://stackoverflow.com/comment/37341374
has comment: http://stackoverflow.com/comment/37341265
tagged with: bounded-wildcard
upvote count: 9
possible better answer: http://stackoverflow.com/a/24190189

http://stackoverflow.com/q/24230724
score: 0
tagged with: java
tagged with: loops
has title: String loop inside for loop
type: Question
has body: I'm trying to make a frame with plenty of rectangles inside a rectangle. I want those who are inside to be different colors, so I've tried to make a for loop with different coordinates and color. But my String loop that I found searching doesn't work very well inside the loop. It just prints all coordinates with one color( like: g2.setColor(Color.CYAN);g.drawRect(247, 197, 50, 50); g2.setColor(Color.CYAN);g.drawRect(244, 194, 49, 49); g2.setColor(Color.CYAN);g.drawRect(241, 191, 48, 48); g2.setColor(Color.RED);g.drawRect(247, 197, 50, 50); g2.setColor(Color.RED);g.drawRect(244, 194, 49, 49); g2.setColor(Color.RED);g.drawRect(241, 191, 48, 48); ) , then the next color with the coordinates etc. but i want it in a single row ( like: g2.setColor(Color.CYAN);g.drawRect(247, 197, 50, 50); g2.setColor(Color.RED);g.drawRect(244, 194, 49, 49); g2.setColor(Color.BLUE);g.drawRect(241, 191, 48, 48); g2.setColor(Color.GREEN);g.drawRect(238, 188, 47, 47); g2.setColor(Color.PINK);g.drawRect(235, 185, 46, 46); g2.setColor(Color.MAGENTA);g.drawRect(232, 182, 45, 45); I have created this code, but I just doesn't understand whats wrong?! package src; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JFrame; import javax.swing.JPanel; @SuppressWarnings("serial") public class Nr1 extends JPanel { JFrame frame = new JFrame(); public static void main(String[] args) { // TODO Auto-generated method stub new Nr1(); } public Nr1(){ frame.setVisible(true); frame.setBackground(Color.gray); frame.setForeground(Color.pink); frame.setSize(1845, 800); frame.setResizable(false); int i; int y = 250; int z = 200; String [] names ={"CYAN", "PINK", "MAGENTA", "YELLOW", "GREEN", "BLUE", "RED"}; for( String name : names ) { for (i=50;i &gt; 0;i--){ y = y -3; z = z -3; System.out.print("g2.setColor(Color." + name + ");"); System.out.print("g.drawRect(" + y + ", " + z + ", " + i +", " + i + ");\n"); }} java.awt.Container contentPane = frame.getContentPane(); con…
has answer: http://stackoverflow.com/a/24230808
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24230796
has answer: http://stackoverflow.com/a/24230760
answer count: 3

android
tags question: http://stackoverflow.com/q/24175391
tags question: http://stackoverflow.com/q/24168625
tags question: http://stackoverflow.com/q/24154390
tags question: http://stackoverflow.com/q/24253961
tags question: http://stackoverflow.com/q/24139611
tags question: http://stackoverflow.com/q/24137628
tags question: http://stackoverflow.com/q/24215702
tags question: http://stackoverflow.com/q/24249928
tags question: http://stackoverflow.com/q/24125344
tags question: http://stackoverflow.com/q/24156047
tags question: http://stackoverflow.com/q/24191041
tags question: http://stackoverflow.com/q/24116994
tags question: http://stackoverflow.com/q/24228566
tags question: http://stackoverflow.com/q/24183530
tags question: http://stackoverflow.com/q/24108998
tags question: http://stackoverflow.com/q/24222204
tags question: http://stackoverflow.com/q/24222206
tags question: http://stackoverflow.com/q/24169816
tags question: http://stackoverflow.com/q/24203985
tags question: http://stackoverflow.com/q/24176447
tags question: http://stackoverflow.com/q/24132482
tags question: http://stackoverflow.com/q/24231903
tags question: http://stackoverflow.com/q/24133456
tags question: http://stackoverflow.com/q/24243969
tags question: http://stackoverflow.com/q/24251604
tags question: http://stackoverflow.com/q/24216075
tags question: http://stackoverflow.com/q/24162927
tags question: http://stackoverflow.com/q/24248714
tags question: http://stackoverflow.com/q/24169021
tags question: http://stackoverflow.com/q/24138664
tags question: http://stackoverflow.com/q/24126810
tags question: http://stackoverflow.com/q/24235022
tags question: http://stackoverflow.com/q/24159266
tags question: http://stackoverflow.com/q/24196764
tags question: http://stackoverflow.com/q/24262474
tags question: http://stackoverflow.com/q/24175752
tags question: http://stackoverflow.com/q/24109639
tags question: http://stackoverflow.com/q/24149034
tags question: http://stackoverflow.com/q/24245043
tags question: http://stackoverflow.com/q/24242801
tags question: http://stackoverflow.com/q/24263302
tags question: http://stackoverflow.com/q/24122771
tags question: http://stackoverflow.com/q/24182965
tags question: http://stackoverflow.com/q/24167337
tags question: http://stackoverflow.com/q/24132514
tags question: http://stackoverflow.com/q/24114853
tags question: http://stackoverflow.com/q/24131435
tags question: http://stackoverflow.com/q/24154917
tags question: http://stackoverflow.com/q/24231480
tags question: http://stackoverflow.com/q/24231130
tags question: http://stackoverflow.com/q/24129500
tags question: http://stackoverflow.com/q/24264062
tags question: http://stackoverflow.com/q/24158190
tags question: http://stackoverflow.com/q/24241360
tags question: http://stackoverflow.com/q/24219248
tags question: http://stackoverflow.com/q/24185921
tags question: http://stackoverflow.com/q/24241395
tags question: http://stackoverflow.com/q/24246143
tags question: http://stackoverflow.com/q/24176749
tags question: http://stackoverflow.com/q/24225882
tags question: http://stackoverflow.com/q/24150314
tags question: http://stackoverflow.com/q/24266681
tags question: http://stackoverflow.com/q/24108317
tags question: http://stackoverflow.com/q/24108356
tags question: http://stackoverflow.com/q/24119225
tags question: http://stackoverflow.com/q/24177059
tags question: http://stackoverflow.com/q/24195364
tags question: http://stackoverflow.com/q/24219495
tags question: http://stackoverflow.com/q/24204628
tags question: http://stackoverflow.com/q/24194255
tags question: http://stackoverflow.com/q/24233436
tags question: http://stackoverflow.com/q/24148776
tags question: http://stackoverflow.com/q/24205017
tags question: http://stackoverflow.com/q/24132141
tags question: http://stackoverflow.com/q/24209202
tags question: http://stackoverflow.com/q/24144815
tags question: http://stackoverflow.com/q/24253282
tags question: http://stackoverflow.com/q/24237705
tags question: http://stackoverflow.com/q/24127902
tags question: http://stackoverflow.com/q/24128318

http://stackoverflow.com/comment/37354675
type: QuestionComment
has text: Are you sure it's not outside of the `while` loop?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24196094

http://stackoverflow.com/comment/37371015
comment on: http://stackoverflow.com/q/24204694
score: 0
type: Comment
type: QuestionComment
has text: private View tabIndicator1 , tabIndicator2 , tabIndicator3 , tabIndicator4;

http://stackoverflow.com/q/24247550
has answer: http://stackoverflow.com/a/24247651
tagged with: casting
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24247589
answer count: 6
has answer: http://stackoverflow.com/a/24247683
has answer: http://stackoverflow.com/a/42718340
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/24247676
downvote count: 0
tagged with: java
has title: Cast an object dynamically in Java?
has answer: http://stackoverflow.com/a/24247838
favorite count: 0
has body: I have an abstract class Entity with several subclasses: SubclassA, SubclassB, and SubclassA has a subclass SubSubClass. I also have an object someObject of class SomeClass that looks like this: class SomeClass{ void doSomething(Entity e){..} void doSomething(SubclassA e){..} void doSomething(SubclassB e){..} void doSomething(SubSubClass e){..} } I have a List&lt;Entity&gt; list. Every item in this list is passed into someObject.doSomething. for(Entity entity : list){ someObject.doSomething(entity); } Thing is, doSomething(Entity e) is always invoked, no matter what the actual type of the current Entity is, because the reference type is always Entity. To fix this, I need to do casting, like: someObject.doSomething((SubclassB)entity). So I was wondering if there's a way to cast an object dynamically to whatever concrete type it is, without instanceof operations. If there is no way to do this, how would you deal with my situation?
type: Question

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

http://stackoverflow.com/comment/130019549
has text: The only thing that helped is to move the .java file to src folder.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/50087008

http://stackoverflow.com/q/24164701
type: AnsweredQuestion
tagged with: java
tagged with: snmp4j
accepted answer: http://stackoverflow.com/a/24447277
score: 1
favorite count: 0
tagged with: snmp
type: Question
answer count: 2
has body: I'm getting Message processing model 3 returned error: Unknown security name error while running get/getNext command for single device. I'm hitting the device every 2 seconds. In order to have better performance, if I want get the different tables. I create thread and access each thread parallely from my application. When I access the device in single threaded mode all request works fine. However when I run it in multi-thread mode I get above error intermittently(2 fails in 10 request). Here is the stack trace. 2014-06-11 11:26:10,371 [http-8080-6] INFO com.kp.SnmpV3Connection - User Target: Security level is: 3Security Name is: user7 2014-06-11 11:26:10,371 [http-8080-3] INFO com.kp.SnmpV3Connection - User Target: Security level is: 3Security Name is: user7 2014-06-11 11:26:10,373 [http-8080-6] DEBUG org.snmp4j.security.UsmUserTable - Adding user user7 = UsmUser[secName=user7,authProtocol=1.3.6.1.6.3.10.1.1.3,authPassphrase=kp-pass,privProtocol=1.3.6.1.6.3.10.1.2.4,privPassphrase=kp-pass,localizationEngineID=null] 2014-06-11 11:26:10,373 [http-8080-6] DEBUG org.snmp4j.security.UsmUserTable - Adding user user7 = UsmUser[secName=user7,authProtocol=1.3.6.1.6.3.10.1.1.3,authPassphrase=kp-pass,privProtocol=1.3.6.1.6.3.10.1.2.4,privPassphrase=kp-pass,localizationEngineID=null] 2014-06-11 11:26:10,374 [http-8080-6] DEBUG org.snmp4j.security.USM - Security name not found for engineID=, securityName=75:73:65:72:37 2014-06-11 11:26:10,374 [http-8080-6] DEBUG org.snmp4j.security.USM - Security name not found for engineID=, securityName=75:73:65:72:37 2014-06-11 11:26:10,376 [http-8080-6] ERROR org.snmp4j.util.TableUtils - org.snmp4j.MessageException: Message processing model 3 returned error: Unknown security name 2014-06-11 11:26:10,376 [http-8080-6] ERROR org.snmp4j.util.TableUtils - org.snmp4j.MessageException: Message processing model 3 returned error: Unknown security name As per the link given here I'm using the below security model: USM usm = new USM(SecurityProtocols.…
downvote count: 0
possible better answer: http://stackoverflow.com/a/71136850
upvote count: 1
has answer: http://stackoverflow.com/a/71136850
has title: Message processing model 3 returned error: Unknown security name
has answer: http://stackoverflow.com/a/24447277

http://stackoverflow.com/a/24108595
type: Answer
answers question: http://stackoverflow.com/q/24108391
score: 0
has body: Any collection that uses the 'Hash' prefix has all objects contained within the collection stored in groups by their hashcode. So when you call a method like contains() the collection loops through each hashcode group and checks whether the hashcode of the object you parsed in matches the group. When a match is found, the objects within that hashcode group are checked using the equals() method of the stored object until an Object's equals() method returns true. If you do not override the hashcode() method, then each Object subclass is given a more or less unique hashcode by the Object class implementation of the hashcode() method. This can cause some problems if you have already overridden the equals() method, because if two objects are considered equal the contains() method might still not find it if the hashcodes do not match. The hashcode contract: When implementing hashcode() the Java Object API has laid out a contract or a set of specifications on how you should implement the hashcode method. And they are; If hashcode() is run on an object multiple times, it must always return the same number. If two objects are considered equal by the equals() method then their hashcode() methods must return the same value. If two objects have the same hashcode, they do not have to be considered equal by their equals() methods. References: The hashcode contract. Implementing hashcode.

http://stackoverflow.com/comment/37323188
type: AnswerComment
has text: Googling your error message leads me to assume that you are using Java 8? There seems to be a FindBugs bug with Java 8. Try compiling with Java 7.
score: 1
comment on: http://stackoverflow.com/a/24168035
type: Comment

message-queue
type: Tag
tags question: http://stackoverflow.com/q/24190090
tag name: message-queue

http://stackoverflow.com/comment/69298908
type: Comment
has text: For message types, I use the postfix 'Request' for requests, 'Result' for replies, and 'Op' for executions that do not trigger a reply. For example: `createRequest`, `createReply`, `endConnectionOp`.
comment on: http://stackoverflow.com/a/26707554
type: AnswerComment
score: 1

http://stackoverflow.com/comment/37185828
has text: Awesome! Thanks! My mistake. With total.toString() it worked!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24106117
type: Comment

http://stackoverflow.com/a/24248758
answers question: http://stackoverflow.com/q/24243747
upvote count: 2
downvote count: 0
has body: Union operation for Quick Find is quadratic O(n^2) for n operations, because each operation takes O(n) time, as is easy to notice in for loop inside union(int p, int q) for (int i=0; i&lt;id.length; i++) Notice that the algorithm is called Quick Find, as each find (connected(int p, int q)) operation takes constant time. However for this algorithm you end up paying in union operation, as mentioned in your question. There is another algorithm Quick Union, which improves time for union operation. But then find doesn't remain O(1) (but better than linear time).
score: 2
type: Answer

http://stackoverflow.com/comment/81469876
type: Comment
score: 0
type: AnswerComment
has text: @deFreitas, refer to other answers on RSA case. This one only complements them on EC case.
comment on: http://stackoverflow.com/a/46774188

http://stackoverflow.com/a/24136550
upvote count: 1
answers question: http://stackoverflow.com/q/24136493
score: 1
has body: I don't see you adding the widgets to the JFrame, so why should they appear? frame.add(textarea); frame.add(field);
downvote count: 0
type: Answer

http://stackoverflow.com/a/24111748
has comment: http://stackoverflow.com/comment/37196910
has comment: http://stackoverflow.com/comment/37196989
type: Answer
has comment: http://stackoverflow.com/comment/37197321
has comment: http://stackoverflow.com/comment/37196764
has comment: http://stackoverflow.com/comment/37196868
accepted answer of: http://stackoverflow.com/q/24111714
score: 7
has comment: http://stackoverflow.com/comment/37197417
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37196931
has body: The method is returning as soon as it hits count 0 and it doesn't find a match. If you want to loop through your array until you find a matching name, your code should look like this: public boolean checkingObjectName(String checkName) { for (int i=0; i&lt;count; i++) //where 'count' has a value of 3 { if (product[i].getName().equals(checkName)) //where product[i] has been initialised { return true; } } return false; }
downvote count: 0
has comment: http://stackoverflow.com/comment/37197546
answers question: http://stackoverflow.com/q/24111714
upvote count: 7

http://stackoverflow.com/q/24113939
has answer: http://stackoverflow.com/a/35700230
favorite count: 0
has answer: http://stackoverflow.com/a/56468392
has answer: http://stackoverflow.com/a/24114612
tagged with: debugging
tagged with: spring-boot
has answer: http://stackoverflow.com/a/24179812
has answer: http://stackoverflow.com/a/35244846
linked to: http://stackoverflow.com/q/21794633
type: Question
has answer: http://stackoverflow.com/a/40909515
has answer: http://stackoverflow.com/a/39621993
has title: How to debug Spring Boot application with Eclipse?
tagged with: java
has answer: http://stackoverflow.com/a/24115804
has answer: http://stackoverflow.com/a/36822369
tagged with: spring
tagged with: eclipse
has answer: http://stackoverflow.com/a/55089095
has answer: http://stackoverflow.com/a/50448680
possible better answer: http://stackoverflow.com/a/24179812
has answer: http://stackoverflow.com/a/78548494
has comment: http://stackoverflow.com/comment/89258567
has answer: http://stackoverflow.com/a/75987678
answer count: 15
score: 120
upvote count: 120
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27924073
has answer: http://stackoverflow.com/a/52350409
downvote count: 0
accepted answer: http://stackoverflow.com/a/24114612
has body: My Spring Boot webapp is running just fine, and I'd like to debug it through Eclipse. So when launching my Remote Java Application debugger, which port should I listen to? And is there a setting on my webapp I have to set to enable debugging?

http://stackoverflow.com/comment/37371730
comment on: http://stackoverflow.com/a/24205188
score: 0
type: AnswerComment
has text: but how do i copy them to a new Cell?
type: Comment

http://stackoverflow.com/a/24232759
upvote count: 13
downvote count: 0
score: 13
has body: You can have composite interfaces, for example from the io package : http://golang.org/src/pkg/io/io.go?s=2987:3047#L57 type Reader interface { Read(p []byte) (n int, err error) } type Writer interface { Write(p []byte) (n int, err error) } type ReadWriter interface { Reader Writer } As a side note, don't try to implement java code using go, try to learn the Go Way.
answers question: http://stackoverflow.com/q/24232513
has comment: http://stackoverflow.com/comment/37427648
type: Answer
has comment: http://stackoverflow.com/comment/37425099

http://stackoverflow.com/comment/37468182
type: Comment
comment on: http://stackoverflow.com/q/24254487
has text: When hitting Run (the green triangle at the top)
score: 0
type: QuestionComment

http://stackoverflow.com/a/24115952
downvote count: 0
has comment: http://stackoverflow.com/comment/37204067
answers question: http://stackoverflow.com/q/24115745
upvote count: 1
has comment: http://stackoverflow.com/comment/37213933
has body: My Samsung is an honest piece of.... er, brick, considering it doesn't even properly connect to USB anymore. Beforehand, when it didn't think it's charging when it isn't, and think that my computer is a car dock; I had to manually link it to the PC so that it would be detected. The way you do that is by downloading the drivers, specifically this one: http://forum.xda-developers.com/showthread.php?t=2645355 What also helped was installing these drivers using the command 'pnputil -i -a filename.inf' http://forum.xda-developers.com/showthread.php?t=1514942 And what you need to do is, restart your computer, then when you plug the device in, it will detect it as an UNKNOWN DEVICE because Samsung Drivers are terrible. When this happens, go to Control Panel -> Device Manager -> Other Devices -> Unknown Device -> Update Driver Software -> Browse my computer -> Let me pick from a list -> See all drivers -> Samsung -> select the one for usb phones. That should fix the problem. KIES never helps.
has comment: http://stackoverflow.com/comment/37214213
has comment: http://stackoverflow.com/comment/37214261
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37213327

http://stackoverflow.com/q/24123621
score: 0
tagged with: oop
has title: Field is declared as private but I'm able to access directly
tagged with: inner-classes
tagged with: java
has body: I have a class Foo which extends Dialog (SWT). I defined a data-member private Bazz bazz Within this class I defined a method called GetOkListener() which basically returns an SelectionListener object. Within the method public void widgetSelected(SelectionEvent arg0) I am accessing to bazz like this: Foo.this.bazz. My question is, How is it possible? bazz defined as private. This class is within Foo extends Dialog @Override protected SelectionListener GetOkListener() { return new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { System.out.println(CreateAlbumDialog.this.album); } public void widgetDefaultSelected(SelectionEvent arg0) { // TODO Auto-generated method stub } }; }
possible better answer: http://stackoverflow.com/a/24123752
has comment: http://stackoverflow.com/comment/37218364
has answer: http://stackoverflow.com/a/24123752
has comment: http://stackoverflow.com/comment/37218161
type: Question
has comment: http://stackoverflow.com/comment/37218243
has answer: http://stackoverflow.com/a/24123720
tagged with: anonymous-inner-class
accepted answer: http://stackoverflow.com/a/24123722
has answer: http://stackoverflow.com/a/24123722
has answer: http://stackoverflow.com/a/24123728
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/24138371
type: Question
has answer: http://stackoverflow.com/a/24138717
score: 5
accepted answer: http://stackoverflow.com/a/24138416
has answer: http://stackoverflow.com/a/24138459
possible better answer: http://stackoverflow.com/a/24138459
upvote count: 5
has title: How to find if a string contains "ONLY" Special characters in java
has body: Suppose I define a String as: String splChrs = "/-@#$%^&amp;_-+=()" ; String inputString = getInputString(); //gets a String from end the user I want to check if String "inputString" contains ONLY special characters contained in String "splChrs" i.e. I want to set a boolean flag as true if inputString contained only characters present in "splChrs" eg: String inputString = "#######@"; //set boolean flag=true And boolean flag is set as false if it contained any letters that did not contain in "splChrs" eg: String inputString = "######abc"; //set boolean flag=false
tagged with: regex
tagged with: special-characters
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/24138416
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37245839
favorite count: 0

http://stackoverflow.com/q/24200123
has comment: http://stackoverflow.com/comment/37362340
type: Question
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37362172
answer count: 1
has comment: http://stackoverflow.com/comment/37362436
has answer: http://stackoverflow.com/a/24205238
score: 0
tagged with: java
tagged with: hibernate
has body: There are many solutions are present in Stack Overflow but none of them helps me. The problem is I have a table and corresponding to that table I have a POJO class for Hibernate. Reverse Engineering is off in hbm.xml file. Scenario is like this: For example: Table A column (a,b,c,d) Corresponding this table a POJO A with property a,b,c. I didn't map 'd' yet. Till here it's working fine. Now after some time I also want 'd' in my mapping class so I added 'd' with setters and getters but now when I am deploying my application it's throwing following exception. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [db.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: RewardCondition column: created (should be mapped with insert="false" update="false") at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at o For more info: There is no foreign key associated with 'created' column and I am using annotations for mapping. Edit: I added this code in my previously working POJO @column(name="created") private Date created; public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; }
has comment: http://stackoverflow.com/comment/37364303
has title: org.hibernate.MappingException throwing by program

http://stackoverflow.com/q/24155966
has answer: http://stackoverflow.com/a/24157813
has comment: http://stackoverflow.com/comment/37279263
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37279187
has comment: http://stackoverflow.com/comment/37279144
type: Question
has answer: http://stackoverflow.com/a/24156056
answer count: 2
tagged with: resteasy
has title: 415 (Unsupported Media Type) error while trying to make a JSON call
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37279009
has comment: http://stackoverflow.com/comment/37279504
tagged with: javascript
tagged with: spring
has comment: http://stackoverflow.com/comment/37281890
has body: I get this error while I am making a rest call. GET localhost:8082/abc/rest/hello/world 415 (Unsupported Media Type) jquery- 1.11.0.min.js:4 n.ajaxTransport.send jquery-1.11.0.min.js:4 n.extend.ajax jquery-1.11.0.min.js:4 n.each.n.(anonymous function) jquery-1.11.0.min.js:4 n.extend.getJSON jquery-1.11.0.min.js:4 getExcelOutput utility.js:6 (anonymous function) This is my javascript function(#showdata is id of div where I will display String data): function getExcelOutput() { $.getJSON("/abc/rest/hello/world", function(data) { $('#showdata').html(" item1="+data.val()+" "); }); } And this is the java code which calls for the service (another java code) @RequestScoped public class ABCServiceImpl implements BasicService { @GET @Path("/hello/{name}") @Produces(MediaType.APPLICATION_JSON) public String hello(@PathParam("name") String name) { return generateProxy().hello(name); } private BasicService generateProxy() { return ProxyFactory.create(BasicService.class, "http://localhost:9090/service/lesson1/"); } } Service side code function: @GET @Path("hello/{name}") @Produces(MediaType.APPLICATION_JSON) public String hello(String name) { return "Hello " + name + excelReader.excelReading(); }
has comment: http://stackoverflow.com/comment/37280500

http://stackoverflow.com/comment/37369735
type: Comment
comment on: http://stackoverflow.com/a/24201035
score: 0
type: AnswerComment
has text: That post uses the SimpleDateTimeFormat which is actually a conversion from Date to String and vice versa. I just don't understand why date/time conversion are done by converting Date to String and then back to Date again.

http://stackoverflow.com/a/24260617
type: Answer
has comment: http://stackoverflow.com/comment/37480482
has comment: http://stackoverflow.com/comment/37482198
has comment: http://stackoverflow.com/comment/37482245
has body: In a java application there is a distinction between file system File and resource (on the class path, inside the .jar). If the image is part of the application, and fixed, read-only, as your relative path suggests, use a resource. However then the image must be inside the jar. Maybe: /src/assets/img/myImage.jpg or make /assets a top source directory too. Then /img/myImage.jpg (or in the first case /assets/img/myImage.jpg) Programmatically one does not use File but URL getClass().getResource("/img/myImage.jpg") or getResourceAsStream.
upvote count: 2
has comment: http://stackoverflow.com/comment/37482001
downvote count: 0
has comment: http://stackoverflow.com/comment/37481706
answers question: http://stackoverflow.com/q/24260019
has comment: http://stackoverflow.com/comment/37481819
score: 2
has comment: http://stackoverflow.com/comment/37481649

http://stackoverflow.com/a/24264732
has comment: http://stackoverflow.com/comment/37519222
has body: Application.requestUserAttention works for me in an e4 application (Eclipse 4.3.2 on Mac 10.9.3 with Java 1.8 update 5). Note: It only does something if the application is not the focused app. With the false parameter there is only one bounce, specify true to make it bounce until the app has focus. Update: You can also do this using the SWT Mac specific classes, like this: private static final long sel_requestUserAttention_ = OS.sel_registerName("requestUserAttention:"); private static final int NSCriticalRequest = 0; private static final int NSInformationalRequest = 10; ... NSApplication app = NSApplication.sharedApplication(); OS.objc_msgSend(app.id, sel_requestUserAttention_, NSInformationalRequest); Use NSInformationalRequest for a single bounce, NSCriticalRequest to bounce until the app receive focus. Since this is Mac only SWT code you will have to put it in a plugin or fragment with a platform filter in the MANIFEST.MF such as: Eclipse-PlatformFilter: (&amp; (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=x86_64) ) Update: The above code is for 64 bit SWT on Mac OSX, for 32 bit SWT use private static final int sel_requestUserAttention_ = OS.sel_registerName("requestUserAttention:");
score: 1
accepted answer of: http://stackoverflow.com/q/24263920
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37513673
upvote count: 1
has comment: http://stackoverflow.com/comment/37514522
has comment: http://stackoverflow.com/comment/37514059
has comment: http://stackoverflow.com/comment/37513899
type: Answer
has comment: http://stackoverflow.com/comment/37517204
has comment: http://stackoverflow.com/comment/37510662
has comment: http://stackoverflow.com/comment/37513777
answers question: http://stackoverflow.com/q/24263920

http://stackoverflow.com/q/24147313
answer count: 0
has comment: http://stackoverflow.com/comment/37264651
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37262757
type: Question
has comment: http://stackoverflow.com/comment/37262797
has comment: http://stackoverflow.com/comment/37263387
type: UnansweredQuestion
tagged with: intellij-idea
has body: I have a bunch of auto-generated code and I need to rename the fields so they are start with a lowercase letter. The best I can do so far is use shift+F6 to do a rename refactoring one at a time. There are about 30 classes though, so this manual process is too time consuming. Is there a way to have Intellij run this refactoring against all the fields in classes within a given package? Here is an example class that needs refactoring: public class User { private String Name; } The desired result is: public class User { private String name; }
has title: Can I auto-rename all of the fields in a package using Intellij IDEA?
has comment: http://stackoverflow.com/comment/37262885
has comment: http://stackoverflow.com/comment/37262919

http://stackoverflow.com/q/24109077
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
has body: i am having trouble with preferences. I am trying to save the high score using libgdx on to the phone. It works WHEN THE APP IS RUNNING, but when i close the app the high score is not saved! if(currentScore &gt; highscore){ highscore = currentScore; prefs.putInteger("score", highscore); getHighScore =prefs.getInteger("highscore", highscore); highScore = ("high score: " + getHighScore); prefs.flush(); } I don't know why it is not saving the highscore. Any help would be appreceiated. thanks in advance
type: AnsweredQuestion
tagged with: preferences
tagged with: libgdx
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24118649
has title: I am having trouble using preferences with libgdx. not saving high score?
has comment: http://stackoverflow.com/comment/37193649
type: Question
has comment: http://stackoverflow.com/comment/37192416
has comment: http://stackoverflow.com/comment/37197186
accepted answer: http://stackoverflow.com/a/24118649
score: 1
tagged with: save
has comment: http://stackoverflow.com/comment/37194769

methods
tags question: http://stackoverflow.com/q/24116097
tags question: http://stackoverflow.com/q/24255017
tags question: http://stackoverflow.com/q/24210905
tags question: http://stackoverflow.com/q/24191195
tags question: http://stackoverflow.com/q/24106538
tag name: methods
tags question: http://stackoverflow.com/q/24121793
tags question: http://stackoverflow.com/q/24160595
tags question: http://stackoverflow.com/q/24104998
tags question: http://stackoverflow.com/q/24234728
tags question: http://stackoverflow.com/q/24240737
tags question: http://stackoverflow.com/q/24109562
tags question: http://stackoverflow.com/q/24114880
tags question: http://stackoverflow.com/q/24196631
type: Tag
tags question: http://stackoverflow.com/q/24131263
tags question: http://stackoverflow.com/q/24218996
tags question: http://stackoverflow.com/q/24111714
tags question: http://stackoverflow.com/q/24255331
tags question: http://stackoverflow.com/q/24113170
tags question: http://stackoverflow.com/q/24229419
tags question: http://stackoverflow.com/q/24206085
tags question: http://stackoverflow.com/q/24109376
tags question: http://stackoverflow.com/q/24107176

http://stackoverflow.com/comment/37202408
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24114853
has text: only network/database operations will be running in background thread and screen reloading/refreshing will be done in UI thread itself

http://stackoverflow.com/comment/37240785
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24121921
has text: I've logged a ticket on ASF JIRA [LOG4J2-665](https://issues.apache.org/jira/browse/LOG4J2-665).
score: 0

http://stackoverflow.com/q/24235099
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/34383147
tagged with: proxy
possible better answer: http://stackoverflow.com/a/26142243
has comment: http://stackoverflow.com/comment/43248257
has answer: http://stackoverflow.com/a/26142243
has title: Setting remote ip and port in littleproxy
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/34383147
linked to: http://stackoverflow.com/q/27039042
has comment: http://stackoverflow.com/comment/40819544
score: 1
tagged with: little-proxy
tagged with: java
has comment: http://stackoverflow.com/comment/39656150
downvote count: 0
has body: In littleProxy, how can I set the remote ip and port? The sample in their website : HttpProxyServer server = DefaultHttpProxyServer.bootstrap() .withPort(8080) .start(); only sets the local port.

http://stackoverflow.com/q/24175752
type: Question
has comment: http://stackoverflow.com/comment/37316525
has answer: http://stackoverflow.com/a/24175893
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/37316594
upvote count: 1
has body: I'm having trouble when it will submit the data, there was a problem android.os.NetworkOnMainThreadException. Please help me solve this problem. The following source daftar_nama_lokasi.java: package geotracker.lokasi; public class daftar_nama_lokasi extends Activity{ private LocationManager lm; private LocationListener locationListener; private EditText lat; private EditText lon; private EditText nama_lokasi; private EditText alamat_lokasi; private EditText kode; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.daftar_nama_lokasi); lat = (EditText) findViewById(R.id.latitude); lon = (EditText) findViewById(R.id.longitude); nama_lokasi = (EditText) findViewById(R.id.nama_lokasi); alamat_lokasi = (EditText) findViewById(R.id.alamat_lokasi); kode = (EditText) findViewById(R.id.imei); lat.setEnabled(false); lon.setEnabled(false); kode.setEnabled(false); TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); // mendapatkan nomor imei dan menyimpanya dalam variabel String imei = telephonyManager.getDeviceId(); EditText IMEI = (EditText)findViewById(R.id.imei); // menampilkan nomor imei pada EditView yang sudah di buat IMEI.setText(imei); // ---use the LocationManager class to obtain GPS locations--- lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationListener = new MyLocationListener(); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); Button btnSimpan = (Button) findViewById(R.id.btnsimpan); btnSimpan.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { JSONObject json = new JSONObject(); String hasil = ""; try { json.put("lat", lat.getText()); json.put("lon", lon.getText()); json.put("location_name", nama_lokasi.getText()); json.put("address", alamat_lokasi.getText()); json.put("imei", kode.getText()); koneksi_internet kn = new koneksi_internet(); hasil = kn.postData(json,"nama_lokasi…
tagged with: java
has title: Code runs successfully on gingerbird but jelly bean error: android.os.NetworkOnMainThreadException
answer count: 1
downvote count: 0
score: 1
tagged with: eclipse
linked to: http://stackoverflow.com/q/6343166
favorite count: 0

http://stackoverflow.com/comment/37261975
has text: Change `double currentKey = (double) it.next();` to `double currentKey = pairs.getKey();`. Also, where is your addition of all the values; Have you read the [MultiMap documentation](https://commons.apache.org/proper/commons-collections/javadocs/api-3.2.1/org/apache/commons/collections/MultiMap.html)? Also, why do you need a `MultiMap` for the second `Map`?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24146692
type: Comment

http://stackoverflow.com/comment/37227878
score: 0
comment on: http://stackoverflow.com/q/24128353
type: Comment
type: QuestionComment
has text: Where is the declaration of your variable `file`?

http://stackoverflow.com/a/24154159
has comment: http://stackoverflow.com/comment/37276021
has body: By exclude a bean in parent, you want it to not be initialized in the child context or you need it to be overwritten in the child context with something else? If it is the former, you can implement a org.springframework.beans.factory.config.BeanFactoryPostProcessor, look up the bean definition and set lazy-init to true on that one. If it is the latter, you can implement a org.springframework.beans.factory.config.BeanPostProcessor to mute the effect of the parent bean by proxying it to a no-op class. Another (non-deterministic) way of achieving this might be to name the child bean exactly the same as the parent one and then check the logs to confirm that the child bean definition has overwritten the parent one - however, this is prone to error when you move around context imports. Deterministic ordering of beans in spring is tracked in SPR-3948
has comment: http://stackoverflow.com/comment/37275982
has comment: http://stackoverflow.com/comment/37275954
has comment: http://stackoverflow.com/comment/37275994
answers question: http://stackoverflow.com/q/24153546
score: 0
type: Answer

http://stackoverflow.com/a/24105514
has body: You are calling the wrong constructor while creating the FileWriter. Rewrite it to: new FileWriter(sFileName, true); That should preserve your data. Here is a direct link to the documentation.
type: Answer
answers question: http://stackoverflow.com/q/24105371
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37189774
accepted answer of: http://stackoverflow.com/q/24105371

http://stackoverflow.com/comment/37338930
type: Comment
type: QuestionComment
has text: @Andrew , No I am starting server program in one console, and the one client in another console
score: 0
comment on: http://stackoverflow.com/q/24188066

http://stackoverflow.com/comment/37368594
comment on: http://stackoverflow.com/a/24201035
type: Comment
has text: take a look a 3er answ. great. http://stackoverflow.com/questions/308683/how-can-i-get-the-current-date-and-time-in-utc-or-gmt-in-java
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37285290
comment on: http://stackoverflow.com/q/24159306
type: QuestionComment
has text: The dependency you have given is definitvley wrong, cause that's the module parent. Check the docs how to use it correctly.
type: Comment
score: 0

http://stackoverflow.com/q/24199873
has answer: http://stackoverflow.com/a/24339339
has body: I'm working on a clojure project that currently uses the latest version of org.clojure/tools.cli and in which I wish to begin using storm. However, as soon as I add [storm "0.9.0.1"] to my dependencies, namespaces which were using the parse-opts function fail to compile. My snooping around has led me to the conclusion that storm is requiring an older version of tools.cli (0.2.x) in a somewhat hidden manner not visible/controllable by leiningen. The funny thing is using lein deps :tree does not reveal this dependency, nor does it reveal any warnings about it; adding [storm "0.9.1" :exclusions [org.clojure/tools.cli]] does not seem to fix the problem. Looking at the storm github repo, it appears that the tools.cli specification is in a pom.xml file. I have confirmed that forking storm, updating this dependency and using this fork via lein-git-deps fixes the problem. However, it's fairly frustrating to have to this. Is there a way around this? Is there some bug here? Leiningen doesn't document this feature particularly well, at least as far as I've been able to find.
type: UnansweredQuestion
score: 0
tagged with: java
answer count: 1
tagged with: dependencies
tagged with: leiningen
has title: Can leiningen see/control dependencies of Java pom.xml dependencies?
tagged with: apache-storm
tagged with: clojure
type: Question

http://stackoverflow.com/comment/48728193
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24163230
score: 0
has text: Are you removing stopwords?

http://stackoverflow.com/q/24153827
downvote count: 0
accepted answer: http://stackoverflow.com/a/24168984
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24168984
has title: JAX-RS MessageBodyReader
tagged with: java
has body: I'm learning how the MessageBodyReader method works from the providers. I see the method returns an object and I'm not sure how to access the object from a service. Could I get an explanation on how to get the object returned from the reader class? This would help me apply a reading rule for all DTOs. Thanks in advance! Service: @POST @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Path("/CreateAccount") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response createAccount(@Context HttpServletRequest req) { String a = "Reader success? ";//Would to see that string here! return Response.ok().build(); } Provider: @Provider public class readerClass implements MessageBodyReader<Object> { @Override public boolean isReadable(Class<?> paramClass, Type paramType, Annotation[] paramArrayOfAnnotation, MediaType paramMediaType) { // TODO Auto-generated method stub return true; } @Override public Object readFrom(Class<Object> paramClass, Type paramType, Annotation[] paramArrayOfAnnotation, MediaType paramMediaType, MultivaluedMap<String, String> paramMultivaluedMap, InputStream paramInputStream) throws IOException, WebApplicationException { // TODO Auto-generated method stub return "Successfully read from a providers reader method"; } }
tagged with: jax-rs
favorite count: 0
type: Question
upvote count: 5
answer count: 1
score: 5

http://stackoverflow.com/q/24242137
upvote count: 7
tagged with: log4j
tagged with: log4j2
favorite count: 0
has body: I have created a JDBC appender and bind the ColumnConfig and DataSourceConnectionSource . while trying to insert record in the DB (Logger.debug("Test")).I am getting below exception. Thanks [6/16/14 18:44:58:647 GMT-08:00] 00000024 SystemErr R ERROR StatusLogger An exception occurred processing Appender JDBCAppender org.apache.logging.log4j.core.appender.AppenderLoggingException: Failed to insert record for log event in JDBC manager: DSRA1300E: Feature is not implemented: PreparedStatement.setNString at org.apache.logging.log4j.core.appender.db.jdbc.JDBCDatabaseManager.writeInternal(JDBCDatabaseManager.java:117) at org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager.write(AbstractDatabaseManager.java:159) at org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender.append(AbstractDatabaseAppender.java:103) at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97) at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:425) at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:406) at org.apache.logging.log4j.core.Logger$PrivateConfig.logEvent(Logger.java:275) at org.apache.logging.log4j.core.async.AsyncLogger.actualAsyncLog(AsyncLogger.java:289) at org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:99) at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:43) at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:28) at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:133) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919) at java.lang.Thread.run(Thread.java:736) Caused by: java.sql.SQLFeatureNotSupportedException: DSRA1300E: Feature is not implemented: PreparedStatement.setNString at com.ib…
type: Question
tagged with: jdbc
tagged with: logging
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24259538
accepted answer: http://stackoverflow.com/a/24259538
score: 7
tagged with: java
has title: log4j2 JDBC Appender Issue:Failed to Insert Record
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24248142
upvote count: 4
downvote count: 0
has body: Assume SpringFactoriesLoader is for you. From its JavaDocs: /* * General purpose factory loading mechanism for internal use within the framework. * * The {@code SpringFactoriesLoader} loads and instantiates factories of a given type * from "META-INF/spring.factories" files. The file should be in {@link Properties} format, * where the key is the fully qualified interface or abstract class name, and the value * is a comma-separated list of implementation class names. For instance: * * example.MyService=example.MyServiceImpl1,example.MyServiceImpl2 * * where {@code MyService} is the name of the interface, and {@code MyServiceImpl1} and * {@code MyServiceImpl2} are the two implementations. */ The sample from one of our project: META-INF/spring.factories: org.springframework.integration.config.IntegrationConfigurationInitializer=\ org.springframework.integration.config.GlobalChannelInterceptorInitializer,\ org.springframework.integration.config.IntegrationConverterInitializer The implementation: public class IntegrationConfigurationBeanFactoryPostProcessor implements BeanFactoryPostProcessor { @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { Set<String> initializerNames = new HashSet<String>( SpringFactoriesLoader.loadFactoryNames(IntegrationConfigurationInitializer.class, beanFactory.getBeanClassLoader())); for (String initializerName : initializerNames) { try { Class<?> instanceClass = ClassUtils.forName(initializerName, beanFactory.getBeanClassLoader()); Assert.isAssignable(IntegrationConfigurationInitializer.class, instanceClass); IntegrationConfigurationInitializer instance = (IntegrationConfigurationInitializer) instanceClass.newInstance(); instance.initialize(beanFactory); } catch (Exception e) { throw new IllegalArgumentException("Cannot instantiate 'IntegrationConfigurationInitializer': " + initializerName, e); } } } }
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24248025

http://stackoverflow.com/q/24219343
tagged with: sql
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25265439
has title: Using batch insert on related tables in SQL
tagged with: mysql
linked to: http://stackoverflow.com/q/12977568
has comment: http://stackoverflow.com/comment/37564807
has comment: http://stackoverflow.com/comment/37403075
tagged with: java
has body: I have two MySQL tables, Persons and Addresses. In Persons table there is column id_address which is foreign key for Addresses column with same name. Column id_address in Addresses has AUTO_INCREMENTed value. So when I want to insert new person, I insert address which sets LAST_INSERT_ID() to new value, then this last id I use for Persons.id_address. So my question is, is there any option to set batch insert for these two tables, and then insert more rows in one step? I'm using Java with MySQL driver and I need this without ORM framework. EDIT: I found it's not possible, related answer is here: Two different prepared statements in one single batch
type: Question
tagged with: batch-insert
score: 0

http://stackoverflow.com/comment/37404459
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24220397
has text: There are no Place(), Title(), or Category() methods in your class that you posted here. Do you have these methods in your code?
type: Comment

http://stackoverflow.com/q/24219184
tagged with: icons
has comment: http://stackoverflow.com/comment/37398719
score: 0
tagged with: nullpointerexception
has title: Java Checkers - removing Icon, java.lang.NullPointerException
tagged with: java
has body: I have a problem with checkers, doing jump doesn't work, I have no idea what can I do to this would work, please help or give me some hints :) public class DnD extends JFrame { private JPanel boardPane; Icon z = null; JLabel jlabel = new JLabel(); String k=""; String ballPressed=""; String p=""; public DnD(){ super("Checker"); icdim = new Dimension(greenIcon.getIconWidth() + 5, greenIcon.getIconHeight() + 5); boardPane = new JPanel(); board = new JLabel[8][8]; dragged = new JLabel(); layers = getLayeredPane(); mouseHandler = new MouseInputAdapter() { public void mouseReleased(MouseEvent mouseevent) { JLabel jlabel = (JLabel)mouseevent.getSource(); Point point = jlabel.getLocation(); Point point1 = mouseevent.getPoint(); point.translate(point1.x, point1.y); Component component = boardPane.getComponentAt(point); JLabel jlabel1 = jlabel; if(hasIcon(component)) if(allowedMove(jlabel, component, k)) jlabel1 =(JLabel)component; else try{ if(bicie(jlabel,component,k)) jlabel1 =(JLabel)component; }catch (Exception e) { e.printStackTrace(); } jlabel1.setIcon(dragged.getIcon()); dragged.setVisible(false); } }; boolean jump(JLabel jlabel, Component component) { int x = jlabel.getX(); int y = jlabel.getY(); int x2= component.getX(); int y2= component.getY(); String h=""; if(ballPressed=="redIcon" &amp;&amp; player==true &amp;&amp; y-y2==138 &amp;&amp; x2-x==138){ Point point = new Point(x+69, y-69); JLabel l= (JLabel) jlabel.getComponentAt(point); try{ q=l.getIcon(); h = q.toString(); if(h=="greenIcon"){ player = false; message.setText("Green"); getComponentAt(x2+69, y2+69).setBounds(0,0,0,0); ((JLabel) q).setIcon(null); return true; } }else return false; } For jump I gave small part of code ( just for redIcon in right way) , because I want to be readable. For line q=l.getIcon(); I get java.lang.NullPointerException http://s2.postimg.org/ywdxs56qx/exception.jpg
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/37398581
has answer: http://stackoverflow.com/a/24219274
type: UnansweredQuestion

http://stackoverflow.com/q/24171828
tagged with: bson
has title: Get rid of MongoDB extensions to JSON format
type: Question
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/24171990
has answer: http://stackoverflow.com/a/24171990
has body: When converting BSON to JSON, MongoDB adds the extensions to the JSON format. However, these extensions bother our front-end design a lot. Could someone suggest any Java API which can get rid of these extensions added by MongoDB? For example, here is what MongoDB gives us : {"createdDate" : { "$date" : "2014-01-01T05:00:00.000Z"}} But what we want is : {"createdDate" : "2014-01-01T05:00:00.000Z"} Thanks for the help!!
favorite count: 0
tagged with: mongodb
upvote count: 2
answer count: 1
downvote count: 0

scala
tags question: http://stackoverflow.com/q/24118856
tags question: http://stackoverflow.com/q/24186221
tags question: http://stackoverflow.com/q/24143012
tags question: http://stackoverflow.com/q/24187215
tags question: http://stackoverflow.com/q/24264475
tags question: http://stackoverflow.com/q/24233990
tags question: http://stackoverflow.com/q/24225351
tags question: http://stackoverflow.com/q/24145989
tag name: scala
tags question: http://stackoverflow.com/q/24229272
tags question: http://stackoverflow.com/q/24145858
tags question: http://stackoverflow.com/q/24229442
tags question: http://stackoverflow.com/q/24204907
tags question: http://stackoverflow.com/q/24218945
tags question: http://stackoverflow.com/q/24209606
tags question: http://stackoverflow.com/q/24253224
tags question: http://stackoverflow.com/q/24182376
tags question: http://stackoverflow.com/q/24261109
tags question: http://stackoverflow.com/q/24189485
tags question: http://stackoverflow.com/q/24126222
type: Tag
tags question: http://stackoverflow.com/q/24114327
tags question: http://stackoverflow.com/q/24112599
tags question: http://stackoverflow.com/q/24114990
tags question: http://stackoverflow.com/q/24188916
tags question: http://stackoverflow.com/q/24193354
tags question: http://stackoverflow.com/q/24230447
tags question: http://stackoverflow.com/q/24172323
tags question: http://stackoverflow.com/q/24169881
tags question: http://stackoverflow.com/q/24227037
tags question: http://stackoverflow.com/q/24118639

http://stackoverflow.com/a/24150270
type: Answer
accepted answer of: http://stackoverflow.com/q/24150017
upvote count: 2
score: 2
has body: The idea of JUnit is to do unit testing. I think you should test a specific method that you know what it should do instead of "faking" anything (I understand mocking for faking), for example: import static org.junit.Assert.assertEquals; import org.junit.Test; public class PayrollTesCase { @Test public void testCalculate() { Message m = new Message(new Thing("a", "b", "c", "d", "e")); assertEquals("abcde", m.toString()); } } So, if in the future you change your Message.toString() implementation, you introduced a bug and it returns "cde" then your specific test case will fail. This is the idea behind unit testing. I like this definition: Unit Testing is a level of the software testing process where individual units/components of a software/system are tested. The purpose is to validate that each unit of the software performs as designed. In JUnit 4.x all the methods are annotated. So, the flow of control in JUnit methods can be described as below: @BeforeClass -&gt; @Before -&gt; @Test -&gt; @After -&gt; @AfterClass By the way, you have different degrees of testing, Unit Testing is the "smallest". I'm not sure what you need but maybe you want to do an Integration Test.
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24150017

http://stackoverflow.com/a/24161841
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24159510
accepted answer of: http://stackoverflow.com/q/24159510
has body: Now, there's probably a few ways this might be done, but this is basically what I've come up with... First, I created a custom label, which uses a javax.swing.Timer to progress from a starting alpha value to a target alpha value (ie 0-1 to fade in). To this label, I added a simply waitFor method, which waits until the target value has been reached. This is achieved through a simple object monitor. Very important, NEVER call this method while you're on the Event Dispatching Thread... Next, I created a series of these labels with the text I wanted displayed and added each one to to the output. I then started a separate Thread and iterated the list, fading each label in and using waitFor to wait for it to be displayed... import java.awt.AlphaComposite; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.Icon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class FadingLabels { public static void main(String[] args) { new FadingLabels(); } public FadingLabels() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } final List&lt;FadingLabel&gt; labels = new ArrayList&lt;&gt;(25); labels.add(new FadingLabel("A ")); labels.add(new FadingLabel("long ")); labels.add(new FadingLabel("time ")); labels.add(new FadingLabel("ago ")); labels.add(new FadingLabel("in ")); labels.add(new FadingLabel("a ")); labels.add(new FadingLabel("galaxy ")); labels.add(new FadingLabel("far, ")); labels.add(new FadingLabel("far, ")); labels.ad…
has comment: http://stackoverflow.com/comment/37289428
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/comment/37713494
comment on: http://stackoverflow.com/a/24266432
type: Comment
has text: @devnull "Ninety" does not match because my pattern is `ninety`. `[Nn]inety` would work, but it looks cluttered; why not make the entire regex case-insensitive? `new RegExp(reNumericWithoutUnit, "gi");` About the order of subpatterns, I found this Q&A: http://stackoverflow.com/questions/10248776/why-order-matters-in-this-regex-with-alternation
type: AnswerComment
score: 0

jtabbedpane
tags question: http://stackoverflow.com/q/24180099
type: Tag
tag name: jtabbedpane
tags question: http://stackoverflow.com/q/24207183

jsp
tags question: http://stackoverflow.com/q/24217224
tags question: http://stackoverflow.com/q/24176602
tags question: http://stackoverflow.com/q/24210839
tags question: http://stackoverflow.com/q/24207904
tags question: http://stackoverflow.com/q/24187558
tags question: http://stackoverflow.com/q/24261242
tags question: http://stackoverflow.com/q/24234289
tags question: http://stackoverflow.com/q/24148290
tags question: http://stackoverflow.com/q/24125380
tags question: http://stackoverflow.com/q/24211217
tags question: http://stackoverflow.com/q/24258937
tags question: http://stackoverflow.com/q/24127066
tags question: http://stackoverflow.com/q/24256702
tags question: http://stackoverflow.com/q/24116293
tags question: http://stackoverflow.com/q/24200936
tags question: http://stackoverflow.com/q/24180554
tags question: http://stackoverflow.com/q/24111962
tags question: http://stackoverflow.com/q/24181906
tags question: http://stackoverflow.com/q/24259850
tags question: http://stackoverflow.com/q/24224825
tags question: http://stackoverflow.com/q/24158862
tags question: http://stackoverflow.com/q/24261552
tag name: jsp
tags question: http://stackoverflow.com/q/24169872
tags question: http://stackoverflow.com/q/24207043
tags question: http://stackoverflow.com/q/24161456
tags question: http://stackoverflow.com/q/24225158
tags question: http://stackoverflow.com/q/24224903
tags question: http://stackoverflow.com/q/24107576
tags question: http://stackoverflow.com/q/24179064
tags question: http://stackoverflow.com/q/24230968
tags question: http://stackoverflow.com/q/24234416
tags question: http://stackoverflow.com/q/24200390
tags question: http://stackoverflow.com/q/24138392
tags question: http://stackoverflow.com/q/24198216
tags question: http://stackoverflow.com/q/24245341
tags question: http://stackoverflow.com/q/24136173
tags question: http://stackoverflow.com/q/24124983
tags question: http://stackoverflow.com/q/24176199
tags question: http://stackoverflow.com/q/24193899
tags question: http://stackoverflow.com/q/24201741
tags question: http://stackoverflow.com/q/24134633
tags question: http://stackoverflow.com/q/24202703
tags question: http://stackoverflow.com/q/24252739
tags question: http://stackoverflow.com/q/24116802
tags question: http://stackoverflow.com/q/24186111
tags question: http://stackoverflow.com/q/24203928
tags question: http://stackoverflow.com/q/24118909
tags question: http://stackoverflow.com/q/24195586
tags question: http://stackoverflow.com/q/24242871
tags question: http://stackoverflow.com/q/24145933
tags question: http://stackoverflow.com/q/24242809
tags question: http://stackoverflow.com/q/24261062
tags question: http://stackoverflow.com/q/24140501
tags question: http://stackoverflow.com/q/24112812
tags question: http://stackoverflow.com/q/24152752
tags question: http://stackoverflow.com/q/24224703
tags question: http://stackoverflow.com/q/24138026
tags question: http://stackoverflow.com/q/24130083
tags question: http://stackoverflow.com/q/24196992
tags question: http://stackoverflow.com/q/24246502
tags question: http://stackoverflow.com/q/24217813
tags question: http://stackoverflow.com/q/24165754
tags question: http://stackoverflow.com/q/24260271
tags question: http://stackoverflow.com/q/24194810
tags question: http://stackoverflow.com/q/24120224
tags question: http://stackoverflow.com/q/24205100
tags question: http://stackoverflow.com/q/24176684
tags question: http://stackoverflow.com/q/24246452
tags question: http://stackoverflow.com/q/24137297
tags question: http://stackoverflow.com/q/24113330
tags question: http://stackoverflow.com/q/24116637
tags question: http://stackoverflow.com/q/24145374
tags question: http://stackoverflow.com/q/24177758
tags question: http://stackoverflow.com/q/24183146
tags question: http://stackoverflow.com/q/24108520
tags question: http://stackoverflow.com/q/24246087
tags question: http://stackoverflow.com/q/24229308
tags question: http://stackoverflow.com/q/24258319
tags question: http://stackoverflow.com/q/24118155

http://stackoverflow.com/comment/37400455
has text: @ Marco Acierno: Of course i can, but i thought it would be all right the way im doing it right now, because i thought after saying c = null; the reference would be killed and the object would be cleaned up in the heap space. So: I should only use one instance of Collatz() and calculate via different threads all the 1mio sequences with that single object?
comment on: http://stackoverflow.com/q/24220007
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37428428
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24233009
type: QuestionComment
has text: Can you connect to the database via the mongo shell?

http://stackoverflow.com/comment/37221692
type: Comment
type: AnswerComment
score: 0
has text: depends on the reason you declared it in the first place. If to only use it in this method, then delete it. If to use it more globally, rename the local variable inside the centro method
comment on: http://stackoverflow.com/a/24124581

http://stackoverflow.com/a/29035980
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24138398
has body: Download the most recent selenium java bindings - 2.45. Then remove the 2.44 (or whatever you're using) from your library. Then include the following in your code: import org.openqa.selenium.phantomjs.PhantomJSDriver; import org.openqa.selenium.phantomjs.PhantomJSDriverService; public void setUp() throws Exception { DesiredCapabilities DesireCaps = new DesiredCapabilities(); DesireCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "C://phantomjs.exe"); WebDriver driver = new PhantomJSDriver(DesireCaps); NOTE* The location of the .exe may not be in your C drive, so you point it to exactly you've store phantom You should be good to go after this.
has comment: http://stackoverflow.com/comment/46313601

http://stackoverflow.com/comment/37275478
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24153800
type: QuestionComment
has text: addMouseListener, right? Would I add it inside the class or outside?

http://stackoverflow.com/comment/37323524
has text: Thank you. The values are now consistent throughout the array. However when it is printed into the console it appears as [[[ 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 ]]] i.e. the matrices are not shown individually. Any ideas why this is? Thanks again though!
comment on: http://stackoverflow.com/a/24179593
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37298107
has text: When you navigate to gwtproject.org do you see sourcemaps? If not, you might be using beta/canary Chrome, which has been frequently known to break this feature. Can you also verify that you haven't unchecked the sourcemaps checkbox in the dev tools? Finally, do you see the log message `[WARN] sent source map for module:` in your super dev mode process console?
comment on: http://stackoverflow.com/q/24164990
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37227738
score: 1
has text: Wow, it's hard to find where your problem is! Also, don't leave `catch` clauses empty; at least put a `e.printStackTrace();` so that your console prints problems you have encountered. For faster help, please post a [SSCCE](http://www.sscce.org/).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24128375

http://stackoverflow.com/q/24198672
has comment: http://stackoverflow.com/comment/37359782
upvote count: 0
type: UnansweredQuestion
score: -3
has title: @OneToOne or @ManyToOne on com.analytica.pojo.Client_Unit.city_id references an unknown entity: com.analytica.pojo.CityMaster error
has comment: http://stackoverflow.com/comment/37359390
has comment: http://stackoverflow.com/comment/37362220
has comment: http://stackoverflow.com/comment/37359719
tagged with: java
tagged with: hibernate
has body: I am trying to insert the data to a table. I am getting the error as 31456 [http-bio-8080-exec-7] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 31457 [http-bio-8080-exec-7] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.analytica.pojo.Client_Unit 31457 [http-bio-8080-exec-7] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.analytica.pojo.Client_Unit on table cu_client_unit @OneToOne or @ManyToOne on com.analytica.pojo.Client_Unit.city_id references an unknown entity: com.analytica.pojo.CityMaster error org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.analytica.pojo.Client_Unit.city_id references an unknown entity: com.analytica.pojo.CityMaster Unit @ManyToOne @JoinColumn(name="CU_CM_ID") public CityMaster getCity_id() { return city_id; } public void setCity_id(CityMaster city_id) { this.city_id = city_id; } City @Id @Column(name="CM_ID") @OneToMany public int getCity_id() { return city_id; } public void setCity_id(int city_id) { this.city_id = city_id; } I am trying to insert the values to db. I am getting the error as @OneToOne or @ManyToOne on com.analytica.pojo.Client_Unit.city_id references an unknown entity: com.analytica.pojo.CityMaster error
answer count: 1
downvote count: 3
has answer: http://stackoverflow.com/a/24199659
favorite count: 0
type: Question

http://stackoverflow.com/q/24221759
tagged with: android
tagged with: listview
tagged with: arraylist
has title: Can I create a ListView with values on the right and left hand side at the same time?
answer count: 2
has comment: http://stackoverflow.com/comment/37404072
tagged with: android-listview
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37403799
downvote count: 0
has answer: http://stackoverflow.com/a/24222139
upvote count: 1
has body: I'm trying to make a scoreboard with the players name (a string) on the left side and the player's score (an integer) on the right. Like this: Player1 0 Player2 0 Player3 0 Player4 0 etc. where the players are taken from an ArrayList of strings. When the name of the player is tapped, the integer on the right should go up by one. I tried using a HashMap to do this, and the table displayed fine, but the HashMap has no ordering so I can't tell it which number to add one to. I also tried a LinkHashMap and had similar problems. I figured using a ListView would be most convenient because each item in the list has a position. I was wondering if it's possible to create a ListView with strings on the left side and integers on the right, while being able to change the values of the integers on the right by tapping on the strings on the left. The integers don't have to be aligned to the right, but just positioned to the right side of the strings. If you could also show the code that would make this possible, that would be greatly appreciated. Thanks. If there is another better solution to this, that would be helpful too.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24221977
has comment: http://stackoverflow.com/comment/37404580
type: UnansweredQuestion

http://stackoverflow.com/a/24181361
type: Answer
has body: This will do ..!! int startIndex= 10; int maxResultCountCount = 115; int endIndex = 0; int spacing=10; int maxValue=maxResultCountCount+startIndex; int endIndex =endIndex+spacing; while(startIndex &lt; maxValue){ System.out.println(startIndex+" "+endIndex); startIndex = endIndex + 1; endIndex = endIndex+spacing; if(endIndex&gt;maxValue) endIndex=maxValue; }
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24181030
answers question: http://stackoverflow.com/q/24181030

http://stackoverflow.com/a/24164054
type: Answer
accepted answer of: http://stackoverflow.com/q/24163900
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24163900
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37293916
has comment: http://stackoverflow.com/comment/37294311
has body: You can wrap your db calls in a Callable like this: public class SqlTask implements Callable&lt;ResultSet&gt; { private String sql; public SqlTask(final String sql) { this.sql = sql; } @Override public ResultSet call() throws Exception { Connection connection = ...; // get connection Statement stmt = connection.createStatement(); return stmt.executeQuery(this.sql); } } and then execute them in parralel using an ExecutorService, for example: final ExecutorService executor = Executors.newCachedThreadPool(); final Future&lt;ResultSet&gt; futureResult1 = executor.submit (new SqlTask("SELECT * FROM table1")); final Future&lt;ResultSet&gt; futureResult2 = executor.submit(new SqlTask("SELECT * FROM table2")); final Future&lt;ResultSet&gt; futureResult3 = executor.submit(new SqlTask("SELECT * FROM table3")); final ResultSet result1 = futureResult1.get(); final ResultSet result2 = futureResult2.get(); final ResultSet result3 = futureResult3.get();

http://stackoverflow.com/q/24108356
has title: unable to instantiate activity, ClassNotFoundException
answer count: 4
possible better answer: http://stackoverflow.com/a/24108419
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24443698
score: 0
linked to: http://stackoverflow.com/q/18533054
has answer: http://stackoverflow.com/a/24229759
has body: I am developing an android application and after moving around some libraries and adjusting my workspace so that it can sync with github I am now encountering a new error that I have not had in the past. Here is the print out in LogCat. FATAL EXCEPTION: main Process: com.exmple.loop, PID:1000 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.loop/com.example.loop.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.loop.MainActivity" on path: DexpathList[[zip file "/data/app/com.example.loop-2.apk"]... I can supply more if needed. I have checked stackoverflow for solutions and came across some that proved to be unhelpful. Here is the first question I found and here is the second. I tried the helpful solutions for both and nothing seems to work. Similar to the user in the first question, the exception is thrown before any line I write because it is failing to recognize my main activity as a class. Here is my android manifest. <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
tagged with: java
has answer: http://stackoverflow.com/a/24109248
accepted answer: http://stackoverflow.com/a/24443698
type: Question
has comment: http://stackoverflow.com/comment/37190711
has comment: http://stackoverflow.com/comment/37189793
has answer: http://stackoverflow.com/a/24108419
tagged with: android
linked to: http://stackoverflow.com/q/6147241
has comment: http://stackoverflow.com/comment/37189824
tagged with: eclipse

http://stackoverflow.com/q/24232931
possible better answer: http://stackoverflow.com/a/24240924
answer count: 2
has comment: http://stackoverflow.com/comment/37445043
has answer: http://stackoverflow.com/a/24240924
has body: I have problems with adding a line at a defined position in JavaFX. The line has to be line a constant line as shown here: How to add a value marker to JavaFX chart? My problem is, that my layout definition is a bit more complicated. Have a look: The important part is the one on the top. I want to have the line on the y=60 line. The left part with the RadioBoxes is a VBox. The part with the (Scatter-)Chart is a StackPane (because I want it to fill the rest of the width). Inside this StackPane is the chart and a Group. The only child of the Group is the line. I think the problem is, that the StackPane centers the Group with the line above the chart. But I can't get the combination of layouts which 1. stretches the chart 2. sets the Line above the chart 3. doesn't center the line I tried lots of combinations but I just can't get it the way I want. Does anybody have an idea?!
tagged with: java-8
tagged with: javafx-8
has title: Adding a line in a JavaFX chart
linked to: http://stackoverflow.com/q/15615881
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37445370
downvote count: 0
score: 7
upvote count: 7
favorite count: 0
tagged with: javafx-2
accepted answer: http://stackoverflow.com/a/24403761
linked to: http://stackoverflow.com/q/30482139
type: Question
has answer: http://stackoverflow.com/a/24403761

http://stackoverflow.com/comment/37422791
type: Comment
has text: @user3580294 I agree that the code should be in the question. But it's actually easy to find the problem even without the code, since the exception stack trace tells what the problem is.
score: 0
comment on: http://stackoverflow.com/q/24231939
type: QuestionComment

http://stackoverflow.com/comment/37337230
score: 0
comment on: http://stackoverflow.com/q/24185601
type: Comment
type: QuestionComment
has text: See my essay on Life After Parsing. http://www.semanticdesigns.com/Products/DMS/LifeAfterParsing.html

http://stackoverflow.com/comment/37190713
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24108838
has text: Yes on rename, please no on extension of `Calendar`.
type: Comment

http://stackoverflow.com/a/24167397
downvote count: 1
upvote count: 5
has comment: http://stackoverflow.com/comment/37300327
type: Answer
accepted answer of: http://stackoverflow.com/q/24167274
score: 4
answers question: http://stackoverflow.com/q/24167274
has body: Try with prefix slash as shown below RequestDispatcher aDispatcher = request.getRequestDispatcher("/file.jsp"); if jsp file is present directly under webapp folder. or try RequestDispatcher aDispatcher = request.getRequestDispatcher("/WEB-INF/file.jsp"); if jsp file is under WEB-INF folder. project structure: WebContent | |__file.jsp | |__WEB-INF | |__file.jsp |__web.xml Read What is WEB-INF used for in a Java web application? If you want not to access this JSP file directly then put is inside the WEB-INF folder that can't accessed publically that is more secure way for restricted resources. A JSP file placed under WEB-INF can't accessed directly by simply hitting the URL in that case it can be accessed by the application only.
type: AcceptedAnswer

http://stackoverflow.com/comment/37408332
type: QuestionComment
score: 0
has text: could you try to reformat your code? remove empty lines and align everything? Most IDEs like eclipse has a shortcut for that e.g. CTRL+SHIFT+F
comment on: http://stackoverflow.com/q/24224285
type: Comment

http://stackoverflow.com/comment/37388141
has text: Unfortunately they are of different sizes. Nice tip anyway.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24213346
type: Comment

http://stackoverflow.com/a/24232542
score: 0
answers question: http://stackoverflow.com/q/24232497
type: Answer
has body: Press Ctrl+space after the type is added. PrintWriter -&gt; Ctrl+space proposes printWriter If a different shortcut is needed, then you would have to implement it. This link explains how to provide a custom keyboard shortcut.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24232497

http://stackoverflow.com/comment/37315566
comment on: http://stackoverflow.com/a/24172628
type: Comment
type: AnswerComment
has text: I understand that much, but for some reason its not scaling my image to the size I want. Does it only scale up? Because the images Im using are very large.
score: 0

http://stackoverflow.com/comment/37422811
has text: The reason is the index.jsp print the response that other jsp generated. If you use de include directive, jsp is translated only once. Remember, the container translate jsp to a Servlet (Java code) and compile. It's a expensive work.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24229857
type: Comment

http://stackoverflow.com/a/24236504
has comment: http://stackoverflow.com/comment/37432263
has comment: http://stackoverflow.com/comment/37476890
answers question: http://stackoverflow.com/q/24236274
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/37432249
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37431833
has comment: http://stackoverflow.com/comment/37431856
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37431777
has body: Without getting to run the code, you have a problem here... t3.setText(total); Because JTextField does not have a setText(int) method. Instead you need to convert the value to a String. You can use Integer.toString(total), but it might give you better results to use NumberFormat.getNumberInstance().format(total)) instead, for example t3.setText(NumberFormat.getNumberInstance().format(total)); Updated The "other" problem you have, which has had me running around in circles, is the fact that Button1handler extends GUI class Button1handler extends GUI implements ActionListener { This means, that when it access the fields t1 and t2 it's getting empty values, because these fields are not the same as the fields that are on the screen. If your ActionListener is in a external file/class, you will need provide context to the class, for example... class Button1handler implements ActionListener { private JTextField f1; private JTextField f2; private JTextField f3; public Button1handler(JTextField f1, JTextField f2, JTextField f3) { this.f1 = f1; this.f2 = f2; this.f3 = f3; } public void actionPerformed(ActionEvent e) { int firstnumber = Integer.parseInt(f1.getText()); int secondnumber = Integer.parseInt(f2.getText()); int total = firstnumber + secondnumber; f3.setText(NumberFormat.getNumberInstance().format(total)); } } Then you'll need to create a new instance of the action handler using something like... b1.addActionListener(new Button1handler(t1, t2, t3)); This provides the action handler with a reference to the actual fields which are been manipulated by the user on the screen... You might be interested in Nested Classes which provides you with some additional features to egt over this requirement (of having to pass references), but you should VERY varimular with context of objects before moving onto it ;)
accepted answer of: http://stackoverflow.com/q/24236274

http://stackoverflow.com/comment/37353120
score: 1
type: Comment
type: QuestionComment
has text: Try it out first and ask a question if you actually have a problem. If you loop it, you'll assign a new `Person` object to `person` but this won't mean the previous one is gone: you just don't reference it from `person` anymore.
comment on: http://stackoverflow.com/q/24195283

http://stackoverflow.com/comment/37356339
comment on: http://stackoverflow.com/q/24196995
score: 2
type: Comment
type: QuestionComment
has text: You don't have to, its just a bad practice to leave things as "default". Making it explicit is often more clear.

http://stackoverflow.com/q/24205100
has body: I am trying to write a web page using JSP which can talk to R via Rserve. I have installed R and Rserve and both are running (I have checked in task manager). What I need to to do now is make a connection between the two. I have found examples of JAVA but not JSP. I have tried editing the JAVA code to be used as JSP but that always gives me errors relating to this bit of code: try { RConnection c = new RConnection(); double d[] = c.eval("rnorm(10)").asDoubles(); org.rosuda.REngine.REXP x0 = c.eval("R.version.string"); System.out.println(x0.asString()); } catch (REngineException e) { } I have been using the code from the answer on this question. I am new to both JAVA and R so I am probably missing something really simple...
type: AnsweredQuestion
tagged with: rserve
accepted answer: http://stackoverflow.com/a/24205184
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24205184
tagged with: jsp
answer count: 1
tagged with: tomcat
type: Question
linked to: http://stackoverflow.com/q/10216014
has title: How to use Rserve with JSP on Tomcat? (Windows 7)
tagged with: http://stackoverflow.com/tag/r

http://stackoverflow.com/comment/44411097
comment on: http://stackoverflow.com/q/24114790
type: Comment
type: QuestionComment
has text: possible duplicate of [Ant import doesn't work](http://stackoverflow.com/questions/26681784/ant-import-doesnt-work)
score: 0

http://stackoverflow.com/q/24253298
has answer: http://stackoverflow.com/a/24253574
accepted answer: http://stackoverflow.com/a/24268427
linked to: http://stackoverflow.com/q/2699209
has answer: http://stackoverflow.com/a/24268427
has body: My question is this: how can reading a huge (many millions of lines) file keep a thread alive, even after it finished doing the file stuff The problem is that I have a Thread started from the javafx application thread, which then (the new thread) performs some read/write actions on a text file, won't exit naturally when faced with HUGE files to parse through, 17-million lines large, specifically. I'm assuming this is due to the thread holding on to some resource that I'm missing, however, since I'm using the try-with-resource model, I'm not sure how that's even possible really. Here's the javafx controller class (using fxml) that sparks off the thread: MainController.java: /** * This method handles what happens when the calculate button is clicked. * The main thing this does is disable/enable a few Nodes, as well as sparks * off the background thread. * * @param event */ @FXML private void convert_button_action(ActionEvent event) { closing_label.setVisible(true); convert_button.setDisable(true); input_text = input_NCLocation_field.getText(); output_text = output_Location_Field.getText(); indicator_node.setVisible(true); if (!toggleSwitch.isSelected()) { (new Thread(new FileWriter(input_text, output_text, indicator_node))).start(); } else { DateWriter temp = new DateWriter(input_text, output_text, indicator_node, yr_mn_dy.isSelected()); (new Thread(temp)).start(); } } nothing too fancy in there, simply some making things visible/not visible and the starting of the appropriate thread based on the input of the user. next is the entire Thread class since it's not too huge. All it does really is either turn a line that looks like: yearmonthday into year,month,day or it separates the year month and day columns into separate files if the user clicked the check box that asked for it. Simply a handy tool for the use case. Please note the println statement at the end of the run() method. I see this println every single time, but after it happens, nothing happens. The program …
type: Question
linked to: http://stackoverflow.com/q/4092914
answer count: 2
tagged with: javafx-2
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/24253574
has title: Thread won't naturally exit at end of run()

http://stackoverflow.com/comment/37197543
score: 1
has text: How does the [tag:swing] tag apply? Why not `Collections.binarySearch()`? How can you debug this without a [complete example](http://stackoverflow.com/help/mcve) and failed test case?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24112236

http://stackoverflow.com/comment/37304651
comment on: http://stackoverflow.com/q/24168946
type: Comment
type: QuestionComment
has text: Try taking those out for a start, or replace the too-general `Exception` with a specific exception. Alternatively, insert a logging statement inside each catch block.
score: 1

http://stackoverflow.com/a/24193485
has body: This is the solution: import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; @XmlRootElement public class ByteArrayWithOverloadedSetterObject { private byte[] data; @JsonProperty //I ADDED THIS public void setData(byte[] data) { this.data = data; } @XmlTransient @JsonIgnore public void setData(String data) { this.data = data.getBytes(); } public byte[] getData() { return data; } } Now my tests pass.
accepted answer of: http://stackoverflow.com/q/24192931
type: Answer
has comment: http://stackoverflow.com/comment/37349511
answers question: http://stackoverflow.com/q/24192931
has comment: http://stackoverflow.com/comment/37349758
score: 8
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37349551
upvote count: 8

http://stackoverflow.com/comment/37492550
type: QuestionComment
has text: You're right dave. Typo on my part. Sorry.
comment on: http://stackoverflow.com/q/24266632
type: Comment
score: 0

http://stackoverflow.com/comment/37314065
has text: @ReneGroeschke That's the odd thing; none. It builds succesfuly, and there are no lint errors, but when I launch the app on android it crashes immediately. Thanks
comment on: http://stackoverflow.com/q/24174380
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37404245
has text: Yes, you may want to distinguish between a query error versus a query that returns no rows. If you mean `dialog`, you can use the approach shown [here](http://stackoverflow.com/a/5540802/230513).
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24220593

http://stackoverflow.com/q/24120298
has comment: http://stackoverflow.com/comment/37215620
has comment: http://stackoverflow.com/comment/37239273
has comment: http://stackoverflow.com/comment/37215342
has body: I want to make sure that meassuring time of clEnqueueReadBuffer() proper way how to meassure time required to copy data from GPU to main memory. I'm a bit suspicious that clFinish() does contribute as well. I run 100x dot product of 1000000 floats and meassure time by this // RUN TIME BLOCK println( " Running OpenCL program ... " ); t1 = System.nanoTime(); for (int reps = 0; reps &lt; 100; reps++) { clEnqueueNDRangeKernel(commandQueue, kernel, 1, null, global_work_size, local_work_size, 0, null, null); } clFinish(commandQueue); // VERSION 1 t2 = System.nanoTime(); println( " OpenCL Run Time : "+ ((t2-t1)*1e-9)+" [s] " ); // READ OUT TIME BLOCK t1 = System.nanoTime(); //clFinish(commandQueue); // VERSION 2 clEnqueueReadBuffer(commandQueue, memObjects[2], CL_TRUE, 0, n * Sizeof.cl_float, dst, 0, null, null); t2 = System.nanoTime(); println( " Read-out Time: "+ ((t2-t1)*1e-9)+" [s] " ); got results OpenCL Run Time : 2.5124469 [s] Read-out Time: 0.002145424 [s] It seem a bit too Good for me just 2 milliseconds and &lt;0.1% of total time ... the problem of CPU-GPU communication bottleneck does not seems to be so bad. when I put clFinish(commandQueue); inside the Read-out Time block I got these results OpenCL Run Time : 1.0892084 [s] Read-out Time: 1.4300439 [s] Which on the other hand seems too bad ... it is faster to do 100 multiplications on GPU than copy it by PCI-express ? .... well maybe Just for completness: I used openclp5 library for processing which use jocl with Java jdk 1.7 on Ubuntu 12.04 64 bit with Quadro FX 580 GPU and my kernel is simple (no optimization or anything ) String programSource = "__kernel void sampleKernel( "+ "__global const float *a, __global const float *b, __global float *c) { "+ " int gid = get_global_id(0); "+ " c[gid] = a[gid] * b[gid]; "+ "}";
type: AnsweredQuestion
score: 0
tagged with: performance
accepted answer: http://stackoverflow.com/a/24120615
tagged with: opencl
tagged with: java
tagged with: profiling
answer count: 1
has comment: http://stackoverflow.com/comment/37267000
type: Question
has answer: http://stackoverflow.com/a/24120615
has comment: http://stackoverflow.com/comment/37226366
has title: How to measure OpenCL readout time?

http://stackoverflow.com/comment/37189465
has text: @TSjahangiri. Do you mean that your string array is not a string array but a char array or a byte array?
type: Comment
comment on: http://stackoverflow.com/a/24107702
score: 0
type: AnswerComment

http://stackoverflow.com/q/24158105
has comment: http://stackoverflow.com/comment/37452981
has title: Mule SFTP endpoint fails to open local file
has comment: http://stackoverflow.com/comment/37384549
has body: I have a Mule flow that reads files through a generic inbound endpoint from an ftp server, makes some modification on the data, and writes files through a generic outbound endpoint to an sftp server. Yesterday it processed 60 files. On 57 there were no errors, but on three the following traces appeared. Any suggestions are welcome. Error writing data over SFTP service, error was: Failed to open local file 4: Failed to open local file at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2297) at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:484) at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:438) at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:405) at org.mule.transport.sftp.SftpClient.storeFile(SftpClient.java:385) at org.mule.transport.sftp.SftpMessageDispatcher.doDispatch(SftpMessageDispatcher.java:176) at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:100) at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2553) at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105) at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55) at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:111) at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:158) at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) [ERROR] DispatchingLogger [Services].xmlSftpConnector.dispatcher.29 2014-06-09 15:55:07 Unexpected exception attempting to write file, message w…
has comment: http://stackoverflow.com/comment/37483980
upvote count: 3
has comment: http://stackoverflow.com/comment/37484051
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24263951
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24263951
type: AnsweredQuestion
score: 3
tagged with: sftp
tagged with: java
tagged with: mule

http://stackoverflow.com/comment/37320574
type: Comment
comment on: http://stackoverflow.com/a/24165190
type: AnswerComment
has text: Noted for later use, but I want to use and understand a system service here.
score: 0

http://stackoverflow.com/comment/37391509
score: 0
has text: Why don't you check the length using java methods ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24215186

http://stackoverflow.com/q/24254657
has title: How to access the package com.google.appengine.api.datastore from the front end code
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: android
tagged with: eclipse
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24254754
type: Question
has body: Eclipse, GoogleAppEngine, Trying to use the method KeyFactory.keyToString(Key) in my client side logic but I need to import import com.google.appengine.api.datastore.Key; import com.google.appengine.api.datastore.KeyFactory; but I I'm getting the "cannot be resolved error" Additional Info: It works with in the backend code Installed additional google api: google cloud datastore api

http://stackoverflow.com/comment/37328435
comment on: http://stackoverflow.com/a/24177217
score: 0
type: Comment
type: AnswerComment
has text: ADTC: "Natively" fast for bytecode is nonsense, and yes Dalvik has a few minor tweaks relative to J2ME, but nothing fundamental. Mostly it only cuts legacy and optimizes manually for ARM. The strong point of using Java is more that the features of the exact processor (architecture) you are running are automatically taken care of, something that requires a separate binary per arch in the native case. But a bytecode managed language with GC can't touch a native binary for that processor with manual management. At best it doesn't matter.

http://stackoverflow.com/comment/37423840
has text: The datasource is container managed not the entity manager factory. Do you not have a bean of type `LocalEntityManagerFactoryBean` in your Spring configuration? If not, that is the problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24232416
score: 0

http://stackoverflow.com/comment/37199174
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24113194
has text: unclear what is your question ?

http://stackoverflow.com/comment/37250433
has text: Are you encountering an error?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24140757
score: 0

http://stackoverflow.com/comment/37272640
comment on: http://stackoverflow.com/a/24149751
type: Comment
score: 0
type: AnswerComment
has text: Its better after your last suggestion. But since I am using the framelayout, my drag and drop imagebutton no longer moves. Any suggestions? Thanks for the help by the way.

http://stackoverflow.com/q/24191195
tagged with: hashmap
type: Question
tagged with: java
tagged with: methods
tagged with: casting
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24191244
has comment: http://stackoverflow.com/comment/37345750
tagged with: multithreading
has body: Working with Java (latest as of last week), I am trying to call a method of a thread which I have stored in a hashmap. Reason I want to do this (store the thread in a map vs a list) is that I might want to call methods of that thread from multiple places and don't want to have to store data in static variables within MonitorThread to be able to do so. private HashMap&lt;String, Thread&gt; threads = new HashMap&lt;String, Thread&gt;(); MonitorThread t = new MonitorThread(); t.start(); threads.put("monitor", t); (MonitorThread)(threads.get("monitor")).SendAlert(); I get a cannot resolve SendAlert error on the last line. Why?
has comment: http://stackoverflow.com/comment/37345041
downvote count: 0
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/24191244
has title: Run method of thread where id stored in map
answer count: 1
favorite count: 0

http://stackoverflow.com/a/24144971
downvote count: 0
has body: I'm pretty sure that the DefaultMqttPahoClientFactory() provided by Spring Integration is using the "synchronous" mode of operation in Paho, so the likelihood is that you would need an alternative ClientFactory implementation.
has comment: http://stackoverflow.com/comment/37261750
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37291687
upvote count: 1
answers question: http://stackoverflow.com/q/24141082

http://stackoverflow.com/comment/37415463
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24228098
type: AnswerComment
has text: Additional explanations about @Bill's solution can be found here: http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java. Is it possible that () are missin arround the literal ?

http://stackoverflow.com/q/24137173
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24137431
accepted answer: http://stackoverflow.com/a/24137431
tagged with: java
upvote count: 4
type: Question
downvote count: 0
tagged with: jpda
has body: The page of migration to "tomcat 8" says (http://tomcat.apache.org/migration-8.html): "When starting Tomcat with the jpda option to enable remote debugging, Tomcat 8 listens on localhost:8000 by default. Earlier versions listened on *:8000" 1.what is the actual different between those configuration? Thanks, Eyal
answer count: 1
tagged with: tomcat8
score: 4
tagged with: tomcat
has title: Tomcat 8 jpda port
favorite count: 0

http://stackoverflow.com/q/24144967
tagged with: sqlexception
accepted answer: http://stackoverflow.com/a/24145083
possible better answer: http://stackoverflow.com/a/24144990
type: AnsweredQuestion
answer count: 2
score: 0
tagged with: java
has title: why don't I need catch the SQLExecption when I use db.exec() on android?
tagged with: sqlite
has answer: http://stackoverflow.com/a/24145083
type: Question
has answer: http://stackoverflow.com/a/24144990
has body: Why don't I need catch the SQLExecption when I use db.exec() on android? The db is a SQLiteDatabase object. when I write the code following, Eclipse don't remind me to catch the SQLException and the code can run normally.However,the method should throw a SQLException according to document provided by eclipse. I think the programmer should catch every exception or add throws statement when creating a method in java. The following is my code. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SQLiteDatabase db=openOrCreateDatabase("keys.db",Context.MODE_PRIVATE,null); String sql="CREATE TABLE `mykey` (_id INTEGER PRIMARY KEY AUTOINCREMENT, "+ "public_key VARCHAR, private_key VARCHAR)"; db.execSQL(sql); db.close(); } thanks.
tagged with: android
has comment: http://stackoverflow.com/comment/37258660

http://stackoverflow.com/a/24138882
has comment: http://stackoverflow.com/comment/37248447
has comment: http://stackoverflow.com/comment/37248166
has comment: http://stackoverflow.com/comment/37257054
has comment: http://stackoverflow.com/comment/37248049
type: Answer
has comment: http://stackoverflow.com/comment/37248133
answers question: http://stackoverflow.com/q/24138675
has comment: http://stackoverflow.com/comment/37247975
has comment: http://stackoverflow.com/comment/37248071
has comment: http://stackoverflow.com/comment/37250215
score: 1
has body: You can use them; checkBox.setEnabled(true); // enable checkbox checkBox.setEnabled(false); // disable checkbox Also you can disable them after check the checkBox with this code: checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener(){ @Override public void onCheckedChanged(CompoundButton arg0, boolean isChecked) { if (isChecked){ checkBox.setEnabled(false); // disable checkbox } } });
downvote count: 0
has comment: http://stackoverflow.com/comment/37248068
upvote count: 1

program-entry-point
tags question: http://stackoverflow.com/q/24161905
type: Tag
tag name: program-entry-point
tags question: http://stackoverflow.com/q/24142419
tags question: http://stackoverflow.com/q/24211099

http://stackoverflow.com/comment/37339056
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24187962
has text: @webSpider why do you use var and not val? :-)

http://stackoverflow.com/comment/37214213
comment on: http://stackoverflow.com/a/24115952
has text: I that list there were two drivers with same name `MTP Driver`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24200571
has title: C# setter unknown field
favorite count: 0
has answer: http://stackoverflow.com/a/24200647
type: Question
type: AnsweredQuestion
tagged with: c#
accepted answer: http://stackoverflow.com/a/24200647
has comment: http://stackoverflow.com/comment/37370207
has comment: http://stackoverflow.com/comment/37369603
has body: I found an example for my solution in C# as follows: address.streetName = new[] { new adxpstreetName {Text = new[] {ausAddress.StreetName}} }; With my limited knowledge of C#, the above tells me that adxpstreetName object is constructed and ausAddress.StreetName is injected to it. What puzzles me is to which field the value is injected to. The adxpstreetName is generated from XSD that does not have field streetName. I am required to provide the solution in Java and the above seems like Javascript where you can introduce a new field as you like. Can C# experts help enlighten me? Thank you
has comment: http://stackoverflow.com/comment/37363844
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37369541

http://stackoverflow.com/a/24177230
has comment: http://stackoverflow.com/comment/37319006
answers question: http://stackoverflow.com/q/24177188
type: AcceptedAnswer
downvote count: 0
has body: on windows you have to set the variable like: set JAVA_OPTS = “-Xdebug , server=y” and use it this way java %JAVA_OPTS% –cp .Server
has comment: http://stackoverflow.com/comment/37319720
type: Answer
has comment: http://stackoverflow.com/comment/37318978
accepted answer of: http://stackoverflow.com/q/24177188
score: 4
has comment: http://stackoverflow.com/comment/37319193
upvote count: 4

http://stackoverflow.com/q/24197141
tagged with: servlets
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1
has body: i am currently using MappingJacksonHttpMessageConverter in my Dispatcher-Servlet.xml. In my application when the user enters a currency, commas are itself attached to the value. When that value is passed to the controller it is unable to convert the string with commas to a double value. throws pare error. I am using this value for other calculations so i cannot change its type to string in the modal class. Is there a way we can can use MappingJacksonHttpMessageConverter to make the controller ignore the commas and read the value. This is part of my servlet.xml file. Any help would be appreciated
favorite count: 0
type: Question
has title: Convert string with commas to double number in spring MVC
tagged with: spring-data-mongodb
tagged with: spring
has answer: http://stackoverflow.com/a/24198813
accepted answer: http://stackoverflow.com/a/24198813

http://stackoverflow.com/q/24234137
upvote count: 1
score: 1
tagged with: java
answer count: 1
favorite count: 0
type: Question
tagged with: el
tagged with: jstl
has answer: http://stackoverflow.com/a/24234209
tagged with: javascript
tagged with: jquery
type: AnsweredQuestion
has body: I have created a table and filled it with elements taken through JSTL tag and EL expression like this <c:forEach items="${routes_list}" var="route"> ${route.airlane} ${route.aircraft_id} ${route.airport_city_source.city} ${route.airport_city_dest.city} <fmt:formatDate value="${route.departure_date}" pattern="dd/MM/yyyy hh:mm"/> <fmt:formatDate value="${route.arrival_date}" pattern="dd/MM/yyyy hh:mm"/> ${route.travel_class} </c:forEach> what I would like to do is to make every row clickable. I have achieved this by using this function $("tr").click(function() { window.location.href = $(this).find("a").attr("href"); }); but my real goal is to pass to href ${route.id} in order to send a post request to a servlet and make some task. I'm not a jquery programmer so I don't know how to proceed. Thank you folks EDIT $(".show_reservations").click(function() { //show.reservations css class var href = $(this).find("a").attr("href"); $.ajax({ cache:false, dataType:"html", data:"${route.id}="+href, type: "POST", url: "admin_show_reservations", //NAME OF THE SERVLET success: function(data) { //console.log(data); alert("success"+data); }, error: function(exception) { alert("error"); } }); }); HTML Voli <c:choose> <c:when test="${!empty routes_list}"> Compagnia ID Veivolo Partenza Arrivo Ora partenza (ora locale) Ora arrivo (ora locale) Classe <c:forEach items="${routes_list}" var="route"> ${route.airlane} ${route.aircraft_id} ${route.airport_city_source.city} ${route.airport_city_dest.city} <fmt:formatDate value="${route.departure_date}" pattern="dd/MM/yyyy hh:mm"/> <fmt:formatDate value="${route.arrival_date}" pattern="dd/MM/yyyy hh:mm"/> ${route.travel_class} </c:forEach> </c:when> <c:otherwise> Non ci sono voli nel sistema. Aggiungerli attraverso la voce presente nel menù sulla sinistra </c:otherwise> </c:choose> GENERATED HTML Voli Compagnia ID Veivolo Partenza Arrivo Ora partenza (ora locale) Ora arrivo (ora locale) Classe Alitalia AZ198EG Catania Milan 18/06/2014 07:00 18/06…
has title: Make table row clickable and pass a post parameter to jquery function
accepted answer: http://stackoverflow.com/a/24234209
downvote count: 0

http://stackoverflow.com/comment/37478791
score: 0
type: Comment
has text: And how do you explain that the .war deployment works just fine?
type: AnswerComment
comment on: http://stackoverflow.com/a/24259930

http://stackoverflow.com/comment/37322491
type: QuestionComment
has text: Should recognize named entities in the file gaz.txt there is only this line "CLASS Music friends association"
comment on: http://stackoverflow.com/q/24164186
score: 0
type: Comment

http://stackoverflow.com/a/24207338
answers question: http://stackoverflow.com/q/24207264
upvote count: 1
type: AcceptedAnswer
score: 1
has body: It's a hash map therefore the elements are "sorted" by their hash values. You could use LinkedHashMap
type: Answer
accepted answer of: http://stackoverflow.com/q/24207264
downvote count: 0

http://stackoverflow.com/q/24255073
type: Question
tagged with: hadoop
has title: Hadoop jobs.setJar does not working for jars on HDFS
type: UnansweredQuestion
tagged with: hadoop-yarn
has comment: http://stackoverflow.com/comment/37467671
score: 0
has comment: http://stackoverflow.com/comment/37467872
has body: I am trying to solve an issue when a Hadoop app throws java.lang.ClassNotFoundException: WARN mapreduce.FaunusCompiler: Using the distribution Faunus job jar: ../lib/faunus-0.4.4-hadoop2-job.jar INFO mapreduce.FaunusCompiler: Compiled to 1 MapReduce job(s) INFO mapreduce.FaunusCompiler: Executing job 1 out of 1: VerticesMap.Map > CountMapReduce.Map > CountMapReduce.Reduce INFO mapreduce.FaunusCompiler: Job data location: output/job-0 INFO client.RMProxy: Connecting to ResourceManager at yuriys-bigdata3/172.31.8.161:8032 WARN mapreduce.JobSubmitter: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner INFO input.FileInputFormat: Total input paths to process : 1 INFO mapreduce.JobSubmitter: number of splits:1 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1402963354379_0016 INFO impl.YarnClientImpl: Submitted application application_1402963354379_0016 INFO mapreduce.Job: The url to track the job: http://local-bigdata3:8088/proxy/application_1402963354379_0016/ INFO mapreduce.Job: Running job: job_1402963354379_0016 INFO mapreduce.Job: Job job_1402963354379_0016 running in uber mode : false INFO mapreduce.Job: map 0% reduce 0% INFO mapreduce.Job: Task Id : attempt_1402963354379_0016_m_000000_0, Status : FAILED Error: java.lang.ClassNotFoundException: com.tinkerpop.blueprints.util.DefaultVertexQuery at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.jav…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/58330963

http://stackoverflow.com/q/24200936
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/37451959
has body: Basically I need to make a server that handles multiple devices sending/receiving information. I have to be able to send commands to the devices. The number of devices is about 40 for now but will increase to maybe 400 over time. The devises will always send information once every 40seconds-60seconds which is set on the device so it can vary, but may also send more information depending on other factors, such as a responses to commands sent to it. So I have read there is java NIO which I can use or what I have currently done is created a thread for each incoming connection. The sending is not a constant thing so it needs to happen on demand, based on users input on my jsp website. So this is where I am stuck. How do I accomplish the sending of commands from outside the program where the connection is. This is what I currently have: Main server class to handle connections and make threads. try (ServerSocket serverSocket = new ServerSocket(portNumber)) { while (listening) { ServerThread r = new ServerThread(serverSocket.accept()); Thread thread = new Thread(r); thread.setDaemon(true); System.out.println(thread.getId() + "thread"); thread.start(); thread.join(); } } catch (IOException e) { System.err.println("Could not listen on port " + portNumber); System.exit(-1); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Then the ServerThread class: public class ServerThread implements Runnable{ private Socket socket = null; public AtomicBoolean isStopped=new AtomicBoolean(false); public ServerThread(Socket socket) { this.socket = socket; } public void run() { while(!this.isStopped.get()){ try ( DataInputStream in = new DataInputStream(socket.getInputStream()); ) { ReceiveThread r = new ReceiveThread(in); Thread thread = new Thread(r); thread.setDaemon(true); thread.start(); thread.join(); socket.close(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStac…
type: Question
has answer: http://stackoverflow.com/a/24201724
has comment: http://stackoverflow.com/comment/96022779
tagged with: sockets
has comment: http://stackoverflow.com/comment/96022847
has comment: http://stackoverflow.com/comment/96022846
has title: multithreaded server asynchronous java
score: 0
type: UnansweredQuestion
tagged with: java
tagged with: multithreading

http://stackoverflow.com/q/24247490
has answer: http://stackoverflow.com/a/75023646
linked to: http://stackoverflow.com/q/10879206
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/78647729
tagged with: java
has answer: http://stackoverflow.com/a/64396355
has answer: http://stackoverflow.com/a/24254740
possible better answer: http://stackoverflow.com/a/24254740
has body: I'm trying to access elements that are present under elements . Could you help me on accessing these 'elements', which I'm working with Selenium Webdriver and JAVA? Issue Encountered: Able to reach the destination page (where the above elements are present), but those elements are not recognized with my code. Overview of XML structure: * Label3 * Label4* Label6 Code Extract: WebDriverWait wait_iframe = new WebDriverWait(driver, 20000); wait_iframe.until(ExpectedConditions.visibilityOfElementLocated((By.id("element2")))); calling_function(sh1.getCell(col + 10, row).getContents(), sh1.getCell(col + 11, row).getContents(), sh1.getCell(col + 12, row).getContents(), sh1.getCell(col + 14, row).getContents()); public static void called_funciton(String string1, String string2, String string3, String string4) { driver.findElement(By.name("Element1 Name")).sendKeys(string1); driver.findElement(By.id("Element2 ID")).sendKeys(string2); driver.findElement(By.id("Element3 ID")).sendKeys(string3); driver.findElement(By.id("Element4 ID")).sendKeys(string4); driver.findElement(By.name("submitButton")).click(); } Do let me know if require any further details!
has answer: http://stackoverflow.com/a/24247565
upvote count: 61
favorite count: 0
score: 61
type: Question
has answer: http://stackoverflow.com/a/54004944
downvote count: 0
answer count: 5
has title: Find elements inside forms and iframe using Java and Selenium WebDriver
tagged with: iframe
tagged with: selenium
accepted answer: http://stackoverflow.com/a/24247565

http://stackoverflow.com/a/24110729
accepted answer of: http://stackoverflow.com/q/24110704
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24110704
has body: To set any value to label : label.setText(YourValue); so , in your case use this line: tfm.setText(meter+"");
upvote count: 1
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/24203809
downvote count: 0
upvote count: 1
score: 1
type: Answer
has body: public class Der implements Car extends Base { //no implementation of interface here because Base class already implements it } you must use extends keyword before implements keywork right : public class Der extends Base implements Car { //no implementation of interface here because Base class already implements it }
answers question: http://stackoverflow.com/q/24178171

http://stackoverflow.com/q/24233687
favorite count: 0
type: Question
tagged with: serialization
accepted answer: http://stackoverflow.com/a/24234335
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/24234335
downvote count: 0
tagged with: json-deserialization
possible better answer: http://stackoverflow.com/a/36058341
type: AnsweredQuestion
has body: In my Java class I have a field declared like this: protected double a = 0.0; In the JSON that is deserialized to reconstitute this class, that field can appear with either of two different names (legacy issue). As an example, the JSON field can look like this: "a": 9.57, or like this: "d": 9.57, (Luckily, the legacy name "d" does not cause a naming collision with any other variables.) My problem is that I need to populate the class field "a" with either the JSON key "a" or "d" -- whichever is present. (I believe they are always mutually exclusive, but I have not actually proven that beyond all doubt.) I'm using Gson 2.2.1 and Java 7 in Netbeans.
has answer: http://stackoverflow.com/a/36058341
has title: GSON 2.0+ deserialize a field from either of two different serialized field names
upvote count: 5
tagged with: java
tagged with: gson
tagged with: deserialization

http://stackoverflow.com/comment/37427966
has text: Sorry, that's what I did. I casted to int.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24233982
type: Comment

http://stackoverflow.com/a/25527551
answers question: http://stackoverflow.com/q/24181776
score: 0
type: Answer
has body: Checks should be ignored if the field is null. You should open a bug report at http://sourceforge.net/p/oval/bugs/

http://stackoverflow.com/comment/37277362
type: QuestionComment
has text: It looks like your destination queue on wrong server SB02861Node01.server1-SampleBus.
comment on: http://stackoverflow.com/q/24154468
type: Comment
score: 0

http://stackoverflow.com/q/24250094
has comment: http://stackoverflow.com/comment/37504356
tagged with: java-3d
has comment: http://stackoverflow.com/comment/40111408
accepted answer: http://stackoverflow.com/a/36962555
has comment: http://stackoverflow.com/comment/37463337
tagged with: awt
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25667661
possible better answer: http://stackoverflow.com/a/25667661
has answer: http://stackoverflow.com/a/36962555
has comment: http://stackoverflow.com/comment/40116882
has body: I am trying to run the following Java 3D sample code. I am referring 3 jars and 1 dll folder. Their names are as follows :- vecmath.jar j3d-core-1.3.1.jar j3dutils.jar j3dcore-ogl.dll (I also tried referring a jar file instead of this dll file. The jar file is j3dcore-d3d_dll.jar). I have also tried placing them on bin and lib folders of jdk and jre. I have also added the path of the that j3dcore-ogl.dll file in the system environment variable named "Path". Later on I tried replacing it with the path of j3dcore-d3d_dll.jar file. The code is as follows :- import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Button; import java.awt.GraphicsConfiguration; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.media.j3d.AmbientLight; import javax.media.j3d.BoundingSphere; import javax.media.j3d.BranchGroup; import javax.media.j3d.Canvas3D; import javax.media.j3d.DirectionalLight; import javax.media.j3d.Transform3D; import javax.media.j3d.TransformGroup; import javax.swing.Timer; import javax.vecmath.Color3f; import javax.vecmath.Point3d; import javax.vecmath.Vector3d; import javax.vecmath.Vector3f; import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.geometry.Sphere; import com.sun.j3d.utils.universe.SimpleUniverse; public class InteractiveAnimation extends Applet implements ActionListener, KeyListener { private static final long serialVersionUID = 1L; private Button go = new Button("Go"); private TransformGroup objTrans; private Transform3D trans = new Transform3D(); private float height = 0.0f; private float sign = 1.0f; // going up or down private Timer timer; private float xloc = 0.0f; public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRoot.addChild…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40115002
has comment: http://stackoverflow.com/comment/40112692
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40124785
has comment: http://stackoverflow.com/comment/37579514
has comment: http://stackoverflow.com/comment/40114902
has title: Java 3D code giving java.lang.UnsatisfiedLinkError

http://stackoverflow.com/q/24169355
type: Question
has comment: http://stackoverflow.com/comment/37304309
score: 0
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37304241
has comment: http://stackoverflow.com/comment/37304157
has body: I'm attempting to create a library which hide the navigation bar and action bar (I know this is a hackish way of doing things - but it will only be on one version of Android and one specific device model - so it should be fine - we don't need global compatibility - we just need it to work) The problem - is I'm getting a few error when creating the library stating: The method getDecorView() is undefined for the type &amp; The method getWindow() is undefined for the type as well as Return type for the method is missing &amp; Syntax error on token ".", { expected. I've attempted to add: DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); as suggested by another SO article - however I must not be implementing it correctly. Any suggestions are appreciated. Source: public class HideNav{ // Hide Android Navigation bar getWindow().getDecorView().setSystemUiVisibility(8); // Hide Android Status Bar getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } } Errors: Syntax error on token ".", { expected The method getDecorView() is undefined for the type The method getWindow() is undefined for the type Return type for the method is missing DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); Any suggestions are appreciated. Edit: I've attempted to implement the suggestion in the comments below by using: public class HideNav extends View{ public HideNav(Context context) { super(context); } public void changeSomethingInWindow(){ // get a reference of the activity Activity parent = (Activity)getContext(); // using the activity, get Window reference Window window = parent.getWindow(); // using the reference of the window, do whatever you want :D window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } } combined with: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); HideNav view = new HideNav(this)…
has comment: http://stackoverflow.com/comment/37307289
tagged with: android-library
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37305740
has title: Creating Library Results in The method getDecorView() is undefined for the type & The method getWindow() is undefined for the type

http://stackoverflow.com/q/24212625
answer count: 0
tagged with: java
tagged with: hibernate
has title: Dao class not fount Exception in Spring MVC
type: Question
type: UnansweredQuestion
has body: I have a problem with spring-beans.xml this is the problem: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [DAO.UsersaosiImplDatabase] for bean with name 'UsersaosiDAO' defined in ServletContext resource [/WEB-INF/spring-beans.xml]; nested exception is java.lang.ClassNotFoundException: DAO.UsersaosiImplDatabase at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1208) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:568) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1277) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:844) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:539) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) 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(Unknown Source) at java.util.concurrent.Threa…
has comment: http://stackoverflow.com/comment/37386803
has comment: http://stackoverflow.com/comment/37389170
has comment: http://stackoverflow.com/comment/37387133
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37386561
score: 0

http://stackoverflow.com/q/24146089
answer count: 4
tagged with: servlets
has answer: http://stackoverflow.com/a/24146379
upvote count: 0
has body: I use ajax to submit data to a servlet. The ajax call appears to be successful. I believe I'm catching the posted data correctly and using jdbc to submit the data to mysql but the record doesn't get added and there are no exception error messages in the console. Heres the servlet code: @WebServlet(description = "submits comment to mysql database", urlPatterns = { "/CommentController" }) public class CommentController extends HttpServlet { private static final long serialVersionUID = 1L; private static Connection conn; private PreparedStatement prep; private String sql; private ResultSet rs; private static final String driver = "com.mysql.jdbc.Driver", host = "jdbc:mysql://host/", dbName = "name", username = "user", password = "pw"; /** * @see HttpServlet#HttpServlet() */ public CommentController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String commentName = request.getParameter("name"); String comment = request.getParameter("comment"); int postID = Integer.parseInt(request.getParameter("postID")); try{ Class.forName(driver); Connection conn = (Connection) DriverManager.getConnection(host + dbName, username, password); sql="INSERT INTO crm_comments (comment_name, comment_content, comment_date, post_id) VALUES (?, ?, NOW(), ?)"; prep = conn.prepareStatement(sql); prep.setString(1, commentName); prep.setString(2, comment); prep.setInt(3, postID); rs = prep.executeQuery(); }catch(Exception e){ e.printStackTrace(); } System.out.println("yes"); } } The html form: <input type="hidden" name="postID" id="postID" value="<%= postID %>"> ajax: $("#commentSubmit").click(function(e){ var postData = $("#commentForm").serializeArray(); var formURL = $("#commentForm").attr("action"); //var catcher = $("#catcher").val(); $.ajax( {…
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/24146456
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24146150
has title: servlet not submitting record to mysql database after form post
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24146520
tagged with: jdbc
score: -1
has comment: http://stackoverflow.com/comment/37260505

http://stackoverflow.com/a/38047577
has comment: http://stackoverflow.com/comment/63535696
type: Answer
has comment: http://stackoverflow.com/comment/63783151
score: 0
has body: String value1 = "" +jsonObject.get(key)+""; if(value1.contains("'")){ value1 = value1.replace("'", "\''"); } value = value +"\'"+value1+"\'"; // value.replaceAll("\"", "\\" + "\""); listofkey+=","; value+=",";
answers question: http://stackoverflow.com/q/24120522

http://stackoverflow.com/comment/37728698
type: Comment
comment on: http://stackoverflow.com/a/24346567
type: AnswerComment
has text: In each jdk, this serialization is different when its write the xml. In oracle jdk, the output tag 4 TreeMap is diferent. So i want to generete a xml that can be assembled in both jdks. I edited the question.
score: 0

http://stackoverflow.com/comment/37244619
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24132884
score: 0
has text: I think (although I could be mistaken) this is because it's being returned as an element of a LinkedList. If you just returned one FacilityDTO it should work as expected.

http://stackoverflow.com/comment/37479325
has text: The other thing would be easy. I don't know a direct way. You could replace the templates back on the requested URI. Or you could concat the path segments yourself from the ```@Path``` values. Both not nice.
comment on: http://stackoverflow.com/q/24238352
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/76549909
score: 5
type: AnswerComment
has text: Crazy. So Try-with-resources is no good replacement for try-catch-finally when the resource is needed to handle the catch.
type: Comment
comment on: http://stackoverflow.com/a/24129101

http://stackoverflow.com/comment/37247407
has text: @RobbyCornelissen: Coffee/tea differences, aside, it depends on the context. I *love* putting behaviour inside enums when it really belongs there - when it's not context-specific, for example. Is the `CoffeeSort` type the piece of code which should unambiguously know how to create a cup of coffee? If so, my solution is great IMO - polymorphism wins over switch/case where feasible. If, however, you've got different situations (e.g. "create a cup of coffee in XML form" vs "create a cup of coffee as JSON") then it's a different matter.
type: Comment
comment on: http://stackoverflow.com/a/24138962
type: AnswerComment
score: 1

http://stackoverflow.com/q/24168572
tagged with: screenshot
has comment: http://stackoverflow.com/comment/37302689
tagged with: device
upvote count: 0
tagged with: java
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37302666
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24169730
linked to: http://stackoverflow.com/q/2801116
score: -1
has body: I have created a quiz app and once the user has finished the quiz an activity opens which shows a certificate with the user's achievements. I want the device to screen shot the certificate so that the user can view the screenshot in the gallery at a later date. What code should I put into my OnClickListener. Thanks in advance.
has title: When the user clicks a button I want the device to take a screenshot. What code should I use for this?
tagged with: memory
has answer: http://stackoverflow.com/a/24169074
answer count: 2

http://stackoverflow.com/comment/37386587
comment on: http://stackoverflow.com/a/24212286
score: 3
type: Comment
has text: @tieTYT Not necessarily. In the wikipedia pseudocode, "remove a node n from S" doesn't specify which node to remove. If you choose the node at random, your result will be randomly ordered while still satisfying the conditions.
type: AnswerComment

http://stackoverflow.com/a/40567234
score: 1
type: Answer
has body: I'm interested at this discussion. I was convinced that specs indicates that default transaction attribute is REQUIRED. Some guys in another stackoverflow discussion : What is the default TRANSACTION ATTRIBUTE for MDBS? spoke about exception on Weblogic server implementation.
downvote count: 0
answers question: http://stackoverflow.com/q/24120389
upvote count: 1

http://stackoverflow.com/q/24139537
has comment: http://stackoverflow.com/comment/37248045
answer count: 2
has comment: http://stackoverflow.com/comment/37247816
possible better answer: http://stackoverflow.com/a/24139708
accepted answer: http://stackoverflow.com/a/24139593
has comment: http://stackoverflow.com/comment/37248243
has comment: http://stackoverflow.com/comment/37247936
has comment: http://stackoverflow.com/comment/37248013
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37248350
score: -4
has comment: http://stackoverflow.com/comment/37248512
has answer: http://stackoverflow.com/a/24139708
has body: i want to cache arrlist values to be available in a class, i am define an empty arrlist instially and adding values on it from a method and then finally trying to get that global defined arralist values.... class Test{ ArrayList list=new ArrayList(); public void addValues(){ list.add("One"); list.add("Two"); list.add("Three"); list.add("Four"); list.add("Five"); getArrlstValues(); } public void getArrlstValues(){ System.out.println("size of cache arralist=" +list.size()); //why this is showing zero size } public static void main(String args[]) { Test obj=new Test(); obj.addValues(); } }
has comment: http://stackoverflow.com/comment/37248132
has comment: http://stackoverflow.com/comment/37248164
has comment: http://stackoverflow.com/comment/37247894
has comment: http://stackoverflow.com/comment/37248097
favorite count: 0
has comment: http://stackoverflow.com/comment/37247988
has comment: http://stackoverflow.com/comment/37248258
type: Question
has comment: http://stackoverflow.com/comment/37247934
has comment: http://stackoverflow.com/comment/37248548
downvote count: 5
has answer: http://stackoverflow.com/a/24139593
has comment: http://stackoverflow.com/comment/37248660
has title: Java- how to temporarily store data in array-list
has comment: http://stackoverflow.com/comment/37248086
type: AnsweredQuestion

http://stackoverflow.com/q/24147736
linked to: http://stackoverflow.com/q/369823
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24148215
upvote count: 1
tagged with: java
tagged with: user-interface
has body: I am a complete beginner at Java coding and I have never worked with GUI before. Here's what I am trying to do. I have main class "Frame" and two classes: "Circle" and "Square". How do I add Circle and Square to Frame that they'll appear on the frame? Sorry for this easy question but I need your help on this. Thanks in advance! public class Frame extends JFrame{ public static void main(String[] args) { Frame f = new Frame(); Circle circle = new Circle(); Square square = new Square(); f.add(circle); f.add(square); } public Frame(){ setTitle("Frame"); setSize(500, 500); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } } public class Circle extends JFrame{ public Circle(){ } public void paint(Graphics g){ g.setColor(Color.GREEN); g.drawOval(300, 300, 200, 200); } } public class Square extends JFrame{ public Square(){ } public void paint(Graphics g){ g.setColor(Color.GREEN); g.drawRect(300, 300, 500, 500); } }
answer count: 1
duplicate of: http://stackoverflow.com/q/369823
tagged with: swing
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37263998
downvote count: 3
accepted answer: http://stackoverflow.com/a/24148215
score: -2
has title: Java GUI: How to add several classes to "Frame" class

pipeline
type: Tag
tags question: http://stackoverflow.com/q/24219852
tag name: pipeline

http://stackoverflow.com/comment/37626875
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24238229
has text: Can you post your web.xml and spring configuration files?
score: 0

httpconnection
tag name: httpconnection
type: Tag
tags question: http://stackoverflow.com/q/24259402

http://stackoverflow.com/q/24117284
type: Question
has comment: http://stackoverflow.com/comment/37207141
answer count: 2
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has body: I am developing an application in Enterprise JavaBeans 3.1 and I receive data from a Socket. This application acts as a Listener and once data is received it is processed. This application was single threaded and due to it processing it slowly, the application is implemented using Threads which is now a multi threaded application. By doing this, the application now runs much faster. However, there are two threads and both threads access the database to insert and update the database. I face the problem of concurrency where one thread inserts and the other updates causing problems. To deal with concurrency, I added a synchronized block to lock an object making sure the full block is executed. By doing this application is now very slow as it was with a single threaded application. The insert and update is done through JDBC. Is there anything else that can be done so it is processed and processed very quickly without slowing down the application. The below is sample code: @Startup @Singleton public class Listener { private ServerSocket serverSocket; private Socket socket; private Object object; private InetAddress server; @Resource private ScheduledExecutorService executor; @PostConstruct public void init() { object = new Object(); serverSocket = new ServerSocket("somePortNumber"); Runnable runnable = new Runnable() { public void run() { checkDatabase(); if(!isServerActive()) { // send e-mail listen(); } else { listen(); } } }; executor.scheduleAtFixedRate(runnable, 0, 0, TimeUnit.SECONDS); } public void listen() { if(socket == null) { socket = serverSocket.accept(); } else if(socket.isClosed()) { socket = serverSocket.accept(); } startThread(socket); } public void startThread(Socket socket) { Runnable runnable = new Runnable() { public void run() { processMessage(socket); } }; new Thread(runnable).start(); } public void processMessage(Socket socket) { synchronized(object) { // build data from Socket // insert into database message, sentDate // do other things // updat…
tagged with: synchronized
has answer: http://stackoverflow.com/a/24120864
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37207463
tagged with: java
has answer: http://stackoverflow.com/a/24117972
has title: Java Sockets Concurrency Threads Being Too Slow
tagged with: concurrency
favorite count: 0

http://stackoverflow.com/comment/37234975
score: 0
has text: Please provide us with what have you done so far, then only an answer can thought of.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24132298

http://stackoverflow.com/a/24139786
score: 0
answers question: http://stackoverflow.com/q/24132719
has body: If you can't use an ArrayList, or any kind of dynamic list at all, then one solution would be this: StringBuilder sb = new StringBuilder(); Scanner scanner = new Scanner(System.in); int j; while((j=scanner.nextInt()) !=-1){ sb.append(j + " "); } String []numbers = sb.toString().split(" "); int[] grades = new int[numbers.length]; for(int i=0;i&lt;numbers.length;i++){ grades[i] = Integer.parseInt(numbers[i]); } As you can see, I'm putting the input in a stringbuilder object, then I parse it in an array of strings, and convert that array in an integer array. I hope this helps.
type: Answer

http://stackoverflow.com/comment/37259757
type: Comment
score: 0
type: AnswerComment
has text: By the way, do you know how to achieve the same using the new java 8 java.time classes?
comment on: http://stackoverflow.com/a/24134640

encryption
tags question: http://stackoverflow.com/q/24138402
tags question: http://stackoverflow.com/q/24160989
tags question: http://stackoverflow.com/q/24223275
tags question: http://stackoverflow.com/q/24226554
tags question: http://stackoverflow.com/q/24124091
tags question: http://stackoverflow.com/q/24179446
tag name: encryption
tags question: http://stackoverflow.com/q/24121346
tags question: http://stackoverflow.com/q/24250385
tags question: http://stackoverflow.com/q/24226638
tags question: http://stackoverflow.com/q/24227043
tags question: http://stackoverflow.com/q/24165284
tags question: http://stackoverflow.com/q/24228603
tags question: http://stackoverflow.com/q/24265866
tags question: http://stackoverflow.com/q/24237339
tags question: http://stackoverflow.com/q/24127477
tags question: http://stackoverflow.com/q/24147057
tags question: http://stackoverflow.com/q/24119055
tags question: http://stackoverflow.com/q/24115945
tags question: http://stackoverflow.com/q/24261970
tags question: http://stackoverflow.com/q/24142388
type: Tag
tags question: http://stackoverflow.com/q/24168246
tags question: http://stackoverflow.com/q/24129441
tags question: http://stackoverflow.com/q/24130154
tags question: http://stackoverflow.com/q/24250105

http://stackoverflow.com/q/24123649
possible better answer: http://stackoverflow.com/a/24123814
has title: Expiration Date control program
has answer: http://stackoverflow.com/a/24123814
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3802893
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37218402
has comment: http://stackoverflow.com/comment/37219082
tagged with: java
upvote count: 1
duplicate of: http://stackoverflow.com/q/3802893
downvote count: 1
has comment: http://stackoverflow.com/comment/37218290
favorite count: 0
has comment: http://stackoverflow.com/comment/37218240
type: Question
accepted answer: http://stackoverflow.com/a/24123827
has body: I need some help guys, i want to make a program that will be used to control the expiration date of some products, it will need to compare the system date with the date at DB ("oracle"), how can i compare these two and return the number of days left to the product expire. I'll be glad if someone can help me with that. I have no idea from where to start.
has answer: http://stackoverflow.com/a/24123827
tagged with: oracle-database
tagged with: compare
has comment: http://stackoverflow.com/comment/37218491
tagged with: jdbc

http://stackoverflow.com/a/24133056
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24132836
score: 1
type: Answer
has body: You need to read the JavaDoc for the Java EE 7 version of ServletRequest.getContentLength(). It says quite clearly: ... or -1 if the length is not known or is greater than Integer.MAX_VALUE Beware that if you're attempting to read a large request body it will almost certainly be chunked anyway. Many HTTP firewalls and proxies will chunk large bodies as a matter of course.
has comment: http://stackoverflow.com/comment/37594586

http://stackoverflow.com/comment/37427650
has text: Yes. It does implements Serializable.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24234285
score: 0

http://stackoverflow.com/q/24246314
type: Question
tagged with: broadcastreceiver
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has title: Android activate BroadcastReceiver only when phone is locked or app in background
answer count: 0
has body: I have a chat application and I want my GCM Broadcast to activate only when the phonescreen is locked or the app is not active (home button, not app killed!) I tried the following: boolean receiver_working = false; public void enableBroadcastReceiver(){ IntentFilter filter = new IntentFilter(); filter.addAction("com.google.android.c2dm.intent.RECEIVE"); filter.addAction("com.google.android.c2dm.intent.REGISTRATION"); filter.addCategory("com.flipflopdev.epvp_aj1987_chat"); registerReceiver(new GcmBroadcastReceiver(), filter); Toast.makeText(getApplicationContext(), "Enabled broadcast receiver", Toast.LENGTH_SHORT).show(); receiver_working = true; } public void disableBroadcastReceiver(){ ComponentName receiver = new ComponentName(getApplicationContext(), GcmBroadcastReceiver.class); PackageManager pm = getApplicationContext().getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); Toast.makeText(getApplicationContext(), "Disabled broadcst receiver", Toast.LENGTH_SHORT).show(); receiver_working = false; } @Override public void onDestroy() { super.onDestroy(); if(receiver_working) { disableBroadcastReceiver(); } } @Override public void onPause() { super.onPause(); if(!receiver_working) { enableBroadcastReceiver(); } } @Override public void onResume() { super.onResume(); checkPlayServices(); if(receiver_working) { disableBroadcastReceiver(); } } The problem is that onResume() is firing even the activity just starts, thats why I have the boolean variable. When I leave the app now through home button, the GCM Notifications fire up like they should (because BR is activated), when I come back into the app it says BR deactivated but notifications still fire up if send. Where is my mistake?
score: 1
tagged with: android
tagged with: java
tagged with: google-cloud-messaging
favorite count: 0

http://stackoverflow.com/a/24205090
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24205017
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24205017
has body: For a given TimeZone you can retrieve it with inDaylightTime(Date). To get the TimeZone you need: TimeZone timezone = TimeZone.getTimeZone("GMT-05:00"); More here: http://developer.android.com/reference/java/util/TimeZone.html
has comment: http://stackoverflow.com/comment/37372576

http://stackoverflow.com/a/24130958
type: Answer
answers question: http://stackoverflow.com/q/24130288
has body: The JVM works as a Just-In-Time (JIT) compiler. There are many sources of information on JIT compilation, but basically as a java program is running it will encounter parts of the program that are needed, these pieces of the program are in .class files. These .class files is just an intermediate form of Java code (it's not quite Java code, but not quite machine code, yet). Obviously, compiling at runtime (JIT) takes resources (CPU cycles) and, thus, time. So, the JVM only loads pieces of the program that it needs to minimize wasted CPU cycles. But yes, your understanding of process/programs is correct. To sum up: A process is a running instance of a program. This running program, then can spawn even more processes or threads to perform work.
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/37462724
comment on: http://stackoverflow.com/q/24252419
type: Comment
type: QuestionComment
score: 0
has text: `but it is not perfect` How is it not *perfect*? What exactly goes wrong?

http://stackoverflow.com/a/24216461
answers question: http://stackoverflow.com/q/24216180
score: 2
has body: You need to create a CustomListAdapter. private class CustomListAdapter extends ArrayAdapter { private Context mContext; private int id; private List &lt;String&gt;items ; public CustomListAdapter(Context context, int textViewResourceId , List&lt;String&gt; list ) { super(context, textViewResourceId, list); mContext = context; id = textViewResourceId; items = list ; } @Override public View getView(int position, View v, ViewGroup parent) { View mView = v ; if(mView == null){ LayoutInflater vi = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mView = vi.inflate(id, null); } TextView text = (TextView) mView.findViewById(R.id.textView); if(items.get(position) != null ) { text.setTextColor(Color.WHITE); text.setText(items.get(position)); text.setBackgroundColor(Color.RED); int color = Color.argb( 200, 255, 64, 64 ); text.setBackgroundColor( color ); } return mView; } } The list item looks like this (custom_list.xml): &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textView" android:textSize="20px" android:paddingTop="10dip" android:paddingBottom="10dip"/&gt; &lt;/LinearLayout&gt; Use the TextView api's to decorate your text to your liking and you will be using it like this listAdapter = new CustomListAdapter(YourActivity.this , R.layout.custom_list , mList); mListView.setAdapter(listAdapter);
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37393859
accepted answer of: http://stackoverflow.com/q/24216180
type: Answer

http://stackoverflow.com/comment/37192082
score: 0
has text: The program will not compile . Inside class only you can declare variables & methods but you can't call methods. Inside class you have called a methods which is wrong
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24109439

http://stackoverflow.com/q/24134680
has comment: http://stackoverflow.com/comment/37239466
has comment: http://stackoverflow.com/comment/37239500
tagged with: joptionpane
tagged with: keypress
has title: how to do keypress event in jpanel text field?
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/37239438
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/37240398
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37239434
has body: when i select something in combobox : it show joptionPane Dialog box wiht two inputs. here i want to first focusing amount field and then, when i entered in amount field its goes to no of App field then enter go to OK . Here is my code for JOption Dialog: JTextField xField = new JTextField(5); JTextField yField = new JTextField(5); JPanel myPanel = new JPanel(); myPanel.add(new JLabel("Amount:")); myPanel.add(xField); myPanel.add(Box.createHorizontalStrut(15)); // a spacer myPanel.add(new JLabel("No of App:")); myPanel.add(yField); int value = 0; xField.requestFocus(); int result = JOptionPane.showConfirmDialog(null, myPanel, "Please Enter Amount and No.of app", JOptionPane.OK_CANCEL_OPTION);
has answer: http://stackoverflow.com/a/24135456
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37239483
tagged with: java
has answer: http://stackoverflow.com/a/24134920
tagged with: jpanel
score: -1
has comment: http://stackoverflow.com/comment/37239361

http://stackoverflow.com/comment/37196126
score: 0
comment on: http://stackoverflow.com/q/24111411
has text: @sandy In my case it is adding time stamp in file successfully. Please see the text from output.txt SumitTyagi1Sun Jun 08 18:28:47 EDT 2014 It seems that it depends on the step. I have selected a first time and input first name as Sumit and Last Name as Tyagi while b selected in second time and d in third time.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24160261
upvote count: 5
type: Answer
has body: Remove that -fe cxf section. Add this extraarg in wsdlOption -autoNameResolution
has comment: http://stackoverflow.com/comment/37289367
accepted answer of: http://stackoverflow.com/q/24159729
score: 5
answers question: http://stackoverflow.com/q/24159729
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37347664
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24192509
score: 0
has text: Isn't that the point of your program? -Generate a random number between 1 and 20. -User inputs a guess. -User input is compared against generated number. -Output is generated identifying if user input was larger, smaller, or equal to the generated number.

nlp
tags question: http://stackoverflow.com/q/24194606
tags question: http://stackoverflow.com/q/24197039
tags question: http://stackoverflow.com/q/24178667
tag name: nlp
type: Tag
tags question: http://stackoverflow.com/q/24164186
tags question: http://stackoverflow.com/q/24265433
tags question: http://stackoverflow.com/q/24218305

http://stackoverflow.com/a/24202282
type: Answer
accepted answer of: http://stackoverflow.com/q/24201699
has body: I figured out what was wrong. You guessed right-it was a configuration issue. The RollingFileAppender's MaxBackupIndex was set to 1, which was making sure it keeps just 1 backup file thus overwriting my previous entries! The correct configuration is now as follows: &lt;appender name="appender1" class="org.apache.log4j.RollingFileAppender"&gt; &lt;param name="File" value="trace.log"/&gt; &lt;param name="Threshold" value="TRACE"/&gt; &lt;!-- FIX BELOW --&gt; &lt;param name="MaxBackupIndex" value="100000000"/&gt; &lt;param name="MaxFileSize" value="100MB"/&gt; &lt;!-- FIX ABOVE --&gt; &lt;layout class="org.apache.log4j.PatternLayout"&gt; &lt;param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p - %m%n"/&gt; &lt;/layout&gt; &lt;/appender&gt; Thanks for the help just the same - much appreciated.
answers question: http://stackoverflow.com/q/24201699
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/38068795
has text: @matthelliwell I have Camel deployed inside ActiveMQ Service. My shared route contains `Idempotent Consumer EIP`, which in turn uses `Idempotent Repository` Java bean. My ActiveMQ Service hosts a lot of queues and topics, some of them are interconnected with the aid of my shared route (thus they are interconnected with employing Idempotent Consumer mechanism). I need that each idempotent topic-to-topic connection utilize it's own, dedicated Idempotent Repository. These repositories of unique message IDs cannot be shared between Idempotent channel-to-channel connections.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24265950

http://stackoverflow.com/q/24118613
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37209042
has comment: http://stackoverflow.com/comment/37214277
tagged with: paypal
linked to: http://stackoverflow.com/q/7688828
type: Question
has title: Getting error in eclipse after adding paypal SDK
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37331743
tagged with: eclipse
has body: i am new to android paypal integration. I got a jar file which i included it in the java build path and started to run the project but i am getting the new error [2014-06-09 16:08:23 - Sandeep] Dx trouble writing output: already prepared [2014-06-09 16:08:27 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/paypal/android/sdk/A; [2014-06-09 16:08:27 - Sandeep] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/paypal/android/sdk/A; Can i know what is the mistake which i have committed after adding the PaypalAndroidSDK

primefaces
tags question: http://stackoverflow.com/q/24228783
tags question: http://stackoverflow.com/q/24142033
tags question: http://stackoverflow.com/q/24195978
tags question: http://stackoverflow.com/q/24235298
tags question: http://stackoverflow.com/q/24168118
tags question: http://stackoverflow.com/q/24192046
tags question: http://stackoverflow.com/q/24162832
tags question: http://stackoverflow.com/q/24128353
tags question: http://stackoverflow.com/q/24241177
tags question: http://stackoverflow.com/q/24149685
tags question: http://stackoverflow.com/q/24151016
tags question: http://stackoverflow.com/q/24258827
tags question: http://stackoverflow.com/q/24106852
tags question: http://stackoverflow.com/q/24265716
tag name: primefaces
tags question: http://stackoverflow.com/q/24187556
type: Tag
tags question: http://stackoverflow.com/q/24256630
tags question: http://stackoverflow.com/q/24119886
tags question: http://stackoverflow.com/q/24208598

http://stackoverflow.com/q/24168108
has comment: http://stackoverflow.com/comment/37301977
has answer: http://stackoverflow.com/a/24168236
accepted answer: http://stackoverflow.com/a/24168236
tagged with: java
type: Question
score: 0
has body: I've been working on a code. when we delete a specific data from a sql table the primary key which gets deleted will be used in the next record we enter. Here is my code : DB.connector().createStatement().executeUpdate("delete from stud where SID='"+PK+"'"); DB.connector().createStatement().executeUpdate("ALTER TABLE stud AUTO_INCREMENT='"+String.valueOf(PK)+"'"); I cant seem to find the error in this code. PK = 4 at this instance. The error is : 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 ''4'' at line 1 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 com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.Util.getInstance(Util.java:384) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) 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:2832) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1755) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1679) at com.cyrax.crms.Student.jButton2ActionPerformed(Student.java:363) at com.cyrax.crms.Student.access$200(Student.java:27) at com.cyrax.crms.Student$3.actionPerformed(Student.java:167) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fire…
tagged with: sql
answer count: 1
tagged with: mysql
type: AnsweredQuestion
has title: MySql AutoIncrement error

http://stackoverflow.com/a/24209693
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24209535
downvote count: 0
upvote count: 1
has body: If you are going to use the Random class, make sure you create an instance outside of the loop, since new Random() uses the system time as a seed. So if two randoms are created during the same tick, they will produce the same random number sequence. private void fillArray() { Random rand = new Random(); for(int i=0; i&lt;10;i++) { PincodeRandom[0][i]=i; PincodeRandom[1][i]= rand.nextInt(2) + 1; } }

http://stackoverflow.com/q/24257227
favorite count: 0
duplicate of: http://stackoverflow.com/q/19920271
tagged with: java
has body: I am trying to mock an object using Mockito Library for Java. After mocking the object i am updating some values for that mocked object. Message m = mock(Message.class); m.put("org.apache.cxf.http.case_insensitive_queries", false); m.put("org.apache.cxf.endpoint.private", false); m.put(Message.REQUEST_URI, pathInfo); m.put(Message.HTTP_REQUEST_METHOD, method); However, on debugging the code, i am not able to see the values which i set in the message object. Attaching screenshot how the message object looks like
has title: Updating a Mock object in Java
score: 1
type: Question
linked to: http://stackoverflow.com/q/19920271
tagged with: mockito
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24257275
answer count: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37292437
comment on: http://stackoverflow.com/q/24162481
has text: If you got a client key from anyone else you should throw it away. It is insecure. You should generate your own private key. Otherwise it cannot perform the function for which it is intended.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/37436567
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24238975
has text: You should use `Matrix` instead of `IMatrix`. Which is the norm: you find `List`, `Map` etc., not `IMap`, `IList`...

http://stackoverflow.com/comment/37306205
comment on: http://stackoverflow.com/q/24168386
has text: The thread is stopped when i leave the activity, i mean that it exist the run function and only then there is an option to leave the activity
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37274587
comment on: http://stackoverflow.com/q/24153328
has text: It is where I add the character to the `charlist`(charlist, charlist2, and charlist3)
score: 0
type: Comment
type: QuestionComment

datetime
tags question: http://stackoverflow.com/q/24186954
tag name: datetime
tags question: http://stackoverflow.com/q/24224272
tags question: http://stackoverflow.com/q/24186801
tags question: http://stackoverflow.com/q/24185803
tags question: http://stackoverflow.com/q/24221524
tags question: http://stackoverflow.com/q/24114155
tags question: http://stackoverflow.com/q/24127356
tags question: http://stackoverflow.com/q/24224696
type: Tag
tags question: http://stackoverflow.com/q/24217408
tags question: http://stackoverflow.com/q/24198906
tags question: http://stackoverflow.com/q/24137067
tags question: http://stackoverflow.com/q/24148429
tags question: http://stackoverflow.com/q/24200938
tags question: http://stackoverflow.com/q/24188756
tags question: http://stackoverflow.com/q/24185673
tags question: http://stackoverflow.com/q/24249346
tags question: http://stackoverflow.com/q/24170456

http://stackoverflow.com/a/24152609
downvote count: 0
upvote count: 1
has body: First of all - you should decide how much memory you can give when starting your program (if you don't have enough memory(RAM), no point running the program if you expect the attachments to be big (66mb shouldn't be an issue). If you have to read the whole document in memory and the size is more than memory allocated to your program, then you can't do anything. It will run out of memory. But - if you can process part of the document and then remove it from memory, then you can load the next part and continue processing.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24152533

http://stackoverflow.com/a/24328673
has body: There is no optimum thread configuration as such. It depends upon your peak / concurrent load requirements which in turn affects your hardware / memory requirements too. What you would want to make sure is that there are enough threads to handle that load within accepted time limits. Running a load testing tool should give you enough inputs to begin with.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24153152
answers question: http://stackoverflow.com/q/24153152
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/24258343
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24258118
downvote count: 1
has body: Everytime I want do download a file, I use this code ( or derviations ) try { URL url; url = new URL("http://YourWebSourceXML.xml"); InputStream in = url.openConnection().getInputStream(); OutputStream out = new FileOutputStream("YourDestFile.xml"); byte[] buffer = new byte[1024]; for (int n;(n = in.read(buffer)) != -1; out.write(buffer, 0, n)); in.close(); out.close(); } catch (IOException e){ // Do something } EDIT: I got this working on first try: try { URL url = new URL("http://www.dnb.no/portalfront/datafiles/miscellaneous/csv/kursliste_ws.xml"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); FileOutputStream fout = new FileOutputStream("x.xml"); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println("Line: " + inputLine); fout.write(inputLine.getBytes()); } fout.close(); in.close(); } catch(Exception e) { e.printStackTrace(); // writeLog("Error fetching from URL: " + e.getMessage()); } Quick and dirty, maybe this will help.
has comment: http://stackoverflow.com/comment/37475248
has comment: http://stackoverflow.com/comment/37475431
has comment: http://stackoverflow.com/comment/37473550
upvote count: 0
has comment: http://stackoverflow.com/comment/37475582
has comment: http://stackoverflow.com/comment/37473484
type: Answer
has comment: http://stackoverflow.com/comment/37475350
has comment: http://stackoverflow.com/comment/37475004
has comment: http://stackoverflow.com/comment/37477465
score: -1
accepted answer of: http://stackoverflow.com/q/24258118

http://stackoverflow.com/a/24193589
downvote count: 0
has comment: http://stackoverflow.com/comment/37351623
upvote count: 1
answers question: http://stackoverflow.com/q/24192998
score: 1
type: Answer
has body: I am not sure if I understood your question correctly but I think you want to start the someMethod() function and then make the caller exit without waiting for someMethod() to finish. This means you are basically branching your execution flow into two, one where the someMethod() running waiting for its due awakening and the other where the caller just continues on(which it will need to do if you want it to finish) after calling someMethod(). To do this you will have to run someMethod() in a separate thread. Something like this. public doSomeStuff() { new Thread(new Runnable() { @Override public void run() { try { new Thread(){ public void run(){ someMethod(); } }.start(); System.out.println("thread finished"); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("thread is going to die"); } }).start(); }

http://stackoverflow.com/a/24228309
has body: edit the line db.execSQL("ALTER TABLE " + DATABASE_TABLE[0] + " ADD COLUMN " + KEY_KIDS + " text not null default kids; "); to db.execSQL("ALTER TABLE " + DATABASE_TABLE[0] + " ADD COLUMN " + KEY_KIDS + " text not null default 'kids'; "); notice the single quote 'kids'. if column is of type string (eg: text, varchar, char), put in quotes, unless the data type of type number (eg: integer, decimal) no quotes needed.
answers question: http://stackoverflow.com/q/24228066
score: 0
type: Answer

http://stackoverflow.com/comment/37205324
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24116326
has text: @ScaryWombat But lot of java files are there. And i don't want change source code. I want sync with repository
type: Comment

http://stackoverflow.com/comment/37218976
type: QuestionComment
has text: It looks like there may be something wrong with your manifest - can you post that?
comment on: http://stackoverflow.com/q/24123935
score: 0
type: Comment

http://stackoverflow.com/q/24180169
has comment: http://stackoverflow.com/comment/37324296
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24277178
has comment: http://stackoverflow.com/comment/37323987
score: 1
has body: Is there a way to get all html5tags with one command instead of doing this? : int h = (doc.getElementsByTag("canvas").size() + doc.getElementsByTag("audio").size() + doc.getElementsByTag("embed").size() + doc.getElementsByTag("source").size() etc.
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26075595
favorite count: 0
type: Question
has title: Get all Html5 Tags using Jsoup?
answer count: 2
has comment: http://stackoverflow.com/comment/37324078
tagged with: jsoup
type: UnansweredQuestion

http://stackoverflow.com/comment/37407983
comment on: http://stackoverflow.com/a/24223877
type: Comment
score: 0
type: AnswerComment
has text: I tried to do like this. I went to `Project Structure [Ctrl+Shift+Alt+s] -> Modules -> Dependencies -> Add (+) -> Library -> Java -> C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 3.1.3\lib\clojure.jar` and chose to add `clojure.jar` as a `Module Library`. And `clojure` appeared in the `External Libraries` of the Project. Was it the correct way?

http://stackoverflow.com/q/24198504
has answer: http://stackoverflow.com/a/24198535
has answer: http://stackoverflow.com/a/24198711
accepted answer: http://stackoverflow.com/a/24198539
has title: How to cut everything before specific characters
has answer: http://stackoverflow.com/a/24198539
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/24198535
answer count: 3
tagged with: java
tagged with: regex
tagged with: trim
type: Question
has body: Good Morning, I'm new in Java and I'd like to cut this String: "jdbc:hsqldb:mem:testdb" into this: "testdb" I've tryed it with regex, but how I said, I'm new and I don't know the Syntax of regex very good. I tried something like this: databaseName = databaseName.replaceAll("*.:", ""); System.out.println(databaseName); It would be glad if someone could help me. Thank you for your answers
has comment: http://stackoverflow.com/comment/37358962

http://stackoverflow.com/a/24226135
score: 0
type: Answer
has body: Using regexes to solve this is possible, but it is likely to give you a poor (inefficient, hard to understand, hard to maintain, etc) solution. What you have is an informal record structure represented using lines of text. (This is not natural language text, so describing it in terms of "paragraphs" doesn't make sense.) The way to process it is to read it a line at a time and then use Scanner (or equivalent) to parse each line into name value pairs. You just need some simple logic to detect the record boundaries and / or check that they are appearing at the correct place in the input stream.
answers question: http://stackoverflow.com/q/24225871
has comment: http://stackoverflow.com/comment/37422675

jakarta-ee
tags question: http://stackoverflow.com/q/24221358
tags question: http://stackoverflow.com/q/24145374
tags question: http://stackoverflow.com/q/24109509
tags question: http://stackoverflow.com/q/24156069
tags question: http://stackoverflow.com/q/24119701
tags question: http://stackoverflow.com/q/24132991
tags question: http://stackoverflow.com/q/24116760
tags question: http://stackoverflow.com/q/24222276
tags question: http://stackoverflow.com/q/24202480
tags question: http://stackoverflow.com/q/24228903
type: Tag
tags question: http://stackoverflow.com/q/24211021
tags question: http://stackoverflow.com/q/24176569
tags question: http://stackoverflow.com/q/24245439
tags question: http://stackoverflow.com/q/24189944
tags question: http://stackoverflow.com/q/24116222
tags question: http://stackoverflow.com/q/24217448
tags question: http://stackoverflow.com/q/24226131
tags question: http://stackoverflow.com/q/24256803
tags question: http://stackoverflow.com/q/24212981
tags question: http://stackoverflow.com/q/24246502
tags question: http://stackoverflow.com/q/24204923
tags question: http://stackoverflow.com/q/24150521
tags question: http://stackoverflow.com/q/24206634
tags question: http://stackoverflow.com/q/24198928
tags question: http://stackoverflow.com/q/24223103
tags question: http://stackoverflow.com/q/24193487
tags question: http://stackoverflow.com/q/24125303
tags question: http://stackoverflow.com/q/24183862
tags question: http://stackoverflow.com/q/24136880
tags question: http://stackoverflow.com/q/24213199
tags question: http://stackoverflow.com/q/24140528
tags question: http://stackoverflow.com/q/24112859
tags question: http://stackoverflow.com/q/24220932
tags question: http://stackoverflow.com/q/24201349
tags question: http://stackoverflow.com/q/24255793
tags question: http://stackoverflow.com/q/24260144
tags question: http://stackoverflow.com/q/24245629
tags question: http://stackoverflow.com/q/24203574
tags question: http://stackoverflow.com/q/24126463
tags question: http://stackoverflow.com/q/24251119
tags question: http://stackoverflow.com/q/24245393
tags question: http://stackoverflow.com/q/24207684
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/24117040
tags question: http://stackoverflow.com/q/24185032
tags question: http://stackoverflow.com/q/24194638
tags question: http://stackoverflow.com/q/24237735
tags question: http://stackoverflow.com/q/24200448
tags question: http://stackoverflow.com/q/24110700
tags question: http://stackoverflow.com/q/24180314
tags question: http://stackoverflow.com/q/24220397
tags question: http://stackoverflow.com/q/24152752
tags question: http://stackoverflow.com/q/24151016
tags question: http://stackoverflow.com/q/24259984
tags question: http://stackoverflow.com/q/24259172
tags question: http://stackoverflow.com/q/24164084
tags question: http://stackoverflow.com/q/24115646
tags question: http://stackoverflow.com/q/24147548
tags question: http://stackoverflow.com/q/24158613
tags question: http://stackoverflow.com/q/24231384
tags question: http://stackoverflow.com/q/24163478

http://stackoverflow.com/a/24146265
has comment: http://stackoverflow.com/comment/81220005
has comment: http://stackoverflow.com/comment/81219758
answers question: http://stackoverflow.com/q/24139214
type: Answer
has comment: http://stackoverflow.com/comment/37288513
has comment: http://stackoverflow.com/comment/81222014
has comment: http://stackoverflow.com/comment/81219632
has comment: http://stackoverflow.com/comment/81240986
has body: The actual question seems to be: You have interface Fruit class Apple implements Fruit class Banana implements Fruit Then you have a method public String checkFruitColor(List&lt;Fruit&gt; fruit) And you have List&lt;Apple&gt; apples = //something List&lt;Banana&gt; bananas = //something Now, you have made the (common) assumption and List&lt;Apple&gt; is a subclass of List&lt;Fruit&gt; because Apple is a subclass of Fruit. But, that means we could do List&lt;Apple&gt; apples = new ArrayList&lt;Apple&gt;(); List&lt;Fruit&gt; fruits = apples //all good as List&lt;Apple&gt; is a subclass of List&lt;Fruit&gt; fruits.add(new Banana()); //we can add a Banana to a List&lt;Fruit&gt; final Apple apple = apples.get(0); //a List&lt;Apple&gt; will always have apples. OOPS!! So, in fact, a List&lt;Apple&gt; is not related to a List&lt;Fruit&gt; - as far as the compiler is concerned they are completely different. Put in technical terms, List is invariant in its type. In order to make what you have work, you need to tell the compiler that you want a List of some subtype of Fruit but you don't care what. public String checkFruitColor(List&lt;? extends Fruit&gt; fruit) This will allow you to pass your List&lt;Apple&gt; to checkFruitColor and access the items as instances of Fruit. What you cannot do is add() to the list as you do not know what the type of the List is.
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37283408
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/81258854
accepted answer of: http://stackoverflow.com/q/24139214

embedded-jetty
tag name: embedded-jetty
type: Tag
tags question: http://stackoverflow.com/q/24123120

http://stackoverflow.com/comment/37247891
type: QuestionComment
has text: Read (and implement) *all* the recommendations of [When Runtime.exec() won't](http://www.javaworld.com/jw-12-2000/jw-1229-traps.html). That might solve the problem. If not, it should provide more information as to the reason it failed. Then ignore that it refers to `exec` and build the `Process` using a `ProcessBuilder`. Also break a `String arg` into `String[] args` to account for arguments which themselves contain spaces.
type: Comment
comment on: http://stackoverflow.com/q/24131365
score: 0

http://stackoverflow.com/comment/37369686
type: QuestionComment
has text: I ran it several time. O/p was more or less similar. I will try to find a better way to benchmark.
comment on: http://stackoverflow.com/q/24203950
type: Comment
score: 0

http://stackoverflow.com/comment/37197856
score: 0
has text: To convert to dBSPL - I think you want to first convert to Pascals by multiplication - perhaps by lref. Next you need to convert from pascals to dBSPL where `dBSPL = 20*log10(Pa/2e-5)`. It is very unusual and not very useful to look plot a time domain waveform in any dB unit. You probably would be better off plotting it in Pascals.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24110333

http://stackoverflow.com/comment/37489069
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24264493
has text: and when you look at the log at the SQL invoked, rather than treating it like a magic black box?
type: Comment

http://stackoverflow.com/comment/37382987
comment on: http://stackoverflow.com/a/24210384
has text: @user3697171 then you should edit your title so it makes more sense
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24261862
answers question: http://stackoverflow.com/q/24261719
score: 0
has body: Is your package for MountainBike and Bicycle same ? If not import the Bicycle in your MountainBike class. import &lt;bicycle-package&gt;.Bicycle;
type: Answer

http://stackoverflow.com/comment/37237131
comment on: http://stackoverflow.com/q/24133438
type: Comment
score: 0
has text: Have you tried Regex?
type: QuestionComment

http://stackoverflow.com/comment/37490308
comment on: http://stackoverflow.com/a/24252924
type: AnswerComment
has text: you really should use `System.nanoTime()` if you want accurate readings for those shorter times: [Timing](http://stackoverflow.com/questions/180158/how-do-i-time-a-methods-execution-in-java). However, I agree that `getScaledInstance` accounts for my problem. I re-timed it and it does take up almost all the time between timesteps. I think I got .3ms for my `paintComponent` originally by stupidly timing only the `repaint` method, which was being called much more often. So your original answer was right, `getScaledInstance` slowed down both methods, I was just timing incorrectly.
score: 0
type: Comment

http://stackoverflow.com/comment/37484578
score: 0
comment on: http://stackoverflow.com/a/24264436
type: Comment
type: AnswerComment
has text: Thank you for answering the actual question, instead of why a constructor is needed at all, like everyone else.

http://stackoverflow.com/a/24141009
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24140977
downvote count: 0
type: AcceptedAnswer
has body: That's precisely what the source of the ActionEvent is for: public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); System.out.println("Event triggered by " + button.getText()); }
answers question: http://stackoverflow.com/q/24140977
type: Answer
score: 4

http://stackoverflow.com/q/24107914
answer count: 2
has body: I have a 2d array String compressedColors[][], which is filled with numbers between 0 and n(Where n is the number of colors in an image). Now I'm trying to compress my array even more for writing to a file, and one idea I had is replacing consecutive identical elements with some sort of multiplication operator. As in I'd like: compressedColors[0][0]=="1" compressedColors[0][1] == "1" to become compressedColors[0][0]=="2*1" compressedColors[0][1] == "" This would need to happen for large numbers of consecutive idenitcal elements, and I only want the compression to go across the second dimension of the array. If two rows are filled with 0's, I want 2 seperate n*0 values at compressedColors[x][0]. I know this is asking a lot, but any ideas how I could accomplish this? I don't even know where to start... Thanks!
has comment: http://stackoverflow.com/comment/37189033
tagged with: java
has title: A bit of array manipulation
tagged with: compression
has comment: http://stackoverflow.com/comment/37189000
type: Question
has comment: http://stackoverflow.com/comment/37188955
has answer: http://stackoverflow.com/a/24108164
possible better answer: http://stackoverflow.com/a/24108164
has comment: http://stackoverflow.com/comment/37188936
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/37188906
tagged with: arrays
has answer: http://stackoverflow.com/a/24108101
accepted answer: http://stackoverflow.com/a/24108101
has comment: http://stackoverflow.com/comment/37188939
has comment: http://stackoverflow.com/comment/37189162
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/24206569
has comment: http://stackoverflow.com/comment/37377535
tagged with: linux
tagged with: libgdx
has title: LWJGL on Eclipse under Linux (Xubuntu)
has comment: http://stackoverflow.com/comment/37379741
has comment: http://stackoverflow.com/comment/37380043
has comment: http://stackoverflow.com/comment/37377827
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/24206764
answer count: 2
has answer: http://stackoverflow.com/a/24206764
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/37381093
accepted answer: http://stackoverflow.com/a/24210335
tagged with: eclipse
has body: I am using Xubuntu and I have a game project based on LibGDX. Running it under Windows works great. But I have installed Eclipse on Linux and when trying to run the project, I get this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: Native Library /usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/libawt.so already loaded in another classloader at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1931) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1872) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1088) at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67) at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.loadLibraries(Toolkit.java:1650) at java.awt.Toolkit.&lt;clinit&gt;(Toolkit.java:1672) at org.lwjgl.LinuxSysImplementation.&lt;clinit&gt;(LinuxSysImplementation.java:50) at org.lwjgl.Sys.createImplementation(Sys.java:126) at org.lwjgl.Sys.&lt;clinit&gt;(Sys.java:111) at org.lwjgl.openal.AL.&lt;clinit&gt;(AL.java:59) at com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio.&lt;init&gt;(OpenALAudio.java:72) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.&lt;init&gt;(LwjglApplication.java:82) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.&lt;init&gt;(LwjglApplication.java:64) at cz.vilix.main.Desktop.main(Desktop.java:30) I've tried looking this up on the internet, but I got no results. The line 30 (where the error occurs) is the line where I try to run the game: new LwjglApplication(game = new Game(), config);
has answer: http://stackoverflow.com/a/24210335
has comment: http://stackoverflow.com/comment/37379142
type: Question

http://stackoverflow.com/comment/37841193
type: AnswerComment
has text: I personally use this type of iteration in which case I need to remove elements from the array, and I just say list.remove(i--); although I use a list and not an array.
comment on: http://stackoverflow.com/a/24432792
type: Comment
score: 0

http://stackoverflow.com/comment/37470010
score: 0
has text: Have you tried using a debugger? If so, what did you learn from using it?
comment on: http://stackoverflow.com/q/24256463
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37225421
type: QuestionComment
comment on: http://stackoverflow.com/q/24123373
score: 0
type: Comment
has text: This assumes that the client knows the data size in advance which is not the case, as stated in the question.

http://stackoverflow.com/comment/37456232
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24248715
has text: I'll see if this helps. I've been experimenting: if I do everything right, I get the can't obtain InputStream error; if I do something wrong (change the extension to .jnilib but leave the reference to .dylib), I get a Native library not found in resource error. I would assume the native library is corrupt, but I can load it just fine through an Eclipse launch. Starting to wonder if it is a permissions issue?

http://stackoverflow.com/comment/46085847
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24151231
has text: darn, gradle makes me sick!

http://stackoverflow.com/q/24177601
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24178988
has title: Difference between AsyncLogger and AsyncAppender in Log4j2
tagged with: multithreading
tagged with: logging
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24178988
score: 31
upvote count: 31
possible better answer: http://stackoverflow.com/a/35291928
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/35291928
has body: I have understanding that AsyncAppender do the appending job in a separate thread. They use ArrayBlockingQueue for this purpose. AND AsyncLogger uses LMAX disruptor library to move logging event from one application thread to the other thread and it is faster as compared to AsyncAppender. My question is why do we have AsyncAppender in log4j2 if the job it does is achieved by AsyncLogger more efficiently. What if we use AsyncAppender along with AsyncLogger ? Are there any more differences between AsyncLogger and AsyncAppender?
tagged with: log4j
tagged with: log4j2

http://stackoverflow.com/a/24142768
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24116962
has body: Had the same Problem. This solved it for me: Why is my embedded h2 program writing to a .mv.db file Just added ;MV_STORE=FALSE and ;MVCC=FALSE to the jdbc url and everything worked just fine.
upvote count: 9
score: 9
has comment: http://stackoverflow.com/comment/71540505

http://stackoverflow.com/comment/37248128
has text: asked, again hint (your answer is wrong add Renderer at runtime) this is job for [XxxTableModel](http://stackoverflow.com/questions/16814512/tablecellrenderer-and-how-to-refresh-cell-background-without-using-jtable-repain), resp. floating/variable params in Renderer
type: Comment
comment on: http://stackoverflow.com/a/24137030
score: 0
type: AnswerComment

http://stackoverflow.com/q/24234036
tagged with: java
tagged with: image
has answer: http://stackoverflow.com/a/24234572
has title: trying to upload a image to my server from android
tagged with: apache
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has body: am using this code to upload an image to my web server: public void send (View view) { HttpURLConnection connection = null; DataOutputStream outputStream = null; DataInputStream inputStream = null; String pathToOurFile = "sdcard/yo.jpg"; String urlServer = "http://192.168.1.4/uplaod.php"; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; try { FileInputStream fileInputStream = new FileInputStream(new File(pathToOurFile)); URL url = new URL(urlServer); connection = (HttpURLConnection) url.openConnection(); // Allow Inputs &amp; Outputs connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); // Enable POST method connection.setRequestMethod("POST"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); outputStream = new DataOutputStream(connection.getOutputStream()); outputStream.writeBytes(twoHyphens + boundary + lineEnd); outputStream.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + pathToOurFile + "\"" + lineEnd); outputStream.writeBytes(lineEnd); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; // Read file bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead &gt; 0) { outputStream.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } outputStream.writeBytes(lineEnd); outputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); // Responses from the server (code and message) int serverResponseCode = connection.getResponseCode(); String serverResponseMessage = connection.getResponseMessage(); fileInputStream.close(); outputStream.flush(); o…
type: UnansweredQuestion
score: 1
tagged with: android

http://stackoverflow.com/comment/38073716
comment on: http://stackoverflow.com/a/24577343
type: AnswerComment
has text: The framework is basically an extension to the Oracle javac which can be used for extra source code checking.
score: 0
type: Comment

http://stackoverflow.com/q/24237015
has answer: http://stackoverflow.com/a/24237267
upvote count: 2
type: AnsweredQuestion
score: 2
has body: When i create a servlet filter in Spring MVC, I am getting the following exception. [javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed] with root cause when i put the sysout i could understand that the exception occurs at the redirect line, but didn't understand why can anyone please tell me some solution for this SessionFilter.java public class SessionFilter implements Filter { private ArrayList<String> urlList; @Override public void destroy() { } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; String url = request.getServletPath(); boolean allowedRequest = false; if(urlList.contains(url)) { allowedRequest = true; } if (!allowedRequest) { HttpSession session = request.getSession(false); if (null == session) { System.out.println("preparing for redirect"); response.sendRedirect("index.jsp"); } } chain.doFilter(req, res); } @Override public void init(FilterConfig config) throws ServletException { System.out.println("entered init"); String urls = config.getInitParameter("avoid-urls"); StringTokenizer token = new StringTokenizer(urls, ","); urlList = new ArrayList<String>(); while (token.hasMoreTokens()) { urlList.add(token.nextToken()); } } web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> SpringMVCHibernate index.jsp dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher *.do 1 SessionFilter com.common.dao.SessionFilter avoid-urls index.jsp SessionFilter /* : : :
answer count: 2
downvote count: 0
tagged with: java
has title: getting IllegalStateException within the doFilter method
has comment: http://stackoverflow.com/comment/37432899
accepted answer: http://stackoverflow.com/a/24237267
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24237990
possible better answer: http://stackoverflow.com/a/24237990
tagged with: servlet-filters
tagged with: spring

http://stackoverflow.com/q/24139896
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24139978
tagged with: regex
has answer: http://stackoverflow.com/a/24139978
has title: How to detect IP adress in ping string using regex
type: AnsweredQuestion
downvote count: 0
answer count: 1
has body: String s = "PING www.google.com (173.194.70.106) 56(84) bytes of data." boolean z = pattern.matches("\\(([0-9]{1,3}\\.){3}[0-9]{1,3}\\)", s); z will be 0. Where am I making a mistake given that the sequence that I am trying to detect is (X.X.X.X) so for s that would be (173.194.70.106)? egrep -e "\(([0-9]{1,3}\.){3}[0-9]{1,3}\)" test gives the desired result so I assume it's a problem between me and java.
upvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/37276325
score: 1
type: Comment
type: QuestionComment
has text: you are running network operation on the ui thred. Use thread or asynctask or volley.
comment on: http://stackoverflow.com/q/24154372

http://stackoverflow.com/q/24241014
type: UnansweredQuestion
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37480143
has title: Play! Extending play.data.Form
tagged with: playframework-2.1
has comment: http://stackoverflow.com/comment/37451828
answer count: 0
tagged with: playframework
has comment: http://stackoverflow.com/comment/37482158
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37471364
type: Question
has body: I am trying to extend play.data.Form in Play 2.1 to add this method: public List&lt;ValidationError&gt; fieldErrors() This is because in some pages I want to just combine all field errors added by play.data.validation.Constraints at the top/bottom of page. Has anybody extended play.data.Form? I am having trouble because the bindForRequest() method seems to return a new Form() instead of populating the existing object, which is making sub-classing non-trivial. Play code here: https://github.com/playframework/playframework/blob/master/framework/src/play-java/src/main/java/play/data/Form.java#L306 Maybe I am doing this wrong?

http://stackoverflow.com/q/24249239
has comment: http://stackoverflow.com/comment/37462970
has comment: http://stackoverflow.com/comment/37463345
has comment: http://stackoverflow.com/comment/37462451
type: Question
has comment: http://stackoverflow.com/comment/37463456
has comment: http://stackoverflow.com/comment/37463297
has comment: http://stackoverflow.com/comment/37463067
tagged with: android
tagged with: java
tagged with: io
tagged with: outputstream
has title: Restart File writing after certain number of lines
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: file
has body: I'm working in Android trying to write some lines into a file. After a certain amount of lines, say 100, I want the file to delete the first line, and then append a line to the end. So basically, I want to keep writing to the file but keep the limit at 100 lines. I have been reading and found the files in java aren't to friendly with what I'm trying to do. I haven't found anything here either http://docs.oracle.com/javase/tutorial/essential/io/file.html Is there a better way of keeping a file to the limit of 100 lines, and deleting the oldest lines when adding the new lines after that? More specifically, I want a textView to display the 100 most recent events that a service has sent. As of now, I have this method to display my STORETEXT file, public void readFileInEditor() { try { InputStream in = openFileInput(STORETEXT); if (in != null) { InputStreamReader tmp = new InputStreamReader(in); BufferedReader reader = new BufferedReader(tmp); String str; StringBuilder buf = new StringBuilder(); while ((str = reader.readLine()) != null) { buf.append(str + "\n"); } in.close(); writelog.setText(buf.toString()); } } catch (java.io.FileNotFoundException e) { // that's OK, we probably haven't created it yet } catch (Throwable t) { Toast.makeText(this, "Exception: " + t.toString(), Toast.LENGTH_LONG).show(); } } and I write to the file like this... OutputStreamWriter out = new OutputStreamWriter(openFileOutput( STORETEXT, MODE_APPEND)); out.write("Some User Activity"); out.write("\n"); out.close(); I want to modify my code to only write the 100 most recent activities, and then set that to my textView. Thanks for any help.
has comment: http://stackoverflow.com/comment/37463265

http://stackoverflow.com/comment/37236230
score: 0
has text: have you tried "Clean Tomcat Work Directory". This will re-publish frm scratch.
comment on: http://stackoverflow.com/q/24132781
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24111557
has title: About Android Frameworks, UI design, and tips
answer count: 2
tagged with: twitter-bootstrap
tagged with: user-interface
has comment: http://stackoverflow.com/comment/37196343
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24112059
score: 0
has body: Is there some native android framework that uses only java? Example: create buttons, text fields, containers, ext. And my biggest problem is with the design. I would like to know if is there any framework that facilitates apply styles to buttons, fields, layers, etc? Like twitter bootstrap, but only in java. I do not want html and css frameworks .. I used the phonegap and is very slow compared to native app. I should use Framework or create my own code?
has answer: http://stackoverflow.com/a/24112059
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/24112030
has answer: http://stackoverflow.com/a/24112030
type: Question

http://stackoverflow.com/q/24115021
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24115084
upvote count: 8
has answer: http://stackoverflow.com/a/24115246
tagged with: casting
has answer: http://stackoverflow.com/a/24115074
downvote count: 2
score: 6
answer count: 6
has answer: http://stackoverflow.com/a/24115075
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28184895
accepted answer: http://stackoverflow.com/a/24115129
has answer: http://stackoverflow.com/a/24115084
tagged with: java
has title: Casting int to Object on java
has answer: http://stackoverflow.com/a/24115129
has body: I have a question: I work in environment of Eclipse. Sometimes the computer does not give to the following casting: int a ... Object ans = (int) a; But only this conversion: int a ... Object ans = (Integer) a; I understand why you can do the casting between Object to Integer, but why primitive variable - there are times when you can, and there are times you can not do a casting? Thank you I am attaching the code which the compiler not let me make casting between int variable to object: /** @return minimum element */ public Object minimum(){ return minimum(this.root); } public Object minimum(BSTNode node){ if (node.left != null) return minimum(node.left); return node.data; } /** @return maximum element */ public Object maximum(){ return maximum(this.root); } public Object maximum(BSTNode node){ if (node.right != null) return maximum(node.right); return node.data; } public Object findNearestSmall(Object elem) { int diff; diff = (int)maximum() - (int)minimum(); if (compare(minimum(), elem) == 0) return elem; else return findNearestSmall(elem, this.root, diff); } public Object findNearestSmall(Object elem, BSTNode node, int mindiff){ if(node == null) return (int)elem - mindiff; int diff = (int)elem - (int)node.data; if(diff &gt; 0 &amp;&amp; mindiff &gt; diff) mindiff = diff; /* Case 2 : Look for in left subtree */ if(compare(node.data, elem)&gt;-1) return findNearestSmall(elem, node.left, mindiff); else /* Case 3 : Look for in right subtree */ return findNearestSmall(elem, node.right, mindiff); }

http://stackoverflow.com/q/24134978
tagged with: jfilechooser
favorite count: 0
tagged with: mouse-cursor
type: Question
has comment: http://stackoverflow.com/comment/37272241
has comment: http://stackoverflow.com/comment/37273184
has title: How do you put the mouse cursor over the OPEN button on a JFileChooser?
tagged with: swing
has comment: http://stackoverflow.com/comment/37239744
upvote count: 2
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37240054
downvote count: 0
has body: I'm trying to snap my mouse cursor over the approve button by default on a JFileChooser but I cannot find any examples anywhere where this has been done before. I have tried using hard coded x,y positions but this is useless when I run my application on a different pc. Any help would be appreciated, my code is as follows: FileOpenDialog fileChooser = new FileOpenDialog(index); fileChooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { } }); // Need to snap mouse cursor to OPEN button here somehow or within overidden // method of showOpenDialog??? int returnVal = fileChooser.showOpenDialog(mainFrame); System.out.println("Return Value is " + returnVal); if (returnVal == FileOpenDialog.APPROVE_OPTION) { setFileIndex(index); setInputFile(fileChooser.getSelectedFile()); } class FileOpenDialog extends JFileChooser { public String fileName; public String dialogTitle; public FileOpenDialog(int index) { initComponent(index); } private void initComponent(int index) { setBackground(Color.lightGray); setAcceptAllFileFilterUsed(false); CustomFileFilter myFilter = new CustomFileFilter(); setFileFilter(myFilter); switch (index) { case 0: setFileName("\\MelbCupHorses.txt"); setDialogTitle("Please Choose Horses File"); break; case 1: setFileName("\\MelbCupEntrants.txt"); setDialogTitle("Please Choose Employees File"); break; } System.out.println(getCurrentDirectory().toString() + fileName); File file = new File(getCurrentDirectory().toString() + fileName); setSelectedFile(file); } /** * @return the dialogTitle */ @Override public String getDialogTitle() { return dialogTitle; } /** * @param dialogTitle the dialogTitle to set */ @Override public void setDialogTitle(String dialogTitle) { this.dialogTitle = dialogTitle; } } Thanking you.
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24135173
accepted answer: http://stackoverflow.com/a/24135173

http://stackoverflow.com/q/24213504
tagged with: datefield
answer count: 0
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
has title: PopupDateField Listener
has body: I've got a PopupDateField with a ValueChangeListener. Is there a way to differentiate if the Event was fired from an .setValue()-Call or an User-Input? I want the Event to be excuted only if the user changes the value, not if it was changed by program. I've made a dirty Workaround by removing the ValueChangListener before setting a new Value and adding it afterwards, but I'm thankfull for better solutions... private static void setDateFieldValue(final PopupDateField dateField, Date value) { Collection&lt;Property.ValueChangeListener&gt; listeners = (Collection&lt;Property.ValueChangeListener&gt;)dateField.getListeners(Property.ValueChangeEvent.class); listeners.forEach(new Consumer&lt;Property.ValueChangeListener&gt;() { @Override public void accept(Property.ValueChangeListener listener) { dateField.removeValueChangeListener(listener); } }); dateField.setValue(value); listeners.forEach(new Consumer&lt;Property.ValueChangeListener&gt;() { @Override public void accept(Property.ValueChangeListener listener) { dateField.addValueChangeListener(listener); } }); }
type: Question
tagged with: java
tagged with: vaadin7
type: UnansweredQuestion
tagged with: listener

http://stackoverflow.com/comment/37309546
has text: Oops, `clazz` was my fault. `class` was initially used, so I changed it before anyone complained about bad syntax. Should I change it?
type: AnswerComment
comment on: http://stackoverflow.com/a/24172037
score: 0
type: Comment

http://stackoverflow.com/q/24264350
has comment: http://stackoverflow.com/comment/37492200
tagged with: c3p0
has answer: http://stackoverflow.com/a/24268483
has title: C3P0 settings is ambiguous
score: 0
has comment: http://stackoverflow.com/comment/37511022
has body: I work at distributed system with multiple servers working with front MySQL DB, and replicated DB in different various of queries. Several servers use of compounds up to 1000 connections (700 - 800, 900 in hard times). Periodically I have the problem with closed connection by MySQL and see already boring exception: The last packet sent successfully to the server was 65,179,696 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. MySQL settings of wait_timeout is default and equals 28800 (8 hours) I use C3P0 paired with hibernate for service my connections to MySQL and have next C3P0 settings on all servers in all hibernate-custom*.xml: &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLInnoDBDialect&lt;/property&gt; &lt;property name="hibernate.current_session_context_class"&gt;org.hibernate.context.ThreadLocalSessionContext&lt;/property&gt; &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://xxx.xxx.xxx.xxx:3306/ibaserver?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=cp1251&amp;amp;zeroDateTimeBehavior=convertToNull&lt;/property&gt; &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="hibernate.connection.username"&gt;username&lt;/property&gt; &lt;property name="hibernate.connection.password"&gt;********&lt;/property&gt; &lt;property name="hibernate.connection.provider_class"&gt;org.hibernate.connection.C3P0ConnectionProvider&lt;/property&gt; &lt;property name="hibernate.transaction.factory_class"&gt;org.hibernate.transaction.JDBCTransactionFactory&lt;/property&gt; &lt;property name="hibernate.c3p0.min_size"&gt;5&lt;/property&gt; &lt;property name="hibernate.c3p0.max_size"&gt;50&lt…
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
tagged with: connection-pooling
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/37209617
comment on: http://stackoverflow.com/a/24114495
type: Comment
type: AnswerComment
has text: // clears the equipidtext EditText field private void clearText((ViewGroup)group2); { for (int m = 0, count = group.getChildCount(); m < count; ++m) { View view2 = group2.getChildAt(i); if (view2 instanceof EditText) { ((EditText)view2).setText(""); ViewGroup view2; if(view2 instanceof ViewGroup && (((ViewGroup)view2).getChildCount() > 0)) clearText((ViewGroup)group2); } } } });
score: 0

http://stackoverflow.com/comment/37478950
comment on: http://stackoverflow.com/q/24261326
has text: @JonSkeet I'm not comparing Hashtable! wanted to know whether Hashtable works effectively when it has got more records as I posted. And will be good if there are any alternatives to Hashtable to use.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37297006
comment on: http://stackoverflow.com/q/24165361
has text: just change the text in the edit text field and press you TRAD button again
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24199903
answers question: http://stackoverflow.com/q/24192842
type: Answer
upvote count: 4
score: 4
downvote count: 0
has body: If you would like the server to handle the updates (push instead of pull), you can use WebSockets, as can be seen here: http://wicketinaction.com/2012/07/wicket-6-native-websockets/

http://stackoverflow.com/a/24201015
has body: array.length is 10, but last index in array is 9, because array index start from 0. The stop condition in your for loop should be i&lt;=array.length-1 if you want to loop through entire array.
downvote count: 0
answers question: http://stackoverflow.com/q/24200949
type: Answer
score: 4
upvote count: 4

oracle-database
tags question: http://stackoverflow.com/q/24118882
tags question: http://stackoverflow.com/q/24116476
tags question: http://stackoverflow.com/q/24209345
tags question: http://stackoverflow.com/q/24168012
tags question: http://stackoverflow.com/q/24123649
tags question: http://stackoverflow.com/q/24197610
tags question: http://stackoverflow.com/q/24181906
tags question: http://stackoverflow.com/q/24126902
tags question: http://stackoverflow.com/q/24259101
tag name: oracle-database
tags question: http://stackoverflow.com/q/24169823
tags question: http://stackoverflow.com/q/24238188
tags question: http://stackoverflow.com/q/24118935
tags question: http://stackoverflow.com/q/24156838
tags question: http://stackoverflow.com/q/24242715
tags question: http://stackoverflow.com/q/24228580
tags question: http://stackoverflow.com/q/24136223
tags question: http://stackoverflow.com/q/24136899
tags question: http://stackoverflow.com/q/24157194
type: Tag
tags question: http://stackoverflow.com/q/24113021
tags question: http://stackoverflow.com/q/24247515
tags question: http://stackoverflow.com/q/24247050
tags question: http://stackoverflow.com/q/24136221
tags question: http://stackoverflow.com/q/24259152
tags question: http://stackoverflow.com/q/24198153
tags question: http://stackoverflow.com/q/24257385
tags question: http://stackoverflow.com/q/24127012
tags question: http://stackoverflow.com/q/24202576
tags question: http://stackoverflow.com/q/24127568

http://stackoverflow.com/q/24123381
answer count: 1
has answer: http://stackoverflow.com/a/24124457
type: Question
tagged with: rotation
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: android-bitmap
has body: I was trying to implement a feature where a user can rotate a picture. I thought of using the RotateAnimation for it like so: rotateRight.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { //create a new bitmap that is rotated 90 deg Matrix mat = new Matrix(); mat.postRotate(90);//90 degree rotation right Bitmap bMapRotate = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), mat, true);//create a new bitmap with the rotated angle bmp = bMapRotate; //save the rotated bitmap as the bitmap that will be uploaded RotateAnimation rotateAnim = new RotateAnimation(0f, 90f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnim.setDuration((long)100); rotateAnim.setRepeatCount(0); rotateAnim.setFillAfter(true);//maintains the rotation previewImage.startAnimation(rotateAnim); previewImage.setImageBitmap(bmp);//set the bitmap to the rotated one (if I don't do this, the animation will always start from the initial position } }); However, when I do this the picture rotates two times the first time the button is clicked. Every time after that the picture rotates properly. Another thing to note is that the picture saved in bmp has the right rotation is 90deg off what the ImageView (previewImage) is showing Let me know if I can give you guys any further details.
has title: RotateAnimation rotates two times instead of just once
tagged with: android-imageview
score: 0

http://stackoverflow.com/q/24136923
tagged with: java
has answer: http://stackoverflow.com/a/24136976
tagged with: maven
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/37243387
type: Question
has answer: http://stackoverflow.com/a/24137632
has title: Tomcat server 404
type: UnansweredQuestion
has body: I have a project using Maven3 to run on Tomcat 7. Tomcat is running and the maven project successfully deployed to tomcat; however when I visit my project link http://localhost:8080/myWebApp I get a 404 error. I am wondering if I have to log in to tomcat first? I am quite new to this set up so excuse my ignorance if I am missing something obvious. EDIT My localhost log Jun 10, 2014 10:51:39 AM org.apache.catalina.core.StandardContext listenerStart SEVERE: Error configuring application listener of class org.apache.catalina.deploy.ApplicationListener@c9d8da8 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runW…
tagged with: http-status-code-404
score: 0
linked to: http://stackoverflow.com/q/6210757
answer count: 2

http://stackoverflow.com/q/24230612
tagged with: jaxb
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37420248
has body: i want to create xml file in java with following format. title data data by using the following code i am getting output like. desc key alt table td title tr import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Xml { String title,desc,key,link,table,tr,td; public String getTitle() { return title; } @XmlElement public void setTitle(String title) { this.title = title; } public String getDescription() { return desc; } @XmlElement public void setDescription(String desc) { this.desc = desc; } public String getKeywords() { return key; } @XmlElement public void setKeywords(String key) { this.key = key; } public String getLinktext() { return link; } @XmlElement public void setLinktext(String link) { this.link = link; } public String getTable() { return table; } @XmlElement public void setTable(String table) { this.table = table; } public String getTr() { return tr; } @XmlElement public void setTr(String tr) { this.tr = tr; } public String getTd() { return td; } @XmlElement public void setTd(String td) { this.td = td; } } jaxbMarshaller.marshal(xml, file); jaxbMarshaller.marshal(xml, System.out); but the above code giving output like this. but how to create child node after root node. means in xml tag only i want to create table as child and under the table node i want to create a row as child node to table node. how to do this.
score: 0
has answer: http://stackoverflow.com/a/24231362
tagged with: java
has title: creating xml file in java using jaxb
answer count: 1

http://stackoverflow.com/comment/41518909
comment on: http://stackoverflow.com/a/24220688
has text: @ingyhere Programmatically configuring Log4j2 is indeed a separate question. This log4j2 manual page may be a good starting point to find out more: http://logging.apache.org/log4j/2.x/manual/customconfig.html#AddingToCurrent Otherwise you may want to ask a new question.
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24245748
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24168154
upvote count: 8
type: Answer
has body: It turns out that I had multiple incorrect imports. I was accidentally importing another libraries implementation of Gson's JsonDeserializer, which caused the code to compile, but fail the instanceof conditional. smh
score: 8
answers question: http://stackoverflow.com/q/24168154
type: AcceptedAnswer

http://stackoverflow.com/a/24189110
has body: What you are trying to achieve is called unique snapshots (see below). Using patch versions of semver for that is wrong (Patch version is the third number, e.g. in 10.0.3 3 is the patch version). When working with Maven (or Gradle, or Ivy) and Artifactory, you have this feature out of the box. You need to set Artifactory repository to work with unique snapshots in repository settings and setup snapshots cleaning (usually keeping 3 to 5 last snapshots is a good practice).
downvote count: 0
has comment: http://stackoverflow.com/comment/37768442
answers question: http://stackoverflow.com/q/24166067
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37488365
type: Answer
has comment: http://stackoverflow.com/comment/37488704

highlight
tags question: http://stackoverflow.com/q/24200568
type: Tag
tag name: highlight

http://stackoverflow.com/comment/37230122
type: Comment
type: QuestionComment
score: 0
has text: Is this a valid URL: `http://:8095/crowd` ?
comment on: http://stackoverflow.com/q/24129516

http://stackoverflow.com/comment/37218377
type: AnswerComment
score: 0
has text: I'd like to know any such methods available for animations.
type: Comment
comment on: http://stackoverflow.com/a/24119235

http://stackoverflow.com/q/24152678
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: JSON character encoding in javascript different from java
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24152844
upvote count: 1
tagged with: unicode
has comment: http://stackoverflow.com/comment/37273713
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37273597
tagged with: javascript
has body: the java code below JSONObject obj = new JSONObject(); try{ obj.put("alert","•é"); byte[] test = obj.toString().getBytes("UTF-8"); logger.info("bytes are"+ test); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); }; produces a JSONObject which escapes the bullet character, but not the latin letter e with grave, e.g ""•é", the byte code is [123, 34, 97, 108, 101, 114, 116, 34, 58, 34, 92, 117, 50, 48, 50, 50, -61, -87, 34, 125] How can get I the same exact output in Javascript (in terms of byte sequence)? I don't understand why JSONObject is only escaping one character but not the other. I don't know what rule it followed. It seems in javascript I can only either escape everything other than the ASCII, (eg.-) or don't escape at all. Thanks!
has comment: http://stackoverflow.com/comment/37273803
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37274151
accepted answer: http://stackoverflow.com/a/24152844
score: 1

http://stackoverflow.com/a/24195155
accepted answer of: http://stackoverflow.com/q/24188992
has comment: http://stackoverflow.com/comment/37448232
answers question: http://stackoverflow.com/q/24188992
type: AcceptedAnswer
upvote count: 7
has body: This is most likely a network management, change / configuration management or general system administration problem rather than a programming problem. It was working before without adding that entry but all of a sudden it stopped working. One approach is to try to figure out what changed to cause it to stop working. This is not the kind of thing that would happen spontaneously. Someone or something has changed some software or configurations to make this happen. Start with when it stopped (or when you noticed) and work back through your change logs. It sounds like it is an issue with the Java DNS resolution procedure. It appears that the resolver is either not trying to talk to the normal DNS servers, or it is trying and failing. We can't debug it for you, but I found these resources that help to explain what should be happening when you do a name lookup in Java, and offer some ideas on trouble-shooting. Resources: DNS and Java Java doesn't pick up system's DNS settings change until restarted Java and /etc/resolv.conf DNS server failover Java networking properties
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37488040
score: 6

http://stackoverflow.com/comment/37412660
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24226443
type: Comment
has text: hmm now it is unable to find the symbol list in the for each loop.

http://stackoverflow.com/q/24257208
type: Question
has answer: http://stackoverflow.com/a/24258642
tagged with: testing
has title: The Android Emulator is not working well
tagged with: android
has comment: http://stackoverflow.com/comment/37471522
has answer: http://stackoverflow.com/a/24313710
has body: I am new in Eclipse Android I have made a sample calculator but when I wanted to test it in the emulator it didn't worked fine `[2014-06-17 01:19:23 - SampleCalculator] ------------------------------ [2014-06-17 01:19:23 - SampleCalculator] Android Launch! [2014-06-17 01:19:23 - SampleCalculator] adb is running normally. [2014-06-17 01:19:23 - SampleCalculator] Performing com.zain.sampleCalculator.MainActivity activity launch [2014-06-17 01:19:24 - SampleCalculator] Automatic Target Mode: launching new emulator with compatible AVD 'Test_Nexus' [2014-06-17 01:19:24 - SampleCalculator] Launching a new emulator with Virtual Device 'Test_Nexus' [2014-06-17 01:20:11 - SampleCalculator] New emulator found: emulator-5554 [2014-06-17 01:20:11 - SampleCalculator] Waiting for HOME ('android.process.acore') to be launched... [2014-06-17 01:23:30 - SampleCalculator] HOME is up on device 'emulator-5554' [2014-06-17 01:23:30 - SampleCalculator] Uploading SampleCalculator.apk onto device 'emulator-5554' [2014-06-17 01:23:32 - SampleCalculator] Installing SampleCalculator.apk... [2014-06-17 01:25:44 - SampleCalculator] Failed to install SampleCalculator.apk on device 'emulator-5554! [2014-06-17 01:25:44 - SampleCalculator] (null) [2014-06-17 01:25:44 - SampleCalculator] Launch canceled! [2014-06-17 09:27:56 - SDK Manager] Created AVD '16GB_Nexus' based on Android 4.4.2, ARM (armeabi-v7a) processor, [2014-06-17 09:27:56 - SDK Manager] with the following hardware config: [2014-06-17 09:27:56 - SDK Manager] disk.dataPartition.size=200M [2014-06-17 09:27:56 - SDK Manager] hw.accelerometer=yes [2014-06-17 09:27:56 - SDK Manager] hw.audioInput=yes [2014-06-17 09:27:56 - SDK Manager] hw.battery=yes [2014-06-17 09:27:56 - SDK Manager] hw.camera.back=none [2014-06-17 09:27:56 - SDK Manager] hw.camera.front=none [2014-06-17 09:27:56 - SDK Manager] hw.dPad=no [2014-06-17 09:27:56 - SDK Manager] hw.device.hash2=MD5:6930e145748b87e87d3f40cabd140a41 [2014-06-17 09:27:56 - SDK Manager] hw.device.…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37471925
tagged with: android-emulator
has comment: http://stackoverflow.com/comment/37474045
answer count: 2
downvote count: 0
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: java
favorite count: 0

http://stackoverflow.com/comment/37236479
type: QuestionComment
comment on: http://stackoverflow.com/q/24133093
has text: Post you logcat here.
score: 1
type: Comment

http://stackoverflow.com/a/24245663
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24245367
has body: You can use the interface and create wrappers for each component type you need. JTextFieldSupportWrapper and JComboboxSupportWrapper both taking an instance of the wrapped object type and and delegating to the addActionListener methods. abstract class ActionListenerSupportWrapper&lt;T extends JComponent&gt; implements ActionListenerSupport { protected final T comp; protected ActionListenerSupportWrapper(T comp) { this.comp = comp; } } // for each supported component type class JTextFieldSupportWrapper extends ActionListenerSupportWrapper&lt;JTextField&gt; { void addActionListener(ActionListener l) { comp.addActionListener(l); } } Now you could declare a map using the interface ActionListenerSupport and add wrapped instances into that map i'll take a list for now. List&lt;ActionListenerSupport&gt; l = // init JTextField tf = // lookup l.add(new JTextFieldSupportWrapper(tf)); hope this helps I think this post can be improved with reflection not having to create the subtypes on your own. But may be you loose some type safety at compile time.
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24245367

http://stackoverflow.com/comment/37628747
comment on: http://stackoverflow.com/a/24217481
score: 0
type: Comment
type: AnswerComment
has text: need a little help, now i want to run my application with tomcat server, but facing this error "FAIL-Application at context path /my_app could not be started" ...

http://stackoverflow.com/comment/37510015
type: Comment
type: QuestionComment
has text: The problem does not occur in this snippet because it's in line 657. In the original code, there must be some observers being attached, and when these are alerted due to the change, somehting breaks when dispatching. Post code that REALLY demonstrates the problem.
score: 0
comment on: http://stackoverflow.com/q/24258683

http://stackoverflow.com/a/24178424
accepted answer of: http://stackoverflow.com/q/24178410
has body: String str= new String("abc").intern() // calling intern() will add the String object to the String pool.
answers question: http://stackoverflow.com/q/24178410
has comment: http://stackoverflow.com/comment/37321307
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37320923
downvote count: 0
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37320948
has comment: http://stackoverflow.com/comment/37320920
type: Answer
has comment: http://stackoverflow.com/comment/37321085
has comment: http://stackoverflow.com/comment/37321018

http://stackoverflow.com/comment/37368110
type: AnswerComment
comment on: http://stackoverflow.com/a/24162969
type: Comment
has text: If your application is Spring-based and you are using the org.springframework.scheduling.quartz.SchedulerFactoryBean, then you can simply have this bean injected into any of your Spring beans. Otherwise, you will have to cache the Scheduler somewhere in the code that constructs it and starts it and expose it through a getter.
score: 0

http://stackoverflow.com/a/24214001
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24213252
type: Answer
score: 2
has body: Yes, you should use a service, in particular a foreground service (to show a notification as the upload progresses). Additionally, a foreground service is not likely to be killed by Android: ... the system considers it to be something the user is actively aware of and thus not a candidate for killing when low on memory. For downloads, Android provides a ready-made solution called DownloadManager. It already includes the capability to resume downloads in case the connection is lost. For uploads, there is no equivalent (at least as far as I know). You would have to roll out your own solution, probably involving the Content-Range HTTP header. It depends a lot on your server, for example Google Drive has an API for this. Also take a look at Resume file upload/download after lost connection (Socket programming) (although it's with sockets, the concepts are more or less the same). Another options is to use a SyncAdapter for this task. See Transferring Data using Sync Adapters. I'm not sure if this supports resuming though.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24213252

http://stackoverflow.com/comment/37440281
comment on: http://stackoverflow.com/q/24241045
score: 1
type: Comment
type: QuestionComment
has text: To have connection release etc. you need a transaction manager and you really should have managed transactions even if your updates are simple. It isn't the database layer that should be transactional but your service layer that should drive the transactions.

http://stackoverflow.com/q/24116082
has title: Ant use old jdk - how to change it?
has answer: http://stackoverflow.com/a/57074838
favorite count: 0
type: Question
has body: I have eclipse indigo (3.7.2) on Ubuntu 12.04 64 bit and I try to compile project using java 1.7. I think I have installed java 1.7 properly because, I can run processing 2.0 (which use java 1.7) and I get correct version message: prokop@prokop-Precision-T1500:~$ java -version java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode) however, when hit "play" in Ant in eclipse I get following message: Unsupported major.minor version 51.0 also in header caption of "Console" window of ant build output is : [Ant Build] /usr/lib/jvm/java-6-openjdk/bin/java I tried to modify environment settings of eclipse: Project > Properties > Java Compiler to 1.7 Window > Prefferences > Java > Installed JREs to jdk1.7._60 which I downloaded to my home /home/prokop/SW/jdk1.7.0_60 but it does not help - ant is oviously still using java-6-openjdk Is there any other setting how to say Ant to use jdk1.7 ? Is it possible at all to make eclipse indigo (3.7.2) on Ubuntu 12.04 64 bit force to compile with java 1.7 ?
score: 3
tagged with: ant
has answer: http://stackoverflow.com/a/24116557
accepted answer: http://stackoverflow.com/a/24116557
has answer: http://stackoverflow.com/a/24116115
possible better answer: http://stackoverflow.com/a/24116115
tagged with: eclipse
answer count: 4
has comment: http://stackoverflow.com/comment/37205169
type: AnsweredQuestion
upvote count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/24116149
tagged with: java

http://stackoverflow.com/comment/37207465
has text: My JAVA_HOME variable was not set, I set it to `/usr/lib/jvm/jdk1.7.0/bin/java` and also put `/usr/lib/jvm/jdk1.7.0/bin/` into PATH according to this http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/ but it does not helped. Just indika's recomandation to set eclipse External Tools Configuration JRE solved the problem
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24116115

http://stackoverflow.com/q/24161167
type: Question
answer count: 0
type: UnansweredQuestion
tagged with: desktop-application
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/37288004
score: 0
has comment: http://stackoverflow.com/comment/37288151
tagged with: java
has title: Run Application in background
has body: What is the best way to run an eclipse RPC application in background? I want to run an application without user awareness, doing some processes and closing application. Is it possible to run it without displaying UI? Should I create a new product?
has comment: http://stackoverflow.com/comment/37288063

http://stackoverflow.com/comment/37319242
type: QuestionComment
comment on: http://stackoverflow.com/q/24177059
has text: @Phil indicate line 82
score: 0
type: Comment

http://stackoverflow.com/comment/37354393
type: Comment
type: QuestionComment
has text: If you mean that you want a newline character `\n`, to appear, literally, as `\n` rather than your text being split, then you have to find the character `\n` (not the string) in your read string and replace it with the two characters ``\`` and `n`.
score: 0
comment on: http://stackoverflow.com/q/24195932

http://stackoverflow.com/q/24118819
has body: package com.example.nrbapp; import java.util.ArrayList; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import android.os.Build; public class SearchResult extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); if (extras != null) { int check = extras.getInt("check"); ArrayList&lt;String&gt; K_array = extras.getStringArrayList("K_array"); } setContentView(R.layout.activity_search_result); LinearLayout t1 = (LinearLayout) findViewById(R.id.linear_layout); TextView tr = new TextView(this); //tr.setId(95);// define id that must be unique tr.setText("TYPE:"); // set the text for the header tr.setTextColor(Color.WHITE); // set the color tr.setTypeface(null, Typeface.BOLD); tr.setPadding(5, 5, 5, 5); // set the padding (if required) t1.addView(tr);//**LINE 43** //t1.addView(tr, new LinearLayout.LayoutParams( // LayoutParams.FILL_PARENT, // LayoutParams.WRAP_CONTENT)); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.search_result, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here.…
tagged with: android-intent
downvote count: 1
has answer: http://stackoverflow.com/a/24118992
favorite count: 0
has title: Unable to start activity ComponentInfo Null Pointer Exception
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24118924
has comment: http://stackoverflow.com/comment/37209069
score: -1
type: Question
has comment: http://stackoverflow.com/comment/37209124
answer count: 2
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37209295

http://stackoverflow.com/q/24228279
tagged with: option-type
type: AnsweredQuestion
upvote count: 154
has answer: http://stackoverflow.com/a/53760824
possible better answer: http://stackoverflow.com/a/43627779
downvote count: 0
has answer: http://stackoverflow.com/a/43627779
has answer: http://stackoverflow.com/a/24228334
tagged with: java-8
favorite count: 0
score: 154
has answer: http://stackoverflow.com/a/24228366
type: Question
answer count: 5
accepted answer: http://stackoverflow.com/a/24228334
tagged with: java
has answer: http://stackoverflow.com/a/49388444
has title: Proper usage of Optional.ifPresent()
tagged with: lambda
has body: I am trying to understand the ifPresent() method of the Optional API in Java 8. I have simple logic: Optional&lt;User&gt; user=... user.ifPresent(doSomethingWithUser(user.get())); But this results in a compilation error: ifPresent(java.util.functionError:(186, 74) java: 'void' type not allowed here) Of course I can do something like this: if(user.isPresent()) { doSomethingWithUser(user.get()); } But this is exactly like a cluttered null check. If I change the code into this: user.ifPresent(new Consumer&lt;User&gt;() { @Override public void accept(User user) { doSomethingWithUser(user.get()); } }); The code is getting dirtier, which makes me think of going back to the old null check. Any ideas?

http://stackoverflow.com/comment/37437870
type: AnswerComment
has text: We have a winner, good thinking
comment on: http://stackoverflow.com/a/24239861
type: Comment
score: 8

http://stackoverflow.com/comment/37309853
type: Comment
score: 0
type: AnswerComment
has text: Thank you, however this doesn't help me with the problem in hand, I have mentioned this option as part of 'Note'.
comment on: http://stackoverflow.com/a/24134496

http://stackoverflow.com/q/24261109
has comment: http://stackoverflow.com/comment/37481392
type: Question
has comment: http://stackoverflow.com/comment/37490088
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37481020
has comment: http://stackoverflow.com/comment/37482647
has title: Play Framework 2.3 :Call Scala object from Java
score: 0
has body: With Play 2.2, in a java application, I'm using a Scala object from my Java Global class : @Override public void onStart(Application app) { MyRegistry$ myRegistry = MyRegistry$.MODULE$; ... } In my 'app' folder, I have a Scala object defined object MyRegistry { ... } I'm trying to migrate to Play 2.3, and this is not working anymore [ERROR] /home/descottl/projects/ads/kelkooAdService/app/Global.java:[36,30] cannot find symbol [ERROR] symbol : variable MyRegistry$ [ERROR] location: class Global Do I need to change something in my build settings to make Java and Scala work together? I've tried to put this in my Build.scala file : lazy val root = (project in file("..")).enablePlugins(PlayScala).enablePlugins(PlayJava) But it does not slove the issue Thanks
has comment: http://stackoverflow.com/comment/37480347
has comment: http://stackoverflow.com/comment/37480960
answer count: 0
tagged with: playframework
has comment: http://stackoverflow.com/comment/37483151
tagged with: java

http://stackoverflow.com/q/24127287
has title: web app architecture: RESTful and web should share the same DTOs?
accepted answer: http://stackoverflow.com/a/24128409
type: AnsweredQuestion
tagged with: java
has body: I'm new to web application development, and aiming at designing an application which will serve both browsers and mobile devices which will consume REST services to communicate with the server. For this I think of creating 2 separate layers for web and rest. I follow the spring io getting started guides full tutorials (http://spring.io/guides#gs), which use an architecture that holds a domain package within the rest layer which constructs the objects that will be sent as replies to rest requests. In another web tutorial they have a similar package under web layer for handling the domain objects prior to displaying them. I read this question and if I follow the general guidelines in the answer, I would implement separate domain packages since even if the view layer uses REST, there are still some differences which might be a source of maintenance problems should I decide to change something in the future: (Best Practice - Multi Layer Architecture and DTOs) My question is regarding an application that has both, should the web layer hold DTO's like the rest one, or is it a good practice to have the views call the rest services or use the same rest.domain.POJOs (and extract these POJOs from that package to a common one? Thanks.
has answer: http://stackoverflow.com/a/24128409
tagged with: web-applications
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37230653
answer count: 1
linked to: http://stackoverflow.com/q/23308241
favorite count: 0
has comment: http://stackoverflow.com/comment/37236089
tagged with: rest
type: Question
tagged with: spring

http://stackoverflow.com/q/24126113
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37223365
has title: Unable to start new activity
has answer: http://stackoverflow.com/a/24126286
downvote count: 1
favorite count: 0
type: Question
tagged with: nullpointerexception
has body: Every time I try to start new activity, an error occurs (Java null pointer exception) and the app fc's: I tried every single way and it just doesn't work! Here's an example for the code : MainAct is the first activity and NewAct is the activity to launch... 1- manifest: &lt;activity android:name="com.example.app.NewAct" android:label="@string/title_activity_newact" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.NewAct" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; 2-MainAct: Button bt; bt = (Button) findViewById (R.id.bt); bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i= new Intent ("com.example.app.NewAct"); startActivity(i); } }); I also tried other forms of intent such as Intent i= new Intent ("android.intent.action.NewAct"); Intent i= new Intent (this, NewAct.class); Intent i= new Intent (view.getContext(), StudentInfoActivity.class);
type: UnansweredQuestion
tagged with: android
score: -1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/37223179
has answer: http://stackoverflow.com/a/24126320
answer count: 3
has answer: http://stackoverflow.com/a/24126523

http://stackoverflow.com/q/24140499
type: UnansweredQuestion
answer count: 1
has body: I'm using jaas to authenticate threw a Kerberos server. I use the Krb5LoginModule to get the ticket in the cache. It works but I always have to specify the configuration file below to run the java app, like this : java com.company.maclasse -Djava.security.auth.login.config=jaas.conf jaas.conf : com.orange.rolefilter.LDAPManager { com.sun.security.auth.module.Krb5LoginModule required client=TRUE doNotPrompt=TRUE useTicketCache=TRUE storeKey=FALSE useKeyTab=FALSE; }; I would like to know if there is a way to specify this Krb5LoginModule elsewhere than in a configuration file, I want it to be taken into account at the compilation for example. In a way to not having to specify it after. Thanks.
score: 0
tagged with: jaas
tagged with: configuration
tagged with: java
has title: Jaas/Kerberos : specify LoginModule elsewhere than in the configuration file
type: Question
tagged with: kerberos
has answer: http://stackoverflow.com/a/28362034

http://stackoverflow.com/a/24165642
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37296948
has body: In general, java.sql.Connection instances (JDBC connections) are not thread-safe; you should not use the same Connection object from multiple threads at the same time. Create a separate Connection for each thread instead.
answers question: http://stackoverflow.com/q/24165529

http://stackoverflow.com/comment/37500687
type: AnswerComment
comment on: http://stackoverflow.com/a/24261053
has text: Hey, you were right. One of the consumers had the boolean controlling transactional behavior set incorrectly. Problem solved. Thanks man.
type: Comment
score: 0

http://stackoverflow.com/comment/37394294
type: AnswerComment
comment on: http://stackoverflow.com/a/24216696
score: 1
type: Comment
has text: `pack` and possibly `setLocationByPlatform` might be better choices

http://stackoverflow.com/q/24228102
tagged with: java
has comment: http://stackoverflow.com/comment/37415440
downvote count: 1
has comment: http://stackoverflow.com/comment/37415458
has answer: http://stackoverflow.com/a/24228273
favorite count: 0
has comment: http://stackoverflow.com/comment/37415525
type: Question
tagged with: actionlistener
answer count: 2
has answer: http://stackoverflow.com/a/24228237
possible better answer: http://stackoverflow.com/a/24228273
tagged with: swing
has comment: http://stackoverflow.com/comment/37415470
has body: import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class StudentGUI extends JFrame implements ActionListener { public StudentGUI() { super("StudentGUI Frame"); //TopPanel TopPanel tp; tp=new TopPanel(); Dimension d = new Dimension(800,600); tp.setPreferredSize(d); this.add (tp, BorderLayout.NORTH); tp.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800,600); setBackground(Color.PINK); tp.setVisible(true); //TopPanel End //BottomPanel BottomPanel bp; bp=new BottomPanel(); this.add (bp, BorderLayout.SOUTH); tp.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800,600); //BottomPanel End //MiddlePanel MiddlePanel mp; mp=new MiddlePanel(); this.add (mp, BorderLayout.CENTER); mp.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800,600); //MiddlePanel End this.setVisible(true); } exitBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e){ int selectedOption = JOptionPane.showConfirmDialog(null, "Do you want to close the window?", "Choose", JOptionPane.YES_NO_OPTION); if (selectedOption == JOptionPane.YES_OPTION) { System.exit(1); } } }); public static void main(String[] args) { new StudentGUI(); } } Here is the code, I am not sure what is wrong, did I miss something? The code executes yet nothing comes.. How do I make the action Listener and action perform execute? It is not realizing the button at all.. Make it so that when the User clicks on the Exit Button, a MessageBox Window popup and ask the User if they are sure that they want to exit. If they say “Yes”, then Exit the App. Bottom Panel: import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.*; public class BottomPanel extends JPanel { publi…
has comment: http://stackoverflow.com/comment/37415565
has title: Exit Button is not working After Action Listerner
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24228237
upvote count: 1

http://stackoverflow.com/comment/37477386
comment on: http://stackoverflow.com/a/24260430
score: 0
type: Comment
has text: That's fine, but a link as an answer is very much frowned upon in SO. That link can go dead. You need to provide an actual answer here and only use a link as a reference for further reading.
type: AnswerComment

http://stackoverflow.com/comment/37488249
has text: I get the "Auth fail" before the ssh.exec(command). I get it on the ssh.connect()
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24262432

http://stackoverflow.com/comment/37445169
comment on: http://stackoverflow.com/q/24243092
score: 0
has text: am i getting you correctly, you propose to have a check `if ((k = e.key) == key) || ((e.hash == hash && ((k = e.key) == key || key.equals(k))))) { do sth}`? if yes, then it will work quicker when key==e.key, otherwise you will have additional comparsion
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37235407
score: 0
type: Comment
type: QuestionComment
has text: I just want to sort the String, so any type of sort will work for me. Please help me
comment on: http://stackoverflow.com/q/24132514

http://stackoverflow.com/comment/37323078
type: QuestionComment
has text: Well the top level exception is `javax.ejb.EJBTransactionRolledbackException: Unexpected Error` but it is caused by the error I posted in the question.
comment on: http://stackoverflow.com/q/24179409
score: 0
type: Comment

http://stackoverflow.com/comment/37462170
score: 0
has text: I'd try building the string for the path first and placing it in a variable, and using the variable to create the ImageIcon object. What error are you getting specifically?
type: Comment
comment on: http://stackoverflow.com/q/24252120
type: QuestionComment

http://stackoverflow.com/a/24236586
has comment: http://stackoverflow.com/comment/37433240
accepted answer of: http://stackoverflow.com/q/24233095
score: 0
has comment: http://stackoverflow.com/comment/37447710
type: AcceptedAnswer
has body: Jsoup stores text in TextNodes -- given an Element (in your example, the body element), you can call e.textNodes() to get a list of its text nodes. In this case, you're going to look at the first item in the list. There's a small example in the textNodes documentation showing how that method relates to other child-getter methods, which may be helpful in more complicated tasks.
answers question: http://stackoverflow.com/q/24233095
type: Answer

http://stackoverflow.com/q/24149640
downvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37269911
has body: Could anyone please provide me a sample program to create a pdf which can dynamically create a grid or even dots starting at (0,0) at bottom left corner on the Pdf of PageSize.Letter either using itext or any other framework max X= 8.5 Inches Max Y =11 Inches
upvote count: 2
score: 0
tagged with: java
tagged with: itext
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24157986
has title: Creating a Pdf with a cartesian grid using itext?
type: Question

http://stackoverflow.com/a/24303351
downvote count: 0
upvote count: 1
has body: Best pratice for Collection properties is to init collection to a new empty collection to let Hibernate proxify it and manage object removal in the right way. Try change you code as @GenericGenerator(name = "uuid-strategy", strategy = "org.collegeboard.springboard.core.util.SpringboardUUIDGenerator") @Entity @Table(name = "user") public class User implements Serializable { @OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL}, orphanRemoval=true) @JoinTable(name = "user_address", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "address_id")) private Set&lt;Address&gt; addresses = new HashSet&lt;Address&gt;; Also look at Hibernate @ManyToOne only works with CascadeType.ALL for correct annotation/persistace methods pairs
type: Answer
answers question: http://stackoverflow.com/q/24186767
has comment: http://stackoverflow.com/comment/37581977
score: 1

http://stackoverflow.com/q/24119581
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: criteria
has comment: http://stackoverflow.com/comment/37213225
has comment: http://stackoverflow.com/comment/37212407
has body: I have a SQL QUERY Like this. SELECT a.id,a.name,b.id,b.name,c.id,c.name from TableA a LEFT JOIN (TableB b INNER JOIN TableC c on c.bid=b.id and c.name in('err','fgh')) on b.aid=a.id I want to convert it into Hibernate Criteria query.Is there any solution for that? Here is the structure of table. http://sqlfiddle.com/#!2/f1b43/1 The expected output is: Aid Aname Bid Bname Cid Cname 1 abc 3 qwe 7 err 1 abc 3 qwe 8 err 1 abc 5 der 12 fgh 2 xyz NULL NULL NULL NULL
answer count: 0
has comment: http://stackoverflow.com/comment/37210647
score: 1
has title: Nested JOIN IN Hibernate Criteria Query
tagged with: java
tagged with: hibernate
downvote count: 0
tagged with: mysql
tagged with: hibernate-criteria
upvote count: 1
has comment: http://stackoverflow.com/comment/37210520

http://stackoverflow.com/comment/37290536
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24159136
type: QuestionComment
has text: @bolloyo thats not true, you can make a post request to root, if you have set it up correctly.

http://stackoverflow.com/comment/37400314
score: 0
comment on: http://stackoverflow.com/q/24220097
type: Comment
type: QuestionComment
has text: `Boolean` is a wrapper class in Java

http://stackoverflow.com/a/24150937
type: Answer
has body: Also, what causes the logic that the more threads allocated, ie more being able to be done at once, to be incorrect? Are you asking, why does a computation running with N threads on an N core machine take longer than T/N time to complete when T is the time to do the same computation with just one thread? Google "Amdahl's Law." It's rarely the case that 100% of the work can be done in parallel. Usually there is something, even if it's only startup/shutdown logic, that has to be done serially. The bits that have to be done serially have a big impact when you measure that speedup ratio.
score: 0
answers question: http://stackoverflow.com/q/24149834

http://stackoverflow.com/q/24116637
has comment: http://stackoverflow.com/comment/37205890
tagged with: jsp
has comment: http://stackoverflow.com/comment/37205503
linked to: http://stackoverflow.com/q/3541077
has answer: http://stackoverflow.com/a/24116903
has answer: http://stackoverflow.com/a/24117134
has body: This is the code of my servlet: protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String result = (String)request.getParameter("action"); switch (result) { case "init": request.setAttribute("CountriesList", signUpBean.getContriesList()); String arg = "/signup.jsp"; RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(arg); dispatcher.forward(request, response); break; case "submit": //Code to handle the request break; } } When I click on the link signup?action=init the servlet is initialized receiving the countries list and passing it to the signup.jsp page in order to show the list on a select form element. When I compile the signup form, I push the submit button which has action="signup?action=submit" in the way the servlet can handle the request. Do you know a more elegant way or correct way to do what I mean?
type: Question
has comment: http://stackoverflow.com/comment/37205388
duplicate of: http://stackoverflow.com/q/3541077
has title: A more elegant way to handle different requests in the same servlet
has comment: http://stackoverflow.com/comment/37218167
has comment: http://stackoverflow.com/comment/37206404
has comment: http://stackoverflow.com/comment/37213699
tagged with: request
tagged with: forms
has comment: http://stackoverflow.com/comment/37211155
has comment: http://stackoverflow.com/comment/37205616
tagged with: servlets
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37206336
tagged with: java
possible better answer: http://stackoverflow.com/a/24116903
accepted answer: http://stackoverflow.com/a/24117134

http://stackoverflow.com/q/24190887
has answer: http://stackoverflow.com/a/24191005
type: Question
has title: Using Guava for a sockets client library
has body: I am writing a small client library to help me with an Android project I am working on. So I am learning Guava now and I am a bit stuck. The TCP server has 2 capabilities: Reply to direct queries Subscribe queries that will be replied several times in the future So I am using a AbstractExecutionThreadService to listen to incoming messages. For direct queries I was thinking to use ListenableFuture and for the subscribe messages to use EventBus. The problem is that to create ListenableFutures I have to use a ListeningExecutorService and it is now what I want. If you see my code, the run loop will processes the messages and should resolve the correct ListenableFuture somehow. So how I make the test() method return a ListenableFuture that will be resolved by the run() loop when the data arrive? public class StratumClient extends AbstractExecutionThreadService { private static final Logger log = LoggerFactory.getLogger(StratumClient.class); private final String host; private final int port; private Socket socket; private DataOutputStream toServer; private BufferedReader fromServer; public StratumClient(String host, int port) throws IOException { this.host = host; this.port = port; this.socket = createSocket(); } protected Socket createSocket() throws IOException { log.debug("Opening a socket to " + host + ":" + port); return new Socket(host, port); } @Override protected void startUp() throws Exception { log.debug("Creating I/O streams to socket: " + socket); toServer = new DataOutputStream(socket.getOutputStream()); fromServer = new BufferedReader(new InputStreamReader(socket.getInputStream())); } @Override protected void triggerShutdown() { try { socket.close(); } catch (IOException e) { log.error("Failed to close socket", e); } } @Override protected void run() throws Exception { String reply; log.debug("Start listening to server replies"); while ((reply = fromServer.readLine()) != null) { log.debug("Got reply from server: " + reply); // TODO process and dispatch messag…
tagged with: sockets
answer count: 1
type: AnsweredQuestion
score: 0
tagged with: guava
tagged with: java
accepted answer: http://stackoverflow.com/a/24191005

http://stackoverflow.com/a/24157472
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37282202
answers question: http://stackoverflow.com/q/24157431
has comment: http://stackoverflow.com/comment/37281682
type: Answer
has comment: http://stackoverflow.com/comment/37283425
has body: I think it should be this: getResources().getString(R.string.my_string); For knowing why you are getting error please refer to this SO post.
score: 0
accepted answer of: http://stackoverflow.com/q/24157431
has comment: http://stackoverflow.com/comment/37281767

http://stackoverflow.com/q/24155248
accepted answer: http://stackoverflow.com/a/24156640
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/16683455
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/24203373
answer count: 2
has title: Navigate between applications at android
has answer: http://stackoverflow.com/a/24203373
has answer: http://stackoverflow.com/a/24156640
downvote count: 0
has comment: http://stackoverflow.com/comment/37278960
upvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/37279149
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37471135
has body: I am having 4 different applications. One is a login and other three are apps that will go to login if not authorized. Login app should get the package name from the other apps. According to the name received, it should again relaunch the application. I've no idea how can I do it.

http://stackoverflow.com/q/24111411
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24111500
has title: Issue with writing and reading from file
tagged with: java
has answer: http://stackoverflow.com/a/24124598
has comment: http://stackoverflow.com/comment/37220003
type: Question
has answer: http://stackoverflow.com/a/24111468
has comment: http://stackoverflow.com/comment/37195869
has comment: http://stackoverflow.com/comment/37216714
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37220028
has comment: http://stackoverflow.com/comment/37226234
tagged with: bufferedreader
has body: I am in a situation where I want to write something(writing employee details with punchin &amp; punchout) to a file and read it back(to show as a report of who all the employees punchedin &amp; punchedout). package Test; import java.io.*; import java.text.*; import java.util.*; public class Test { public static void main(String[] args) throws IOException { String lastName = ""; String firstName = ""; String choice = "y"; String customerChoice = "x"; int empid = 0; Scanner sc = new Scanner(System.in); int currentIndex; File file = new File("E:/output.txt"); FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Calendar cal = Calendar.getInstance(); int[] punchedArray; punchedArray = new int[100]; // System.out.println(t); while (!customerChoice.equalsIgnoreCase("d") &amp;&amp; customerChoice != "invalid" &amp;&amp; choice.equalsIgnoreCase("y")) { customerChoice = getValidCustomerChoice(sc); if (customerChoice.equalsIgnoreCase("a")) { // System.out.println("In Create Customer"); System.out.print("Enter your first name: "); firstName = sc.next(); System.out.print("Enter your last name: "); lastName = sc.next(); System.out.println(firstName + lastName + "with employee id" + empid); //System.out.println(firstNameArray[newEmployeeIndex] + " " + lastNameArray[newEmployeeIndex] + " your employee ID is: " + employeeIDArray[newEmployeeIndex]); empid++; //sc.next(); } if (customerChoice.equalsIgnoreCase("b")) { System.out.println("Welcome to the punch in/out screen"+"\n"); System.out.print("Enter your employee ID: "); currentIndex = Integer.parseInt(sc.next()); if (punchedArray[currentIndex] == 0) { System.out.println("You are now punched in"); punchedArray[currentIndex] = 1; } else if (punchedArray[currentIndex] == 1) { System.out.println("You are now punched out"); punchedArray[currentIndex] = 0; } System.out.print(firstName + " "+ lastName + " "+ "your employee…
has comment: http://stackoverflow.com/comment/37203370
has comment: http://stackoverflow.com/comment/37196126
has comment: http://stackoverflow.com/comment/37195852
has comment: http://stackoverflow.com/comment/37196085

http://stackoverflow.com/comment/37390377
type: QuestionComment
score: 0
has text: Can you explain your problem statement a bit more?
comment on: http://stackoverflow.com/q/24214584
type: Comment

http://stackoverflow.com/q/24238238
duplicate of: http://stackoverflow.com/q/24236286
has answer: http://stackoverflow.com/a/24238983
score: 2
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/24236286
upvote count: 2
type: UnansweredQuestion
tagged with: google-bigquery
has title: Can't import com.google.api.services.bigquery.model.TableCell
has body: In our sourcecode, I can import library for 'import com.google.api.services.bigquery.model.TableRow; import com.google.api.services.bigquery.model.*;' But I can't import 'import com.google.api.services.bigquery.model.TableCell;' Please tell me know to solve this case. Thanks, 1

http://stackoverflow.com/q/24196588
type: AnsweredQuestion
has body: So im using Smack to run my chat bot for league of legends, however I can't even get the bot to show up because of a missing class error that I can't seem to figure out. Code and error below, Thanks for any help, -Nick Also: yes, this code was taken from an example because when I tried it myself I still got the same error. package com.nickparks.bot; import java.util.*; import java.io.*; import org.jivesoftware.smack.*; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.tcp.XMPPTCPConnection; public class JabberSmackAPI implements MessageListener{ XMPPConnection connection; public void login(String userName, String password) throws XMPPException { ConnectionConfiguration config = new ConnectionConfiguration("chat.na1.lol.riotgames.com",5223); connection = new XMPPTCPConnection(config); try { connection.connect(); connection.login(userName, password, "xiff"); } catch (SmackException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void displayBuddyList() { Roster roster = connection.getRoster(); Collection&lt;RosterEntry&gt; entries = roster.getEntries(); System.out.println("\n\n" + entries.size() + " buddy(ies):"); for(RosterEntry r:entries) { System.out.println(r.getUser()); } } public void disconnect() { try { connection.disconnect(); } catch (SmackException.NotConnectedException e) { e.printStackTrace(); } } public void processMessage(Chat chat, Message message) { if(message.getType() == Message.Type.chat) System.out.println(chat.getParticipant() + " says: " + message.getBody()); } public static void main(String args[]) throws XMPPException, IOException { // declare variables JabberSmackAPI c = new JabberSmackAPI(); // Enter your login information here c.login("bot", "Password"); c.displayBuddyList(); System.out.println("-----"); System.out.println("Who do you want to talk to? - Type contacts full email address:"); String talkTo = br.readLine(); System.out.println("-----"); System.out.println("All message…
tagged with: classnotfoundexception
score: 7
tagged with: xmpp
tagged with: java
answer count: 1
has title: Smack throws "java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserFactory:"
downvote count: 0
accepted answer: http://stackoverflow.com/a/24218535
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/24218535
type: Question
tagged with: smack

http://stackoverflow.com/comment/37318962
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24173161
has text: +3 -3 down ... its a simple question, hence simple answer.

http://stackoverflow.com/comment/37305592
has text: @trashgod, by the way I went to your "Subway Simulation" page and clicked on the link for the Java Web Start. I got the same error dialog, with a message saying: `"Your security settings have blocked a self-signed sandbox application from running"`. I think I'm getting in over my head trying to understand all this stuff :)
score: 0
comment on: http://stackoverflow.com/a/24150669
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37307809
has text: I would rather use a `Thread.sleep(10)` call, but that freezes the UI thread (as expected). I may just have to tweek how everything works, and run the UI updates on the thread (separate from the counter)
comment on: http://stackoverflow.com/a/24170857
type: Comment
score: 0
type: AnswerComment

sparql
tags question: http://stackoverflow.com/q/24166518
type: Tag
tags question: http://stackoverflow.com/q/24202703
tag name: sparql
tags question: http://stackoverflow.com/q/24116853
tags question: http://stackoverflow.com/q/24167256

http://stackoverflow.com/comment/37380407
type: Comment
comment on: http://stackoverflow.com/a/24209608
type: AnswerComment
score: 0
has text: Yeah I know, I should probably have done that. Sorry

http://stackoverflow.com/a/27427896
type: Answer
answers question: http://stackoverflow.com/q/24166192
has body: I suggest you to add the Native Libraries to you project, the .so files. You need add to \lib\ folder in your project the platforms folders in this path: OpenCV-x.x.xx-android-sdk\sdk\native\libs\ - armeabi - armeabi-v7a - mips - x86 Which folder you need add depends in what is your target architecture, and this is how i solved the problem you have.
score: 0

http://stackoverflow.com/a/24201848
answers question: http://stackoverflow.com/q/24201530
has body: My approach was to remove the 'used' parts of the string each iteration; that way, I only need to print out the first five characters of the remaining string each time. It's nice to keep things simple: String preBody = "The AThe CThe IThe O"; while (preBody.length()&gt;0) { String part = preBody.substring(0, 5); System.out.println(part); if (preBody.length()&gt;5) { preBody = preBody.substring(5); } else { preBody = ""; } }
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37451402
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24231550
has text: If you have a thread that wants to wait for an event, you wait on a semaphore. Then the part of the code that sees the event releases the semaphore. This will wake up the other thread and allow it to run. This way the code can only run after an event occurs. There are of course other ways to do it as well, its just one common and efficient method.
score: 0

http://stackoverflow.com/comment/37351029
has text: I'm not running into an `OutOfMemoryException` at this time. Do you recommend manually implementing some kind of Least Recently Used algorithm to determine which bitmaps to keep in memory? Just to elaborate, I will only be calling `getBitmap()` rarely, when the Activity holding **PictureFrame** is resumed.
comment on: http://stackoverflow.com/q/24194218
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37258738
comment on: http://stackoverflow.com/a/24135768
type: AnswerComment
has text: @user3238181 please, try to look at anything that can draw an image, like a JLabel. There is certainly an ImageIcon stored somewhere
score: 0
type: Comment

http://stackoverflow.com/q/24241455
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24241576
tagged with: layout-manager
tagged with: swing
has title: Adding a JTable to JFrame
favorite count: 0
type: Question
type: UnansweredQuestion
score: 1
tagged with: java
has body: I want to add test2 to my DFrametest class, so that the table of test2 shows up in my window. I get an empty window and can't find the mistake. public class test2 extends JPanel { JTable tbl; DefaultTableModel dt; public test2(){ JLabel label = new JLabel("Course Lookup GUI"); this.add( label ); tbl = new JTable(); dt = new DefaultTableModel(); dt.addColumn("ID"); dt.addColumn("Name"); tbl.setModel(dt); try{ Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/lagerverwaltungwin", "root", ""); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("SELECT ArtNr, Beschreibung FROM artikel"); }catch(Exception e){ e.printStackTrace(); } JScrollPane jp = new JScrollPane(); jp.getViewport().add(tbl); add(jp); } } This is my Frameclass which should have the table from test2: public class DFrametest extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { DFrametest frame = new DFrametest(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public DFrametest() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); test2 t = new test2(); this.add(t); this.setVisible(true); } }
tagged with: jpanel
tagged with: jtable
has answer: http://stackoverflow.com/a/24241926
answer count: 2

http://stackoverflow.com/comment/37197261
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556)
comment on: http://stackoverflow.com/q/24107895
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24165032
has title: Moving element by KeyListener in Swing
has answer: http://stackoverflow.com/a/24165241
type: AnsweredQuestion
answer count: 2
has body: I have problem with KeyListener, I've been searching solution but it should be working. Unfortunately, it doesn't and i have no idea why. When i type up arrow, nothing happens. I was reading about "Focus", but I don't know how this works, maybe you can give me some example, unnecessary to my problem. public class Trawa extends JPanel implements KeyListener { int wysokosc = 200; public Trawa(){ addKeyListener(this); setSize(200,600); setBackground(Color.GREEN); } public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; Color c1 = new Color(36,217,36); g2d.setColor(c1); g2d.fillRect(10, wysokosc, 100, 100); c1 = new Color(0,0,0); g2d.setColor(c1); g2d.fillRect(10, wysokosc, 30, 30); g2d.fillRect(80, wysokosc, 30, 30); c1 = new Color(252,3,0); g2d.setColor(c1); g2d.fillRect(40, wysokosc+60 ,30,30); } @Override public void keyPressed(KeyEvent arg0) { int key = arg0.getKeyCode(); if(key == KeyEvent.VK_UP) wysokosc-=100; repaint(); } @Override public void keyReleased(KeyEvent arg0) { } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } } Here is my main class with frame. Maybe the problem is here. public class GUI extends JFrame{ public GUI(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); add(new Trawa()); setLayout(new GridLayout(1,5)); pack(); setSize(1300, 600); setLocation(40, 100); setVisible(true); } public static void main(String[] args) { new GUI(); } }
upvote count: 0
downvote count: 2
tagged with: swing
linked to: http://stackoverflow.com/q/286727
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37296128
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/24165345
tagged with: keylistener
has answer: http://stackoverflow.com/a/24165345
possible better answer: http://stackoverflow.com/a/24165241

http://stackoverflow.com/comment/37363699
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24200750
has text: Can you write some sort of `Maybe<T>` wrapper that just holds a possibly-null `T`?

http://stackoverflow.com/a/24129582
has comment: http://stackoverflow.com/comment/37259930
answers question: http://stackoverflow.com/q/24129441
has comment: http://stackoverflow.com/comment/37259378
type: Answer
has body: The getMaxAllowedKeyLength() has been introduced just for this purpose, otherwise you would have to handle an exception during the Cipher encryption/decryption operations (update and doFinal) to test if the restrictions apply. As the policy files may change in time or for different versions of Java, it is easier to test with a method. Note that getMaxAllowedKeyLength() should not be used for any other reason than testing for restrictions. Notably, it may well return Integer.MAX_VALUE instead of a valid key size. And of course, if it returns 128 you cannot use AES with a key size of 256. To remedy this you need to install the Unlimited Strength Jurisdiction Policy Files for the Oracle JRE / JDK and then copy it into the (jre)/lib/security folder of all the Java installations where you want to use larger key sizes. You can overwrite the files that are already there. You may need local admin rights or similar rights on that folder to do so. If that is not possible you could use another implementation of AES that doesn't require the Cipher class as this class actually enforces the limitations. There are a few tricks around this issue as well.
accepted answer of: http://stackoverflow.com/q/24129441
score: 3
upvote count: 3
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37229946

http://stackoverflow.com/q/24253710
upvote count: 1
has comment: http://stackoverflow.com/comment/37465141
has body: I have a hash set of 1000 strings. Each string is having a size of 10. Can you tell me the exact number of bytes required to store this in memory? Both for 32bit and 64bit VMs. Can you explain the way to calculate this?
has comment: http://stackoverflow.com/comment/37466192
has comment: http://stackoverflow.com/comment/37465441
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24254111
has title: Java object memory size of a set of strings
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24254111
has comment: http://stackoverflow.com/comment/37465115
answer count: 1
has comment: http://stackoverflow.com/comment/37465857
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37465093
tagged with: memory-management
downvote count: 0
linked to: http://stackoverflow.com/q/16882277

http://stackoverflow.com/comment/37400415
type: AnswerComment
has text: Yes this is my cards array declaration: private Card[] cards = new Card [52];
comment on: http://stackoverflow.com/a/24220124
type: Comment
score: 0

http://stackoverflow.com/q/24237138
has comment: http://stackoverflow.com/comment/40920648
has answer: http://stackoverflow.com/a/24237280
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: io
linked to: http://stackoverflow.com/q/11695500
favorite count: 0
type: Question
upvote count: 4
tagged with: try-catch
has comment: http://stackoverflow.com/comment/37435690
has body: I have a java application taking data from stdin and writing results to stdout. Like this: app1 | java_app | app2 The amount of data moved through the pipe is large and takes a long time (hours and days is not uncommon or unexpected). Its seems that if app1 dies, and closes its end of the pipe, I receive a pipe related exception. However is app2 dies, and closes its end of the pipe I do not receive an exception. This means that java_app continues on consuming input, which will never generate any useful output, running for hours or days. The difference in pipe exception reporting seems to stem from System.in being an InputStream, while System.out is a PrintStream and PrintStreams swallow up any errors. I know you can get the error state from a PrintStream by using stream.checkError() - but using that everywhere is clunky (and forces a flush of your output stream.) I 'm happy to forgo the bulk of functionality of PrintStream to get better error reporting. Is there another way to get access to stdout that isn't wrapped in a PrintStream, but instead a nicer OutputStream?
has title: How do I catch errors when piping to/from javas stdin/stdout
has comment: http://stackoverflow.com/comment/37435036
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24237280
has comment: http://stackoverflow.com/comment/37501917
has comment: http://stackoverflow.com/comment/37443910

http://stackoverflow.com/comment/37423782
type: QuestionComment
score: 0
has text: @Braj Yes, thanks. But I am not getting how to use them in my servlet code and where to place that datasource tags content. Anyways thanks.
comment on: http://stackoverflow.com/q/24232091
type: Comment

http://stackoverflow.com/comment/37406565
has text: If you think that you will pass two different type of list in this method then use double generic parameters `<T,V>`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24223145
type: Comment

http://stackoverflow.com/comment/37401891
type: Comment
type: AnswerComment
has text: @user3740532 In the regular expression syntax ,the '[]' is used to specify an allowed range or choice of valid characters
score: 1
comment on: http://stackoverflow.com/a/24220915

http://stackoverflow.com/q/24107304
tagged with: string-literals
has answer: http://stackoverflow.com/a/24107501
type: Question
has comment: http://stackoverflow.com/comment/127431288
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37195610
score: 0
has title: Java: string literal behaves differently from string variable (cannot be from interning)
has comment: http://stackoverflow.com/comment/37188163
has body: I have the following code: public RecordList searchDatabase(String key, String value) { String newKey; newKey = key; // no results //newKey = "name_of_person"; // finds results //newKey = new String("name"); // no results //newKey = new String(key); // no results //newKey = new String(key.getBytes().clone()); // no results System.out.println(newKey.equals("name_of_person")); return database.search(newKey, value); } It is supposed to search a database with a key and value, but it finds nothing. But if I change the key to a string literal (the first commented line), it finds the correct results. I tried a few other things (the other commented lines), which didn't work. The println always prints true. I searched for similar problems, and it seems that interning is a common cause for problems with string comparison. But in this case, the only case that works is when I pass a string literal, so if interning is the problem, then the database must have the field as a string literal in its source. I searched, and the literal "name_of_person" does not appear elsewhere in the source (it is dynamically created from JSON). In case it matters, the database.search function is org.apache.lucene.search.join.JoinUtil.createJoinQuery, and the problem is with its 2nd parameter, toField.
tagged with: java
has comment: http://stackoverflow.com/comment/37188248
answer count: 1
upvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/37187897
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/37208259
comment on: http://stackoverflow.com/a/24117407
type: AnswerComment
score: 0
has text: I'm asserting findAll method which returns only the entities which have an active state. Anyway, I fixed the issue. It was a misplaced `||` of all things.
type: Comment

http://stackoverflow.com/q/24159979
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
has body: I am trying to convert a XML file to CSV file dynamically using Java code. I am able to obtain the data converted to CSV but the problem is with the Header row.I need to add the first row to the CSV file having the name of that column. Here is the Java code: import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.w3c.dom.Document; class xmltocsv { public static void main(String args[]) throws Exception { File stylesheet = new File("C:/testxsl.xsl"); File xmlSource = new File("C:/test.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(xmlSource); StreamSource stylesource = new StreamSource(stylesheet); Transformer transformer = TransformerFactory.newInstance() .newTransformer(stylesource); Source source = new DOMSource(document); Result outputTarget = new StreamResult(new File("c:/output.csv")); transformer.transform(source, outputTarget); } } And here is my sample XML: &lt;record&gt; &lt;column name="ID"&gt;537316&lt;/column&gt; &lt;column name="TYPE"&gt;MANUAL&lt;/column&gt; &lt;column name="SECONDID" /&gt; &lt;column name="KEY"&gt;345&lt;/column&gt; &lt;/record&gt; Here is my XSL file: &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:template match="/*"&gt; &lt;xsl:for-each select="*[1]/*"&gt; &lt;xsl:value-of select="name()"/&gt; &lt;xsl:if test="position() != last()"&gt;, &lt;/xsl:if&gt; &lt;xsl:if test="position() = last()"&gt; &lt;xsl:text&gt;&amp;#xD;&lt;/xsl:text&gt; &lt;/xsl:if&gt; &lt;/xsl:for-each&gt; &lt;xsl:apply-templates/&gt; &lt;/xsl:te…
favorite count: 0
tagged with: xslt
type: Question
tagged with: http://stackoverflow.com/tag/csv
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24160176
has title: XML to CSV dynamic conversion using XSL - unable to obtain tag names
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24160176

http://stackoverflow.com/q/24154911
has comment: http://stackoverflow.com/comment/37277464
answer count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37277528
tagged with: terminal
has comment: http://stackoverflow.com/comment/37307803
type: UnansweredQuestion
tagged with: sockets
has body: I have a Java TCP server that receives a connection from a telnet client from a mac terminal. What byte sequence do I have to send to the client so the user will type the password in the telnet session and it won't be displayed in the terminal (echo off). Then after the user has typed the password I want to turn the echo back on. I am looking for a specific, correct and working answer, something like: On the server side I will do: client.send( byteArrayToTurnEchoOff ) then the user types the password, does not see it, server receives, and turn echo back on with something like client.send( byteArrayToTurnEchoOn ) I am looking for byteArrayToTurnEchoOff and byteArrayToTurnEchoOn that works! ANYONE?
has title: What bytes to send to a telnet client from a Java server so the client does not show the password the user is typing?
score: -1
has answer: http://stackoverflow.com/a/24161610
tagged with: telnet
tagged with: security
downvote count: 2
upvote count: 1
tagged with: java

http://stackoverflow.com/q/24154917
tagged with: gson
possible better answer: http://stackoverflow.com/a/50355221
score: 89
downvote count: 1
has answer: http://stackoverflow.com/a/50355221
upvote count: 90
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/45274611
accepted answer: http://stackoverflow.com/a/24155082
has title: Retrofit Expected BEGIN_OBJECT but was BEGIN_ARRAY
tagged with: android
has answer: http://stackoverflow.com/a/41084710
has answer: http://stackoverflow.com/a/43126599
has answer: http://stackoverflow.com/a/56071328
type: AnsweredQuestion
tagged with: retrofit
has body: I'm fairly new to JSON parsing, I'm using the Retrofit library of Square and ran into this problem. I'm trying to parse this JSON reponse: [ { "id": 3, "username": "jezer", "regid": "oiqwueoiwqueoiwqueoiwq", "url": "http:\/\/192.168.63.175:3000\/users\/3.json" }, { "id": 4, "username": "emulator", "regid": "qwoiuewqoiueoiwqueoq", "url": "http:\/\/192.168.63.175:3000\/users\/4.json" }, { "id": 7, "username": "test", "regid": "ksadqowueqiaksj", "url": "http:\/\/192.168.63.175:3000\/users\/7.json" } ] Here are my models: public class Contacts { public List&lt;User&gt; contacts; } ... public class User { String username; String regid; @Override public String toString(){ return(username); } } my Interface: public interface ContactsInterface { @GET("/users.json") void contacts(Callback&lt;Contacts&gt; cb); } my success method: @Override public void success(Contacts c, Response r) { List&lt;String&gt; names = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; c.contacts.size(); i++) { String name = c.contacts.get(i).toString(); Log.d("Names", "" + name); names.add(name); } ArrayAdapter&lt;String&gt; spinnerAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, names); mSentTo.setAdapter(spinnerAdapter); } When I use it on my success method it throws the error Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column2 What is wrong here?
has answer: http://stackoverflow.com/a/48965455
has answer: http://stackoverflow.com/a/24155082
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/139513539
answer count: 7

http://stackoverflow.com/q/24202405
tagged with: multithreading
has title: Please with multithreading in Java
has body: I am a new java programmer and I have a file sharing program which I am trying to make it work continuously in a while(true) loop in a multithread. I have the sever running correctly but I can make the client to run continuously e.g. server establishes connection then I run client but I have to manually run it because after a file is transfer, client stops. Bellow is the code, can you please help me correct the error? import java.net.*; import java.io.*; public class TCPServer { private static ServerSocket myServer; private static Socket myClient = null; public static void main(String[] args) throws IOException { try { myServer = new ServerSocket(6789); System.out.println("Server is now available..."); } catch(Exception e) { System.err.println("This port is unavailable."); System.exit(1); } while(true) { try { myClient = myServer.accept(); System.out.println("Connection established to : " + myClient); Thread t = new Thread(new ConnectionThread(myClient)); t.start(); }catch(Exception e) { System.err.println("Connection failed...!"); } } } } import java.net.*; import java.io.*; public class TCPClient { private static BufferedReader myReader; private static PrintStream myOut; private static String fileName; private static Socket mySocket; public static void main(String[] args) throws IOException { try { mySocket = new Socket("localhost", 6789); myReader = new BufferedReader(new InputStreamReader(System.in)); } catch(Exception e) { System.err.println("Couldn't establish a connection with server."); System.exit(1); } try { myOut = new PrintStream(mySocket.getOutputStream()); switch (Integer.parseInt(sendOrReceive())) { case 1: myOut.println("1"); sendFile(); break; case 2: myOut.println("2"); System.err.print("Enter file name: "); fileName = myReader.readLine(); myOut.println(fileName); receiveFile(fileName); break; } mySocket.close(); } catch(Exception e) { System.err.println("not valid input"); } } public static String sendOrReceive() throws IOException { System.out.pr…
has answer: http://stackoverflow.com/a/24203478
accepted answer: http://stackoverflow.com/a/24203478
downvote count: 1
favorite count: 0
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24202674
possible better answer: http://stackoverflow.com/a/24202674
has comment: http://stackoverflow.com/comment/37366701
answer count: 4
type: Question
has answer: http://stackoverflow.com/a/24203252
has answer: http://stackoverflow.com/a/24204003
upvote count: 1

http://stackoverflow.com/comment/37430305
type: QuestionComment
comment on: http://stackoverflow.com/q/24235785
has text: it isn't just provided by maven dependency
score: 0
type: Comment

http://stackoverflow.com/comment/37347574
type: Comment
score: 0
type: QuestionComment
has text: Well, considering I am able to do create an ArrayList instance without any type-assignment on either the left or right side, what is the purpose of the right-hand <Integer>-specification?
comment on: http://stackoverflow.com/q/24192297

http://stackoverflow.com/comment/37265384
type: AnswerComment
has text: It really depends on what you are using this for, if it's for production code @tmanion's solution is more encapsulated and testable. If you are just playing around, this one is probably fine. I don't know much about type conversions in C#, so I am no help there.
comment on: http://stackoverflow.com/a/24148323
type: Comment
score: 0

http://stackoverflow.com/comment/37211398
has text: rename @ModelAttribute("SpringWeb") to @ModelAttribute("user") then try it
type: QuestionComment
comment on: http://stackoverflow.com/q/24119973
score: 0
type: Comment

http://stackoverflow.com/comment/37239525
comment on: http://stackoverflow.com/q/24133037
type: QuestionComment
has text: I would write the simplest version of word count with one thread, one HashMap, and see how long the simple version takes. How else are you going to know how much of an improvement multiple threads provides?
type: Comment
score: 1

http://stackoverflow.com/a/24214746
type: AcceptedAnswer
has body: The answer has been found. A third-party library had a method that was not turning off console output of the log4j logging when a customer Appender was created. There were two methods to accomplish this, only one of them performed the operation properly. I switched to the second method and the console messages stopped when the custom Appender was created. I re-ran the job that was failing after 18 hours. Right now, it is at 3.5 days (84 hours) and still going strong. Therefore, it can be determined that if there is no process that will take the console output (System.out), those output messages will be stored by the JVM in heap storage. Eventually the JVM heap storage will be exhausted and the application will crash.
answers question: http://stackoverflow.com/q/24130815
type: Answer
upvote count: 4
score: 4
accepted answer of: http://stackoverflow.com/q/24130815
downvote count: 0

http://stackoverflow.com/comment/37339608
comment on: http://stackoverflow.com/a/24188543
type: AnswerComment
score: 2
has text: +1 nice spot. Sometimes typo answers are very helpful.
type: Comment

validation
tags question: http://stackoverflow.com/q/24241572
tags question: http://stackoverflow.com/q/24177111
tags question: http://stackoverflow.com/q/24251126
tags question: http://stackoverflow.com/q/24172623
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/24192199
tags question: http://stackoverflow.com/q/24206668
tags question: http://stackoverflow.com/q/24181776
tags question: http://stackoverflow.com/q/24253556
tags question: http://stackoverflow.com/q/24168964
tags question: http://stackoverflow.com/q/24209568
tags question: http://stackoverflow.com/q/24242403

http://stackoverflow.com/comment/37434653
score: 0
type: AnswerComment
has text: I did not try do add user item and than immediately delete another one. I show u code of method which completely add item and other method which delete. So i can add item - code is working, but i can not still delete item. I will update my question. Check it.
type: Comment
comment on: http://stackoverflow.com/a/24236340

http://stackoverflow.com/q/24242801
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37443522
tagged with: android-canvas
score: 0
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25719151
has body: I'm trying to draw this shape in my android app : i want to draw a hollow circle with wide stroke, i want to draw a hollow circle with wide stroke, and i want that each circle will fill in a custom way. if the user enter 57 then the circle stroke will be 57% yellow and in the middle of the shape will be text view. is there a way to do it? this is my code so far: public class MyView extends View { Paint paint; Path path; public MyView(Context context) { super(context); init(); } public MyView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public MyView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init(){ paint = new Paint(); paint.setColor(Color.BLUE); paint.setStrokeWidth(10); paint.setStyle(Paint.Style.STROKE); } @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); paint.setStyle(Paint.Style.STROKE); canvas.drawCircle(50, 50, 30, paint); } } and the xml <?xml version="1.0" encoding="utf-8"?> <TextView style="@style/black_textview" android:text="@string/status_m" /> and this is the main class public class HomeGraphFragment extends Fragment { FrameLayout frameGraph1 , frameGraph2 , frameGraph3; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.home_graph, container, false); init(v); return v; } private void init(View v) { frameGraph1 = (FrameLayout)v.findViewById(R.id.frame_graph_1); frameGraph2 = (FrameLayout)v.findViewById(R.id.frame_graph_2); frameGraph3= (FrameLayout)v.findViewById(R.id.frame_graph_3); frameGraph1.addView(new MyView(getActivity())); } }
has answer: http://stackoverflow.com/a/55170560
tagged with: android-custom-view
has title: How to draw custom circle with a fill color in android?
has comment: http://stackoverflow.com/comment/37443590
type: Question
answer count: 2

http://stackoverflow.com/a/47858494
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/102571332
has comment: http://stackoverflow.com/comment/115462591
score: 1
has body: import java.util.Stack; public class EvaluateString { public static int evaluate(String expression) { char[] tokens = expression.toCharArray(); // Stack for numbers: 'values' Stack&lt;Integer&gt; values = new Stack&lt;Integer&gt;(); // Stack for Operators: 'ops' Stack&lt;Character&gt; ops = new Stack&lt;Character&gt;(); for (int i = 0; i &lt; tokens.length; i++) { // Current token is a whitespace, skip it if (tokens[i] == ' ') continue; // Current token is a number, push it to stack for numbers if (tokens[i] &gt;= '0' &amp;&amp; tokens[i] &lt;= '9') { StringBuffer sbuf = new StringBuffer(); // There may be more than one digits in number while (i &lt; tokens.length &amp;&amp; tokens[i] &gt;= '0' &amp;&amp; tokens[i] &lt;= '9') sbuf.append(tokens[i++]); values.push(Integer.parseInt(sbuf.toString())); } // Current token is an opening brace, push it to 'ops' else if (tokens[i] == '(') ops.push(tokens[i]); // Closing brace encountered, solve entire brace else if (tokens[i] == ')') { while (ops.peek() != '(') values.push(applyOp(ops.pop(), values.pop(), values.pop())); ops.pop(); } // Current token is an operator. else if (tokens[i] == '+' || tokens[i] == '-' || tokens[i] == '*' || tokens[i] == '/') { // While top of 'ops' has same or greater precedence to current // token, which is an operator. Apply operator on top of 'ops' // to top two elements in values stack while (!ops.empty() &amp;&amp; hasPrecedence(tokens[i], ops.peek())) values.push(applyOp(ops.pop(), values.pop(), values.pop())); // Push current token to 'ops'. ops.push(tokens[i]); } } // Entire expression has been parsed at this point, apply remaining // ops to remaining values while (!ops.empty()) values.push(applyOp(ops.pop(), values.pop(), values.pop())); // Top of 'values' contains result, return it return values.pop(); } // Returns true if 'op2' has higher or same precedence as 'op1', // otherwise returns false. public static boolean hasPrecedence(char op1, char op2) { if (op2 == '(' || op2 == ')') retur…
has comment: http://stackoverflow.com/comment/82681872
type: Answer
answers question: http://stackoverflow.com/q/24256463

http://stackoverflow.com/comment/37725474
has text: This is an excellent post, unfortunately I don't know jersey well enough to help you. But hopefully my +1 will help you get more attention
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24171534
type: QuestionComment

http://stackoverflow.com/a/24359013
score: 1
has body: Hm, interesting. This reproduces easily on JavaFX 8. In fact the crash still occurs even with this simplified code: public static void main(String[] args) { Series&lt;String, Number&gt; series = new Series&lt;&gt;(); ObservableList&lt;Data&lt;String, Number&gt;&gt; list = series.getData(); list.add(new Data&lt;&gt;("1", 1.0)); list.set(0, new Data&lt;&gt;("2", 2.0)); } As near as I can tell, the XYChart tries to keep an internal linked list in synch with changes to the ObservableList and there is a bug in this code. The only workaround I can suggest is to copy out the data into a plain list, modify it, and then create a new Series with the modified data. Then remove the old Series and add the new Series to the chart. A couple asides: it's unnecessary to call new Double(1); you can simply use a double literal 1.0 (as I've done above) since it will get boxed into a Double because a Number is expected in that argument position. Also, the example simply removes the first element from the list, which can be accomplished by replacing the entire loop with list.remove(0). But other changes such as simply setting a new value seem to cause NPE, so this does look like a bug.
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24258683

http://stackoverflow.com/a/24260068
answers question: http://stackoverflow.com/q/24260011
has body: Add a method toString() that returns your key, then it will work. Your 'key' property shouldn't be static. If you know that all your enums have a key property, you can ask for it directly by reflection too. public enum Mode{ RUNNING("SytemRunning"), STOPPED("SystemStopped"), IDLE("tmpIdle"); public String key; private Mode(String key) { this.key = key; } public String toString() { return this.key; } } Get 'key' with reflection: Class&lt;?&gt; c = Class.forName("Mode"); Object[] objects = c.getEnumConstants(); // now this is not what I want, but almost for(Object obj : objects) { try { Field keyField = obj.getClass.getDeclaredField("key"); keyField.setAccessible(true); // if it is private for example. System.out.printn("value : " + keyField.get(obj); } catch (NoSuchFieldException e) { // fallback to toString() System.out.println("value : " + obj); } }
downvote count: 0
score: 8
has comment: http://stackoverflow.com/comment/123654248
upvote count: 8
type: Answer

http://stackoverflow.com/comment/37295783
type: Comment
type: QuestionComment
has text: Thank you - Ryan. I actually thought of my JAXB generated classes as my model classes. What I do not like, is that I have to work with IntegerProperties. My post is quite simplified; In the end I will have like 20 Integer properties that I bind to different member variables of my List<TicketType> tickets. Isn't it possible to use this List as my "property" and bind controls to elements of this property, like tickets.getPlays().get(0), so that when the List gets updated, the controls will get updated? right now, I have to assign elements of my ticket list to properties.
score: 0
comment on: http://stackoverflow.com/q/24118103

http://stackoverflow.com/comment/37242041
type: QuestionComment
comment on: http://stackoverflow.com/q/24136221
has text: What do you need certification for?
score: 0
type: Comment

http://stackoverflow.com/comment/37409304
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24224622
score: 0
has text: @user3731979 You can't tell if files are different just by looking at the size. Different files might have the same size. Create a Hash from the file, compare it with the other file's hash. If they are the same, you have the same file (don't need to update) if not, download the update.

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

http://stackoverflow.com/comment/37211792
comment on: http://stackoverflow.com/a/24119899
has text: watch this image i want to add fxml inside scrollpane [link]( https://i.sstatic.net/DiPnk.png)
type: Comment
type: AnswerComment
score: 0

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

http://stackoverflow.com/a/24176167
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24162395
accepted answer of: http://stackoverflow.com/q/24162395
has body: It solved. As I described above, it doesn't work even if I completely delete the directory javax.* in appengine-api.jar. It just works only if I remove that jar file from /jre/lib/ext. I think there are still many "traces" in appengine-api.jar that affect to javamail.jar. After looking in that jar file, I found out there are 3 files in appengine-api.jar/META-INF/ which are affect to javamail.jar: jamamail.address.map javamail.charset.map javamail.providers I delete those 3 files and it works! That's enough, I don't have to delete the directory javax.* anymore, just delete those 3 files. I don't think this is the best solution but till now I can't find another solution for using both javamail.jar and appengine-api.jar in PC app.
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/q/24125066
favorite count: 0
type: Question
score: 3
has title: Java Console Game Development | Methods
answer count: 5
tagged with: java
has answer: http://stackoverflow.com/a/24125505
accepted answer: http://stackoverflow.com/a/24125365
has answer: http://stackoverflow.com/a/24125164
has answer: http://stackoverflow.com/a/24125429
possible better answer: http://stackoverflow.com/a/24125429
type: AnsweredQuestion
upvote count: 3
downvote count: 0
has body: Alright, allow me to elaborate on my dilemma. I'm making a Console Game with Java. It's not going to be super simple, but I don't want it to be really advanced either. I'm just trying to test my skills using the basics that I've learned. I've started a few times, but constantly ran into the same "problem". It's not exactly a problem though, just something I could do better. The best way to explain it is to just show some example code. Here is my Main class. We'll call it "Main.java". package com.mattkx4.cgamedev.main; public class Main { public static void main(String[] args) { } } Ok, now let's make a new method in our Main.java. We'll call this method "Start". Our Main class now looks like so: package com.mattkx4.cgamedev.main; import java.util.Scanner; public class Main { public static void main(String[] args) { } public static void start() { System.out.println("This is the start."); Scanner s = new Scanner(System.in); System.out.println("Enter \"NEXT\" to continue."); String in = s.nextLine(); if(in.equalsIgnoreCase("NEXT")) { }else{ System.out.println("Please input \"NEXT\"."); start(); } } } Now we'll add two more methods. We'll call them "middle" and "end". Our finished class now looks like so: package com.mattkx4.cgamedev.main; import java.util.Scanner; public class Main { public static void main(String[] args) { start(); } public static void start() { System.out.println("This is the start."); Scanner s = new Scanner(System.in); System.out.println("Enter \"NEXT\" to continue."); String in = s.nextLine(); if(in.equalsIgnoreCase("NEXT")) { middle(); s.close(); System.exit(0); }else{ System.out.println("Please input \"NEXT\"."); start(); } } public static void middle() { System.out.println("This is the middle."); System.out.println("Let's move on to the end."); end(); } public static void end() { System.out.println("This is the end.\nFinishing up, and heading back to the start() method to close program."); } } What I've written here is in my opinion a very inef…
has answer: http://stackoverflow.com/a/24125365
has answer: http://stackoverflow.com/a/24125462

http://stackoverflow.com/a/24131496
answers question: http://stackoverflow.com/q/24130052
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24130052
has body: my guess is that the following line in BufferedImage is failing rgbArray[off++] = colorModel.getRGB(raster.getDataElements(x, y, data)); rgbArray is the array passed in to the function. It needs to be quite big but the function will initialise it for you if you pass in null. Try replacing image.getRGB(0,0,w,h,pixels,0,w); with pixels = image.getRGB(0,0,w,h,null,0,w);
type: Answer

http://stackoverflow.com/comment/37366533
comment on: http://stackoverflow.com/a/24172581
score: 1
type: Comment
has text: Fathers of broker-based **AMQP** have years ago moved farther forward to create a faster & smarter **ZeroMQ** and later on to a spin-off **nanomsg** that is even more efficient. For professional grade Projects it is worth time to read a book on rather principles of the efficient & scaleable MQ from these smart guys >>> [Code Connected, Vol.1] available also in PDF from Pieter Hintjens. If you start with Fig.60 & Fig.62 before reading about details, you may IMHO build faster your full imagination of the power hidden inside real-world application MQ-layer design needs. Skip any code, get ideas.
type: AnswerComment

http://stackoverflow.com/a/24139978
has comment: http://stackoverflow.com/comment/37248858
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24139896
score: 3
has comment: http://stackoverflow.com/comment/37248935
has body: matches() will try to match the whole string on the regular expression. For your purpose you could use Matcher.find(): String s = "PING www.google.com (173.194.70.106) 56(84) bytes of data."; Pattern p = Pattern.compile("\\(([0-9]{1,3}\\.){3}[0-9]{1,3}\\)"); Matcher m = p.matcher(s); if (m.find()) { System.out.println(m.group(0)); }
type: Answer
answers question: http://stackoverflow.com/q/24139896
upvote count: 3

http://stackoverflow.com/q/24156005
has answer: http://stackoverflow.com/a/24156045
has answer: http://stackoverflow.com/a/24156197
favorite count: 0
type: Question
tagged with: split
has body: I am trying to split a string with "\" but its not working for me, the string contains alpha numeric data and some Japaneses characters.. Here is the code i am trying String [] folder = null; String [] files= null; for (int i =0; i&lt;listFile_Names.size();i++) { String filesList = listFile_Names.get(i); filesList = filesList.substring(1); Log.v("Fullpath",filesList ); try{ String[] parts = filesList.split("\\"); folder[i] = parts[0]; files[i] = parts[1]; } catch(Exception e){ e.printStackTrace(); } } for(int j=0; j&lt; folder.length; j++) { Log.v("Folders", folder[j].toString()); Log.v("Files", files[j].toString()); } Here is what LogCat Says 06-11 11:19:03.300: V/Fullpath(14600): A40-002(D155AX-8_DUAL仕様ﾁｪｯｸｼｰﾄ)\sheet001.html 06-11 11:19:03.300: W/System.err(14600): java.util.regex.PatternSyntaxException: Unrecognized backslash escape sequence in pattern near index 1: 06-11 11:19:03.300: W/System.err(14600): \ 06-11 11:19:03.300: W/System.err(14600): ^ 06-11 11:19:03.300: W/System.err(14600): at java.util.regex.Pattern.compileImpl(Native Method) 06-11 11:19:03.300: W/System.err(14600): at java.util.regex.Pattern.compile(Pattern.java:400) 06-11 11:19:03.300: W/System.err(14600): at java.util.regex.Pattern.&lt;init&gt;(Pattern.java:383) 06-11 11:19:03.300: W/System.err(14600): at java.util.regex.Pattern.compile(Pattern.java:374) 06-11 11:19:03.300: W/System.err(14600): at java.lang.String.split(String.java:1842) 06-11 11:19:03.300: W/System.err(14600): at java.lang.String.split(String.java:1823) 06-11 11:19:03.300: W/System.err(14600): at jp.co.komatsu.android.xlez.webservice.AsynTaskGetUpdatedFiles.doInBackground(AsynTaskGetUpdatedFiles.java:202)
downvote count: 0
score: 6
has answer: http://stackoverflow.com/a/31506385
upvote count: 6
possible better answer: http://stackoverflow.com/a/24156083
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37279287
has answer: http://stackoverflow.com/a/68770276
has answer: http://stackoverflow.com/a/24156220
has title: Splitting a string with "\" in Android
has answer: http://stackoverflow.com/a/24156083
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24156085
accepted answer: http://stackoverflow.com/a/24156045
answer count: 7
tagged with: string

http://stackoverflow.com/comment/37400831
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24219312
has text: @PavelRyzhov I can't do this now (old PC), but will do it tomorrow evening, edit the answer accordingly, and drop you a note (sorry for the delay)
type: Comment

http://stackoverflow.com/comment/37478790
has text: What are you trying to compare here? Disadvantages of Hashtable compared with what?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24261326

http://stackoverflow.com/a/24198929
has body: I don't think an enum is what you're looking for. From the Oracle Java tutorial's enum page here: An enum type is a special data type that enables for a variable to be a set of predefined constants. Constants. So making new instances really doesn't make sense. And that's also enforced at the language level. JLS section 8.9.2: It is a compile-time error if a constructor declaration in an enum declaration is public or protected (§6.6). In an enum declaration, a constructor declaration with no access modifiers is private. So there's your first problem. You can't have a public enum constructor. Second, you're slightly misunderstanding how enum constant constructors work. When you do something like MECH(...) You're effectively calling a constructor. And you can't do things like have int x in a constructor call. You're going to have treat it like any other constructor, which means either you get to put a method call there or some other expression that evaluates to something. Your first two parameters were OK, but the rest of them, not so much. For example, if I wanted to make a new String(), I can't do this: String s = new String(String putStringHere); Similar logic applies to your code. Honestly, I'm a little confused why you're using an enum. Seems to me like a regular old class would do just fine. (also, probably a typo, but your constructor should be capitalized)
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37376142
has comment: http://stackoverflow.com/comment/37381245
answers question: http://stackoverflow.com/q/24198706

http://stackoverflow.com/q/24232099
score: -1
has answer: http://stackoverflow.com/a/24232517
type: AnsweredQuestion
upvote count: 0
tagged with: stack
has body: I am trying to solve a maze in an object oriented way. My maze consists of fields, each field has an element attribute, an element is a wall, player, helper or endpoint. A field with an empty attribute is a path. Each field keeps track of his own neighbors in a HashMap. When the player hits a helper, the helper should solve the maze and show the correct path. I'm trying to find the endpoint by getting the current location of the helper and storing it's neighbors fields in a stack. This is the code as far as helper goes. The loop never ends, and I don't know why? public void findRoute() { Collection&lt;Field&gt; c = currentField.getHashMap().values(); Stack&lt;Field&gt; fieldNeighbours = new Stack&lt;Field&gt;(); for (Field field : c) { fieldNeighbours.push(field); } while (!endpointReached) { Field p = fieldNeighbours.pop(); if (p.getElement().getNaam().equals("endPoint")) { System.out.println("endPoint Reached! "); endpointReached = true; return; } if (!p.getElement().getNaam().equals("Wall")) { if (!p.getHashMap().get("north").getElement().getNaam().equals("Wall")) { fieldNeighbours.push(p.getHashMap().get("north")); } if (!p.getHashMap().get("south").getElement().getNaam().equals("Wall")) { fieldNeighbours.push(p.getHashMap().get("south")); } if (!p.getHashMap().get("east").getElement().getNaam().equals("Wall")) { fieldNeighbours.push(p.getHashMap().get("east")); } if (!p.getHashMap().get("west").getElement().getNaam().equals("wall")) { fieldNeighbours.push(p.getHashMap().get("west")); } } }
answer count: 1
has title: Using a stack to solve a maze Object Oriented (backtracking) issue
downvote count: 1
favorite count: 0
type: Question
tagged with: maze
tagged with: java
has comment: http://stackoverflow.com/comment/37423701
accepted answer: http://stackoverflow.com/a/24232517

http://stackoverflow.com/comment/37334220
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24175391
has text: LibraryActivity starts correctly and I can print messages in Logcat from this class. The Layout starts too (I have added buttons and some controls to check this) but the code in LibraryFragment isn't executed.

http://stackoverflow.com/a/24128026
score: 0
has comment: http://stackoverflow.com/comment/37236433
has body: Do you ever invoke the SetStrOuput(...) method? Follow Java naming conventions. Method names should NOT start with an upper case character.
type: Answer
answers question: http://stackoverflow.com/q/24127748
has comment: http://stackoverflow.com/comment/37262497
has comment: http://stackoverflow.com/comment/37264768
has comment: http://stackoverflow.com/comment/37260746
has comment: http://stackoverflow.com/comment/37261310
has comment: http://stackoverflow.com/comment/37237985
has comment: http://stackoverflow.com/comment/37236310

http://stackoverflow.com/comment/37459122
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24242652
has text: @user2968166 Yes, any mock object is built up with a series of `when` clauses to define behaviour. Without a `when` clause, Mockito returns a default value (e.g. `false`, `0`, `null`).

http://stackoverflow.com/comment/37323162
score: 2
has text: 1. standard Renderers concept works in Nimbus too, could be (in Java7) bugs sensitive, 2. did you tried custom L&F(s) based on Nimbus, there is used own injection to all keys in UIManager, overrode part of bugs, or unaccesible keys, 3. +1 for description, but -1 without an SSCCE/MCVE
comment on: http://stackoverflow.com/q/24179643
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24241762
has body: Just keep reference of your timer and use timer.cancel(); timer.purge(); to stop your timer.
type: Answer
accepted answer of: http://stackoverflow.com/q/24241209
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24241209

http://stackoverflow.com/a/29016353
answers question: http://stackoverflow.com/q/24233806
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: Another way is write a macro using Modelio API. This is a very simple example for PHP (only for prepare class and methods): if (selectedElements.size() &gt; 0): for c in selectedElements: print "&lt;?php" print "" print "class " + c.getName() print "{" child = c.getCompositionChildren() for a in child: if (a.getMClass().getName() == "Operation"): print " public function " + a.getName() + "()" print " {" print " }" print "" print "}" print "" else: print "No element has been selected." APIs for macros is here. API also allows you to save your generated code to files (for example you can use package names as directories and class names as file names).
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24233806

http://stackoverflow.com/a/36993908
type: Answer
score: 19
upvote count: 19
has body: If you're using Tomcat 8, it's really easy - add these two sections to your web.xml: HeaderSecurityFilter org.apache.catalina.filters.HttpHeaderSecurityFilter HeaderSecurityFilter /* The server response now has 'nosniff' and X-Frame-Options: DENY by default More detail: Tomcat 8 Filter Configuration
downvote count: 0
answers question: http://stackoverflow.com/q/24182367

http://stackoverflow.com/comment/135936263
score: 0
type: AnswerComment
has text: Hi @RatneZ, thanks for the answer. May I know why using an iterator can solve the issue?
type: Comment
comment on: http://stackoverflow.com/a/55412621

http://stackoverflow.com/comment/37418959
has text: Well I see that your question is indeed not very accepted... But I do not agree with the people that said it was unclear (how else could I've answered?). But yeah I'll help you with the typing code. This code works for me to press a key (as long as the window has focus) `new Robot().keyPress(KeyEvent.VK_G);` p.s. you can also upvote this answer ._.
comment on: http://stackoverflow.com/a/24221863
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24222276
accepted answer: http://stackoverflow.com/a/24222865
has comment: http://stackoverflow.com/comment/37404716
has answer: http://stackoverflow.com/a/24222865
linked to: http://stackoverflow.com/q/6115896
has comment: http://stackoverflow.com/comment/37404372
tagged with: jakarta-ee
has title: Creating a user friendly wrapper API with good error handling
has comment: http://stackoverflow.com/comment/37404797
type: Question
has comment: http://stackoverflow.com/comment/37404667
tagged with: java
has body: I am creating a wrapper API over a payment API that is pretty hard to use. All sort of things can go wrong when you do payment transactions; there is a problem with the card, the payment was refused by the clients bank, 3D secure issue and the list goes on (around 20 error codes). From the payment API this information is provided in a normal String field. The error code will e.g. be Card_not_eligible. What I want to do is to provide a better way to handle such errors. I have been thinking of creating own exceptions for each of these error codes. Does this sound crazy? If not would you use checked or unchecked exceptions? Forced catch of 20 errors or more is probably not an good idea? Or do you have a better solution for this type of error handling?
has comment: http://stackoverflow.com/comment/37404500
has comment: http://stackoverflow.com/comment/37404597
has comment: http://stackoverflow.com/comment/37404400
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/27578
score: 0
answer count: 1

http://stackoverflow.com/q/24263920
answer count: 1
tagged with: macos
accepted answer: http://stackoverflow.com/a/24264732
type: Question
has answer: http://stackoverflow.com/a/24264732
linked to: http://stackoverflow.com/q/15079783
has body: i am trying to make my mac tray icon as suggested in How to make my app icon bounce in the Mac dock this works fine with pure java applications and swings but this doesn't works with e4 swt applications , how to make it bounce in this type applications ref: pfa of the sample code in the following link https://bugs.eclipse.org/bugs/show_bug.cgi?id=321949
has title: How to make my e4 swt app icon bounce in the Mac dock
tagged with: e4
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: swt

css
tags question: http://stackoverflow.com/q/24166025
tags question: http://stackoverflow.com/q/24107617
tag name: css
tags question: http://stackoverflow.com/q/24207904
tags question: http://stackoverflow.com/q/24259231
type: Tag
tags question: http://stackoverflow.com/q/24215177
tags question: http://stackoverflow.com/q/24180345
tags question: http://stackoverflow.com/q/24242809

http://stackoverflow.com/q/24122038
has comment: http://stackoverflow.com/comment/37215380
has comment: http://stackoverflow.com/comment/37215343
has comment: http://stackoverflow.com/comment/37215546
type: AnsweredQuestion
score: 0
tagged with: exception
tagged with: java
has answer: http://stackoverflow.com/a/24122202
accepted answer: http://stackoverflow.com/a/24122202
has body: I'm fairly new to using try and catch statements and I'm having a bit of trouble with return statements. Upon compiling my code I got an unreported IOException in: fileFtp = client.listNames(); So I tried wrapping this statement in a try and then wrote a catch for the exception but then the fileName array was no longer visible, so I wrapped the entire method in a try{} and used a catch at the end and put the return statement which returned the fileName after the end of the catch{}, but this didn't work either since fileName was no longer visible as it was in the try{} So how can I meet the exception report requirements while still having fileName and fileFtp arrays initialized? private String[] checkDirectories(){ String[] fileFtp; String[] fileName; try{ fileFtp = client.listNames(); } catch(IOException ex){ System.out.println("IOException in checkDirectories()"); ex.printStackTrace(); } fileName = new String[fileFtp.length]; for (int i=0; i&lt;fileFtp.length; i++){ fileName[i] = fileFtp[i]; } return fileName; }
has answer: http://stackoverflow.com/a/24122138
possible better answer: http://stackoverflow.com/a/24122138
has title: try and catch blocks in return methods
type: Question
answer count: 2

http://stackoverflow.com/comment/37390127
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24207529
type: QuestionComment
has text: Does your Extension class (PluginTaskExtension) contain a appVersion property?

http://stackoverflow.com/comment/37371781
score: 0
type: AnswerComment
has text: @DaveMorrisey I want to check for date Est Time Zone GMT-5
comment on: http://stackoverflow.com/a/24205148
type: Comment

zxing
tags question: http://stackoverflow.com/q/24193648
type: Tag
tags question: http://stackoverflow.com/q/24191879
tag name: zxing

http://stackoverflow.com/a/24160850
has comment: http://stackoverflow.com/comment/37420319
upvote count: 1
answers question: http://stackoverflow.com/q/24132167
score: 1
type: Answer
has body: Something like this should work: PersistenceUnitDescriptorAdapter pu = new PersistenceUnitDescriptorAdapter() { @Override public List&lt;String&gt; getManagedClassNames() { return Arrays.asList( MyClass.class.getName(), ... ); } }; Map&lt;Object, Object&gt; settings = new HashMap&lt;Object, Object&gt;(); settings.put( "javax.persistence.schema-generation.scripts.action", "create" ); settings.put( "javax.persistence.schema-generation.scripts.create-target", "&lt;path-to-export-file&gt;" ); EntityManagerFactoryBuilderImpl factoryBuilder = new EntityManagerFactoryBuilderImpl( pu, settings ); factoryBuilder.generateSchema(); It relies on Hibernate internal classes, but so did your earlier solution. You could create a issue here - https://hibernate.onjira.com/browse/HHH - explaining your use case. Maybe a solution using a public API can be made available.
downvote count: 0

http://stackoverflow.com/comment/38011208
score: 0
type: Comment
type: AnswerComment
has text: Oh OH OH! I get it now! I'm gonna try this and see if it works! :D
comment on: http://stackoverflow.com/a/24354029

http://stackoverflow.com/comment/37192898
score: 0
comment on: http://stackoverflow.com/a/24109859
type: Comment
has text: And where do I use that?
type: AnswerComment

http://stackoverflow.com/comment/37496769
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24256630
has text: I've added code for 2 xml files hope you can find somethig is wrong there

http://stackoverflow.com/comment/37456431
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24249412
has text: Why does the client have to talk to the database directly? Server queries database locally and gives data to client over HTTP.
score: 0

http://stackoverflow.com/a/24200816
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37364959
accepted answer of: http://stackoverflow.com/q/24200472
has body: I don't know the jxl library very well, and I couldn't get your example running (what import should I use for Number?), but: The Excel file formats not only stores formulas, but also the calculated results in the file. So when you change the values A and B, you somehow need to re-evaluate the formulas in order for the new result to be stored. Most likely, the formula is not re-evaluated and still returns the old value. Looking at the jxl API, there is a command setRecalculateFormulasBeforeSave() that might be of help when used at the right place (likely before your copy.write(): tempSheet.getSettings().setRecalculateFormulasBeforeSave(true); Sadly, I couldn't try it out myself as I wasn't able to get your example running, but it might be worth a try. UPDATE: okay, finally got your example working. My approach above does not help. My interpretation: As mentioned, the Excel file format does store formula results in the file. Changing cell values need re-evaluation of formulas. This re-evaluation/recalculation is only done by Excel itself, but not by JXL. Thinking a bit more about this, this makes sense: If JXL would need to recalculate the values, it would have to support all the formulas supported by Excel itself, including all the complex statistical and financial formulas, which is likely just too much. So all JXL can do is change the values of cells, but the actual calculation it cannot do. So, except opening the created file in Excel and re-saving it, there seems to be no other way to update the formula result.
type: Answer
has comment: http://stackoverflow.com/comment/37371359
score: 0
has comment: http://stackoverflow.com/comment/37371729
answers question: http://stackoverflow.com/q/24200472

http://stackoverflow.com/comment/37286326
type: Comment
has text: If you write System.out.println, without the brackets, that will take care of everything. (I edited my answer)
type: AnswerComment
comment on: http://stackoverflow.com/a/24160222
score: 1

http://stackoverflow.com/q/24257555
answer count: 1
tagged with: eclipse
type: Question
type: UnansweredQuestion
has title: How to bind data in java?
has answer: http://stackoverflow.com/a/24257624
score: 0
has body: I will read the data from an xml file and list the properties of the elements in a page. With my code you can already read the data and store them in a list. But unfortunately, data binding does not work. Please help .. bookHandler public class bookHandler implements ContentHandler { private String currentValue; boolean tablecaption; private boolean bookObjectCreated = false; private boolean inbookSection = false; bookObject currentbookObject; private boolean inbody = false; private boolean namebook = false; private boolean authbook = false; private List<bookObject> booksList = null; public List<bookObject> getbookList() { return booksList; } public void characters(char[] ch, int start, int length) throws SAXException { currentValue = new String(ch, start, length); } public void startElement(String uri, String localName, String qname, Attributes atts) throws SAXException { if ((localName.equals("TABLE-PRE")) && (atts.getValue("ID").equals("action"))) { inbookSection = true; } if (inbookSection) { if (localName.equals("BODY")) { inbody = true; } } if (inbody) { if (localName.equals("ROW")) { bookObjectCreated = true; currentbookObject = new bookObject(); if (booksList == null) booksList = new ArrayList<bookObject>(); } if (bookObjectCreated) { if (localName.equals("ENTRY") && (atts.getValue("COLNAME").equals("col1"))) { namebook = true; } else if (localName.equals("ENTRY") && (atts.getValue("COLNAME").equals("col2"))) { authbook = true; } } } } public void endElement(String uri, String localName, String atts) throws SAXException { if (bookObjectCreated) { if (namebook) { if (atts.equals("P")) { currentbookObject.setName(currentValue); namebook = false; } } else if (authbook) { if (atts.equals("P")) { currentbookObject.setAuth(currentValue); authbook = false; } } if (atts.equals("ROW")) { bookObjectCreated = false; booksList.add(currentbookObject); authbook = false; } } if (atts.equals("BODY")) { inbody = false; inbookSection = false; } } bookObject.java public class …
tagged with: xml-parsing
tagged with: java

http://stackoverflow.com/q/24113288
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/43882049
has answer: http://stackoverflow.com/a/24199971
answer count: 2
tagged with: java
tagged with: file-upload
favorite count: 0
type: Question
tagged with: netty
has body: I can send this POST request with some jpg file to my server POST /formpostmultipart HTTP/1.1 Host: localhost:8080 Connection: keep-alive Content-Length: 621551 Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Origin: http://localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2031.2 Safari/537.36 Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryY1m4URqQ5ydALOrQ Referer: http://localhost:8080/upload Accept-Encoding: gzip,deflate,sdch Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4 what must i do for get file from this request and save to disk for example? p.s. sorry for my bad english
downvote count: 0
score: 4
possible better answer: http://stackoverflow.com/a/43882049
accepted answer: http://stackoverflow.com/a/24199971
has title: How get file data from post request in NETTY 4?
upvote count: 4

http://stackoverflow.com/q/24161848
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/37289958
has comment: http://stackoverflow.com/comment/37289618
tagged with: android
score: -1
has comment: http://stackoverflow.com/comment/37289936
type: AnsweredQuestion
has body: I am using public class DatabaseHandler that extends SQLiteOpenHelper and this is my method to get all the data from the db, it looks all fine but crashes, and activity says nullpointerException. Is there anything to change in the code? I have only one row of information.. // Getting all data public Cursor getData(String UserName, String Email, String Password, String BirthDate, String PinCode, String Country, String PaypalID, String mobile, String FBID) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_DATA, new String[] { "UserName", "Email", "Password", "BirthDate", "PinCode", "Country", "PaypalID", "mNUMBER", "FBID" }, null, null, null, null, null, null); if (cursor != null) { if (cursor.moveToFirst()) { do { Log.i("counttttttttttttt", "" + cursor.getCount()); UserName = cursor.getString(0); Email = cursor.getString(1); Password = cursor.getString(2); BirthDate = cursor.getString(3); PinCode = cursor.getString(4); Country = cursor.getString(5); PaypalID = cursor.getString(6); mobile = cursor.getString(7); FBID = cursor.getString(8); } while (cursor.moveToNext()); } } db.close(); return cursor; } In, Account Activity, db = new DatabaseHandler(AccountActivity.this); // Declared all String db.getData(name, email, password, birthdate, pincode, country, paypal, mobile, fbid); and set those String to TextView as required.. but it says nullpointer exception.
answer count: 2
accepted answer: http://stackoverflow.com/a/24184803
has title: Getting NullPointerException while getting data from SQLiteDatabase in android
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24184803
tagged with: sqlite
has comment: http://stackoverflow.com/comment/37290232
has comment: http://stackoverflow.com/comment/37290010
possible better answer: http://stackoverflow.com/a/24163302
tagged with: android-sqlite
downvote count: 1
has answer: http://stackoverflow.com/a/24163302
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37289480
has comment: http://stackoverflow.com/comment/37290756

http://stackoverflow.com/q/24234728
has body: I've looked around but can't find exactly what I'm looking for. What I have going on is I have a class defined that is meant to represent a region in a JPanel that you can draw to which it does by creating a bufferedImage of the specified size and uses that images graphics to doubleBuffer to the JPanel, and that region is then drawn as an image to the parent JPanel, essentially creating panel regions without having to deal with javax's crazy panel organizing logic that depends on all panels touching boarders. This is essentially a graphics context for graphics widgets that can move/resize etc, similar to video game UI. What I'm trying to do is I want to be able to store method calls to draw operations in the graphics class, parameters included. The purpose for this is so that I can, either at runtime or in source code, load in methods with the parameter's values already specified that can just be called without having to break encapsulation, because as it stands either the parent class has to draw directly to the bufferedimage, something I would like to avoid so that methods can be added at runtime, or the method calls for drawing have to be done in the PanelRegion class itself, forcing me to create a new specialized PanelRegion every time I want another PanelRegion, which just won't work effeciently. What I would like to be able to do is simply something like: Class graphics = panelRegion.getGraphics(); String methodName = "drawRectangle"; int xPos = 0; int yPos = 0; int width = 0; int height = 0; ImaginaryMethodClass method = graphics.getMethod(methodName, int, int, int, int); method.imaginaryMethodThatLoadsParameterValues(xPos, yPos, width, height); panelRegion.addMethod(method); panelRegion.invokeDrawMethods(); public void invokeDrawMethods() { for(ImaginaryMethodClass aMethod : listOfMethods) { aMethod.imaginaryMethodThatExecutesTheMethodWithTheLoadedParameterValues(); } } If this isn't making sense, essentially the only solution I've found is you can abstractl…
favorite count: 0
has answer: http://stackoverflow.com/a/24234934
has answer: http://stackoverflow.com/a/40886544
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24234934
has title: Java: store method calls in an array and execute later?
possible better answer: http://stackoverflow.com/a/40886544
tagged with: abstraction
type: Question
answer count: 2
upvote count: 12
score: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/37428354
tagged with: methods

http://stackoverflow.com/a/24257350
score: 6
upvote count: 6
downvote count: 0
answers question: http://stackoverflow.com/q/24257335
has body: The method ConfigFilePath is returning a value. You have to assign that returned value to the variable path: path = ConfigFilePath(path); Note: Try to follow Java naming conventions. Use mixedCase for methods/variables and use CamelCase for classes/interfaces
type: Answer

http://stackoverflow.com/comment/37413696
has text: You didn't execute class `B`. Also, how was the output `-12` when you printed `12`? Was that a typo?
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24227114

http://stackoverflow.com/a/39686087
score: 5
has body: I have written a library for this, which gets you free from doing the chores needed for managing android accounts, such as defining a bound service, authenticator xml, etc. Working with that is in 5 simple steps: Step 1 Add this to dependencies for build.gradle of the app: compile 'com.digigene.android:account-authenticator:1.3.0' Step 2 Define your authentication account type as a string in strings.xml: DigiGene Replace ‘DigiGene’ with your own account type. This is what appears in Android Accounts in this screenshot. Step 3 Design your registration layout for registering the users (e.g. this image): <?xml version="1.0" encoding="utf-8"?> <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.digigene.authenticatortest.MainActivity"> <EditText android:id="@+id/account_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:hint="User Name" /> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/account_name" android:gravity="center_horizontal" android:hint="Password" android:inputType="textPassword" /> </RelativeLayout> and make a new class, say MyRegistrationActivity.java, with the following code: import com.digigene.accountauthenticator.activity.RegistrationActivity; public class MyRegistrationActivity extends RegistrationActivity { private EditText accountNameEditText, passwordEditText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.registration_layout); accountName…
answers question: http://stackoverflow.com/q/24227274
upvote count: 5
downvote count: 0
type: Answer

http://stackoverflow.com/q/24172983
has answer: http://stackoverflow.com/a/24173063
upvote count: 3
downvote count: 0
answer count: 1
has body: I'm getting this weird NPE in my clojure hello world (ns test-app.core (:gen-class)) (defn -main [&amp; args] ( (println "Hello")) ) Notice the extra () around the (println "Hello"). That seems to be the problem, if i remove that its just fine. And the output of the program. Notice that the code actually printed "Hello" and the threw. Hello Exception in thread "main" java.lang.NullPointerException at test_app.core$_main.doInvoke(core.clj:5) at clojure.lang.RestFn.invoke(RestFn.java:397) at clojure.lang.Var.invoke(Var.java:411) at user$eval5$fn__7.invoke(form-init9064825970813284041.clj:1) at user$eval5.invoke(form-init9064825970813284041.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6619) at clojure.lang.Compiler.eval(Compiler.java:6609) at clojure.lang.Compiler.load(Compiler.java:7064) at clojure.lang.Compiler.loadFile(Compiler.java:7020) at clojure.main$load_script.invoke(main.clj:294) at clojure.main$init_opt.invoke(main.clj:299) at clojure.main$initialize.invoke(main.clj:327) at clojure.main$null_opt.invoke(main.clj:362) at clojure.main$main.doInvoke(main.clj:440) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:419) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) [Finished in 4.0s with exit code 1] My question is why is this happening? Or better: So is this a bug in or is it expected behaviour? I assume that's because the first arg of a list should be the name of a function, and here its another list :P. but shouldn't the complier/runtime give a nicer error in that case? Thx in advance.
accepted answer: http://stackoverflow.com/a/24173063
favorite count: 0
type: AnsweredQuestion
score: 3
tagged with: nullpointerexception
tagged with: java
has title: Clojure NPE in main
tagged with: clojure
type: Question

http://stackoverflow.com/a/24219931
answers question: http://stackoverflow.com/q/24218945
downvote count: 0
upvote count: 1
has body: \n works , and i was trying for, %0a var body = "Hello from Govind Singh Nagarkoti!\n Your verification code is " + code
score: 1
type: Answer

http://stackoverflow.com/a/24173235
score: 0
has comment: http://stackoverflow.com/comment/37311890
has body: I hope it have latest Google Play services APK Better that just hoping for it: isGooglePlayServicesAvailable
has comment: http://stackoverflow.com/comment/37311860
type: Answer
answers question: http://stackoverflow.com/q/24173214

http://stackoverflow.com/q/24171653
type: Question
has answer: http://stackoverflow.com/a/24171944
accepted answer: http://stackoverflow.com/a/24171944
has comment: http://stackoverflow.com/comment/37309232
has comment: http://stackoverflow.com/comment/37309258
has comment: http://stackoverflow.com/comment/37308985
has comment: http://stackoverflow.com/comment/37309352
has title: MySQL select performance issue with JDBC
type: AnsweredQuestion
score: 0
has body: I'm having a performance issue with MySQL (v5.5) while running a local Java application using mysql-connector v5.1.30 I have 2 tables called A and B. I run something like this: PreparedStatement stmtA = conn.prepareStatement("select x, y, z, u, v, w from A"); PreparedStatement stmtB = conn.prepareStatement("select val from B where something = ?"); ResultSet result = stmtA.executeQuery(); while ( resultA.next() ){ // do something with result row if (some condition) { // true approx. 80% of the time ResultSet resultB = stmtB.executeQuery(some_value_from_resultA); // do something with result row resultB.close(); } } stmtA.close(); The problem is that this takes ~12 minutes to complete every time. Here's a few relevant bits of information: The mysqld process is using 95-99% CPU for the 12 minute duration The java process is using 1-4% CPU for the 12 minute duration Memory usage for both processes is negligable Table A has 65,000 records, 18 columns (all VARCHAR except for Id) and uses MYISAM Table B has 51,000 records, 4 columns (3 INT and 1 VARCHAR) and uses MYISAM There is no index/key on the Table B column that I'm querying I'm running Ubuntu 12.04 with a Core i5 and 4GB RAM Aside from the fact that the CPU usage of the mysql process is crazy, the reason I think there is a problem is because the application has additional functionality that runs an almost identical method against a different database table. This table has a similar number of columns to table A (also using MYISAM) but one big difference is that there is no table B here. So it works the same as above but without having to query a second table while iterating the rows of the first table. This other table has 4,500 rows and the iteration takes less than 1 second. So it would appear that the nested query of table B is causing the problem, but I'm not sure. I have limited experience with MySQL. If you need any more info, please ask.
tagged with: sql
tagged with: java
answer count: 1
tagged with: mysql
has comment: http://stackoverflow.com/comment/37309641

http://stackoverflow.com/comment/37438343
score: 0
has text: how to update maven dependencies
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24182305

http://stackoverflow.com/q/24192038
score: -2
has comment: http://stackoverflow.com/comment/37346835
tagged with: java
possible better answer: http://stackoverflow.com/a/24192236
has title: arithmetic expression Math.random in java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24192236
has comment: http://stackoverflow.com/comment/37346735
accepted answer: http://stackoverflow.com/a/24192509
upvote count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/37346625
has body: the purpose of this program is to let the user try to guess a number up to 20 randomly chosen by the computer. The user inputs their guess. The computer then tells the user if their guess is too high or too low. The user keeps inputting their guess until theu guess correctly. Then they are told how many guesses it took them. The problem is that I am not understanding whether the arithmetic expression in the program generates random numbers from 1 to 20 because when I am inputting numbers from 1 to 20, the pop-up says 'number is too big'. package pkTopic6Exercise13; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.Font; public class Topic6Exercise13 { private GuessingGame MyGuessingGame = new GuessingGame(); private Topic6Exercise13() {//constructor } public static void main(String[] args) { Topic6Exercise13 myTopic6Exercise13 = new Topic6Exercise13(); myTopic6Exercise13.go(); } private void go() { T6Ex13GUIin myT6Ex13GUIin = new T6Ex13GUIin(); } private class GuessingGame { private int NumToGuess=0; private int Guess=0; private int NumGuesses=0; private GuessingGame() {//constructor } private void GenerateNum() { NumToGuess = 1+(int)(20*Math.random()); } private String CheckNum() { NumGuesses = NumGuesses + 1; if (Guess &gt; NumToGuess) { JOptionPane.showMessageDialog(null, Guess + " is too BIG!"); return "NotGuessed"; } else if (Guess &lt; NumToGuess) { JOptionPane.showMessageDialog(null, Guess + " is too SMALL!"); return "NotGuessed"; } else { JOptionPane.showMessageDialog(null, "Well done! " + Guess +" is correct, it took " + NumGuesses + " goes."); return "Guessed"; } } } private class T6Ex13GUIin extends JFrame { private JLabel lblGuess; private JTextField txfGuess; private JButton btnPickNumber; private JButton btnQuit; private T6Ex13GUIin() {//constructor Font fontDialog = new Font("Dialog", Font.BOLD,24); this.setSize(1000,500); th…
has answer: http://stackoverflow.com/a/24192509
favorite count: 0
has comment: http://stackoverflow.com/comment/37346845
type: AnsweredQuestion

http://stackoverflow.com/comment/37311890
type: Comment
comment on: http://stackoverflow.com/a/24173235
type: AnswerComment
has text: You can check if it is the required version for your app with above method.
score: 0

http://stackoverflow.com/comment/37208995
has text: I do not mean to modify the jar, but copy the original build.properties and put in your desire classpath, get the source of QuartzScheduler and modify only the part of the code which read build.properties. And place your compiled class file in the correct package. This will read your build.propeties.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24116785
score: 0

http://stackoverflow.com/q/24176690
score: 0
has title: simple Circle on circle Collision libgdx
tagged with: libgdx
tagged with: android
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/24177472
type: Question
tagged with: c++
tagged with: geometry
has body: made two circles one of radius 8(image 16x16) and one of radius 20( image 40x40) i am calling the circle over overlap method and the collsion is just off. It is colliding with a circle that is around the 0,0 point of where ever my image of the ball is. the bullet can go within the ball on the bottom and right sides. public class MyGame extends ApplicationAdapter { SpriteBatch batch; Texture ballImage, bulletImage; OrthographicCamera cam; Circle ball; Array &lt;Circle&gt; bullets; long lastShot; @Override public void create () { System.out.println("game created"); ballImage = new Texture(Gdx.files.internal("ball.png")); bulletImage = new Texture(Gdx.files.internal("bullet.png")); cam = new OrthographicCamera(); cam.setToOrtho(true,320,480);//true starts top right false starts top left batch = new SpriteBatch(); ball = new Circle(); ball.radius=20; ball.x=320/2-ball.radius; // half screen size - half image ball.y=480/2-ball.radius; bullets = new Array&lt;Circle&gt;(); spawnBullet(); /* batch.draw(bulletImage,bullet.x,bullet.y); bullet.x++; bullet.y++; */ } public void spawnBullet() { Circle bullet = new Circle(); bullet.radius=8; bullet.x=0; bullet.y=0; bullets.add(bullet); lastShot = TimeUtils.nanoTime(); } @Override public void render () { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); cam.update(); batch.setProjectionMatrix(cam.combined); batch.begin(); batch.draw(ballImage,ball.x,ball.y); for(Circle bullet: bullets) { batch.draw(bulletImage, bullet.x, bullet.y); } batch.end(); if(Gdx.input.isTouched()) { Vector3 pos = new Vector3(); pos.set(Gdx.input.getX(), Gdx.input.getY(),0); cam.unproject(pos); ball.y = pos.y - ball.radius; ball.x = pos.x - ball.radius ; } //if(TimeUtils.nanoTime()-lastShot &gt;1000000000) one second //spawnBullet(); Iterator&lt;Circle&gt; i = bullets.iterator(); while(i.hasNext()) { Circle bullet = i.next(); bullet.x++; bullet.y++; if(bullet.overlaps(ball)) { System.out.println("overlap"); i.remove(); } } } }
has answer: http://stackoverflow.com/a/24177472
type: AnsweredQuestion

http://stackoverflow.com/comment/37384986
score: 0
comment on: http://stackoverflow.com/a/24211453
type: Comment
has text: Thanks. Can you explain more on the serialization part? Would there be `if-else` for mapper?
type: AnswerComment

http://stackoverflow.com/q/24234777
has answer: http://stackoverflow.com/a/24235219
has answer: http://stackoverflow.com/a/24235209
favorite count: 0
linked to: http://stackoverflow.com/q/5224877
type: Question
has comment: http://stackoverflow.com/comment/37428673
tagged with: java
has title: retrieving random elements in an array without duplicating positions
has body: I want to retrieve elements from an array, but make it so if an element position was already chosen it wouldn't be duplicated. What would be the best and/or most readable way to do this? The method I had in mind only works for numbers, and is limited when an element has a duplicate in another position. The closest I found was this: Java - generate Random range of specific numbers without duplication of those numbers - how to? but it didn't apply since I don't need all the elements in the array. Though it made me realize a possible 'solution' would be to shuffle and then iterate through the array for the amount I require, but I was wondering how else this could be done?
tagged with: duplicates
has comment: http://stackoverflow.com/comment/37428529
has comment: http://stackoverflow.com/comment/37428349
has comment: http://stackoverflow.com/comment/37428434
score: 2
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24235219
answer count: 2
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/24235209

http://stackoverflow.com/comment/37279504
type: QuestionComment
comment on: http://stackoverflow.com/q/24155966
score: 0
has text: @jsjunkie it's blank page when I type that.
type: Comment

http://stackoverflow.com/q/24188199
has answer: http://stackoverflow.com/a/28693630
type: Question
answer count: 1
has title: SSL Connection error on Weblogic
has body: I am working on application. It is deployed on Weblogic and using the cluster. After few hits on the application we are geeting SSL Connection Error. On server Logs I saw this javax.net.ssl.SSLException: Received fatal alert: unexpected_message at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1639) at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1607) at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1776) at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1080) at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:884) at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:758) at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:664) at weblogic.security.SSL.jsseadapter.JaSSLEngine$5.run(JaSSLEngine.java:134) at weblogic.security.SSL.jsseadapter.JaSSLEngine.doAction(JaSSLEngine.java:732) at weblogic.security.SSL.jsseadapter.JaSSLEngine.unwrap(JaSSLEngine.java:132) at weblogic.socket.JSSEFilterImpl.unwrap(JSSEFilterImpl.java:585) at weblogic.socket.JSSEFilterImpl.unwrapAndHandleResults(JSSEFilterImpl.java:490) at weblogic.socket.JSSEFilterImpl.unwrapAndHandleResults(JSSEFilterImpl.java:457) at weblogic.socket.JSSEFilterImpl.isMessageComplete(JSSEFilterImpl.java:306) at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:960) at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:897) at weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:130) at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29) at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119) Can any body please help me to resolve this.
accepted answer: http://stackoverflow.com/a/28693630
tagged with: ssl-certificate
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
tagged with: weblogic12c
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/37213521
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24121021
score: 0
has text: Your example code will recognize the data you provided as two hits. Is this intended?

http://stackoverflow.com/q/24224438
type: Question
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/24224492
upvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/37408681
has comment: http://stackoverflow.com/comment/37408656
type: AnsweredQuestion
has title: Java Arrays 2 x 2 and how they work
has body: http://www.willamette.edu/~gorr/classes/cs231/lectures/chapter9/arrays2d.htm I was taking a look at that link above under the "Array of Objects" section. This code is given from the above link for (int i=0; i &lt; board.length ; i++) for (int j=0; j &lt; board[i].length ; j++) board[i][j] = rand.nextInt(10); Can someone explain to me in detail for newbies that snippet of code and how it works to fill in the grid with random integers especially the part with board.length and board[i].length
tagged with: java
accepted answer: http://stackoverflow.com/a/24224492
favorite count: 0
has answer: http://stackoverflow.com/a/24225769
possible better answer: http://stackoverflow.com/a/24225769

http://stackoverflow.com/comment/37364678
score: 0
comment on: http://stackoverflow.com/q/24200095
type: Comment
type: QuestionComment
has text: Yes i add maxOccurs attribute and solved my problem. Thank you ;)

http://stackoverflow.com/a/24186606
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24185782
has body: <?xml version="1.0" encoding="UTF-8"?> DWR Servlet dwr-invoker org.directwebremoting.servlet.DwrServlet debug true dwr-invoker /dwr/* is not a valid web.xml (this is not even valid XML) The root element of a web.xml is web-app. Please refer to the documentation to understand how a web deployment descriptor should look like and what it is for. You could edit you web xml in this way: DWR Servlet dwr-invoker org.directwebremoting.servlet.DwrServlet debug true dwr-invoker /dwr/* version="3.0" must be support supported by your application server (for example tomcat 7.x) Otherwise pleas look for the corresponding declarations for the servlet spec your app-server implements, for example for 2.5
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24185782
has comment: http://stackoverflow.com/comment/37336674
score: 3

http://stackoverflow.com/q/24216859
has body: I have query in finding the repeating groups in the below input string. Objective: A line must have 4 or more occurences of [Key:value] pair.(with rectangular braces) Input: &lt;2014/06/14-11:03:06.695&gt;+Timer-11+INFO@TimeLogger.logTime: [Process Name : Nav Calculations] [Total Time : 7 ms][Wait Time : 0 ms][Execution Time : 7 ms]. Snippet: final Pattern p = Pattern.compile("(\\[.*?\\]){4,}"); final Matcher m = p.matcher(s); while (m.find()) { System.out.println(m.group()); } With the above snippet, the matcher couldnot find the match. But if i change the pattern to "(\\[.*?\\]){3}")" , it returns the below value. [Process Name : Nav Calculations] [Total Time : 7 ms][Wait Time : 0 ms][Execution Time : 7 ms] I went through the previous other posts regarding regex as well. But couldnt understand what am i missing here. Why the regular expression "(\\[.*?\\]){4,}" does not work. What should I change in this regular expression to meet my objective Kindly guide me from here.
has title: Multiple Occurences of groups in java regular expression
tagged with: java
tagged with: regex
has answer: http://stackoverflow.com/a/24216897
score: 2
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/24216897
answer count: 1
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/a/24189546
has comment: http://stackoverflow.com/comment/37341655
upvote count: 0
answers question: http://stackoverflow.com/q/24189480
downvote count: 1
type: Answer
has body: Per this thread, the sorting runtime will be O(n*log n) since Arrays.sort() uses a modified version of quicksort, whether the array is already sorted or not.
has comment: http://stackoverflow.com/comment/37341894
score: -1

http://stackoverflow.com/comment/37472060
comment on: http://stackoverflow.com/a/24196517
score: 0
type: Comment
has text: you can find the JIRA for Spring Data MongoDB here: https://jira.spring.io/browse/DATAMONGO
type: AnswerComment

http://stackoverflow.com/a/24209768
has comment: http://stackoverflow.com/comment/37381587
accepted answer of: http://stackoverflow.com/q/24209702
score: 10
answers question: http://stackoverflow.com/q/24209702
type: Answer
has comment: http://stackoverflow.com/comment/37381348
downvote count: 0
upvote count: 10
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37381399
has body: The reason for this is that when you box an int into an Integer, you may or may not create a new Integer instance. If you do, then the new instance may not have reference equality with other Integer instances, even if they share the same value. AtomicReference.compareAndSet() uses reference equality (identity) for comparisons. The key is in how the compiler handles automatic boxing of int values: it emits calls to Integer.valueOf(). As an optimization, Integer.valueOf() has a cache of boxed integers, and by default that cache includes values up to 128. If you box an integer n twice, you will get the same Integer reference back each time if the value was small enough to be in the cache; otherwise, you will get two separate instances. Currently, you unbox the old value, compute the new value, and when you call compareAndSet() you box the old value again. Once you hit 128, you stop getting cached values, so the second boxed copy is no longer the same one that's in the AtomicReference.

http://stackoverflow.com/a/24181759
score: 2
downvote count: 0
has body: Seeing as you're trying to decouple the process from a specific implementation, you will need to provide some kind of API which would allow you to provide feedback in some uniform manner. Probably the simplest approach would be to provide the BackgroundTask class with some kind of observer/listener, which interested parties could register with for notification and the BackgroundTask could use to provide feedback. This would allow BackgroundTask to raise events about a given state change or other notification and the implementations would be able to handle in an implementation specific manner.
upvote count: 2
answers question: http://stackoverflow.com/q/24173832
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24173832

http://stackoverflow.com/a/24236225
score: 5
downvote count: 0
has body: The uppercase Y stands for "week year". You need the lowercase y in your format. Here's the javadoc for SimpleDateFormat. It shows you how to create your patterns and this is what your patterns should look like: private final static String DATE_TIME_FORMAT_FILE = "dd_MM_yyyy_HH_mm"; private final static String DATE_TIME_FORMAT_DATA = "dd/MM/yyyy HH:mm";
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/24236212

http://stackoverflow.com/a/24254646
has body: It Should be something like that: public class MyClass { public void setSerial(int ser) { serialNumber = ser; } public double computeArea() { return width*length; } } But that won't work: public void displayBoxes(){ MyClass myClass = new MyClass(); DecimalFormat df = new DecimalFormat("0.000"); System.out.println(toString()); System.out.println("The rectangle with the serial number " + myClass.setSerial(12345) + " has the largest area: " + myClass.ComputerArea()); Because: a. The setSerial() method is void. Doesn't return anything. b. The ComputerArea() method doesn't take any arguments so there's no knowledge of what is width and what is length in the computerArea() method....
type: Answer
accepted answer of: http://stackoverflow.com/q/24254582
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24254582
score: 0

http://stackoverflow.com/q/24233659
score: 0
has comment: http://stackoverflow.com/comment/37426303
answer count: 1
has comment: http://stackoverflow.com/comment/37426185
tagged with: error-handling
has comment: http://stackoverflow.com/comment/37426352
upvote count: 1
has comment: http://stackoverflow.com/comment/37426115
has title: Catch handler for multiple exceptions?
downvote count: 1
has comment: http://stackoverflow.com/comment/37426098
has comment: http://stackoverflow.com/comment/37426239
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37426470
has comment: http://stackoverflow.com/comment/37426023
has comment: http://stackoverflow.com/comment/37426365
has body: I am experimenting with exceptions and i want to ask when it is possible to handle multiple exceptions in one handler and when it is not? For example i wrote the following code which combines two exceptions (FileNotFoundException OutOfMemoryError) and the program runs properly without any error. Al thought the handling is not so relevant with the functionality of the code i chose them just to see when i can combine multiple exceptions in on handler : import java.io.FileNotFoundException; import java.lang.OutOfMemoryError; public class exceptionTest { public static void main(String[] args) throws Exception { int help = 5; try { foo(help); } catch (FileNotFoundException | OutOfMemoryError e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static boolean foo(int var) throws Exception { if (var &gt; 6) throw new Exception("You variable bigger than 6"); else return true; } } But when i choose different type of exceptions the compiler gives me error . For example when i choose IOException and Exception i have the error the exception is already handled " : import java.io.IOException; import java.lang.Exception; public class exceptionTest { public static void main(String[] args) throws Exception { int help = 5; try { foo(help); } catch (IOException | Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static boolean foo(int var) throws Exception { if (var &gt; 6) throw new Exception("You variable bigger than 6"); else return true; } } So why is this happening ? Why in one occasion i can use multiple exception in handler and in the other not ? Thank you in advance.
tagged with: exception
tagged with: java
has comment: http://stackoverflow.com/comment/37426091
accepted answer: http://stackoverflow.com/a/24233905
has comment: http://stackoverflow.com/comment/37426038
has answer: http://stackoverflow.com/a/24233905
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37426243
has comment: http://stackoverflow.com/comment/37426208
has comment: http://stackoverflow.com/comment/37426093

http://stackoverflow.com/q/24242871
score: 0
accepted answer: http://stackoverflow.com/a/24255067
has comment: http://stackoverflow.com/comment/37446584
has comment: http://stackoverflow.com/comment/37445013
tagged with: java
answer count: 1
has title: Problems! Entity data are not fetched using data access object (dao) and JPA?
tagged with: jpa
tagged with: jsp
type: Question
has body: I have this Dao which get events according to the user id. It return the events object. public enum Dao { INSTANCE; public List<EventsDetail> getevents(String userId) { EntityManager em = EMFService.get().createEntityManager(); Query q = em.createQuery("select t from EventsDetail t where t.MemberId = :userId"); q.setParameter("userId", userId); @SuppressWarnings("unchecked") List<EventsDetail> events = q.getResultList(); return events; } } here i have this jsp page which call dao as i have import the dao class. here i have used try and catch to throw exception where i get null pointer exception. <% Dao dao = Dao.INSTANCE; UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); List<EventsDetail> events = new ArrayList(); if (user != null) { pageContext.setAttribute("user", user); events = dao.getevents(user.getUserId()); %> }.... <% try{ for (EventsDetail event : events) { pageContext.setAttribute("title", event.Title()); pageContext.setAttribute("place", event.getPlace()); pageContext.setAttribute("category", event.Category()); pageContext.setAttribute("cdate", event.Cdate()); %> <%=count%> ${fn:escapeXml(cdate)} ${fn:escapeXml(place)} ${fn:escapeXml(title)} ${fn:escapeXml(category)} <% } } catch (Exception e) { System.out.println("Exception:" + e); } %> the problem is that i get just empty data from the datastore where data are already persent in the datastore.
has answer: http://stackoverflow.com/a/24255067
tagged with: dao
type: AnsweredQuestion

http://stackoverflow.com/a/24254421
upvote count: 4
answers question: http://stackoverflow.com/q/24254306
downvote count: 0
has comment: http://stackoverflow.com/comment/37467231
has body: Assuming that you are using JDBC, you can use the PostgreSQL extensions of the standard. In particular, you need the org.postgresql.PGNotification class to receive notifications that you have to explicitly poll for. See the JDBC documentation here. There is a fully worked-out example in the docs.
score: 4
has comment: http://stackoverflow.com/comment/37479847
type: Answer

http://stackoverflow.com/comment/37421657
type: Comment
type: QuestionComment
has text: You didn't forget the opening part of the string indicator, did you, by that I mean "http://..."
comment on: http://stackoverflow.com/q/24231460
score: 0

http://stackoverflow.com/comment/37366785
score: 1
type: QuestionComment
has text: Well... if you're going to hide complexity within method names, then you can do all the iteration you like and call it `containsAll(base, sample)`. I suspect the resulting regular expression will be challenging to read and thus harder to maintain.
comment on: http://stackoverflow.com/q/24202447
type: Comment

http://stackoverflow.com/q/24217961
type: Question
has answer: http://stackoverflow.com/a/24218097
accepted answer: http://stackoverflow.com/a/24218097
has comment: http://stackoverflow.com/comment/37396424
has comment: http://stackoverflow.com/comment/37396603
linked to: http://stackoverflow.com/q/22744920
tagged with: swing
type: AnsweredQuestion
has body: i wrote very simple code to display an icon of the grapes but still the code doesn't show me anything here is my code import javax.swing.*; import java.awt.*; public class Code { ImageIcon ii = new ImageIcon("image/grapes2.jpg"); JLabel label = new JLabel("Grapes", ii, SwingConstants.CENTER); JFrame frame = new JFrame("ImageIcon"); public void ui(){ label.setHorizontalTextPosition(SwingConstants.CENTER); label.setVerticalTextPosition(SwingConstants.BOTTOM); label.setIconTextGap(5); label.setOpaque(true); label.setBackground(Color.GRAY); frame.setSize(2300,2300); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(label); } }
score: 0
tagged with: imageicon
has comment: http://stackoverflow.com/comment/37396406
upvote count: 1
tagged with: java
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/23478984
has comment: http://stackoverflow.com/comment/37396560
has title: ImageIcon does not work with me
has comment: http://stackoverflow.com/comment/37396570
favorite count: 0

http://stackoverflow.com/a/24156055
accepted answer of: http://stackoverflow.com/q/24156004
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: You should read this wiki article about file handling. You have to place the res\map\test.tmx inside your android project in the assets folder. The way you load the map assumes an internal (android/assets) file path. Furthermore I'd advise you to load the TiledMap via an AssetManager.
has comment: http://stackoverflow.com/comment/37279136
answers question: http://stackoverflow.com/q/24156004
type: Answer

http://stackoverflow.com/comment/37187998
comment on: http://stackoverflow.com/q/24106948
score: 1
type: Comment
type: QuestionComment
has text: C# enums are little more than a grouping of named integers - it can only be of one integer type.

http://stackoverflow.com/comment/37243118
type: Comment
type: AnswerComment
has text: I'll try that, but looking at this: https://developer.android.com/training/basics/actionbar/adding-buttons.html gives me the impression that ordering should not matter.
score: 0
comment on: http://stackoverflow.com/a/24135377

http://stackoverflow.com/comment/100887869
type: QuestionComment
has text: Here is an example using JavaCPP. https://docs.leponceau.org/java-examples/java-evaluation/javacpp.opencv.EdgeDetectionTest.html
score: 0
comment on: http://stackoverflow.com/q/24174868
type: Comment

http://stackoverflow.com/a/24185054
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24184773
score: 1
has body: what about just checking for patterns that include everything EXCEPT those single digits? (\b[0-9]{2,})|([01])|([6-9])
downvote count: 0

http://stackoverflow.com/comment/37448166
type: AnswerComment
has text: @DaveNewton: do you know exactly how your car works? If it broke down could you fix it yourself? Yet clearly a car makes life simpler. That argument is specious.
comment on: http://stackoverflow.com/a/24242917
score: 0
type: Comment

http://stackoverflow.com/comment/37398030
comment on: http://stackoverflow.com/q/24208568
score: 0
type: Comment
type: QuestionComment
has text: @Thomas I've tried to use maven-checkstyle-plugin (it is actually mentioned in this question) and calling checkstyle from command line - http://checkstyle.sourceforge.net/cmdline.html

http://stackoverflow.com/comment/37457728
score: 0
comment on: http://stackoverflow.com/q/24249917
type: QuestionComment
has text: @Andrew int SIZE = input.nextInt(); is what I have at line 14
type: Comment

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/24139097
tags question: http://stackoverflow.com/q/24114669
tags question: http://stackoverflow.com/q/24242594
type: Tag

image
tags question: http://stackoverflow.com/q/24161326
tags question: http://stackoverflow.com/q/24152150
tags question: http://stackoverflow.com/q/24175378
tags question: http://stackoverflow.com/q/24227357
tags question: http://stackoverflow.com/q/24140431
tags question: http://stackoverflow.com/q/24265930
tags question: http://stackoverflow.com/q/24193234
tags question: http://stackoverflow.com/q/24258319
tags question: http://stackoverflow.com/q/24142059
tags question: http://stackoverflow.com/q/24111940
tags question: http://stackoverflow.com/q/24168300
tags question: http://stackoverflow.com/q/24126920
tags question: http://stackoverflow.com/q/24172670
tags question: http://stackoverflow.com/q/24177062
tags question: http://stackoverflow.com/q/24226976
tag name: image
tags question: http://stackoverflow.com/q/24176057
tags question: http://stackoverflow.com/q/24110190
tags question: http://stackoverflow.com/q/24152830
tags question: http://stackoverflow.com/q/24233364
tags question: http://stackoverflow.com/q/24232063
tags question: http://stackoverflow.com/q/24171935
tags question: http://stackoverflow.com/q/24152692
tags question: http://stackoverflow.com/q/24179890
type: Tag
tags question: http://stackoverflow.com/q/24222292
tags question: http://stackoverflow.com/q/24144188
tags question: http://stackoverflow.com/q/24189253
tags question: http://stackoverflow.com/q/24183380
tags question: http://stackoverflow.com/q/24253358
tags question: http://stackoverflow.com/q/24234036
tags question: http://stackoverflow.com/q/24260019
tags question: http://stackoverflow.com/q/24176008
tags question: http://stackoverflow.com/q/24164318

http://stackoverflow.com/comment/37412047
type: Comment
has text: Hey this works! Thanks a lot. Why does this work though?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24226245

http://stackoverflow.com/a/24156459
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24150141
type: Answer
answers question: http://stackoverflow.com/q/24150141
has body: In order to import cobertura report into SonarQube you need the cobertura-sonar plugin. You can refer to this page http://docs.codehaus.org/display/SONAR/Plugin+version+matrix to know which version of the plugin to use with your version of the platform. For version of cobertura plugin prior to 1.6 you would need to use sonar.dynamicAnalysis=reuseReports and set the coverage tool to cobertura : sonar.java.coveragePlugin=cobertura as stated in sonarqube coverage documentation However I would really recommend you to upgrade to, at least, a LTS version of the platform.
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24177007
type: Answer
has body: Yes run a for loop or use a join: SELECT T.* FROM ( SELECT 23 AS id UNION SELECT 33 ... UNION SELECT 23) AS list LEFT JOIN table_name T ON list.id = T.id Based on this answer https://stackoverflow.com/a/372991/360211
score: 1
answers question: http://stackoverflow.com/q/24176749
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/24140401
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24143168
tagged with: colors
tagged with: jtextarea
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37253865
has title: Java - Text format to change
score: -1
tagged with: swing-highlighter
has body: Like in word I want to change the text color in my project here's the code I made import java.awt.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.JFrame; public class Cool extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; private JTextField textField; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Cool frame = new Cool(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public Cool() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); setTitle("JNotePad"); textField = new JTextField(); contentPane.add(textField, BorderLayout.NORTH); textField.setColumns(30); JScrollPane scrollPane = new JScrollPane(); contentPane.add(scrollPane, BorderLayout.CENTER); JTextArea IAmText = new JTextArea(); IAmText.setRows(10); IAmText.setColumns(30); scrollPane.setViewportView(IAmText); pack(); } } what can i use please explain. I will be very grateful. Please!!! I have added all i knew can any body give a newer fresher idea like I dont know fresher and better idea that can improve this and can anybody help me with text wrap.I want that when the text reaches the end of the window it would automatically get to the next line so that i dont have to worry about it going all the way to up to a hundred and twenty miles and the person scrolls and scrolls.
has comment: http://stackoverflow.com/comment/37249897
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37249844
tagged with: swing
downvote count: 1

http://stackoverflow.com/comment/37334934
score: 1
type: Comment
type: QuestionComment
has text: So, it looks like `_context` is `null`. Debug your code and find out why.
comment on: http://stackoverflow.com/q/24186166

http://stackoverflow.com/q/24123120
has answer: http://stackoverflow.com/a/24123217
has title: Jetty http lookup when not connected to internet
tagged with: jetty-9
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/42367470
answer count: 3
upvote count: 3
tagged with: java
downvote count: 0
has body: I have an embedded jetty server, it is using jetty 9. I am trying to run it's local instance with host=localhost and port =8080, now when my machine is connected to internet it works well. But when it is not it throws the exception - Any idea how can I fix this? java.net.UnknownHostException: java.sun.com at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.http.HttpClient.&lt;init&gt;(HttpClient.java:211) at sun.net.www.http.HttpClient.New(HttpClient.java:308) at sun.net.www.http.HttpClient.New(HttpClient.java:326) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:637) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1290) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1257) at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:262) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1162) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScanner…
accepted answer: http://stackoverflow.com/a/24134407
favorite count: 0
possible better answer: http://stackoverflow.com/a/42367470
tagged with: embedded-jetty
type: Question
has answer: http://stackoverflow.com/a/24134407

http://stackoverflow.com/q/24162217
downvote count: 4
upvote count: 1
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24162315
tagged with: regex
has comment: http://stackoverflow.com/comment/37290284
has body: Below are the String values I want to separate the inside brackets value US Records (100) Foreign Records (243) In the string above I want to separate the counts and store into another string 100, 243 using regular expression.
favorite count: 0
type: Question
has title: Regular expression for getting values inside brackets
type: UnansweredQuestion
score: -3

http://stackoverflow.com/comment/37239757
type: AnswerComment
score: 0
has text: Now the problem is that on first iteration when i get the values from iterator, instead of giving me first entry value it gives me the last entry value and on next iteration iterator stopped looping..
type: Comment
comment on: http://stackoverflow.com/a/24133710

r.java-file
tags question: http://stackoverflow.com/q/24235290
type: Tag
tags question: http://stackoverflow.com/q/24227029
tags question: http://stackoverflow.com/q/24234596
tags question: http://stackoverflow.com/q/24133117
tags question: http://stackoverflow.com/q/24132783
tag name: r.java-file

http://stackoverflow.com/a/24184690
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24179528
has body: I finally resolve the problem like that: public List&lt;HeroeDto&gt;retrieveHeroes(){ String paramOfBaseUrl = "heroes"; RestAdapter restAdapter = getRestAdapter(); HeroeDto[] listHeroesToReturn = null; final Interface client = restAdapter.create(Interface.class); Response resp = client.retrieveHeroes(paramOfBaseUrl); try { String StringJsonHeroes = UtilitiesString.convertStreamToString(resp.getBody().in()); ObjectMapper mapper = new ObjectMapper(); listHeroesToReturn = mapper.readValue(StringJsonHeroes, HeroeDto[].class); UtilitiesString.showLogSuccesRetrieveFromWS(TAG, "HEROES"); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } if(listHeroesToReturn==null) UtilitiesString.showLogEchecRetrieveFromWS(TAG, "HEROES"); return Arrays.asList(listHeroesToReturn); } interface Interface { @GET("/{param}") Response retrieveHeroes( @Path("param") String heroes ); } public static String convertStreamToString(InputStream is) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } is.close(); return sb.toString(); } public static void showLogSuccesRetrieveFromWS(String TAG, String nameOfWSRetrieven){ Log.i(TAG, "la récupération de la WS "+nameOfWSRetrieven+" Reussis"); } public static void showLogEchecRetrieveFromWS(String TAG, String nameOfWSRetrieven){ Log.i(TAG, "la récupération de la WS "+nameOfWSRetrieven+" a ECHOUE"); } public static void showLogSuccesInsertInDBB(String TAG, String nameOfWSRetrieven){ Log.i(TAG, "l insertion des "+nameOfWSRetrieven+" Reussis"); } public static void showLogEchecInsertInDBB(String TAG, String nameOfWSRetrieven){ Log.i(TAG, "l insertion des "+nameOfWSRetrieven+" a ECHOUE"); } Thank's all for your responses

http://stackoverflow.com/comment/37238212
type: Comment
comment on: http://stackoverflow.com/a/24124765
score: 0
type: AnswerComment
has text: I have used your opinion but the query gets failed at execution. Please the above link I posted.

http://stackoverflow.com/a/24153404
has comment: http://stackoverflow.com/comment/37276158
has comment: http://stackoverflow.com/comment/37276211
has body: I faced a similar problem when I was programatically assigning background color to my listview items. I dont know what caused the problem (probably the getView() was not getting called properly). I solved my problem by using if-else. In your case something like this should work: if(processClick == true) {//set desired result in if myButton.setEnabled(false); myButton.setClickable(false); myButton.setVisibility(View.INVISIBLE); }else{//reset items to original in else myButton.setEnabled(true); myButton.setClickable(true); myButton.setVisibility(View.GONE); }
score: 0
answers question: http://stackoverflow.com/q/24153139
type: Answer
has comment: http://stackoverflow.com/comment/37276514

http://stackoverflow.com/comment/37387958
score: 0
comment on: http://stackoverflow.com/a/24194307
type: Comment
type: AnswerComment
has text: @DavidEkermann you are welcome.. always pick an answer that helped you and approve it.

http://stackoverflow.com/q/24222292
has body: I'm creating a program in Java Swing, and I have run into a problem. The program has two images; one of the images is the full image, and it gets displayed in the image navigator. The other image is a zoomed-in portion of the full image and is displayed in another component. I have in my main class something that goes like this whenever the part to view in the ZoomedImage container updates: BufferedImage zoom = imageNavigator.getZoomedImage(); ((ZoomedImage)container.getTopComponent()).updatePanel(zoom); which calls: public BufferedImage getZoomedImage(){ BufferedImage img = image.getSubimage((int)(startX/scaleX), (int)(startY/scaleY), (int)(image.getWidth()*percentViewWidth), (int)(image.getHeight()*percentViewHeight)); BufferedImage copyOfImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics g = copyOfImage.createGraphics(); g.drawImage(img, 0, 0, null); return copyOfImage; } I also call similar code when initializing the component. startX/Y are the starting points of the box that shows the area it is zoomed in on. ScaleX/Y have to do with the scale between the size of the image being displayed and the size of the component displaying the image. percentViewWidth/Height are part of the zooming information. After the components have all been packed, the functionality works fine. The zoomed image updates just fine whenever I make changes to what portion of the original image I'm looking at. The problem is that in order to do that, I have to depend on the size of the component holding the main image so that I can grab the correct section of the image. When it is first initializing, the size is 0, so I can't grab the correct section. How can I tell it to update the image immediately after it has a size?
tagged with: swing
tagged with: image
linked to: http://stackoverflow.com/q/11739989
has comment: http://stackoverflow.com/comment/37404628
has comment: http://stackoverflow.com/comment/37404506
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37404809
answer count: 1
has comment: http://stackoverflow.com/comment/37404898
type: Question
has answer: http://stackoverflow.com/a/24343762
has title: How can I initialize an image grab that depends on the size of the component?
type: UnansweredQuestion

http://stackoverflow.com/comment/37476357
type: AnswerComment
has text: so, whiich way do u think is better? buffering or this copy method?
type: Comment
comment on: http://stackoverflow.com/a/24245646
score: 0

http://stackoverflow.com/q/24216272
has answer: http://stackoverflow.com/a/29326505
downvote count: 0
has answer: http://stackoverflow.com/a/24216364
type: AnsweredQuestion
score: 3
tagged with: sbt
tagged with: playframework
accepted answer: http://stackoverflow.com/a/24216364
tagged with: playframework-2.3
upvote count: 3
tagged with: java
has body: I'm trying to use the play-querydsl plugin with Play 2.3 with no success. I know that the plugin system has changed in Play 2.3, but I'm wondering if there is any way to use an old Play 2.2 plugin with Play 2.3. The play-querydsl's Installation page lists the following steps to enable the plugin for Play 2.2: playJavaSettings ++ QueryDSLPlugin.queryDSLSettings val current = project.in(file(".")).configs(QueryDSLPlugin.QueryDSL) However, if I understand correctly, there is no playJavaSettings in Play 2.3 (even though it's mentioned in About SBT Settings). Is there any way to use this plugin from Play 2.3 without changing the plugin?
has title: How to enable play-querydsl plugin in Play 2.3?
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/29326505
answer count: 2

http://stackoverflow.com/comment/37324271
has text: Ahhh, my eyes!! They burn!!
score: 1
comment on: http://stackoverflow.com/q/24180345
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37316083
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24175356
score: 0
has text: @saboehnke put it onclick not in ontouch of the buildMoreButton

http://stackoverflow.com/q/24197039
tagged with: nlp
has answer: http://stackoverflow.com/a/63324888
type: Question
has comment: http://stackoverflow.com/comment/37361436
answer count: 2
has title: NLP - Determine whether a piece of text is talking about a given topic?
tagged with: stanford-nlp
tagged with: classification
has comment: http://stackoverflow.com/comment/37357040
has body: I have a Java application where I'm looking to determine in real time whether a given piece of text is talking about a topic supplied as a query. Some techniques I've looked into for this are coreference detection with packages like open-nlp and Stanford-NLP coref detection, but these models take extremely long to load and don't seem practical in a production application environment. Is it possible to perform coreference analysis such that given a piece of text and a topic, I can get a boolean answer that the text is discussing the topic? Other than document classification which requires a trained corpus, are there any other techniques that can help me achieve such a thing?
type: UnansweredQuestion
downvote count: 0
upvote count: 1
favorite count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/49324274
tagged with: information-retrieval
has answer: http://stackoverflow.com/a/24200845

http://stackoverflow.com/comment/37245764
has text: I'm deploying using `mvn tomcat:deploy` and I don't get any errors on the tomcat stack trace or on maven when deploying
type: AnswerComment
comment on: http://stackoverflow.com/a/24136976
score: 0
type: Comment

http://stackoverflow.com/comment/37349814
type: Comment
comment on: http://stackoverflow.com/a/24169178
score: 0
type: AnswerComment
has text: I added this code: registerForContextMenu(tr_head[i]); tr_head[i].showContextMenu(); but it gives me a NullPointerException. Why?

http://stackoverflow.com/a/24132838
has comment: http://stackoverflow.com/comment/37237001
has comment: http://stackoverflow.com/comment/37236343
has comment: http://stackoverflow.com/comment/37236363
type: Answer
has body: I just have this problem 30min ago and basically appcompat_v7_2 is a bug from eclipse that you need to delete that folder from your package explorer. After you delete it clean and build then Create a new project again and set the minimum required SDK to 14
answers question: http://stackoverflow.com/q/24132806
has comment: http://stackoverflow.com/comment/37236461
has comment: http://stackoverflow.com/comment/37237504
has comment: http://stackoverflow.com/comment/37236304
has comment: http://stackoverflow.com/comment/37236734
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24132806

http://stackoverflow.com/q/24211217
upvote count: 0
type: UnansweredQuestion
answer count: 1
tagged with: jsp
tagged with: tomcat
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37428096
has title: How to setup java environment in digitalocean?
has answer: http://stackoverflow.com/a/24211795
tagged with: java
has body: I want to set up java/jsp environment in digitalocean VPS. I need help with that. I found help in digitalocean community but I want to know that which os is best for jsp and tomcat? And also the version of OS. I saw that tomcat is accessible at port 8080 so is there any option that i can access my site at port 80 or something like domain.com/index.jsp instead of domain.com:8080/indes.jsp? I am still learning java and jsp so for that I need help to set up.
score: -1
tagged with: digital-ocean
has comment: http://stackoverflow.com/comment/37408041

http://stackoverflow.com/comment/37185865
type: QuestionComment
comment on: http://stackoverflow.com/q/24105858
score: 0
has text: it is my desperat attempt to make it go false the second time i push the Mouse button. sorry i dont claim to be an expert on this stuff that is why i consult with you guys :)
type: Comment

http://stackoverflow.com/a/24222968
downvote count: 0
has comment: http://stackoverflow.com/comment/37405913
has body: This is the wrong way to do this. First off, if you need something in the background all the time, use a Thread, not an Async Task. Not only is it a better fit, but using an AsyncTask would break other AsyncTaks, since they execute on a single thread by default. Secondly, its more efficient in battery and CPU to be notified than to poll. Use a BroadcastReceiver for http://developer.android.com/reference/android/net/ConnectivityManager.html#CONNECTIVITY_ACTION rather than polling for the connection status.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37405958
has comment: http://stackoverflow.com/comment/37406370
accepted answer of: http://stackoverflow.com/q/24222909
has comment: http://stackoverflow.com/comment/37406405
has comment: http://stackoverflow.com/comment/37406553
type: Answer
has comment: http://stackoverflow.com/comment/37406155
has comment: http://stackoverflow.com/comment/37406636
has comment: http://stackoverflow.com/comment/37406304
answers question: http://stackoverflow.com/q/24222909
has comment: http://stackoverflow.com/comment/37406549
has comment: http://stackoverflow.com/comment/37406455
score: 2
has comment: http://stackoverflow.com/comment/37405863
upvote count: 2
has comment: http://stackoverflow.com/comment/37405921
has comment: http://stackoverflow.com/comment/37405879
has comment: http://stackoverflow.com/comment/37406216

http://stackoverflow.com/comment/37287368
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24160747
type: Comment
has text: I am trying to call it from the `constructor` where `request` is not available,is that a bad way of calling `getServletContext`

http://stackoverflow.com/q/24163101
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37316585
answer count: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37333177
downvote count: 0
has comment: http://stackoverflow.com/comment/37337266
tagged with: maven
has body: I have existing two maven projects, I want to combine them after build into one project. I have not created these projects module wise, the two projects are separate maven projects. Below is the POM xml code part from existing projects. Project One pom.xml com.olex olex-reg 1.0 war Project Two pom.xml com.olex olex-qba 1.0 war Combine Project pom.xml com.olex olex-war 1.0 pom I want to combine these projects into one like olex-war, A complete project. After build I want all the code to be copied to this olex-war project. Please suggest / provide hint if anyone aware of such scenario. Thanks in advance.
has answer: http://stackoverflow.com/a/24191308
has answer: http://stackoverflow.com/a/24171560
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24171560
has comment: http://stackoverflow.com/comment/37337628
has comment: http://stackoverflow.com/comment/37333388
tagged with: java
has comment: http://stackoverflow.com/comment/37337395
has title: Create Parent Maven Project from Existing projects
tagged with: pom.xml
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37305432
accepted answer: http://stackoverflow.com/a/24191308
score: 2

http://stackoverflow.com/q/24168786
type: Question
type: AnsweredQuestion
tagged with: parameterized
possible better answer: http://stackoverflow.com/a/56186890
score: 7
accepted answer: http://stackoverflow.com/a/24169136
has body: I am new to parameterized feature of JUnit 4.x and having a problem. My parameterized test consists of 3 integer arrays and I am having difficulty of how to declare them. What I have below generates run-time error: testGeneral[0] caused an ERROR: argument type mismatch argument type mismatch java.lang.IllegalArgumentException at java.lang.reflect.Constructor.newInstance(Constructor.java:526) testGeneral[1] caused an ERROR: argument type mismatch argument type mismatch java.lang.IllegalArgumentException at java.lang.reflect.Constructor.newInstance(Constructor.java:526) Here is my code: @RunWith(Parameterized.class) public class MyArrayTest { private Integer[] inputList1; private Integer[] inputList2; private Integer[] expectedList; public MyArrayTest(Integer[] li1, Integer[] li2, Integer[] expected) { // ========&gt; Runtime error happens here. &lt;========= this.inputList1 = li1; this.inputList2 = li2; this.expectedList = expected; } @Parameterized.Parameters public static Collection testCases() { return Arrays.asList(new Object[][][] { {{1,1,1}, {2,2,2}, {3,3,3}}, {{2,2,2}, {3,3,3}, {4,4,4}} }); } @Test public void testGeneral() { // Do some test with this.inputList1, this.inputList2, // and verify with this.expectedList // I am not even getting here yet. } } I appreciate your help to correctly passing the three arrays to my tests.
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/56186890
upvote count: 7
tagged with: java
has answer: http://stackoverflow.com/a/24169136
has title: Passing arrays to Parameterized JUnit
favorite count: 0

http://stackoverflow.com/q/24173965
has title: possible lossy conversion from int to short
answer count: 1
has comment: http://stackoverflow.com/comment/37313686
favorite count: 0
accepted answer: http://stackoverflow.com/a/24173988
has comment: http://stackoverflow.com/comment/37313351
tagged with: int
linked to: http://stackoverflow.com/q/51632152
has answer: http://stackoverflow.com/a/24173988
type: Question
tagged with: short
tagged with: java
has comment: http://stackoverflow.com/comment/37313338
upvote count: 6
duplicate of: http://stackoverflow.com/q/51632152
has comment: http://stackoverflow.com/comment/37313251
has body: I have defined array gx, array arr to be short type. but why the operation at left may end up with int type and I must cast it into short? the compiler error is possible lossy conversion from int to short. this is my code. public PixImage sobelEdges() { short gy=0; for(int x=1;x&lt;width-1;x++){ for(int y=1;y&lt;height-1;y++){ // if(x=){ for(int z=0;z&lt;3;z++){ gx[x][y][z]=arr[x-1][y-1][z]-arr[x+1][y-1][z]+2*arr[x-1][y][z]-2*arr[x+1][y][z]+arr[x-1][y+1][z]-arr[x+1][y+1][z]; } // } } } return this; // Don't forget to use the method mag2gray() above to convert energies to // pixel intensities. } Is that because the so called unbox? so that means every time I made a operation I need to cast?
type: AnsweredQuestion
score: 5
tagged with: arrays
downvote count: 1

http://stackoverflow.com/q/24196764
has comment: http://stackoverflow.com/comment/37356006
answer count: 3
has answer: http://stackoverflow.com/a/24196826
has comment: http://stackoverflow.com/comment/37378506
tagged with: java
linked to: http://stackoverflow.com/q/4533440
accepted answer: http://stackoverflow.com/a/24197832
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24197832
has body: I am looking to add formatted text to a ListView (I would like the text to be the color #33B5E5). This is what I tried so far: ArrayList myarraylist; String mystring = "Value I want to add" myarraylist.add(mystring); //other functions to set the arraylist My question is, how would I change the color of mystring? Is it possible to set the text color of a string?
has comment: http://stackoverflow.com/comment/37355943
tagged with: android
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24197861
has title: Add formatted text to a ListView
score: 0
possible better answer: http://stackoverflow.com/a/24196826

http://stackoverflow.com/q/24176560
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24180723
answer count: 1
type: Question
has title: how to write an arraylist value in an single column using JXL
type: UnansweredQuestion
has body: how can we write an ArrayList values ('n' numbers) with single column(ms excel) by using jxl ArrayList&lt;String&gt; allRecordCount = scrapAllRecord(); Label EEFL = new Label(1, row, allRecordCount.get(0); sheet.addCell(new Label(EEFL)); allRecordCount have 'n' numbers of values need to write all those values in an single column
tagged with: jxl

http://stackoverflow.com/a/24141030
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24140758
downvote count: 0
has body: It could be something like this as.filter (a -&gt; (a==a1) || (a==a2)).findFirst () And then check if the result is a1 or a2 or empty. I'm sorry I don't give a full solution, it's hard to do if from my smart phone
answers question: http://stackoverflow.com/q/24140758
score: 3
has comment: http://stackoverflow.com/comment/37255367
type: Answer
has comment: http://stackoverflow.com/comment/37250834
has comment: http://stackoverflow.com/comment/37250707
upvote count: 3

http://stackoverflow.com/comment/37333841
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24178672
type: Comment
has text: I try to add a timestamp parameter to it <%@ include file="/WEB-INF/pages/table.jsp?time=${timestamp}" %> however whenever i try to load the page it give me an error saying that it cannot find the page, do you know how do I add a parameter to this import tag?

http://stackoverflow.com/q/24114155
linked to: http://stackoverflow.com/q/12728527
tagged with: date
linked to: http://stackoverflow.com/q/1534804
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24114995
answer count: 3
upvote count: 7
tagged with: java
linked to: http://stackoverflow.com/q/11882926
has answer: http://stackoverflow.com/a/24115306
possible better answer: http://stackoverflow.com/a/24115306
score: 7
has title: How to get current date and add five working days in Java
linked to: http://stackoverflow.com/q/11356109
has comment: http://stackoverflow.com/comment/37201899
favorite count: 0
has comment: http://stackoverflow.com/comment/37200943
type: Question
has answer: http://stackoverflow.com/a/24115356
accepted answer: http://stackoverflow.com/a/24115356
linked to: http://stackoverflow.com/q/428918
duplicate of: http://stackoverflow.com/q/1534804
has body: I want two dates. 1) Current date in MM/dd/yy format 2) Modified date which will be the adition of five business days(Mon-Fri) to current date and it should be in MMM dd, yyyy format. So if my current is 9th june than currentDate should be 06/09/14 and modifiedDate should be Jun 13, 2014. How to do this?
has comment: http://stackoverflow.com/comment/37200934
tagged with: datetime
downvote count: 0
duplicate of: http://stackoverflow.com/q/428918

http://stackoverflow.com/comment/37362012
type: Comment
has text: Ah, that's true. Looks like I got the lists backwards. Thanks!
comment on: http://stackoverflow.com/a/24190189
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37199914
has text: I don't understand what the problem is that you're having. There is no reason why a Node.js client cannot communicate with a Java server; what is happening when you try? Why do you think that you can't send a date between then?
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24113604
type: Comment

http://stackoverflow.com/q/24142059
has comment: http://stackoverflow.com/comment/37253449
tagged with: find
type: UnansweredQuestion
score: -1
tagged with: image
has comment: http://stackoverflow.com/comment/37252832
has body: I have image, and I have the number on it. I exactly know coordinates start and end of the number, and I can save all different digits in advance. I want to understand what is the number it. i.e I want to get variable of type int. I invented stupid algorithm:find each digit -> sort them and translate to the int, but I think it's very long and not optimal) do you have good ideas or library ? I didn't find it. sorry for my very bad english:(
tagged with: java
has comment: http://stackoverflow.com/comment/37252676
downvote count: 2
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37255021
has title: Number recognition from Image java
has comment: http://stackoverflow.com/comment/37252871
has answer: http://stackoverflow.com/a/24142259
favorite count: 0
type: Question

http://stackoverflow.com/comment/37373655
has text: Hmm. For grins, try to get rid of the BaseEntity to see if there is something else going on?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24179409
type: QuestionComment

http://stackoverflow.com/q/24238240
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37435976
answer count: 3
has comment: http://stackoverflow.com/comment/37435101
upvote count: 3
has answer: http://stackoverflow.com/a/42301061
tagged with: java
has title: Java Regex - mask credit card number
downvote count: 0
has body: I have the function which masks credit card numbers in String: public static String replaceCreditCardNumber(String text){ final String MASKCARD = "$1&lt;MASKED&gt;$2"; final Pattern PATTERNCARD = Pattern.compile("([0-9]{4})[0-9]{0,9}([0-9]{4})"); Matcher matcher = PATTERNCARD.matcher(text); if (matcher.find()) { return matcher.replaceAll(MASKCARD); } return text; } this function works fine in the following cases: String text = "Aaaa bbbb aaa=1234567890123456 fdfdfd=aaa"; String expected = "Aaaa bbbb aaa=1234&lt;MASKED&gt;3456 fdfdfd=aaa"; assertEquals(expected,text);//OK String text = "Aaaa bbbb aaa=\"1234567890123456\" fdfdfd=aaa"; String expected = "Aaaa bbbb aaa=\"1234&lt;MASKED&gt;3456\" fdfdfd=aaa"; assertEquals(expected,text); However the following case fails String text = "Aaaa bbbb aaa=1gfg23fgfg4567890123456 fdfdfd=aaa"; String expected = "Aaaa bbbb aaa=1gfg23fgfg4567890123456 fdfdfd=aaa"; assertEquals(expected,text); I'm getting aaa=1gfg23fgfg4567[&lt;MASKED&gt;]3456 What am I missing in my regex expression?
tagged with: string
has answer: http://stackoverflow.com/a/24238331
favorite count: 0
type: Question
score: 3
has comment: http://stackoverflow.com/comment/37435113
has comment: http://stackoverflow.com/comment/37435396
possible better answer: http://stackoverflow.com/a/24238331
accepted answer: http://stackoverflow.com/a/24238343
tagged with: regex
has answer: http://stackoverflow.com/a/24238343

http://stackoverflow.com/q/24127632
has title: How do I specify the WS-Addressing version with a JAX-WS client?
type: Question
has answer: http://stackoverflow.com/a/24210344
score: 3
tagged with: java
has body: I generated a SOAP 1.2 web service client with wsimport (JDK 1.7). I need it to explicitly use WS-Addressing 2004/08 and not 2005/08. The closest I could find for instanciating the client was import MyService.*; import javax.xml.ws.BindingProvider; public class test { public static void main(String[] args) { MyService service = new MyService(); IMyService proxy = service.getMyService(new javax.xml.ws.soap.AddressingFeature(true, true) ); ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://192.168.0.5:1234/services/MyService"); proxy.Ping("Foo"); } } The important bit being MyService service = new MyService(); IMyService proxy = service.getMyService(new javax.xml.ws.soap.AddressingFeature(true, true)); Unfortunately, this results in 2005/08 addressing. Not supplying an argument to getMyService() results in not using WS-Addressing. The only examples I can find on Google that force 2004/08 Addressing use Axis2 (the whole reason I want JAX-WS is to move away from Axis2) The difference on the wire is (2004/08) <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"> <s:Header> <a:Action s:mustUnderstand="1">http://www.example.com/schemas/service/myservice/IMyService/Ping</a:Action> <a:MessageID>urn:uuid:87727401-b1a0-4667-9ef0-c64e58800ff6</a:MessageID> <a:ReplyTo> <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address> </a:ReplyTo> <a:To s:mustUnderstand="1">https://192.168.0.5:1234/services/MyService</a:To> </s:Header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Foo </s:Body> </s:Envelope> (2005/08) <S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"> <S:Header> https://192.168.0.5:1234/services/MyService http://www.example.com/schemas/service/myservice/IMyService/Ping <Address>http://www.w3.org/2005/08/addressing/anonymous uuid:87727401-b1a0-4667-9ef0-c…
tagged with: soap
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/74825308
tagged with: ws-addressing
answer count: 2
upvote count: 3
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26486375
favorite count: 0

http://stackoverflow.com/q/24242555
tagged with: java
has body: The requirement is to print the receipt vertically and there should be minimum 80 chars in a line. To print the reciept vertically I have added following lines: posPrinter.rotatePrint(POSPrinterConst.PTR_S_RECEIPT, POSPrinterConst.PTR_RP_RIGHT90); this code is able to print the receipt vertically, but the problem is that it is printing only 69 characters in a line, and my requirement is to print 80 characters in a line. Please help me How can I resolve this. Thanks in advance.
answer count: 0
downvote count: 0
upvote count: 1
type: UnansweredQuestion
has title: How to set max char length in a line when printing reciept vertically using JPOS
tagged with: printers
favorite count: 0
type: Question
score: 1

http://stackoverflow.com/q/24137994
tagged with: java
tagged with: jboss
has comment: http://stackoverflow.com/comment/37250390
score: 0
answer count: 0
type: UnansweredQuestion
has body: I need to invoke a shell script as a separate process from a web application hosted on jboss. I am using the following code to invoke the process: ArrayList&lt;String&gt; command = new ArrayList&lt;String&gt;(); command.add("file.sh"); ProcessBuilder builder = new ProcessBuilder(command); File file = new File(directory); builder.directory(file); builder.redirectErrorStream(true); builder.start(); The problem is that when i kill/stop the jboss the execution of the script also stops.The execution environment is linux.
has comment: http://stackoverflow.com/comment/37327175
type: Question
tagged with: linux
has title: Spawn separate process from jboss

http://stackoverflow.com/comment/39660971
has text: Please see http://stackoverflow.com/questions/22730801/java-se-spring-data-hibernate. I think you have java 8
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24128045
type: QuestionComment

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/24251048
tags question: http://stackoverflow.com/q/24217621

http://stackoverflow.com/q/24122565
has body: How to remove items from the Arraylist? final ArrayList&lt;List&lt;String&gt;&gt; finalArrayList = null; buf="1,2,3,four,5,six,nine,10"; finalArrayList.add(Arrays.asList(buf.split(","))); for(int i = finalArrayList .size()-1 ; i &gt;0; i--){ for(int i1 = finalArrayList .get(i) .size()-1 ; i1 &gt; 0; i1--){ if(isNumeric(finalArrayList.get(i).get(i1))==true){ Log.d("arra", finalArrayList.get(i).get(i1).toString()); finalArrayList.remove(finalArrayList.get(i).get(i1)); } } } } It would also be great if someone link to declaration and explanation tuts. I don't know its legal or not,but it worked.Thanks to this video and this links. final ArrayList&lt;List&lt;String&gt;&gt; finalArrayList = null; String[] strn = buf.split(","); ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt; (); for(int i =0;i&lt; strn.length;i++){ names.add(strn[i]); //System.out.println(names); } Iterator&lt;String&gt; i = names.iterator(); while(i.hasNext()){ String s = i.next(); //System.out.println("Printing&gt;&gt;&gt;" + s); try{ if(isNumeric(s)==true){ System.out.println("Removing..."); i.remove(); } else{ System.out.println("No numeric"); } }catch(Exception e){ System.out.println("On Removing Error===&gt;" + e.getMessage()); } } finalArrayList.add(names);
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24122628
linked to: http://stackoverflow.com/q/9691328
type: Question
has comment: http://stackoverflow.com/comment/37216221
has title: Android Remove items from ArrayList<List<String>>
linked to: http://stackoverflow.com/q/1196586
duplicate of: http://stackoverflow.com/q/9691328
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37251311
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/37477566
has text: Actually, you;d better start a new JVM instance for each test, as mere loading a class can influence performance (see the influence of `preload` in this [benchmark of mine](http://stackoverflow.com/q/24222991/581205)). Multithreading makes it all even more non-deterministic. Sometimes, it may be fine, sometimes not... and you can be never sure. So I (and all the benchmarking guys) prefer waiting longer to risking wasting *own* time with possible nonsense results.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24256232

http://stackoverflow.com/q/24168217
favorite count: 0
has answer: http://stackoverflow.com/a/24168567
type: Question
has comment: http://stackoverflow.com/comment/133728205
has comment: http://stackoverflow.com/comment/37302005
downvote count: 0
tagged with: jdbc
upvote count: 1
has body: this is my table in mysql CREATE TABLE `mydb`.`mytab` ( `email` VARCHAR(45) NOT NULL, `name` VARCHAR(45) NULL, PRIMARY KEY (`email`)); and my code in java is Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/spacespacer", "root", ""); PreparedStatement state=con.prepareStatement("INSERT INTO `spacespacer`.`mytab` VALUES (?, ?);"); state.setString(1, "email"); state.setString(2, "name"); state.executeUpdate(); and this is what i get when i run the file in netbeans run: Exception in thread "main" java.sql.SQLException: Duplicate entry 'email' for key 'PRIMARY' at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531) at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1347) at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:958) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1957) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1880) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1741) at spacespacer.SpaceSpacer.main(SpaceSpacer.java:30) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds) so how do i get it to work? thanks for replying
accepted answer: http://stackoverflow.com/a/24168243
tagged with: sql-server
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24168374
answer count: 3
has answer: http://stackoverflow.com/a/24168243
tagged with: sql
score: 1
tagged with: java
tagged with: mysql
has title: java.sql.SQLException: Duplicate entry for key when trying to insert in database from java
possible better answer: http://stackoverflow.com/a/24168374

http://stackoverflow.com/q/24175415
has body: The below provides an error when in lan behind a proxy ,but works properly outside lan/proxy. Please let me know how I can rectify it I used the code to detect proxy setting and it gave Detecting Windows/IE proxy setting using Java I am getting: proxy hostname : DIRECT No Proxy Does this mean I am not behind a Proxy Server? I'm trying to use java rome-fetcher to acquire rss feeds for processing. Everything works fine when I have direct internet access. However, I need to be able to run my application behind a proxy server. The below provides an error when in lan ,but works properly outside lan Exception in thread "main" java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) import java.util.Properties; import java.net.*; import java.io.*; import java.io.FileWriter; import java.io.Writer; import java.net.HttpURLConnection; import java.net.URL; import java.util.Iterator; import java.util.List; import com.sun.syndication.feed.synd.SyndEntry; import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.io.SyndFeedInput; import com.sun.syndication.io.SyndFeedOutput; import com.sun.syndication.io.XmlReader; public class RomeLibraryExample { @SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { URL url = new URL("http://rss.cnn.com/rss/cnn_topstories.rss"); //System.setProperty("http.proxyHost", "DIRECT"); // System.setProperty("http.proxyPort", "8080"); HttpURLConnection httpcon = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY); // Reading the feed SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(httpcon)); List&lt;SyndEntry&gt; entries = feed.getEntries(); Iterator&lt;SyndEntry&gt; itEntries = entries.iterator(); while (itEntries.hasNext()) { SyndEntry entry = itEntries.next(); System.out.println("Title: " + entry.getTitle()); System.out.println("Link: " + entry.getLink()…
favorite count: 0
type: Question
has title: About detecting proxy setting using rome api
tagged with: proxy
tagged with: rome
linked to: http://stackoverflow.com/q/4933677
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38296199
answer count: 0
tagged with: rss
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24200519
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/37365584
has comment: http://stackoverflow.com/comment/37372980
has comment: http://stackoverflow.com/comment/37366446
has comment: http://stackoverflow.com/comment/37364794
has body: In fact, all the time the load of your HashMap go more than 75%, a HashMap is created with a double size. This is the reason why hashmap size is always a power of two. You might be interested by this article : http://java.dzone.com/articles/hashmap-internal
type: Answer
answers question: http://stackoverflow.com/q/24200197
has comment: http://stackoverflow.com/comment/37381700
upvote count: 0

http://stackoverflow.com/q/24161662
has answer: http://stackoverflow.com/a/24161828
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37289028
answer count: 2
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24161788
accepted answer: http://stackoverflow.com/a/24161788
downvote count: 0
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24161828
has body: Whats up guys ! I have a class in Java which is a server, I put this server class, the argument port, for example if I call this class I would like: new Server (5000); 5000 is the argument of this server class, so I created a new frame with a button class, and action of this button I call this class server 5 times, but with different arguments and looked like this: Servidor servidor = new Servidor(5000); //Port number argument Servidor servidor1 = new Servidor(5001); Servidor servidor2 = new Servidor(5002); Servidor servidor3 = new Servidor(5003); Servidor servidor4 = new Servidor(5004); But the problem is that when I click the button, the only server that initiates the first is on port 5000, I've done the debug here and noticed that only the first statement is executed, the other 4 are not, why is that? I've tried to do so: new Servidor(5000); new Servidor(5001); new Servidor(5002); new Servidor(5003); new Servidor(5004); Still does not work, I did the debug in both cases and only the server port 5000 is started, someone help? The code have a two while this is a problem right ? But i can fix this, the code of server : public class Servidor { private ServerSocket serverSocket; private Socket socket; private Map&lt;String, ObjectOutputStream&gt; mapOnline = new HashMap&lt;String, ObjectOutputStream&gt;(); public int porta; // nova lista para armazenar todas as janelas ativas private Map&lt;String, ObjectOutputStream&gt; mapJanelaLista = new HashMap&lt;String, ObjectOutputStream&gt;(); Calendar data = Calendar.getInstance(); int horas = data.get(Calendar.HOUR_OF_DAY); int minutos = data.get(Calendar.MINUTE); int segundos = data.get(Calendar.SECOND); public Servidor(int porta) { try { serverSocket = new ServerSocket(porta); System.out.println("Servidor "+ porta + " Online "); serverSocket.setSoTimeout(0); while (true) { socket = serverSocket.accept(); new Thread(new ListenerSocket(socket)).start(); } } catch (IOException ex) { } } private class ListenerSocket implement…
has title: Failed to instantiate objects: only the first is created

http://stackoverflow.com/a/24127561
type: Answer
has comment: http://stackoverflow.com/comment/37274479
score: 0
has body: You need to first create a Language class: public class Language { private String name; private int count; public Language(String name) { this.name = name; this.count = 0; } public String getName() { return this.name; } public int getCount() { return this.count; } public void setCount(int count) { this.count = count; } } And then, create a list of languages from the ArrayList: List&lt;String&gt; languageNames = // your language names Map&lt;String, Language&gt; map = new HashMap&lt;String, Language&gt;(); for (String languageName : languageNames) { Language language = map.get(languageName); if (language == null) { language = new Language(languageName); } else { language.setCount(language.getCount() + 1); } map.put(languageName, language); } List&lt;Language&gt; languages = new ArrayList&lt;Language&gt;(map.values()); After that, we sort, and print the languages: Collections&lt;Language&gt;.sort(languages, new Comparator&lt;Language&gt;() { public int compare(Language l1, Language l2) { return l1.getCount() - l2.getCount(); } }); System.out.println(languages);
has comment: http://stackoverflow.com/comment/37244198
answers question: http://stackoverflow.com/q/24119065
has comment: http://stackoverflow.com/comment/37273154

alchemyapi
type: Tag
tag name: alchemyapi
tags question: http://stackoverflow.com/q/24243039

http://stackoverflow.com/a/24186479
downvote count: 1
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/37335618
answers question: http://stackoverflow.com/q/24186403
has body: Give each button A special name: TopButton and BottomButton. When TopButton is pressed, it will do what you want it to do. When BottomButton is pressed, it will do what you want to do. You can do this by doing: TopButton.addActionListener(new ActionListener { public void ActionPerformed(ActionEvent event) { System.out.println("The TopButton has been pressed!"); } }); BottomButton.addActionListener(new ActionListener { public void ActionPerformed(ActionEvent event) { System.out.println("The BottomButton has been pressed!"); } });
upvote count: 0
has comment: http://stackoverflow.com/comment/37337103

http://stackoverflow.com/a/24165721
upvote count: 1
has body: Because it prints the local variable p out.printf("%d\n%d\n", p, q); not the member out.printf("%d\n%d\n", this.p, q);
downvote count: 0
answers question: http://stackoverflow.com/q/24165598
score: 1
type: Answer

http://stackoverflow.com/comment/37349061
score: 0
comment on: http://stackoverflow.com/q/24125326
type: Comment
has text: Do you happen to use mod_security? Does it work better with mod_proxy_http? Do you have anything before Apache in your environment? Did you test with newer version of all those products?
type: QuestionComment

http://stackoverflow.com/a/24154592
answers question: http://stackoverflow.com/q/24132945
score: 0
type: AcceptedAnswer
has body: I added this '&amp;Version=2014-05-01' and everything worked fine. This parameter is used to specify the version of the service we are trying to use. This is the latest version of EC2. When I don't mention a specific version, aws looks for this version (2005-10-05) of service &amp; may be, it does not exist.
accepted answer of: http://stackoverflow.com/q/24132945
type: Answer

http://stackoverflow.com/a/24157051
answers question: http://stackoverflow.com/q/24156468
has body: Should work with any amout of rows. Haven't tested with thousands though. public static void main(String[] args) { int maxRows = 14; int spaces = String.valueOf(maxRows).length(); for (int i = 1; i &lt;= maxRows; i++) { // for each row for (int j = 1; j &lt;= maxRows - i; j++) { // add spaces to the left for (int l = 1; l &lt;= spaces; l++) { // according to number of digits System.out.print(" "); } } for (int k = 1; k &lt;= i; k++) { // for each column System.out.print(i); for (int l = String.valueOf(i).length(); l &lt;= spaces * 2 - 1; l++) { // add spaces inbetween System.out.print(" "); } } System.out.print(System.getProperty("line.separator")); } }
type: Answer
has comment: http://stackoverflow.com/comment/37281220
score: 0
has comment: http://stackoverflow.com/comment/37281407

daemon
tags question: http://stackoverflow.com/q/24201205
type: Tag
tag name: daemon
tags question: http://stackoverflow.com/q/24206427

http://stackoverflow.com/q/24168718
has body: In my project I have an abstract custom object: public abstract class CustomObject { //abstract class goodness } In another class I am using a few different classes that extend CustomObject and am writing a method that can take the specific class that extends it as a parameter, populates the common fields, and spits it back out as the result. The method looks like this right now: public &lt;T&gt; T setCommonProperties( Class&lt;T extends CustomObject&gt; clazz, Identifier ident ) { CustomObject populate = clazz.newInstance(); //populate populate } This looks correct with what I have found while searching the internet, but eclipse marks the extends as incorrect. It gives me Syntax error on token "extends", , expected when I hover over the extends. Does anyone have any idea why eclipse may be doing this?
tagged with: generics
type: Question
accepted answer: http://stackoverflow.com/a/24168745
has answer: http://stackoverflow.com/a/24168745
has title: Eclipse not recognizing passing an extended generic class
tagged with: eclipse
type: AnsweredQuestion
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/comment/37358542
type: QuestionComment
has text: But before you do, look up the error on stackoverflow. There are so many related posts.
comment on: http://stackoverflow.com/q/24198153
score: 0
type: Comment

http://stackoverflow.com/q/24241612
has body: I've installed Hawt.IO and it's great for what it does, now I just want to know if it's possible to create a new user that isn't an admin, and has specific permissions. For example a user that would only have access to some tabs, or a user that can only view graphs but can't do any editing on the settings etc. Is this possible on hawt.io? Thank you in advance :)
type: Question
tagged with: hawtio
has answer: http://stackoverflow.com/a/24247105
type: UnansweredQuestion
has title: hawt.io create a user with specific permissions
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/24249346
tagged with: android
tagged with: datetime
tagged with: date
has body: android report this error W/System.err(31941): java.text.ParseException: Unparseable date: "Thu, 12 Jun 2014 13:15:30 GMT" (at offset 0) this is my dateFormat "EEE, dd MMM yyyy KK:mm:ss zzz" any idea?
has title: format date string Thu, 12 Jun 2014 13:15:30 GMT
accepted answer: http://stackoverflow.com/a/24249421
type: AnsweredQuestion
score: 0
downvote count: 2
has answer: http://stackoverflow.com/a/24249469
possible better answer: http://stackoverflow.com/a/24249469
linked to: http://stackoverflow.com/q/8216292
tagged with: java
has comment: http://stackoverflow.com/comment/37460432
has answer: http://stackoverflow.com/a/24249421
favorite count: 0
type: Question
upvote count: 2
answer count: 2

http://stackoverflow.com/comment/37445420
type: QuestionComment
comment on: http://stackoverflow.com/q/24232738
score: 0
type: Comment
has text: a user is typing 524288 chars - maybe the client should limit the saize adn valdiate beforehand anyway

http://stackoverflow.com/a/24263882
score: 5
has comment: http://stackoverflow.com/comment/37494672
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/37495523
has body: Conversions like this are sometimes worth doing as a first step in something else, and that's why your IDE gives you an easy way to do it correctly. If you're going to leave the code exactly in the form given, there's no reason for the conversion. It's equivalent code. I would personally prefer to leave it in the more concise and expressive for-each form. If you need to change your loop so it does something more complex, like removing from the list as you traverse it, the proper way to do that is with an iterator, and it can be easily added in the converted code.
accepted answer of: http://stackoverflow.com/q/24263479
answers question: http://stackoverflow.com/q/24263479
has comment: http://stackoverflow.com/comment/37483723
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37484094

network-programming
tag name: network-programming
tags question: http://stackoverflow.com/q/24136880
tags question: http://stackoverflow.com/q/24150559
tags question: http://stackoverflow.com/q/24228605
tags question: http://stackoverflow.com/q/24152123
tags question: http://stackoverflow.com/q/24190507
tags question: http://stackoverflow.com/q/24232111
tags question: http://stackoverflow.com/q/24112391
tags question: http://stackoverflow.com/q/24117089
tags question: http://stackoverflow.com/q/24219883
tags question: http://stackoverflow.com/q/24221984
tags question: http://stackoverflow.com/q/24180618
tags question: http://stackoverflow.com/q/24258544
tags question: http://stackoverflow.com/q/24214291
tags question: http://stackoverflow.com/q/24188992
tags question: http://stackoverflow.com/q/24166747
type: Tag
tags question: http://stackoverflow.com/q/24190810
tags question: http://stackoverflow.com/q/24261027
tags question: http://stackoverflow.com/q/24127886

http://stackoverflow.com/comment/37361699
comment on: http://stackoverflow.com/q/24199834
score: 0
type: Comment
type: QuestionComment
has text: @BackSlash But how????? ihave try it in my custom class but i can't add value in map which use by HashSet class at that point i have stop.....:(

http://stackoverflow.com/q/24249917
has comment: http://stackoverflow.com/comment/37457646
has comment: http://stackoverflow.com/comment/37458149
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24250205
has comment: http://stackoverflow.com/comment/37457752
downvote count: 0
has comment: http://stackoverflow.com/comment/37457945
has comment: http://stackoverflow.com/comment/37457843
has comment: http://stackoverflow.com/comment/37457809
has comment: http://stackoverflow.com/comment/37459262
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37458429
has answer: http://stackoverflow.com/a/24250250
has comment: http://stackoverflow.com/comment/37457757
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24250137
has comment: http://stackoverflow.com/comment/37457789
has comment: http://stackoverflow.com/comment/37457728
has body: I'm pretty new at when it comes to Java and I am having an issue with this new Program that I am designing. I believe it might have something to do with the Scanner, but I am not so sure. I apologize if my formatting is off, this is my first post. Any help would be appreciated. package commissioncalculationprogram; import java.util.Scanner; public class calculate { public static void main(String args[]) { Scanner input = new Scanner(System.in); // for user input //create new object to compute compensation and find the highest earner Salesman a = new Salesman (); System.out.print("How many salespersons do you want to compare: "); int SIZE = input.nextInt(); //**** Line 14 in original code **** String[] name = new String[SIZE]; double[] sale = new double[SIZE]; double[] compensation = new double[SIZE]; // input data for each person and compute compensation for that one for (int i = 0; i &lt; SIZE; i++) { input.nextLine(); System.out.print("Please enter name of person " + (i+1) + ": "); name[i] = input.nextLine(); System.out.print("Please enter total annual sales of person " + (i+1) + ": $"); sale[i] = input.nextDouble(); compensation[i] = a.calculation(sale[i]); } // find index of the highest earner in array int highest = a.highest_earner(compensation, SIZE); // display the highest earner System.out.println("\nThe highest earner is: \n" + name[highest] + " with total sales: $" + sale[highest] + " and total compensation: $" + compensation[highest]); // calculate and display the additional amount of sales that each salesperson // must achieve to match or exceed the higher of the two earners System.out.println("\nAdditional amount of sales needed for others to match the higgest earners:"); System.out.format("%-25s%10s\n", " Name", "Sale amount needed"); for (int i = 0; i &lt; SIZE; i++) { if (i == highest) { continue; } // skip the highest earner //System.out.println(name[i] + "\t\t$" + (sale[highest] - sale[i])); System.out.format("%-25s%10s\n", name[i], (sale[highest] …
has comment: http://stackoverflow.com/comment/37457847
has answer: http://stackoverflow.com/a/24250171
has comment: http://stackoverflow.com/comment/37457621
answer count: 4
has title: Exception in thread "main" java.util.NoSuchElementException, Numerous errors
score: 2
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/37457635

http://stackoverflow.com/a/24166733
has body: That your methods return void is unusual. I can only assume that instead of returning a node, findChild() sets a cursor in the object. It's not a style I'm keen on. You should make sure you know for sure how it's supposed to work (e.g. how does it communicate "not found"?) - or clarify with your tutor. The pseudocode is: foreach line of text read parent name and list of children tree.findChild(parent) if not found, create root node with name of parent foreach child create new node and add as child of parent (by assigning to left-child to the parent... ... or assigning to right-sibling of the previous child) There are various ways you could rearrange that. For example you could construct an orphaned list of children: Node siblingList = new Node(first child) Node tail = head while(more children) newChild = new Node(next child) tail.rightSibling = newChild tail = newChild ... then attach that list of children to the appropriate parent. parent.leftChild = siblingList
accepted answer of: http://stackoverflow.com/q/24164962
answers question: http://stackoverflow.com/q/24164962
type: Answer
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24277589
type: Answer
accepted answer of: http://stackoverflow.com/q/24171254
downvote count: 0
has body: This appears to be a bug in Hawt.io. There is an indication that it should be fixed in 1.4.5 or 1.4.6, however I have verified that it's still failing in 1.4.8 and 1.5.0-SNAPSHOT.
type: AcceptedAnswer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24171254

http://stackoverflow.com/q/24184670
upvote count: 3
has title: DefaultTableModel not returning values in dataVector
downvote count: 0
has body: My issue is related with JTable and DefaultTableModel. My task is to create JTable which shows data with checkboxes... which I did successfully.. But I want to delete rows from JTable selected by checkboxes... I know this has been asked too many times... And I need to use removeRow(int row) method for removal... But when I executing the statement DefaultTableModel model=(DefaultTableModel)jTable1.getModel(); int totalrows=model.getRowCount(); for (int i = totalrows - 1 ; i &gt;= 0; i--) { Boolean checked = (Boolean) jTable1.getModel().getValueAt(i, 8); if (checked) { ((DefaultTableModel)jTable1.getModel()).removeRow(i); } } It is returning 0 always from getRowCount() method so it will not go inside the loop.. The table is already having rows. My TableModel class is as follows public class tabmod extends DefaultTableModel { public tabmod(Object rowData[][], Object columnNames[]) { super(rowData, columnNames); } @Override public Class getColumnClass(int col) { if (col == 8) return Boolean.class; return super.getColumnClass(col); //other columns accept String values } @Override public boolean isCellEditable(int row, int col) { return col == 8; } } And I am calling it from my JFrame like these tabmod tab=new tabmod(t,header); final JTable table = new JTable(tab); table.setFillsViewportHeight(true); jScrollPane1.add(table); jScrollPane1.setViewportView(table); I am not getting what is the issue here.....
tagged with: swing
favorite count: 0
tagged with: defaulttablemodel
tagged with: jtable
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/24187841
has answer: http://stackoverflow.com/a/24187841
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/24185437
answer count: 2
has answer: http://stackoverflow.com/a/24185437

http://stackoverflow.com/a/34305712
has comment: http://stackoverflow.com/comment/120791256
type: Answer
answers question: http://stackoverflow.com/q/24156490
has body: You can add ShallowEtagHeaderFilter to filter chain. The following snippet works for me. import java.util.Arrays; import org.springframework.boot.context.embedded.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.filter.ShallowEtagHeaderFilter; @Configuration public class FilterConfig { @Bean public FilterRegistrationBean filterRegistrationBean() { FilterRegistrationBean filterBean = new FilterRegistrationBean(); filterBean.setFilter(new ShallowEtagHeaderFilter()); filterBean.setUrlPatterns(Arrays.asList("*")); return filterBean; } } The response body will looks like the below: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 X-Application-Context: application:sxp:8090 ETag: "05e7d49208ba5db71c04d5c926f91f382" Content-Type: application/json;charset=UTF-8 Content-Length: 232 Date: Wed, 16 Dec 2015 06:53:09 GMT
score: 16
downvote count: 1
upvote count: 17

http://stackoverflow.com/q/24111824
has answer: http://stackoverflow.com/a/24117390
upvote count: 2
has title: Grails dynamic scaffolding error
tagged with: grails
type: AnsweredQuestion
score: 2
tagged with: java
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24117390
favorite count: 0
type: Question
has body: I am new to Grails, I installed Grails 2.4 on Ubuntu 14.04 I have this Grails Domain: class EndUser { String username String password String fullName String toString() { "$fullName" } static hasMany = [projects: Project, tasks: Task] static constraints = { fullName() username() password() } } and it's controller: class EndUserController { static scaffold = true def index = { // redirect(action: "list") } } I am getting the error below, and everytime i create a new EndUser, I am getting an error page showing this message: Error 500: Internal Server Error URI /ProjectTracker/endUser/create Class java.lang.NullPointerException Message null What did I do wrong? and how can I fix it? Please let me know if I need to provide more info. |Running Grails application |Server running. Browse to http://localhost:8080/ProjectTracker | Error 2014-06-09 01:59:47,663 [http-bio-8080-exec-7] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /ProjectTracker/endUser/edit/1 Stacktrace follows: Message: Error processing GroovyPageView: Error executing tag &lt;g:form&gt;: Error executing tag &lt;g:render&gt;: null Line | Method -&gt;&gt; 527 | doFilter in /endUser/edit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caused by GrailsTagException: Error executing tag &lt;g:form&gt;: Error executing tag &lt;g:render&gt;: null -&gt;&gt; 38 | doCall in /endUser/edit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caused by GrailsTagException: Error executing tag &lt;g:render&gt;: null -&gt;&gt; 33 | doCall in /endUser/edit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caused by NullPointerException: null -&gt;&gt; 333 | hash in java.util.concurrent.ConcurrentHashMap - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 988 | get in '' | 141 | getValue in grails.util.CacheEntry | 81 | getValue in '' | 33 | doCall . in endUser_edit$_run_closure2_closure27…

http://stackoverflow.com/comment/37207431
has text: Thank you for the link, I've read your answer and it was helpful to clarify the difference between static and non-static. However, not completely helpful because in my case, if I create an instance of ManagementServiceHandler into the class ArithmeticServiceDispatcher, then each time I call the method to get any operation, the map the method looks for to fetch the requested operation is the map of the ManagementServiceHandler I instantiated, not the map where NodeManifest objects are actually stored. So the map is empty and I get always 0 as result. Not sure if i explained my issue correctly..
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24116097
type: Comment

http://stackoverflow.com/a/24111802
accepted answer of: http://stackoverflow.com/q/24111754
score: 0
has body: please Use ArrayAdapter&lt;HashMap&lt;String, String&gt;&gt; instead of ArrayAdapter&lt;String&gt; ArrayAdapter&lt;HashMap&lt;String, String&gt;&gt; arrayAdapter = new ArrayAdapter&lt;HashMap&lt;String, String&gt;&gt;( this, android.R.layout.simple_list_item_1, foodList );
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24111754
type: Answer

http://stackoverflow.com/comment/37313913
has text: Your for does not work, and I am not aloud to use array.copy;
type: Comment
comment on: http://stackoverflow.com/a/24154272
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37478866
type: AnswerComment
comment on: http://stackoverflow.com/a/24261364
type: Comment
has text: The OP had already used `retainAll`. Although I remain slightly uncertain if that was his actual question given the simplicity of the step he had missed.
score: 0

http://stackoverflow.com/a/24148319
has comment: http://stackoverflow.com/comment/37266917
type: Answer
has comment: http://stackoverflow.com/comment/37266579
has comment: http://stackoverflow.com/comment/37266378
has comment: http://stackoverflow.com/comment/37265928
answers question: http://stackoverflow.com/q/24146142
has comment: http://stackoverflow.com/comment/37275080
score: 0
has comment: http://stackoverflow.com/comment/37270699
has comment: http://stackoverflow.com/comment/37265305
has comment: http://stackoverflow.com/comment/37284089
has body: There's no session object in freemarker, you should do something like &lt;#assign session = stack.findValue('#session')/&gt; The action code to execute would be FreemarkerResult fr = new FreemarkerResult("SendEmail.ftl"); ActionContext.getContext().getContainer().inject(fr); Writer out = new StringWriter(); fr.setWriter(out); Map&lt;String, Object&gt; session = ActionContext.getContext().getSession(); session.put("A", A); session.put("B", B); fr.execute(ActionContext.getContext().getActionInvocation());

http://stackoverflow.com/a/25188427
score: 2
upvote count: 2
downvote count: 0
has body: This exception occurs when the POJO does not contain an explicit default/non-parameterized constructor. So adding a default constructor will usually get it fixed. (When you create a Java object from the json string...the ObjectMapper will usually make use of the default constructor of the Java class you are currently marshalling/unmarshalling to/from.)
answers question: http://stackoverflow.com/q/24187073
type: Answer

http://stackoverflow.com/comment/37316570
type: QuestionComment
comment on: http://stackoverflow.com/q/24175853
score: 0
has text: ... and use `IN` clause
type: Comment

http://stackoverflow.com/a/24215166
accepted answer of: http://stackoverflow.com/q/24215063
downvote count: 0
has comment: http://stackoverflow.com/comment/37391524
has body: Match the escape sequence \uXXXX with a regular expression. Then use a replacement loop to replace each occurrence of that escape sequence with the decoded value of the character. Because Java string literals use \ to introduce escapes, the sequence \\ is used to represent \. Also, the Java regex syntax treats the sequence \u specially (to represent a Unicode escape). So the \ has to be escaped again, with an additonal \\. So, in the pattern, "\\\\u" really means, "match \u in the input." To match the numeric portion, four hexadecimal characters, use the pattern \p{XDigit}, escaping the \ with an extra \. We want to easily extract the hex number as a group, so it is enclosed in parentheses to create a capturing group. Thus, "(\\p{XDigit}{4})" in the pattern means, "match 4 hexadecimal characters in the input, and capture them." In a loop, we search for occurrences of the pattern, replacing each occurrence with the decoded character value. The character value is decoded by parsing the hexadecimal number. Integer.parseInt(m.group(1), 16) means, "parse the group captured in the previous match as a base-16 number." Then a replacement string is created with that character. The replacement string must be escaped, or quoted, in case it is $, which has special meaning in replacement text. String data = "This is\\u2019 a sample text file \\u2014and it can ..."; Pattern p = Pattern.compile("\\\\u(\\p{XDigit}{4})"); Matcher m = p.matcher(data); StringBuffer buf = new StringBuffer(data.length()); while (m.find()) { String ch = String.valueOf((char) Integer.parseInt(m.group(1), 16)); m.appendReplacement(buf, Matcher.quoteReplacement(ch)); } m.appendTail(buf); System.out.println(buf);
has comment: http://stackoverflow.com/comment/114120333
score: 10
type: Answer
has comment: http://stackoverflow.com/comment/37391711
has comment: http://stackoverflow.com/comment/37391570
has comment: http://stackoverflow.com/comment/37391491
upvote count: 10
has comment: http://stackoverflow.com/comment/37391683
answers question: http://stackoverflow.com/q/24215063
type: AcceptedAnswer

http://stackoverflow.com/q/24215950
score: 1
tagged with: java
has body: One of my database column is of type Timestamp format (yyyy-MM-dd HH:mm:ss) but the data saved in it is 2014-06-13 00:00:00. So the time component is not saved to the database table. I am trying to INSERT data to that table but unable to remove the time component from my data. Here is what I am doing: long time = System.currentTimeMillis(); java.sql.Timestamp timestamp = new java.sql.Timestamp(time); So the time (long) = 1402710418003 and timestamp=2014-06-13 21:46:58.003 Is there a way I can remove the time part from timestamp? Ex: 2014-06-13 OR Ex: 2014-06-13 00:00:00 This is my prepared statement: java.util.Date currentDate= new java.util.Date(); sql_statement4.setTimestamp(6,new Timestamp(currentDate.getTime())); sql_statement4 is a PreparedStatement object. I want the value to be in Timestamp format. How do I do this?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37392831
upvote count: 1
has comment: http://stackoverflow.com/comment/37392985
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37393308
has title: Saving Timestamp data but only with date in Java
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/24216285
has comment: http://stackoverflow.com/comment/37393324

http://stackoverflow.com/comment/37219932
score: 0
type: AnswerComment
type: Comment
has text: your welcome. It would be helpful if you mark this as useful.
comment on: http://stackoverflow.com/a/24124066

acl
tag name: acl
tags question: http://stackoverflow.com/q/24229704
type: Tag

http://stackoverflow.com/comment/60878660
has text: It is important actually. It's critical to distinguish newly created socket conenction.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24219942
type: Comment

http://stackoverflow.com/a/24221144
has comment: http://stackoverflow.com/comment/37402437
score: 0
has comment: http://stackoverflow.com/comment/37402271
answers question: http://stackoverflow.com/q/24221077
has body: You can use either the comparable or comparator functions to, effectively sort arrays of objects by a specific value. You will, depending override the compare to value and select an instance field to make comparisons with.
type: Answer

http://stackoverflow.com/a/24183063
type: Answer
accepted answer of: http://stackoverflow.com/q/24183024
answers question: http://stackoverflow.com/q/24183024
has comment: http://stackoverflow.com/comment/37331199
has comment: http://stackoverflow.com/comment/37330973
downvote count: 0
score: 1
upvote count: 1
has body: Set JAVA_HOME to which ever version you want in your bash_profile. Maven uses JAVA_HOME to read the Java version to be used
type: AcceptedAnswer

http://stackoverflow.com/comment/37364222
type: QuestionComment
score: 0
has text: There are 2 errors: (1) Array INFO: 0.22772277227722773 9.831683168316832 -1.94.59405 94059405 (2) Error in http connection android os.NetworkOnMainThreadException
type: Comment
comment on: http://stackoverflow.com/q/24197350

http://stackoverflow.com/comment/37459473
has text: No, it won't. `${fn:replace(fn:escapeXml(text), "\n", " ")}` will do exactly what you want.
type: AnswerComment
comment on: http://stackoverflow.com/a/24226850
score: 0
type: Comment

http://stackoverflow.com/q/24179497
linked to: http://stackoverflow.com/q/6340535
has body: This question already asked before but I don't find good understandable answer from there. I would actually want to know that unlike c++ class objects can't be created statically in java why ? and what are the main disadvantages to create objects statically that java designers want to prevent to be occur ? Thanks.
has comment: http://stackoverflow.com/comment/37323630
tagged with: static
type: Question
has comment: http://stackoverflow.com/comment/37323993
linked to: http://stackoverflow.com/q/18827284
has comment: http://stackoverflow.com/comment/37323732
has comment: http://stackoverflow.com/comment/37323678
has comment: http://stackoverflow.com/comment/37324344
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37323620
has comment: http://stackoverflow.com/comment/37322817
has comment: http://stackoverflow.com/comment/37323028
has comment: http://stackoverflow.com/comment/37324523
has comment: http://stackoverflow.com/comment/37323004
tagged with: c++
tagged with: dynamic
has comment: http://stackoverflow.com/comment/37323780
has title: Why class objects only created dynamically in java?
linked to: http://stackoverflow.com/q/12836522
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/37323418
has comment: http://stackoverflow.com/comment/37324198
downvote count: 0
has answer: http://stackoverflow.com/a/24180016
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/24181115
linked to: http://stackoverflow.com/q/974583
has comment: http://stackoverflow.com/comment/37323642
has comment: http://stackoverflow.com/comment/37322927
has comment: http://stackoverflow.com/comment/37323565
has comment: http://stackoverflow.com/comment/37325105
favorite count: 0

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/24184308
type: Tag
tags question: http://stackoverflow.com/q/24149361

http://stackoverflow.com/comment/37189697
has text: Thank you for your attention but I have also setLookAndFeel method for ubuntu but it doesn't affect. It is already same.
comment on: http://stackoverflow.com/a/24108321
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/24234416
accepted answer: http://stackoverflow.com/a/24308431
possible better answer: http://stackoverflow.com/a/24234658
has title: Retrieve part of URL path in JSP
tagged with: java
score: 2
upvote count: 2
type: AnsweredQuestion
answer count: 2
has body: In my spring application, I have in my controller one method map a view in this form: http://server/app/viewname/1/10/1 I want retrieve inside the jsp the values after the viewname (1, 10 and 1). Is there any way to do that? That's my JSP page: <%@ include file="../include/header.jsp" %> <sec:authorize access="hasPermission(#user, 'cadastra_${param.name}')"> Cadastrar novo ${param.name} </sec:authorize> <c:forEach var="item" items="${param.elements}"> ${item} </c:forEach> <sec:authorize access="hasPermission(#user, 'altera_${param.name}')"> </sec:authorize> <sec:authorize access="hasPermission(#user, 'remove_${param.name}')"> </sec:authorize> <c:url value="/${param.name}/listagem.json" var="listagem"/> <%@ include file="../include/footer.jsp" %> I need retrieve this data before the tag above.
has answer: http://stackoverflow.com/a/24308431
downvote count: 0
has answer: http://stackoverflow.com/a/24234658
tagged with: jsp
tagged with: spring
favorite count: 0
type: Question

http://stackoverflow.com/a/24181735
downvote count: 0
has comment: http://stackoverflow.com/comment/37326894
has body: The suppression thing isn't limited to try-with-resources, and you can use it for similar situations yourself. E.g., it is provided for other situations. try-with-resources puts the logic for closing the resources behind the scenes, so you don't have direct access in your own code to dealing with any exceptions that occur during the process. So they added the "suppression" thing so they could use it in that behind-the-scenes code. But cleverly, they didn't only make it something that could be used there. You can use it yourself, via Throwable#addSuppressed. You can see this in the pseudo-code example given in JLS §14.20.3.1; here's a real code version of it: { SomeResource someResource = null; Throwable primaryException = null; try { someResource = /*...get the resource...*/; /*...do something...*/ } catch (Throwable t) { primaryException = t; throw t; } finally { if (someResource != null) { if (primaryException != null) { // Dealing with a primary exception, close the resource // and suppress any exception resulting try { someResource.close(); } catch (Throwable suppressed) { primaryException.addSuppressed(suppressed); } } else { // Not dealing with a primary exception, close the // resource without suppressing any resulting exception someResource.close(); } } } }
answers question: http://stackoverflow.com/q/24181489
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/37346276
accepted answer of: http://stackoverflow.com/q/24181489
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37360438

http://stackoverflow.com/q/24218731
answer count: 1
downvote count: 0
tagged with: javascript
has title: How to execute a javascript without webview or fxml in a JavaFX Application?
has answer: http://stackoverflow.com/a/24224863
has body: I've got a JavaFX sample code, with a CSS file and javascript file, without html code and without fxml code, and I want to load the javascript file code. I know how to load the css file with: scene.getStylesheets().add(Login.class.getResource("login.css").toExternalForm()); But I don't find a same instruction for a javascript file. I want to add the javascript file code to the scene: The .java code is: package login; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.text.Text; import javafx.stage.Stage; public class Login extends Application { @Override public void start(Stage primaryStage) { primaryStage.setTitle("Bienvenido a JavaFX"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Scene scene = new Scene(grid, 300, 300); primaryStage.setScene(scene); scene.getStylesheets().add(Login.class.getResource("login.css").toExternalForm()); Text scenetitle = new Text("Bienvenido"); //scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); scenetitle.setId("welcome-text"); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label("Nombre de Usuario:"); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Contraseña:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); //grid.setGridLinesVisible(true); // Para Debugging. Button btn = new Button("Entrar"); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actio…
score: 2
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/37406558
tagged with: java
has comment: http://stackoverflow.com/comment/37406594
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37404615
linked to: http://stackoverflow.com/q/23436894
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/37469871
type: QuestionComment
comment on: http://stackoverflow.com/q/24256232
type: Comment
score: 0
has text: Continuing what user3580294 said, although the Java library source is available for reference, there is no guarantee that it matches the actual binary implementation. My first-order guess would be that the String class uses many more native routines than it lets on.

http://stackoverflow.com/comment/37225971
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24127438
has text: I am not able to move the file which I am getting from the text box...

http://stackoverflow.com/q/24144418
upvote count: 2
has comment: http://stackoverflow.com/comment/37257465
has comment: http://stackoverflow.com/comment/37257752
has body: I got the following problem. My generic class CursorPointer delivers a cursor to a SQL database where it provides several methods to extract the values for the current cursor position. Now I would like to provide an interface that is able to requery a cursor of the same type. Currently my code looks like this: public abstract class CursorPointer&lt;TElement&gt; { public static interface ICursorQuery&lt;TElement&gt; { public CursorPointer&lt;TElement&gt; query(); } private final ICursorQuery&lt;TElement&gt; reQueryHandler; private final Cursor cursor; public CursorPointer(Cursor cursor, ICursorQuery&lt;TElement&gt; reQueryHandler) { this.cursor = cursor; this.reQueryHandler = reQueryHandler; } public Cursor getCursor() { return cursor; } public CursorPointer&lt;TElement&gt; reQuery() { try { return reQueryHandler == null ? null : reQueryHandler.query(); } finally { this.close(); } } public TElement get(int position) { cursor.moveToPosition(position); return get(); } public TElement get() { return get(cursor); } protected abstract TElement get(Cursor cursor); } An implementation of that cursor will result in something like this: public class RouteCursor extends CursorPointer&lt;RouteElement&gt; { @Override public CursorPointer&lt;RouteElement&gt; reQuery() { // TODO Auto-generated method stub return super.reQuery(); } } So the return type of the reQuery-method is generic, too. But I actually want a generic constrain on the CursorPointer class so that the return type of reQuery MUST be RouteCursor again. But how to define that constraint?
type: AnsweredQuestion
score: 2
tagged with: constraints
has title: Java generics constraint for same type
tagged with: sql
tagged with: java
answer count: 1
tagged with: jdbc
downvote count: 0
has comment: http://stackoverflow.com/comment/37258002
tagged with: generics
has answer: http://stackoverflow.com/a/24145309
favorite count: 0
accepted answer: http://stackoverflow.com/a/24145309
has comment: http://stackoverflow.com/comment/37258123
type: Question
has comment: http://stackoverflow.com/comment/37257281
has comment: http://stackoverflow.com/comment/37257533

http://stackoverflow.com/comment/37415631
type: AnswerComment
has text: @filcab: come on now , really!! Its a way of expression.good day, peace out!!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24187596

http://stackoverflow.com/q/24239122
tagged with: apache-fop
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24239173
tagged with: java
downvote count: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xslt
type: Question
has title: Pass a parameter from java-embedded fop to xsl file
upvote count: 2
has body: I've embedded fop in a java programm: public class run { public static void main(String [ ] args){ FopFactory fopFactory = FopFactory.newInstance(); OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(new File("F:/test.pdf"))); } catch (FileNotFoundException e) { e.printStackTrace(); } try { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); TransformerFactory factory = TransformerFactory.newInstance(); Source xslt = new StreamSource(new File("F:/main_structure.xsl")); Transformer transformer = factory.newTransformer(xslt); Source src = new StreamSource(new File("F:/source.xml")); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); } catch (FOPException e) { e.printStackTrace(); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } finally { try { out.close(); System.out.println("ende"); } catch (IOException e) { e.printStackTrace(); } } } } now my xsl (main_structure.xsl) needs a parameter to run &lt;xsl:param name="OFFSET_LEFT" select="1"/&gt; in the console I would be using the "-param name value" attribute to pass that parameter to fop. So how do I pass a parameter into my xsl file in the embedded version of fop?
tagged with: parameters
accepted answer: http://stackoverflow.com/a/24239173
score: 2

http://stackoverflow.com/comment/37440982
type: Comment
comment on: http://stackoverflow.com/a/24240084
type: AnswerComment
has text: Added alternative for when you can't edit the region jars.
score: 0

http://stackoverflow.com/comment/91231027
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/34587875
type: Comment
has text: @MiguelMunoz , can you check the values of the following environment variables `M2_HOME` & `PATH`?

http://stackoverflow.com/q/24193313
tagged with: arrays
has comment: http://stackoverflow.com/comment/37349509
has comment: http://stackoverflow.com/comment/37349224
type: AnsweredQuestion
upvote count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/37349183
tagged with: java
has answer: http://stackoverflow.com/a/24193434
accepted answer: http://stackoverflow.com/a/24193434
has answer: http://stackoverflow.com/a/24193431
possible better answer: http://stackoverflow.com/a/24193431
has comment: http://stackoverflow.com/comment/37349430
has title: I want to write a method in java that will analyse the string, and get all the message start with # or @ or end with .com
tagged with: string
favorite count: 0
type: Question
answer count: 2
tagged with: algorithm
has comment: http://stackoverflow.com/comment/37349512
score: -2
has body: public static String extract(String text, String reference){ String hashtag; String referenceuser; String links; String[] temp = text.split("\\s+"); String result = ""; //boolean flag = true; for(int c = 0 ; c&lt;temp.length ;c++){ if (temp[c].startsWith("#")){ hashtag = "\n" + temp[c]; result = hashtag; return result; } else if (temp[c].startsWith("@")){ referenceuser = "\n"+ temp[c]; result = referenceuser; return result; } else if (temp[c].endsWith(".com")){ links = temp[c]; result = links; return result; } } return result; I wrote this one, but it seems only find the 1st element i want, aka the 1st hashtag messages, i was wondering how is that possible to let this code keep looping so that all the matching string is getted. how do I get all the info i needed.

http://stackoverflow.com/a/24200236
type: Answer
answers question: http://stackoverflow.com/q/24200186
score: 3
has comment: http://stackoverflow.com/comment/37362693
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24200186
has body: You can use lookarounds for this: (?&lt;![-\d])\s+|\s+(?![\d-]) Code Demo
downvote count: 0

http://stackoverflow.com/comment/37406558
type: Comment
type: QuestionComment
has text: Can you clarify a bit more about what you're trying to do, or perhaps *why* you want to execute javascript here. Also, if you don't have an HTML document, it's not clear what the `document` variable in the javascript is going to represent.
comment on: http://stackoverflow.com/q/24218731
score: 0

http://stackoverflow.com/a/24186369
type: Answer
answers question: http://stackoverflow.com/q/24186263
score: 30
has comment: http://stackoverflow.com/comment/109740038
has comment: http://stackoverflow.com/comment/95576260
type: AcceptedAnswer
downvote count: 0
upvote count: 30
accepted answer of: http://stackoverflow.com/q/24186263
has body: To create objectId programmatically, use the following syntax import org.bson.types.ObjectId; ObjectId id1 = new ObjectId(); ObjectId id2 = ObjectId.get(); // In case you want to mention the parent ID itself, ObjectId id3 = new ObjectId("5399aba6e4b0ae375bfdca88");

http://stackoverflow.com/q/24180573
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24188498
tagged with: jpa
tagged with: mysql
has body: I have a webapp running in Glassfish + postgreSQl + JPA and I am supposed to migrate it to Tomcat + MySQL. I have the data available in MYsql but I face issue with resource creation. Maven Project --> META-INF --> context.xml <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="10" maxIdle="4" name="jdbc/pool" password="pwd" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" url="jdbc:mysql://xx.xx.xx.xx:3306/db" username="user"/> Project -- > src/main/resouces/META-INF --> persistence.xml org.eclipse.persistence.jpa.PersistenceProvider jdbc/Pool <property name="javax.persistence.jdbc.url" value="jdbc:mysql://xx.xx.xx.xx:3306/db?zeroDateTimeBehavior=convertToNull"/> <property name="javax.persistence.jdbc.password" value="pwd"/> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> <property name="javax.persistence.jdbc.user" value="test"/> <property name="javax.persistence.schema-generation.database.action" value="create"/> Maven Project --> WEB-INF --> web.xml DB Connection jdbc/Pool javax.sql.DataSource Container I have the mysql-connector undet tomcat/lib When deployed , tomcat logs has INFO: Deploying configuration descriptor F:\Dev_Env\apache-tomcat-7.0.42\conf\Catalina\localhost\TestApp.xml Jun 12, 2014 2:37:37 PM org.apache.tomcat.jdbc.pool.ConnectionPool init but resource instance is not created SEVERE: Servlet /TestApp threw load() exception javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceEnvFactory.java:117) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321) at org.apache.naming.NamingContext.lookup(NamingContext.java:843) at org.apache.naming.NamingContext.lookup(NamingContext.java:154) at org.apache.naming.NamingContext.lookup(NamingContext.java:831) at org.apache.naming.NamingContext.lookup(NamingContext.java:168) at org.apache.catalina.core.DefaultInstanceMana…
tagged with: tomcat
type: Question
has title: Tomcat - Mysql -Persistence... Cannot create resource
tagged with: maven
has answer: http://stackoverflow.com/a/26073942
linked to: http://stackoverflow.com/q/3821640

http://stackoverflow.com/q/24174654
tagged with: java
accepted answer: http://stackoverflow.com/a/24427178
tagged with: easymock
has body: I want to know how to write test cases with EasyMock for classes that contain methods with arguments and returns some object. Pls let me know if it is not detailed enough. I did worked on it for hours to solve it..so i opted stackoverflow now. The following is the method present in Class XYZ that i'm trying to workout public static Identifier getMachineIdentifierFor( Machine machine ) { Identifier identifier = new IdentifierImpl(); identifier.setMachine(machine.getMachine()); identifier.setMachineIdentifierType(machine.getMachineIdentifierType()); return identifier; } The following is how Machine class looks like( just sample ...i skipped getters and setter while copying to here) public class MachineImpl implements Machine { private String machine; private MachineIdentifierType machineIdentifierType; //@followed by some strings and getters and setters for the corresponding fields } The following is how identifier looks like public class IdentifierImpl implements Identifier { private String machine; private machineIdentifierType machineIdentifierType; public void setInstrument(String machine) { this.machine = machine; } public String getMachine() { return machine; } public MachineIdentifierType getMachineIdentifierType() { return machineIdentifierType; } public void setInstrumentIdentifierType(MachineIdentifierType machineIdentifierType) { this.machineIdentifierType = machineIdentifierType; } } Any help is appreciated
has answer: http://stackoverflow.com/a/24427178
type: AnsweredQuestion
score: 0
has title: Regarding EasyMock for class that contains method with parameters
answer count: 1
type: Question

http://stackoverflow.com/a/24200078
score: -2
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37388333
has body: you can try with a regex like : /&lt;spec[^&gt;]*&gt;(.*?)&lt;\/spec&gt;/ i think it is not efficient but you can try, check the regex for a better performance /&lt;td[^&gt;]*&gt;(.*?)&lt;\/td&gt;&lt;\/tr&gt;/ this is an approximation. would fail the subject of child. You can use this result to remove span, div etc. /&lt;(.*?)[^&gt;]*&gt;(.*?)&lt;\/(.*?)&gt;/
answers question: http://stackoverflow.com/q/24198602
upvote count: 0

http://stackoverflow.com/comment/37411326
type: AnswerComment
type: Comment
has text: Speculation: It *could* come from a new attitude sweeping SO Meta that 'poor questions' should be down-voted and closed/deleted, rather than answered (whether well or any other way). Perhaps someone extended that down vote to an answer as well. But that is just my random speculation. It would be good to get actual information to replace it.
comment on: http://stackoverflow.com/a/24224496
score: 0

http://stackoverflow.com/q/24190063
has answer: http://stackoverflow.com/a/27976517
has answer: http://stackoverflow.com/a/37334766
has comment: http://stackoverflow.com/comment/37343192
has answer: http://stackoverflow.com/a/36988796
has answer: http://stackoverflow.com/a/24402755
has comment: http://stackoverflow.com/comment/37343488
has body: $ cassandra Cassandra 2.0 and later require Java 7 or later. OK, what's going on in that part of the init script? java_ver_output=`"${JAVA:-java}" -version 2&gt;&amp;1` jvmver=`echo "$java_ver_output" | awk -F'"' 'NR==1 {print $2}'` JVM_VERSION=${jvmver%_*} JVM_PATCH_VERSION=${jvmver#*_} if [ "$JVM_VERSION" \&lt; "1.7" ] ; then echo "Cassandra 2.0 and later require Java 7 or later." exit 1; fi Hmm, if I get the version at the command line: $ java_ver_output=`"${JAVA:-java}" -version 2&gt;&amp;1` $ echo $java_ver_output java version "1.7.0_55" Java(TM) SE Runtime Environment (build 1.7.0_55-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode) $ JVM_VERSION=${jvmver%_*} $ echo $JVM_VERSION 1.7.0 If I run which java: $ which java /usr/bin/java If I put that line in the script: /usr/bin/java The frustrating part here is that I've got this running in the past but since I bounced the server I can't get cassandra to start. So I'm confused here, how is Cassandra confused about what version of Java I'm running? How do I get cassandra running? Is 1.7.0_55 not Java 7 (I don't get Java's naming convention)?
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/37451907
has comment: http://stackoverflow.com/comment/37343004
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37343529
has comment: http://stackoverflow.com/comment/37397742
possible better answer: http://stackoverflow.com/a/24190146
has comment: http://stackoverflow.com/comment/38873429
favorite count: 0
has comment: http://stackoverflow.com/comment/37343620
has answer: http://stackoverflow.com/a/37083286
score: 2
type: AnsweredQuestion
tagged with: cassandra
has title: cassandra 2 complaining about Java 7 when I have Java 7 installed
has answer: http://stackoverflow.com/a/24190146
has answer: http://stackoverflow.com/a/57984845
has comment: http://stackoverflow.com/comment/37342871
has answer: http://stackoverflow.com/a/32860137
has comment: http://stackoverflow.com/comment/37343096
has comment: http://stackoverflow.com/comment/37383846
has comment: http://stackoverflow.com/comment/37343836
accepted answer: http://stackoverflow.com/a/24402755
tagged with: java
linked to: http://stackoverflow.com/q/24119211

http://stackoverflow.com/comment/48014586
has text: @joe_deniable . I have same issue, and i sent the email to Google too. But no response yet. Did you get any response or solution ? Thanks
type: Comment
comment on: http://stackoverflow.com/q/24221331
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37339118
score: 0
type: AnswerComment
has text: In Scala (and other functional programming languages) immutability is favored over mutability. This has some advantages, e.g. you can reason better about what happens in your program and it simplifies concurrent programming.
comment on: http://stackoverflow.com/a/24187962
type: Comment

http://stackoverflow.com/q/24159191
has comment: http://stackoverflow.com/comment/37284570
has body: I want to write in file that exists. My data is in the form of java list. Here is a sample of data : snmp,192.168.20.1,cloud, snmp,192.168.20.2,cloud, I want to add line snmp,192.168.20.1,cloud123 in the file. It should update existing file content i.e.(snmp,192.168.20.1,cloud) by new contents given. And if provided contents different from contents of file then append it to file? Here is my workaround--- String tempFile = RunMTNew.instdir + "/var/"; File tempFileName = new File(tempFile+"hosts.tempFile"); try{ if(!tempFileName.exists()) { tempFileName.createNewFile(); } }catch (FileNotFoundException e){ e.printStackTrace(); } catch ( IOException ioe){ ioe.printStackTrace(); System.out.println("Exception occured while creating temp file"); } FileReader fileReader = new FileReader(filename); BufferedReader bufferedReader = new BufferedReader(fileReader); PrintWriter tempoutfile= null; while((line = bufferedReader.readLine()) != null) { System.out.println("line before if "+ line); if(line!=null || (line = line.trim()) != "" ){ System.out.println("line at start of while" + line); String[] lineFromFile = line.split(","); try { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filename, true))); ListIterator atwlist = arraytowrite.listIterator(); String lineToWriteInFile = ""; while (atwlist.hasNext()) { ArrayList atwlistline = (ArrayList) atwlist.next(); System.out.println("array" + atwlistline); String lineToAdd = atwlistline.toString(); lineToWriteIfNotFound = lineToAdd; System.out.println("After converting to string line is" + lineToAdd); System.out.println("lineFromFile contents are "+ lineFromFile[1]); if(lineToAdd.contains(lineFromFile[1])){ lineToWriteInFile = lineToAdd; } else{ lineToWriteInFile = line; } } try{ tempoutfile = new PrintWriter(new BufferedWriter(new FileWriter(tempFileName, true))); System.out.println("writing in file" +lineToWriteInFile); tempoutfile.write(lineToWriteInFile); tempoutfile.write("\n"); }catch(IOException ioe){ ioe.…
type: AnsweredQuestion
score: 0
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24159370
has title: How to write in existing file from list using Java by removing duplicate data?
tagged with: file
has answer: http://stackoverflow.com/a/24238530
accepted answer: http://stackoverflow.com/a/24238530
possible better answer: http://stackoverflow.com/a/24159273
has comment: http://stackoverflow.com/comment/37284526
has comment: http://stackoverflow.com/comment/37284550
type: Question
has answer: http://stackoverflow.com/a/24159273

http://stackoverflow.com/comment/37398058
type: QuestionComment
score: 0
has text: Yes, in this example I want to be found and present in matcher1.group(1)
type: Comment
comment on: http://stackoverflow.com/q/24218863

http://stackoverflow.com/comment/37389182
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24210424
has text: Absolutely. You can register BroadcastReceivers locally within Activitys and other classes to react to different Intents that are being broadcast. What your BroadcastReceiver does when called is completely up to you.

http://stackoverflow.com/q/24245439
type: UnansweredQuestion
tagged with: war
tagged with: glassfish
has comment: http://stackoverflow.com/comment/37450293
score: 0
tagged with: glassfish-3
has body: I have a JavaEE ear containing an ejb and war being deployed to GlassFish v3.1.2.2. The war contains a Jersey/Atmosphere application that is using CDI. Within the war, I have an MDB that is asynchronously receiving events it will broadcast using Atmosphere. The message I need to broadcast using Atmosphere needs to includes some links to other resources in the web application. In order to build those links, like in other places in the code, I would like to use UriBuilder. To do so, I need access to the application's deployed context root, so I can invoke UriBuilder.fromPath(contextRoot) This Java EE 7 article implies I can inject a ContextServlet into a CDI bean this way: @Inject ServletContext context; But this does not work for my MDB. I'm also only on JavaEE6 w/ Glassfish v3. How can I access the ServletContext from an MDB hosted in my war?
has comment: http://stackoverflow.com/comment/37450206
has answer: http://stackoverflow.com/a/24255940
tagged with: java
answer count: 1
has title: Determine WAR context root from MDB
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37450944

http://stackoverflow.com/q/24241104
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37478180
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37440753
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I have created a simple java class and my server is glassfish server 4.0. I am getting Classnotfound exception on server start. I am using java jdk1.7.0_60. My classpath is set to C:\Program Files (x86)\Java\jdk1.7.0_60\bin and also my JAVA_HOME set to C:\Program Files (x86)\Java\jdk1.7.0_60\bin. Here is my java code package java.kabita; import java.util.ArrayList; import java.util.List; import javax.jws.WebService; @WebService public class ProductCatalog { public List&lt;String&gt; productCategories() { List&lt;String&gt; categories = new ArrayList&lt;&gt;(); categories.add("Books"); categories.add("Music"); categories.add("Movies"); return categories; } } Here is the error Info: Running GlassFish Version: GlassFish Server Open Source Edition 4.0 (build 89) Info: Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter Info: SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. Info: SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. Info: SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created. Info: Grizzly Framework 2.3.1 started in: 31ms - bound to [/0.0.0.0:8,080] Info: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:8,181] Info: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:4,848] Info: Authorization Service has successfully initialized. Info: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:3,700] Info: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry Info: this.makeModuleFor(org.glassfish.main.web.glue, null) returned OSGiModuleImpl:: Bundle = [org.glassfish.main.web.glue [263]], State = [READY] Info: this.makeModuleFor(org.glassfish.web.javax.servlet.jsp, null) returned OSGiModuleImpl:: Bundle = …
has title: classNotFound Exception on glassfish server
answer count: 0
tagged with: classnotfoundexception

http://stackoverflow.com/comment/37502119
comment on: http://stackoverflow.com/a/24244366
type: Comment
score: 0
type: AnswerComment
has text: You're right. I tested it also, and I watched your video and really.

http://stackoverflow.com/q/24241159
has comment: http://stackoverflow.com/comment/37456025
tagged with: struts2
has body: I have a login action which after successful execution redirects to the previous page (I store the previous page in my session so I can fetch it later). In Struts2, I can find two ways to do this redirection: ${previousAction.requestURL} In this example, the getPreviousAction().getRequestURL() method (this is a selfmade method, its not native to Struts2) will be invoked and this will return the URL of the previous page as intended, for example: somenamespace/index.action There is also another type of redirection: ${previousAction.name} /${previousAction.namespace} I want to use this `redirectAction result type because it is much cleaner. But, I have a problem when query parameters are part of the URL. For example: somenamespace/index.action?name=john&age=50 I know I can add these params hardcoded in my struts.xml, but the problem is my login action should redirect to any previously invoked action, and I do not know beforehand which query parameters the previous actions had. This is different from the typical usecase where you know exactly to which action you're redirecting to A very bad solution I found was adding every param possible (the collection of all params of all my actions in struts.xml) and then use the option: true
has comment: http://stackoverflow.com/comment/37440683
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: ognl
downvote count: 0
answer count: 1
has title: Redirecting to another action with unknown amount of parameters in Struts 2
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24250240
accepted answer: http://stackoverflow.com/a/24250240
tagged with: http-redirect

http://stackoverflow.com/q/24105406
has answer: http://stackoverflow.com/a/24105543
type: Question
has comment: http://stackoverflow.com/comment/37184604
tagged with: android
accepted answer: http://stackoverflow.com/a/24105543
has body: Actually, I am developing an app which can open another app according what user said to the cell phone. For example, when I said 'Facebook', the app will open Facebook automatically. But I face a problem that the debugger showed Caused by: java.lang.NullPointerException. Here's my source code. Test.java package com.example.Voice_Recognizer; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.app.Application; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.speech.RecognizerIntent; import android.view.View; import android.widget.EditText; public class Test extends Activity { private EditText editText; private List&lt;String&gt; label = new ArrayList&lt;String&gt;(); private List&lt;Drawable&gt; icon = new ArrayList&lt;Drawable&gt;(); private List&lt;ApplicationInfo&gt; installedApps = new ArrayList&lt;ApplicationInfo&gt;(); private List&lt;Class&gt; clsName = new ArrayList&lt;Class&gt;(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); editText = (EditText) findViewById(R.id.edittext); getApp(); } public void getApp() { PackageManager pm = getPackageManager(); List&lt;ApplicationInfo&gt; apps = pm.getInstalledApplications(0); for(ApplicationInfo app : apps) { //checks for flags; if flagged, check if updated system app if((app.flags &amp; ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 1) { installedApps.add(app); clsName.add(pm.getClass()); label.add((String)pm.getApplicationLabel(app)); icon.add(pm.getApplicationIcon(app)); //it's a system app, not interested } else if ((app.flags &amp; ApplicationInfo.FLAG_SYSTEM) == 1) { //Discard this one //in this case, it should be a user-installed app } else { installedApps.add(app); clsName.add(pm.getClass()); label.add((String)pm.getApplicationLabel(app)); icon…
has comment: http://stackoverflow.com/comment/37184708
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37184434
tagged with: java
has title: Android Caused by: java.lang.NullPointerException
answer count: 1

http://stackoverflow.com/comment/37427328
type: AnswerComment
score: 1
type: Comment
has text: @ryvantage I didn't say it would. I suggested it as an optimization. Say the first index you access is 1000. Then the array would probably be relocated log_2(1000) ~ 10 times if you append repeatedly. If you use `ensureCapacity`, it's going to be realocated exactly once.
comment on: http://stackoverflow.com/a/24234162

http://stackoverflow.com/a/24176810
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24176662
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24176662
has body: Ok, as someone commented, I think the problem is in the loops :P This is what we want to do when we read all the words: Create an ArrayList (better than Array, because you don't know exactly how many words you have in the text file). Then create a double loop (1 while + 1 for) which goes through the file and stores strings in that ArrayList The loops will go through all the lines, and then add every word in the line to the ArrayList (using the split on " " like you are trying). So: public ArrayList&lt;String&gt; readFile(){ File f = new File ("dictionary.txt"); ArrayList&lt;String&gt; array = new ArrayList&lt;String&gt;(); try { Scanner input = new Scanner (f); while (input.hasNext()){ //Goes through all lines String line = input.nextLine(); //Array of all words: String[] wordArray = line.split(" "); //Goes through all words: for(String str : wordArray){ array.add(str); } } input.close(); }//try catch (IOException e) { e.printStackTrace(); } return array; }

http://stackoverflow.com/a/24132885
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37236441
has comment: http://stackoverflow.com/comment/37236171
has body: Is your class InboxFragment and FriendsFragment extends Fragment(android.support.v4.app.Fragment) ? android.support.v4.app.Fragment and android.app.Fragment are not compatible to each other and FragmentPagerAdapter supports android.support.v4.app.Fragment only. Give it a try, it should work..
has comment: http://stackoverflow.com/comment/37236153
downvote count: 0
has comment: http://stackoverflow.com/comment/37236967
upvote count: 1
answers question: http://stackoverflow.com/q/24132692
has comment: http://stackoverflow.com/comment/37236141

http://stackoverflow.com/comment/37394161
score: 0
type: AnswerComment
has text: So is there any way to make android:theme="@style/AppTheme" working? I'm using minimum sdk version 9 and target as 19
type: Comment
comment on: http://stackoverflow.com/a/24216560

http://stackoverflow.com/q/24147935
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37264829
tagged with: jsp
has comment: http://stackoverflow.com/comment/37265423
has comment: http://stackoverflow.com/comment/37265020
has answer: http://stackoverflow.com/a/24155846
type: Question
has comment: http://stackoverflow.com/comment/37264949
score: 0
has answer: http://stackoverflow.com/a/24149611
has title: Calling part of jsp page from Servlet or Java Class
has answer: http://stackoverflow.com/a/24147956
tagged with: java
has comment: http://stackoverflow.com/comment/37265170
answer count: 4
tagged with: servlets
has comment: http://stackoverflow.com/comment/37265554
has answer: http://stackoverflow.com/a/24148001
has body: I need to call small part of JSP page(like only div load) when a method is invoked? I know we can load whole JSP page from Servlet. Is this possible or any other solution for this?

http://stackoverflow.com/comment/37337347
has text: And that is often the case. I think I'm arrving late but I see debris from assorted disagreements on other answers
type: Comment
comment on: http://stackoverflow.com/a/24186545
score: 0
type: AnswerComment

http://stackoverflow.com/a/24217356
has body: add the mysql-connector-java-5.0.8-bin.jar to the build path, if that does not resolve add under the projects lib folder
answers question: http://stackoverflow.com/q/24217306
type: Answer
score: 0

http://stackoverflow.com/q/24227448
upvote count: 0
has comment: http://stackoverflow.com/comment/37414277
answer count: 1
downvote count: 3
accepted answer: http://stackoverflow.com/a/24227623
has comment: http://stackoverflow.com/comment/37414228
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24227623
has body: Hi i have one doubt that, I stored the instance of a class in a arraylist. What would be wrong if we store the instances of class in a treeset instead of arraylist? can any one help me in brief description?
tagged with: java
score: -3
has title: What would be wrong if we store the instances of class in a treeset
has comment: http://stackoverflow.com/comment/37414353
has comment: http://stackoverflow.com/comment/37414246
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37414579

http://stackoverflow.com/q/24233528
has comment: http://stackoverflow.com/comment/37426446
has comment: http://stackoverflow.com/comment/37425884
score: 0
tagged with: java
tagged with: stream
answer count: 1
has title: Can signed bytes be read from a stream?
tagged with: c#
has comment: http://stackoverflow.com/comment/37425750
has body: I'm trying to read bytes sent by a java servlet into a C# application, so far, I haven't been able to get anything more than gibberish from the servlet using normal streams in C#. I've tried various forms of decoding, but haven't found a working way to read sbytes into a c# application from an http source. The servlet bytes are sent with Edited Code public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ ServletOutputStream resp = response.getOutputStream(); try{ resp.write("test".getBytes("UTF-8")); } catch(Exception e){ //Do Nothing } C# reads in with try { HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://path.to/servlet"); req.Method = "POST"; req.ContentType = "text/html"; HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); string text; using (var reader = new StreamReader(resp.GetResponseStream())) { text = reader.ReadToEnd(); Console.WriteLine(text); } } catch (Exception e) { Console.WriteLine(e.ToString()); } I end up with two question marks or the same two ascii symbols. Does anyone have any idea how to do stream these Java bytes into a C# application?
type: Question
has answer: http://stackoverflow.com/a/24233579
type: UnansweredQuestion
tagged with: servlets

http://stackoverflow.com/q/24208673
tagged with: websphere-7
has body: I've been rattling my brain on this one today to no avail. I'm trying to redeploy a project to websphere, but whenever I do I get the error "abc123 could not be redeployed because it could not be completely removed in the undeployment phase..." There's a bit more to the error, but it just says to stop the server and try again, but my server is already stopped. When I look into the deployment log I see another error: "WASX7280E: An application with name 'abc123' does not exist." I've tried cleaning the project, removing the deployment, adding it back and there was no change. Anyone else have any ideas I can try?
tagged with: java
tagged with: myeclipse
score: 1
favorite count: 0
type: Question
has title: Error when Re-Deploying Ear to Websphere 7.0 in myEclipse Blue 10.7.1
tagged with: websphere
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37432625
has comment: http://stackoverflow.com/comment/37398916

http://stackoverflow.com/comment/37253318
has text: in the given link input to the map reduce job also xml but i need only output should be xml and the input is normal key value pair.. let me know if i am wrong..
score: 1
comment on: http://stackoverflow.com/a/24139006
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24158965
has answer: http://stackoverflow.com/a/24159957
upvote count: 3
has answer: http://stackoverflow.com/a/45172451
downvote count: 0
has body: I have an object of type: Optional&lt;String&gt; and I would like to know at runtime what is the generic type of Optional - meaning 'String'. I've tried: obj.getClass() but this returns java.util.Optional then I tried, obj.getParameterizedType(); but this doesn't return it has Class&lt;> object. Any idea??
possible better answer: http://stackoverflow.com/a/24159010
type: Question
tagged with: reflection
has answer: http://stackoverflow.com/a/24159010
score: 3
tagged with: java
answer count: 3
favorite count: 0
has title: Java8: How to get the internal Type of java.util.Optional class?
accepted answer: http://stackoverflow.com/a/45172451
type: AnsweredQuestion

http://stackoverflow.com/comment/37401277
has text: What do you mean by "inclusive" and "exclusive" in this context? Both are "inclusive" in that the specified type itself is a valid type argument. Can you quote *exactly* what the book says?
score: 2
comment on: http://stackoverflow.com/q/24220606
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24235036
has body: I have a static list in my Util.java class: ... private static List&lt;MyEntity&gt; mainList = new LinkedList&lt;MyEntity&gt;(); ... static { fillMainList(); } ... public static List&lt;MyEntity&gt; fillMainList() { org.hibernate.Session session = HibernateUtil.getSessionFactory().openSession(); try{ setMainList(new MyEntityDAO(session).findMyEntities()); } finally{ session.close(); } return getMainList(); } ... MyEntityDao.java: ... @SuppressWarnings("unchecked") public List&lt;MyEntity&gt; findMyEntities(){ Criteria criteria = getSession().createCriteria(MyEntity.class); criteria.addOrder(Order.desc("participants") ); criteria.setMaxResults(5); List&lt;MyEntity&gt; MyEntitys = (List&lt;MyEntity&gt;) criteria.list(); List&lt;MyEntity&gt; ordered = new LinkedList&lt;MyEntity&gt;(); ordered.addAll(MyEntitys); return ordered; } ... And here is MyJSFBean.java, where I set the list that my primeFaces dataTable will interact: ... public List&lt;MyEntity&gt; getMainList() { if(mainList == null){ mainList = Util.getMainList(); } return mainList ; } ... And I call the method fillMainList() when I start my application (in the static block from the Util.java class), and after that, every 12 hours (with a scheduler) to update the list. Every time a user enters in a JSF page, its backing bean will get this list from the Util.java class. Ok so, when I start my application, I can see the list in my PrimeFaces datatable in the same order as I queried with Hibernate Criteria. But after some 10 minutes, when I enter in the page again, the list is randomly sorted... The static list lost its sort... how is that possible, I have even used LinkedList to try to maintain the sort without success... thanks!
has comment: http://stackoverflow.com/comment/37429257
has comment: http://stackoverflow.com/comment/37429018
has comment: http://stackoverflow.com/comment/37429458
score: 0
tagged with: linked-list
tagged with: jsf
answer count: 0
tagged with: java
tagged with: collections
has comment: http://stackoverflow.com/comment/37429575
type: Question
has comment: http://stackoverflow.com/comment/37429143
has comment: http://stackoverflow.com/comment/37429029
has comment: http://stackoverflow.com/comment/37429055
has comment: http://stackoverflow.com/comment/37429045
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37429488
has comment: http://stackoverflow.com/comment/37431416
has title: Java static list losing its order after some time
tagged with: sorting

http://stackoverflow.com/q/24115354
has comment: http://stackoverflow.com/comment/37203290
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24119063
has title: Java self-typed methods: cannot safely cast to actual type
has comment: http://stackoverflow.com/comment/37203162
tagged with: generics
has comment: http://stackoverflow.com/comment/37204309
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37203124
has comment: http://stackoverflow.com/comment/37203700
answer count: 1
tagged with: self-type
has comment: http://stackoverflow.com/comment/37217761
accepted answer: http://stackoverflow.com/a/24119063
has comment: http://stackoverflow.com/comment/37217684
has body: Consider the following class, which I believe is correctly called a self-typed class: public abstract class Example&lt;E extends Example&lt;E&gt;&gt; { /** Constructs an instance of the subclass */ protected abstract E construct(); /** Do a private operation in the base class */ private void specialOp() {} public E get1() { E obj = construct(); // Error: The method specialOp() from the type Example&lt;E&gt; is not visible obj.specialOp(); return obj; } public E get2() { Example&lt;E&gt; obj = construct(); obj.specialOp(); // Warning: Type safety: Unchecked cast from Example&lt;E&gt; to E return (E)obj; } public E get3() { E obj = construct(); ((Example&lt;E&gt;)obj).specialOp(); return obj; } } That is to say, implementations extending this class would have a type signature like so: public class SubExample extends Example&lt;SubExample&gt; Each of the three get*() methods ostensibly do the same thing - construct a subclass of Example, execute a private method on the instance, and return it as its subtype. However only the last example compiles without warnings. The behavior in get1() is an error even without generics, consider: public class Example { private void specialOp() {}; public void get(SubExample e) { // Error: The method specialOp() from the type Example is not visible e.specialOp(); } public static class SubExample extends Example {} } Which I understand, even if it seems unnecessarily restrictive to me. And similarly get3() makes sense, though I dislike needing to cast like that. But get2() confuses me. I understand E is technically a subtype of Example&lt;E&gt;, but don't the bounds of this generic ensure that all Example&lt;E&gt;s are also Es? If so, why is it not safe to cast like this? Is it ever possible to cast from Example&lt;E&gt; to E without a warning?
has comment: http://stackoverflow.com/comment/37203332
favorite count: 0
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/37389725
comment on: http://stackoverflow.com/a/24158695
score: 0
type: Comment
type: AnswerComment
has text: ummm... I'm guessing 'FA' needs two bytes because java bytes are signed? I think I read that in a book once...

http://stackoverflow.com/q/24129767
answer count: 1
has body: I would like to setup automated testing for my managed extensions. I am using CommunityServerBuilder as suggested in this post http://www.markhneedham.com/blog/2013/10/20/neo4j-testing-an-unmanaged-extension-using-communitserverbuilder/#comments with versions: neo4j 2.1.1 jersey 2.9 When I try run a test I see this error. java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:445) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532) at java.lang.Thread.run(Thread.java:744) I have also tried jersey versions 1.…
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24132879
tagged with: neo4j
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/24132879
favorite count: 0
has title: Running automated tests on managed extensions in Neo4j 2
type: Question
downvote count: 0

http://stackoverflow.com/q/24123247
type: Question
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24123630
has answer: http://stackoverflow.com/a/24123776
has title: How to create a copy of an instance without having access to private variables
has comment: http://stackoverflow.com/comment/37217487
answer count: 3
has answer: http://stackoverflow.com/a/24123248
has body: Im having a bit of a problem. Let me show you the code first: public class Direction { private CircularList xSpeed, zSpeed; private int[] dirSquare = {-1, 0, 1, 0}; public Direction(int xSpeed, int zSpeed){ this.xSpeed = new CircularList(dirSquare, xSpeed); this.zSpeed = new CircularList(dirSquare, zSpeed); } public Direction(Point dirs){ this(dirs.x, dirs.y); } public void shiftLeft(){ xSpeed.shiftLeft(); zSpeed.shiftRight(); } public void shiftRight(){ xSpeed.shiftRight(); zSpeed.shiftLeft(); } public int getXSpeed(){ return this.xSpeed.currentValue(); } public int getZSpeed(){ return this.zSpeed.currentValue(); } } Now lets say i have an instance of Direction: Direction dir = new Direction(0, 0); As you can see in the code of Direction, the arguments fed to the constructor, are passed directly to some other class. One cannot be sure if they stay the same because methods shiftRight() and shiftLeft could have been called, which changes thos numbers. My question is, how do i create a completely new instance of Direction, that is basically copy(not by reference) of dir? The only way i see it, is to create public methods in both CircularList and Direction that return the variables needed to create a copy of the instance, but this solution seems really dirty since those numbers are not supposed to be touched after beeing fed to the constructor, and therefore they are private. EDIT1: CircularList is a class that is a looped around version of ArrayList. You can see that i feed it an array called dirSquare and then a number. The number is an index in that array. So if the number i feed it is for example 3, it will be the last element in dirSquare, which has value of 0. When i use shiftRight and shiftLeft, the index gets incremented/decremented and if i increment pass the size of the last element of the array, it loops around and starts with 0th elemnt. The same thing happens if i go pass 0 on the other side. Thats why its called Circular list. I cant use getXSpeed/getZSpe…
tagged with: java

http://stackoverflow.com/q/24224799
tagged with: apache-storm
favorite count: 0
type: Question
tagged with: nonblocking
has answer: http://stackoverflow.com/a/24255669
upvote count: 2
type: UnansweredQuestion
tagged with: python
has title: Update vs. Request-Reply in Storm DRPC
has body: I'm building a real-time API handling 2 types of calls: Updates, Computation requests. Internally, the updates are broadcasted among workers. The workers keep working data structures (such as hash-tables) in their RAM, and modify the contents as the updates are coming. When a computation request comes, exactly one idle worker handles it, using multiple threads, working with the local copy in RAM. I'm wondering whether I could migrate my current implementation to Storm. As I understand it, Storm is pretty real-time and could help me a lot with scalability and fault-tolerance. Currently, I'm using UWSGI/Python to handle the API requests, and Java workers to do the computation. I'm thinking of putting the Java workers into the Storm topology as bolts. However, I'm not quite sure about the spouts. As I understand it, I could use DRPC to handle the computation requests, just by connecting to a DRPC server from python. It is clearly written in the docs that DRPC can handle the whole life-cycle of the request-reply paradigm. But what about updates? My question is: Is it a good idea (or is it even possible?) to use DRCP to only submit updates in non-blocking manner, not waiting for replies (because there are no results)?
score: 2
tagged with: real-time
tagged with: java
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37437134
comment on: http://stackoverflow.com/a/24239382
type: AnswerComment
score: 1
type: Comment
has text: Even though the point stays the same, ain't Java int's also 32-bit, not 16?

http://stackoverflow.com/q/24169881
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/24170845
favorite count: 0
type: Question
tagged with: executioncontext
tagged with: scala
accepted answer: http://stackoverflow.com/a/24170622
upvote count: 4
score: 4
has body: I recently came across some odd behavior on a machine where maping a function that returns Future[T] was executing sequentially. This same problem does not occur on other machines: work is interleaved as one would expect. I later discovered that this was likely because Scala was being a little too smart and choosing an ExecutionContext that matched the machine's resources: one core, one worker. Here's some simple code that reproduces the problem: import scala.concurrent._ import scala.concurrent.duration._ val ss = List("the", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog") def r(s: String) : Future[String] = future { for (i &lt;- 1 to 10) yield { println(String.format("r(%s) waiting %s more seconds...", s, (10 - i).toString)) Thread.sleep(1000) } s.reverse } val f_revs = ss.map { r(_) } println("Look ma, no blocking!") val rev = f_revs.par.map { Await.result(_, Duration.Inf) }.mkString(" ") println(rev) Running this on the machine exhibiting the strange behavior produces sequential output like this: Look ma, no blocking! r(the) waiting 9 more seconds... r(the) waiting 8 more seconds... r(the) waiting 7 more seconds... Providing a custom ExecutionContext: val pool = Executors.newFixedThreadPool(1) implicit val ec = ExecutionContext.fromExecutor(pool) allows the threads to interleave on this machine. But I have a new problem now: the thread pool does not shutdown, causing the program to hang indefinitely. Apparently, this is the expected behavior for FixedThreadPools, and I can shut it down by putting pool.shutdown() somewhere. Call me stubborn, but I don't want to have to tell the thread pool to shutdown. Is there a way to configure the pool to shutdown when all of the queues are empty (possibly after some delay) just like it works with the default pool? I've looked through the ExecutionContext documentation, but I'm not finding what I'm looking for.
has answer: http://stackoverflow.com/a/24170845
type: AnsweredQuestion
has title: How do I configure the shutdown policy for Scala ExecutionContexts?
answer count: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24170622

ehcache
tags question: http://stackoverflow.com/q/24213806
tags question: http://stackoverflow.com/q/24110070
tags question: http://stackoverflow.com/q/24229704
tags question: http://stackoverflow.com/q/24122646
tag name: ehcache
tags question: http://stackoverflow.com/q/24143383
tags question: http://stackoverflow.com/q/24137158
type: Tag
tags question: http://stackoverflow.com/q/24125283

http://stackoverflow.com/q/24205017
has comment: http://stackoverflow.com/comment/37371401
has answer: http://stackoverflow.com/a/24205090
answer count: 2
has comment: http://stackoverflow.com/comment/37371888
has comment: http://stackoverflow.com/comment/37374233
upvote count: 0
has comment: http://stackoverflow.com/comment/37371848
tagged with: android
has comment: http://stackoverflow.com/comment/37371625
score: -3
has title: How to find the begin date and enddate for daylight saving timing using date in year in android
has body: How to find the begin date and end date for day light saving time using date in year in android eg If 09.03.2014 is day light saving time begin date and is day light saving time end date 02.11.2014 need to find end date.In my application am using East Time Zone GMT-5 Thanks
linked to: http://stackoverflow.com/q/24140408
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24205148
has comment: http://stackoverflow.com/comment/37371616
tagged with: java
has comment: http://stackoverflow.com/comment/37372908
downvote count: 3
has comment: http://stackoverflow.com/comment/37374679
has comment: http://stackoverflow.com/comment/37374202
possible better answer: http://stackoverflow.com/a/24205148
accepted answer: http://stackoverflow.com/a/24205090
favorite count: 0
type: Question

http://stackoverflow.com/q/24230927
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/37420742
tagged with: fonts
has title: Measure text height (with own font)
tagged with: java
has comment: http://stackoverflow.com/comment/37420707
favorite count: 0
type: Question
tagged with: measure
type: UnansweredQuestion
has body: I am programming a game for Android and need to find out the height of a text, to place the text correctly. I am drawing on a canvas in a SurfaceView like this: paint.setTypeface(tfSign); paint.setColor(Color.WHITE); paint.setTextSize(24); canvas.drawText("Level", table[1].getX(), table[1].getY()+measureTextHeight("Level " + Integer.toString(plant[currentViewPoint - 1].getLevel()), paint), paint); as you can see, I am using a method to measure the text height: public int measureTextHeight(String text, Paint paint) { Rect result = new Rect(); // Measure the text rectangle to get the height paint.getTextBounds(text, 0, text.length(), result); return result.height(); } But this method seem to return a false height. I think it's because i am using a custom font? Hope you can say me, how i can get the right Text height! Thanks :)
tagged with: android
has comment: http://stackoverflow.com/comment/37420583
upvote count: 2
tagged with: text
score: 2

http://stackoverflow.com/comment/37324436
score: 3
comment on: http://stackoverflow.com/q/24180475
type: Comment
type: QuestionComment
has text: As a best practice you should handle Checked Exceptions and your program should ideally not generate Unchecked Exceptions.

http://stackoverflow.com/comment/37348492
type: AnswerComment
comment on: http://stackoverflow.com/a/24192881
type: Comment
has text: thanks, but that works quite well, as the date is already string formatted in my observation list
score: 0

http://stackoverflow.com/comment/37400603
type: Comment
has text: If the cast is invalid, you will get an exception at runtime.
type: QuestionComment
comment on: http://stackoverflow.com/q/24220268
score: 0

http://stackoverflow.com/a/24166002
downvote count: 0
has body: Something like this maybe ? EditText e=(EditText)findViewById(R.id.escribiraqui); TextView T=(TextView)findViewById(R.id.traduccion); Button TRAD=(Button) findViewById(R.id.traducir); TRAD.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view){ String textToBeConverted = e.getText().toString(); // //HERE IS THE REST OF THE CODE THAT TRANSLATES THE textToBeConverted //TO MORSE CODE // } });
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24165361

http://stackoverflow.com/comment/37377263
score: 0
type: AnswerComment
has text: panel= new panel(this); JScrollPane scrollPane= new JScrollPane(); scrollPane.getViewport().add(panel); scrollPane.getPreferredSize().setSize(screenSize.width, screenSize.height); tabbedPane.addTab("panel", null, scrollPane, null); setLayout(groupLayout);
comment on: http://stackoverflow.com/a/24207424
type: Comment

http://stackoverflow.com/q/24118050
accepted answer: http://stackoverflow.com/a/24118190
has title: Java makefile under windows chokes on accent marks
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37218449
tagged with: makefile
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24118190
has comment: http://stackoverflow.com/comment/37207890
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 1
has body: First off, I'm sorry if this is trivial, I have no experience with make files, I only develop on Windows and I'm used to IDEs. I need to compile an external java library. It comes with a makefile. Unfortunately I'm having a lot of trouble getting it to run. I installed make and grep from the GnuWin32 toolset and added it to my path variable. When I try to run the makefile it chokes on: "javac: invalid flag: `find" Usage: javac &lt;options&gt; &lt;source files&gt; It seems like it has problems interpreting the accent mark. Is that supposed to be a quotation mark killed by text encoding? I did a quick google search but I'm not finding anything relevant. Here is the full make file I'm trying to get to run: # UNIX: #JAVAC=javac -encoding utf8 -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked -cp "../lib/asm-4.1.jar:../lib/asm-analysis-4.1.jar:../lib/asm-commons-4.1.jar:../lib/asm-tree-4.1.jar:../lib/asm-util-4.1.jar:../lib/asm-xml-4.1.jar:../lib/junit-4.0.jar" # Win32: JAVAC=javac -encoding utf8 -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked -cp "../lib/asm-4.1.jar;../lib/asm-analysis-4.1.jar;../lib/asm-commons-4.1.jar;../lib/asm-tree-4.1.jar;../lib/asm-util-4.1.jar;../lib/asm-xml-4.1.jar;../lib/junit-4.0.jar" JAVA=java SOURCES=`find . -name "*.java" | grep -v \\\#` JAR=pqlib.jar .PHONY = all default clean test benchmark jar default: all all: ${JAVAC} `find . -name "*.java" | grep -v \\\#` clean: rm -f `find . -name "*.class"` test: all ${JAVA} org.junit.runner.JUnitCore `find edu -name "*Test.java" | grep -v \\\# | sed 's/^\.\///' | sed 's/\.java//' | tr '/' '.'` benchmark: all bench/MiniBench.class ${JAVA} bench.MiniBench jar: all rm -f ${JAR} jar cf ${JAR} `find edu -name "*.class" | grep -v Test` Any help is greatly appreciated.

http://stackoverflow.com/q/24257815
has comment: http://stackoverflow.com/comment/37477928
has answer: http://stackoverflow.com/a/24258175
has comment: http://stackoverflow.com/comment/37491793
has comment: http://stackoverflow.com/comment/37472820
score: 0
has comment: http://stackoverflow.com/comment/37497455
tagged with: idref
has comment: http://stackoverflow.com/comment/37483192
has comment: http://stackoverflow.com/comment/37500389
has comment: http://stackoverflow.com/comment/37477564
tagged with: java
has comment: http://stackoverflow.com/comment/37484404
has comment: http://stackoverflow.com/comment/37480321
answer count: 1
has comment: http://stackoverflow.com/comment/37481029
tagged with: jaxb
has comment: http://stackoverflow.com/comment/37493038
tagged with: http://stackoverflow.com/tag/xml
type: Question
has title: jaxb unmarshall child @XmlIDREF
has comment: http://stackoverflow.com/comment/37479779
has body: I have class @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "customerOrder", propOrder = { "demandsUuid", "invoicesOutUuid", "paymentsUuid", "customerOrderPosition", "purchaseOrdersUuid" }) public class CustomerOrder extends LegendEntity { @XmlAttribute(name = "sourceAgentUuid") @XmlIDREF @XmlSchemaType(name = "IDREF") @XmlJavaTypeAdapter(XmlAdapterTest.class) protected Object sourceAgentUuid; .... Also Agent class for sourceAgentUuid field @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "agent", propOrder = { "attribute", "requisite", "contact", "contactPerson", "agentNewsItem", "tags" }) @XmlSeeAlso({ Company.class }) public class Agent extends LegendEntity { @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String uuid; And unmarshalling xml snipetpets <?xml version="1.0" encoding="UTF-8"?> <customerOrder deliveryPlannedMoment="2014-04-23T16:10:00+04:00" reservedSum="0.0" stateUuid="44b3fca5-a2b3-11e3-31b2-002590a28eca" targetAgentUuid="9a3c7d6b-4245-11e3-24c6-7054d21a8d1e" sourceAgentUuid="ef0b03de-c95b-11e3-9183-002590a28eca" sourceStoreUuid="b05ed064-8743-11e3-0c1a-002590a28eca" applicable="true" moment="2014-04-21T17:50:00+04:00" payerVat="true" rate="1.0" vatIncluded="true" created="2014-04-21T17:50:44.142+04:00" createdBy="it@erms" name="440" updated="2014-04-22T12:19:56.472+04:00" updatedBy="it@erms" readMode="SELF" changeMode="NONE"> 5f65cc9e-3708-11e3-bf9a-7054d21a8d1e 5f65cc9e-3708-11e3-bf9a-7054d21a8d1e ef1267b8-c95b-11e3-aeb4-002590a28eca 9a3ad96b-4245-11e3-010e-7054d21a8d1e 9a3ad96b-4245-11e3-010e-7054d21a8d1e 440 440 When I try to unmarshall JAXBElement poe = (JAXBElement)u.unmarshal( new FileInputStream( "org_order.xml" ) ); CustomerOrder co=(CustomerOrder)poe.getValue(); System.out.println(co.getSourceAgentUuid()); result null (but all other not @XmlIDREF field unmarshalled ok) How I can get ef0b03de-c95b-11e3-9183-002590a28eca result ? I had create test class for simply. Why output is null…
type: UnansweredQuestion

http://stackoverflow.com/comment/37516171
has text: What is the exact name and location of the properties file? It should be ValidationMessages.properties in the root of the classpath. src/main/resources is not a place it gets picked up from though. This is a source location, the build (whatever tool or IDE you are using) copies the file to another location. It might also help to see your code for LocaleAwareMessageInterpolator.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24266025

http://stackoverflow.com/a/34828838
has comment: http://stackoverflow.com/comment/61067065
answers question: http://stackoverflow.com/q/24135682
has body: There are a lot of misleads here. BLE is capable of sending much more than 20 bytes, and it can be done easily in android. What you need to change is the link MTU that is set to 23 by default(only 20 of them can be used to set a value). Android provides fragmentation mechanism if the given packet to send is larger than the current link MTU(this is the purpose of the offset parameter in the onCharacteristicRead(...) API). So you can make the MTU bigger, as a request from the central using: requestMtu(...) API. The latter will cause a callback call onMtuChanged at the peripheral side which will inform him of the new MTU. After this action is done, you can send bigger packets without issuing the Android fragmentation mechanism. The alternatives are to build yourself your own fragmetation mechanism and not to send packets that are bigger then the MTU. Or rely on the Android mechanism and work with it using the 'offset' parameter.
type: Answer
score: 20
upvote count: 22
has comment: http://stackoverflow.com/comment/87515612
downvote count: 2

http://stackoverflow.com/q/24266303
tagged with: spring-ldap
type: UnansweredQuestion
tagged with: apache
answer count: 1
tagged with: authentication
type: Question
has body: I have a setup with an apache HTTP server front facing tomcat server. The Apache server uses LDAP for authentication. I am using an Embedded LDAP server (Apache DS) and have configured to disable anonymous bind using service.setAllowAnonymousAccess(false); // Disable Anonymous Access service.setAccessControlEnabled(true); // Enable basic access control check (allow only System Admin to login to LDAP Server) My application uses Spring LDAP to connect and perform user operations like Adding a user. I have configured it in spring.xml as follows: &lt;bean id="ldapContextSource" class="org.springframework.ldap.core.support.LdapContextSource"&gt; &lt;property name="url" value="ldap://localhost:389" /&gt; &lt;property name="base" value="dc=test,dc=com" /&gt; &lt;property name="userDn" value="uid=admin,ou=system" /&gt; &lt;property name="password" value="secret" /&gt; &lt;/bean&gt; Apache httpd.conf is configured to use basic auth AuthLDAPBindDN "uid=admin,ou=system" AuthLDAPBindPassword "{SHA}&lt;Hash for secret&gt;" ISSUE 1 : When trying to login to ldap server using a client (say jexplorer), I am able to login using both Hashed password and using the plain text "secret". How is that possible? In this case , if someone gets to know the AuthLDAPBindDN and AuthLDAPBindPassword which is a hashed one in my case, They will be able to login using the same to the LDAP server with full access which is a security threat. Also, I want to replace the password in spring.xml with a hashed one. Since, admin can change the LDAP password, How do I ensure my application to use the updated hashed password as we are hard-coding it in spring.xml?
score: 0
tagged with: hash
has answer: http://stackoverflow.com/a/24283125
tagged with: java
has comment: http://stackoverflow.com/comment/37488954
has title: LDAP authentication on Apache against hashed password

http://stackoverflow.com/a/24210528
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24208182
score: 0
type: Answer
has body: The return value from JPA's getResultList() method is any class that implements the List interface. The consumer (you) has no need to know the concrete class name, just access the return value using the List interface.
accepted answer of: http://stackoverflow.com/q/24208182

http://stackoverflow.com/comment/37344075
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24190090
has text: thanks - that's the type of systems i had been reading about. more specifically to the java consumer/worker though, i was wondering if it was bad practice to just do while (true) when waiting for messages or if there was a better way to do that.

http://stackoverflow.com/comment/86406136
type: AnswerComment
score: 0
has text: How can "they" decide to remove access to FXRobot without providing an alternative?!?!?!? I don't understand this BLATANT disregard?
comment on: http://stackoverflow.com/a/36179066
type: Comment

http://stackoverflow.com/q/24263847
accepted answer: http://stackoverflow.com/a/24266432
has comment: http://stackoverflow.com/comment/37684926
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10248776
score: 1
has comment: http://stackoverflow.com/comment/37483952
answer count: 1
has title: Regular expression to detect time durations
downvote count: 0
has comment: http://stackoverflow.com/comment/37483831
has comment: http://stackoverflow.com/comment/37483765
upvote count: 1
has answer: http://stackoverflow.com/a/24266432
has comment: http://stackoverflow.com/comment/37484302
favorite count: 0
type: Question
tagged with: java
has body: I wrote a Regular expression for Duration Regular Expression is ([0-9]+ (?:[y|Y]ears?|[y|Y]rs?|[m|M]o?nths?|[d|D]a?ys?) ?)+ You can check this on this regex tool. Test Cases that matched This October I will complete 24 years. Right now I am 3 months short means 23 years 9 mnths 19 days. ATL is servering Research work from last 10 years 23 months 19 dys. Test cases that should be matched, but not matched I am twenty three years old. There was a disaster came exactly twenty two years twelve months thirty days back. Doubts Help me to detect English words of numerics, see 3rd and 4th case. EDITED 1 I added reFourDigits varibale to handle Twelve hundred twenty type cases. But it fails to catch that. Please help me in that. Below are all the details regarding above problem. public static final String reDigit = "(?:[O|o]ne|[t|T]wo|[t|T]hree|[f|F]our|[f|F]ive|[s|S]ix|[s|S]even|[e|E]ight|[n|N]ine)"; public static final String reTeen = "(?:[t|T]wenty|[t|T]hirty|[f|F]orty|[f|F]ifty|[s|S]ixty|[s|S]eventy|[e|E]ighty|[n|N]inety)"; public static final String re10_19 = "(?:[t|T]en|[e|E]leven|[t|T]welve|[t|T]hirteen|[f|F]ourteen|[f|F]ifteen|[s|S]ixteen|[s|S]eventeen|[e|E]ighteen|[n|N]ineteen)"; public static final String reTwoDigits = "(?:(?:" + reTeen + "[- ])?" + reDigit + "|" + re10_19 + "|" + reTeen + ")"; public static final String reThreeDigits = "(?:(?:" + reDigit + " hundred (?:and)?)?" + reTwoDigits + "|" + reDigit + " hundred)"; public static final String reFourDigits = "(?:" + reTwoDigits + " hundred (?:and)? " + reTwoDigits + ")"; public static final String reSixDigits = "(?:(?:" + reThreeDigits + " thousand (?:and )?)?" + reThreeDigits + "|" + reThreeDigits + " thousand|" + reFourDigits + ")"; public static final String reTwelveDigits = "(?:(?:" + reSixDigits + " million (?:and )?)?" + reSixDigits + "|" + reSixDigits + " million)"; Pattern is String patternString = "\\b( ?(?:[,0-9]+|"+Constants.reTwelveDigits+") ?)\\b"; When I run There are twenty hundred twenty two app…
tagged with: regex
has comment: http://stackoverflow.com/comment/37486177

http://stackoverflow.com/comment/37238250
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24132726
score: 0
has text: Acceptance mean click on right arrow in front of Answer, :) it will reward you +2 Reputation. if you accept answer. and it will helpful other as well.

http://stackoverflow.com/comment/37462147
score: 0
type: AnswerComment
type: Comment
has text: Hence, I wouldn't recommend it ;)
comment on: http://stackoverflow.com/a/24251805

http://stackoverflow.com/q/24248082
has body: I would like to add an attribute (with the @Path annotation) to an ElementList element ... but it doesnt seem to be doable? I would like this: &lt;section title="traaa"&gt; &lt;item title="a" /&gt; &lt;item title="b" /&gt; &lt;/section&gt; But can achieve only this: &lt;section&gt; &lt;item title="a" /&gt; &lt;item title="b" /&gt; &lt;/section&gt; The following code gives me an "org.simpleframework.xml.core.ElementException: Element 'section' is also a path name in class qti.QuestionList": @Attribute(name="title") @Path("assessment/section") public String title1; @ElementList(name="section") @Path("assessment") public ArrayList&lt;Question&gt; qsts;
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: simple-framework
type: UnansweredQuestion
has title: ElementList Attributes (Java Simple Framework)
upvote count: 2
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24317587
tagged with: java
answer count: 1

http://stackoverflow.com/a/24231324
has comment: http://stackoverflow.com/comment/37422235
answers question: http://stackoverflow.com/q/24231223
upvote count: 8
score: 8
has body: There are lot of libraries that does this. This is my suggestion. Here you can find the library import com.google.gson.Gson; and then do, Gson gson = new Gson(); Student student = gson.fromJson(jsonStringGoesHere, Student.class); Maven Dependency com.google.code.gson gson 2.2.4
type: Answer
downvote count: 0

http://stackoverflow.com/a/24207737
upvote count: 1
answers question: http://stackoverflow.com/q/24206480
score: 1
type: Answer
has body: The exception output exactly states the line number: Caused by: java.lang.NullPointerException at application.DBManager.connect(DBManager.java:54) Assuming the code in the question is the same as your production code, that Line 54 contains: reportStatus.setMsg("Could not reach database."); reportStatus is probably not initialized, thus causing the NullPointerException.
downvote count: 0

http://stackoverflow.com/a/24128061
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37227737
score: 2
type: Answer
has body: Instead of Text, you probably meant to use TextView. And to get its contents, use getText(), i.e. String text = (TextView)findViewById(TEXT1).getText().toString();
answers question: http://stackoverflow.com/q/24127973

http://stackoverflow.com/comment/37431614
type: Comment
comment on: http://stackoverflow.com/q/24236273
type: QuestionComment
has text: You should try before asking. It's a good habit to have, and you can usually get things figured out faster.
score: 1

http://stackoverflow.com/a/24263062
score: 13
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42486749
has body: Put it in "double quotes" instead of 'single quotes'. Double quotes are for string literals, single quotes are for single character constants.
accepted answer of: http://stackoverflow.com/q/24263049
type: Answer
answers question: http://stackoverflow.com/q/24263049
upvote count: 13

http://stackoverflow.com/a/24149373
score: 3
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37270582
has comment: http://stackoverflow.com/comment/37270664
has body: You need to understand how a HashMap works. When you put a key in a HashMap, containing N buckets, the hashCode of the key is used to find the appropriate bucket. Then each key contained in the bucket is compared, using equals(), with the added key, to know if the key is already in the map. Similarly, when getting the value for a key, the hashCode() is first used to find the appropriate bucket, then each key in this bucket is compared with equals() to the key passed to get(). You're doing two things which you should never do when using HashMaps: Modifying the key after it has been stored in the map. This modifies its hashCode, and causes thekey to not be searched for in the appropriate bucket. A bit as if you put all red coins in a red drawer, and then repainted one of the keys to blue. Obviously, if you then search for the blue coins, you'll search them in the blue drawer, and not in the red drawer where it has been stored, since it was red initially. Implementing hashCode() using an algorithm that makes many keys have the same value. It's the case for "clover" and "arthur", which have the same length, and thus the same hashCode() given your implementation. "magnolia", on the other hand, doesn't have the same hashCode(). Given the above, you should be able to understand why your code works the way it does. Just draw what happens on paper for each operation, and you'll understand.
type: Answer
answers question: http://stackoverflow.com/q/24149035

http://stackoverflow.com/q/24211571
tagged with: android
downvote count: 0
has comment: http://stackoverflow.com/comment/37385401
tagged with: sorting
answer count: 0
score: 1
tagged with: java
has title: Parse LocalDataStore sorting doesn't work
upvote count: 1
has body: When i am enabling the data store my query result is not sorted. The same query if i fetch from network i am able to get sorted order. I am using parse for Android SDK version Parse 1.5.1. My code : ParseQuery&lt;ParseObject&gt; locBasedQuery = ParseQuery .getQuery(Constants.CLASS_MESSAGEOVERVIEW); locBasedQuery.fromLocalDatastore(); locBasedQuery.whereWithinKilometers(Constants.MESSAGEOVERVIEW_LOCATION, new ParseGeoPoint(latitude, longitude), radius); if (sortingType == Constants.HOME_TAB_NEW) { locBasedQuery.orderByDescending(Constants.COLUMN_UPDATED_TIME); } else { locBasedQuery.orderByDescending(Constants.MESSAGEOVERVIEW_NOOFCOMMENTS); } locBasedQuery.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(List&lt;ParseObject&gt; objects, ParseException e) { if (e == null) { } } );
favorite count: 0
type: Question
tagged with: parse-platform
type: UnansweredQuestion

http://stackoverflow.com/comment/37452837
type: AnswerComment
comment on: http://stackoverflow.com/a/24231454
has text: As I understand, your interface is not void. What do you mean exactly by "my interface is supposed to be void"? Could you please copy the exact error you are getting?
score: 0
type: Comment

http://stackoverflow.com/comment/37335546
comment on: http://stackoverflow.com/q/24186458
has text: Take a look at the folder where your `.class` files end up -- you'll see something like `<class_name>$1.class`, `<class_name>$2.class`, etc. for each anonymous type that was compiled. You can try decompiling them to be sure.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/24226443
has comment: http://stackoverflow.com/comment/37412557
has comment: http://stackoverflow.com/comment/37412660
accepted answer of: http://stackoverflow.com/q/24226408
has body: Your problem is in the line: box.addItem(list.toArray()); The addItem() method for a JComboBox requires an Object as a parameter. Typically, a String object is used as the parameter. Instead, what you are doing is trying to add the actual list reference to the combo box when you really meant to add every item in the list. Instead, you should add the individual items in the list as follows: for(Stuff stuff : list) { box.addItem(stuff.getName()); } EDIT: Reading your original worded problem again, I think your second code snippet regarding the GUI should not be using another ArrayList of Stuff if you actually intended to use the ArrayList in one instance of a Stuff object. Therefore, you should first change: private ArrayList&lt;Stuff&gt; list = new ArrayList&lt;&gt;(); to private Stuff = new Stuff(); and change the for loop to iterate through stuff.getList() instead of list. To clarify, the for loop might look like: for(String detail : stuff.getList()) { box.addItem(detail); // add each extracted detail from the text file that was stored in the list of the stuff object }
has comment: http://stackoverflow.com/comment/37412506
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/37412683
has comment: http://stackoverflow.com/comment/37412470
answers question: http://stackoverflow.com/q/24226408
has comment: http://stackoverflow.com/comment/37412507
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37415005
type: QuestionComment
has text: And what's the problem? What output does your code generate so far?
score: 1
comment on: http://stackoverflow.com/q/24227899
type: Comment

http://stackoverflow.com/q/24240896
has comment: http://stackoverflow.com/comment/91733445
type: Question
upvote count: 12
tagged with: timezone
has body: this is my date " 15-05-2014 00:00:00 " how to convert IST to UTC i.e( to 14-05-2014 18:30:00) based on from timezone to UTC timezone. my code is DateFormat formatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("IST")); //here set timezone System.out.println(formatter.format(date)); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); //static UTC timezone System.out.println(formatter.format(date)); String str = formatter.format(date); Date date1 = formatter.parse(str); System.out.println(date1.toString()); if user enter same date from any zone then will get UTC time(ex: from Australia then 15-05-2014 00:00:00 to 14-05-2014 16:00:00) please any suggestions.
linked to: http://stackoverflow.com/q/12919067
possible better answer: http://stackoverflow.com/a/48740124
answer count: 2
tagged with: simpledateformat
linked to: http://stackoverflow.com/q/38922754
tagged with: date
has answer: http://stackoverflow.com/a/48740124
has comment: http://stackoverflow.com/comment/37441109
accepted answer: http://stackoverflow.com/a/24262202
has title: convert date and time in any timezone to UTC zone
has answer: http://stackoverflow.com/a/24262202
score: 12
type: AnsweredQuestion
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37440052
has comment: http://stackoverflow.com/comment/37487394
favorite count: 0

http://stackoverflow.com/comment/37480214
has text: I read the same in docs and in my code @CachePut stores entity into cache before method execution. I tried on property which is not null when @CachePut method is called and it stores OK, but if I use null property `id` as `key` of `CachePut` then exception is thrown.
comment on: http://stackoverflow.com/a/24252160
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37447556
comment on: http://stackoverflow.com/q/24242509
type: QuestionComment
has text: I can set color filter, but unfortunately only for foreground image (in src) and I have to chage it in background :( any suggestion?
score: 0
type: Comment

http://stackoverflow.com/comment/37216319
type: Comment
score: 0
type: AnswerComment
has text: post method is in the controller already. I still get either a blank page or 404.
comment on: http://stackoverflow.com/a/24122134

http://stackoverflow.com/q/24170972
score: 7
has title: Pageable and @Param in a spring data JpaRepository method issue
has comment: http://stackoverflow.com/comment/37334341
accepted answer: http://stackoverflow.com/a/24186707
answer count: 1
tagged with: jpa
downvote count: 0
tagged with: spring-data
upvote count: 7
has body: I have a following repository: public interface MilestoneRepository extends JpaRepository<Milestone,Date> { @Query("select m from Milestone m where m.date <= :date order by m.date desc") Page<Milestone> findLeftClosest(@Param("date") Date date, Pageable pageable); } Defined like above works ok, but if I switch the arguments order: public interface MilestoneRepository extends JpaRepository<Milestone,Date> { @Query("select m from Milestone m where m.date <= :date order by m.date desc") Page<Milestone> findLeftClosest(Pageable pageable, @Param("date") Date date); } I get a following exception on context initialization (posting the most interesting bottom cause): Caused by: java.lang.IllegalArgumentException: Either use @Param on all parameters except Pageable and Sort typed once, or none at all! at org.springframework.util.Assert.isTrue(Assert.java:65) at org.springframework.data.repository.query.Parameters.assertEitherAllParamAnnotatedOrNone(Parameters.java:265) at org.springframework.data.repository.query.Parameters.<init>(Parameters.java:85) at org.springframework.data.jpa.repository.query.JpaParameters.<init>(JpaParameters.java:43) at org.springframework.data.jpa.repository.query.JpaQueryMethod.createParameters(JpaQueryMethod.java:284) at org.springframework.data.jpa.repository.query.JpaQueryMethod.createParameters(JpaQueryMethod.java:51) at org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:70) at org.springframework.data.jpa.repository.query.JpaQueryMethod.<init>(JpaQueryMethod.java:79) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:69) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:304) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:161) at org.springframework.data.repositor…
favorite count: 0
type: Question
type: AnsweredQuestion
tagged with: spring-data-jpa
tagged with: java
has answer: http://stackoverflow.com/a/24186707

http://stackoverflow.com/comment/37429993
type: Comment
score: 0
has text: Essentially, this is what the `TableColumnModel` is doing, except, instead of returning `null` when it can't find a column, it throws an exception. You should avoid using exceptions as logic controllers as there might be multiple reasons why the exception is thrown
type: QuestionComment
comment on: http://stackoverflow.com/q/24235557

http://stackoverflow.com/comment/37482453
type: AnswerComment
comment on: http://stackoverflow.com/a/24259159
type: Comment
has text: @user3364049, If thats the case have you tried removing `p.waitFor();`. This will actually put that thread to wait until the process is over. Try out that way and see whether it works. I just noticed this now.
score: 0

http://stackoverflow.com/comment/37481830
comment on: http://stackoverflow.com/a/24262804
has text: Ahh I never thought of it like that, that makes a lot more sense now!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37355129
type: Comment
has text: Oh, well, it is "*always* null [right after the loop, baring no break]" - anyway, I was merely trying to reinforce the statement that this is a limitation with the *particular* static analysis used, which is indeed primitive in javac.
type: AnswerComment
comment on: http://stackoverflow.com/a/24196178
score: 1

http://stackoverflow.com/comment/37489480
comment on: http://stackoverflow.com/a/24266111
type: Comment
has text: is it the first query ? i mean when u run the app is this one is the first place where db is used? or you able to run any query before the place where crash is coming ?
type: AnswerComment
score: 0

http://stackoverflow.com/q/24207236
has comment: http://stackoverflow.com/comment/37375941
type: Question
has comment: http://stackoverflow.com/comment/37375778
answer count: 3
has answer: http://stackoverflow.com/a/24207310
has comment: http://stackoverflow.com/comment/37375846
score: 7
has answer: http://stackoverflow.com/a/24210033
tagged with: java
linked to: http://stackoverflow.com/q/4761681
has title: What is the purpose of using a local variable to hold a global one?
tagged with: global-variables
has answer: http://stackoverflow.com/a/24207771
possible better answer: http://stackoverflow.com/a/24207771
has comment: http://stackoverflow.com/comment/37376154
type: AnsweredQuestion
has body: I had a look at the source code of the String.hashcode() method. This was the implementation in 6-b14, which has been changed already. public int hashCode() { int h = hash; if (h == 0) { int off = offset; char val[] = value; int len = count; for (int i = 0; i &lt; len; i++) { h = 31*h + val[off++]; } hash = h; } return h; } My question is about this line: int len = count; Where count is a global variable representing the amount of characters of the String. Why is a local variable len used here for the loop condition and not the global variable itself? Because there is no manipulating of the variable, only reading. Is it just good practice to use a local variable if a global field is used for reading from or writing to it? If the answer is yes why for reading too?
accepted answer: http://stackoverflow.com/a/24210033
downvote count: 0
tagged with: local-variables
tagged with: string
upvote count: 7
has comment: http://stackoverflow.com/comment/37375871
favorite count: 0

http://stackoverflow.com/comment/37272608
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24152154
has text: This worked for me. The only change would be to replace `activity` with `getActivity()`. Thanks!

http://stackoverflow.com/comment/37398209
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24218948
has text: Wow, thank you, that was really clear, i think i do get it now.
type: Comment

http://stackoverflow.com/comment/37357513
score: 0
has text: I saved it as csv and uploaded it. Sorry for the dumb question
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24192481

http://stackoverflow.com/q/24195929
has comment: http://stackoverflow.com/comment/37354507
accepted answer: http://stackoverflow.com/a/74516382
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37354524
has comment: http://stackoverflow.com/comment/37354372
has comment: http://stackoverflow.com/comment/43877995
has answer: http://stackoverflow.com/a/74516382
answer count: 3
has answer: http://stackoverflow.com/a/24196185
has comment: http://stackoverflow.com/comment/43786028
tagged with: user-interface
upvote count: 1
has comment: http://stackoverflow.com/comment/37354538
tagged with: swing
has comment: http://stackoverflow.com/comment/37354522
has title: Swing GUI Inconsistently freezing
has comment: http://stackoverflow.com/comment/37354475
downvote count: 1
favorite count: 0
type: Question
has body: EDIT: I posted this question over 8 years ago when I was a new programmer. The question itself is not well formed and despite my best efforts, I don't think there is much to salvage from the question itself; however, I do think that there are several answers provided that shine a light on a few important topics. I thought I would attempt to address the wound to my reputation this question has proven itself to be by compiling and expounding upon some of those topics here. A Friend and I have been trying to write a simple server/client chat application in Java. When we were just using the command line (e.g. java.util.Scanner) everything was fine. It wasn't until we tried building a GUI that we ran into trouble. Sometimes it would work, sometimes it would freeze and sometimes nothing would happen. We are somewhat certain that the problem is in the ask() method public String ask(String string) { println(string); hasInput = false; while(true) { //System.out.println("working"); if(hasInput) { println("done"); return processLastInput();//removes the carot ">" from the input and returns it } } } but if you uncomment the println statement it inconsistently works ...here is the rest of the code for you to see import java.awt.Color; import java.awt.Font; import java.awt.Toolkit; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.KeyStroke; public class ConsoleGUI { private JFrame FRAME; private JPanel PANEL; private JTextArea CMD_TEXT; private JTextArea CMD_HISTORY; private JScrollPane CMD_HISTORY_SCROLLER; private String LAST_INPUT = ""; private boolean hasInput = false; private final int screenX = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(); private final int screenY = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight(); public ConsoleGUI(String terminalHeader) { FR…
possible better answer: http://stackoverflow.com/a/24196185
tagged with: java
has answer: http://stackoverflow.com/a/24195975
has comment: http://stackoverflow.com/comment/37354513

http://stackoverflow.com/q/24200095
has comment: http://stackoverflow.com/comment/37362714
has comment: http://stackoverflow.com/comment/37362680
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37364678
upvote count: 1
tagged with: spring
has title: Spring-ws multiple request in one request
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24200453
tagged with: spring-ws
tagged with: java
has answer: http://stackoverflow.com/a/24200453
score: 1
linked to: http://stackoverflow.com/q/5253400
favorite count: 0
type: Question
has body: I have a problem. I want to create multiple request in one request. &lt;xsd:element name="SendMemberStatusRequest"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="MemberStatusRequest" type="member:MemberStatusRequest"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="SendMemberStatusResponse"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="MemberStatusResponse" type="member:MemberStatusResponse"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; This is my xsd code. For one "MemberStatusRequest" but i want to use, who want to send request may be send 1 request may be send 10 request. Anybody can help me ? &lt;xsd:element name="SendMemberStatusRequest"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="MemberStatusRequest" type="member:MemberStatusRequest"/&gt; &lt;xsd:element name="MemberStatusRequest" type="member:MemberStatusRequest"/&gt; ......... &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt;

http://stackoverflow.com/comment/37407448
comment on: http://stackoverflow.com/a/24223645
type: Comment
type: AnswerComment
has text: @gyurix Please fix the off by one error in your code in the for-loop-header
score: 0

http://stackoverflow.com/comment/37439774
score: 0
has text: Check supported media formats for Android [here](http://developer.android.com/guide/appendix/media-formats.html)
comment on: http://stackoverflow.com/q/24240845
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24184219
upvote count: 2
answers question: http://stackoverflow.com/q/24184059
has body: This might be a very bad assumption, depending on your database vendor. Connections are scarce resources, with both client and database server components. The garbage collector on the client can certainly clean up the Connection object, but that doesn't inform the server that the connection is closed. You'll soon run out of connections on the server side, because they're a finite resource. Same for Statement and ResultSet (cursor on the server side). A better solution is to use a JDBC connection pool to amortize the cost of creating connections and manage closing them when done. You should also close your SQL resources in a finally block, wrapped in individual try/catch blocks: public class DatabaseUtils { private DatabaseUtils() {} // Similar for Statement and ResultSet public static void close(Connection c) { try { if (c != null) { c.close(); } } catch { Exception e) { log.error(e); } } } And in your code: Connection c = null; try { c = ds.getConnection(); // Do something with the connection } finally { DatabaseUtils.close(c); // same for Statement and ResultSet }
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/24265689
linked to: http://stackoverflow.com/q/24253556
type: Question
duplicate of: http://stackoverflow.com/q/1116019
type: UnansweredQuestion
has body: If I have a Spring form as follows: &lt;c:url value="/user/profile?id=${user.id}" var="profileURL" /&gt; &lt;form:form action="${profileURL}" method = "get"&gt; &lt;input type="submit" value="My profile"&gt; &lt;/form:form&gt; Spring complains that: Your page request has caused a MissingServletRequestParameterException: Required String parameter 'id' is not present error: However, in the controller method, the parameter is present: @RequestMapping(value = "/profile", method = RequestMethod.GET) public String getProfile(@RequestParam("id") String id, Model model) { User user = userService.get(Integer.parseInt(id)); model.addAttribute("user", user); return "profile"; } Can anyone advise why this is? If I use a simple form field like: &lt;input name="id" type="hidden" value="=${user.id}"&gt; Everything is good. But I prefer to use a Spring field, hidden of necessary. At run-time the form looks like this: &lt;form id="command" action="/nameOfapplication/user/profile?id=3" method="get"&gt; &lt;input type="submit" value="My profile"&gt; &lt;/form&gt; This causes the following messages in the stacktrace: Your page request has caused a MissingServletRequestParameterException: Required String parameter 'id' is not present error: org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:255)
tagged with: http-request-parameters
has comment: http://stackoverflow.com/comment/37488617
linked to: http://stackoverflow.com/q/1116019
tagged with: spring
has comment: http://stackoverflow.com/comment/37488816
has comment: http://stackoverflow.com/comment/37488137
tagged with: spring-mvc
score: 0
has comment: http://stackoverflow.com/comment/37488684
answer count: 0
has comment: http://stackoverflow.com/comment/37489012
tagged with: java
has comment: http://stackoverflow.com/comment/37489383
has comment: http://stackoverflow.com/comment/37489348
has title: Trying to use a @RequestParam field in Spring form
has comment: http://stackoverflow.com/comment/37487783
has comment: http://stackoverflow.com/comment/37489100
has comment: http://stackoverflow.com/comment/37488313

http://stackoverflow.com/q/24235296
score: 29
tagged with: logback
favorite count: 0
possible better answer: http://stackoverflow.com/a/24235375
has answer: http://stackoverflow.com/a/59195300
linked to: http://stackoverflow.com/q/1975939
has comment: http://stackoverflow.com/comment/37429531
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39072009
tagged with: java
has title: how to define logback variables/properties before logback auto-load logback.xml?
upvote count: 29
accepted answer: http://stackoverflow.com/a/24272855
answer count: 4
type: Question
has answer: http://stackoverflow.com/a/24272855
has answer: http://stackoverflow.com/a/24235375
downvote count: 0
has body: My company has an environment management tool that enables you to look up properties from the environment programmatically in Java. I want to leverage this tool to configure logback. For example, suppose I have a logback.xml as follows (the file appender section in particular): <?xml version="1.0" encoding="UTF-8"?> %d{yyyy-MM-dd/HH:mm:ss.SSS} [%thread] %-5level %logger{20}: %msg%n ${LOG_FILE:-/default/log/file/path %d{yyyy-MM-dd/HH:mm:ss.SSS} [%thread] %-5level %logger{20}: %msg%n <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> So, in this case, I want to look up the LOG_FILE property from the environment (or OS, if you will), and pass it to logback before logback loads the logback.xml so that it will know the value of LOG_FILE. So, how can I achieve that? BTW, I know how to define a file appender programmatically, but that's not what I want here. Thank you very much.

http://stackoverflow.com/q/24161127
tagged with: collections
has body: My map is declared as private Map accountByReport; I am using the below loop to check if the reportID is in the map or not before adding the corresponding Department Account to the key. Is my loop correct and what should the type declaration be in this instance and how can I catch exceptions? for(Entity entity : entities) { if(accountsByReport.containsKey(entity.getReportID())) { ((List&lt;String&gt;)accountsByReport.get(entity.getReportID())).add(entity.getDepAccount()); } else { accountsByReport.put(entity.getReportID(), new ArrayList&lt;String&gt;().add(entity.getDepAccount())); } }
type: Question
has answer: http://stackoverflow.com/a/24161624
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/24161338
tagged with: java
has answer: http://stackoverflow.com/a/24161338
tagged with: dictionary
has title: Single Key Multiple Accounts to Map
accepted answer: http://stackoverflow.com/a/24161335
type: AnsweredQuestion
score: 0
tagged with: list
has comment: http://stackoverflow.com/comment/37288176
has answer: http://stackoverflow.com/a/24161335
answer count: 3

http://stackoverflow.com/q/24225275
tagged with: inner-join
type: AnsweredQuestion
score: 0
tagged with: foreign-keys
has answer: http://stackoverflow.com/a/24225303
accepted answer: http://stackoverflow.com/a/24225303
tagged with: primary-key
tagged with: java
tagged with: mysql
type: Question
has title: How to use inner join to get 'next column' value?
answer count: 1
has body: I've been researching for quite some time and it seems I may be misunderstanding how inner-joins work in MySQL. I have 3 tables: UserTable: UserID UserName Hash UserUni UserHousing 1 John @123eq.. FK FK 2 Bob !S91ka.. FK FK ... The foreign keys relate to the following two tables' PKs (UniID and HousingID, respectively): UniversitiesList: UniID UniName 1 Yale 2 Penn ... HousingList: HousingID HousingName UniID 1 Dorm_1 FK 2 Dorm_2 FK ... Where, of course, these FKs are PKs (UniID) in Universities list What I'm trying to do is query the id, hash, UserUni, and UserHousing values, i.e not the keys. This is what I'm playing around with now: "SELECT UserTable.Hash, UserTable.UserID, UserTable.UserUni, UserTable.UserHousing " + "FROM UserTable " + "INNER JOIN UniversitiesList " + "ON UserTable.UserUni = UniversitiesList.UniID " + "INNER JOIN HousingList " + "ON UserTable.UserHousing = HousingList.HousingID " + "WHERE UserTable.UserName = John" What I would like to retrieve is something like 1, @123eq, Yale, Dorm_1, but instead I keep getting 1, @123eq, 1, 1. I'm working with Java so this is how I'm getting the results: if (result.next()) { hash = result.getString(1); id = result.getInt(2); uni = result.getString(3); housing = result.getString(4); } Any idea one what I'm doing wrong?

http://stackoverflow.com/a/24106241
type: Answer
has body: The stacktrace has the answer to the (implied) question. This statement should be removed as it is attempting to add the frame to itself add(frame);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24106222
score: 0
answers question: http://stackoverflow.com/q/24106222

http://stackoverflow.com/comment/37263486
has text: @T.C. Correct; corrected
score: 0
comment on: http://stackoverflow.com/q/24147372
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37436445
type: AnswerComment
type: Comment
has text: Thanks for your response azarai. U have mentioned in your post that the security will provide to rest api using oauth or oauth2 . But i have read that oauth suits when the third party server comes into picture correct me if am wrong ? Here am not using any third party api like facebook,twiter etc..then how oauth suits for my requirement ?
comment on: http://stackoverflow.com/a/24205513
score: 0

http://stackoverflow.com/q/24195337
tagged with: android-support-library
type: Question
has title: Android: Swipe Views without additional support library
downvote count: 0
answer count: 1
has body: I have no interest in backward support for &lt; 4.0 devices. And also, I would like to get rid of support libraries to make package as small as possible. Is it possible to create similar effect only using 4.0+ native fragments?
upvote count: 1
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24196004
tagged with: android-fragments
has answer: http://stackoverflow.com/a/24196004
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/comment/37566573
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24296270
has text: Thanks for the reply, but in my scenario, I can't depend on browser session or cookies, because, request may come from some other clients also, like some http client is making request, then that time, these session and cookies, will not be available.

jscrollpane
tags question: http://stackoverflow.com/q/24154923
tag name: jscrollpane
tags question: http://stackoverflow.com/q/24233722
tags question: http://stackoverflow.com/q/24207183
tags question: http://stackoverflow.com/q/24144722
tags question: http://stackoverflow.com/q/24246494
tags question: http://stackoverflow.com/q/24188490
type: Tag
tags question: http://stackoverflow.com/q/24151663
tags question: http://stackoverflow.com/q/24129531
tags question: http://stackoverflow.com/q/24205385
tags question: http://stackoverflow.com/q/24177138
tags question: http://stackoverflow.com/q/24203426

http://stackoverflow.com/q/24193404
accepted answer: http://stackoverflow.com/a/24193571
tagged with: swing
has answer: http://stackoverflow.com/a/24193571
favorite count: 0
type: AnsweredQuestion
tagged with: resultset
tagged with: java
tagged with: ms-access-2007
score: 4
type: Question
upvote count: 4
tagged with: compiler-errors
answer count: 1
has body: I am working on a project "Hospital Management System" in Java Swing. Now on the records page I want to show all stored records of patients in a table format. But I have never worked with JTable in swing. Now when I tried to fetch records in a simple program, it is printing all records on console in for loop but when I go for JFrame and tried to fetch records on JTable, instead of making a table, it's showing a error message like: Ex_test.java:51: cannot find symbol, symbol : constructor JTable(java.lang.String[],java.lang.String[][]) location: class javax.swing.JTable, JTable table=new JTable(column,data); Can anyone tell me what is the problem in my code? Database is MS-Access 2007. import javax.swing.*; import javax.swing.JTable; import java.awt.event.*; import java.awt.*; import java.sql.*; public class Ex_test extends JFrame { public static void main(String[] args) { Ex_test ob=new Ex_test(); } int i=0; String column[]; String data[][]; //JTable table; public Ex_test() { super("Array"); String[] id=new String[15]; String[] name=new String[15]; String[] contact=new String[15]; try { Connection con; Statement st; ResultSet rs; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:test"); st=con.createStatement(); rs=st.executeQuery("select * from test"); String column[]={"ID","NAME","CONTACT"}; while (rs.next()) { id[i]=rs.getString("id"); name[i]=rs.getString("sname"); contact[i]=rs.getString("contact"); i++; } for (i=0;i&lt;4 ;i++ ) { System.out.println(""+id[i]+name[i]+contact[i]); String data[][]={{id[i],name[i],contact[i] }}; } } catch (Exception e) { } JTable table=new JTable(column,data); setSize(1000,1000); setVisible(true); } }
has title: How to create simple table in Java Swing?
downvote count: 0

http://stackoverflow.com/a/24245047
accepted answer of: http://stackoverflow.com/q/24244939
has comment: http://stackoverflow.com/comment/37455126
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24244939
has body: If the 3rd party supports WEBDAV you should be able to use PROFIND to get the directory contents. Sardine is a java implementation and the very first example on the readme is what you are looking for.
type: Answer

myfaces
type: Tag
tag name: myfaces
tags question: http://stackoverflow.com/q/24224903

http://stackoverflow.com/comment/37500137
has text: Code posted. So, I haven't printed out the ints (battling another problem and trying to work through this as a thought exercise ATM). So, if I have an address (say, 1.2.3.4), it will be larger than the negative number posed by firstClassE and larger than broadcast ... but in real life, it may be smaller than both, or at the very least (worst case, for me), it will always at least be smaller than broadcast. I was expecting, when I wrote the code, that the largest int I'd see would be broadcast and the range I'd be checking would be between firstClassE and broadcast.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24265377
type: AnswerComment

http://stackoverflow.com/comment/37295184
score: 0
type: AnswerComment
has text: @user3711467 add another regex just for checking. if line match that regex, you should keep.
comment on: http://stackoverflow.com/a/24164417
type: Comment

http://stackoverflow.com/a/24233396
has comment: http://stackoverflow.com/comment/37425819
score: 0
has comment: http://stackoverflow.com/comment/37427033
type: Answer
has comment: http://stackoverflow.com/comment/37427377
answers question: http://stackoverflow.com/q/24233115
has comment: http://stackoverflow.com/comment/37425626
has body: The setY and other similar methods expect values in pixels. Now, this is exactly where the problem lies. Different phones have screens of different resolutions and so the 750th pixel will be located at different positions on different phones unless two displays are identical. The solution is simple. Use values in DP: mInspireMeImg.setY(dpToPx(750)); and keep this method stored somewhere: public static int dpToPx(float dpValue, Context context){ return (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue, context.getResources().getDisplayMetrics()); } More about DP unit: http://developer.android.com/training/multiscreen/screendensities.html What is the difference between "px", "dp", "dip" and "sp" on Android?

http://stackoverflow.com/comment/37259132
score: 0
type: Comment
type: QuestionComment
has text: Set it as the path to the image.. You know the name of the image and where it is in the project. It should be trivial.
comment on: http://stackoverflow.com/q/24145189

cdi
type: Tag
tags question: http://stackoverflow.com/q/24249470
tags question: http://stackoverflow.com/q/24207684
tag name: cdi
tags question: http://stackoverflow.com/q/24214617
tags question: http://stackoverflow.com/q/24151016
tags question: http://stackoverflow.com/q/24248449
tags question: http://stackoverflow.com/q/24156069

http://stackoverflow.com/comment/37185740
type: AnswerComment
comment on: http://stackoverflow.com/a/24106055
type: Comment
has text: If a class doesn't implement the Cloneable interface, overrides the clone method, and an object of it calls clone. In that case the call goes to native clone(), and most probably there is the check for 'obj instanceof Clonebale', which throws the CloneNotSupportedException.
score: 0

http://stackoverflow.com/q/24238329
tagged with: processing
has answer: http://stackoverflow.com/a/24238493
tagged with: arrays
score: -1
linked to: http://stackoverflow.com/q/8892027
possible better answer: http://stackoverflow.com/a/24238503
has answer: http://stackoverflow.com/a/24238739
has body: So I've been working on a small tanks program, but whenever I try to run it I get an ArrayIndexOutOf BoundsException on line 477 (http://pastebin.com/k4WNXE6Q). void placeStations(int Number) { for (int i = 0; i&lt;Number; i++) { stations.add(new RefillStation(int(random(0, width)), int(random(0, height)))); // This line of code refuses to work. I get an 'ArrayIndexOutOfBoundsException: -3' RefillStation station = stations.get(i); for (Tank tank : tanks) { if (station.getRectangle().intersects(tank.getRectangle())) { station.kill(); i=i-1; } } for (Obstacle obstacle : obstacles) { if (station.getRectangle().intersects(obstacle.getRectangle())) { station.kill(); i=i-1; } } } } I have tried for hours to find an error, but I can see nothing different from the method above, which seems to work fine. I am using the 'i' type for loops in some places because whenever I try to remove something from an index in a modern for loop, it gives me a size change exception. Any Ideas on what I could do to remedy this?
type: AnsweredQuestion
answer count: 3
has title: ArrayIndexOutOfBoundsException in processing
upvote count: 0
tagged with: java
tagged with: indexoutofboundsexception
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24238503
type: Question
accepted answer: http://stackoverflow.com/a/24238493

http://stackoverflow.com/q/24261210
has answer: http://stackoverflow.com/a/24267022
tagged with: jdbc
has title: Is String.split() function safe?
has body: One day I was talking with a friend about one of his server applications for a little flash game. The server communicates with a mysql database. And I found this request: "UPDATE phpbb_users SET patojdur = '" + this.score + "' WHERE user_id = '" + this.user_id + "'" As this.score is data entered by the user, I asked him if it wasn't unsafe to put that directly in the SQL request, and take the risk of an SQL injection. But he answered me: "No, because this.score is an user_request.split("'")[1], the split is protecting me and you can't put a ' to inject." My question isn't if he made the right choice by doing that, because I know he won't change his mind, but What he said made me curious about a thing: is split really safe? Does it really prevent the splitted character to pass whatever you do? Or even if it's risky, put a var.split("'") finally prevent you from ' injection? Edit: I've read the following question but mine is specific to the Split method, and doesn't apply only on SQL database, in other word my question is: Does var.split('c') really prevent c to be in the final string?
has answer: http://stackoverflow.com/a/24267499
accepted answer: http://stackoverflow.com/a/24267499
score: 2
tagged with: security
type: AnsweredQuestion
answer count: 2
linked to: http://stackoverflow.com/q/15537368
tagged with: sql
tagged with: java
downvote count: 0
possible better answer: http://stackoverflow.com/a/24267022
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/a/24263951
has comment: http://stackoverflow.com/comment/37528426
accepted answer of: http://stackoverflow.com/q/24158105
type: Answer
answers question: http://stackoverflow.com/q/24158105
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/37840953
has comment: http://stackoverflow.com/comment/37487096
has comment: http://stackoverflow.com/comment/37487079
has body: It looks like one of 3 reasons: Permissions on the folder you're writing to. Spaces on the file path (or name). Wrong slash in the file path. EDIT based on comment. You can try configuring maxThreadsActive to limit the no of threads active at a time. &lt;dispatcher-threading-profile maxThreadsActive="5" maxThreadsIdle="5"/&gt;
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37483817
downvote count: 0

http://stackoverflow.com/a/24229857
type: Answer
has comment: http://stackoverflow.com/comment/37422163
has comment: http://stackoverflow.com/comment/37420069
downvote count: 0
upvote count: 1
has body: Include directive insert the code into main.jsp before the container make the "translation". Generated servlet cotains the code of both files main.jsp and includeDirective.jsp. When you use include action, the response of includeAction.jsp is insert into main.jsp but not include in the translation. The code of includeDirective.jsp isn't into generated servlet. 1) The JSP translate to Sevlet in the first request. 2) Include action make a new translation in each request. 3) The request object it's the same for main.jsp and includeAction.jsp. If you set an attribute in includeAction runtime, you can see when the includeAction "response" to main.jsp. Try print attribute before &lt;jsp:include page="includeaction.jsp" /&gt;
has comment: http://stackoverflow.com/comment/37422811
answers question: http://stackoverflow.com/q/24229308
has comment: http://stackoverflow.com/comment/37422315
score: 1

http://stackoverflow.com/q/24149187
score: 0
has comment: http://stackoverflow.com/comment/37266562
tagged with: java
has answer: http://stackoverflow.com/a/24149244
has comment: http://stackoverflow.com/comment/37267094
has title: Collections Shuffle Method has Null Objects
favorite count: 0
accepted answer: http://stackoverflow.com/a/24149229
type: Question
has comment: http://stackoverflow.com/comment/37266714
answer count: 2
tagged with: shuffle
has answer: http://stackoverflow.com/a/24149229
possible better answer: http://stackoverflow.com/a/24149244
upvote count: 2
has body: I am working on a Java project that involves Card objects and a Deck object. When I made my Deck, I have an ArrayList that has all 52 Cards in it. However, when I use the shuffle method in Collections, four Card objects are turning to null. The Card class works fine, and when I print out the Deck before the shuffle method, all 52 Cards are there. Once I shuffle the Cards in the Deck, that's when I get the four null methods. import java.util.ArrayList; import java.util.Collections; public class Deck { public ArrayList&lt;Card&gt; pack = new ArrayList&lt;Card&gt;(); public int spades = 1; public int hearts = 1; public int diamonds = 1; public int clubs = 1; public String s = "spades"; public String h = "hearts"; public String cl = "clubs"; public String d = "diamonds"; public Deck(){ } public void makeDeck() { for (int i = 0; i &lt; 14; i++) { Card c = null; if (clubs &lt; 14) c = new Card ("Clubs", clubs); clubs++; pack.add(c); if (spades &lt; 14) c = new Card ("Spades", spades); spades++; pack.add(c); if (hearts &lt; 14) c = new Card ("Hearts", hearts); hearts++; pack.add(c); if (diamonds &lt; 14) c = new Card ("Diamonds", diamonds); diamonds++; pack.add(c); } } public void showDeck() { for (int i = 0; i &lt; 52; i++) { System.out.println(pack.get(i)); } } public String CardNumber (int index) { return (pack.get(index).toString()); } public int Number (int index) { return pack.get(index).CNum(); } public void Shuffle() { Collections.shuffle(pack); } }
downvote count: 2
tagged with: collections
type: AnsweredQuestion

http://stackoverflow.com/comment/37220579
has text: I had only been doing that, manual add/remove. I didnt even know there was another way. I dont even know what the redeploy feature is. (I am a relatively new dev)
type: Comment
comment on: http://stackoverflow.com/a/24124787
type: AnswerComment
score: 0

http://stackoverflow.com/q/24232298
tagged with: java
answer count: 1
tagged with: spring-security
type: Question
tagged with: web.xml
has body: I come across this code in my web.xml but I don't understand how to add securityConfig.xml to the classpath along with dispatcherContext.xml contextConfigLocation classpath:dispatcherContext.xml can anyone please give me some suggestion UPDATE when i include <import resource="classpath:securityConfig.xml" /> in dispatcherContext.xml like as shown below <?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:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <import resource="classpath:securityConfig.xml" /> I am getting the below Exception ContextLoader - Context initialization failed org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:securityConfig.xml] Offending resource: class path resource [dispatcherContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [s…
tagged with: spring
accepted answer: http://stackoverflow.com/a/24232379
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24232379
has title: Spring MVC : adding securityConfig.xml along with dispatcherContext.xml

http://stackoverflow.com/a/24270155
answers question: http://stackoverflow.com/q/24262422
type: AcceptedAnswer
has body: The http session is stored in the SessionMap which is among the other context maps is stored in the action context by the dispatcher when serving a request. The session map is a wrapper for http session object and operations such as get/put are synchronized using a http session object monitor. It simply synchronizes the access to http session attributes, however providing a Map implementation.
upvote count: 1
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24262422
downvote count: 0

http://stackoverflow.com/comment/37405793
has text: What you want to return? What is your expected output?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24222861

http://stackoverflow.com/comment/37355839
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24196600
has text: you forgot to append `a` after `substring()`

http://stackoverflow.com/comment/37269321
has text: I have added my `AsyncTask` class's code in the question above!
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24150321
type: Comment

http://stackoverflow.com/q/24185803
type: AnsweredQuestion
tagged with: java
tagged with: datetime
tagged with: http://stackoverflow.com/tag/json
tagged with: python
score: 1
type: Question
has body: I have a Rest Service which receives a JSON object. This JSON has a timestamp value in it. When I convert the JSON object to Java class I use a long variable (which I later use with new Date(long) to get a proper date object) for the timestamp. Everything was working fine as the clients (in Java and JS) were sending timestamp as long. Now we are adding a Python client to the service, and I am trying to send timestamp as long from Python. But time.time() method in Python always gives a floating point number. So I decided to use a double variable in my Rest Service's Java class and I am getting the timestamp correctly. But then how do I convert this to a Date Object. Any ideas?
accepted answer: http://stackoverflow.com/a/24186134
downvote count: 0
answer count: 1
upvote count: 1
has title: Converting floating point timestamp from Python to Date in java
has answer: http://stackoverflow.com/a/24186134
favorite count: 0

http://stackoverflow.com/comment/37245538
type: AnswerComment
has text: yes it works! i did't remove data already saved to mongoDB :D thanks a lot :)
comment on: http://stackoverflow.com/a/24137390
type: Comment
score: 0

http://stackoverflow.com/q/24108712
downvote count: 1
has comment: http://stackoverflow.com/comment/37190488
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24108891
has comment: http://stackoverflow.com/comment/37190628
tagged with: java
has body: I want to import calendar with "import java.util.Calendar;" but, my eclipse said nothing with red underline... import java.util.Calendar; import java.util.Scanner; Scanner is fine but Calendar, it says "The import java.util.Calendar conflicts with a type defined in the same file"
has comment: http://stackoverflow.com/comment/37190701
has title: I can't import util.Calendar
possible better answer: http://stackoverflow.com/a/24108891
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37190557
answer count: 2
accepted answer: http://stackoverflow.com/a/24108838
has answer: http://stackoverflow.com/a/24108838
has comment: http://stackoverflow.com/comment/37190504
upvote count: 1
tagged with: calendar
tagged with: libraries

http://stackoverflow.com/comment/37322482
type: QuestionComment
comment on: http://stackoverflow.com/q/24179314
has text: Does it work? If not, do you get an error? What is the expected result, what is the acutal result?
type: Comment
score: 4

http://stackoverflow.com/a/24262451
answers question: http://stackoverflow.com/q/24262045
score: 0
upvote count: 1
downvote count: 1
has body: Declare your class A as interface and return in B an internal delegate implementation of this interface (Proxy pattern). Something like this public interface A { void setNumber(int n); int getNumber(); } public class B { private A member; private class AImpl implements A { public void setNumber(int n) { member.setNumber(n); notifyB(); } public int getNumber() { int res = member.getNumber(); notifyB(); return res; } } public A getMember() { return new AImpl(); } public void setMember(A member) { this.member = member; } private void notifyB() { // notification } } Alternative you can also use the class Proxy but interface is the preferrable way to do this.
type: Answer

http://stackoverflow.com/comment/37253592
score: 0
type: AnswerComment
has text: Try as in your original code: JSONArray jsonDetailsObj = json.getJSONArray(cityList); (Without quotes)
comment on: http://stackoverflow.com/a/24141906
type: Comment

http://stackoverflow.com/q/24190657
tagged with: deserialization
tagged with: jvm
has title: how to overcome class loading issues in java when a class in JVM class path tries to access the class available in a web applications lib
type: Question
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37343788
score: 0
has answer: http://stackoverflow.com/a/24192026
has body: I have a cache framework newly developed for one of our portal which will be used by many applications across portal. When the Heap size is exceeding certain limit we are persisting the cached entries to database. Before persisting we are serializing the CachedObject and then storing into Database. public class CachedObject implements Serializable{ private Object obj = null; public CachedObject(){ } public CachedObject(Object obj) { this.obj = obj; } } Above is my CachedObject representation, obj is the actual object that is put into cache. Say obj is of type TestPojo.java and it resides in web-inf/lib of respective application. This TestPojo.java is loaded by application class loader. The newly developed cache framework jar (say cache.jar) resides in JVM classpath of IBM Websphere server and is loaded by ExtJarClassLoader. I was able to serialize the cached object and save into database perfectly, but when I DE serialize the object saved in database I am getting ClassNotFoundException as the required TestPojo.java has no visibility at JVM Class path level(where cache.jar resides, here de serialization happens). I knew that if I can move the cache.jar to application classloader level the issue will be resolved. But, I cannot do this because there are other jars with in the jvm class path that make use of this cache.jar. Please suggest if there are alternate solutions to resolve this class loading issue.. by changing configurations at web sphere application server level or any other work around @ java code. I have also tried different ways by changing the application’s class loading Delegation Mode to parent_first, parent_last but I am getting the same de serialization issue.
answer count: 1
tagged with: jar

http://stackoverflow.com/comment/135973181
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/55725767
has text: this worked for me with the details described by @Zhou.
score: 0

http://stackoverflow.com/a/48040786
score: -6
has body: Just change "String[] args" to "String args[]".
type: Answer
answers question: http://stackoverflow.com/q/24117713
upvote count: 1
downvote count: 7

http://stackoverflow.com/comment/37221784
type: Comment
has text: When I do that, I cannot seem to find a way to get the Application's Context anymore to create a textview.
type: AnswerComment
comment on: http://stackoverflow.com/a/24117022
score: 0

http://stackoverflow.com/a/24254549
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24254532
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24254532
score: 3
has body: every time I do this the screen just freezes That is because Thread.sleep(10); in a while loop will put your current Thread to blocking state thus freezing your screen.
type: Answer

http://stackoverflow.com/a/24109869
has body: I figured it out using timer. For some reason, the first frame wouldn't show up in the first animation, hence sprites[0] and [1] are the same image. import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.Timer; public class Sprite extends JPanel implements ActionListener{ private ImageIcon[] sprites = new ImageIcon[4]; private Timer time; private int delay = 500, currentFrame = 0; private ImageIcon a0 = new ImageIcon("C:/Users/Guilherme/Desktop/G/FEUP/2º Ano/2nd semester/Eclipse repos/Sprite/src/images/ball.jpg"); private ImageIcon a1 = new ImageIcon("C:/Users/Guilherme/Desktop/G/FEUP/2º Ano/2nd semester/Eclipse repos/Sprite/src/images/transferir.jpg"); private ImageIcon a2 = new ImageIcon("C:/Users/Guilherme/Desktop/G/FEUP/2º Ano/2nd semester/Eclipse repos/Sprite/src/images/smurf_sprite.png"); public Sprite() { sprites[0] = a0; sprites[1] = a0; sprites[2] = a1; sprites[3] = a2; time = new Timer(delay, this); time.start(); } public void paintComponent(Graphics g) { super.paintComponent(g); sprites[currentFrame].paintIcon(this, g, 0, 0); if (currentFrame == sprites.length-1) { time.stop(); } else currentFrame++; } public void actionPerformed(ActionEvent e) { repaint(); } public static void main(String[] arg) { JFrame f = new JFrame(); Sprite s = new Sprite(); f.add(s); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(500,400); } }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24108644
downvote count: 1
answers question: http://stackoverflow.com/q/24108644
type: Answer
score: -1
upvote count: 0

http://stackoverflow.com/comment/37474708
type: Comment
comment on: http://stackoverflow.com/a/24258988
type: AnswerComment
has text: Yes, if the player is close enough to see the chunks, it will appear as if they render one by one. However, if the chunks are generated far enough away from the player so the player can't see them, there is no delayed display.
score: 0

http://stackoverflow.com/q/24227896
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24227939
has body: I am attempting to create a generic/parameterized code to call from multiple classes I have. I will code it so I have several classes that have methods of the same name, so I'm hoping to create a generic way to call them. Say I have 3 different classes that will all have methods that are called getAmount() that return ints and toString() methods that return Strings Then I want a generic class that could possibly reference any of those three. public class Stuff&lt;Project&gt; { private Project p; public Stuff(Project aProject) { this.p = aProject; } public int getValue() { return p.getAmount(); } public String toString() { return p.toString(); } Is there anything in java that would get this functionality for me, or am i thinking in C? I've tried using Object.getClass() in various ways to attempt to cast things, and several of the other Generic programming related questions on this site and the docs.oracle site don't seem to have what I'm looking for. Is this not possible because of the way type erasure works?
has title: Using Generic/Parameterized java with multiple classes
has answer: http://stackoverflow.com/a/24227939
possible better answer: http://stackoverflow.com/a/24227955
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37415028
answer count: 2
has answer: http://stackoverflow.com/a/24227955
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37415015
tagged with: generics

http://stackoverflow.com/comment/37365311
type: QuestionComment
comment on: http://stackoverflow.com/q/24201293
has text: Data in User becomes same as data in UserForm. And I want to change only one field.
score: 0
type: Comment

http://stackoverflow.com/comment/37339874
type: Comment
type: AnswerComment
has text: @ajb You're right, Long.compareTo() requires a Long argument. In fact all primitive wrappers only have a compareTo() taking their own type. There is no Comparable<Number> among any of the primitives wrappers in the JDK.
score: 0
comment on: http://stackoverflow.com/a/24188179

http://stackoverflow.com/q/24227971
tagged with: format-specifiers
tagged with: regex
has comment: http://stackoverflow.com/comment/37416516
has answer: http://stackoverflow.com/a/24228046
has comment: http://stackoverflow.com/comment/37415422
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24228026
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24236355
tagged with: console.readline
has comment: http://stackoverflow.com/comment/37415152
tagged with: string
has body: This question has a follow-up question here. Following this tutorial and compiling the given RegexTestHarness is giving the following errors on console.readLine(String) and console.Format(String), respectively: The method readLine() in the type Console is not applicable for the arguments (String) The method format(String, Object[]) in the type Console is not applicable for the arguments (String, String, int, int) According to the documentation, there are two arguments required there: public String readLine(String fmt, Object... args) public Console format(String fmt, Object... args) The second argument of type Object for both the methods is: args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by. So I believe that it changed after the tutorial was published. QUESTION:- What is meant the arguments referenced by the format specifiers? Firstly I thought that it is the format specifiers themselves but then I am also getting an error on Matcher matcher = pattern.matcher(console.readLine("Enter input string to search: ")); statement. import java.io.Console; import java.util.regex.Pattern; import java.util.regex.Matcher; /* * Enter your regex: foo * Enter input string to search: foo * I found the text foo starting at index 0 and ending at index 3. * */ public class RegexTestHarness { public static void main(String[] args){ Console console = System.console(); if (console == null) { System.err.println("No console."); System.exit(1); } while (true) { Pattern pattern = Pattern.compile(console.readLine("%nEnter your regex: ")); //********ERROR***** Matcher matcher = pattern.matcher(console.readLine("Enter input string to search: ")); //********ERROR***** boolean found = false; while (matcher.find()) { console.format("I found t…
has title: console.readLine() and console.format(): What is meant by arguments referenced by format specifiers?
tagged with: java

http://stackoverflow.com/comment/37233270
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24131263
has text: @user3697635-What does your `transform()` method do?Has ra2085 mentioned correct formula for transform? `Slope=dy/dx` simply;
type: Comment

http://stackoverflow.com/q/24176951
answer count: 2
has body: I declared a variable as a double in java from two figures and it doesn't seem to be coming up properly in the output. For instance, my runs figure was 18, the balls figure was 21, however when printed to screen, the strikerate variable only displayed as 0.0. Can anybody see my issue here? :) double strikerate = runs/balls; System.out.println(runs); System.out.println(balls); System.out.println(" "); System.out.println("Strikerate: " + strikerate);
upvote count: 1
tagged with: java
downvote count: 1
has title: Division of two numbers not storing properly as a double in Java
favorite count: 0
duplicate of: http://stackoverflow.com/q/4931892
type: Question
has answer: http://stackoverflow.com/a/24176982
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24176967
linked to: http://stackoverflow.com/q/4931892
has comment: http://stackoverflow.com/comment/37318411
has comment: http://stackoverflow.com/comment/37320759
score: 0

http://stackoverflow.com/comment/37293783
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24158734
has text: Kindly accept it as the answer by ticking the right mark on the leftmost side. I don't understand what do you mean by adding time from inside the action.
score: 0

http://stackoverflow.com/q/24227182
has title: Guava Optional as method argument for optional parameters
has body: Recently I had a discussion with my teammate on use of Guava Optional for optional parameters in a method. Let's say method is List&lt;Book&gt; getBooks(String catalogId, Optional&lt;String&gt; categoryId) { Validate.notNull(catalogId); Validate.notNull(categoryId); // Point of conflict. Is this required? which accepts a catalogId and an optional categoryId which returns books listed in that catalog and if category is also passed then returns books only in that category. Point of conflict was, Validating Optional&lt;String&gt; categoryId for null check. I was of view point that there should not be a null check on it since it's an optional parameter. Caller of the function can either pass null or Optional.&lt;String&gt;absent() and getBooks function should handle both cases by doing if(categoryId==null &amp;&amp; categoryId.isPresent()) in the implementation. My opinion was that Optional for optional parameters just makes the contract of the method more clear. One can tell just by looking at method signature that this parameter is optional and does not need to read the javadocs. But he should not be forced to pass Optional.absent() when he does not want to use that optional parameter. My team mate had different view. He wanted to put a null check for it and hence force the caller to always pass Optional.&lt;String&gt;absent(). His point was that why would we pass a null optional. Moreover getBooks("catalog123", Optional.absent()) looks more readable than getBooks("catalog123", null). This method is in one of our library packages and is used by multiple packages owned by us. What are your suggestions on usage of Optional for this scenario? Thanks
type: AnsweredQuestion
tagged with: guava
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37414666
tagged with: optional-parameters
favorite count: 0
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/24229056
has comment: http://stackoverflow.com/comment/37414450
has answer: http://stackoverflow.com/a/24229056

http://stackoverflow.com/comment/37450172
score: 2
type: AnswerComment
has text: @JeeshuMittal Yes, I think you're on the right track. As I said, it contains all the information needed for it to be used as a `Pet` and some additional information specific to `Dog`. All of this being encapsulated in a single object.
comment on: http://stackoverflow.com/a/24246027
type: Comment

http://stackoverflow.com/q/24134658
downvote count: 0
tagged with: grails-domain-class
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24134895
type: UnansweredQuestion
tagged with: grails
has body: Consider a Grails domain Class: class Rate { static belongsTo = [createdUser:User] static hasMany=[cancelNo:CancelNo,property:Property ] Long id String code static constraints = { id ( nullable:true ) code( nullable: true ) } } Consider a java Class class Rate { Long id String code } I want to remove the domain class and need to reuse the java class I have done all the mappings in grails-app/conf/hibernate/hibernate.cfg.xml and created a groovy file RateConstraints.groovy inside that have given correct package of hibernate java-class and this constraints = { id ( nullable:true ) code( nullable: true ) } what i want to know is, Is it possible to write mapping inside this..? ie, static belongsTo = [createdUser:User] static hasMany=[cancelNo:CancelNo,property:Property ] if it is possible then how it can be achieved..?
has title: Grails:Replacing GORM with Hibernate class
score: 2
upvote count: 2
tagged with: java
tagged with: hibernate
answer count: 1

http://stackoverflow.com/comment/37368166
has text: thank sir. How about cursorAdapter error that over database class.
type: Comment
comment on: http://stackoverflow.com/a/24203192
score: 0
type: AnswerComment

http://stackoverflow.com/a/24252736
has body: Check this callback. But this is called when end of playback source was reached. Also You can check other callbacks there
score: 2
answers question: http://stackoverflow.com/q/24252642
type: Answer
accepted answer of: http://stackoverflow.com/q/24252642
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24224427
accepted answer of: http://stackoverflow.com/q/24222795
type: Answer
has body: The "Combined trigger axis" issue is caused by DirectInput. JInput uses DirectInput to poll the 360 controller. In this article is explained that the combining of axis was an intentional change to keep compatability with legacy games. Quoting the article: The combination of the left and right triggers in DirectInput is by design. Games have always assumed that DirectInput device axes are centered when there is no user interaction with the device. However, the Xbox 360 controller was designed to register minimum value, not center, when the triggers are not being held. Older games would therefore assume user interaction. The solution was to combine the triggers, setting one trigger to a positive direction and the other to a negative direction, so no user interaction is indicative to DirectInput of the "control" being at center. In order to test the trigger values separately, you must use XInput. ` LWJGL can not offer separate trigger values because it in effect relies on DirectInput. The best course of action would be to find java bindings for XInput, which does allow separate trigger values.
answers question: http://stackoverflow.com/q/24222795
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24130156
upvote count: 1
answers question: http://stackoverflow.com/q/24129531
score: 1
type: Answer
has body: GridBagLayout is dong exactly what is expected of it. When the available space is to small to honour the preferred size of the component, it will use the component's minimum size instead. Instead, consider using a BorderLayout and an EmptyBorder to produce the empty space around the scroll pane You could also use the weightx/y, fill and insets properties of GridBagConstraints Take a look at How to use GridBagLayout for more details
downvote count: 0

http://stackoverflow.com/a/24255581
type: Answer
has comment: http://stackoverflow.com/comment/37469351
has comment: http://stackoverflow.com/comment/37468450
has comment: http://stackoverflow.com/comment/37468582
has comment: http://stackoverflow.com/comment/37474743
has comment: http://stackoverflow.com/comment/37473137
accepted answer of: http://stackoverflow.com/q/24255532
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37469480
has comment: http://stackoverflow.com/comment/37470811
answers question: http://stackoverflow.com/q/24255532
score: 0
has body: This will do ClassA obj= new ClassA(); obj.playerRectangle.setPosition(obj.getX() + obj.velocity.x * obj.delta, 300); this will only work if all the functions and objects( ie; getx(),velocity.x,delta ) are all public.

http://stackoverflow.com/q/24204559
has comment: http://stackoverflow.com/comment/37371263
has comment: http://stackoverflow.com/comment/37370886
answer count: 3
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24207674
tagged with: garbage-collection
upvote count: 1
has answer: http://stackoverflow.com/a/25067689
has body: I've read few articles about how garbage collection works and still don't understand how using generations helps? As I understood the main idea is that we start collection from the youngest generation and move to older generations. But why the authors of this idea decided that starting from the youngest generation is the most efficient way?
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/37372401
has answer: http://stackoverflow.com/a/24204790
has comment: http://stackoverflow.com/comment/37372040
tagged with: java
has title: How generation help garbage collector?
score: -1
type: Question

http://stackoverflow.com/q/24218442
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37415099
has body: I'm using the gdata-java-client from Google to work with Google spreadsheets. SpreadsheetService s = new SpreadsheetService("myAppName"); This works in Eclipse. As soon as I run it on App Engine (dev environment), I get NoClassDefError. The following jars are in WEB-INF/lib gdata-spreadsheet-meta-3.0.jar gdata-spreadsheet-3.0.jar jsr305.jar google-collect-1.0-rc1.jar gdata-client-1.0.jar Instantiate other objects from those jars such as SpreadsheetEntry for example works. The solutions I've found for this problem lied all in missing jars. I think this isn't the problem here, since I could create other objects from those jars.
answer count: 1
has comment: http://stackoverflow.com/comment/37400727
linked to: http://stackoverflow.com/q/15212252
has title: NoClassDefFoundError with Google Spreadsheets APIs on Google Application Engine
type: Question
has comment: http://stackoverflow.com/comment/37404563
tagged with: google-app-engine
tagged with: java
has comment: http://stackoverflow.com/comment/37403633
has comment: http://stackoverflow.com/comment/37404614
score: 0
has answer: http://stackoverflow.com/a/24227969
tagged with: google-sheets
has comment: http://stackoverflow.com/comment/37402345

http://stackoverflow.com/a/24165713
has comment: http://stackoverflow.com/comment/42016412
answers question: http://stackoverflow.com/q/24165593
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/37304830
upvote count: 4
has body: To synchronize on each file, it seems that you can synchronize on the ing variable, which contains a reference to the file: public void write(Ing ing) { synchronized(ing) { File file = getFile(ing); FileWriter writer = new FileWriter(file, true); ... } }
has comment: http://stackoverflow.com/comment/42011767
downvote count: 0

http://stackoverflow.com/comment/37400357
score: 0
comment on: http://stackoverflow.com/q/24220097
type: Comment
has text: Well I just needed a quick name for the variable and this was the first I could think of but I'll change it.
type: QuestionComment

http://stackoverflow.com/a/24250205
has comment: http://stackoverflow.com/comment/37485333
has comment: http://stackoverflow.com/comment/37458911
type: Answer
has comment: http://stackoverflow.com/comment/37463212
has comment: http://stackoverflow.com/comment/37458231
has body: You should use the hasNextXXXX() methods from the Scanner class to make sure that there is an integer ready to be read. The problem is you are called nextInt() which reads the next integer from the stream that the Scanner object points to, if there is no integer there to read (i.e. if the input is exhausted then you will see that NoSuchElementException) From the JavaDocs, the nextInt() method will throw these exceptions under these conditions: InputMismatchException - if the next token does not match the Integer regular expression, or is out of range NoSuchElementException - if input is exhausted IllegalStateException - if this scanner is closed You can fix this easily using the hasNextInt() method: Scanner s = new Scanner(System.in); int size= 0; System.out.print("How many salespersons do you want to compare: "); if(s.hasNextInt()) { size= s.nextInt(); } s.close();
score: 1
has comment: http://stackoverflow.com/comment/37458385
answers question: http://stackoverflow.com/q/24249917
downvote count: 0
has comment: http://stackoverflow.com/comment/37463230
upvote count: 1

http://stackoverflow.com/a/24169136
accepted answer of: http://stackoverflow.com/q/24168786
has comment: http://stackoverflow.com/comment/37303575
type: Answer
score: 7
has body: The reason why it is failing is because your test expects Integer arrays whereas you are passing Object type. So you are expanding the type. Try this: @Parameterized.Parameters public static Collection testCases() { return Arrays.asList(new Integer[][][] { {{1,1,1}, {2,2,2}, {3,3,3}}, {{2,2,2}, {3,3,3}, {4,4,4}} }); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24168786
upvote count: 7
has comment: http://stackoverflow.com/comment/105659531

http://stackoverflow.com/q/24191296
tagged with: cucumber-jvm
tagged with: cucumber-junit
has answer: http://stackoverflow.com/a/33110479
has body: I have a set of acceptance tests written for the Cucumber-JVM. In order to reduce the feedback time I would like to run the scenarios (of a feature) in parallel. How do I do that in the simplest and most convenient way? (I would prefer to be able to express this in Java code, as a regular JUnit test/runner, i.e. I would prefer not to resort to some workaround using the maven-surefire or maven-failsafe plugin which would require(?) twiddling and merging of the Cucumber reports afterwards.)
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37466701
tagged with: junit-runner
favorite count: 0
type: Question
tagged with: cucumber
linked to: http://stackoverflow.com/q/41034116
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/41034116
has title: How to run scenarios in Cucumber-JVM in parallel?
score: 4
has comment: http://stackoverflow.com/comment/48299346
has comment: http://stackoverflow.com/comment/83842263
upvote count: 4

http://stackoverflow.com/comment/37194797
comment on: http://stackoverflow.com/q/24110848
type: QuestionComment
type: Comment
has text: If you want to make sure that it always fits the platform it is running on, you can use `File.separator`.
score: 0

http://stackoverflow.com/comment/37358572
type: Comment
has text: Thanks for the update code, but it doesnt seem to like this: doUpdateTimeout = new Runnable(mHandlerThread.getLooper()) { public void run() { The constructor Object(HandlerThread) is undefined?
comment on: http://stackoverflow.com/a/24197326
type: AnswerComment
score: 0

http://stackoverflow.com/comment/76677937
comment on: http://stackoverflow.com/a/24221347
score: 10
type: Comment
has text: Incorrect, a list of maps can be very useful depending on the context.
type: AnswerComment

http://stackoverflow.com/q/24188372
tagged with: java
has comment: http://stackoverflow.com/comment/37340065
has body: I'm writing a bunch of relatively small files (about 50k or so each). The total processing time for writing all of these files is about 400 seconds. I put in some checks to see what's taking the most time and of that 400 total seconds, 12 seconds is spent writing the data to the files and 380 seconds are spent just doing this code: fos = new FileOutputStream(fileObj); I would expect the writing and closing of the file to take most of the time but it looks like just creating the FileOutputStream is taking the most amount of time by far. Is there a better way to create my files or is the file creation just generally a slow operation? This is the total time for thousands of files by the way, not just the time for a single file.
has comment: http://stackoverflow.com/comment/37340196
has answer: http://stackoverflow.com/a/24189196
favorite count: 0
accepted answer: http://stackoverflow.com/a/24189196
type: Question
has comment: http://stackoverflow.com/comment/37339382
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37340365
tagged with: io
has answer: http://stackoverflow.com/a/50461613
possible better answer: http://stackoverflow.com/a/50461613
upvote count: 2
score: 2
answer count: 2
downvote count: 0
has title: new FileOutputStream slow, is there a better way?

http://stackoverflow.com/comment/37269584
type: AnswerComment
score: 1
type: Comment
has text: While this answer may be correct, to be truly useful and merit a +1 you should at least show an example of what you mean.
comment on: http://stackoverflow.com/a/24150619

http://stackoverflow.com/comment/37302383
score: 0
has text: please explain me in detail i am beginner in java and i am comparing the output with c++
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24168387

http://stackoverflow.com/comment/37312754
has text: i edited again and pasted what book says, so its wrong as i understand from what u have said
score: 0
comment on: http://stackoverflow.com/q/24173308
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37280227
score: 0
type: Comment
type: AnswerComment
has text: Problem solved. But as I am a beginner I am in a big dilemma that which method should I use. The first which I wrote in my question and I have been using that method since starting or the second method that you told me today. Please help.
comment on: http://stackoverflow.com/a/24133550

http://stackoverflow.com/a/24180435
accepted answer of: http://stackoverflow.com/q/24180337
upvote count: 2
has comment: http://stackoverflow.com/comment/37366740
has comment: http://stackoverflow.com/comment/37369317
has comment: http://stackoverflow.com/comment/37368892
answers question: http://stackoverflow.com/q/24180337
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37367217
score: 2
downvote count: 0
type: Answer
has body: Seems like two Camel routes were configured using the same camelContext ID. Check their IDs and change them in case they are equal. Also check if you're not loading Camel context twice, as that would produce the same error. Also take a look at this: https://issues.apache.org/jira/browse/CAMEL-5259
has comment: http://stackoverflow.com/comment/37368265

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/24218945
type: Tag

http://stackoverflow.com/a/24147873
answers question: http://stackoverflow.com/q/24147671
has comment: http://stackoverflow.com/comment/37264007
has comment: http://stackoverflow.com/comment/37270857
has comment: http://stackoverflow.com/comment/37264100
has comment: http://stackoverflow.com/comment/37268203
type: Answer
has comment: http://stackoverflow.com/comment/37263894
accepted answer of: http://stackoverflow.com/q/24147671
type: AcceptedAnswer
has body: just add these lines into your action performed code - NewTicketWindow frame = new NewTicketWindow(); frame.setVisible(true);
downvote count: 0
has comment: http://stackoverflow.com/comment/37264314
upvote count: 1
has comment: http://stackoverflow.com/comment/37264490
score: 1

http://stackoverflow.com/q/24123959
favorite count: 0
type: Question
has body: Assume we have following example code. First Class: public class Template&lt;T&gt; { private final T val; public Template(T val) { this.val = val; } public T getVal() { return val; } } Second class: import java.util.ArrayList; import java.util.List; public class App { public static void main(String[] args) { List&lt;?&gt; templates = new ArrayList&lt;Template&lt;?&gt;&gt;(); // How can I cast this without warning? List&lt;Template&lt;?&gt;&gt; castedTemplates = (List&lt;Template&lt;?&gt;&gt;)templates; // further code... } } So, my question is: How can I do the cast without warning and without @SuppressWarnings("unchecked")?
answer count: 2
has answer: http://stackoverflow.com/a/24124075
has comment: http://stackoverflow.com/comment/37219439
tagged with: casting
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37218874
has title: Java: Casting a List<?> without warning
has comment: http://stackoverflow.com/comment/37218893
downvote count: 0
has comment: http://stackoverflow.com/comment/37219461
upvote count: 1
score: 1
tagged with: java
tagged with: generics
has answer: http://stackoverflow.com/a/24124003

http://stackoverflow.com/a/24183936
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24183744
type: Answer
has body: Almost every namespace (xsd) has a corresponding NamespaceHandler class somewhere in Spring. The same goes for the elements each element has a corresponding BeanDefinitionParser. See the javadoc for the available implementation in Spring itself. The Spring Security ones can be found here. Most Spring projects nowaways include a namespace in general somewhere in the org.springframework.[project].config package.
answers question: http://stackoverflow.com/q/24183744

http://stackoverflow.com/q/24211115
has comment: http://stackoverflow.com/comment/37425153
answer count: 1
tagged with: glassfish-4
has comment: http://stackoverflow.com/comment/37410331
has comment: http://stackoverflow.com/comment/37386910
has comment: http://stackoverflow.com/comment/37387499
has comment: http://stackoverflow.com/comment/37387754
has comment: http://stackoverflow.com/comment/37387358
has answer: http://stackoverflow.com/a/24273382
score: 0
has comment: http://stackoverflow.com/comment/37387551
has comment: http://stackoverflow.com/comment/37387963
has comment: http://stackoverflow.com/comment/37387150
has comment: http://stackoverflow.com/comment/37387018
tagged with: java
tagged with: hibernate
type: UnansweredQuestion
has body: I am getting the following exception: javax.el.ELException: javax.persistence.TransactionRequiredException at com.sun.el.parser.AstValue.invoke(AstValue.java:279) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) Caused by: javax.persistence.TransactionRequiredException at com.sun.enterprise.container.common.impl.EntityManagerWrapper.doTxRequiredCheck(EntityManagerWrapper.java:161) at com.sun.enterprise.container.common.impl.EntityManagerWrapper.doTransactionScopedTxCheck(EntityManagerWrapper.java:151) at com.sun.enterprise.container.common.impl.EntityManagerWrapper.persist(EntityManagerWrapper.java:299) I am using Hibernate 4.3.5 @Named @SessionScoped public class MenuBean implements Serializable { @PersistenceContext private EntityManager entityManager; @Transactional public void create() { MenuTitle menu = new MenuTitle(); menu.setLabel(label); entityManager.persist(menu); //exception in this line label = null; } Persistence XML: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd"> org.hibernate.jpa.HibernatePersistenceProvider MySQL5 <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="hibernate.current_session_context_class" value="jta"/> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform"/> <property name="hibernate.hbm2ddl.auto" value="none"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> I have also tried to set hibernate.tr…
has comment: http://stackoverflow.com/comment/37386681
type: Question
has comment: http://stackoverflow.com/comment/37387869
has comment: http://stackoverflow.com/comment/37387825
tagged with: jpa-2.1
has title: Glassfish 4 - TransactionRequiredException using Hibernate and CDI @Transactional

http://stackoverflow.com/comment/37489028
comment on: http://stackoverflow.com/a/24244889
score: 0
type: Comment
type: AnswerComment
has text: @JackMoore - What did you try, and what happened?

http://stackoverflow.com/comment/37465301
score: 0
has text: Well thanks. I'm not sure I totally understand what you're saying ("`getScaledInstance` is slow, 100's milliseconds slow" seems untrue as using the unsafe `Thread` method rendered it much faster than that) but the idea that `Timer` is slower because too many things getting stuck in the Event Queue seems likely. This fixed my problem and gave me some insight into it so I'll accept it as an answer until I find a better one, if there is one (which I suspect not).
comment on: http://stackoverflow.com/a/24252924
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24125949
type: Question
tagged with: java-8
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: javafx
tagged with: user-interface
downvote count: 0
has body: I have three JavaFX TextFields, one for name, one for domain, and the final for the FQDN (Fully Qualified Domain Name). I have a class that contains SimpleStringProperties for name, domain, and FQDN. I am have not been able to create a binding for FQDN that takes the values set in SimpleStringProperty name and SimpleStringProperty domain and creates SimpleStringProperty name@domain. I was trying to build the strings by combining the name and domain and adding @ however I cannot get it back to a SimpleStringProperty to send to the GUI for FQDN. I've included a rough example of what I've done. I have the GUI and many other components working, I just cannot get the FQDN to report correctly. I did this previously in Java Swing by adding an ActionListener that would listen for mouse movement and then update the field. I am trying to improve on this. public class Data { static SimpleStringProperty name = new SimpleStringProperty(); static SimpleStringProperty domain = new SimpleStringProperty(); static SimpleStringProperty FQDN = new SimpleStringProperty(); public static void setName(String string) { name.set(string); } public static void setDomain(String string) { domain.set(string); } public static ObservableStringValue getFQDN() { FQDN.set(name.get() + "@" + domain.get()); return FQDN; } } public class GUI { TextField name = new TextField(); TextField domain = new TextField(); TextField FQDN = new TextField(); name.textProperty().addListener(new NameChange()); domain.textProperty().addListener(new DomainChange()); FQDN.textProperty().bind(Data.getFQDN()); } public class NameChange implements ChangeListener&lt;String&gt; { @Override public void changed(ObservableValue&lt;? extends String&gt; observable, String oldValue, String newValue) { Data.setName(newValue); } } public class DomainChange implements ChangeListener&lt;String&gt; { @Override public void changed(ObservableValue&lt;? extends String&gt; observable, String oldValue, String newValue) { Data.setDomain(newVal…
answer count: 1
accepted answer: http://stackoverflow.com/a/24126103
favorite count: 0
has answer: http://stackoverflow.com/a/24126103
has title: Bind JavaFX TextField to a String value from two SimpleStringValues
tagged with: textfield

http://stackoverflow.com/a/24210964
type: Answer
has body: You set Statement stmt=null; and you never initialize it later.
score: 0
answers question: http://stackoverflow.com/q/24210590

http://stackoverflow.com/comment/37223584
comment on: http://stackoverflow.com/a/24123539
score: 0
type: AnswerComment
has text: yes i have the file but whenever i build source code ,file is deleted from lib folder under d:/Compiere2/lib/ BUILD FAILED C:\Users\Public\Compiere\Compiere\utils_dev\build.xml:78: The following error occurred while executing this line: D:\ProgramsandFiles\Compiere2\build.xml:347: Error while expanding D:\ProgramsandFiles\Compiere2\lib\CCTools.jar java.io.FileNotFoundException: D:\ProgramsandFiles\Compiere2\lib\CCTools.jar (The system cannot find the file specified)
type: Comment

http://stackoverflow.com/a/24212742
answers question: http://stackoverflow.com/q/24212721
type: Answer
has comment: http://stackoverflow.com/comment/37386839
score: 2
has body: There's only one thread in that thread pool. The thread will take a Runnable or Callable task that has been submit and execute it. When it is done, the same thread will pick up and execute the next task. And so on. It is more or less equivalent to executing the tasks sequentially.
accepted answer of: http://stackoverflow.com/q/24212721
downvote count: 0
has comment: http://stackoverflow.com/comment/37386873
upvote count: 2
has comment: http://stackoverflow.com/comment/37387220
type: AcceptedAnswer

http://stackoverflow.com/comment/37423219
has text: In OptionScreen. I don't even know what GameMain is.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24231972
type: Comment

http://stackoverflow.com/q/24236993
answer count: 1
duplicate of: http://stackoverflow.com/q/21824402
has comment: http://stackoverflow.com/comment/37432810
has body: "Why multiple inheritance is not possible in java ?" is any different to the question "Why multiple inheritance is not supported in java ?" or both are inter related . I know this has already been answered , just looking for a difference if any not the answer to the why.
linked to: http://stackoverflow.com/q/995255
tagged with: multiple-inheritance
has comment: http://stackoverflow.com/comment/37432743
has comment: http://stackoverflow.com/comment/37432756
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2515477
upvote count: 2
duplicate of: http://stackoverflow.com/q/995255
has comment: http://stackoverflow.com/comment/37432881
accepted answer: http://stackoverflow.com/a/24237017
has comment: http://stackoverflow.com/comment/37432719
linked to: http://stackoverflow.com/q/21824402
has answer: http://stackoverflow.com/a/24237017
type: AnsweredQuestion
score: 0
has title: why multiple inheritances are not possible in java
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/37386593
type: Comment
comment on: http://stackoverflow.com/a/24207485
has text: In `emp[0]` `[0]` means to do something with element number `0` inside array held by `emp` reference, so `emp[0] = new Employee ("Charlie")` mean set element `0` of array from `emp` to `new Employee ("Charlie")`, notice you don't change value of `emp` itself, but value *inside* that array. It is hard to answer your question better in comment. Maybe consider creating separate question for it so people could write more then ~600 characters in their answers. Anyway `array[0]=123` is similar to `array.set(0,123)` not `array = new arrayWithElement123`.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24194194
has body: I'm building an android application where I have to read a big chunk of information from a server. The server sends the information as a JSONArray and everything is fine on the server side. However the problem comes when I'm trying to receive this JSONArray as it seems to be too large for me to receive? I connect to the server using HttpClient like this: HttpParams httpParams = new BasicHttpParams(); int timeoutConnection = 20000; HttpConnectionParams.setConnectionTimeout(httpParams, timeoutConnection); int timeoutSocket = 20000; HttpConnectionParams.setSoTimeout(httpParams, timeoutSocket); HttpClient client = new DefaultHttpClient(httpParams); HttpGet request = new HttpGet(); request.setURI(url); HttpResponse response = null; try { response = client.execute(request); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedReader in = null; if (response != null) { in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()), 100000); } return in; And I simply try to read what's in the BufferedReader with the readLine() method, however what I get back is not the full content of the response. I know this because I tried accessing the same content with a web browser and it returns the full content. The response from the server is on a single line (might affect it, I don't know) I'm able to read 4kb and I need to read a whopping 141kb (so I'm far off).. My personal guess is that somewhere in my code there is a size limit. Extra I read from the BufferedReader like this: BufferedReader in = getResponse(new URI(params[0])); // Read from the received buffer String s; StringBuilder sb = new StringBuilder(10000); if(in != null){ while ((s = in.readLine()) != null){ sb.append(s); } } Log.d("Problem: ", sb.toString()); EDIT: The response does not differ, it's always the same length EDIT2: It seems that it was Log.d() that had a li…
has answer: http://stackoverflow.com/a/24194307
has comment: http://stackoverflow.com/comment/37351051
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37351987
has title: Reading large response body as HttpClient
tagged with: apache-httpclient-4.x
has comment: http://stackoverflow.com/comment/37387739
type: Question
has comment: http://stackoverflow.com/comment/37350905
answer count: 2
tagged with: android
linked to: http://stackoverflow.com/q/309424
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24194305
has comment: http://stackoverflow.com/comment/37350866
has comment: http://stackoverflow.com/comment/37351807
has comment: http://stackoverflow.com/comment/37350975

http://stackoverflow.com/q/24242923
accepted answer: http://stackoverflow.com/a/24243511
possible better answer: http://stackoverflow.com/a/24243520
tagged with: java
has body: I'm un-marshalling some XML to a string using JAXB. However the order of attributes is not the same as the original XML when running our build scripts via Maven. This is failing some unit-tests which pass perfectly fine in Eclipse. Any ideas why this would happen? Lots of similar questions here but hard to find a solid answer. :)
has answer: http://stackoverflow.com/a/24515341
has answer: http://stackoverflow.com/a/24243511
has answer: http://stackoverflow.com/a/24243520
tagged with: jaxb
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/37443937
downvote count: 0
tagged with: maven
has answer: http://stackoverflow.com/a/30402672
score: 4
has comment: http://stackoverflow.com/comment/37444448
has comment: http://stackoverflow.com/comment/37444118
has title: How to state the order of Attributes in XML after using JAXB, either in maven or elsewhere
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37444576
tagged with: unmarshalling

http://stackoverflow.com/q/24109509
has title: @PersistenceContext is null on Glassfish embedded (no ejb)
has comment: http://stackoverflow.com/comment/37192844
has comment: http://stackoverflow.com/comment/37224905
linked to: http://stackoverflow.com/q/4708035
has comment: http://stackoverflow.com/comment/37209286
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37225075
has comment: http://stackoverflow.com/comment/37220242
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37192815
has comment: http://stackoverflow.com/comment/37239580
tagged with: jta
tagged with: glassfish
has comment: http://stackoverflow.com/comment/37192128
score: 0
has comment: http://stackoverflow.com/comment/37224173
has body: im facing following problem. In my application I'm trying to use @PersistenceContext injected into the NON ejb instance of DAO by Glassfish embedded server. So it's a pojo controlled by CDI. Like this : @Named public class DummyDAO implements Serializable { @PersistenceContext private EntityManager entityManager; public void testManager() { if (entityManager == null) { throw new RuntimeException("It's null!!"); } System.out.println("Hello! I'm injected"); } } This dummy DAO injects into a JSF bean by CDI like this : @ManagedBean @SessionScoped public class OrderImportManagerBean implements Serializable { @Inject DummyDAO dummyDAO; public void testManager() { dummyDAO.testManager(); } } testManager() called from an xhtml page like #{orderImportManagerBean.testManager} entityManager is always null. The CDI itself works, all instances injected as they should but not this one. I have persistence.xml and orm.xml under resources/META-INF catalog. So after the project is packaged I get META-INF and stuff in right place (classes/META-INF). Here is my persistence.xml : org.hibernate.jpa.HibernatePersistenceProvider <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/> <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:testdb"/> <property name="javax.persistence.jdbc.user" value="sa"/> <property name="javax.persistence.jdbc.password" value=""/> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name = "hibernate.show_sql" value = "true" /> Now I'm wondering what is wrong with my configuration? Any suggestions? Thanks.
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/37233196
comment on: http://stackoverflow.com/q/24131118
score: 0
has text: @MadProgrammer Sorry I edited my comment right after you answered but if I deleted the KeyPressed method could I keep my original design?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24117390
score: 1
has comment: http://stackoverflow.com/comment/37209221
has body: It looks like you hit this bug: https://jira.grails.org/browse/GRAILS-11430. It will be fixed in Grails 2.4.1; you can either wait until that version is released or try the workaround provided in the comments of that link, which has been reported to work.
accepted answer of: http://stackoverflow.com/q/24111824
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24111824
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24210409
score: 3
has comment: http://stackoverflow.com/comment/37382440
has body: Assuming that you can't pass in the Class object of your caller: Other than the fact that the very need for this implies a rather obnoxious design, then, the only way you can do this is to construct an exception and inspecting the last stack trace element in it: Exception e = new Exception(); StackTraceElement[] elements = e.getStackTrace(); The first element in the array is what you're looking for. (Updated following a comment) This won't work consistently in JITted environments.
has comment: http://stackoverflow.com/comment/37389560
has comment: http://stackoverflow.com/comment/37389610
has comment: http://stackoverflow.com/comment/37382857
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/37389676
type: Answer
has comment: http://stackoverflow.com/comment/37389479
answers question: http://stackoverflow.com/q/24210373
has comment: http://stackoverflow.com/comment/37389744
has comment: http://stackoverflow.com/comment/37389825

http://stackoverflow.com/comment/37432289
comment on: http://stackoverflow.com/q/24236738
has text: Did you try anything before posting here? I know it's a bit of a moot question since you got the answer you're looking for, but being given answers isn't something that's always going to be possible... And my guess as to why the code isn't on topic is because none of your code shows your attempt at solving the problem. You just show code with `// Sort the openList` and (basically) ask "What do I put here to make this work?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37468237
type: QuestionComment
comment on: http://stackoverflow.com/q/24248523
score: 1
type: Comment
has text: When you fix the errors manually in Eclipse, for what percentage of them is the first suggested fix the right choice? Remember that a wrong fix converts a compiler error to wrong code, making things worse.

http://stackoverflow.com/a/24156971
downvote count: 0
has body: Basically you try to get the nextElement() and then read it from the zip file. You can keep a counter to the loop of Enumeration of type ZipEntry and then increment as we find more elements. ZipFile zf = new ZipFile(f); try { for (Enumeration&lt;? extends ZipEntry&gt; e = zf.entries(); e.hasMoreElements();) { ZipEntry ze = e.nextElement(); String name = ze.getName(); if (name.endsWith(".txt")) { InputStream in = zf.getInputStream(ze); } } } finally { zf.close(); } You can read about more at Reading zip file efficiently in Java
answers question: http://stackoverflow.com/q/24156886
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/24168389
score: 0
has body: I'm making a thread the usual way and named it "Encoder". If the app closes and restarts again the object of the Thread is destroyed and recreated. Is there a way to get to know if the Thread that I started before is still running or not. ?
tagged with: multithreading
answer count: 2
has comment: http://stackoverflow.com/comment/37304859
has comment: http://stackoverflow.com/comment/37302362
type: Question
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24169662
type: UnansweredQuestion
has title: How to get to know if a Thread is running in Android
has comment: http://stackoverflow.com/comment/37302273
has answer: http://stackoverflow.com/a/24168614
has comment: http://stackoverflow.com/comment/37305008

http://stackoverflow.com/q/24137677
favorite count: 0
score: 2
tagged with: android
tagged with: java
has body: I am using vitamio api to play my audio files. on the official website of vitamio, using it is the same as using the native MediaPlayer in android. My audio played for a few seconds until it crashes. In my logcat there is an error report : Invalid indirect reference 0x2bc70b08 in decodeIndirectRef VM aborting Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1) Can anyone help me fix this? Please.
has title: Invalid Indirect Reference 0x2bc70b08
type: Question
answer count: 0
upvote count: 3
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/q/24164862
has answer: http://stackoverflow.com/a/44316313
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37296408
has comment: http://stackoverflow.com/comment/55169962
has answer: http://stackoverflow.com/a/26863935
has comment: http://stackoverflow.com/comment/37295810
score: 10
upvote count: 10
has answer: http://stackoverflow.com/a/24371894
has title: @ControllerAdvice exception handling together with @ResponseStatus
tagged with: spring
answer count: 4
has body: I have @ControllerAdvice class, which handles a set of exceptions. Than we have some other exceptions, which are annotated with @ResponseStatus annotation. To combine both approaches, we use technique described in blog post: http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc, namely in the ControllerAdvice we handle generic Exception in the following way: @ExceptionHandler(value = Exception.class) public ModelAndView defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception { // If the exception is annotated with @ResponseStatus rethrow it and let // the framework handle it - like the OrderNotFoundException example // at the start of this post. // AnnotationUtils is a Spring Framework utility class. if (AnnotationUtils.findAnnotation(e.getClass(), ResponseStatus.class) != null) throw e; // Otherwise setup and send the user to a default error-view. ModelAndView mav = new ModelAndView(); mav.addObject("exception", e); mav.addObject("url", req.getRequestURL()); mav.setViewName(DEFAULT_ERROR_VIEW); return mav; } It works like a charm, however, using this technique causes error with the following text to appear in the application log: 2014-06-11 15:51:32.907 ERROR o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - Failed to invoke @ExceptionHandler method: ... This is caused by this piece of code in ExceptionHandlerExceptionResolver: try { if (logger.isDebugEnabled()) { logger.debug("Invoking @ExceptionHandler method: " + exceptionHandlerMethod); } exceptionHandlerMethod.invokeAndHandle(webRequest, mavContainer, exception); } catch (Exception invocationEx) { logger.error("Failed to invoke @ExceptionHandler method: " + exceptionHandlerMethod, invocationEx); return null; } Does anybody know how to combine these two approaches to exception handling properly to avoid the error in the log? Thanks, Jan
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/32591497
downvote count: 0
has comment: http://stackoverflow.com/comment/59675640
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/59622525
has comment: http://stackoverflow.com/comment/37296773

http://stackoverflow.com/comment/37194587
has text: Where exactly are you stuck? Please clarify.
comment on: http://stackoverflow.com/q/24110756
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24117878
type: AnsweredQuestion
has body: I have this code to export a JasperReprot to XLS: JasperPrint jprint=JasperFillManager.fillReport(expRpg, null, new JRBeanCollectionDataSource(datalist)); JRXlsExporter exporter = new JRXlsExporter(); exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jprint); exporter.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, outStream); exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.exportReport(); Upgrading to JasperReports 5.6 all setParameter are flagged as "deprecated" and I can not find documentation to adapt this code. How to export a report to xls with JasperReports 5.6?
has comment: http://stackoverflow.com/comment/37212902
answer count: 3
tagged with: deprecated
has answer: http://stackoverflow.com/a/24120791
tagged with: java
downvote count: 0
possible better answer: http://stackoverflow.com/a/33680874
has comment: http://stackoverflow.com/comment/37212989
upvote count: 44
favorite count: 0
type: Question
tagged with: jasper-reports
accepted answer: http://stackoverflow.com/a/24120791
has answer: http://stackoverflow.com/a/46113306
has title: JasperReports 5.6: JRXlsExporter.setParameter is deprecated
score: 44
has answer: http://stackoverflow.com/a/33680874
tagged with: export

sqlexception
tags question: http://stackoverflow.com/q/24209345
type: Tag
tags question: http://stackoverflow.com/q/24144967
tag name: sqlexception

http://stackoverflow.com/comment/37199305
type: Comment
type: QuestionComment
has text: see http://stackoverflow.com/questions/19216118/how-is-that-x-20x-x-x-x-final-value-of-x-in-java-is-65#answer-19216199
comment on: http://stackoverflow.com/q/24113263
score: 0

http://stackoverflow.com/q/24223216
type: AnsweredQuestion
score: 1
tagged with: java
has title: Invoking Clojure from Java in IntelliJ Idea?
accepted answer: http://stackoverflow.com/a/24223877
answer count: 1
upvote count: 1
has body: I installed La Clojure Plugin for IntelliJ Idea IDE so I'm either able to use Clojure REPL, or create a Clojure app, but how to run a Clojure function from a Java program? For some unknown reason, I can't import clojure.lang.RT; etc. Can you give me a step-by-step guide so it will be possible to invoke Clojure code from Java?
has answer: http://stackoverflow.com/a/24223877
tagged with: clojure
favorite count: 0
type: Question
tagged with: intellij-idea
downvote count: 0

http://stackoverflow.com/a/24123054
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37218067
answers question: http://stackoverflow.com/q/24122862
has body: You can end it after hitting enter twice. The code would look like: package Utilities; import java.util.Scanner; public class reader { public static void main(String[ ] args) { Scanner scan = new Scanner( System.in ); StringBuffer buf = new StringBuffer(); while ( scan.hasNextLine() ) { System.out.println("&lt;&lt;"); String line = scan.nextLine(); buf.append( line ); buf.append( "\n" ); System.out.println(line); if(line.equals("")) break; } String s = buf.toString(); System.out.print(s); } } You can even use custom message like exit.
has comment: http://stackoverflow.com/comment/37219300
has comment: http://stackoverflow.com/comment/37219182
has comment: http://stackoverflow.com/comment/37218781

http://stackoverflow.com/q/24238077
linked to: http://stackoverflow.com/q/14228520
has comment: http://stackoverflow.com/comment/100961132
score: 4
has comment: http://stackoverflow.com/comment/37434817
has answer: http://stackoverflow.com/a/24238153
has answer: http://stackoverflow.com/a/24238194
has answer: http://stackoverflow.com/a/24238179
has answer: http://stackoverflow.com/a/24238132
upvote count: 4
type: AnsweredQuestion
tagged with: oop
accepted answer: http://stackoverflow.com/a/24238132
duplicate of: http://stackoverflow.com/q/14228520
tagged with: java
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/37434756
possible better answer: http://stackoverflow.com/a/24238168
has comment: http://stackoverflow.com/comment/100961130
has answer: http://stackoverflow.com/a/24238191
has comment: http://stackoverflow.com/comment/100961131
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24238168
has answer: http://stackoverflow.com/a/24238335
has body: Recently I was asked this question "why should one override a method? " I replied, if I have a class with 10 methods and I want to use all of its functionality except one method, then I will override that method to have my own functionality. Then the interviewer replied in that case why cant we write a new method with a different name and use that method instead. Yes this is also right. Now I am confused. What is the real objective in overriding a method? Can anyone please tell me? Thank you all in advance.
tagged with: overriding
has comment: http://stackoverflow.com/comment/37434772
has title: Why should we override a method?

http://stackoverflow.com/a/24250171
type: Answer
has body: I believe it has something to do with your scanner. The scanner input method uses a buffer to capture and store the data entered. Nextline will capture all data to the end of the return character, which, empties the buffer. All the other scanner methods such as Nextint, capture data from the buffer till before the return character, which basically ends your next scanner capture prematurely, due to the remaining return character. Try and add a input.nextline(); after you capture your input from any scanner methods to clear the buffer and prevent issues with with the scanner input methods. That's how I understand it, if someone has a better explanation I would be all ears.
score: 0
answers question: http://stackoverflow.com/q/24249917

http://stackoverflow.com/comment/37354372
type: QuestionComment
score: 1
has text: How is `ask` called? Swing is a single threaded environment, you never want to do anything that might block the UI thread. You may also want to consider having a read through [Code Conventions for the Java Programming Language](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
comment on: http://stackoverflow.com/q/24195929
type: Comment

http://stackoverflow.com/q/24209438
has body: when I read the source code of the UnpooledDirectByteBuf.java of Netty5, I find some code of UnpooledDirectByteBuf.java like this: public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) { checkSrcIndex(index, length, srcIndex, src.capacity()); if (buffer.hasArray()) { src.getBytes(srcIndex, buffer.array(), index + buffer.arrayOffset(), length); } else if (src.nioBufferCount() &gt; 0) { ... ... } else { src.getBytes(srcIndex, this, index, length); } return this; } I surprise that why we called "buffer.hasArray()" here. is this.buffer of UnpooledDirectByteBuf a DirectByteBuffer ? and I think that buffer.hasArray() here always return false. Am I right? Thanks!
upvote count: 1
type: UnansweredQuestion
tagged with: netty
answer count: 1
has answer: http://stackoverflow.com/a/24239200
favorite count: 0
downvote count: 0
score: 1
tagged with: java
has title: Netty UnpooledDirectByteBuf
type: Question

http://stackoverflow.com/q/24208422
type: UnansweredQuestion
tagged with: android
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/37384791
has title: Is AsyncTask delivering any response between onDestroy() and onCreate() callbacks of a fragment?
answer count: 0
tagged with: android-fragments
tagged with: java
downvote count: 1
favorite count: 0
tagged with: android-asynctask
type: Question
tagged with: android-orientation
has body: I know I came a bit too late to the party and over the past 3 years (or maybe longer) there've been thousands and thousands of discussion like this one (unfortunately most of them involving activities and not fragments), but I'm curious about one thing. Having the following piece of code, can mFragment be null when the AsyncTask's callback onError() or onSuccess() gets called after the screen orientation changes? So the AsyncTask starts, I rotate the screen of the device and at some point the AsyncTask will return an error or a success. When this happens, can the mFragment be null? I already know that this cannot happen when dealing with Activities because basically no messages will be processed between a call to onRetainNonConfigurationInstance() of the previous instance and onCreate() of the new instance of the activity. Unfortunately I couldn't find anything about this rule when it comes to fragments. Do you guys know anything about this? Thank you for your answers! public class Fragment extends Fragment { private WorkerFragment mWorkerFragment; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWorkerFragment =(WorkerFragment)getFragmentManager().findFragmentByTag("worker_fragment"); if (mWorkerFragment == null) { mWorkerFragment = new WorkerFragment(); getFragmentManager().beginTransaction().add(mWorkerFragment, "worker_fragment").commit(); } if (savedInstanceState == null) { mWorkerFragment.performAsyncTask(); } private static class WorkerFragment extends Fragment { private TypeOfAsyncTask mAsyncTask; private Fragment mFragment; private Callback mCallback = new Callback() { @Override public void onError(Error error) { // Can mFragment be null here? mFragment.onSendRequestError(error); } @Override public void onSuccess(Result result) { // Can mFragment be null here? mFragment.onSendRequestSuccess(result); } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainIn…

http://stackoverflow.com/a/24120082
downvote count: 0
has body: You can copy the .git folder in the new project, and check that a git status does pick up all your changes (git add -A . after that, in order to add any new, modified or deleted files). A more clean solution would be to : initialize an empty git repo in your project (git init .) add as a remote a path to your previous project (git remote add origin /path/to/previous/project, where a .git/ folder reside. Then, using git branch and git reset: git fetch git branch master origin/master git reset --soft master
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24119701
score: 1
accepted answer of: http://stackoverflow.com/q/24119701
type: AcceptedAnswer

http://stackoverflow.com/comment/37378142
type: QuestionComment
type: Comment
score: 6
comment on: http://stackoverflow.com/q/24208612
has text: What happens when you try? (My guess: you can 'cast' it, but it's still `null`, so you get an exception with `equals`)

http://stackoverflow.com/q/24106538
has answer: http://stackoverflow.com/a/24106590
tagged with: integer
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37186609
has answer: http://stackoverflow.com/a/24106616
has answer: http://stackoverflow.com/a/24106563
answer count: 3
has title: Arguments of variable number of integers in method in java
score: 1
has body: Question: Write a method that takes as input a variable number of integers. The method should return the average of the integers as a double. Write a full program to test the method. That code below creates an array of 10 integers and finds their average. However, I need it to create a variable number of arguments (int...a) where any number of integers entered can be averaged. Can someone help me.Thanks. My code: package average.pkgint; import java.util.Scanner; public class AverageInt { /** * @param args the command line arguments */ public static void main(String[] args) { int [] number = new int [10]; Scanner b = new Scanner(System.in); System.out.println("Enter your 10 numbers:"); for (int i = 0; i &lt; number.length; i++) { number[i] = b.nextInt() ; } System.out.println("The average is:"+Avnt(number)); } public static int Avnt(int [] a){//declare arrays of ints int result = 1; int sum = 0; //iterate through array for (int num : a) { sum += num; } double average = ( sum / a.length);//calculate average of elements in array result = (int)average; return result; } }
tagged with: java
downvote count: 1
tagged with: arguments
tagged with: methods
tagged with: variadic-functions

http://stackoverflow.com/a/24154272
answers question: http://stackoverflow.com/q/24154135
type: Answer
has body: try this int temp = data[data.length - 1]; for (int i = data.length - 1; i &gt; 0; i--) { data[i] = data[i - 1]; } data[0] = temp; or this int temp = data[data.length - 1]; System.arraycopy(data, 0, data, 1, data.length - 1); data[0] = temp;
score: 0
has comment: http://stackoverflow.com/comment/37314686
has comment: http://stackoverflow.com/comment/37313913
has comment: http://stackoverflow.com/comment/37316749

http://stackoverflow.com/comment/37411274
comment on: http://stackoverflow.com/q/24225871
type: Comment
type: QuestionComment
score: 0
has text: Sorry, this is another way of saying: can you show us what you have tried?

casting
tags question: http://stackoverflow.com/q/24208612
tags question: http://stackoverflow.com/q/24251111
tags question: http://stackoverflow.com/q/24217213
tags question: http://stackoverflow.com/q/24155455
tags question: http://stackoverflow.com/q/24232814
tags question: http://stackoverflow.com/q/24139986
tags question: http://stackoverflow.com/q/24123959
tags question: http://stackoverflow.com/q/24247550
tag name: casting
type: Tag
tags question: http://stackoverflow.com/q/24235724
tags question: http://stackoverflow.com/q/24115021
tags question: http://stackoverflow.com/q/24127638
tags question: http://stackoverflow.com/q/24191195

http://stackoverflow.com/q/24186458
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37335645
possible better answer: http://stackoverflow.com/a/24187124
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24186548
has comment: http://stackoverflow.com/comment/37335546
answer count: 2
has comment: http://stackoverflow.com/comment/37335485
has answer: http://stackoverflow.com/a/24186548
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37339131
has title: In Java, are anonymous inner types detrimental to performance?
favorite count: 0
type: Question
has body: Is using anonymous inner types detrimental to performance (CPU utilisation, compiler performance, memory consumption, etc.) as opposed to declaring it explicitly somewhere? I am using a framework that demands the usage of certain inherited classes, in my case I need the class only a single time and to avoid making the programs flow difficult to follow I'd like to use the anonymous inner type. "object.SetXclass(new ???" will be called often and in any case a new instance of the object inheriting from y needs to be created. 1) explicit class declaration class x extends y { @Override public void m() { ... }; } ~~ object.SetXclass(new x()); 2) anonymous inner type -is this bad for performance? object.SetXclass(new y() { @Override public void m() { ... }; });
has answer: http://stackoverflow.com/a/24187124
has comment: http://stackoverflow.com/comment/37335438
tagged with: performance
has comment: http://stackoverflow.com/comment/37335916

http://stackoverflow.com/q/24211943
answer count: 1
linked to: http://stackoverflow.com/q/2610633
downvote count: 0
tagged with: maven
upvote count: 1
has title: aspectj-maven-plugin, declare soft how to compile
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24341085
has body: Is it possible to compile project with softened Exceptions (e.g.: declare soft: Exception : execution(* *.*());) aspects in it using only aspectj-maven-plugin ? I can't handle it... I am still getting compilation error unreported exception Exception; must be caught or declared to be thrown So it is compiled without taking aspects in account. I am using this command to compile: mvn clean aspectj:compile and my pom.xml is: 4.0.0 pl.group.id aop 1.0.0 org.aspectj aspectjrt 1.7.4 org.apache.maven.plugins maven-compiler-plugin 3.1 org.codehaus.mojo aspectj-maven-plugin 1.6 1.7 1.7 1.7 src/main/aspect compile test-compile What am I doing wrong?
has answer: http://stackoverflow.com/a/24341085
has comment: http://stackoverflow.com/comment/37385600
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37385215
tagged with: aspectj-maven-plugin
tagged with: aspectj
score: 1
tagged with: java

http://stackoverflow.com/comment/37430034
type: Comment
type: AnswerComment
has text: @user3742134 compile using filename Eg. `javac filename.java` and run only using class name `java Boolean_1` here if class is not public
score: 0
comment on: http://stackoverflow.com/a/24229198

http://stackoverflow.com/q/24216920
tagged with: java
has comment: http://stackoverflow.com/comment/37394679
has body: I am using RandomAccessFile but writeBytes() overwrites the existing content Mostly i want to implement this without using any new temporary file at least methods name few clues or techniques will do.
linked to: http://stackoverflow.com/q/17473303
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37395400
has title: How to append and delete data in the middle of a text file, shifting the remaining file content using java code?
accepted answer: http://stackoverflow.com/a/24217065
answer count: 1
has answer: http://stackoverflow.com/a/24217065
has comment: http://stackoverflow.com/comment/37394961
tagged with: file-io
type: Question

forms
tags question: http://stackoverflow.com/q/24254567
tags question: http://stackoverflow.com/q/24258827
tags question: http://stackoverflow.com/q/24181695
tags question: http://stackoverflow.com/q/24116637
type: Tag
tags question: http://stackoverflow.com/q/24255679
tag name: forms
tags question: http://stackoverflow.com/q/24152797

http://stackoverflow.com/comment/37419873
type: QuestionComment
has text: @geoand Ok, that's the problem: I just needed change `this.entityClass.getName()` for `this.getName()` - I had created this method just for get the correct value in another place and forgot change here.
score: 0
comment on: http://stackoverflow.com/q/24230349
type: Comment

http://stackoverflow.com/comment/37507600
has text: It is very similar to JSession. I can hijack a session if I know the session ID. I agree to the fact that if you can do memory dump you can leak information. I am trying to find if there are standards around this.
type: QuestionComment
comment on: http://stackoverflow.com/q/24260938
type: Comment
score: 0

http://stackoverflow.com/comment/37438658
type: QuestionComment
has text: Then add %JAVA_HOME%\bin to your PATH
comment on: http://stackoverflow.com/q/24240179
score: 0
type: Comment

http://stackoverflow.com/a/24260852
has body: ArrayList&lt;String&gt; utilList = new ArrayList&lt;String&gt;(); for (Field field: fields) { utilList.add(field.getName()); } But I don't see the point of using utilList…
type: Answer
has comment: http://stackoverflow.com/comment/37477849
answers question: http://stackoverflow.com/q/24260759
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37477778
score: 1

http://stackoverflow.com/comment/37311927
type: Comment
comment on: http://stackoverflow.com/a/24173135
type: AnswerComment
has text: Also, in my first example, is the gps.location.isValid() calculated both times, or only one.
score: 0

http://stackoverflow.com/q/24167166
tagged with: asynctaskloader
tagged with: inner-classes
downvote count: 0
upvote count: 1
score: 1
has body: Good Afternoon, I am developing an Android application that has ArrayLists of CustomObjects. These objects are generated at run-time and their properties are set from SQLite data. Since I am using SQlite i will be requiring the use of some sort of AsyncTask, and I believe the AsyncTaskLoader fits the bill. I want to create some sort of "Manager" class that will manage the creation/loading/updating of these custom objects (There are 3 custom object types). What i want to do is create the "Manager" class and have 3 inner classes that will extend AsyncTaskLoader (As well as other various functions as required). My question to you is, How can my MainActivity work with these inner classes that are a part of the "Manager" class? How will MainActivity receive the callbacks? Is there a better solution than this? Something like this... public class ObjectManager implements LoaderManager.LoaderCallbacks&lt;ArrayList&lt;Object&gt;&gt;{ private Context mContext; private LoaderManager mLoaderManager; private ObjectManagerCallBacks mObjectManagerCallBacks; public ObjectManager(Context context, LoaderManager loaderManager){ this.mContext = context; this.mObjectManagerCallBacks = (ObjectManagerCallBacks) context; this.mLoaderManager = loaderManager; mLoaderManager.initLoader(*id#1*,null,this); mLoaderManager.initLoader(*id#2*,null,this); mLoaderManager.initLoader(*id#3*,null,this); } public interface ObjectManagerCallBacks{ void contentUpdated(int loader,ArrayList&lt;Object&gt; newData); } @Override public Loader&lt;ArrayList&lt;Object&gt;&gt; onCreateLoader(int id, Bundle args) { switch (id){ case #1: return new #1Loader(mContext); case #2: return new #2Loader(mContext); case #3: return new #3Loader(mContext); default: return null; } } @Override public void onLoadFinished(Loader&lt;ArrayList&lt;Object&gt;&gt; loader, ArrayList&lt;Object&gt; data) { switch (loader.getId()){ case #1: mObjectManagerCallbacks.contentUpdated(#1LOADER,data); break; case #2: mObjectManagerCallbacks.conte…
answer count: 1
has comment: http://stackoverflow.com/comment/37317525
has title: Android - Putting Multiple ASyncTaskLoader classes as InnerClasses in a "manager" Class
has comment: http://stackoverflow.com/comment/37300100
has comment: http://stackoverflow.com/comment/37333473
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37300488
has comment: http://stackoverflow.com/comment/37299865
tagged with: subclass
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37302087
has comment: http://stackoverflow.com/comment/37335213
has comment: http://stackoverflow.com/comment/37346640
has answer: http://stackoverflow.com/a/24192878
accepted answer: http://stackoverflow.com/a/24192878

http://stackoverflow.com/comment/37355791
comment on: http://stackoverflow.com/q/24193588
type: QuestionComment
has text: Hi user1146334, I corrected the syntax. It is just code segments. I am trying to write protobuf Uid.List to Accumulo Value (seems to work) and I have an example; I failed to read the Uid.List out and gave an example of my failed attempt.
type: Comment
score: 0

http://stackoverflow.com/comment/37337063
has text: Adam, I can't appreciate your answer enough. Thanks a lot!
comment on: http://stackoverflow.com/a/24186604
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37415040
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24227913
has text: Try nameing all *.java files after javac. (This assumes everything you import (except the JDK stuff) is below the folder game.)

http://stackoverflow.com/q/24219852
upvote count: 1
answer count: 1
favorite count: 0
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24331458
accepted answer: http://stackoverflow.com/a/24331458
has body: I'm currently working on a project to forward (and later transcode) a RTP-Stream from a IP-Webcam to a SIP-User in a videocall. I came up with the following gstreamer pipeline: gst-launch -v rtspsrc location="rtsp://user:pw@ip:554/axis-media/media.amp?videocodec=h264" ! rtph264depay ! rtph264pay ! udpsink sync=false host=xxx.xxx.xx.xx port=xxxx It works very fine. Now I want to create this pipeline using java. This is my code for creating the pipe: Pipeline pipe = new Pipeline("IPCamStream"); // Source Element source = ElementFactory.make("rtspsrc", "source"); source.set("location", ipcam); //Elements Element rtpdepay = ElementFactory.make("rtph264depay", "rtpdepay"); Element rtppay = ElementFactory.make("rtph264pay", "rtppay"); //Sink Element udpsink = ElementFactory.make("udpsink", "udpsink"); udpsink.set("sync", "false"); udpsink.set("host", sinkurl); udpsink.set("port", sinkport); //Connect pipe.addMany(source, rtpdepay, rtppay, udpsink); Element.linkMany(source, rtpdepay, rtppay, udpsink); return pipe; When I start/set up the pipeline, I'm able to see the input of the camera using wireshark, but unfortunately there is no sending to the UDP-Sink. I have checked the code for mistakes a couple of times, I even set a pipeline for streaming from a file (filesrc) to the same udpsink, and it also works fine. But why is the "forwarding" of the IP-Cam to the UDP-Sink not working with this Java-Pipeline?
has title: GStreamer-Java: RTSP-Source to UDP-Sink
tagged with: pipeline
tagged with: gstreamer
type: AnsweredQuestion
downvote count: 0

reflection
tags question: http://stackoverflow.com/q/24232438
tags question: http://stackoverflow.com/q/24251111
tags question: http://stackoverflow.com/q/24168578
tags question: http://stackoverflow.com/q/24123403
tags question: http://stackoverflow.com/q/24247687
tags question: http://stackoverflow.com/q/24151641
tags question: http://stackoverflow.com/q/24157810
tags question: http://stackoverflow.com/q/24147965
tags question: http://stackoverflow.com/q/24207039
tags question: http://stackoverflow.com/q/24237708
tags question: http://stackoverflow.com/q/24260011
tags question: http://stackoverflow.com/q/24185601
tags question: http://stackoverflow.com/q/24162748
tags question: http://stackoverflow.com/q/24227802
tags question: http://stackoverflow.com/q/24243391
tags question: http://stackoverflow.com/q/24158613
tags question: http://stackoverflow.com/q/24108283
tags question: http://stackoverflow.com/q/24159156
tags question: http://stackoverflow.com/q/24140880
tag name: reflection
tags question: http://stackoverflow.com/q/24158965
tags question: http://stackoverflow.com/q/24199485
tags question: http://stackoverflow.com/q/24127474
type: Tag
tags question: http://stackoverflow.com/q/24128609

http://stackoverflow.com/a/24266432
has comment: http://stackoverflow.com/comment/37710965
has comment: http://stackoverflow.com/comment/37710064
has comment: http://stackoverflow.com/comment/37678076
has comment: http://stackoverflow.com/comment/37710670
accepted answer of: http://stackoverflow.com/q/24263847
upvote count: 3
has comment: http://stackoverflow.com/comment/38942263
has comment: http://stackoverflow.com/comment/37489592
has comment: http://stackoverflow.com/comment/37826127
has body: Personally, I would recommend a real parser. It is possible with a regex, but it can become a very lenghty pattern. Below I used define from the PHP dialect of regex to avoid duplicate patterns. If the regex engine of your choice has no such construct, then you may need to expand every definition, which results in a pretty long pattern. You can still avoid having to write it out yourself by dynamically building up the pattern string with simple string concatenation. (?(DEFINE)(?&lt;Digit&gt;one|two|three|four|five|six|seven|eight|nine)) (?(DEFINE)(?&lt;Teen&gt;twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety)) (?(DEFINE)(?&lt;TwoDigits&gt;((?&amp;Teen)-)?(?&amp;Digit)|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|(?&amp;Teen))) (?(DEFINE)(?&lt;ThreeDigits&gt;((?&amp;Digit) hundred (and )?)?(?&amp;TwoDigits)|(?&amp;Digit) hundred)) (?(DEFINE)(?&lt;SixDigits&gt;((?&amp;ThreeDigits) thousand (and )?)?(?&amp;ThreeDigits)|(?&amp;ThreeDigits) thousand)) (?(DEFINE)(?&lt;TwelveDigits&gt;((?&amp;SixDigits) million (and )?)?(?&amp;SixDigits)|(?&amp;SixDigits) million)) Fiddle: http://regex101.com/r/oM4oF2 Prepend the definitions to your expression, then you can replace every [0-9]+ by (?:[0-9]+|(?&amp;TwelveDigits)). EDIT: As far as I can tell, Java has no reusable subpatterns, so you will have to fully expand the pattern. string reDigit = "(?:one|two|three|four|five|six|seven|eight|nine)"; string reTeen = "(?:twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety)"; string reTwoDigits = "(?:(?:" + reTeen + "-)?" + reDigit + "|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|" + reTeen + ")"; string reThreeDigits = "(?:(?:" + reDigit + " hundred (?:and )?)?" + reTwoDigits + "|" + reDigit + " hundred)"; string reSixDigits = "(?:(?:" + reThreeDigits + " thousand (?:and )?)?" + reThreeDigits + "|" + reThreeDigits + " thousand)"; string reTwelveDigits = "(?:(?:" + reSixDigits + " million (?:and )?)?" + reSixDigi…
answers question: http://stackoverflow.com/q/24263847
has comment: http://stackoverflow.com/comment/37798326
has comment: http://stackoverflow.com/comment/37846683
has comment: http://stackoverflow.com/comment/38981149
has comment: http://stackoverflow.com/comment/37497988
has comment: http://stackoverflow.com/comment/37824530
has comment: http://stackoverflow.com/comment/37712023
has comment: http://stackoverflow.com/comment/38958952
has comment: http://stackoverflow.com/comment/37685032
has comment: http://stackoverflow.com/comment/37490588
has comment: http://stackoverflow.com/comment/37682331
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37498603
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38965117
has comment: http://stackoverflow.com/comment/37693049
has comment: http://stackoverflow.com/comment/37490338
has comment: http://stackoverflow.com/comment/37713494
score: 3

xml-namespaces
type: Tag
tag name: xml-namespaces
tags question: http://stackoverflow.com/q/24145120

http://stackoverflow.com/comment/37274398
type: Comment
has text: It has to be String format as first parameter and String date as the second. Since you are using Joda time, `toDate()` on `LocalDate` should be sufficient. `map.date.toDate()` should give a `java.util.Date`, no need of parsing anymore. Otherwise, if you still want to use `Date.parse` then the second parameter has to be a String as in `map.date.toString()`. Hope that helps.
comment on: http://stackoverflow.com/q/24152796
score: 1
type: QuestionComment

http://stackoverflow.com/comment/37441600
type: QuestionComment
has text: You should have made a zip of your complete project folder (and put it OUTSIDE your workspace). You should make a backup every time you are going to change anything. Or (at least) once a day. At least, you learned a lesson for the future.
type: Comment
comment on: http://stackoverflow.com/q/24241360
score: 1

http://stackoverflow.com/comment/37505308
has text: Is it possible to find the from which `index` there is changing of `Friend` nature. For e.g. `A,B` are `Friend`who are fav and frnd, `C,D,E` are `Friend` who are frnd only and `F,G` are non frnd. So, the changing `indices` are `0 2 5`. I can do it easily from sorted list,but is it possible to do from above `comparator`.Meaning, sorting and keeping changed `indices` can be done at same time or not. Thanks
comment on: http://stackoverflow.com/a/24265219
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24151663
has title: Issue with changing JScrollBars value in a JScrollPane: 90 is the magic number apparently
favorite count: 0
tagged with: jscrollbar
type: Question
tagged with: jscrollpane
upvote count: 2
tagged with: user-interface
downvote count: 0
tagged with: swing
has body: OK, so my basic premise is that I have the following setup (https://i.sstatic.net/IsFGJ.png): And my problem is only in relation to the main image window. All the little black boxes surround POI picked out by a Harris Detector and I want the user to select a subset of the squares to send as the foundation of a training set. As can be seen (bottom right), I can turn the boxes red when they're clicked, and I do this by redrawing onto the image and then changing the top component of the JSplit pane to a new JScrollPane that's a JLabel that encapsulates an image icon. This works great, but being a new ScrollPane, it jumps back to the top left, which is inconvenient at best. So now, before changing the JScrollPane, I'm storing the current value of the both the Horizontal and Vertical bars and then setting the new ScrollPanes bars to the respective values. BUT, this only works for one of them. It's so odd. The first one always takes just fine, the second however defaults to 90, regardless of how it's set. The relevant code segment is: int scrollHoriz = view_scroll.getHorizontalScrollBar().getValue(); int scrollVerti = view_scroll.getVerticalScrollBar().getValue(); System.out.println("OLD Horizontal Position: " + view_scroll.getHorizontalScrollBar().getValue()); System.out.println("OLD Vertical Position: " + view_scroll.getVerticalScrollBar().getValue()); System.out.println("Horiz: " + scrollHoriz); System.out.println("Verti: " + scrollVerti + "\n"); view_scroll = new JScrollPane(); view_scroll.getViewport().add(new JLabel(new ImageIcon(theImage))); view_scroll.getHorizontalScrollBar().setUnitIncrement(12); view_scroll.getVerticalScrollBar().setUnitIncrement(12); view_scroll.getViewport().getView().addMouseListener(new TrainingMousePress(this)); view_scroll.getVerticalScrollBar().setValue(scrollVerti); view_scroll.getHorizontalScrollBar().setValue(scrollHoriz); System.out.println("NEW Horizontal Position: " + view_scroll.getHorizontalScrollBar().getValue()); System.out.pri…
has comment: http://stackoverflow.com/comment/37277093
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24153190
has answer: http://stackoverflow.com/a/24153190
tagged with: java
answer count: 1

http://stackoverflow.com/a/24258414
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24258162
has comment: http://stackoverflow.com/comment/37473645
answers question: http://stackoverflow.com/q/24258162
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37473900
has body: You can use file. Your script writes the output to a file. Your servlet then reads this file whenever it is called.

http://stackoverflow.com/q/24152852
upvote count: 1
has comment: http://stackoverflow.com/comment/37273794
tagged with: stroke
has comment: http://stackoverflow.com/comment/37274242
has title: Stroke of drawable clips when size increases
score: 1
tagged with: android
tagged with: java
tagged with: drawable
linked to: http://stackoverflow.com/q/18693721
has body: I have a drawable circle &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"&gt; &lt;gradient android:type="radial" android:startColor="#FFFFFF" android:endColor="#EEEEEE" android:gradientRadius="90" /&gt; &lt;size android:width="50dp" android:height="50dp"/&gt; &lt;stroke android:width="2dp" android:color="#999999"/&gt; &lt;/shape&gt; And I'm trying to change the stroke of this circle on code side, like so: public void onStrokeNeedsToChange(int newStroke) { GradientDrawable gradientDrawable = (GradientDrawable)mButton.getBackground(); gradientDrawable.setStroke(newStroke, Color.RED); } However, when I change the size of the stroke it is being clipped as if the whole drawable button is inside of a square. Does anybody know how to increase the size of the stroke without it clipping?
favorite count: 0
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/37273678
type: UnansweredQuestion
tagged with: gradient
downvote count: 0

http://stackoverflow.com/comment/37417731
type: Comment
type: QuestionComment
has text: You're synching with the distributor database every week, right? Don't accept any database records from your distributors that are more than a week old. Problem solved.
comment on: http://stackoverflow.com/q/24228903
score: 2

http://stackoverflow.com/q/24163478
has answer: http://stackoverflow.com/a/24312427
tagged with: web-services
has answer: http://stackoverflow.com/a/24163864
favorite count: 0
has comment: http://stackoverflow.com/comment/37638033
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24284698
upvote count: 3
score: 3
tagged with: java-war
answer count: 5
has answer: http://stackoverflow.com/a/24275909
has body: I have a large collection of different independent (stateless) web services written in Java and compiled as WAR files. I want to deploy them to a single web application server. If the URIs handled by the services in each WAR file began with a prefix I could use as a web app name, then this would be easy. I could, for instance, have SALES WAR FILE: contains code for the following: GET http://example.com/sales/widgets POST http://example.com/sales/widgets GET http://example.com/sales/sky-hooks MARKETING WAR FILE: contains code for the following: GET http://example.com/marketing/widgets PUT http://example.com/marketing/sky-hooks ...in which case I would simply deploy two WAR files under the names "sales" and "marketing". However, I am not that fortunate. Instead, the URI paths handled by the components overlap. Something like this: SALES WAR FILE: contains code for the following: GET http://example.com/widgets/sales POST http://example.com/widgets/sales GET http://example.com/sky-hooks/sales MARKETING WAR FILE: contains code for the following: GET http://example.com/widgets/marketing PUT http://example.com/sky-hooks/marketing My question is how (if at all) I can deploy these on a single web application server. I am open to suggestions that require a significant amount of work. For instance, my best-so-far idea is to build services that expect a component-name prefix before the regular URI path, then pipe all incoming traffic through a different server that knows what component each URI pattern falls into and modifies the URI to add that prefix. The difficulty with this approach is that tools like Swagger that read my source code will have a mistaken idea of what the URIs look like. Any ideas?
has answer: http://stackoverflow.com/a/24212068
has comment: http://stackoverflow.com/comment/37934253
tagged with: java
has comment: http://stackoverflow.com/comment/37924738
has title: Can I have multiple Java webapps with overlapping paths?
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37599583
type: UnansweredQuestion

http://stackoverflow.com/comment/37408185
score: 0
comment on: http://stackoverflow.com/q/24224092
type: Comment
type: QuestionComment
has text: thanks for the comment T.C.: i need help with learning concept of modular arithmetic to deal with big integer operation. Any reference will be appreciated. Thanks again :)

http://stackoverflow.com/comment/37400634
comment on: http://stackoverflow.com/q/24220268
has text: It doesn't. The runtime does.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37189747
comment on: http://stackoverflow.com/q/24108175
score: 0
type: QuestionComment
has text: Try to reduce the amount of code. It should be like two classes with two or three methods, each containing two lines. That helps to find the problem, for you and for us.
type: Comment

http://stackoverflow.com/q/24157713
has title: Naming Conventions - Enums with 'Type'-Postfix
tagged with: naming-conventions
tagged with: java
has answer: http://stackoverflow.com/a/36292453
possible better answer: http://stackoverflow.com/a/36292453
linked to: http://stackoverflow.com/q/3069743
has body: I am working at a java-project were every enum has a postfix 'Type', e.g. 'PassengerType.java'. Is this an appropriate naming convention, or should it better be 'Passenger.java'? The problem is that there is already a class 'Passenger.java' with a field PassengerType, denoting the 'type' of passenger. What naming scheme would you suggest?
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37282161
has answer: http://stackoverflow.com/a/24157884
accepted answer: http://stackoverflow.com/a/24157884
type: Question

http://stackoverflow.com/q/24260011
downvote count: 1
has answer: http://stackoverflow.com/a/24260068
has body: I have an enum declared like this: public enum Mode{ RUNNING("SytemRunning"), STOPPED("SystemStopped"), IDLE("tmpIdle"); public static String key; private Mode(String key){ this.key = key; } } Now, I want to get out the keys(SystemRunning, SystemStopped, tmpIdle) for this enum by reflection: Class&lt;?&gt; c = Class.forName("Mode"); Object[] objects = c.getEnumConstants(); // now this is not what I want, but almost for(Object obj : objects){ System.out.println("value : " + obj); } the output is: RUNNING STOPPED IDLE However, I'd like to have the Strings SystemRunning, tmpIdle etc.. Thank you very much in advance.
favorite count: 0
has comment: http://stackoverflow.com/comment/37476737
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/37476656
answer count: 3
tagged with: reflection
tagged with: java
linked to: http://stackoverflow.com/q/5316311
upvote count: 13
score: 12
type: Question
has answer: http://stackoverflow.com/a/49196092
accepted answer: http://stackoverflow.com/a/24260151
possible better answer: http://stackoverflow.com/a/24260068
has title: Get value of enum by reflection
has answer: http://stackoverflow.com/a/24260151

http://stackoverflow.com/comment/37401752
has text: In the catch block i defined like this `catch (Exception ex) { model.addAttribute("error", "failed"); result.reject("DUPKEY"); return "redirect:saveContact.do"; } ` and in the view i did `${error}` but its not printing anything, is it due to the redirect
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24208456
type: AnswerComment

http://stackoverflow.com/q/24177277
tagged with: macos
favorite count: 0
has body: I have pyDev installed on Eclipse, but I quit the eclipse without saving python module yesterday. The Eclipse got crashed when I tried to open it. So I download the eclipse and install again. The new one can open java project and class, but for python, it said that: Could not create the view: org.python.pydev.navigator.view No editor descriptor for id org.python.pydev.editor.PythonEditor What can I do now? I didn't find anything useful till now.
type: Question
has title: Eclipse on mac: crash after clicking the Eclipse icon, reinstall but can't create view for pyDev
type: UnansweredQuestion
tagged with: python
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37320337
answer count: 0
score: 1
tagged with: java
downvote count: 0
upvote count: 1

file-upload
tags question: http://stackoverflow.com/q/24197114
tags question: http://stackoverflow.com/q/24190962
tag name: file-upload
tags question: http://stackoverflow.com/q/24258539
type: Tag
tags question: http://stackoverflow.com/q/24185306
tags question: http://stackoverflow.com/q/24225854
tags question: http://stackoverflow.com/q/24205046
tags question: http://stackoverflow.com/q/24266308
tags question: http://stackoverflow.com/q/24113288

http://stackoverflow.com/a/24222318
upvote count: 1
has body: The instanceof operator compares an object to a specified type. You can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface. Read more Oracle Java Tutorial - The Type Comparison Operator instanceof Note: When using the instanceof operator, keep in mind that null is not an instance of anything. For example: String name = null; System.out.println((name instanceof String)); // prints false You might interested in Class#isAssignableFrom() Parent p = new Child(); System.out.println(p.getClass().isAssignableFrom(Parent.class)); // return false System.out.println(p.getClass().isAssignableFrom(Child.class)); // return true
answers question: http://stackoverflow.com/q/24221947
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37187969
has text: May be i would. If you can give me a valid reason
score: 1
type: Comment
comment on: http://stackoverflow.com/a/24107356
type: AnswerComment

http://stackoverflow.com/comment/37216601
score: 0
comment on: http://stackoverflow.com/q/24121020
has text: @Ean: the size of the set is 1. Also if I try a different collection like list.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37274242
has text: See this question: http://stackoverflow.com/questions/18693721/oval-shape-clipped-when-created-programmatically
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24152852

http://stackoverflow.com/comment/37429376
type: Comment
has text: If extending the existing serializer is the only option, I will go for that. Thanks for the example!
comment on: http://stackoverflow.com/a/24234133
type: AnswerComment
score: 0

http://stackoverflow.com/q/24132507
has body: I need to Scan Wifi Networks. How can i getRssi() of WiFi Scan Network (Not of connection wi-fi network) int level = WifiManager.calculateSignalLevel(wifi.getConnectionInfo().getRssi(), results.get(i).level); int difference = level * 100 / results.get(i).level;
favorite count: 0
type: Question
upvote count: 2
tagged with: rssi
type: UnansweredQuestion
has title: How to get WI-FI signal strength in percantage from Scan Network?
tagged with: android
downvote count: 0
score: 2
has answer: http://stackoverflow.com/a/24133120
tagged with: java
answer count: 1
tagged with: wifi

http://stackoverflow.com/q/24158190
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37282857
has answer: http://stackoverflow.com/a/24158308
has answer: http://stackoverflow.com/a/24158249
accepted answer: http://stackoverflow.com/a/24158249
upvote count: 1
has comment: http://stackoverflow.com/comment/37282767
linked to: http://stackoverflow.com/q/2818796
downvote count: 0
tagged with: string-concatenation
has answer: http://stackoverflow.com/a/24158260
possible better answer: http://stackoverflow.com/a/24158260
favorite count: 0
type: Question
has title: Android:String concatenation in Toast doesn't work
answer count: 5
score: 1
has comment: http://stackoverflow.com/comment/37283037
tagged with: android
tagged with: java
has body: I've designed an app, part of which requires me to display a toast based on how many input fields are left empty. Here's my code snippet- if ((isEmpty(firstName))||(isEmpty(lastName))||(isEmpty(Age))||(isEmpty(phoneNumber))) { String text="Following fields are empty:"; if ((isEmpty(firstName))||(isEmpty(lastName))){ text.concat("\nName"); } if ((isEmpty(Age))){ text.concat("\nAge"); } if ((isEmpty(phoneNumber))){ text.concat("\nPhone Number"); } Toast toast=Toast.makeText(this, text, Toast.LENGTH_SHORT); toast.show(); } Here isEmpty() returns True if the input field is empty, else it returns false. Now, I expected the output (when all fields are empty), to show Following fields are empty: Name Age Phone Number However, it only shows Following fields are empty: . Where's my mistake? RESOLVED- Instead of concat(), I used text+="name" and so on. But why didn't concat() work?
has answer: http://stackoverflow.com/a/24158317
has answer: http://stackoverflow.com/a/24158281
has comment: http://stackoverflow.com/comment/37282807
tagged with: toast
has comment: http://stackoverflow.com/comment/37282823

http://stackoverflow.com/q/24165591
has answer: http://stackoverflow.com/a/24165673
has title: AndEngine stop animated sprite when destination reached
answer count: 1
accepted answer: http://stackoverflow.com/a/24165673
type: Question
has body: I am working on an Android project using AndEngine. I have a working animated sprite that moves to a touched location on the screen. My issue is I can't seem to figure out how to stop the animation once the sprite reaches the destination. Here is my code for the movement and animation of the sprite. Thanks in advance for any help. Edit New Code--- @Override public boolean onSceneTouchEvent (Scene m_Scene, TouchEvent pSceneTouchEvent) { if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_UP) { float touchX = pSceneTouchEvent.getX(); float touchY = pSceneTouchEvent.getY(); float[] minerLoc = sprMiner.getSceneCenterCoordinates(); float minerX = minerLoc[0]; float minerY = minerLoc[1]; MoveModifier sprModifier = new MoveModifier(5, minerX, touchX, minerY, touchY) { protected void onModifierStarted(IEntity pItem) { super.onModifierStarted(sprMiner); // Start Walking Animation sprMiner.animate(new long[] {150, 150, 150, 150, 150, 150, 150, 150}, 0, 7, true); } protected void onModifierFinished(IEntity pItem) { super.onModifierFinished(sprMiner); //Stop Walking Animation sprMiner.stopAnimation(0); } }; sprMiner.registerEntityModifier(sprModifier); } return false; }
tagged with: android
tagged with: java
tagged with: animation
tagged with: andengine
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/37338648
type: Comment
score: 0
has text: Edit your question with more details on how you are opening the new view from the current view (post some code). Not sure I can make it any simpler than it is in the link but I can try.
type: QuestionComment
comment on: http://stackoverflow.com/q/24187483

http://stackoverflow.com/q/24223577
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24224197
answer count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/24223649
has answer: http://stackoverflow.com/a/24223649
has comment: http://stackoverflow.com/comment/37406871
has comment: http://stackoverflow.com/comment/37406911
type: Question
score: 0
has answer: http://stackoverflow.com/a/24223763
has title: Two smallest numbers in a set
has body: I am trying to find the two smallest numbers in a set WITHOUT USING ARRAYS. Here is the code: Scanner in = new Scanner(System.in); int N = in.nextInt(); int min = in.nextInt(); for(int i = 1; i &lt; N; i++){ int a = in.nextInt(); if(a &lt; min){ min = a; } } System.out.println(min); It find the smallest number but there is nothing about the second smallest number. How do I do that? Please, note that I am a complete beginner to Java so easy explanation and help will be much appreciated)
possible better answer: http://stackoverflow.com/a/24223645
has answer: http://stackoverflow.com/a/24223687
has comment: http://stackoverflow.com/comment/37406933
has answer: http://stackoverflow.com/a/24223645

http://stackoverflow.com/a/24249378
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24248757
has body: You can create your GUI with any IDE you like. There is no problem with Netbeans in this area. Netbeans, like any other editing tool, allows you perfectly well to create some class like i.e. MyModel that extends an AbstractTableModel, which has no GUI and you should use in order to separate your Model from the View and Controller that have a GUI. Your JTable will then automatically call getValueAt(row, col) and getRowCount() in order to show the tiny subset of your 1.000 or maybe 1.000.000 lines that need to be displayed. You must not necessarily load all 1000 records to any Vector or ArrayList. Just make getValueAt(row, col) read each row and return every column. There is a high probability that your user will not scroll down every time and will not ask the TableModel to provide anything more than the 40-60 lines that should be visible after the first rendering. This example shows the getValueAt, used on a scrollable ResultSet sr from a database: @Override public Object getValueAt(int row, int column) { try { sr.absolute(row + 1); // position your ResultSet. switch (column) { case 0: return sr.getInt("..."); case 1: return sr.getString("..."); case 2: return sr.getString("..."); case 3: return ...... default: return ("-"); } } catch (SQLException sex) { ........ } } This is what happens at the GUI side: Is the JTable. Since you use a TableModel it will show you the JTable only at runtime. Here is the place that allows you to bind your model to the auto-generated code of NetBeans. This is the instance of your model. You could also write something like "new MyModel()" here. The generated code is no monster either: ... jTable1.setModel(etb); jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jTable1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { myMouseClicked(evt); } }); jScrollPane1.setViewportView(jTable1); ...
upvote count: 2

http://stackoverflow.com/comment/37308561
comment on: http://stackoverflow.com/a/24131721
type: AnswerComment
score: 0
has text: Yes ultimately if you want to develop for iphone you will need mac software to at the least sign your builds. You can install OS X on a PC. See this other question http://stackoverflow.com/questions/644225/iphone-development-on-hackintosh
type: Comment

http://stackoverflow.com/comment/37480691
type: Comment
type: QuestionComment
has text: @Dinal Sorry, I'm beginer in android. Can you explain, what means "clean built". Before everything was ok
comment on: http://stackoverflow.com/q/24262222
score: 0

http://stackoverflow.com/a/24208353
downvote count: 0
score: 1
upvote count: 1
has body: public class ClassB&lt;A, B, C&gt; extends AnotherClass&lt;A&gt; {} Where: Generic A must extend ClassA&lt;A, B, C&gt; Generic B must extend ClassB&lt;A, B, C&gt; Generic C must extend ClassC&lt;A, B, C&gt;
type: Answer
answers question: http://stackoverflow.com/q/24208236

http://stackoverflow.com/q/24217213
has body: If I declare a list "myList" that I happen to know will only contain strings I can cast it to a List without any problems, what is actually going on behind the scenes to cast the list to a list of strings? List myList = new ArrayList(); List&lt;String&gt; myStringList = (List&lt;String&gt;) myList; If I create the list as list of objects I would assume that the same thing applies but I can no longer cast this back to a list of strings, what is the reason for this? List&lt;Object&gt; myObjList = new ArrayList&lt;Object&gt;(); List&lt;String&gt; myStringList = (List&lt;String&gt;) myObjList; // Can't do this!
tagged with: generics
favorite count: 0
type: Question
score: -1
answer count: 3
has comment: http://stackoverflow.com/comment/37395139
upvote count: 2
has answer: http://stackoverflow.com/a/24217279
tagged with: casting
has answer: http://stackoverflow.com/a/24217404
type: UnansweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37395210
has title: How casting of generics works Java
has answer: http://stackoverflow.com/a/24217367

http://stackoverflow.com/comment/37432293
type: QuestionComment
has text: You could also accomplish the same thing with `Files.copy(zips, outFile.toPath());`. See [here](http://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#copy-java.io.InputStream-java.nio.file.Path-java.nio.file.CopyOption...-).
comment on: http://stackoverflow.com/q/24227597
type: Comment
score: 0

http://stackoverflow.com/comment/37493795
has text: What error does it throw?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24246571

http://stackoverflow.com/q/24109871
answer count: 1
has title: Java: Accessing XML value as a new variable in another class
tagged with: http://stackoverflow.com/tag/xml
type: Question
has body: Java Programming I have a class WeatherAgent. The function of this class is to get the current temperature value and other parameters from a URL (XML code) from World weather online. My main question is; how to get the generated temperature value in class WeatherAgent into antother class (Boiler)? So, Accessing XML value in class WeatherAgent as a new variable in another class (class Boiler). package assignment_4; /* * imports of class WeatherAgent2 */ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /* *start class WeatherAgent2 */ public class WeatherAgent { private Document getDocument() { Document doc = null; try { URL url = new URL( "http://api.worldweatheronline.com/free/v1/weather.ashx?q=Eindhoven&amp;format=xml&amp;num_of_days=5&amp;key=87xdd77n893f6akfs6x3jk9s"); URLConnection connection = url.openConnection(); // Connecting to // URL specified doc = parseXML(connection.getInputStream()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return doc; } private Document parseXML(InputStream stream) throws Exception { DocumentBuilderFactory objDocumentBuilderFactory = null; DocumentBuilder objDocumentBuilder = null; Document doc = null; try { objDocumentBuilderFactory = DocumentBuilderFactory.newInstance(); objDocumentBuilder = objDocumentBuilderFactory.newDocumentBuilder(); doc = objDocumentBuilder.parse(stream); } catch (Exception ex) { throw ex; } return doc; } /* * get the temperature */ public double temperature() { Document doc = getDocument(); Node Temperature; Double temp = 0.0; NodeList forecast = doc.getElementsByTagName("temp_C"); for (int i = 0; i &lt; forecast.getLength(); i++) { Element element = (Element) forecast.item(i); NodeList list1 = (NodeList) element…
has answer: http://stackoverflow.com/a/24109922
type: UnansweredQuestion
score: 0
tagged with: agents
tagged with: java

http://stackoverflow.com/comment/37252676
score: 1
has text: show us your code so we can improve it
type: Comment
comment on: http://stackoverflow.com/q/24142059
type: QuestionComment

http://stackoverflow.com/comment/37472017
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24257256
type: Comment
has text: also see this http://developer.android.com/guide/webapps/webview.html#BindingJavaScript

http://stackoverflow.com/comment/37571916
has text: http://stackoverflow.com/questions/24230003/multiple-execution-of-a-processbuilder-in-a-java-program/24230302?noredirect=1#comment37508343_24230302 Code in the link is mine where either of this concepts should be used. Sorry I can't post the code here as it will be irrelevant to the question I have asked here. So please kindly look at the code and suggest me if I could use processbuilder or filehandler or threadpool as mentioned by one of the user in the below answers..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24264659
score: 0

http://stackoverflow.com/comment/123614707
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/67280233
has text: Although, if the all args constructor is not public/used, a way to fix #2 would be to add `buildMethodName = "someUglyName"`, and provide your own `build` which is based on `someUglyName`. i.e. it calls `someUglyName()`, performs/calls validations and returns the object

http://stackoverflow.com/q/24182593
has title: How to access Hive using Java API in DSE
has answer: http://stackoverflow.com/a/24398984
tagged with: datastax-enterprise
answer count: 2
type: UnansweredQuestion
score: 0
has body: I'm working on 5 node cluster with 2 cassandra,2 solr and 1 hadoop node on DSE 4.0.3 , I'm trying to connect Hive thru java api. Below is the program I'm trying to execute import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; public class HiveJdbcClient { private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"; /** * @param args * @throws SQLException */ public static void main(String[] args) throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(1); } Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", ""); Statement stmt = con.createStatement(); String tableName = "testHiveDriverTable"; stmt.executeQuery("drop table " + tableName); ResultSet res = stmt.executeQuery("create table " + tableName + " (key int, value string)"); // show tables String sql = "show tables '" + tableName + "'"; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); if (res.next()) { System.out.println(res.getString(1)); } // describe table sql = "describe " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(res.getString(1) + "\t" + res.getString(2)); } // load data into table // NOTE: filepath has to be local to the hive server // NOTE: /tmp/a.txt is a ctrl-A separated file with two fields per line String filepath = "/tmp/a.txt"; sql = "load data local inpath '" + filepath + "' into table " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); // select * query sql = "select * from " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(String.valueOf(res.getInt(1)) + "\t" + res.getString(2)); } // regular hive query sql = "select count(1) from " + tableName; System.…
tagged with: java
type: Question
tagged with: hive
has answer: http://stackoverflow.com/a/28863672

http://stackoverflow.com/q/24225158
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has body: I am having a lot of difficulty trying to install a TomCat server so instead of wasting time, is there anyway I can run some java server page code online? I am very short on time and need to compile this code below and find out whats wrong. if someone can lead me to a website that can compile JSP online, that would be excellent! Thank you for the help <TITLE>JSP Debugging <% import java.io.*; %> <% import java.util.Date; %> <% import java.util.Enumeration; %> <% response.setContentType("MIME"); Date today = new Date(12,20,2004); Date created = new Date(session.getCreationTime()); Date lastAccessed = new Date(session.getLastAccessedTime()); out.print(" Today is " ); out.print(today); out.print(" " ); out.print("This session has the following characteristics: " ); out.println(" ID: "); <%= session.getId(); %> out.println("Created: " + created); out.println("Last Accessed: " + lastAccessed); out.println(" Max Inactive Interval: " + session.getMaxInactiveInterval()); %>
has answer: http://stackoverflow.com/a/24225185
type: AnsweredQuestion
has title: Run .JSP file online
downvote count: 0
upvote count: 1
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/37410706
accepted answer: http://stackoverflow.com/a/24225185
favorite count: 0
type: Question
score: 1

http://stackoverflow.com/a/24149525
score: 0
has body: I wouldn't simulate an exception, I'd make something genuinely go wrong. You're using an in-memory database so you have control of your test data. Also it's a better test (less chance of bad assumptions invalidating your results) if you're recreating a real problem instead of faking out something. The easiest way to test your transaction would be to have the test create a B with data chosen so that the update will cause a referential integrity constraint to be violated (Do you have any not-null constraints? Otherwise you can introduce an invalid primary key value, by re-using an existing value). The RI violation will cause an exception to get thrown.
type: Answer
answers question: http://stackoverflow.com/q/24145758

http://stackoverflow.com/comment/37370962
type: QuestionComment
has text: These strings are from different files first one is downloaded as CSV so no unicode characters..and second one(currentRow) is downloaded in unicoded txt format and converted to CSV using dos2unix..
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24204423

http://stackoverflow.com/comment/37263668
comment on: http://stackoverflow.com/q/24147372
type: Comment
type: QuestionComment
score: 0
has text: @TrippKinetics Go back and read my question

http://stackoverflow.com/q/24257195
tagged with: concurrency
has title: Cached Thread Pool in Spring Framework
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24258505
tagged with: spring
favorite count: 0
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24258505
tagged with: threadpool
tagged with: java
answer count: 1
has body: My application uses Spring 3.0.5 Release. I have collection with 10000+ entities. As per my business requirement I need to traverse each property and bind to a pojo in get another collection. The function/process is handled by single request/thread. I came accross org.springframework.scheduling.concurrent.ConcurrentTaskExecutor. I tried implementing it. But compared to normal process latency it takes 2 fold of time.Think it is not reusing the thread. Each and every time its spawn a new thread consumes resource. So How can I implement cached thread pool of Java concurrency via Spring Framework.

http://stackoverflow.com/a/24168584
has comment: http://stackoverflow.com/comment/37319033
answers question: http://stackoverflow.com/q/24157092
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24157092
has body: Your issue is case sensitivity. StandardTokenizer includes a LowercaseFilter. WhitespaceAnalyzer does not. So, using StandardTokenizer your priority is indexed as "high", whereas it's indexed as "HIGH" by WhitespaceAnalyzer. This wouldn't be an issue for your query if it were being analyzed (ie. using a QueryParser), but there isn't going to be any analysis of your TermQuery. Try changing your query to: TermQuery termQuery = new TermQuery(new Term("priority", "high")); To see that in action.

mysql
tags question: http://stackoverflow.com/q/24263187
tags question: http://stackoverflow.com/q/24141930
tags question: http://stackoverflow.com/q/24211438
tags question: http://stackoverflow.com/q/24198032
tags question: http://stackoverflow.com/q/24217306
tags question: http://stackoverflow.com/q/24161416
tags question: http://stackoverflow.com/q/24247884
tags question: http://stackoverflow.com/q/24110264
tags question: http://stackoverflow.com/q/24187199
tags question: http://stackoverflow.com/q/24263744
tags question: http://stackoverflow.com/q/24264350
tags question: http://stackoverflow.com/q/24201485
tags question: http://stackoverflow.com/q/24135363
tags question: http://stackoverflow.com/q/24162481
type: Tag
tags question: http://stackoverflow.com/q/24177476
tags question: http://stackoverflow.com/q/24221721
tags question: http://stackoverflow.com/q/24264490
tags question: http://stackoverflow.com/q/24151026
tags question: http://stackoverflow.com/q/24225275
tags question: http://stackoverflow.com/q/24150255
tags question: http://stackoverflow.com/q/24121478
tags question: http://stackoverflow.com/q/24178570
tags question: http://stackoverflow.com/q/24210590
tag name: mysql
tags question: http://stackoverflow.com/q/24121637
tags question: http://stackoverflow.com/q/24257874
tags question: http://stackoverflow.com/q/24129764
tags question: http://stackoverflow.com/q/24163597
tags question: http://stackoverflow.com/q/24168223
tags question: http://stackoverflow.com/q/24188462
tags question: http://stackoverflow.com/q/24208029
tags question: http://stackoverflow.com/q/24205631
tags question: http://stackoverflow.com/q/24209130
tags question: http://stackoverflow.com/q/24229442
tags question: http://stackoverflow.com/q/24165920
tags question: http://stackoverflow.com/q/24145504
tags question: http://stackoverflow.com/q/24195642
tags question: http://stackoverflow.com/q/24118882
tags question: http://stackoverflow.com/q/24140785
tags question: http://stackoverflow.com/q/24259524
tags question: http://stackoverflow.com/q/24201349
tags question: http://stackoverflow.com/q/24151758
tags question: http://stackoverflow.com/q/24127176
tags question: http://stackoverflow.com/q/24186909
tags question: http://stackoverflow.com/q/24140540
tags question: http://stackoverflow.com/q/24148255
tags question: http://stackoverflow.com/q/24220844
tags question: http://stackoverflow.com/q/24208118
tags question: http://stackoverflow.com/q/24209754
tags question: http://stackoverflow.com/q/24219343
tags question: http://stackoverflow.com/q/24203686
tags question: http://stackoverflow.com/q/24225924
tags question: http://stackoverflow.com/q/24217656
tags question: http://stackoverflow.com/q/24228903
tags question: http://stackoverflow.com/q/24168217
tags question: http://stackoverflow.com/q/24113023
tags question: http://stackoverflow.com/q/24196627
tags question: http://stackoverflow.com/q/24161311
tags question: http://stackoverflow.com/q/24146089
tags question: http://stackoverflow.com/q/24171653
tags question: http://stackoverflow.com/q/24229917
tags question: http://stackoverflow.com/q/24196239
tags question: http://stackoverflow.com/q/24182627
tags question: http://stackoverflow.com/q/24211852
tags question: http://stackoverflow.com/q/24219383
tags question: http://stackoverflow.com/q/24138607
tags question: http://stackoverflow.com/q/24146661
tags question: http://stackoverflow.com/q/24196801
tags question: http://stackoverflow.com/q/24256319
tags question: http://stackoverflow.com/q/24182150
tags question: http://stackoverflow.com/q/24263003
tags question: http://stackoverflow.com/q/24198626
tags question: http://stackoverflow.com/q/24158432
tags question: http://stackoverflow.com/q/24180573
tags question: http://stackoverflow.com/q/24171508
tags question: http://stackoverflow.com/q/24107250
tags question: http://stackoverflow.com/q/24175714
tags question: http://stackoverflow.com/q/24164478
tags question: http://stackoverflow.com/q/24168588

http://stackoverflow.com/q/24163230
has comment: http://stackoverflow.com/comment/48757106
answer count: 2
possible better answer: http://stackoverflow.com/a/24168379
has answer: http://stackoverflow.com/a/24168379
downvote count: 0
upvote count: 1
tagged with: lucene
has comment: http://stackoverflow.com/comment/48728193
type: AnsweredQuestion
has title: Wikipedia Dump will become huge in Lucene?
score: 1
tagged with: java
tagged with: wikipedia
has body: Indexing Wikipedia Dump, which is a 35GB XML file, turns out to be huge in Lucene (see code below for an overview). After 100 articles, with fields not stored, i have ~35 MB indexing space used, which means for ~3.5 million articles, i use over 1.2 TB! How is this possible, given that the original file is only a tiny fraction of that size. Is this package that inefficient or is Lucene just having really large index storage needs? Am I overlooking something? I could only explain it if I assume that the first 100 articles from Wikipedia are unnaturally large and do not represent very much a normal article, in which case I would massively overestimating it. Can somebody tell me some numbers of how big their dump (indexed with Lucene) turned out and how long it took? Here the code: package example; import edu.jhu.nlp.wikipedia.*; import edu.jhu.nlp.language.Language; import org.apache.log4j.Logger; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.*; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.util.Version; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Date; import java.util.Vector; public class WikipediaTextFacetIndexer { protected String facetName = null; protected ConfigurationManager configManager = null; protected String contentFolder = null; protected String indexFolder = null; private static int counter = 0; public void index() { // true creates a new index / false updates the existing index boolean create = false; // check if data directory exists logger.debug("wikipedia dump file = " + contentFolder); final File wikipediaDumpFile = new File(contentFolder); if (!wikipedi…
accepted answer: http://stackoverflow.com/a/24909009
has comment: http://stackoverflow.com/comment/37292793
has answer: http://stackoverflow.com/a/24909009
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question

http://stackoverflow.com/q/24143683
answer count: 1
has body: I'm working on a project for work that requires me to ask some informations to the user, then write them down in a Word document. The thing is that I have to write those informations in a document that already exists, containing tables, checkboxes and so on... I tried using Apache POI, which is useful when it comes to creating a Word document, but does not seem to help me filling an existing one. How should I proceed ? What API should I use ? Thanks in advance for any help.
upvote count: 1
has comment: http://stackoverflow.com/comment/37255904
downvote count: 1
tagged with: ms-word
has answer: http://stackoverflow.com/a/24144341
favorite count: 0
linked to: http://stackoverflow.com/q/7431334
type: Question
has title: Write in an existing Word document using Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37257697
has comment: http://stackoverflow.com/comment/37256146
has comment: http://stackoverflow.com/comment/37280121
duplicate of: http://stackoverflow.com/q/203174
has comment: http://stackoverflow.com/comment/37255879
linked to: http://stackoverflow.com/q/15737169
linked to: http://stackoverflow.com/q/203174
score: 0
tagged with: apache-poi
tagged with: java

http://stackoverflow.com/comment/37433467
type: Comment
comment on: http://stackoverflow.com/a/24237321
score: 0
type: AnswerComment
has text: `for (int n = 0; n < board[m].length; n++) {` should be `for (int n = 0; n < board2[m].length; n++) {`, I think. Doesn't make a difference in this case, since the matrices are the same size, but I don't think that was intended code. I was probably misusing terminology... My apologies. Meant the termination condition for the loop.

http://stackoverflow.com/comment/37353740
score: 0
type: Comment
has text: The BACK button is not on a keyboard.
type: AnswerComment
comment on: http://stackoverflow.com/a/24194727

http://stackoverflow.com/a/24260874
type: Answer
has comment: http://stackoverflow.com/comment/37478530
answers question: http://stackoverflow.com/q/24260498
has body: Your current code won't work: OutputStream output = new OutputStream("SomePath"); ... won't compile because OutputStream is abstract. So somewhere you're going to need to tell the method what OutputStream to use. To make it more testable, make the stream a parameter. public void pullAndFlushData(OutputStream output, URI uri, Params params) { InputStream input = doHttpRequest(uri, params); IOUtils.copyLarge(input, output); output.flush(); output.close(); } Alternatively, output could be a field in the object, populated by the constructor or a setter. Or you could pass the object a factory. Whichever of these you choose, it means that the caller can take control of what kind of OutputStream is used -- for the production code, a FileOutputStream; for tests, a ByteArrayOutputStream. You may wish to review the decision to close() the OutputStream here - and instead do it in the same block as the OutputStream is opened. Now you can test it by having your unit test supply an OutputStream. @Test public void testPullAndFlushData() { URI uri = ...; Params params = ...; ByteArrayOutputStream baos = new ByteArrayOutputStream(); someObject.pullAndFlushData(baos, uri, params); assertSomething(..., baos.toByteArray()); } This doesn't use Mockito, but it's a good pattern for testing methods that use OutputStream. You could let Mockito mock an OutputStream and use it in the same way - setting expectations for the write() calls upon it. But that would become quite brittle about the way copyLarge() chunks the data. You could also use Mockito's spy() to check that calls were made to your real ByteArrayOutputStream. @Test public void testPullAndFlushData() { URI uri = ...; Params params = ...; ByteArrayOutputStream spybaos = spy(new ByteArrayOutputStream()); someObject.pullAndFlushData(spybaos, uri, params); assertSomething(..., spybaos.toByteArray()); verify(spybaos).flush(); // asserts that flush() has been called. } However, note that the Mockito team was quite reluctant to provide s…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24260498
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37478371

http://stackoverflow.com/q/24197350
has comment: http://stackoverflow.com/comment/37357832
has comment: http://stackoverflow.com/comment/37358966
has comment: http://stackoverflow.com/comment/37358319
has comment: http://stackoverflow.com/comment/37358085
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37358919
has comment: http://stackoverflow.com/comment/37357961
has comment: http://stackoverflow.com/comment/37357769
type: Question
has comment: http://stackoverflow.com/comment/37358150
has answer: http://stackoverflow.com/a/24201364
accepted answer: http://stackoverflow.com/a/24201364
has comment: http://stackoverflow.com/comment/37364222
has body: Is it possible to record data in android app and webservice at same time? I am trying to do this but if data is recording in android app data then not recording in webservice and if recording in webservice stops recording in android app? Thx in advance
answer count: 1
has title: Recording data in android app and web service at same time
has comment: http://stackoverflow.com/comment/37358271
has comment: http://stackoverflow.com/comment/37359122
has comment: http://stackoverflow.com/comment/37357859
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37358616
has comment: http://stackoverflow.com/comment/37358041
has comment: http://stackoverflow.com/comment/37362694

http://stackoverflow.com/a/24207310
score: 1
has comment: http://stackoverflow.com/comment/37375944
has comment: http://stackoverflow.com/comment/37375968
has comment: http://stackoverflow.com/comment/37376527
type: Answer
has body: If count can be modified, then you want a local variable. If you have multithreading going on, then you want a local variable. It's safest to create a local variable. However, it's not strictly necassary. In this case, it's overkill, since Strings are immutable anyway. The value of count can't even change. It's pretty much useless, which is why in Java 8 it looks like this: public int hashCode() { int h = hash; if (h == 0 &amp;&amp; value.length &gt; 0) { char val[] = value; for (int i = 0; i &lt; value.length; i++) { h = 31 * h + val[i]; } hash = h; } return h; } They don't even have count anymore, they're using value.length, where value is a final char array. They are doing char val[] = value, but that's just a reference and is strictly unnecassary. There might be some subtle microenhancement by using a local variable, or it might have been done for readability, but it's not necassary (and in my opinion less readable).
downvote count: 0
answers question: http://stackoverflow.com/q/24207236
has comment: http://stackoverflow.com/comment/37376663
upvote count: 1

http://stackoverflow.com/q/24252999
tagged with: java
tagged with: eclipse
has body: using iOS I sometimes like to call 2 functions at random a button press for example, I would use; So sometimes, the user would get (1) the other time (2) etc. if (arc4random() % 2 == 0) { // Do one thing (1) } else { // Do something else(2) } } How would I do this within Eclipse/java? In otherwords, what is the same statement but in a Java language?
has comment: http://stackoverflow.com/comment/37463749
has comment: http://stackoverflow.com/comment/37464988
duplicate of: http://stackoverflow.com/q/363681
answer count: 1
linked to: http://stackoverflow.com/q/901689
upvote count: 1
linked to: http://stackoverflow.com/q/363681
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24253072
type: AnsweredQuestion
score: 0
has title: arc4random equivalent for Java?
has answer: http://stackoverflow.com/a/24253072

http://stackoverflow.com/a/24263753
answers question: http://stackoverflow.com/q/24263517
type: Answer
has body: The way you have things it would be possible to derive a class from Ore and implement a public static function in that derived class that refers to size. This is one way in which size could be accessed prior to initialisation and the compiler is correctly identifying that. One fix would be to use a static initialiser block in Ore which initialises size, or set its value to a literal: protected static final float size = /*ToDo - a literal here*/;
score: 0

http://stackoverflow.com/q/24117008
possible better answer: http://stackoverflow.com/a/24117099
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24117107
accepted answer: http://stackoverflow.com/a/24117107
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37206088
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24117243
has comment: http://stackoverflow.com/comment/37205923
has comment: http://stackoverflow.com/comment/37206106
has title: Array Printf issue
has comment: http://stackoverflow.com/comment/37205906
has body: I'm working on simple program that is supposed to list the numeric values in an array; a certain way. This is how I would like to have the output look like: Printing Array: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 It has to be lined as seen above and line must only contain 10 numbers. I seem to have everything formatted correctly but my output doesn't look like that. Here is what I am getting: Printing Array: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 I'm not sure exactly what I'm doing wrong but here's my code: //disregard the name 'Juice', I like to give my programs weird names public class Juice { public static void main(String[] args) { //sets up the array int[] numbers = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22}; //title System.out.println("Printing Array: "); //counting the elements for (int i = 0; i &lt; numbers.length; i++) { //prints each element value with 4 spaces in between System.out.printf("%4d", numbers[i]); //once line reaches ten values; print new line if (i % 10 == 0) { System.out.printf("\n"); } } } }
tagged with: arrays
has answer: http://stackoverflow.com/a/24117130
has comment: http://stackoverflow.com/comment/37206391
has answer: http://stackoverflow.com/a/24117099
score: -1

http://stackoverflow.com/q/24225319
has comment: http://stackoverflow.com/comment/37410212
has comment: http://stackoverflow.com/comment/37410208
downvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has title: Android - How to make something happen without any events
tagged with: android
has answer: http://stackoverflow.com/a/24225511
linked to: http://stackoverflow.com/q/6242268
score: -1
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37410234
has body: after some time of programming I decided to download the Android SDK and see if I should start focusing on mobile development to start making money. At the moment I am just trying to get used to how the android works and up until now I have a basic understanding of the events and the way the xml files interact with the .java files. To learn I'm just trying to do tests of basic stuff and now I have something like this : TextView text = (TextView)findViewById(R.id.lol); number mnumber = new number(); mnumber.change_in_number(); text.setText(mnumber.get_in_number() + ""); Let me explain; number is a class I make which has an integer varibale inside, a function to get the value (get_in_number) and a function to change the integer variable to a random value (change_in_number). All of this functions work es intended for they are very simple but when I run the code this only happens once (as expected). My question now is... Exactly how would I make this code repeat itself every X amount of seconds? You know, to have the value changed multiple times without the need of any event while the application is running. I know this question is really simple and probably also easy to answer but right now I really need help with getting started. Thanks in advance for your help.
answer count: 1

http://stackoverflow.com/comment/37245026
comment on: http://stackoverflow.com/a/24137431
type: Comment
score: 0
type: AnswerComment
has text: hi , thanks for your answer , but for some reason when i set JPDA_ADDRESS to be IP:PORT (for exmple 192.168.10.168:8000) for some reason the server isn't start - and i can't see anything in the Catalina log (and when JPDA_ADDRESS contained only port everything is ok..) .

http://stackoverflow.com/q/24218802
has title: Eclipse Java printf issue PrintStream is not applicable
duplicate of: http://stackoverflow.com/q/7774428
tagged with: java
linked to: http://stackoverflow.com/q/5192161
has comment: http://stackoverflow.com/comment/37399211
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37399060
favorite count: 0
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/7774428
has comment: http://stackoverflow.com/comment/37400021
accepted answer: http://stackoverflow.com/a/24227906
downvote count: 0
has comment: http://stackoverflow.com/comment/37399323
score: 4
has comment: http://stackoverflow.com/comment/37398538
tagged with: printf
has comment: http://stackoverflow.com/comment/37399168
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24227906
has answer: http://stackoverflow.com/a/41894875
has body: I'm doing a intro to programming course and I'm having issues with my Eclipse that doesn't seem to want to run printf in even its simplest form. My code is: package Practice; import java.io.*; public class Printf { public static void main(String[] args) throws IOException { int num1 = 54; int num2 = 65; int sum = num1 + num2; System.out.printf("Sum of %d and %d is %d.", num1, num2, sum); } } The error is as saying The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int, int, int) I have the Java compiler compliance level set to 1.8 so it should have no issues as I have read in previous posts. Kepler version of Eclipse has had the Java 8 patch applied (so I could comply with 1.8) No site I have found has given me any other clues as to what the issue could be?
answer count: 3
has answer: http://stackoverflow.com/a/24220177
possible better answer: http://stackoverflow.com/a/24220177

http://stackoverflow.com/comment/37356314
comment on: http://stackoverflow.com/a/24174058
type: Comment
type: AnswerComment
has text: What value is `Rowc` when you get the exception? Maybe you have an extra blank line somewhere in the file. Like I mentioned before, if you're not absolutely sure of the format of your file, it's not a good idea to hard code your indexes.
score: 0

http://stackoverflow.com/comment/37382422
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24189667
type: AnswerComment
has text: Thanks for your tip. But UDP is the guideline. I don't have to love it but to accept.

http://stackoverflow.com/comment/37480996
score: 0
comment on: http://stackoverflow.com/q/24261593
type: Comment
type: QuestionComment
has text: can you share TrayUtilitiesDemo methods source

min
type: Tag
tag name: min
tags question: http://stackoverflow.com/q/24226086

http://stackoverflow.com/comment/37304750
comment on: http://stackoverflow.com/a/24168660
type: Comment
type: AnswerComment
has text: This is not the exact answer to what the problem was, but it is close enough that I'll accept it as the answer. Essentially, I think it was an issue with the order in which the styles were being applied, which is what your solution mentions in the first bullet point. What I ended up doing was defining a CSS class in the CSS file as normal, and then used a CSSResource extender with my ClientBundle and used the addStyleNames attribute/method in the UiBinder XML files to actually apply the style to the component. I hope this makes sense to whoever runs into this problem and finds this answer!
score: 0

http://stackoverflow.com/a/24239878
has body: How about this: int pos = 0; int maxPos = 0; for(String keyset: maxMin.keySet()){ pos = pos + 1; double values = maxMin.get(keyset); if (values &lt; min) { min = values; } if (values &gt; max) { max = values; maxPos = pos; } } Set&lt;Integer&gt; keySet = maxMin.keySet(); List&lt;Integer&gt; keyList = new ArrayList&lt;Integer&gt;(keySet); Integer key = keyList.get(maxPos);
has comment: http://stackoverflow.com/comment/37438336
has comment: http://stackoverflow.com/comment/37438393
upvote count: 1
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/24239769
score: 0

http://stackoverflow.com/a/24260351
upvote count: 1
has comment: http://stackoverflow.com/comment/37491289
has comment: http://stackoverflow.com/comment/37500394
type: Answer
accepted answer of: http://stackoverflow.com/q/24254152
has body: To change the channel of an event's message, use setMessage with a different channel parameter. Do this for all events in the track.
answers question: http://stackoverflow.com/q/24254152
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37412983
has text: Why don't you move the `pd.show` inside `onPreExecute` and dismiss it inside `onPostExecute`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24226260

http://stackoverflow.com/q/24130403
type: Question
has answer: http://stackoverflow.com/a/24130478
tagged with: java
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37231622
upvote count: 2
has title: Tomcat project folder what to do?
downvote count: 3
answer count: 1
has body: This question might sound stupid, but I am in trouble. A developer gave me a ready made application as is. I downloaded the zip file and found that it was not ready to use. So in the root folder I have te following: .settings Folder src Folder target Folder pom.xml File .classpath File .gitignore File .project File log.roo File .springBeans File I tried to deploy this folder in Tomcat Manager but nothing happend. Can you give an advice what to do, to get this working?
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/24130478
has comment: http://stackoverflow.com/comment/37231729
favorite count: 0

http://stackoverflow.com/q/24195777
type: Question
tagged with: resourcebundle
answer count: 2
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/24533285
has body: I thought I would use the new ResourceBundleControlProvider framework in Java 8 to fix something which Oracle themselves will never fix - the default encoding used when reading resource bundles. So I made a control: package com.acme.resources; import java.io.IOException; import java.util.Locale; import java.util.ResourceBundle; public class AcmeResourceBundleControl extends ResourceBundle.Control { @Override public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException { throw new UnsupportedOperationException("TODO"); } } Then I made a provider: package com.acme.resources; import java.util.ResourceBundle; import java.util.spi.ResourceBundleControlProvider; public class AcmeResourceBundleControlProvider implements ResourceBundleControlProvider { private static final ResourceBundle.Control CONTROL = new AcmeResourceBundleControl(); @Override public ResourceBundle.Control getControl(String baseName) { if (baseName.startsWith("com.acme.")) { return CONTROL; } else { return null; } } } Then in META-INF/services/java.util.spi.ResourceBundleControlProvider: com.acme.resources.AcmeResourceBundleControlProvider Then I just tried to run our application from IDEA and I find that it never loads my provider (otherwise the exception would be raised.) I have checked the names and they all seem to match up. I have checked the compiler output directory IDEA is using and it does contain the service file. I wrote a simple test program which just tries to look up the service: public static void main(String[] args) { for (ResourceBundleControlProvider provider : ServiceLoader.load(ResourceBundleControlProvider.class)) { System.out.println(provider.getClass()); } } This does print out one entry which is the name of my implementation class. So the issue is not in the service file. If I breakpoint inside ResourceBundle, I seem to be able to access the custom provider cla…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24533285
accepted answer: http://stackoverflow.com/a/26302773
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/26302773
has comment: http://stackoverflow.com/comment/37357581
has comment: http://stackoverflow.com/comment/37355750
has title: Why isn't my ResourceBundleControlProvider being loaded?
tagged with: internationalization
favorite count: 0

http://stackoverflow.com/comment/37391738
score: 0
comment on: http://stackoverflow.com/q/24215177
type: Comment
type: QuestionComment
has text: Not sure what exactly you are asking about. Is it [how to redirect from servlet to jsp page](http://stackoverflow.com/questions/13621998/how-to-redirect-from-servlet-to-jsp-page)?

http://stackoverflow.com/comment/37243375
type: Comment
score: 0
type: QuestionComment
has text: All these solutions involve stored procedure. I cannot change any code due to being the end of the project.
comment on: http://stackoverflow.com/q/24136223

http://stackoverflow.com/comment/37490588
type: AnswerComment
score: 0
has text: My project language language is Java
comment on: http://stackoverflow.com/a/24266432
type: Comment

http://stackoverflow.com/q/24221103
has body: I have a simple service: public class AccountService implements IAccountService { @Inject IAccountDAO accountDAO; } This class is provided by my module: @Module(library = true ) public class ServiceModule { @Provides @Singleton IAccountService provideAccountStoreService(IAccountDAO accountDAO) { IAccountService service= new AccountService(); //Somehow set the accountDAO inside service return service; } @Provides @Singleton IAccountDAO accountDAO provideAccountDAO() { return new AccountDAO(); } } Is there a way to have dagger do injection on "service" after I return it and before it's injected in some other object?
tagged with: dagger
type: AnsweredQuestion
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24222000
score: 1
upvote count: 1
answer count: 1
favorite count: 0
tagged with: dependency-injection
has title: Using injection inside a @Provides method in Dagger
accepted answer: http://stackoverflow.com/a/24222000
type: Question

facebook-android-sdk
tags question: http://stackoverflow.com/q/24149438
tags question: http://stackoverflow.com/q/24149499
type: Tag
tags question: http://stackoverflow.com/q/24149405
tag name: facebook-android-sdk

http://stackoverflow.com/q/24108084
tagged with: http://stackoverflow.com/tag/xml
tagged with: arraylist
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37189413
type: Question
type: UnansweredQuestion
has body: I have a class called StringArray and StringStringArray which are generated from XML-Schema files. The are defined like this: * &amp;lt;complexType name="stringArray"&gt; * &amp;lt;complexContent&gt; * &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &amp;lt;sequence&gt; * &amp;lt;element name="item" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/&gt; * &amp;lt;/sequence&gt; * &amp;lt;/restriction&gt; * &amp;lt;/complexContent&gt; * &amp;lt;/complexType&gt; * &amp;lt;complexType name="stringArrayArray"&gt; * &amp;lt;complexContent&gt; * &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &amp;lt;sequence&gt; * &amp;lt;element name="item" type="{http://jaxb.dev.java.net/array}stringArray" maxOccurs="unbounded" minOccurs="0"/&gt; * &amp;lt;/sequence&gt; * &amp;lt;/restriction&gt; * &amp;lt;/complexContent&gt; * &amp;lt;/complexType&gt; The classes are defined in the following way (classes are provided by the instructors of an exercise course): @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "stringArray", propOrder = { "item" }) public class StringArray { @XmlElement(nillable = true) protected List&lt;String&gt; item; public List&lt;String&gt; getItem() { if (item == null) { item = new ArrayList&lt;String&gt;(); } return this.item; } } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "stringArrayArray", propOrder = { "item" }) public class StringArrayArray { @XmlElement(nillable = true) protected List&lt;StringArray&gt; item; public List&lt;StringArray&gt; getItem() { if (item == null) { item = new ArrayList&lt;StringArray&gt;(); } return this.item; } } Now I need to add an object of type List&lt;String&gt; to an StringStringArray object. The situation looks like this: List&lt;List&lt;String&gt;&gt; listOfLists = new ArrayList&lt;List&lt;String&gt;&gt;(); StringArrayArray respond = new StringArrayArray(); ListIterator&lt;List&lt;String&gt;&gt; listIterator = listOfLists.li…
has title: Convert List<String> to a xml-schema type (defined as lists of strings)
has comment: http://stackoverflow.com/comment/37191187
tagged with: xsd
tagged with: type-conversion

http://stackoverflow.com/q/24220986
tagged with: string
accepted answer: http://stackoverflow.com/a/27569255
has comment: http://stackoverflow.com/comment/37402242
favorite count: 0
type: Question
downvote count: 3
tagged with: java
score: -3
has body: I did read the documentaion on String.split(delimiter) and it says that the return type is String[]. But I don't know how to take that return of String.split() and assign its elements to my receiving String[]. The simple-minded String[] z = stuff.split(" "); (where stuff is a String) does not work. It compiles fine, but the z ends up being some mumbo-jumbo with ampersands. Looks like toString of something, not like a String array. Please enlighten me. Thanks. UPADTE: Sorry for asking this. Of course it works. I knew too little at the time and was overwhelmed.
type: AnsweredQuestion
upvote count: 0
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/24221091
possible better answer: http://stackoverflow.com/a/24221091
has answer: http://stackoverflow.com/a/27569255
has title: Putting the return of String.split(delimiter) into a String[]

http://stackoverflow.com/comment/37464685
type: Comment
has text: In this sample why {"Coffee","Bread"} is not an answer where {1,4} is common? your requirement is some what not correct. think about it again.
type: AnswerComment
comment on: http://stackoverflow.com/a/24253171
score: 0

http://stackoverflow.com/a/29214118
has comment: http://stackoverflow.com/comment/52631009
downvote count: 0
answers question: http://stackoverflow.com/q/24116222
has comment: http://stackoverflow.com/comment/68937738
has comment: http://stackoverflow.com/comment/68928427
has body: Use @org.jboss.ejb3.annotation.Pool(value="myPoolName") annotation on the EJB referencing your custom pool as defined in the standalone.xml : <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES" /> <strict-max-pool name="mdb-strict-max-pool" max-pool-size="80" instance-acquisition-timeout="1" instance-acquisition-timeout-unit="MINUTES" /> <strict-max-pool name="myPoolName" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="SECONDS" /> [edit] without the annotation : Using the pool namespace (urn:ejb-pool:1.0) in jboss-ejb3.xml (jboss specific ejb descriptor) <p:pool> myEjbName <p:bean-instance-pool-ref>myPoolName</p:bean-instance-pool-ref> </p:pool>
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/24130154
tagged with: cryptography
has body: I'm confused as to why I need to specify an algorithm such as "AES" when generating a key for encryption, e.g... KeyGenerator kg = KeyGenerator.getInstance("AES"); It clearly is not used for specifying the size of the key since AES keys can be 128, 192, or 256-bits. That part would be done via init()... kg.init(256, new SecureRandom()); SecretKey key = kg.generateKey(); For what it's worth, the above example code was borrowed from http://android-developers.blogspot.de/2013/02/using-cryptography-to-store-credentials.html Furthermore, NIST FIPS-197 states... No weak or semi-weak keys have been identified for the AES algorithm, and there is no restriction on key selection. ...so that would lead me to believe that any 128, 192, or 256 bits could be used as a key. Clearly, specifying "AES" when I get a cipher instance, e.g... Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); ...is necessary to indicate the cipher algorithm to be use. I just don't get what the purpose of specifying it for the key generation does. Thanks.
tagged with: aes
has answer: http://stackoverflow.com/a/24131272
downvote count: 0
score: 7
upvote count: 7
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37231210
favorite count: 0
type: Question
tagged with: key-generator
has comment: http://stackoverflow.com/comment/37231154
type: UnansweredQuestion
tagged with: encryption
has title: What exactly does specifying "AES" as the algorithm in KeyGenerator.getInstance() do?

http://stackoverflow.com/a/24208091
accepted answer of: http://stackoverflow.com/q/24201168
type: Answer
has body: You selected the root node of your file <entries>. If you use appendChild on that node, your node will be appended as the last child of the root node, which is the expected behaviour. You actually want to wrap words inside the RegDef node with the w element, which is not a task as simple as the three lines of code you included in your example. For that you will need to: Select that node (there are many methods in the DOM, document.getElementsByTagName("RegDef") will give you a NodeList containing all of them. You can also use XPath. For each RegDef you will need to select all its descendant text nodes. If you use XPath an expression such as .//text() in the context of each RegDef will give you a list of those nodes. Each one may contain one or more "words", or even empty spaces and newlines. You can extract the words by splitting by spaces or punctuation marks or other characters that can be used as delimiters for a word. There are several tools for that in Java, including regular expressions. Finally, when you have isolated each individual "word", and eliminated the nodes you want to ignore, you can create a w element for each one, create a new text node containing the word, and append the text node as a child of that element. You will also have to set attributes. Perhaps you should use a smaller XML file to focus on your specific problem, and later adapt it to your real world example. You could start with something like this: String xml = " \n" + " This text have i node. \n" + " This text doesn't have i atribute. \n" + " "; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbf.newDocumentBuilder(); Document document = builder.parse(new InputSource(new StringReader(xml))); NodeList regDefNodes = document.getElementsByTagName("RegDef"); int size = regDefNodes.getLength(); for(int i = 0; i < size; i++) { Element regDef = (Element)regDefNodes.item(i); Element newRegDef = wrapWordsInContents(regDef, document); Element parent =…
answers question: http://stackoverflow.com/q/24201168
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/24255926
has body: import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { TextView textView; EditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn = (Button) this.findViewById(R.id.btnShowName); editText = (EditText) this.findViewById(R.id.editTextName); textView = (TextView) this.findViewById(R.id.textView); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { textView.setText(editText.getText().toString()); } }); } } and the 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" tools:context="com.geronimo.MainActivity" &gt; &lt;Button android:id="@+id/btnShowName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:text="Show Name" /&gt; &lt;TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@+id/btnShowName" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;EditText android:id="@+id/editTextName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@+id/textView" android:ems="10" android:inputType="textPersonName" android:text="Name" /&gt; &lt;/RelativeLayout&gt; This works for me.So i'd just say just check your imports once and maybe cross check with this code?
has comment: http://stackoverflow.com/comment/37469013
has comment: http://stackoverflow.com/comment/37498477
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24253296

http://stackoverflow.com/q/24191311
downvote count: 0
has comment: http://stackoverflow.com/comment/37775160
tagged with: google-play-services
has body: I'm making a Android game with LibGDX and I want to use the Google Play Game Services API but I can't get it working. Here's what happens when I try to login: 06-12 20:08:47.745: E/Volley(4046): [253] tk.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/115171141636978128288 06-12 20:08:47.846: E/SignInIntentService(4046): Access Not Configured. Please use Google Developers Console to activate the API for your project. 06-12 20:08:47.846: E/SignInIntentService(4046): ebw 06-12 20:08:47.846: E/SignInIntentService(4046): at dwp.a(SourceFile:146) 06-12 20:08:47.846: E/SignInIntentService(4046): at dfx.a(SourceFile:390) 06-12 20:08:47.846: E/SignInIntentService(4046): at dfx.a(SourceFile:371) 06-12 20:08:47.846: E/SignInIntentService(4046): at dex.a(SourceFile:719) 06-12 20:08:47.846: E/SignInIntentService(4046): at ecp.a(SourceFile:250) 06-12 20:08:47.846: E/SignInIntentService(4046): at com.google.android.gms.games.service.GamesSignInIntentService.onHandleIntent(SourceFile:389) 06-12 20:08:47.846: E/SignInIntentService(4046): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 06-12 20:08:47.846: E/SignInIntentService(4046): at android.os.Handler.dispatchMessage(Handler.java:102) 06-12 20:08:47.846: E/SignInIntentService(4046): at android.os.Looper.loop(Looper.java:136) 06-12 20:08:47.846: E/SignInIntentService(4046): at android.os.HandlerThread.run(HandlerThread.java:61) 06-12 20:08:47.846: E/LoadSelfFragment(9533): Unable to sign in - application does not have a registered client ID 06-12 20:08:47.846: W/SignInActivity(9533): onSignInFailed()... 06-12 20:08:47.846: W/SignInActivity(9533): ==&gt; Returning non-OK result: 10004 I checked if the app is linked and if the SHA1 key is the same between my keystore and in the Google Developers Console and I checked if I was been a tester of the app who was allowed to use the API. Now I don't know where to look for to get this working. Thank you for your help.
score: 3
tagged with: google-play-games
answer count: 0
upvote count: 3
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/92246400
has comment: http://stackoverflow.com/comment/45585425
favorite count: 0
type: Question
has title: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/xxxxx LibGDX Android
type: UnansweredQuestion
tagged with: libgdx

http://stackoverflow.com/comment/37197165
has text: What that code does is add the attribute to the `ServletContext`, which is like defining it as a variable that will live as long as the webapp.
comment on: http://stackoverflow.com/a/24111987
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24220192
accepted answer: http://stackoverflow.com/a/24220304
linked to: http://stackoverflow.com/q/10964882
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24220448
has answer: http://stackoverflow.com/a/24220304
score: 0
tagged with: java
has body: I have some problems making the exception do that i want!. I have created a servlet, which i want to handle all exceptions. My class building for this scenario that i need help too you see under here: Servlet: This exception handling is only for 1 method, try { completed = func.addNewOperator(userId, name, ini, cpr, password, role); }catch (Exception e) { Error = "There was a problem with database access"; response.sendRedirect("SystemError.jsp?Error_resultat=" + Error); } catch (IOException e) { Error = "Error found with connection"; response.sendRedirect("SystemError.jsp?Error_resultat=" + Error); } catch (RuntimeException e) { Error = "Error found with entered values"; response.sendRedirect("SystemError.jsp?Error_resultat=" + Error); } catch (Exception e) { Error = "Serious error found!"; response.sendRedirect("SystemError.jsp?Error_resultat=" + Error); The func.addNewOperator is called in my function class: Function: A small example from my function method you see under here: public boolean addNewOperator(String userId, String name, String ini, String cpr, String password, String role ) throws Exception { int id = Integer.parseInt(userId); } So lets say if it can't parse it to and integer, it should throws the exception to my servlet, but this is not working. I want to throw the exception to the servlet, and then the servlet should send a response to open SystemError.jsp with an error message as parameter. Can anyone see if i forgot something??
linked to: http://stackoverflow.com/q/6182771
type: Question
answer count: 2
tagged with: exception
has title: How to handle exception in my servlet correct
possible better answer: http://stackoverflow.com/a/24220448
tagged with: servlets

http://stackoverflow.com/comment/37320144
score: 0
comment on: http://stackoverflow.com/q/24177927
has text: Please show your code.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24219248
possible better answer: http://stackoverflow.com/a/24219491
favorite count: 0
has answer: http://stackoverflow.com/a/24229120
type: Question
accepted answer: http://stackoverflow.com/a/24229120
answer count: 2
has answer: http://stackoverflow.com/a/24219491
has body: The size of the text-file is 560 kilobytes and has about 24500 rows. Each row is added to a list. Maybe my phone is to old and slow? Phone-model: Samsung GT-S5570 with Android 2.3.4. It takes about 30 seconds or more to read it and I'm pretty sure that my algorithms outside the Reader-class is not the problem. Anyone else who has encountered a similar problem or has an idea of what the problem could be? public class Reader { public List&lt;String&gt; read(String file) { Context ctx = ApplicationContextProvider.getContext(); List&lt;String&gt; entries = new ArrayList&lt;String&gt;(); //Get res/raw text-file id. int resId = ctx.getResources().getIdentifier(file,"raw", ctx.getPackageName()); InputStream inputStream = ctx.getResources().openRawResource(resId); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream), 8192); try { String test; while (true) { test = reader.readLine(); if (test == null) break; entries.add(test); } inputStream.close(); reader.close(); } catch (IOException e) { e.printStackTrace(); } return entries; } }
has title: Reading text-file in res/raw, very slow. Using BufferedReader
type: AnsweredQuestion
downvote count: 0
upvote count: 1
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/a/24169775
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24169325
has body: Let's look at each step: byte[] hashedPassword= Utility.convertCharArrayToByteArray(password, null); The above converts the Unicode-16 characters to a byte-array using the default endcoding, probably WIN-1252 or UTF-8. Since the password contains nothing outside standard 7-bit ASCII, the result is the same for either encoding. hashedPassword = md.digest(hashedPassword); hashedPassword now refers to a completely different byte array containing the BINARY digest of the original password. This is a BINARY string and no longer represents anything in any character encoding. It is pure binary data. Utility.convertByteArrayToCharArray(hashedPassword, null); Now you attempt to "decode" the binary string as if it were encoded with the default character set, which will undoubtedly throw an exception. I suspect you really wanted to display either the hexadecimal representation of the digest, or maybe the base-64 version. In either case, what you have done will never work. Since you haven't explained what you want to accomplish, this is the best anyone can do.
answers question: http://stackoverflow.com/q/24169325
type: Answer
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/62664601
has text: Thanks. I even forgot that I asked this question on SO. :D :D
type: AnswerComment
comment on: http://stackoverflow.com/a/37576507
score: 0
type: Comment

xcode
tag name: xcode
tags question: http://stackoverflow.com/q/24191040
type: Tag
tags question: http://stackoverflow.com/q/24147871

http://stackoverflow.com/q/24224633
upvote count: 0
type: UnansweredQuestion
score: -3
tagged with: list
answer count: 2
tagged with: java
downvote count: 3
tagged with: bukkit
has body: im creating minecraft sectors system.. I want to get worldguard region what player is actually. All regions are saved into files like (Regions/region1.yml, region2.yml) Now my question is: How can i list all files in folder regions to String list? i need it to do something like this if(e.getregion.getiid.contains(list1) { //do something }
tagged with: file
has answer: http://stackoverflow.com/a/24224787
has title: If something name is one of file name
has answer: http://stackoverflow.com/a/24224882
favorite count: 0
type: Question

http://stackoverflow.com/a/28335240
type: Answer
answers question: http://stackoverflow.com/q/24203515
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/54245793
has body: If you use with AndroidAnnotation, add @UiThread to view treatment method. Note that the method should not be private.

http://stackoverflow.com/q/24169250
has comment: http://stackoverflow.com/comment/37313812
has comment: http://stackoverflow.com/comment/37304032
has body: On a fragment I got this: public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { CommentItem rowView = (CommentItem) list.getChildAt(firstVisibleItem); rowView.hola(); } Each listview row is a custom view called CommentItem, and I'm casting the row to this custom view. What I want is calling the method hola(), but I got the following error: 06-11 19:28:27.418: E/AndroidRuntime(12133): java.lang.NullPointerException 06-11 19:28:27.418: E/AndroidRuntime(12133): at com.devyanlab.qoment.fragments.CommentsFragment.onScroll(CommentsFragment.java:243) The line 243 rowView.hola();; I don't know for sure if that is the right way to get the row's view. Any thoughts?
favorite count: 0
tagged with: android-custom-view
type: Question
has comment: http://stackoverflow.com/comment/37303925
has title: NullPointerException error on trying to cast row's custom view
type: UnansweredQuestion
score: -2
tagged with: android
has comment: http://stackoverflow.com/comment/37304145
has comment: http://stackoverflow.com/comment/37304087
upvote count: 0
downvote count: 2
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24169320
tagged with: android-listview
has comment: http://stackoverflow.com/comment/37304477
tagged with: java
answer count: 1

http://stackoverflow.com/comment/37437218
type: AnswerComment
has text: @Kent fair enough. Editing in progress :)
comment on: http://stackoverflow.com/a/24239363
score: 0
type: Comment

http://stackoverflow.com/comment/37190175
has text: Add whole stactrace please!
comment on: http://stackoverflow.com/q/24108492
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24154443
answers question: http://stackoverflow.com/q/24154382
upvote count: 2
downvote count: 0
has body: offer returns immediately if queue is full; put in the same situation will wait until space becomes available and lockInterruptibly makes it possible to interrupt it
score: 2
type: Answer

http://stackoverflow.com/a/24233579
type: Answer
has comment: http://stackoverflow.com/comment/37426622
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37426036
answers question: http://stackoverflow.com/q/24233528
has comment: http://stackoverflow.com/comment/37426644
upvote count: 2
has comment: http://stackoverflow.com/comment/37426061
has body: Two problems: You're using the platform-default encoding in both C# and Java. That's almost always a bad choice. Specify the encoding explicitly in Java - UTF-8 is usually a good choice. (That's also the default for most .NET code.) You're ignoring the return value of Stream.Read; in general you should use that to work out how much data you've actually received. In this case, however, it would be a much better idea to use StreamReader: string text; // Uses UTF-8 implicitly using (var reader = new StreamReader(httpResponse.GetResponseStream()) { text = reader.ReadToEnd(); } The signedness of bytes in Java is irrelevant here. (Additionally, why are you using new String("test")? What do you think that will do over just using "test"?)

http://stackoverflow.com/a/24130520
has body: If you have an ordered list of date ranges. In pseudo code seeing as you don't appear to know which language you are going to use. end = 31/12/2008 foreach(DateRange d in ranges) { if d.end &gt;= end { if d.start &lt;= end + 1 end = d.end else // Gap found (end + 1 to d.start - 1) //break , return error? // or if you wanted to identify the all the gaps, perhaps // gaps.add(new DateRange(end +1, d.start - 1)) // end = d.end } } Certainly no need for adding 1 day at a time.
answers question: http://stackoverflow.com/q/24130045
score: 1
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/37398436
comment on: http://stackoverflow.com/a/24218736
score: 0
type: Comment
type: AnswerComment
has text: Something exactly like [my answer](https://stackoverflow.com/a/13635838/207421) there.

http://stackoverflow.com/comment/37465661
has text: How do i remove the reference to it? This is my question @ChiefTwoPencils
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24254001
score: 0

http://stackoverflow.com/comment/37312208
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24173161
has text: again, the answer is in the javadocs -> `Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).` The `List` is always - unless an exception is thrown - altered as result of the call, so there is no need to return anything.

http://stackoverflow.com/comment/37284634
has text: That was how I solved this problem some time ago. Did you recompile/repackage everything? I advice you to delete the whole `html/build` folder and do it again. I had the problem of it not getting cleaned up correctly and all changes I did, didn't apply after a rebuild because of that.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24155913
type: QuestionComment

http://stackoverflow.com/a/24241341
accepted answer of: http://stackoverflow.com/q/24241035
has comment: http://stackoverflow.com/comment/37441602
has comment: http://stackoverflow.com/comment/37442285
type: Answer
has comment: http://stackoverflow.com/comment/37441342
has body: You can use a do-while loop to achieve this: import java.util.Random; import java.util.Scanner; public class Main { public static int number, guess, tryCount, replay; public static int maxValue = 1; public static Scanner scan; public static Random rand; public static void main(String args[]) { scan = new Scanner(System.in); rand = new Random(); do { // start of do-while loop tryCount = 0; // reset tryCount System.out.print("Enter a maximum number: "); while(maxValue &lt; 2) { maxValue = scan.nextInt(); } number = rand.nextInt(maxValue); System.out.print("Guess a number from 1 to " + maxValue + ": "); while (guess != number) { guess = scan.nextInt(); tryCount++; if (guess &lt; 1) { System.out.print("Guess is not positive. Try again: "); } else if (guess &lt; number) { System.out.print("Too low! Try again: "); } if (guess &gt; maxValue) { System.out.println("Guess is higher than " + maxValue + ". Try again: "); } else if (guess &gt; number) { System.out.print("Too high! Try again: "); } } if (tryCount == 1) { System.out.println("Nailed it! It only took you 1 try!"); } else { System.out.println("Nailed it! It took you " + tryCount + " tries."); } do { // check the user's input System.out.println("Type 0 to play again. Type 1 to quit."); replay = scan.nextInt(); if (replay != 0 &amp;&amp; replay != 1) { System.out.println("Input not recognized."); } } while (replay != 0 &amp;&amp; replay != 1); } while (replay == 0); // end of do-while loop } } do-while loops are always executed at least once. The condition is checked at the end of the loop.
has comment: http://stackoverflow.com/comment/37441282
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37442190
answers question: http://stackoverflow.com/q/24241035
score: 0

http://stackoverflow.com/comment/37249423
type: QuestionComment
has text: @MCND I added the `-verbose -debug` parameters related output to the question.
comment on: http://stackoverflow.com/q/24138607
score: 0
type: Comment

http://stackoverflow.com/a/24116627
has body: You can change the base source directory for the project by opening the Properties for the project, go to Java Build Path and select the Source tab. Change src to be src/main.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24116326

http://stackoverflow.com/comment/37295767
has text: No problem. You could actually use OpenGL's GL_QUADS instead of GL_TRIANGLES to draw a cube, it would require less sides to draw (since a cube has 6 square sides instead of 12 triangle ones.) Just be sure to add vertices to the float arrays and change the buffer sizes - which by the way, 3*3*4 is 36, but your triangle2 array only has 9 values in. Doesn't it just need to be 3*3, or am I being dumb?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24164713
score: 0

http://stackoverflow.com/comment/37416392
comment on: http://stackoverflow.com/q/24228566
score: 0
type: Comment
type: QuestionComment
has text: seems your `mDb` is `null`

http://stackoverflow.com/q/24232034
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: user-interface
tagged with: eclipse
has body: I am working on a java project and I want to export it to a runnable jar file. This project has a GUI with several background images, and when I run it in eclipse with the images in my project folder it works, but when I try to export it to a jar, I get the following exception when running on cmd: javax.imageio.IIOException: can't read input file! I have tried moving my images to various places in the project to attempt to include them in the jar, and even then it didn't work. I'm using File objects with commands like final Image backgroundImage = javax.imageio.ImageIO.read(new File("background.png")); How do I make it so that I can still use the images (preferably changing as little code as possible)?
tagged with: jar
answer count: 1
accepted answer: http://stackoverflow.com/a/24232367
has comment: http://stackoverflow.com/comment/37422900
has answer: http://stackoverflow.com/a/24232367
has title: exporting runnable jar with eclipse, want to use image files
type: Question

fast-vector-highlighter
type: Tag
tag name: fast-vector-highlighter
tags question: http://stackoverflow.com/q/24191686

http://stackoverflow.com/q/24119701
tagged with: git
favorite count: 0
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24120082
accepted answer: http://stackoverflow.com/a/24120082
has body: I have recent migrated a Java EE project from 5 to 6, as this required quite a big overhaul I created a new EE6 skeleton project and copied most of the code across manually. I now have my working EE6 project (and an obsolete EE 5 project). I would like to keep my Git history, is there are recommended way to move the .git directory into the new project so that all the updates are picked up as a new commit? Or can I just copy the .git folder over? Or do I have to start from scratch and lose the history? Thanks, I am sure this must have been asked before but I have been unable to find any questions that relate
has title: Project migration to new directory - keeping Git history
type: AnsweredQuestion
downvote count: 0
upvote count: 1
score: 1
tagged with: java
answer count: 1
tagged with: github

http://stackoverflow.com/comment/37239113
type: QuestionComment
comment on: http://stackoverflow.com/q/24134372
has text: isTerminated was used to ensure all threads got terminate before creating a fresh threadPool in next iteration.Now we are waiting for shutdownNow to complete in 10 min if shutdown not complete in 15 min.Will there be any case where shutdownNow even not able to terminate?. Execute thread is a runnable class. how would we make sure if threads are interruptible..
score: 0
type: Comment

http://stackoverflow.com/comment/64904722
score: 1
comment on: http://stackoverflow.com/a/24107430
type: Comment
has text: You can get Project Explorer by Window > Show View > Project Explorer
type: AnswerComment

http://stackoverflow.com/comment/37242908
has text: what piece of code is not working? Can you provide more information?
comment on: http://stackoverflow.com/q/24136664
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24240084
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24239791
has comment: http://stackoverflow.com/comment/37441973
score: 0
has comment: http://stackoverflow.com/comment/37441559
type: Answer
has comment: http://stackoverflow.com/comment/37440982
has comment: http://stackoverflow.com/comment/37440202
has body: Will you be distributing them separately? If not you don't need to dynamically load the jars or reflect them. Your app can reference all jars. Here is the dependencies you could have: |Application Jar | ↓ ↓ ↓ ↓ |Region 1 Jar| |Region 2 Jar| ↓ ↓ ↓ |Core Jar | Core Jar is region agnostic but has one or more interfaces for what it requires from a region. Region jars have classes that implement those core interfaces and the Application jar is responsible for constructing the right region classes and plugging it all together. If the Regions are outside of your control, and they can't depend on Core or implement it's interfaces you can use adapters: |Application Jar | ↓ ↓ ↓ ↓ |Region 1 Jar Adapter| |Region 2 Jar Adapter| ↓ ↓ ↓ ↓ |Core Jar | ↓ ↓ |Region 1 Jar| |Region 2 Jar| Here Region 1 and Region 2 are anything you like, they have no dependencies. Only one package has a dependency on them, and that is it's adapter package. The Adapter supports a core interface and knows how to translate the calls to the underlying Region Jar. The application is identical to the previous situation.
answers question: http://stackoverflow.com/q/24239791

http://stackoverflow.com/q/24207887
type: Question
answer count: 2
has body: Hello I have a JTable and there a 3 radio buttons at the bottom when the user clicks the buttons I want the JTable to only show certain rows for that button. I've tried deleting the rows when the button is pressed but I get an error when i click the other button that re-adds them. Is there anyway I can just hide the rows when the button is pressed and show them when the other button is pushed?
downvote count: 0
possible better answer: http://stackoverflow.com/a/24208017
upvote count: 1
tagged with: swing
has title: how to display certain rows in JTable
accepted answer: http://stackoverflow.com/a/24207995
has answer: http://stackoverflow.com/a/24208017
tagged with: jtable
has answer: http://stackoverflow.com/a/24207995
type: AnsweredQuestion
tagged with: java
score: 1
favorite count: 0

http://stackoverflow.com/comment/37199757
score: 0
type: Comment
has text: @PatriciaShanahan That's a good point... I was intending for the "return x, then increment x by 1" be taken as a "single instruction", as it is, but I admit my wording is misleading. Thanks for the clarification! Interesting to learn that that is the reason behind the undefined behavior in C... Wonder why it wasn't cleared up later. Maybe to allow optimizations? I've heard optimizing compilers love undefined behavior
type: QuestionComment
comment on: http://stackoverflow.com/q/24113263

http://stackoverflow.com/a/24129438
has comment: http://stackoverflow.com/comment/37239948
type: Answer
answers question: http://stackoverflow.com/q/24125224
score: 0
has comment: http://stackoverflow.com/comment/37240410
has comment: http://stackoverflow.com/comment/37241982
has body: Based on the java code you pasted the error is this: You are calling MySQL and printing "starting query ....", the one of two things happen: either the query works, and you see the "finished query ..." or an exception is thrown and the "finished query ..." is skipped and the execution goes to the code that handles the exception. What kinds of exceptions would cause this: if the selectQuery is something that is modified dynamically then it could be a malformed query exception. if the selectQuery is not dynamic and it works, it could be its parameters. If the selectQuery is good and the parameters are good than it could be a connection timeout issue: your sql is taking longer than the time set in the java connection. To know for sure you have to print the stacktrace of the exception in the "catch/finally" block. It will reveal to you what the problem was. A simple google search with the cause of the problem should tell you how to fix it.

http://stackoverflow.com/q/24138049
type: AnsweredQuestion
tagged with: drag-and-drop
tagged with: java
tagged with: eclipse
type: Question
score: 0
has body: I have created a custom view on Eclipse and defined a drag and drop listener for it. When I drag items from my view onto the native Java editor (using TextTransfer as the mechanism), the text successfully gets pasted on the editor. However, when I try to do the opposite i.e. when I select a piece of text from the Java editor and drag it to my view, then the cursor shows an invalid sign and the drop doesn't work as expected. The Drop Target is also set to accept TextTransfer instances. When I have two Java editors open and I drag text from one to the other, it works perfectly. Why does it not work when I drag the text onto my view? I overrode the dragEnter function of the DropTargetAdapter in my view to check if the drag was being detected and it was. After printing the event.datatypes, I can also see the CF_TEXT type being supported. When I print the event.data, however it is null. Why? Code is below: viewDropTargetAdapter = new DropTargetAdapter() { @Override public void drop(DropTargetEvent event) { addCodeSnippetAction.run(); } @Override public void dragEnter(DropTargetEvent event) { System.out.println("DATATYPE: " + event.currentDataType); System.out.println("DATA: " + event.data); System.out.println("DETAIL: " + event.detail); TransferData[] td = event.dataTypes; for(int i=0; i&lt;td.length; i++) { System.out.println("Datatype of " + i + " is: " + td[i].type + " and " +getNameFromId(td[i].type)); } super.dragEnter(event); } }; viewDropTarget = new DropTarget(viewer.getControl(), DND.DROP_COPY); viewDropTarget.setTransfer(new Transfer[] {TextTransfer.getInstance()}); viewDropTarget.addDropListener(viewDropTargetAdapter); Output is below: DATATYPE: org.eclipse.swt.dnd.TransferData@77f5c2c7 DATA: null DETAIL: 0 Datatype of 0 is: 13 and CF_UNICODETEXT Datatype of 1 is: 1 and CF_TEXT
has title: Eclipse Plugin - Dragging text from Java editor onto custom viewer always gets null data
tagged with: swt
answer count: 1
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/24138268
accepted answer: http://stackoverflow.com/a/24138268

http://stackoverflow.com/q/24125786
type: Question
has body: I get following error when I try use my DAO. I don know where is problem. I please for help. Error look like this: Request processing failed; nested exception is org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here This is my POJO class: @Entity @Table(name = "contacts") public class Customer { @Id @Column(name="ID") @GeneratedValue private Integer id; @Column(name="firstname") private String name; @Column(name="lastname") private String surname; @Column(name = "telephone") private String telephoneNumber; @Column(name = "email") private String email; DAO class: @Repository public class CustomerResource implements DAO_INTERFACE { @Autowired private SessionFactory sf; @Override public void addCustomer() { } @Override public List<Customer> getList() { return sf.getCurrentSession().createQuery("from Customer").list(); } @Override public void delete(int id) { } } Service: @Service public class CustomerService implements CustomerDatabaseInterface { @Autowired private DAO_INTERFACE customerRepo; @Transactional public List<Customer> getCustomers() { return customerRepo.getList(); } } servlet-context.xml: <resources mapping="/resources/**" location="/resources/" /> <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <beans:property name="prefix" value="/WEB-INF/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> <context:component-scan base-package="pl.project" /> </beans:beans> root-context.xml: org.hibernate.dialect.MySQLDialect true pl.project.model.Customer <tx:annotation-driven/> Error log : cze 09, 2014 7:31:39 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_05\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NV…
has answer: http://stackoverflow.com/a/31561443
has comment: http://stackoverflow.com/comment/37223593
tagged with: spring
has title: Hibernate and Spring MVC. Transaction not working
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24130028
has comment: http://stackoverflow.com/comment/51079016

http://stackoverflow.com/comment/37356949
comment on: http://stackoverflow.com/a/24186406
has text: that pretty much sums it up - I cannot live without get() (in my use case), whereas I wanted to avoid it for a variety of reasons.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24213345
score: 0
has comment: http://stackoverflow.com/comment/37419698
has comment: http://stackoverflow.com/comment/37401678
has comment: http://stackoverflow.com/comment/37758167
has comment: http://stackoverflow.com/comment/37418880
has comment: http://stackoverflow.com/comment/37388409
has body: Your code is not easy to read and there is a lot... so I'm not sure but it seems that the problem is the following : In the BiftorStartRecording , if, for some reason, an exception occurs : you set recorder = null; (look in the catch blocks of the BiftorStartRecording method). Then, the onReceive is called (i.e. your broadcast receive a message) : under some condition BiftorStopRecording is called from the onReceive. BiftorStopRecording try to invoke something on the recorder, but the recorder is now null due to previous exception. How to fix ? start by cleaning your code take care of the lifecycle of your recorder object (currently created when the service is instanciated, and set to null when an exception occurs : that's not good) Hope it helps. Try this : public void BiftorStopRecording() { if(!EnableCallRecording)return; if(recording==true) { if(recorder!=null){ //add this check recorder.stop(); recorder.reset(); recorder.release(); recorder=null; } //add this closing bracket too recording=false; SendBroadcastIntent(); SendNotification(false); CheckOutPutFile(OutFile); } else { recorder=null; recording=false; SendNotification(false); CheckOutPutFile(OutFile); } //prepare a new recorder for next call recorder = =new MediaRecorder(); }
has comment: http://stackoverflow.com/comment/37447435
has comment: http://stackoverflow.com/comment/37638552
has comment: http://stackoverflow.com/comment/37756198
has comment: http://stackoverflow.com/comment/37419159
has comment: http://stackoverflow.com/comment/37637273
type: Answer
has comment: http://stackoverflow.com/comment/37418782
has comment: http://stackoverflow.com/comment/37418895
has comment: http://stackoverflow.com/comment/37445015
has comment: http://stackoverflow.com/comment/37388714
has comment: http://stackoverflow.com/comment/37418670
answers question: http://stackoverflow.com/q/24212490

http://stackoverflow.com/q/24238461
score: 2
upvote count: 2
has title: How can I Rewrite .xlsm file using Apache POI?
tagged with: apache-poi
downvote count: 0
tagged with: java
answer count: 1
favorite count: 0
type: Question
tagged with: xlsm
has body: I am using this code to rewrite xlsm files using Apache POI. I have to rewrite data on Sheet1 from resultset, this code creates copy of template xlsm file and does all the processing. But when I open the created xlsm file it shows me this message: We found a problem with some content in 'FileName.xlsm'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, Click Yes. Here is my code, please suggest what I should do. public void dbConnect(String driver_connect_string, String db_connect_string, String db_userid, String db_password){ try{ Class.forName(driver_connect_string); Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password); System.out.println("connected"); Statement statement = conn.createStatement(); Properties propq = new Properties(); FileInputStream fisq = new FileInputStream("query.properties"); propq.load(fisq); String queryString = propq.getProperty("myQueryString"); ResultSet rs = statement.executeQuery(queryString); Properties propf2 = new Properties(); FileInputStream fisf2 = new FileInputStream("file.properties"); propf2.load(fisf2); OPCPackage pkg = OPCPackage.open(new File(propf2.getProperty("sourceFile"))); XSSFWorkbook wb_template; wb_template = new XSSFWorkbook(pkg); System.out.println("package loaded"); SXSSFWorkbook wb = new SXSSFWorkbook(wb_template); wb.setCompressTempFiles(true); Sheet sheet = wb.getSheetAt(0); Row rowhead = sheet.createRow((short) 0); rowhead.createCell((short) 0).setCellValue("EmpId"); rowhead.createCell((short) 1).setCellValue("EmaName"); rowhead.createCell((short) 2).setCellValue("Department"); rowhead.createCell((short) 3).setCellValue("Job Title"); rowhead.createCell((short) 4).setCellValue("DOB"); int index = 1; while (rs.next()) { Row row = sheet.createRow((short) index); row.createCell((short) 0).setCellValue(rs.getString(1)); row.createCell((short) 1).setCellValue(rs.getString(2)); row.createCell((short) 2).setCellValue(rs.getString(3)); row.…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24277662

http://stackoverflow.com/a/24174294
type: Answer
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24174268
has body: That sounds more like a problem of a corrupted Java installation. Check the JAVA_HOME environment variable. If this is empty fix this and try again. To delete eclipse and the sdk just delete them from where you installed them.

http://stackoverflow.com/comment/37277277
type: QuestionComment
comment on: http://stackoverflow.com/q/24154923
has text: `The mistake I have made is that I have put all my components directly on the jframe rather than a jpanel` - that is correct, it is a mistake. You know the solution, there is no easy way out. Add the components to a panel and add the panel to the viewport of the scroll pane. Then add the scroll pane to the frame.
score: 2
type: Comment

catalina
tag name: catalina
tags question: http://stackoverflow.com/q/24122883
type: Tag

http://stackoverflow.com/comment/37228163
has text: I wasn't aware I could store it as a resource without requiring a permission to read/write. Thanks for that.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24128006
type: Comment

http://stackoverflow.com/q/24260709
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24260795
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24260795
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/24260787
has title: Cannot append new line string to a file Android local storage
has answer: http://stackoverflow.com/a/24260787
has body: I am saving some csv to a file on the local android storage.I want to append new lines to existing csv file but my code overwrites the previous data and I can see just a single line of csv text.Please guide where I am going wrong.Here is my current code. private void saveLogFile(Long activityTimestamp, Long currentTime, Integer activityType) { if (activityTimestamp != null &amp;&amp; currentTime != null &amp;&amp; activityType != null) { File dir = new File(Environment.getExternalStorageDirectory() .getAbsolutePath() + "/ACTIVITY_RECOGNITION"); dir.mkdirs(); File myFile = new File(dir, "activity_log.csv"); try { if (!myFile.exists()) { myFile.createNewFile(); } if (myFile.exists()) { CSVWriter writer = new CSVWriter(new FileWriter(myFile)); //List&lt;String[]&gt; data = new ArrayList&lt;String[]&gt;(); //data.add(new String[] { activityTimestamp.toString(),currentTime.toString(), activityType.toString() }); String[] data={ activityTimestamp.toString(),currentTime.toString(), activityType.toString() }; writer.writeNext(data); writer.close(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Log.d("saveLogFile", "some data is null"); } }
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/q/24141227
has comment: http://stackoverflow.com/comment/37251206
has comment: http://stackoverflow.com/comment/37251256
answer count: 4
tagged with: for-loop
has answer: http://stackoverflow.com/a/24141335
score: 2
type: AnsweredQuestion
upvote count: 3
has title: Which manner of processing two repetative operations will be completed faster?
has body: Generally speaking, is there a significant differance in the processing speeds of these two example segments of code, and if so, which should complete faster? Assume that "processA(int)" and "processB(int)" are voids that are common to both examples. for(int x=0;x&lt;1000;x++){ processA(x); processB(x); } or for(int x=0;x&lt;1000;x++){ processA(x); } for(int x=0;x&lt;1000;x++){ processB(x); } I'm looking to see if I can speed up one of my programs and it involves cycling through blocks of data several times and processing it differant ways. Currantly, it runs a seperate cycle for each processing method, meaning a lot of cycles get run in total, but each cycle does very little work. I was thinking about rewriting my code so that each cycle incorporates every processing method; in other words, much fewer cycles, but each cycle has a heavier workload. This would be a very intensive rewrite of my program stucture. So unless it would give me a significant performance boost, it won't be worth the trouble.
possible better answer: http://stackoverflow.com/a/24141333
accepted answer: http://stackoverflow.com/a/24141491
has answer: http://stackoverflow.com/a/24141458
downvote count: 1
has answer: http://stackoverflow.com/a/24141491
has answer: http://stackoverflow.com/a/24141333
favorite count: 0
tagged with: performance
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37252213
has comment: http://stackoverflow.com/comment/37251934

http://stackoverflow.com/q/24110024
type: Question
has title: How to get coordinates for a bounding box
type: UnansweredQuestion
tagged with: yelp
has answer: http://stackoverflow.com/a/24351305
has body: I am trying to use the Yelp API's bounding box method: http://www.yelp.com/developers/documentation/v2/search_api#searchGBB I want the bounding box to be the entire US. and I used the following coordinates for it: request.addQuerystringParameter("bounds", "38.266224,-122.541803"+"|"+"44.018501,-72.092587"); However, the API isn't finding business across the US. Am I doing something wrong? Should I be choosing other coordinates?
score: 0
tagged with: java
answer count: 1
tagged with: geolocation
has comment: http://stackoverflow.com/comment/37201307
tagged with: latitude-longitude

http://stackoverflow.com/comment/37350196
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24192157
score: 1
has text: It's not that difficult. I'll try to write it in my answer.

char
tags question: http://stackoverflow.com/q/24266628
tags question: http://stackoverflow.com/q/24156327
tag name: char
tags question: http://stackoverflow.com/q/24155459
tags question: http://stackoverflow.com/q/24211216
type: Tag
tags question: http://stackoverflow.com/q/24221208
tags question: http://stackoverflow.com/q/24264997

http://stackoverflow.com/comment/37317045
score: 0
type: AnswerComment
has text: Yup. It's right there, inside the while loop: writer.close();
comment on: http://stackoverflow.com/a/24176175
type: Comment

cognos-tm1
type: Tag
tag name: cognos-tm1
tags question: http://stackoverflow.com/q/24123363

http://stackoverflow.com/comment/37340322
has text: Depending on if I'm thinking the same thing as you, it actually wouldn't, if you did `test(new Child())`. If you assigned `new Child()` to an `Object` and passed that, I think it would.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24188748

http://stackoverflow.com/a/24165588
answers question: http://stackoverflow.com/q/24165492
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37296896
downvote count: 0
type: Answer
has body: The input is taken only once, the first time! Therefore the loop always returns the same result. You should duplicate the getting input code inside the loop! Scanner sChoice = new Scanner(System.in); char choice = ''; while (choice != 'q') { switch (choice) { case 'c': nastybat.checkStats(); break; . . . . . choice = sChoice.next().charAt(0); The first line gets input for the first switch run, and the one inside the loop gets the rest. UPDATE: The choice = sChoice.next().charAt(0); should be place at the final of the loop, if not, as @proskor says, when user hits 'q' the program will return an 'invalid entry'.

http://stackoverflow.com/comment/37194426
has text: You should edit your question to add that paragraph back in, then.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24110034

http://stackoverflow.com/comment/37641219
type: AnswerComment
has text: @user3580294, I added one more paragraph clarifying `hashCode()` calls via Base.hashCode() -- they are effectively `Object.hashCode()` as `Base` doesn't have `hashCode()`. I thought that was perfectly clear. So between JDK and calipher framework there would be really a lot of classes defining `hashCode()` so the call is a Object.v-call. If you have only one class with hashCode and the compiler can treat as NOT java.lang.Object it'd be obviously a static call. That's the last comment here.
comment on: http://stackoverflow.com/a/24341846
type: Comment
score: 2

http://stackoverflow.com/comment/37311358
type: Comment
has text: Try compiling both java files javax Check.java GridLayout3x3.java
comment on: http://stackoverflow.com/q/24172755
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37436878
type: Comment
type: AnswerComment
has text: The code is incomplete, but this is the way to go. Have a custom comparator that can compare two segments, two camps or a mix by comparing the dates then `Collections.sort(segmentAndCampList, new SegmentAndCampComparator())`
score: 0
comment on: http://stackoverflow.com/a/24239207

http://stackoverflow.com/comment/37483396
has text: alright i've got nothing for you then.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24262955

http://stackoverflow.com/q/24142079
has body: I make a movie theater with JButtons, and I keep them in a JPanel. In my txt, I have 0 and 1. I read digit and put it to arraylist. When I setBackground() my JButtons if came 0 I set green, if came 1 I set red. But when code run all of them are green. How can I fix that? I try repaint and dispose. But it didn't work. if(controls.get(n) == 0){ button.setBackground(Color.GREEN); // repaint(); // dispose(); } if(controls.get(n) == 1){ // button.setBackground(Color.RED); repaint(); // dispose(); } n++;
downvote count: 1
favorite count: 0
type: Question
tagged with: jframe
has answer: http://stackoverflow.com/a/24142219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37252847
score: -1
has comment: http://stackoverflow.com/comment/37270270
has comment: http://stackoverflow.com/comment/37252843
has comment: http://stackoverflow.com/comment/37252765
has comment: http://stackoverflow.com/comment/37253881
has comment: http://stackoverflow.com/comment/37253789
has title: How can i access from txt to jbutton
has comment: http://stackoverflow.com/comment/37252827
upvote count: 0
tagged with: java
answer count: 1
tagged with: swing

http://stackoverflow.com/q/24157734
type: Question
has comment: http://stackoverflow.com/comment/37282157
has comment: http://stackoverflow.com/comment/37283754
has title: Tomcat couldn't see servlet
has comment: http://stackoverflow.com/comment/37292871
has body: When I run my webapp with Netbeans it works perfectly, but I can't everytime for using this webapp open netbeans and run it. I download netbeans with apache tomcat, and with netbeans it works fine. But then when i need to run tomcat separately, i have problems. I run it, open webb app manager, deploy war file of my project. Then i try to run it, so i have first index.jsp page without problem, then it should do smth in servlet pages, this things doesn't work. So tomcat couldn't see servlet. I know that problem may be because I don't have web.xml file, it wouldn't generated automatically, because of mine is servlet 3.0 or smth, so i have this annotations @WebServlet(name = "zakaz", urlPatterns = {"/zakaz"}) but it still doesn't work. I can't understand why, do you have any ideas? I get null pointer exception in Tomcat
has comment: http://stackoverflow.com/comment/37286084
has comment: http://stackoverflow.com/comment/37284222
tagged with: servlets
has comment: http://stackoverflow.com/comment/37282702
score: 0
has comment: http://stackoverflow.com/comment/37284203
answer count: 0
has comment: http://stackoverflow.com/comment/37282406
type: UnansweredQuestion
tagged with: java
tagged with: web
tagged with: tomcat

http://stackoverflow.com/comment/37237341
score: 0
has text: Thanks can you provide some link how to do this..
type: Comment
comment on: http://stackoverflow.com/q/24133482
type: QuestionComment

hadoop
tags question: http://stackoverflow.com/q/24165097
tags question: http://stackoverflow.com/q/24147490
tags question: http://stackoverflow.com/q/24258338
tags question: http://stackoverflow.com/q/24181033
tags question: http://stackoverflow.com/q/24109400
tags question: http://stackoverflow.com/q/24165009
tags question: http://stackoverflow.com/q/24105117
tags question: http://stackoverflow.com/q/24181826
tags question: http://stackoverflow.com/q/24173005
tags question: http://stackoverflow.com/q/24163477
tag name: hadoop
tags question: http://stackoverflow.com/q/24218767
tags question: http://stackoverflow.com/q/24160776
tags question: http://stackoverflow.com/q/24117350
tags question: http://stackoverflow.com/q/24105852
tags question: http://stackoverflow.com/q/24135656
tags question: http://stackoverflow.com/q/24255073
tags question: http://stackoverflow.com/q/24114341
tags question: http://stackoverflow.com/q/24238481
type: Tag
tags question: http://stackoverflow.com/q/24168316
tags question: http://stackoverflow.com/q/24170645
tags question: http://stackoverflow.com/q/24239823
tags question: http://stackoverflow.com/q/24165787
tags question: http://stackoverflow.com/q/24152843
tags question: http://stackoverflow.com/q/24261425
tags question: http://stackoverflow.com/q/24186818
tags question: http://stackoverflow.com/q/24265457
tags question: http://stackoverflow.com/q/24207569
tags question: http://stackoverflow.com/q/24183282
tags question: http://stackoverflow.com/q/24184746
tags question: http://stackoverflow.com/q/24177691
tags question: http://stackoverflow.com/q/24215218
tags question: http://stackoverflow.com/q/24124916
tags question: http://stackoverflow.com/q/24183404
tags question: http://stackoverflow.com/q/24198032
tags question: http://stackoverflow.com/q/24226554
tags question: http://stackoverflow.com/q/24145281
tags question: http://stackoverflow.com/q/24204269
tags question: http://stackoverflow.com/q/24161311
tags question: http://stackoverflow.com/q/24206367

http://stackoverflow.com/comment/37306104
score: 0
has text: Thread.sleep(1000); i've put to see if that works but before that I didn't have that Line of code. Tested that but didn't help. Please have a look at my latest post above and comment - Thanks.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24170137

http://stackoverflow.com/q/24154557
answer count: 1
has answer: http://stackoverflow.com/a/24154688
type: Question
tagged with: sockets
type: UnansweredQuestion
tagged with: telnet
has body: I´m trying to connection using telnet, but the response of server it´s a unreadble string, can some one help me? ( the telnet server is a windows XP), I want to authenticate by telnet and execute some commands. the following code bellow import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.Socket; public class TelnetClient { public static void main(String args[]) throws Exception{ // Create object of Socket Socket soc = new Socket("192.168.56.101", 23); String Command; // Create object of Input Stream to read from socket DataInputStream din = new DataInputStream(soc.getInputStream()); // Create object of Output Stream to write on socket DataOutputStream dout = new DataOutputStream(soc.getOutputStream()); // Object of Buffered Reader to read command from terminal BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Welcome to Telnet Client"); System.out.println("&lt; Telnet Prompt &gt;"); Command = br.readLine();// reads the command dout.writeUTF(Command);// sends command to server System.out.println(din.readLine()); // gets the response of server soc.close(); // close port din.close(); // close input stream dout.close(); // close output stream br.close(); // close buffered Reader } } and the response of server is : ÿý%ÿûÿûÿý'ÿýÿý with a lot of "?"
score: 0
tagged with: java
has title: Java and Telnet resposnse unreadble

http://stackoverflow.com/comment/37288391
has text: user3273107 gave correct answer. put public in front of ShowMeText
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24161231
type: Comment

http://stackoverflow.com/q/24266628
has comment: http://stackoverflow.com/comment/37489112
type: AnsweredQuestion
answer count: 2
tagged with: char
score: 0
possible better answer: http://stackoverflow.com/a/24266745
has body: I'm currently using a char as a counter in a char[]. An example of the problem I'm having is below: char counter = 0x00; for (int i = 0; i &lt; 15; i++){ counter++; } This seemed to work well until I discovered that when i = 10, counter was assigned 0x10 and not 0x0A. How can I increment the char to contain the hex value and not the decimal value? Any suggestions or advice would be great!
has answer: http://stackoverflow.com/a/24266745
accepted answer: http://stackoverflow.com/a/24266754
type: Question
has answer: http://stackoverflow.com/a/24266754
has title: Incrementing Char Issue (Hex)
tagged with: java
tagged with: hex

http://stackoverflow.com/a/24173063
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24172983
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24172983
type: Answer
has body: I assume that's because the first arg of a list should be the name of a function, and here its another list Close - when code is evaluated, the first item in the list form is evaluated, and the result is invoked as a function (the first item could be the name of a function, or another function call that returns a function). In this case, the println function always returns nil; attempting to invoke nil as a function yields the NPE that you see. shouldn't the complier/runtime give a nicer error in that case? Not necessarily - the compiler can't know ahead of time whether the result of evaluating the inner function call will be a valid function to use for the outer function call. The following works just fine: ((partial + 1) 2) because partial returns another function.
score: 5

http://stackoverflow.com/a/61158618
upvote count: 14
downvote count: 0
score: 14
answers question: http://stackoverflow.com/q/24164014
type: Answer
has body: Overriding of default caching behavior for a particular method can be done in the below way: @Controller public class MyRestController { @RequestMapping(value = "/someUrl", method = RequestMethod.GET) public @ResponseBody ResponseEntity<String> myMethod( HttpServletResponse httpResponse) throws SQLException { return ResponseEntity.ok().cacheControl(CacheControl.maxAge(100, TimeUnit.SECONDS)).body(T) } }

http://stackoverflow.com/comment/37225957
type: QuestionComment
type: Comment
score: 0
has text: So you didn't try anything?
comment on: http://stackoverflow.com/q/24127474

http://stackoverflow.com/q/24235813
has answer: http://stackoverflow.com/a/24235863
has body: I am trying to expand my program to allow different NPCs with a similar code base. I want to have a super class NPC with with various subclasses for each creature. Here I will call them Enemy1, Enemy2, and Enemy3. I also want to assign any given NPC to a variable via NPC enemy = new NPC(enemyID);, where "enemyID" is an integer denoting the NPC's in-game id (let Enemy1's ID = 1, Enemy2's = 2, Enemy3's =3). Even if this works, is it ok in practice (I haven't tested it just yet since the actual code will have more in-depth features): public class NPC { public NPC(int id) { switch (id) { case 1: { this = new Enemy1(); break; } case 3: { this = new Enemy3(); break; } case 3: { this = new Enemy3(); break; } } } //Various default and shared methods will follow } public class Enemy1 extends NPC { //Various variables specific to this enemy public Enemy1() //LOL { //Assign default values } //Default methods overwritten and enemy-specific methods go here } I'm not sure if that would compile since I don't have the full implementation yet, but I just want to know if an object can self-reassign in this manner, and if that is an OK programming choice. If you need clarification, let me know, and please give me reasons in your answers so I can learn instead of just getting a yes/no answer (I am self-taught, so feedback is especially helpful).
tagged with: constructor
has title: Reassign object through its constructor and "this" keyword
has comment: http://stackoverflow.com/comment/37430366
has comment: http://stackoverflow.com/comment/37430377
has comment: http://stackoverflow.com/comment/37430573
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: this
answer count: 1
accepted answer: http://stackoverflow.com/a/24235863
type: Question

http://stackoverflow.com/a/24260200
has comment: http://stackoverflow.com/comment/37476846
score: 0
answers question: http://stackoverflow.com/q/24259890
has comment: http://stackoverflow.com/comment/37477302
has comment: http://stackoverflow.com/comment/37477019
type: Answer
has comment: http://stackoverflow.com/comment/37477053
has body: Add 7 days or 1 week to your date and compare with current date if(lastUpdate.plusDays(7).isBefore(LocalDate.now()) { clearWeeklyStatistics(); } OR if(lastUpdate.plusWeeks(1).isBefore(LocalDate.now()){ clearWeeklyStatistics(); } Edit:- Consider this solution only if you want to compare the crossing of week in terms of 7 days period , See the comments for more details.

http://stackoverflow.com/comment/37334823
type: QuestionComment
comment on: http://stackoverflow.com/q/24133570
score: 0
has text: It is basically a listener method that is provided inside of the Background class that I am using..I am just extending the Background class and overriding the listener to do some custom stuff. As such, it is called by the library code..
type: Comment

http://stackoverflow.com/a/24153024
type: Answer
has comment: http://stackoverflow.com/comment/37274246
accepted answer of: http://stackoverflow.com/q/24152433
has comment: http://stackoverflow.com/comment/37274368
type: AcceptedAnswer
downvote count: 0
has body: You can change the names you want for the enumeration members. There are two ways of doing that: JAXB mappings file XSD annotations Using XSD annotations If you can modify your schema, you can insert JAXB elements as an <xs:appinfo> extension: <jaxb:typesafeEnumMember name="SIP1" /> <jaxb:typesafeEnumMember name="SIP2" /> ... This should generate: @XmlEnum public enum IdTypeEnum { SIP1, SIP2; ... without any @XmlEnumValue annotations since now they have identical names. Using a bindings file If you can't change the schema, you can also do that using JAXB bindings: <jaxb:bindings version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"> <jaxb:bindings schemaLocation="sip.xsd"> <jaxb:bindings node="//xs:simpleType[@name='IdTypeEnum']/xs:restriction/xs:enumeration[@value='SIP1']"> <jaxb:typesafeEnumMember name="SIP1"/> </jaxb:bindings> <jaxb:bindings node="//xs:simpleType[@name='IdTypeEnum']/xs:restriction/xs:enumeration[@value='SIP2']"> <jaxb:typesafeEnumMember name="SIP2"/> </jaxb:bindings> </jaxb:bindings> </jaxb:bindings> And include the bindings file when you run xjc: xjc -b bindings-file.xml sip.xsd Generating a bindings files with XSLT If you don't want to copy the same values individually it would be very simple to generate the bindings file using XSLT. Here's an example: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <jaxb:bindings version="2.0"> <jaxb:bindings schemaLocation="sip.xsd"> <xsl:apply-templates select="//xs:simpleType[@name='IdTypeEnum']/xs:restriction/xs:enumeration"/> </jaxb:bindings> </jaxb:bindings> </xsl:template> <xsl:template match="xs:enumeration"> <jaxb:bindings node="//xs:simpleType[@name='IdTypeEnum']/xs:restriction/xs:enumeration[@value='{@value}']"> <jaxb:typesafeEnumMember name="{@value}"/> </jaxb:bindings> </xsl:temp…
has comment: http://stackoverflow.com/comment/37274636
answers question: http://stackoverflow.com/q/24152433
score: 5
upvote count: 5

http://stackoverflow.com/a/58392676
type: Answer
upvote count: 10
answers question: http://stackoverflow.com/q/24184485
downvote count: 0
has body: I would suggest not relying on the janino dependency (1 MB for nothing in this case) there is a simpler solution using the logback's default value implementation like this: <?xml version="1.0" encoding="UTF-8"?> <property name="base.folder" value="${catalina.home:-./target}"/> ${base.folder}/logs/myApplication.log ... ... Look for the :- characters beetween the variable name and the default value. If the ${catalina.home} variable is empty the default value (in this case ./target) will be used.
score: 10

http://stackoverflow.com/comment/37551985
score: 0
type: AnswerComment
has text: @user3486059 thats good :) Its a bit hard to find the right tutorials for libgdx, cause there are so many out there.
comment on: http://stackoverflow.com/a/24264521
type: Comment

http://stackoverflow.com/a/24218722
upvote count: 1
has comment: http://stackoverflow.com/comment/37397826
answers question: http://stackoverflow.com/q/24218516
downvote count: 0
type: Answer
has body: All static methods in JOptionPane create modal dialogs, i.e., execution of the code stops until the user dismisses the dialog box. If you want to create non-modal dialogs, use JDialog directly. Refer to Java Swing Tutorial for more information. Updated: If I am not wrong, you are trying to do is to NOT show the ReviewPatients dialog at all when there are no records. If that is the case, the simplest solution is to just replacing dispose() with System.exit(1). A better solution is check whether there are records in the database, and: If there are records, create the ReviewPatients dialog and populate the table with the data. If there is no record, display the JOptionPane to inform the user there is no record, and terminate the program. On a separate note: though permissible, try not to mix AWT components with Swing components (refer to another Stack Overflow answer for the reasons).
accepted answer of: http://stackoverflow.com/q/24218516
has comment: http://stackoverflow.com/comment/37419430
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/37249781
comment on: http://stackoverflow.com/a/24140531
type: AnswerComment
has text: I take it that this will keep the session alive for a hour since the last request?
score: 0
type: Comment

http://stackoverflow.com/comment/37389713
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24214120
has text: and I can modify raster only in open method
type: Comment

http://stackoverflow.com/comment/37318198
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24176719
has text: Can you print the `receivedString` right before you try to parse it to an object? just to make shure you're not parsing an empty string.
type: Comment

http://stackoverflow.com/comment/37327217
comment on: http://stackoverflow.com/q/24181489
type: Comment
type: QuestionComment
score: 0
has text: @biziclop: I see the suppression stuff encouraging **good** practices. Previously, when dealing with an exception in logic code, we had to *throw away* exceptions resulting from cleanup code. Now we don't have to anymore (even where we can't use try-with-resources).

http://stackoverflow.com/q/24119416
tagged with: jar
upvote count: 1
tagged with: war
has title: How to access a .jar present inside of a .war from some other .war?
type: AnsweredQuestion
has body: Suppose i have a .war file which includes a Jar file(WEB-INF\lib), Now i want to access this jar from some other war file. is this possible without placing it at some common reference. All Suggestions welcomed.
tagged with: java
accepted answer: http://stackoverflow.com/a/24119585
answer count: 1
score: 1
has answer: http://stackoverflow.com/a/24119585
tagged with: eclipse
favorite count: 0
has comment: http://stackoverflow.com/comment/37227732
type: Question
has comment: http://stackoverflow.com/comment/37232065
tagged with: weblogic
downvote count: 0

http://stackoverflow.com/q/24142411
has title: multi rows of keyboard pattern matching in android
score: 0
has body: I am working on a password verifying function. It has 3 rules: it should not repeat (3 or more consecutive letter abc, efg, etc) it should not repeat 3 or more letter ( e.g aaa, ccc, 111 etc) it should not have 3 or more consecutive keyboard letter ( e.g qwerty, asdf etc) it should not have consecutive multi line letter ( e.g 1 and 2nd row letter in keyboard e.g 1q2w3e4r etc ) I could successfully get the first 2 rules : 1. Pattern pattern = Pattern.compile("([a-z0-9!₩£¥@#\\$%^&amp;*()~`\\-=_+\\[\\]{}|:\\\";',\\./&lt;&gt;?\\x21-\\x7e])\\1\\1", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(password); 2. private boolean validateConsecutiveSeq(String epin) { char epinCharArray[] = epin.toCharArray(); int asciiCode = 0; boolean isConSeq = false; int previousAsciiCode = 0; int numSeqcount = 0; for (int i = 0; i &lt; epinCharArray.length; i++) { asciiCode = epinCharArray[i]; if ((previousAsciiCode + 1) == asciiCode) { numSeqcount++; if (numSeqcount &gt;= 2) { isConSeq = true; break; } } else { numSeqcount = 0; } previousAsciiCode = asciiCode; } return isConSeq; } Now i am not clear about what pattern i should use for rule no.3 and rule no 4. Please tell me about how to proceed with pattern matching. Rule no.4 is is little tricky and confusing for me
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24143424
tagged with: pattern-matching
type: Question
type: UnansweredQuestion
tagged with: android
tagged with: regex

http://stackoverflow.com/comment/37496739
comment on: http://stackoverflow.com/a/24248634
score: 0
type: AnswerComment
has text: Then the only thing I should do is to override the `incrementToken` method from the `TokenFilter` abstract class?
type: Comment

http://stackoverflow.com/q/24200750
answer count: 1
has answer: http://stackoverflow.com/a/24200931
tagged with: java.util.concurrent
has comment: http://stackoverflow.com/comment/37363699
type: Question
has title: Insertion of null value in a ConcurrentSkipListMap Java
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/24200931
has body: I know it's maybe not the best thing to do and that I'm not using properly this object, but here is my problem. I want to use a ConcurrentSkipListMap and have declared my map as such: private ConcurrentSkipListMap&lt;Date,T&gt; map Sometimes, I need to initialize elements of this map with a "null" value, meaning that on a given day, there were no data. For a regular hastable, that works, you can insert a null value associated to a key. When getting the value for a certain date, I just have to test if it is null or not. For a ConcurrentSkipListMap, that does not work. It throws a null value exception. When looking at the source code, I understood that this is an internal representation of the Nodes where a null value just means that the Node in the list is dead. I know the best answer to this would be, just don't add the date in that case... but for many reasons, I still need to. And anyway, testing for the existence of the key is to me the same as testing for a null value associated to a key. I can't add a dummy value as well cause I will not be able to make a distinction between this dummy value and a real one (for, example, if my template class is an Integer, even if I choose -1 as a flag for empty, i would not be able to see the difference with a real value of -1 for this day). I was previously using private SortedMap&lt;Date,T&gt; map = Collections.synchronizedSortedMap(new TreeMap&lt;Date,T&gt;(new BasicDateComparatorIncreasing())); but I like the fact that ConcurentSkipListMap implements the ConcurrentNavigableMap interface Is there a way to achieve what I want to do ? thanks
tagged with: hashtable
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/37373864
type: AnswerComment
comment on: http://stackoverflow.com/a/24176016
score: 0
has text: In that case I believe the issue lies on your server-side. Something should be wrong so that you can't open a connection. I would try to access it on my computer's browser and if it can't connect, then you found your issue
type: Comment

http://stackoverflow.com/a/24515341
answers question: http://stackoverflow.com/q/24242923
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: Little update. So I figured out things a bit better thanks to your answers, and was able to compare some jaxb objects in my unit test. But it was taking a while. I found this lib to really help me, and I moved on: XMLUnit

http://stackoverflow.com/comment/37301256
type: Comment
comment on: http://stackoverflow.com/q/24152414
type: QuestionComment
score: 0
has text: @AndrewThompson No, I mean method. If you look at the [Java Virtual Machine Specification](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.3), you'll see that while the code attribute of a method can have a length specified by a 4-byte unsigned integer ("u4" in the spec), the exception table, line number table, local variables table, and other, all use a 2-byte unsigned integer ("u2" in the spec) to specify a program counter. That limits a method to 64k of bytecode. A class has no such limit.

http://stackoverflow.com/q/24205385
tagged with: java
tagged with: java-7
answer count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37372863
downvote count: 1
favorite count: 0
type: Question
has body: As per the question above. I have a JTextArea in a JScrollPane and it will keep on letting me add text forever (and simply not let me display it or scroll to it, due to constraints on the visible size of the TextArea and ScrollPane). Am I missing something incredibly obvious? Below is example code I've reduced to the minimal lines for (issue is still present), hopefully not too long: import java.awt.CardLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.WindowConstants; import javax.swing.text.DefaultCaret; public class TestGUI { private static JFrame mainframe; private static JPanel newGamePanel; private static JPanel loadGamePanel; private static JPanel panelContainer; final static String NEWGAME = "New Game"; final static String LOADGAME = "Load Game"; public TestGUI() { // do nothing } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { System.setProperty("awt.useSystemAAFontSettings", "on"); TestGUI.createGUI(); } }); } public static void createGUI() { mainframe = new JFrame("Login to Test"); newGamePanel = new JPanel(); loadGamePanel = new JPanel(); panelContainer = new JPanel(); panelContainer.setLayout(new CardLayout()); JPanel basePanel = new JPanel(); final JPanel statusPanel = new JPanel(); JButton quitButton = new JButton("Quit"); JPanel countryDesc = generateContentPanel("Country Description: ", new JTextArea()); ((JComponent) mainframe.getContentP…
has comment: http://stackoverflow.com/comment/37484165
has comment: http://stackoverflow.com/comment/37400366
tagged with: jtextarea
linked to: http://stackoverflow.com/q/13431578
has comment: http://stackoverflow.com/comment/37372728
accepted answer: http://stackoverflow.com/a/24205746
score: -1
has title: Can't prevent text from being entered in JTextArea (in JScrollPane)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24205746
tagged with: jscrollpane
upvote count: 0

http://stackoverflow.com/a/24226124
has body: I would put this in a comment, but unfortunately I don't have a high enough rep. So I'll do my best to solve the problem. You mentioned that all of the images were present in the drawable-hdpi folder. But if you notice the error, it looks like it is searching for the file in the res/drawable-xxhdpi folder. What I would suggest is copying the .xml files from the -hdpi folder into the -xxhdpi folder and seeing if it works!
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24225882
type: Answer
score: 1

http://stackoverflow.com/comment/37424902
has text: [Works for me](https://ideone.com/UktBMg).
type: QuestionComment
comment on: http://stackoverflow.com/q/24233093
type: Comment
score: 0

http://stackoverflow.com/comment/37405879
type: AnswerComment
has text: No, a thread is definitely persistent. How do you think an AsyncTask is written- it's a thread with a runonUIThread block written for you. It lasts even after the activity is destroyed. An AlarmManager is not needed. Nor is either thread or AlarmManager the right answer here- he should be using the broadcast receiver.
score: 0
comment on: http://stackoverflow.com/a/24222968
type: Comment

http://stackoverflow.com/comment/37291346
score: 0
has text: i added explenation of what i'm trying to do
comment on: http://stackoverflow.com/q/24162748
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37421549
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24231109
has text: @Bread do us a favour by editing your question and post the whole activty code and the xml layout. Where is it declared and what is the name of the xml posted

http://stackoverflow.com/q/24190997
tagged with: generics
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24191126
has answer: http://stackoverflow.com/a/24191126
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
has title: java.lang.IllegalAccessException: Can not call newInstance() on the Class for java.lang.Class
upvote count: 2
tagged with: java
answer count: 1
downvote count: 0
has body: In my spring project, I implemented a generic controller for serve as base for all my controller (each entity from my project have one specific controller). Right now, when I am trying access a view mapped by the controller, I am facing this error: java.lang.IllegalAccessException: Can not call newInstance() on the Class for java.lang.Class at java.lang.Class.newInstance(Class.java:339) at com.config.generic.controller.controller.createCommandObject(controller.java:84) at com.config.generic.controller.controller$$FastClassBySpringCGLIB$$56ef52f8.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:640) at com.usuario.controller.UsuarioController$$EnhancerBySpringCGLIB$$2c4051b5_2.createCommandObject(<generated>) 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.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:123) at org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:722) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframewor…

opencv
tags question: http://stackoverflow.com/q/24204744
type: Tag
tags question: http://stackoverflow.com/q/24174868
tags question: http://stackoverflow.com/q/24166192
tags question: http://stackoverflow.com/q/24193234
tags question: http://stackoverflow.com/q/24263690
tags question: http://stackoverflow.com/q/24211670
tags question: http://stackoverflow.com/q/24241439
tags question: http://stackoverflow.com/q/24230603
tags question: http://stackoverflow.com/q/24225410
tags question: http://stackoverflow.com/q/24190450
tags question: http://stackoverflow.com/q/24127138
tags question: http://stackoverflow.com/q/24155243
tag name: opencv
tags question: http://stackoverflow.com/q/24134594

http://stackoverflow.com/comment/37295321
type: AnswerComment
has text: @Mohammadaltaani Did you mean to convert string to array?
comment on: http://stackoverflow.com/a/24164126
type: Comment
score: 0

http://stackoverflow.com/comment/37274562
has text: I see an accepted answer... but what is the actual problem and solution then?
comment on: http://stackoverflow.com/q/24152692
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24224703
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37423390
has comment: http://stackoverflow.com/comment/37423437
has title: java.lang.Error: Unresolved compilation error occuring in JSP
has comment: http://stackoverflow.com/comment/37423778
has comment: http://stackoverflow.com/comment/37409349
has comment: http://stackoverflow.com/comment/37423255
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37423405
has body: I am trying to follow a tutorial on JSP and eve after writing the same code in the tutorial i still receive following error. java.lang.Error: Unresolved compilationproblem: Duplicate local variable cart. I am trying to run the servlet with the following code. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); Cart cart = (Cart)session.getAttribute("cart"); if (cart == null) { cart = new Cart(); } cart.setTotalItems(7); session.setAttribute("cart", cart); getServletContext().getRequestDispatcher("/showcart.jsp").forward(request,response); } HTTP Status 500 - Servlet execution threw an exception -------------------------------------------------------------------------------- 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.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.Error: Unresolved compilation problem: Duplicate local variable cart demo.Session.doGet(Session.java:32) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.53 logs. Apache Tomcat/7.0.53 showcart.jsp: <?xml version="1.0" encoding="ISO-8859-1" ?> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here <%@ page import= "demo.*" %> <% Cart cart= (Cart)session.getAttribute("cart");%> Items in cart : <%= cart.getTotalItems() %> the web.xml: Session Session demo.Session Session /Session </web-app> session.java package demo; import java.io.IOException; import javax.servlet.ServletExcept…
has comment: http://stackoverflow.com/comment/37409538
has comment: http://stackoverflow.com/comment/37409160
accepted answer: http://stackoverflow.com/a/24225197
has comment: http://stackoverflow.com/comment/37423365
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/24225197
has comment: http://stackoverflow.com/comment/37423379
has comment: http://stackoverflow.com/comment/37423729

http://stackoverflow.com/comment/37198610
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/24112875
has text: You break with a `return` statement or by hitting the end of the method. So what are you really trying to ask?

http://stackoverflow.com/q/24108052
has comment: http://stackoverflow.com/comment/37189225
upvote count: 0
tagged with: java
has body: I saw some design pattern book and I noticed some interesting point: They creates a lot of classes. Some times it seems that I can add one field instead of creating class. For example Implementation using class: public class Animal { } public class Dog : Animal { } Implementation using state: public class Animal { public AnimalType AnimalType; } var dog = new Animal(); dog.AnimalType = AnimalType.Dog; Maybe there is another better way to create dog object, I just tried to make point. So which approach is better?
has answer: http://stackoverflow.com/a/24108106
downvote count: 1
favorite count: 0
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/37189307
has comment: http://stackoverflow.com/comment/37189223
has title: When should I use new class instead of adding new field (as state)?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24108415
has comment: http://stackoverflow.com/comment/37189259
score: -1
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/37189344
tagged with: oop
answer count: 2

http://stackoverflow.com/comment/37193649
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/24109077
type: Comment
has text: "score" != "highscore"? (You're writing to 'score' but checking 'highscore'?)

http://stackoverflow.com/q/24119904
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/37233558
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37225563
has comment: http://stackoverflow.com/comment/37211263
tagged with: rest
tagged with: jersey
has comment: http://stackoverflow.com/comment/37211335
type: UnansweredQuestion
has title: NullPointerException in rest webservice upload
has comment: http://stackoverflow.com/comment/37220118
upvote count: 1
tagged with: web-services
answer count: 0
score: 1
tagged with: java
has body: I am trying to upload a file using a rest webservice. This is my code @Path(value= "/up") public class upload { @POST @Path(value="upload") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile(@FormDataParam("file") InputStream fileInputStream ) { String filePath = "C://Users/Marya/Desktop/file" ; System.out.println("*****serverpath********"); saveFile(fileInputStream, filePath); //this is line 29 System.out.println("*****save********"); String output = "File saved to server location : " + filePath; System.out.println("done"); return Response.status(200).entity(output).build(); } private void saveFile(InputStream uploadedInputStream,String serverLocation) { try {OutputStream outpuStream = new FileOutputStream(new File(serverLocation)); int read = 0; byte[] bytes = new byte[1024]; outpuStream = new FileOutputStream(new File(serverLocation)); while ((read = uploadedInputStream.read(bytes)) != -1) //this is lione 42 { outpuStream.write(bytes, 0, read); System.out.println("*****read********"); } outpuStream.flush(); outpuStream.close(); } catch (IOException e) { e.printStackTrace(); } } } When I run it, the file is created but it is empty with size = 0 !! and I get this error: Grave: "Servlet.service()" pour la servlet JAX-RS Servlet a généré une exception java.lang.NullPointerException at com.example.upload.saveFile(upload.java:42) at com.example.upload.uploadFile(upload.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDi…
downvote count: 0

http://stackoverflow.com/q/24146305
has answer: http://stackoverflow.com/a/24146401
possible better answer: http://stackoverflow.com/a/24146401
downvote count: 0
has comment: http://stackoverflow.com/comment/37260848
upvote count: 1
answer count: 4
has comment: http://stackoverflow.com/comment/37261050
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24146436
has body: I have a simple program that I am making that looks through a directory recursively and removes all files that do not match the files extensions chosen by the user. (essentially I am remaking a script that I wrote in PHP to help teach myself java) The method works fine except that it returns an array of files that match the array of extensions. This would remove the wrong files. How can I return the files that do not match? I am using org.apache.commons.io.FileUtils with a string array to get the files: import java.io.File; import java.util.List; import java.io.IOException; import org.apache.commons.io.FileUtils; public class Recurse { // The method that takes a directory path (file object called folder) and a string of extensions public static List&lt;File&gt; getFiles(final File folder, String[] extensions) throws IOException{ List&lt;File&gt; fileList = (List&lt;File&gt;) FileUtils.listFiles(folder, extensions, true); return fileList; } } I have found examples that use just one file type e.g ".txt" but cannot find one for an array. I would prefer to stick with org.apache.commons.io.FileUtils but I am willing to change my method.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24146460
accepted answer: http://stackoverflow.com/a/24146460
tagged with: file
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24147045
has title: How can you in Java list all files recursively in a folder that do not match an array of extensions?

http://stackoverflow.com/q/24219090
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/83443650
favorite count: 0
type: Question
has body: I am trying to copy a file from my phone to my pc using adb over network. My code works perfectly fine even for files with spaces in their path, but it fails for files containing any special character for example "ß á ö" and thats my problem. I need to execute this command from java and I am currently using this code to pull the file: public static void pullFile() { try { // Setting file paths String androidFilePath = "\"/storage/sdcard0/Download/Bußgeld 2014 TGC.pdf\""; String windowsFilePath = "\"C:\\Dropbox\\Java Projekte\\ADB Browser\\bin\\files\\Bußgeld 2014 TGC.pdf\""; System.out.println(androidFilePath); System.out.println(windowsFilePath); // Building command List&lt;String&gt; cmd = new LinkedList&lt;&gt;(); cmd.add("adb"); cmd.add("pull"); cmd.add(androidFilePath); cmd.add(windowsFilePath); // Running command ProcessBuilder builder = new ProcessBuilder(cmd); builder.redirectErrorStream(true); Process p = builder.start(); // Getting the output from the command ... System.out.println(stringBuilder.toString); } catch (IOException e) { e.printStackTrace(); } } When I run this code I am getting the following error: remote object '/storage/sdcard0/Download/Bu�geld 2014 TGC.pdf' does not exist My question now is how do I correctly escape the characters for the adb. I´ve tried to use ByteBuffer buf = Charset.forName("UTF-8").encode(androidFilePath); androidFilePath = new String(buf.array(), "UTF-8"); but this way I get some trailing whitespaces, which i can´t remove since trim will return a new String, which isn´t encoded with "UTF-8"; Ok i figured out, that it probably isn´t the fault of the java code! I ran the command from cmd as well as windows powershell and both returned: remote object '/storage/sdcard0/Download/Bu▀geld 2014 TGC.pdf' does not exist
tagged with: android
linked to: http://stackoverflow.com/q/35512820
tagged with: adb
has answer: http://stackoverflow.com/a/24221028
accepted answer: http://stackoverflow.com/a/24221028
has comment: http://stackoverflow.com/comment/37399400
tagged with: escaping
score: 2
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37401024
has title: Adb pull file with special character in its path
downvote count: 0

http://stackoverflow.com/q/24197618
score: 1
tagged with: java
tagged with: image-processing
possible better answer: http://stackoverflow.com/a/24197751
favorite count: 0
type: Question
has title: Read and write an image to SDCard in ANdroid
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24197751
has answer: http://stackoverflow.com/a/24198348
tagged with: android
answer count: 2
has body: I am trying to read the files from URL and write into my sdcard. As it is working good with the other files like .js .css and .txt files etc... But it is not working with .png .jpg .bmp and .gif. My code for this is String path = dir + value; File localConfigfile = new File( Environment.getExternalStorageDirectory() + "/Avalon/assets/www/" + path); String responseString = RequestMgr.GetWebSource(DomainName + "/" + Heirarchy + "/" + Serverpath); FileOutputStream out; if (localConfigfile.exists()) { localConfigfile.delete(); out = new FileOutputStream(localConfigfile); out.write(responseString.getBytes()); } } Please help me here i am struck in this
downvote count: 0
accepted answer: http://stackoverflow.com/a/24198348
upvote count: 1

http://stackoverflow.com/a/24132940
type: Answer
has comment: http://stackoverflow.com/comment/37236473
has body: Building a dynamic array involves these basic steps: -Create an array of a fixed capacity. -When the size of the array (# of elements added) approach the capacity, create a new array (usually doubling the capacity), and copy all the old elements to the new array. A linked list is the most efficient for your task of building the array (done in O(1) time). However, accessing elements for inserting and deleting in a linked list is not efficient (O(n) time). Imagine having to move through the whole list to get to the last element. Building the dynamic array is less efficient, because of the need to re-size the array as it grows. Inserting and deleting elements is less efficient because of need to move all the elements after to make room or fill the gap. However accessing an element in an array is efficient (O(1) time) and there are big advantages when it comes to sorting. The Java ArrayList is an implementation of a dynamic array. You could also implement your own.
score: 0
answers question: http://stackoverflow.com/q/24132719

http://stackoverflow.com/a/24157775
answers question: http://stackoverflow.com/q/24157605
type: Answer
score: 0
has body: You should not do that in a background thread, try this instead: class CreateNewProduct extends AsyncTask&lt;String, String, Integer&gt; { @Override protected void onPreExecute() { pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Generating Coupon. Please Wait... "); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } protected String doInBackground(String... args) { String fname = inputFname.getText().toString(); String lname = inputLname.getText().toString(); String contact = inputContact.getText().toString(); String email = inputEmail.getText().toString(); String eventname = inputEventname.getText().toString(); List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("fname", fname)); params.add(new BasicNameValuePair("lname", lname)); params.add(new BasicNameValuePair("contact", contact)); params.add(new BasicNameValuePair("email", email)); params.add(new BasicNameValuePair("eventname", eventname)); JSONObject json = jsonParser.makeHttpRequest(url_create_product, "POST", params); try { int success = json.getInt(TAG_SUCCESS); return success; } catch (JSONException e) { e.printStackTrace(); } return -1; } protected void onPostExecute(Integer success) { pDialog.dismiss(); if (success == 1) { // START A NEW FRAGMENT } else { } } } If CreateNewProduct is a class inside an Activity , you can add the fragment as you would add any other fragment: protected void onPostExecute(Integer success) { pDialog.dismiss(); if (success == 1) { // START A NEW FRAGMENT FragmentManager fragmentManager = getFragmentManager() FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); ExampleFragment fragment = new ExampleFragment(); fragmentTransaction.add(R.id.fragment_container, fragment); fragmentTransaction.commit(); } else { } } As I just noticed that this AsyncTask most likely is inside a fragment here is another approach: In your activity: public void addCoupon() { Fra…
has comment: http://stackoverflow.com/comment/37282228

http://stackoverflow.com/comment/37240394
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24135363
has text: just use `IDTOPIK` instead of `TOPIK.IDTOPIK`
type: Comment

http://stackoverflow.com/q/24165598
possible better answer: http://stackoverflow.com/a/24165629
has comment: http://stackoverflow.com/comment/37296913
has comment: http://stackoverflow.com/comment/37297662
has answer: http://stackoverflow.com/a/24165629
has comment: http://stackoverflow.com/comment/37297047
has comment: http://stackoverflow.com/comment/37297289
has answer: http://stackoverflow.com/a/24165737
type: AnsweredQuestion
downvote count: 4
has title: why does the method print 10 instead of 12
tagged with: java
has comment: http://stackoverflow.com/comment/37298118
has answer: http://stackoverflow.com/a/24165989
has body: how is possible when i have the rolling code. There is a method there that prints 10, when i expect it to print 12: public class Opgave1d { PrintStream out; int p = 5; int q = 10; public Opgave1d() { out = new PrintStream(System.out); } void methode1(int p) { this.p = p + 2; q = 4 * p; out.printf("%d\n%d\n", p, q); } void start(){ methode1(q); } } How is it possible that it prints 10 and 40, the 40 i get it, but why does it not print : 12 40???? I appreciate any help!
has answer: http://stackoverflow.com/a/24165721
has answer: http://stackoverflow.com/a/24165765
has answer: http://stackoverflow.com/a/24165630
has answer: http://stackoverflow.com/a/24165675
favorite count: 0
type: Question
answer count: 8
accepted answer: http://stackoverflow.com/a/24165627
upvote count: 2
has comment: http://stackoverflow.com/comment/37298505
has comment: http://stackoverflow.com/comment/37296942
has comment: http://stackoverflow.com/comment/37298738
score: -2
has answer: http://stackoverflow.com/a/24165627
has comment: http://stackoverflow.com/comment/37297056

http://stackoverflow.com/a/24351305
answers question: http://stackoverflow.com/q/24110024
score: 1
downvote count: 0
upvote count: 1
has body: Yes.The coordinates you have chosen is too large.You should choose other coordinates. In your code you have chosen northeast longitude vale as -72.092587 replace by -122.092587. Your code should be: request.addQuerystringParameter("bounds", "38.266224,-122.541803"+"|"+"44.018501,-122.092587);
type: Answer

http://stackoverflow.com/comment/37195616
score: 0
comment on: http://stackoverflow.com/q/24111219
has text: `break` with a label is *not* the same as a `goto` statement in other languages which is what it looks like you're trying to do...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37253674
has text: no the `isSatisfiedBy` method is in a completely different class
comment on: http://stackoverflow.com/q/24142530
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24111507
has title: How to reformat Java from Allman to K&R with line comments using Eclipse?
has body: I started out coding using the Allman style, with aligned braces: void foobar() { if(foo) { bar(); } } After decades I've decided I want that extra screen space; and besides, my client uses non-matched braces, so it's hard to switch back and forth from work to my personal code. So I want to convert all my existing code to K&amp;R: void foobar() { if(foo) { bar(); } } Eclipse 4.4 has a sufficient code formatter, and if I select my source tree I can even format files in bulk. The problem is that if I have a line comment where a K&amp;R brace would be, Eclipse will refuse to move the brace up a line, leaving me with a hodgepodge of coding styles: void foobar() { if(foo) //if foo { bar(); } } How can I tell Eclipse to move the brace up, even if there is a comment on the line where the brace goes? void foobar() { if(foo) { //if foo bar(); } }
tagged with: code-formatting
accepted answer: http://stackoverflow.com/a/24111766
tagged with: braces
has answer: http://stackoverflow.com/a/24111766
type: AnsweredQuestion
tagged with: curly-braces
score: 3
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
tagged with: eclipse
favorite count: 0
type: Question

http://stackoverflow.com/q/24219894
tagged with: java
answer count: 1
has title: Eclipse is not stopping/breaking at breakpoint?
has comment: http://stackoverflow.com/comment/37400008
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37399968
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/24219982
tagged with: android
accepted answer: http://stackoverflow.com/a/24219982
has body: I am trying to put breakpoints in my code for some simple debugging but my program is not stopping or telling me if the breakpoints is reached. I use CRTL+SHIFT+B and the breakpoint is visible in blue (enabled) on the left side. I am using these breakpoints in my core project and running from desktop project. Am i missing something and/or how to fix this?
has comment: http://stackoverflow.com/comment/37399992
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37399961
tagged with: breakpoints

http://stackoverflow.com/comment/37458586
has text: Thanks for the reply...no idea what you are talking about though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24249057
type: Comment

http://stackoverflow.com/comment/37400260
type: QuestionComment
comment on: http://stackoverflow.com/q/24220007
score: 0
type: Comment
has text: and you can't create only one Collatz object?

http://stackoverflow.com/q/24205631
tagged with: database
has body: I am writing a program to get values from MySQL database and insert into file. My Database is very large containing around 15 million records. So after some time the program becomes slow as the reason might me more number of table scanning happens. My program structure is like that, I am taking some value from the database in the resultset and looping each value from the resultset and insert this value in the where clause of select query to fetch data from different database and finally get the value. Here is the sample code: while(rs.next()) { String name = rs.getString("name"); String query = "SELECT empID from Employee where name="+name; rs2 = stm.executeQuery(query); } I wanted to know the solution where the time for the select query in the loop gets constant or some other solution which improve the performance.
has comment: http://stackoverflow.com/comment/37372618
has comment: http://stackoverflow.com/comment/37372690
tagged with: database-performance
has comment: http://stackoverflow.com/comment/37372909
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37372617
has comment: http://stackoverflow.com/comment/37372637
has comment: http://stackoverflow.com/comment/37372764
has answer: http://stackoverflow.com/a/24206211
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/37372996
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37373065
has comment: http://stackoverflow.com/comment/37372670
has title: query performance issues interacting with two databases
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24207142
tagged with: java

http://stackoverflow.com/q/24120118
tagged with: url
favorite count: 0
type: Question
has body: how to download a file from a url to a file folder located on a server using java. For now have written a code which downloads a file to a local folder on my C: but I have to save the file to a server
has answer: http://stackoverflow.com/a/24120452
type: UnansweredQuestion
tagged with: java
score: -3
has comment: http://stackoverflow.com/comment/37212169
upvote count: 0
has comment: http://stackoverflow.com/comment/37211543
has title: download a file from url and save it to file folder on a server in java
answer count: 1
downvote count: 3

http://stackoverflow.com/q/24167977
has body: I am developing an app for Android using Eclipse. I have a fragment that has a listview. I want to change the text of one Textview located inside one row of the listview. public class FragmentShowList extends Fragment { public FragmentShowList() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_show_list, container, false); ListView lv = (ListView) rootView.findViewById(R.id.lv_show); DBAdapter helper = new DBAdapter(getActivity()); String tableName = Tables.TABLENAME_CATEGORIES_MAIN; Tables table = new Tables(tableName); Cursor cursor = helper.getCursor(tableName); int[] to = new int[] {R.id.row_category_color, R.id.row_category_name}; SimpleCursorAdapter adapter = new SimpleCursorAdapter(getActivity(), R.layout.row_category, cursor, table.getColumns(), to, 0); lv.setAdapter(adapter); View view = lv.getChildAt(0); //TextView tv = (TextView) view.findViewById(R.id.row_category_name); //tv.setText("haha"); return rootView; }} I'm able to create and view the list, but when I try to run the two last lines that are with the "//" the app crashes due to a "null pointer exception" and the xml file for the rows is: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50dp" &gt; &lt;TextView android:id="@+id/row_category_color" android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:background="@drawable/rectangle" android:gravity="center" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/row_category_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_alignTop="@+id/row_category_color" android:layout_toRightOf="@+i…
possible better answer: http://stackoverflow.com/a/24168344
accepted answer: http://stackoverflow.com/a/24168244
has comment: http://stackoverflow.com/comment/37301739
has answer: http://stackoverflow.com/a/24168344
type: Question
has answer: http://stackoverflow.com/a/24168244
has comment: http://stackoverflow.com/comment/37302617
tagged with: android-fragments
tagged with: android-listview
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/6766625
has comment: http://stackoverflow.com/comment/37301625
has comment: http://stackoverflow.com/comment/37301973
tagged with: listview
has comment: http://stackoverflow.com/comment/37301773
has title: Not able to access a textview inside listview
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/37302534
score: 0
has comment: http://stackoverflow.com/comment/37301678

http://stackoverflow.com/a/24254842
downvote count: 0
upvote count: 1
score: 1
type: Answer
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24254320
has body: akka-persistence does not work with the same thread dispatcher which is what the TestActorRef provides. We need to switch to using a simple ActorRef so that a multithreaded dispatcher can be used for the test. This github issue talks about the very same problem :- https://github.com/akka/akka/issues/15293
accepted answer of: http://stackoverflow.com/q/24254320

http://stackoverflow.com/a/24207182
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24206725
has body: I think you made a typo when writing env-&gt;SetLongField(TestClass, fidError, jerror); instead of env-&gt;SetLongField(jobj, fidError, jerror);. Could you please verify, if this is sufficient?
score: 2
upvote count: 2

http://stackoverflow.com/comment/37455474
comment on: http://stackoverflow.com/q/24248468
score: 0
has text: Yes... First there is a SELECT to get all the elements and then one DELETE call for every entry in that list
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24178494
has comment: http://stackoverflow.com/comment/37321096
has comment: http://stackoverflow.com/comment/37321094
upvote count: 0
type: UnansweredQuestion
has title: Calculating if a number is prime - why can the boolean conditional be i*i <= number?
downvote count: 1
favorite count: 0
type: Question
has body: int isPrime(int number) { int i; for(i=2; i*i &lt;= number; i++) { if (number % i == 0) { return 0; } } return 1; } Why is it the case that the boolean conditional of the control statement is: i*i &lt;= number? Deep mathematical explanation please!
tagged with: conditional-statements
has answer: http://stackoverflow.com/a/24178555
answer count: 3
has comment: http://stackoverflow.com/comment/37322296
has answer: http://stackoverflow.com/a/24178583
has comment: http://stackoverflow.com/comment/37351840
has answer: http://stackoverflow.com/a/24178603
tagged with: java
has comment: http://stackoverflow.com/comment/37321127
score: -1

http://stackoverflow.com/q/24238187
tagged with: java
tagged with: template-engine
tagged with: chunk-templates
favorite count: 0
has answer: http://stackoverflow.com/a/24308776
type: Question
upvote count: 2
score: 2
tagged with: android
downvote count: 0
type: UnansweredQuestion
answer count: 1
has body: I am trying to use chunk in android. I need something like this: Suppose, Following are tags. tags: {"world":"WORLD", "c": "Dennis Ritchie", "apple":"JOBS" } Input: HELLO {{ world }}, C is written by {{ c }}, while java is written by {{ java }}, hola. Output: HELLO WORLD, C is written by Dennis Ritchie, while java is written by, hola. In short I need a custom delimiter like, {{ string }} i.e. DEFAULT_TAG_START = "{{"; DEFAULT_TAG_END ="}}"; While if input contains tag which is not specified, then it should be replaced by empty. I tried &amp; stuck at following, public String process(String msg) { Chunk c = new Chunk(); c.append(msg); c.set("apple", "JOBS"); c.set("c", "Dennis Ritchie"); c.set("world", "WORLD"); return c.toString(); }
has title: Using chunk template engine in android with custom tags

http://stackoverflow.com/comment/37346566
type: QuestionComment
has text: You don't need two booleans... And this looks fine.
score: 0
comment on: http://stackoverflow.com/q/24191959
type: Comment

http://stackoverflow.com/q/24197201
accepted answer: http://stackoverflow.com/a/24197304
has comment: http://stackoverflow.com/comment/133231393
type: AnsweredQuestion
has body: Recently I work on the project that has implemented the SSL. The SSL cert is expire once per year. And it throw exception in android after I renew the cert on the server. 06-13 11:20:27.709: D/allenj(30076): javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. After I looking through the project code, I saw there is a bks file, so , does it mean I have to update the bks file once per year, and I have to re-upload the app to google play as well. The problem is what is the standard way to cope with the renewal of the SSL cert? Thanks for helping. Code extract nnable Register_runnable = new Runnable(){ @Override public void run() { EditText emailText = (EditText) findViewById(R.id.editText1regist); EditText pwText = (EditText) findViewById(R.id.editText2registpw); String end = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; try { KeyStore keyStore = KeyStore.getInstance("BKS"); InputStream in = getResources().openRawResource(R.raw.ballooncardbks); keyStore.load(in, "".toCharArray()); TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509"); tmf.init(keyStore); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, tmf.getTrustManagers(), null); String actionUrl = "https://app.ballooncard.com/api/client/register/format/json"; URL url = new URL(actionUrl); HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); // con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestMethod("POST"); con.setSSLSocketFactory(context.getSocketFactory()); con.setRequestProperty("Connection", "Keep-Alive"); con.setRequestProperty("Charset", "UTF-8"); con.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
has answer: http://stackoverflow.com/a/24197304
has answer: http://stackoverflow.com/a/75524475
upvote count: 8
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37365689
tagged with: ssl
has title: How do I update the SSL cert in my android apps?
score: 8
type: Question
has comment: http://stackoverflow.com/comment/37365869
has comment: http://stackoverflow.com/comment/37356750
answer count: 2
has comment: http://stackoverflow.com/comment/37365771
linked to: http://stackoverflow.com/q/24006545
downvote count: 0
tagged with: https
favorite count: 0
possible better answer: http://stackoverflow.com/a/75524475

http://stackoverflow.com/comment/37348204
type: QuestionComment
comment on: http://stackoverflow.com/q/24172755
score: 0
has text: Here's an amusing note... NOW with classpath as shown in my previous long comment, in this folder `C:\Users\Dov\Documents\!Docs\NetBeansProjects\Tictactoe\src>` this command DOES compile: `javac -cp . gridLayout3x3\GridLayout3x3.java`
type: Comment

http://stackoverflow.com/a/24198539
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24198504
has comment: http://stackoverflow.com/comment/37359182
answers question: http://stackoverflow.com/q/24198504
has body: If you know you only what everything after the last : then you can simply use databaseName = databaseName.substring(databaseName.lastIndexOf(":") + 1) Of course you should make sure it actually contains the delimiter... if (databaseName.contains(":")) {... You could also use String#split and grab the elements you want... String parts[] = databaseName.split(":"); String name = parts[parts.length - 1];
type: Answer

http://stackoverflow.com/comment/37237937
type: QuestionComment
comment on: http://stackoverflow.com/q/24133456
has text: what is `imageLoader`??
type: Comment
score: 0

http://stackoverflow.com/comment/37340365
score: 0
comment on: http://stackoverflow.com/q/24188372
type: Comment
type: QuestionComment
has text: i tested on windows and the results are generally the same

http://stackoverflow.com/a/24213000
answers question: http://stackoverflow.com/q/24212937
type: Answer
score: 0
has body: You may need to put the Quiz.class file in your webroot directory (by your jsp file) so that the jsp code can find it, otherwise i don't think that ../target/classes gets exposed to browsers on the web, as that seems like it would be a security issue?
has comment: http://stackoverflow.com/comment/37390548

http://stackoverflow.com/q/24120446
tagged with: object
has title: Java: How can I use objects instantiated in one class in another class?
score: 0
has answer: http://stackoverflow.com/a/24139713
tagged with: java
has comment: http://stackoverflow.com/comment/37212400
has comment: http://stackoverflow.com/comment/37212414
has answer: http://stackoverflow.com/a/24120710
answer count: 6
has body: I have been trying to create a game for my programming class in high school, and I have ran into an issue to do with objects instantiated in different classes. My teacher has been unable to help, as he is "learning alongside us". public void launchGame(){ ObjectInitialize init = new ObjectInitialize(); init.objectInitialize(); while(year &gt; 1900){ util.checkEvents(); prussia.setTactics(4); I have a main method in another class that calls this method. The first thing this method does is create a new object of the class ObjectInitialize named init. Then I call the objectInitialize method on init. This is the code for that method: public void objectInitialize(){ Country france = new Country("France", 10, 200, 2, 100, 100, 1, 1, 800); Country russia = new Country("Russia", 8, 150, 1, 100, 100, 1, 1, 1300); Country austria = new Country("Austria", 8, 150, 1, 100, 100, 1, 1, 700); Country prussia = new Country("Prussia", 8, 175, 2, 100, 100, 1, 1, 700); FranceUI franceUI = new FranceUI(); RussiaUI russiaUI = new RussiaUI(); AustriaUI austriaUI = new AustriaUI(); PrussiaUI prussiaUI = new PrussiaUI(); EventHandlerUI eventHandlerUI = new EventHandlerUI(); GameStartUI gameStartUI = new GameStartUI(); AllianceUI allianceUI = new AllianceUI(); Utilities util = new Utilities(); } As you can see, this method creates many objects. There are no obvious errors in this method. However, when I try to use the util.checkEvents() or prussia.setTactics(4) objects/methods, my IDE tells me that it "cannot find symbol". Is this because the class that the launchGame() method is in cannot access the objects created in the other class? If so, how do I fix this? I can post more of my code if anyone needs to see it. Thank you! EDIT I have moved all of my code that was initially in the objectInitialize() method into the constructor, and created variables for each object outside like so: public class objectInitialize { Country france; Country russia; Country austria; Country prussia; FranceUI fr…
has answer: http://stackoverflow.com/a/24120651
tagged with: class
accepted answer: http://stackoverflow.com/a/24120651
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37212497
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/37212310
has answer: http://stackoverflow.com/a/24120531
has answer: http://stackoverflow.com/a/24120513
possible better answer: http://stackoverflow.com/a/24120513
favorite count: 0
has answer: http://stackoverflow.com/a/24120600
type: Question

http://stackoverflow.com/comment/37261795
score: 0
comment on: http://stackoverflow.com/q/24146885
type: Comment
has text: What is the error msg EXACTLY? Show us some minimal code that shows your problem.
type: QuestionComment

http://stackoverflow.com/q/24148570
tagged with: spawn
tagged with: java
has body: I'm trying to compile a .java file with the javac command then I want to to execute it with the java command. Here is what I'm trying : var spawn = require('child_process').spawn; var javac = spawn('javac', [' C:/Users/Administator/Desktop/Hello.java']); var javaa = spawn('java', [' C:/Users/Administator/Desktop/Hello']); javac.stdout.on('data', function out(data) { console.log(data); javaa.stdout.on('data', function out(data) { console.log(data); }); javaa.stderr.on('data', function(data) { console.log("error"); }); javaa.on('exit', function out(data) { console.log(data); }); }); javac.stderr.on('data', function(data) { console.log("error"); }); javac.on('exit', function out(data) { console.log(data); });
has comment: http://stackoverflow.com/comment/37265458
tagged with: node.js
tagged with: command
score: 0
has comment: http://stackoverflow.com/comment/37268020
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/24396301
type: Question
has title: How can I execute a Java command on nodeJS?

http://stackoverflow.com/q/24181776
has answer: http://stackoverflow.com/a/25527551
tagged with: validation
downvote count: 0
score: 1
upvote count: 1
answer count: 1
favorite count: 0
has title: Stop object field validation on first failure
type: Question
tagged with: oval
has body: I'm using OVAL as object validation framework in my project. Let's say I have the following object: public class MyObject { @NotNull(message = "Amount cannot be null.") @NotNegative(when = "groovy:((_value != null) &amp;&amp; (_value.getAmount() &lt;= 0))", message = "Amount cannot be ZERO or negative.") private Currency amount; } Without specifying (_value != null) in @NotNegative annotation it fails with java.lang.NullPointerException even though there is additional @NotNull annotation which should check that case. Is it possible somehow to avoid that duplication?
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/comment/37390866
has text: Technically, `subMap(K, K)` is available through the `SortedMap` interface.
type: Comment
comment on: http://stackoverflow.com/a/24214771
score: 0
type: AnswerComment

http://stackoverflow.com/q/24227563
favorite count: 0
accepted answer: http://stackoverflow.com/a/24227813
downvote count: 0
upvote count: 1
score: 1
has body: I would like to parse data from JSON which is String type. My JSON response looks like [{"order":-1,"number":"5"},{"order":0,"number":"7"},{"order":1,"number":"3"}] I tried to use next method: JSONArray json = new JSONArray("My JSON String"); for (int i = 0; i &lt; json.length(); i++) { JSONObject json_staticon = json.getJSONObject(i); if(json_staticon.getInt("order") == 0) { return json_staticon.getInt("number"); } } But I want to use Google GSON library to parse my JSON responses, so... what better way to get number value in object with order = 0 using GSON? Thanks!
has answer: http://stackoverflow.com/a/24227813
answer count: 1
tagged with: android-json
has title: How to get JSON Object with specific value in Android using GSON
type: Question
type: AnsweredQuestion
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson

http://stackoverflow.com/q/24211078
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37383505
downvote count: 1
tagged with: file-io
score: 0
has comment: http://stackoverflow.com/comment/37393532
tagged with: java
answer count: 1
upvote count: 1
favorite count: 0
type: Question
has title: Reading big files in Java using readfully
has answer: http://stackoverflow.com/a/24211314
has body: I have a big file of size 10gb, If i read its whole contents using readfully() in java, I get a outofmemoryerror, so i decided to read the big 10gb file in parts using same readfully(), for this i need to pass the offset and length parameters for readfully(). The offset must be of long or double datatype so that it can point to different parts of the file. But the readfully() accepts only int offset. How to read the big data? try { IOUtils.readFully(in, contents, minOffset, maxOffset); value.set(contents, 0, contents.length); } finally { IOUtils.closeStream(in); } Can I use seek() to get to a specific position and then use readfully() from that position?
has comment: http://stackoverflow.com/comment/37384349

http://stackoverflow.com/comment/116076420
score: 0
type: Comment
type: QuestionComment
has text: @allprog "natural" does not mean good or correct.
comment on: http://stackoverflow.com/q/24232513

http://stackoverflow.com/a/24152369
has comment: http://stackoverflow.com/comment/37273002
has comment: http://stackoverflow.com/comment/37272990
has comment: http://stackoverflow.com/comment/37272914
answers question: http://stackoverflow.com/q/24152351
type: Answer
has comment: http://stackoverflow.com/comment/37273027
has comment: http://stackoverflow.com/comment/37273017
has comment: http://stackoverflow.com/comment/37272996
score: 12
upvote count: 12
has body: Java doesn't analyze the logic of your if blocks determine that one of your if statements will run and assign a value to i. It is simple and it sees the possibility of none of the if statements running. In that case, no value is assigned to i before it's used. Java will not give a default value to a local variable, even if it gives default values to class variables and instance variables. Section 4.12.5 of the JLS covers this: Every variable in a program must have a value before its value is used: and A local variable (§14.4, §14.14) must be explicitly given a value before it is used, by either initialization (§14.4) or assignment (§15.26) Assign some kind of default value to i, when you declare it, to satisfy the compiler. int i = 0; // Your if statements are here. return number[i];
has comment: http://stackoverflow.com/comment/37273050
downvote count: 0
has comment: http://stackoverflow.com/comment/37272871

http://stackoverflow.com/comment/37616455
type: Comment
score: 0
has text: You may skip the quotation marks, I admit to my answer being cocky. So what? My criticism is substantial and my answer constructive even so. It is just not true that there are no good AOP tutorials out there. If you read http://www.eclipse.org/aspectj/doc/next/progguide/starting.html you will see that it is targeted at absolute beginners coming from POJO development. I am a POJO developer myself, I never use Spring or EJB. I taught myself AspectJ just by reading the tutorials and other documentation material. I can also recommend the book "AspectJ in Action" by Ramnivas Laddad. Good luck!
type: AnswerComment
comment on: http://stackoverflow.com/a/24330001

http://stackoverflow.com/a/24129022
has comment: http://stackoverflow.com/comment/37230252
accepted answer of: http://stackoverflow.com/q/24128609
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24128609
has comment: http://stackoverflow.com/comment/37231039
score: 5
has body: You can't do it with an enum, but is there any reason that a simple Map wouldn't serve your purposes? Or, since you have some other utility methods, a class backed by a Map? You could add only those messages for libraries that have been loaded, and if there is a clear delineation between the loading phase and run phase of your application, you could even use a builder pattern and freeze the Map as an immutable map, so that once the application was running no further changes could be made to the messages. (This could be done with either Collections.unmodifiableMap() or one of the immutable map types from Guava.) One thing that is not entirely clear to me is whether you are guaranteed that there will be no collisions in the messages used by different libraries. That could be a concern. For example: import java.util.HashMap; import java.util.Map; public class MessageType { private final static Map&lt;Long, MessageType&gt; messageTypes = new HashMap&lt;&gt;(); // it isn't clear how the libraries would provide information on // the message types they support; suppose that each library has a // MessageInfo that implements Map&lt;Long, String&gt; with all its types: public static void loadLibrary(MessageInfo messageInfo) { // populate the map with each message type it supports for (Map.Entry&lt;Long, String&gt; entry : messageInfo.entrySet()) { MessageType messageType = new MessageType(entry.getKey(), entry.getValue()); messageTypes.put(entry.getKey(), messageType); } } // A MessageType has a name and a number private final long number; private final String name; private MessageType(long number, String name) { this.number = number; this.name = name; } public long getMessageNumber() { return number; } public String getMessageName() { return name; } public static MessageType fromMessageNumber(long number) { if (!messageTypes.containsKey(number)) { throw new IllegalArgumentException("Unknown message: " + number); } return messageTypes.get(number); } } You could also add check…
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/37230420

http://stackoverflow.com/comment/37237897
type: Comment
has text: openjpa dont like it.. this what it get: <openjpa-1.2.1-SNAPSHOT-r422266:686069 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Encountered "b" at character 63, but expected: [",", ".", "GROUP", "HAVING", "INNER", "JOIN", "LEFT", "ORDER", "WHERE", <EOF>].
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24123330

http://stackoverflow.com/q/24183744
has comment: http://stackoverflow.com/comment/37330381
answer count: 2
downvote count: 0
has title: Where to look for exact effects of Spring XML namespaces configuration?
has answer: http://stackoverflow.com/a/24184105
tagged with: spring-security
favorite count: 0
accepted answer: http://stackoverflow.com/a/24183936
type: Question
has answer: http://stackoverflow.com/a/24183936
tagged with: java
possible better answer: http://stackoverflow.com/a/24184105
has body: As we know, Spring Framework has lot of configuration elements in XML namespaces such as: &lt;mvc:annotation-config/&gt; &lt;tx:annotation-driven/&gt; Some of them do a really huge amout of work, for example: &lt;http&gt; element in Spring Security security namespace. Where to look to find exact code (more than documentation says ) for all effects of introducing particular XML element? For example - where should I look if I want to see exact Spring actions caused by ussing &lt;security:csrf&gt; element in &lt;security:http&gt; element? (which filters/interceptors/converters are added, what scope attributes becomes available etc.)
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
score: 4
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/24244935
has body: I doubt your UDF evaluates return type Text . Change return type from Text to String as Hive supports following String types : STRING VARCHAR (Note: Only available starting with Hive 0.12.0) CHAR (Note: Only available starting with Hive 0.13.0) please check the Hive datatypes link
answers question: http://stackoverflow.com/q/24226554
type: Answer
score: 0

http://stackoverflow.com/comment/37266579
type: Comment
has text: My result type is not FTL,but jsp, I send out the email,and that email template is FTL.I store the session value in value stack and then want to access those values in FTL Template.I have action class which trigger the email class, and in that email class, I load FTL Template and do the required processing and once email is send.Everything works fine just that in FTL template I dont get the values.But values are there in jsp result type configured.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24148319

sqlite
tags question: http://stackoverflow.com/q/24181617
tags question: http://stackoverflow.com/q/24183425
tags question: http://stackoverflow.com/q/24164063
tags question: http://stackoverflow.com/q/24226526
tags question: http://stackoverflow.com/q/24144967
tags question: http://stackoverflow.com/q/24181829
tags question: http://stackoverflow.com/q/24224373
tags question: http://stackoverflow.com/q/24161848
tags question: http://stackoverflow.com/q/24231993
tags question: http://stackoverflow.com/q/24206746
type: Tag
tags question: http://stackoverflow.com/q/24176749
tags question: http://stackoverflow.com/q/24209259
tags question: http://stackoverflow.com/q/24265919
tags question: http://stackoverflow.com/q/24138529
tags question: http://stackoverflow.com/q/24208202
tags question: http://stackoverflow.com/q/24228066
tags question: http://stackoverflow.com/q/24181972
tags question: http://stackoverflow.com/q/24128145
tags question: http://stackoverflow.com/q/24115541
tags question: http://stackoverflow.com/q/24111114
tags question: http://stackoverflow.com/q/24111912
tags question: http://stackoverflow.com/q/24113343
tags question: http://stackoverflow.com/q/24228566
tags question: http://stackoverflow.com/q/24234985
tags question: http://stackoverflow.com/q/24258060
tag name: sqlite
tags question: http://stackoverflow.com/q/24160453
tags question: http://stackoverflow.com/q/24108116
tags question: http://stackoverflow.com/q/24240320

enumeration
tag name: enumeration
type: Tag
tags question: http://stackoverflow.com/q/24147223

http://stackoverflow.com/q/24226029
score: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27578712
has comment: http://stackoverflow.com/comment/37427700
upvote count: 3
tagged with: java
answer count: 1
tagged with: junit
downvote count: 0
has body: I have a test that perfectly works in Eclipse but fails in Gradle. I am not sure what is wrong. I am using Java 8 in Eclipse. prompt: E:\Files\Source\Workspace-Eclipse2\project\src\test\java\com\project\core\domain\TeamUnitTest.java:31: error: no sui table method found for assertThat(List&lt;User&gt;,Matcher&lt;Collection&lt;Object&gt;&gt;) assertThat(team.getUsers(), empty()); ^ method Assert.&lt;T#1&gt;assertThat(T#1,Matcher&lt;? super T#1&gt;) is not applicable (actual argument Matcher&lt;Collection&lt;Object&gt;&gt; cannot be converted to Matcher&lt;? super List&lt;User&gt;&gt; by method invocati on conversion) method Assert.&lt;T#2&gt;assertThat(String,T#2,Matcher&lt;? super T#2&gt;) is not applicable (cannot instantiate from arguments because actual and formal argument lists differ in length) where T#1,T#2 are type-variables: T#1 extends Object declared in method &lt;T#1&gt;assertThat(T#1,Matcher&lt;? super T#1&gt;) T#2 extends Object declared in method &lt;T#2&gt;assertThat(String,T#2,Matcher&lt;? super T#2&gt;) E:\Files\Source\Workspace-Eclipse2\project\src\test\java\com\project\core\domain\TeamUnitTest.java:51: error: no sui table method found for assertThat(List&lt;User&gt;,Matcher&lt;Collection&lt;Object&gt;&gt;) assertThat(team.getUsers(), empty()); ^ method Assert.&lt;T#1&gt;assertThat(T#1,Matcher&lt;? super T#1&gt;) is not applicable (actual argument Matcher&lt;Collection&lt;Object&gt;&gt; cannot be converted to Matcher&lt;? super List&lt;User&gt;&gt; by method invocati on conversion) method Assert.&lt;T#2&gt;assertThat(String,T#2,Matcher&lt;? super T#2&gt;) is not applicable (cannot instantiate from arguments because actual and formal argument lists differ in length) where T#1,T#2 are type-variables: T#1 extends Object declared in method &lt;T#1&gt;assertThat(T#1,Matcher&lt;? super T#1&gt;) T#2 extends Object declared in method &lt;T#2&gt;assertThat(String,T#2,Matcher&lt;? super T#2&gt;) 2 errors :compileTestJava FAILED test code: assertThat(team.getU…
tagged with: gradle
has title: Tests pass in Eclipse but fails in Gradle. Related to assertThat
favorite count: 0
has comment: http://stackoverflow.com/comment/37413808
type: Question

http://stackoverflow.com/q/24258377
has comment: http://stackoverflow.com/comment/37473954
has comment: http://stackoverflow.com/comment/37473842
answer count: 0
type: UnansweredQuestion
tagged with: junit
has comment: http://stackoverflow.com/comment/37473548
tagged with: android-testing
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/37473988
type: Question
has body: In my Android project, I have a java class MyWorker.java : public class MyWorker{ private Context context; public MyWorker(Context context){ this.context = context; } public void doWork(){ Mission mission = new Mission(context); mission.do(); ... } } The Mission class is as simple as (It uses a class from 3rd party library Jackson): public class Mission{ private Context context; //ObjectMapper is a class from 3rd party library (Jackson JSON Processor) private ObjectMapper mapper; public Mission(Context context){ this.context = context; Log.i("tag", "The last log msg I see is this one!"); //when test case runs unit test, system kills my app here…why? mapper = new ObjectMapper(); Log.i("tag", "I don't see this log msg!"); } ... } I would like to unit test the doWork() function of MyWorker class. Here is my test case: public class MyWokerTest extends AndroidTestCase{ private Context context; @Override public void setUp() throws Exception{ super.setUp(); context = getContext(); } @Override protected void runTest(){ MyWorker worker = new MyWorker(context); worker.doWork(); } ... } When I run above test case, I always see the following log from logcat: I/tag(29538): The last log msg I see is this one! I/ActivityManager( 551): Force stopping package com.my.app uid=10211 I/ActivityManager( 551): Killing proc 29538:com.my.app/u0a211: force stop D/AndroidRuntime(29508): Shutting down VM D/dalvikvm(29508): GC_CONCURRENT freed 114K, 89% free 483K/4096K, paused 0ms+0ms, total 3ms system kills my app before mapper = newObjectMapper() in the constructor of Mission class, why? Do I miss something when writing unit test for a class which uses 3rd party library???
score: 0
has title: When run unit test, system kills my app in the middle of class's constructor before 3rd party library class call
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37473440
has comment: http://stackoverflow.com/comment/37473490

http://stackoverflow.com/comment/37240079
type: AnswerComment
has text: Then may be converters can help as others have pointed out, but I have no experience with the converters.
comment on: http://stackoverflow.com/a/24134774
score: 0
type: Comment

filenotfoundexception
type: Tag
tag name: filenotfoundexception
tags question: http://stackoverflow.com/q/24128318
tags question: http://stackoverflow.com/q/24175896

http://stackoverflow.com/q/24117897
answer count: 1
type: Question
tagged with: soapui
tagged with: soap
accepted answer: http://stackoverflow.com/a/24136162
tagged with: web-services
has comment: http://stackoverflow.com/comment/37210358
has comment: http://stackoverflow.com/comment/37208929
has answer: http://stackoverflow.com/a/24136162
has body: I have to call a webservice with SOAP that happens to have a ^ in the URL. The URL has this structure String url = "http://sampleurl.com?type=entry&amp;version=1.0&amp;Sender.Service=SenderService&amp;Interface=sampleurl/ABC^ServiceRequest"; This gives me the following exception: com.sun.xml.messaging.saaj.util.JaxmURI$MalformedURIException: Query string contains invalid character:^ 11:47:10,670 ERROR [STDERR] at com.sun.xml.messaging.saaj.util.JaxmURI.initializePath(JaxmURI.java:690) 11:47:10,670 ERROR [STDERR] at com.sun.xml.messaging.saaj.util.JaxmURI.initialize(JaxmURI.java:407) 11:47:10,670 ERROR [STDERR] at com.sun.xml.messaging.saaj.util.JaxmURI.&lt;init&gt;(JaxmURI.java:194) 11:47:10,670 ERROR [STDERR] at com.sun.xml.messaging.saaj.util.JaxmURI.&lt;init&gt;(JaxmURI.java:178) 11:47:10,670 ERROR [STDERR] at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:254) The thing that puzzle me out is that calling the webservice with SOAP UI gives me a correct answer even if I put the ^ in the URL. If I scape the caret character to %5e in my application or in SOAP UI the webservice responds "Message is incomplete. No Sender found" so it seems that the ^ must be present. Any idea of how to put ^ in the URL without giving an exception?
type: AnsweredQuestion
score: 0
has title: SOAP MalformedURIException with character ^
tagged with: java

http://stackoverflow.com/a/24241136
downvote count: 1
type: Answer
score: -1
has body: If your task is not so big, you can use Thread.sleep() method(example 10 iteration with 10 minutes delay): public static void main(String[] args) throws InterruptedException { methodOne(); for (int i = 0; i &lt; 10; i++) { Thread.sleep(600000); methodTwo(); } }
answers question: http://stackoverflow.com/q/24240737
upvote count: 0

http://stackoverflow.com/q/24204966
has title: java string comparsion by words ignoring space
has body: How to compare dynamic strings by considering the words in java ? For example: narendar baddam and narendar baddam should ignore the extraspace for dynamic input. need to be same
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37371344
type: Question
has comment: http://stackoverflow.com/comment/37371334
has answer: http://stackoverflow.com/a/24206821
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/24205004
has answer: http://stackoverflow.com/a/24205105
downvote count: 4
upvote count: 0
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/24205012

http://stackoverflow.com/q/24222676
tagged with: gson
has comment: http://stackoverflow.com/comment/37405237
linked to: http://stackoverflow.com/q/20057695
type: Question
has comment: http://stackoverflow.com/comment/37405345
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/20057695
has title: GSON getting arrays
score: 0
answer count: 0
tagged with: java
has body: I'm fairly new to GSON and I was wondering how to store an array from a json page, for example if I have: {capitals:[{"alabama":"montgomery"},{"alaska":"juneau"},{"arizona":"phoenix"}]} I'm unsure of how to do this, previously I've had pages a name and information inside of them (like so), "name":{"var1":"aaa", "var2":"bbb"} and I've been able to create a class for that, just a bit confused of how to process arrays.

http://stackoverflow.com/comment/37505565
comment on: http://stackoverflow.com/q/24229704
score: 0
type: Comment
has text: great if you post this as an answer I can accept
type: QuestionComment

http://stackoverflow.com/q/24237874
score: 2
answer count: 0
has title: Security warning prompt for Java Applet
tagged with: java
tagged with: certificate
downvote count: 0
tagged with: warnings
tagged with: applet
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
tagged with: manifest
has body: Starting from JRE 1.7 update 55, in some circumstances (not always, expecially if i call application by host-name instead of by IP), security warning is always shown, even if i check "Don't show this message again". Manifest is fixed according to the latest directives UPDATE Investigating JRE security log, i've noticed that, where applet works correctly, i've these lines: security: Caricamento certificati di distribuzione da C:\Users\Redturtle\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs security: Certificati di distribuzione caricati da C:\Users\Redturtle\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs security: Caricamento certificati di distribuzione da C:\Users\Redturtle\AppData\LocalLow\Sun\Java\Deployment\security\sandbox.certs security: Certificati di distribuzione caricati da C:\Users\Redturtle\AppData\LocalLow\Sun\Java\Deployment\security\sandbox.certs security: Caricamento certificati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Certificati caricati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Caricamento certificati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Certificati caricati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Caricamento certificati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Certificati caricati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Caricamento certificati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Certificati caricati dallarea di memorizzazione dei certificati della sessione di distribuzione security: Caricamento certificati dall'area di memorizzazione dei certificati di Internet Explorer TrustedPublisher security: Certificati caricati dall'area di memorizzazione dei certificati di Internet Explorer TrustedPublisher security: …

http://stackoverflow.com/q/24106168
accepted answer: http://stackoverflow.com/a/24106217
has answer: http://stackoverflow.com/a/24106217
possible better answer: http://stackoverflow.com/a/24106184
type: Question
tagged with: actionlistener
has title: ActionListener problems
has body: I have been making an applet for a project for my school but I stumbled upon a nasty error. My problem is probably quite common but I can't seem to find an answer for it. I have been getting the error: The type Pyramid must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent) but I have already implemented the method in there and it's spelling is correct. I checked so many times that my head hurts. My project has frozen at this process for like 3 hours now and I have no idea how to get it to work. Oh and also do you think that using 3 polygons to draw a pyramid is the best way to do it in java? import java.awt.*; import java.applet.*; import java.awt.event.*; public class Pyramid extends Applet implements ActionListener { int n = 3; // vurhove double a, k; double Sok, S, V; public void init() { setLayout(null); TextField aT; // textbox za osn. rub aT = new TextField("Osnoven rub", 20); aT.setBounds(20, 410, 125, 20); TextField lT; // textbox za ok. rub lT = new TextField("Okolen rub", 20); lT.setBounds(20, 460, 125, 20); TextField SokT; // textbox S ok. SokT = new TextField("Okolna povurhnina", 20); SokT.setBounds(20, 510, 125, 20); TextField ST; // textbox S1 ST = new TextField("Osnovna povurhnina", 20); ST.setBounds(20, 560, 125, 20); TextField VT; // textbox za obema VT = new TextField("Obem", 20); VT.setBounds(20, 610, 125, 20); Button ochButton; // izchertava piramidata ochButton = new Button("Izchertai"); ochButton.setBounds(700, 435, 100, 30); ochButton.addActionListener(ActionOchButton); Button oznButton; // ozna4ava vurhovete, izpisva velichinite oznButton = new Button("Oznachi cherteja"); oznButton.setBounds(700, 510, 100, 30); oznButton.addActionListener(ActionOznButton); Button iButton; // iz4islqva veli4inite iButton = new Button("Izchisli"); iButton.setBounds(700, 585, 100, 30); iButton.addActionListener(ActioniButton); add(aT); add(lT); add(SokT); add(ST); add(VT); add(ochButton); add(oznButton); add(iButton); Color bg; …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24106184
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24106204
tagged with: java

http://stackoverflow.com/comment/37312740
score: 0
has text: Using getClass().getName().equals and getClass().equals did the trick for me. For some reason, I had the same solution as this answer, but on my end, I was getting an empty count even when I debugged and could visibly see the class I wanted in the list. Thanks for the answers and comments!
comment on: http://stackoverflow.com/a/24172037
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24248991
has title: The type of the expression must be an array type but it resolved to int error
type: Question
has answer: http://stackoverflow.com/a/24249057
type: UnansweredQuestion
tagged with: arrays
score: -3
has answer: http://stackoverflow.com/a/24249036
answer count: 4
has body: I am tying to compile a white loop for a set of arrays, but am getting the following error: The type of the expression must be an array type but it resolved to int Here is what I have: package PayrollPractice; import java.text.DecimalFormat; //Payroll Class, pg 504 public class Payroll { private int[] _emp; //employee ID private int[] _hours; //hours worked private double[] _rates; //rate of pay private double[] _wages; //wages public Payroll() { //array of employee ID(s) _emp = new int[] { 5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489 }; } public boolean is_emp(int number) { int index, //loop control variable _emp; //element the value is found at boolean found; //flag indicating the search results //element 0 is the starting point of the search, pg 463 index = 0; //Store the default values for the element and found, pg 463 _emp = -1; found = false; //search the array, pg 463 while (!found &amp;&amp; index &lt; _emp) { //does this element have a value? if (_emp[index] == number) //ERROR: The type of the expression must be an array type but it resolved to int { found = true; } else { //increment index so we can look at the next element index++; } } //return either the subscript of the value(if found) //or -1 to indicate the value was not found. return found; }
upvote count: 0
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24249165
has answer: http://stackoverflow.com/a/24249059
favorite count: 0

http://stackoverflow.com/q/24225568
has answer: http://stackoverflow.com/a/24225726
tagged with: antlr4
has answer: http://stackoverflow.com/a/24225623
upvote count: 2
tagged with: exception
downvote count: 0
has body: I have a 10gb file and I need to parse it in Java, whereas the following error arises when I attempt to do this. java.lang.NegativeArraySizeException at java.util.Arrays.copyOf(Arrays.java:2894) at org.antlr.v4.runtime.ANTLRInputStream.load(ANTLRInputStream.java:123) at org.antlr.v4.runtime.ANTLRInputStream.&lt;init&gt;(ANTLRInputStream.java:86) at org.antlr.v4.runtime.ANTLRInputStream.&lt;init&gt;(ANTLRInputStream.java:82) at org.antlr.v4.runtime.ANTLRInputStream.&lt;init&gt;(ANTLRInputStream.java:90) How can I solve this problem properly? How can I adjust such an input stream to handle this error?
score: 2
type: AnsweredQuestion
tagged with: large-files
answer count: 3
has title: NegativeArraySizeException ANTLRv4
tagged with: java
possible better answer: http://stackoverflow.com/a/24225659
has answer: http://stackoverflow.com/a/24225659
accepted answer: http://stackoverflow.com/a/24225726
favorite count: 0
type: Question

http://stackoverflow.com/comment/37484018
type: Comment
comment on: http://stackoverflow.com/a/24264124
score: 0
type: AnswerComment
has text: ya I know it.But after this step I don't Know

http://stackoverflow.com/q/24121021
has answer: http://stackoverflow.com/a/24137800
score: 1
has comment: http://stackoverflow.com/comment/37213569
has comment: http://stackoverflow.com/comment/37213521
favorite count: 0
has comment: http://stackoverflow.com/comment/37213479
has answer: http://stackoverflow.com/a/24121113
tagged with: kinect
type: Question
has comment: http://stackoverflow.com/comment/37241835
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/37216356
type: UnansweredQuestion
has body: I receive in my program continous position of the hand (with kinect), the output looks like this: Hand position:838.64514 Hand position:840.4282 Hand position:852.3208 Hand position:866.03687 Hand position:893.8414 Hand position:921.6699 Hand position:945.2051 Hand position:972.0855 Hand position:1000.8606 Hand position:1025.4481 Hand position:1057.6517 Hand position:1084.9567 Hand position:1103.6124 Hand position:1129.9386 Hand position:1150.4238 Hand position:1165.6777 Hand position:1189.4777 Hand position:1209.6266 Hand position:1229.9663 Hand position:1243.3293 Hand position:1292.5873 Hand position:1277.4403 Hand position:1285.637 Hand position:1296.5696 Hand position:1281.771 Hand position:1348.9625 Hand position:1356.9446 Hand position:1357.5063 Hand position:1371.6934 Hand position:1357.644 Hand position:1363.991 Hand position:1346.6333 Hand position:1368.9194 Hand position:1319.148 Hand position:1309.4614 Hand position:1453.7458 Hand position:1293.8644 Hand position:1277.6212 Hand position:1266.6547 Hand position:1245.1154 Hand position:1233.5824 Hand position:1244.8787 Hand position:1227.302 Hand position:1211.7441 Hand position:1168.937 Hand position:1172.2562 Hand position:1141.3367 Hand position:1112.7675 Hand position:1079.6964 Hand position:1046.8102 Hand position:1002.8637 Hand position:966.8124 Hand position:1031.8394 Hand position:1041.4575 Hand position:969.2346 Hand position:857.4234 Hand position:845.1776 Hand position:828.65186 Hand position:829.81885 Hand position:835.6876 the number represent the z position of the hand. So z was approximately 800 and then it grew to approximately 1200 and then it come back to 800. All this represent one "Beat" or one "hit" with the hand. I want to detect this variation. I started coding something like this if (position &gt; oldPosition) difference=difference+ position - oldPosition; if (difference &gt; 120) println ( "One Hit"); difference=0; oldPosition=position; before I continue developing I wanted to be su…
has title: Detect variation of numbers
upvote count: 3
tagged with: java

http://stackoverflow.com/q/24245341
has body: I created an applet that is called by JSP file. I wish to pass a Java object to the applet. Is it possible, and if it possible how can I do it?
answer count: 0
duplicate of: http://stackoverflow.com/q/1389834
upvote count: 1
tagged with: java
downvote count: 1
tagged with: jsp
favorite count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/37448492
has comment: http://stackoverflow.com/comment/37448589
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1389834
has title: Passing Java objects from JSP to an applet
score: 0

http://stackoverflow.com/comment/37299434
type: Comment
has text: I agree. If a class has no need for direct public/external use, I would make it private/package-protected in the same source file where it's used. Aside from builders, I haven't use inner classes too much. FYI, I just rewrote my own answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24151250

http://stackoverflow.com/q/24140069
tagged with: multithreading
has answer: http://stackoverflow.com/a/24140210
has answer: http://stackoverflow.com/a/24140184
downvote count: 1
accepted answer: http://stackoverflow.com/a/24140184
tagged with: synchronization
favorite count: 0
type: Question
has body: Pretty much all resources I've found on synchronized blocks use this or a member of the class as a lock object. I'm interested in finding out why I can't get synchronized blocks to work when the lock object is a (static) member of another class. Here's my code to illustrate the problem: public class Test { public static void main(String[] args) { Thread thread1 = new FirstThread(); Thread thread2 = new SecondThread(); thread1.start(); thread2.start(); } } class FirstThread extends Thread { @Override public void run() { synchronized (Lock.lock) { System.out.println("First thread entered block"); try { Lock.lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("First thread exited block"); } } class SecondThread extends Thread { @Override public void run() { try { Thread.sleep(1000); //just making sure second thread enters synch block after first thread } catch (InterruptedException e) { e.printStackTrace(); } synchronized (Lock.lock) { System.out.println("Second thread entered block"); Lock.lock.notifyAll(); } System.out.println("Second thread exited block"); } } class Lock { public static Object lock = new Object(); } My understanding is that the second thread should not be able to enter the synchronized block until the first thread exits, since they are synchronized on the same object. Thus I was expecting the program to hang (deadlock?) after "First thread entered block", since the second thread can't enter the block and the first thread will be stuck waiting for a notification. But instead I got the following output: First thread entered block Second thread entered block Second thread exited block First thread exited block Clearly the second thread enters the synchronized block before the first thread has left it's block. Can someone explain what I'm missing? I thought the purpose of synchronized blocks was to prevent exactly this. Is it because the lock object is a member of another class?
has title: Synchronized blocks don't work when using member of unrelated class as lock object?
has answer: http://stackoverflow.com/a/24140178
possible better answer: http://stackoverflow.com/a/24140178
linked to: http://stackoverflow.com/q/1036754
type: AnsweredQuestion
score: 0
answer count: 3
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/37350312
type: QuestionComment
comment on: http://stackoverflow.com/q/24193660
score: 0
has text: entityManager.refresh(user)
type: Comment

http://stackoverflow.com/a/24233277
has comment: http://stackoverflow.com/comment/37953586
has comment: http://stackoverflow.com/comment/37707982
accepted answer of: http://stackoverflow.com/q/24223103
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24223103
has body: isn't the jar filtered? Maybe an ignored prefix
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37453409
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24196631
tagged with: methods
answer count: 4
score: 2
has answer: http://stackoverflow.com/a/24196729
has comment: http://stackoverflow.com/comment/37357179
upvote count: 2
has answer: http://stackoverflow.com/a/24196815
has comment: http://stackoverflow.com/comment/37355956
downvote count: 0
has answer: http://stackoverflow.com/a/24197531
has comment: http://stackoverflow.com/comment/37355720
accepted answer: http://stackoverflow.com/a/24196669
has comment: http://stackoverflow.com/comment/37355725
favorite count: 0
type: Question
type: AnsweredQuestion
has title: Which is the most professional way to combine functions
tagged with: performance
has body: I am taking a Java course and have a question about professionalism and efficiency. I have read that it is best not to create temporary variables. I have answered one of the quiz questions correctly as follows: public void removeLowest(){ remove(find(lowScore())); //doesn't really read very easily } The answer broke down each step like this: public void removeLowest(){ double low = lowScore(); int lowScoreIndex = find(low); remove(lowScoreIndex); } Both versions accomplish the same task, but which is better? Thanks.
possible better answer: http://stackoverflow.com/a/24196815
tagged with: java
has answer: http://stackoverflow.com/a/24196669

http://stackoverflow.com/q/24199884
upvote count: 3
answer count: 2
has body: With Java7 and Java8, I would like to generate a warning if some methods was called. The warning will be print if a specific jar is present when then user compile. I write an Annotation Processor and catch the visitMethodInvocation(). Now, I want extract the class and method names will be invoked. Is it possible to do that ? Or how to approach this?
has comment: http://stackoverflow.com/comment/37962407
downvote count: 0
has title: Java8, how discover the class and method name in visitMethodInvocation?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24577343
linked to: http://stackoverflow.com/q/1066555
tagged with: annotations
has comment: http://stackoverflow.com/comment/37364387
favorite count: 0
type: Question
score: 3
tagged with: javac
tagged with: java
has comment: http://stackoverflow.com/comment/38013562
has comment: http://stackoverflow.com/comment/37366481
has answer: http://stackoverflow.com/a/24575253

http://stackoverflow.com/a/24259842
score: 12
answers question: http://stackoverflow.com/q/24259508
upvote count: 12
accepted answer of: http://stackoverflow.com/q/24259508
downvote count: 0
has body: Make sure, following jar file included in your class path and lib folder. spring-core-3.0.5.RELEASE.jar if you are using maven, make sure you have included dependency for spring-core-3xxxxx.jar file org.springframework spring-core ${org.springframework.version} Note : Replace ${org.springframework.version} with version number.
has comment: http://stackoverflow.com/comment/93031349
has comment: http://stackoverflow.com/comment/98849969
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/comment/37440591
has text: im sorry i don't understand your answer in regard to my question
type: Comment
comment on: http://stackoverflow.com/a/24239789
score: 0
type: AnswerComment

http://stackoverflow.com/q/24108492
type: Question
upvote count: 0
has body: hi am unable to load class in my android app , i can load basic class but when i Initialize context in that class then am not able to load it public class main { // Initalize context Context mContext; public main(Context mContext){ this.mContext = mContext; } public boolean main() { Log.d("MYLOG", "main() called successfully when there context is not initialized like above"); // some code here } } my class loading code try{ final File tmpDir = context.getDir("dex", 0); final DexClassLoader classloader = new DexClassLoader(libPath, tmpDir.getAbsolutePath(), null, this.getClass().getClassLoader()); final Class&lt;Object&gt; classToLoad = (Class&lt;Object&gt;) classloader.loadClass("com.myproject.test.dumy_class"); // package plus main class final Object myInstance = classToLoad.newInstance(); // throwing exception here } } catch (Exception e) { // exception thrown at that statement : final Object myInstance = classToLoad.newInstance(); } Exception i got : java.lang.InstantiationException: can't instantiate class com.myproject.test.dumy_class; no empty constructor so please help .
tagged with: loader
has comment: http://stackoverflow.com/comment/37190175
tagged with: dex
linked to: http://stackoverflow.com/q/234600
answer count: 1
has comment: http://stackoverflow.com/comment/37192057
has comment: http://stackoverflow.com/comment/37190329
favorite count: 0
has comment: http://stackoverflow.com/comment/37190095
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37192308
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24109585
downvote count: 1
accepted answer: http://stackoverflow.com/a/24109585
score: -1
has title: Android java unable to load class

http://stackoverflow.com/comment/37306941
type: Comment
type: QuestionComment
has text: Interestingly enough, if you run `javap -c Test` on this, it says it's getting the static `Field Sub.ID:Ljava/lang/String;`!
score: 0
comment on: http://stackoverflow.com/q/24170682

http://stackoverflow.com/comment/37191603
type: AnswerComment
has text: It depends on where you create the object, if it's inside your activity `MyPhoneStateListener phoneListener = new MyPhoneStateListener(this);` is ok.
type: Comment
comment on: http://stackoverflow.com/a/24109131
score: 0

http://stackoverflow.com/comment/37410515
score: 0
comment on: http://stackoverflow.com/a/24218658
type: AnswerComment
has text: Well, I feel dumb now. Between Powershell and Cygwin, it's been so long since I've used CMD it didn't even occur to me to try it. ... Thank you, that seems to have worked.
type: Comment

http://stackoverflow.com/q/24227137
has comment: http://stackoverflow.com/comment/37413746
upvote count: 0
tagged with: paint
downvote count: 2
score: -2
has body: I am following the tutorial on the Oracle website about the use of RescaleOp. I am trying to do the tutorial without an applet and convert everything to swing. The code follows. import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.awt.image.RescaleOp; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; /* * How to load an Image from an external file. */ public class ARGB extends JPanel { BufferedImage img; float[] scales = { 1f, 1f, 1f, 0.5f }; float[] offsets = new float[4]; RescaleOp rop; public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.white); g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.setColor(Color.black); g2d.setFont(new Font("Dialog", Font.BOLD, 24)); g2d.drawString("Java 2D is great!", 10, 80); g2d.drawImage(img, rop, 0, 0); System.out.println("hi"); } public ARGB() { try { img = ImageIO.read(new File("src/strawberry.jpg")); } catch (IOException e) { e.printStackTrace(); // TODO: handle exception } } public Dimension getPreferredSize() { if (img == null) { return new Dimension(100, 100); } else { return new Dimension(img.getWidth(), img.getHeight()); } } public void setOpacity(float opacity) { scales[3] = opacity; rop = new RescaleOp(scales, offsets, null); } public static void main(String[] args) { // TODO Auto-generated method stub final ARGB argb = new ARGB(); JFrame frame = new JFrame("See Through Image"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.add("Center", new LoadImage()); JSlider opacitySlider = new JSlider(0, 100); frame.a…
answer count: 1
has title: Paint, Repaint, and PaintComponent
tagged with: swing
accepted answer: http://stackoverflow.com/a/24227223
has comment: http://stackoverflow.com/comment/37414231
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24227223
favorite count: 0

http://stackoverflow.com/comment/37197326
type: QuestionComment
has text: Check out the [Apache HttpComponents](http://hc.apache.org/) library. It has classes that are comparable to the .NET code in your link.
comment on: http://stackoverflow.com/q/24112108
score: 1
type: Comment

http://stackoverflow.com/a/24110110
score: 2
has body: Here is the code which does the trick for you :) public class MainActivity extends Activity { TextView terminal; Button button1, button2, button3, button4; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); terminal = (TextView) findViewById(R.id.outputTerminal); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); } // Defines the buttons behavior when clicked. public void buttonClicked(View v) { switch (v.getId()) { case R.id.button1: terminal.append("Button1 clicked...\n"); break; case R.id.button2: terminal.append("Button2 clicked...\n"); break; case R.id.button3: terminal.append("Button3 clicked...\n"); break; case R.id.button4: terminal.append("Button4 clicked...\n"); break; } } } I see Now How it might be messing up with you. Please change the TextView in your Layout to like below: &lt;TextView android:id="@+id/outputTerminal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; And check the code now. Comment back if any issues.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24109636
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37193450
has comment: http://stackoverflow.com/comment/37193415
answers question: http://stackoverflow.com/q/24109636
has comment: http://stackoverflow.com/comment/37193874
has comment: http://stackoverflow.com/comment/37194030
type: Answer
has comment: http://stackoverflow.com/comment/37193586

http://stackoverflow.com/a/24184692
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24180898
has comment: http://stackoverflow.com/comment/37362345
has comment: http://stackoverflow.com/comment/37377046
has comment: http://stackoverflow.com/comment/37354838
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37365303
has comment: http://stackoverflow.com/comment/37364929
has comment: http://stackoverflow.com/comment/37340234
has body: It could be HikariCP, we fixed some issues with connection cleanup at shutdown in 1.3.9 (released this week). You should upgrade if you have not already done so. You are calling HikariDataSource.close() or HikariDataSource.shutdown(), right? If you're running in a container, you can configure the container to call one of these methods in its destroy configuration. If you do not shutdown the pool, it will indeed just abandon connections (any pool will). If you were not calling close() or shutdown(), that would be the problem, but we of course always recommend running on the latest version of HikariCP.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37364716
answers question: http://stackoverflow.com/q/24180898

http://stackoverflow.com/comment/37247909
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24138890
type: Comment
has text: The codes are ready in IAP Nokiax project anyones could download the IAP lib and sdk from nokia .when compiled in eclipse it only showed the button without any activity .

http://stackoverflow.com/comment/37516703
has text: checked and it doesn't return 206 .. it returns 200, so my guess is that it doesn't support range anymore on those links
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24259402

http://stackoverflow.com/comment/37443509
type: Comment
comment on: http://stackoverflow.com/q/24242224
type: QuestionComment
has text: Output a serialization of the byte array behind the values of "attribute" to see exactly what characters it contains. This will also help you catch stuff like nbsp for whitespace etc.
score: 1

http://stackoverflow.com/comment/37210520
comment on: http://stackoverflow.com/q/24119581
type: Comment
type: QuestionComment
score: 0
has text: Are you want data in 3 pairs ? means `id-name` like so..

http://stackoverflow.com/a/24206110
answers question: http://stackoverflow.com/q/24202714
type: Answer
has body: You will need to create a custom deserializer for ResourceDescription in order to accomplish what you need to do. The syntax for specifying a custom deserializer for ResourceDescription will look like this: @JsonDeserialize(using=ResourceDescriptionDeserializer.class) public class ResourceDescription { ... } This deserializer will have to iterate through each of the keys for each resource description to see if it begins with "tag_", strip off the prefix and use the remaining for the namespace and populate the name/value for the Tag before adding it to the array of the ResourceDescription being created. For all other attributes/types I think you can just defer to the default deserialization and set those attributes on their respective fields. Then, to deserialize the list of ResourceDescriptions you can specify a TypeReference to avoid writing a custom deserializer for ResourceDescriptions. The code will look something like this: Map&lt;String, List&lt;ResourceDescription&gt;&gt; resultMap = objectMapper.readValue(JSON, new TypeReference&lt;Map&lt;String, List&lt;ResourceDescription&gt;&gt;&gt;() {}); List&lt;ResourceDescription&gt; descriptions = resultMap.get("resourcedescriptions"); Here's an article that doesn't quite pair with what you're doing but I think will help with the general idea: Using Jackson to deserialize array nested within array in JSON object
score: 2
upvote count: 2
downvote count: 0

ios
tags question: http://stackoverflow.com/q/24221984
tags question: http://stackoverflow.com/q/24164078
type: Tag
tags question: http://stackoverflow.com/q/24209749
tags question: http://stackoverflow.com/q/24259421
tags question: http://stackoverflow.com/q/24248383
tags question: http://stackoverflow.com/q/24124273
tags question: http://stackoverflow.com/q/24189285
tag name: ios
tags question: http://stackoverflow.com/q/24266410

http://stackoverflow.com/comment/37249081
score: 0
comment on: http://stackoverflow.com/q/24139695
has text: I thought I seen it some example code somewhere. I've tried that before however and It doesnt make a difference
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37226191
comment on: http://stackoverflow.com/q/24127405
score: 0
type: QuestionComment
has text: FYI, added explanation as to why the reverse, `[*-+]`, would be valid! :)
type: Comment

http://stackoverflow.com/comment/37261469
has text: What implementation of Multimap are you using?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24146519

http://stackoverflow.com/a/24184342
type: Answer
has comment: http://stackoverflow.com/comment/37332702
has body: First: remove the for loop, its useless. Second: You cannot do that. There is no way to know in advance how long your statement will take. This depends on things like how many data you request, the network speed, other statements executed in the same moment or how much other load is on the machine. What you could to is the following (in pseudo code): Request how many rows are there in total and get row by row. On each row, you can increase the loading bar. You can split the loading bar by the number of rows or you can calculate how many rows would be 1%. int numberOfRows = SELECT COUNT(*) FROM MESSANGER; for(i in numberOfRows) row = SELECT * FROM MESSANGER WHERE ID = i print i + " rows from " + numberOfRows + " rows loaded"
answers question: http://stackoverflow.com/q/24180611
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37332415
accepted answer of: http://stackoverflow.com/q/24180611
score: 0

http://stackoverflow.com/comment/37271116
comment on: http://stackoverflow.com/a/24151223
type: AnswerComment
score: 0
has text: yes, the while loop is an infinite loop here, i tried also
type: Comment

http://stackoverflow.com/comment/92176118
type: Comment
has text: I am not sure how glassfish exposes the OSGi services. Can you try to check on the OSGi level which service properties are set? You can then query for these properties in the serviceCriteria.
type: QuestionComment
comment on: http://stackoverflow.com/q/24207684
score: 0

http://stackoverflow.com/a/24267947
has comment: http://stackoverflow.com/comment/37521595
has comment: http://stackoverflow.com/comment/37516565
has comment: http://stackoverflow.com/comment/37517632
has comment: http://stackoverflow.com/comment/37492206
answers question: http://stackoverflow.com/q/24265716
has body: Try using FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Your message")); and add a update="elementId" attribute to the component, which triggers your managed bean action. "elementId", of course, is the coresponding id of your &lt;p:messages&gt; element. For me this way it works fine. Maybe it also solves your issue.
has comment: http://stackoverflow.com/comment/37514261
type: Answer
has comment: http://stackoverflow.com/comment/37491994
score: 0

http://stackoverflow.com/comment/37295539
comment on: http://stackoverflow.com/a/24152838
type: Comment
type: AnswerComment
has text: @SotiriosDelimanolis Thanks for the correction, I agree with your opinion. But for that _You simply can't store it that way and you shouldn't._ statement, that is from semantic angle. Semantically I still don't think he should be storing that way.
score: 0

http://stackoverflow.com/a/24250357
score: 1
has body: package phase is called before in maven's lifecycle just before install, so if you ask to invoke particular phase it invokes all the phases upto that phase by default skipping package phase is effectively don't run plugins which are binded to run at package phase (usually jar plugin) you can find all these plugins by mvn help:effective-pom and then create another build profile and skip their execution
type: Answer
answers question: http://stackoverflow.com/q/24250345
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37387972
comment on: http://stackoverflow.com/q/24213145
type: QuestionComment
has text: `Node` is an `Object` but `Object` isn't a `Node`
score: 1
type: Comment

http://stackoverflow.com/q/24223027
tagged with: screen
answer count: 1
has body: I'm working with some code where I have a few buffered images in a scrollbar. When I click one of these images, I want to draw a rectangle around the image to indicate that the image is selected. My issue is that because my panel is scrollable, the image position set when drawing is not necessarily the actual screen position. So when the mouse is clicked, the point of the cursor's position doesn't intersect any of the position attributes (x, y, height, &amp; width) I have for the object holding the actual image. Does anybody know how to get the actual position of an image relative to the screen instead of the panel? So far I haven't found any solutions to this online. Thanks.
tagged with: bufferedimage
has title: Java - Getting screen position of buffered image
score: 0
has answer: http://stackoverflow.com/a/24223452
tagged with: java
type: Question
tagged with: position
type: UnansweredQuestion

http://stackoverflow.com/a/24236035
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37431356
upvote count: 1
has comment: http://stackoverflow.com/comment/37431085
answers question: http://stackoverflow.com/q/24235941
accepted answer of: http://stackoverflow.com/q/24235941
has body: Replace it with Runtime.getRuntime().exec(new String[]{"sh", "-c", editorcmd + " " + tmpfn + " &gt;/dev/tty &lt;/dev/tty"}).waitFor(); This will pause the current thread until the process has finished, with stdin and stdout piped to the controlling terminal.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37431492

resources
tags question: http://stackoverflow.com/q/24259577
tags question: http://stackoverflow.com/q/24186960
tags question: http://stackoverflow.com/q/24250697
tags question: http://stackoverflow.com/q/24248873
tags question: http://stackoverflow.com/q/24117842
tags question: http://stackoverflow.com/q/24173337
type: Tag
tag name: resources
tags question: http://stackoverflow.com/q/24233364

http://stackoverflow.com/comment/37273226
has text: Break the functionality down into smaller method calls. Place your coordinates into multi dimensional arrays and use loops to perform repeated work. Use classes to represent the individual elements and provide simple "paint" methods to do the work in a self contained environment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24152414
type: QuestionComment

http://stackoverflow.com/q/24143352
score: 0
type: UnansweredQuestion
tagged with: google-cloud-datastore
answer count: 1
has body: I embedding a User Defined Class (StudentProfile) inside another class (Account) using the @Embedded and @EmbeddedOnly JDO Annotations. Google Datastore indexes the attributes of the Embedded class by default and I would like to unindex many of the attributes in the Embedded Class (StudentProfile). I have tried using the '@Extension(vendorName="datanucleus", key="gae.unindexed", value="true")' in the Account Class, where I declare the StudentProfile Attribute, and at the various attributes of StudentProfile class itself. Even after this, I am able to filter by studentAttribute.shortName (a field I annotated to be unindexed). Since Google Datastore documentation says that unindexed fields cannot be used as filters, I take this to mean that the unindexing effort was in vain. I believe there is an @Unindex annotation in objectify, is there an equivalent in JDO? I also tried to experiment with unindexing a normal attribute in the Account class (using the JDO Extension) and it works (ie returns null when I try to filter by that attribute). Here is the relevant code from each class. Any help is greatly aprreciated! Thanks! @PersistenceCapable public class Account { // primary key and other attributes... // the embedded class with renaming for the clashing fields @Persistent(dependent="true", defaultFetchGroup="false") @Extension(vendorName="datanucleus", key="gae.unindexed", value="true") @Embedded(members = { @Persistent(name="shortName", columns=@Column(name="shortName"), extensions=@Extension(vendorName="datanucleus", key="gae.unindexed", value="true")), @Persistent(name="email", columns=@Column(name="personalEmail")), @Persistent(name="institute", columns=@Column(name="originalInstitute")) }) private StudentProfile studentProfile; } // the embeddedOnly class @PersistenceCapable(embeddedOnly="true") public class StudentProfile { // other attributes... // the filter attribute I used for querying @Persistent @Extension(vendorName="datanucleus", key="gae.unindexed", value…
tagged with: jdo
has answer: http://stackoverflow.com/a/24147739
tagged with: google-app-engine
tagged with: java
has title: Unindexing Embedded Class Attributes using JDO (app-engine)
type: Question

http://stackoverflow.com/q/24169409
has title: Getting items from start in MultiAutoCompleteTextView when using custom adaptor in android instead of correct start place?
answer count: 1
type: Question
tagged with: android
tagged with: java
tagged with: autofill
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24171132
tagged with: android-edittext
tagged with: multiautocompletetextview
has body: I have created a custom adaptor for MultiAutoCompleteTextView, which gives me view for list view. The problem is that when ever i type any character, it gives right count, but starting index start from 0 hence i see wrong names. String[] personsList = {"Rahul", "Mike", "Mantu","Mathew", "Gatr", "Ahamad"}; AutoCompleteNameAdaptor autoCompleteAdaptor = new AutoCompleteNameAdaptor(getApplicationContext(), personsList); CustomMultiAutoCompleteTextView personName = (CustomMultiAutoCompleteTextView) findViewById(R.id.allPeopleInvolved); personName.setThreshold(1); personName.setAdapter(autoCompleteAdaptor); personName.setTokenizer(new CustomMultiAutoCompleteTextView.CommaTokenizer()); When list view opens it always show list item start from "Rahul, even when i type "m", but count remains 3, so 3 items comes starting from item 0. This is working fine in android arrayAdaptor which is : ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, personsList); Were should i debug to get why it is not passing right indexes in getView function of my adaptor, or do i need to setup some sorting algorithm to sort list and update it in adaptor again, if yes where? Custom Adaptor Code public class AutoCompleteNameAdaptor extends ArrayAdapter&lt;String&gt; { LayoutInflater inflater; String[] listItems; public AutoCompleteNameAdaptor(Context context, String[] objects) { super(context, R.layout.people_involved_autocomplete_list, objects); this.listItems = objects; inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { GenericItemViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.people_involved_autocomplete_list, parent, false); holder = new GenericItemViewHolder(); holder.personNameLabel = (TextView) convertView.findViewById(R.id.personName); holder.personNameLabel.setText(this.…
score: 0

http://stackoverflow.com/a/24237324
has body: board2 is always zero. You fill the wrong array here: //fill the grid for (int row2 = 0; row2 &lt; board2.length; row2++) { for (int col2 = 0; col2 &lt; board[row2].length; col2++) { board[row2][col2] = rand.nextInt(10); } }
type: Answer
has comment: http://stackoverflow.com/comment/37433399
answers question: http://stackoverflow.com/q/24237283
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37433409

http://stackoverflow.com/q/24178197
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24181542
has title: How to build maven after importing an java spring project
possible better answer: http://stackoverflow.com/a/24178362
tagged with: java
has answer: http://stackoverflow.com/a/24178362
score: -1
tagged with: spring
tagged with: eclipse
has answer: http://stackoverflow.com/a/24178781
answer count: 4
type: Question
has answer: http://stackoverflow.com/a/24178574
upvote count: 2
has answer: http://stackoverflow.com/a/24181542
downvote count: 3
tagged with: maven
has comment: http://stackoverflow.com/comment/37321016
favorite count: 0
has body: Hello i am new to java spring concepts . .so i downloaded a sample spring application and import that into eclipse ..i have read from spring tutorials either i have to install maven into eclipse to run spring projects .. so i have installed maven and add a maven dependency pom.xml file into project but i got error in java build path as missing spring framework..can any one help me out from here .. Blockquote Tell me how to add maven dependency for a imported java spring project MY program file package java4s; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; public class ClientLogic { public static void main(String[] args) { Resource res = new ClassPathResource("spconfig.xml"); BeanFactory factory = new XmlBeanFactory(res); Object o = factory.getBean("id1"); WelcomeBean wb = (WelcomeBean)o; wb.show(); } } <property name="message" value="Welcome to spring" /> This is my file pom.xml > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> > 4.0.0 > Spring-Hello-World > Spring-Hello-World > 0.0.1-SNAPSHOT > com.force.sdk > force-springsecurity > 22.0.9-BETA > jar > compile > > Further what kind of dependency i can add here..just now i have started working with springs

http://stackoverflow.com/comment/37452460
score: 1
has text: How are you *launching* the project?
type: QuestionComment
comment on: http://stackoverflow.com/q/24246924
type: Comment

http://stackoverflow.com/comment/37418758
type: AnswerComment
comment on: http://stackoverflow.com/a/24221863
has text: Wow this question is so bad I can no longer ask another 1. Can you maybe help me though it is related the question above and this time I have code... I am opening MircoSoft Word using Java then using the robot to click and then to type for some reason the click is being accepted but the typing not. When I say accepted I mean the click is registering and the type code is taking place but the letters are not appearing on Word. I can send you the code.
type: Comment
score: 0

http://stackoverflow.com/comment/37484455
type: Comment
score: 0
type: QuestionComment
has text: Your constructor needs a parameter: `name`. In Java, only a non-argument constructor is by generated by defaut.
comment on: http://stackoverflow.com/q/24264317

http://stackoverflow.com/q/24109459
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/37192840
has comment: http://stackoverflow.com/comment/37196940
has title: Win api's SendMessage waits forever
type: UnansweredQuestion
answer count: 1
tagged with: delphi-xe2
has comment: http://stackoverflow.com/comment/37192302
has comment: http://stackoverflow.com/comment/37201535
has body: I have a GUI application on windows 7 64 bit (service pack 1) My GUI application has some Java in it and it dispatches Delphi code - Lately, after upgrading to a multicore PC - we've noticed that some heavy GUI actions cause the GUI to get stuck. We only have one thread that updates our GUI. After debugging it, we noticed that once in a while, a call made by delphi to win api's "SendMessage" just waits for ever. We then tried to set the program's affinity to 1 - and the problem was solved, but it slows down our application. I know that it is common to replace SendMessage with PostMessage or SendMessageTimeout, but there are many places where we use SendMessage + we also use DevExpress components that also use SendMessage - we can't possibly map all these places. What seems most bizarre is that even though our GUI has one thread, set affinity to 1 solves the problem (there are other background threads in the system, but they are all pure java and perform some data calculations). my questions are: Any known ways to fix this problem? Maybe known bugs in Windows 7? Is it possible that the messages I sent is somehow lost? Is there a limit to the total messages or rate? If so, how can I increase these limits? How can I get more information - for example: check somewhere in windows what happened to my message - where/why did windows get stuck etc. Any way of further analyzing the problem will be greatly appreciated. Thank you very much
favorite count: 0
tagged with: delphi
has answer: http://stackoverflow.com/a/24109726
score: -5
has comment: http://stackoverflow.com/comment/37209653
tagged with: winapi
tagged with: windows
tagged with: java
has comment: http://stackoverflow.com/comment/37224719
downvote count: 5
has comment: http://stackoverflow.com/comment/37198362

http://stackoverflow.com/comment/37223448
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24125120
has text: Note the correction to your title. Your SocketChannel is still open. It is the *connection* that was forcibly closed.
type: Comment

http://stackoverflow.com/comment/37215343
type: Comment
comment on: http://stackoverflow.com/q/24122038
score: 0
has text: What do you mean by "not visible"?
type: QuestionComment

http://stackoverflow.com/comment/37429521
has text: I'm not thinking what the appilcation does, I wrote the applications for both server and client side EJP. And the problem is decribed clearly in my post. So for you once again: It seems that for some reason in the midst of an established(!) dialog the connection is reset. And yes, I suspect an underlying problem in the VM, just read or google and you'll find numerous messages that are related to this issue, manifested in various environments and Java based systems but t.m.o. related to this basic level. And if you really want to see some code: follow the link or even have a try yourself.
comment on: http://stackoverflow.com/q/24235251
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24125120
has body: I have a java.nio.channels.SocketChannel in my jSCSI implamantation that is disconnecting when I try to open a driver with size greater than 4GB. The iscsi RFC says that the BasicHeaderSegment.BHS_FIXED_SIZE may be 48, so with this position I can read the bytes on the channel. The java doc says 5 types of errors, but my app is throwing the last one that doesn't say a specific information. NotYetConnectedException ClosedChannelException AsynchronousCloseException ClosedByInterruptException IOException Code: public final int read(final SocketChannel sChannel) throws InternetSCSIException, IOException, DigestException { // read Basic Header Segment first to determine the total length of this // Protocol Data Unit. clear(); final ByteBuffer bhs = ByteBuffer.allocate(BasicHeaderSegment.BHS_FIXED_SIZE); int len = 0; while (len &lt; BasicHeaderSegment.BHS_FIXED_SIZE) { int lens = sChannel.read(bhs); if (lens == -1) { // The Channel was closed at the Target (e.g. the Target does // not support Multiple Connections) // throw new ClosedChannelException(); return lens; } len += lens; LOGGER.trace("Receiving through SocketChannel: " + len + " of maximal " + BasicHeaderSegment.BHS_FIXED_SIZE); } bhs.flip(); error: java.io.IOException: An existing connection was forcibly closed by the remote host at sun.nio.ch.SocketDispatcher.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) at sun.nio.ch.IOUtil.read(IOUtil.java:197) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379) at org.jscsi.parser.ProtocolDataUnit.read(ProtocolDataUnit.java:417) at org.jscsi.target.connection.TargetSenderWorker.receiveFromWire(TargetSenderWorker.java:145) at org.jscsi.target.connection.Connection$TargetConnection.receivePdu(Connection.java:217) at org.jscsi.target.connection.phase.TargetFullFeaturePhase.execute(TargetFullFeaturePhase.java:96) at org.jscsi.target.connection.Connection$TargetConnection.c…
tagged with: ioexception
answer count: 2
score: 5
downvote count: 0
tagged with: java
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37223448
upvote count: 5
has title: Connection was forcibly closed by the remote host
tagged with: sockets
possible better answer: http://stackoverflow.com/a/24135772
tagged with: socketchannel
has answer: http://stackoverflow.com/a/24126935
accepted answer: http://stackoverflow.com/a/24126935
has answer: http://stackoverflow.com/a/24135772

http://stackoverflow.com/comment/37328169
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24182074
has text: Try this public interface IdObjectDAO<T,U> { public T getObjectById(U id); }

join
tags question: http://stackoverflow.com/q/24196627
type: Tag
tag name: join
tags question: http://stackoverflow.com/q/24200905

http://stackoverflow.com/comment/37215522
type: Comment
score: 0
type: AnswerComment
has text: But I dont know... After that only its working properly
comment on: http://stackoverflow.com/a/24122073

http://stackoverflow.com/q/24196995
type: Question
tagged with: constructor
has title: Why need to assign a null value when using Constructor? Java
tagged with: null
tagged with: arrays
has comment: http://stackoverflow.com/comment/37356339
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37356382
accepted answer: http://stackoverflow.com/a/24197488
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24197488
has body: I noticed that in the below example code, when the "Scanner scan" and "String [] words" were declared, they were assigned 'null'. Why do we need to do that? Many thanks for your help! * The example code was designed to read strings from a file, with the first line of the file being the number of strings: int howMany. int howMany; Scanner scan = null; //why do we need to assign a 'null'? File f; String[] words = null; //why not use String[] words= new String []; ? try { f = new File(filename); scan= new Scanner(f); howMany = scan.nextInt(); words = new String[howMany]; for (int i = 0; i &lt; howMany; i++) { words[i] = scan.next(); } } catch (IOException e) { System.out.println(e); }
has comment: http://stackoverflow.com/comment/37356688

http://stackoverflow.com/a/24233562
has body: How silly of me, i didn't use the war name in the URL.. But i'll keep this code up for anyone who goes through the struggle of setting up jersey Answer to the question http://localhost:8080/&lt;your-war-name&gt;/&lt;your-servlet-URI&gt;/&lt;whatever&gt; so for me it is-> http://localhost:8080/REST_Test/rest/testapi Credits: this answer
score: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24233324
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/24233324
type: Answer

http://stackoverflow.com/comment/37212259
type: QuestionComment
comment on: http://stackoverflow.com/q/24120470
score: 5
has text: Any chance you can trim down your code to a small, reproducible example instead of this giant code dump?
type: Comment

http://stackoverflow.com/q/24142960
answer count: 1
has comment: http://stackoverflow.com/comment/37254513
favorite count: 0
type: Question
has title: How do I create a regex to ensure an array is correctly initialized in Java?
has body: I am trying to create a regular expression for an array that will check that the array initialization is correct: {1,2,3} //correct {1,2,3,,,} //not correct This is my current regex: (?!\,\s*\})\{(.*?)\}* How do I do this in Java?
accepted answer: http://stackoverflow.com/a/24143079
has comment: http://stackoverflow.com/comment/37254485
has comment: http://stackoverflow.com/comment/37254571
tagged with: regex
score: 2
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24143079
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/37430262
type: Comment
type: QuestionComment
has text: @panini Thanks. Indeed it does create its own UI so I can imagine that the process is more involved. Do you know of any guide that could help me out or is the only way simply to start from scratch?
comment on: http://stackoverflow.com/q/24235715
score: 0

http://stackoverflow.com/q/24257653
tagged with: moxy
has title: Howto dig for performance problems with moxy
type: Question
tagged with: performance
has body: I'm using moxy for large structure and in 95% of cases it works like charme. It is fast and reliable. But I do have now a project with the same class structure but different data. Now I do have a big read impact. Writing the complete project needs ~20sec, but reading needs more than 450sec. The written file is around 280MB. (Usally reading is only 30% slower) With guessing I wasn't able to find the problem. But how to dig for this problem in moxy. The first thing I tried was to supply a different Reader (BufferedInputStream, FileInputStream and just the file) nothing changed. Than I checked the XmlJavaTypeAdapter and set the defaultSize of maps etc. Again nothing changed. So maybe someone has a better idea. [UPDATE 1] After extracting all osgi parts and building a standalone java application I was able to use VisualVM for analyzing this project. And I found that ReferenceResolver.getReference() consumes more than 90%. So I guess my Reference and ID is somehow badly designed. [UPDATE 2] Created an issue
accepted answer: http://stackoverflow.com/a/25545978
tagged with: java
has answer: http://stackoverflow.com/a/25545978
type: AnsweredQuestion
score: 0
answer count: 1

http://stackoverflow.com/comment/37286554
type: Comment
has text: so what is the problem?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24160135

http://stackoverflow.com/comment/37354457
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24195975
has text: thats what we thought but... it does sometimes complete the loop because we do get a return. Its odd because its inconsistently working about every eight times run or so it actually returns a value but otherwise it wont return anything, or freezes

http://stackoverflow.com/comment/37383065
comment on: http://stackoverflow.com/q/24210850
score: 1
type: Comment
type: QuestionComment
has text: You can accomplish this using reflection

http://stackoverflow.com/comment/37201343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24112812
has text: someId is 'String' object
score: 0

http://stackoverflow.com/a/39072009
upvote count: 11
answers question: http://stackoverflow.com/q/24235296
downvote count: 0
has body: I want to look up the LOG_FILE property from the environment (or OS, if you will) Here are the alternatives: If by environment, you mean what's generally known as environment variables, you can refer to them directly in the configuration file without much hassle. If you don't mean environment variables, but rather something that requires custom code to access, you can implement a custom ch.qos.logback.core.spi.PropertyDefiner that grabs and returns the value. e.g. public class MyCompanyEnvironmentGrabber extends PropertyDefinerBase { @Override public String getPropertyValue() { return ...; // grab the value from company environment } } There's apparently reports one can programmatically set up a variable before logback.xml is loaded by putting it before any calls to logger, and being careful of the ClassLoader load order... However, I think this is very brittle as not using static logger is very hard to control when the code base becomes complex. All told, since logback.xml is loaded almost immediately after the Java instance starts, safe ways of dynamically setting the value to a variable seems limited to: Setting it outside the Java program, such as through a calling shell script, by the use of environment variables or system properties (-D). Returning it via the ch.qos.logback.core.spi.PropertyDefiner callback. Setting it up in a ch.qos.logback.classic.spi.LoggerContextListener as done in this answer. Artificially delaying the loading of logback.xml as how the OP has done in his answer.
type: Answer
score: 11

http://stackoverflow.com/comment/37464420
comment on: http://stackoverflow.com/a/24253171
has text: The set of keys will keep on increasing which is why i cant figure out how to formulate a logic for it.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/24147127
answers question: http://stackoverflow.com/q/24146800
has comment: http://stackoverflow.com/comment/37262389
has body: You can create another GridBagLayout panel and add it in first panel as a left part of the second row with width equals 4.
score: 3
has comment: http://stackoverflow.com/comment/37262441
upvote count: 3
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37269184

http://stackoverflow.com/q/24182902
has answer: http://stackoverflow.com/a/49951700
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37328774
has body: I want to remove all key "id" and its value from my json string. Problem is "id" comes at many level in my json string. I am using JSONObject. With JSONObject we can remove "id" at top level only but i need to remove "id" from every level. Please help me Ex of json string - "{ "success": { "body": { "id": 5827, "siteName": "RPX", "instances": [ { "instanceId": "i-3a63035e", "name": "prdae-mst21a (iserver)", "state": "running", "publicDnsName": "ec2-54-209-175-118.compute-1.amazonaws.com", "tags": [ { "id": 9783, "key": "ktier", "value": "da" }, { "id": 9782, "key": "Name", "value": "prdae-mst21a (iserver)" }, { "id": 9781, "key": "kreg", "value": "e" } ], "sshAccessInfo": { "id": 9788, "keyPair": { "id": 6050, "keyName": "Kens key", "status": "UPLOADED", "defaultUser": "root", "passPhrase": "imaginea#@!" }, "userName": "imaginea" }, "account": { "id": 5857, "accountId": "348713271046", "type": "AWS", "ownerAlias": "348713271046", "regionName": "us-east-1" }, "availabilityZone": "us-east-1a", "publicIpAddress": "54.209.175.118", "instanceType": "m2.2xlarge" }, { "instanceId": "i-65ad2346", "name": "prpoe-pap22e cp", "state": "running", "publicDnsName": "ec2-54-86-2-65.compute-1.amazonaws.com", "tags": [ { "id": 9755, "key": "kzone", "value": "e" }, { "id": 9754, "key": "kreg", "value": "e" } ], "sshAccessInfo": { "id": 9756, "keyPair": { "id": 5895, "keyName": "rpxprod-rightscale", "status": "UPLOADED", "defaultUser": "ubuntu", "passPhrase": "imaginea#@!" }, "userName": "imaginea" }, "account": { "id": 5857, "accountId": "348713271046", "type": "AWS", "ownerAlias": "348713271046", "regionName": "us-east-1" }, "availabilityZone": "us-east-1e", "publicIpAddress": "54.86.2.65", "instanceType": "m1.large" } ], "filters": [ { "id": 5828, "accountInfo": { "id": 5829, "type": "AWS", "regionName": "us-east-1" } } ], "loadBalancers": [ { "id": 5855, "name": "st-pgpool-cp", "vpcId": "vpc-865c68ee", "instanceIds": [ "i-b81511eb" ], "availabilityZones": [ "us-east-1e" ] }, { "id…
downvote count: 0
has answer: http://stackoverflow.com/a/70104599
accepted answer: http://stackoverflow.com/a/24184189
tagged with: string
has comment: http://stackoverflow.com/comment/37329240
has comment: http://stackoverflow.com/comment/37328785
favorite count: 0
type: Question
type: AnsweredQuestion
has title: How to remove all key and its value of a particular keyname from json string(with children) in java
has answer: http://stackoverflow.com/a/24183876
answer count: 5
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24183670
has comment: http://stackoverflow.com/comment/37329146
has answer: http://stackoverflow.com/a/24184189
possible better answer: http://stackoverflow.com/a/49951700

http://stackoverflow.com/comment/37404500
type: QuestionComment
type: Comment
has text: @Makoto Yeah, maybe creating an enum would be better. I also have another field that either contain `success` indicating that the transaction went fine, or any other string indicating that something went wrong. Would you throw an exception then?
comment on: http://stackoverflow.com/q/24222276
score: 0

http://stackoverflow.com/comment/37206270
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24117181
has text: Are you sure that you get a response for your SOAP request? Try this soapResponse.writeTo(System.out) before writing to file and see if you get any output.

http://stackoverflow.com/comment/37418976
comment on: http://stackoverflow.com/a/24225133
score: 0
type: Comment
type: AnswerComment
has text: You can do it by using both Jsoup and Regex. For Jsoup, try putting the lists in a class and then retrieve the text using doc.getElementsbyClass("className").text(); and compare the results in a for each loop till you find BBC Channel 555

http://stackoverflow.com/comment/37474837
score: 0
has text: Yeah the problem was that in everything I read before, I couldn't think of looking at this very Java folder, I'd always go llok for the one in ProgramFiles. Proving I do not think well. (laughs) Thanks anyway.
type: AnswerComment
comment on: http://stackoverflow.com/a/24245997
type: Comment

http://stackoverflow.com/a/24331284
score: 1
answers question: http://stackoverflow.com/q/24226933
has comment: http://stackoverflow.com/comment/37611713
type: Answer
has comment: http://stackoverflow.com/comment/37872764
has body: I can not reproduce this problem. With the following code updates are really fast for example (blurringly fast on a low-end tablet): package com.mycompany.myapp42; import android.app.*; import android.os.*; import android.widget.*; import java.text.*; import java.util.*; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final TextView tv = (TextView) findViewById(R.id.textView); new Thread(new Runnable() { @Override public void run() { while (true) { runOnUiThread(new Runnable() { @Override public void run() { tv.setText(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date())); } }); try { Thread.sleep(10); } catch (InterruptedException e) {} } } }).start(); } } EDIT There are performance problems for me too if the soft keyboard (SwiftKey) is visible.
has comment: http://stackoverflow.com/comment/37612115
has comment: http://stackoverflow.com/comment/37612179
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24129088
downvote count: 1
favorite count: 0
tagged with: finally
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24129101
has answer: http://stackoverflow.com/a/57994925
tagged with: java
score: 44
has body: In Java 7's try-with-resources, I don't know which order the finally block and the auto-closing happens. What's the order? BaseResource b = new BaseResource(); // not auto-closeable; must be stop'ed try(AdvancedResource a = new AdvancedResource(b)) { } finally { b.stop(); // will this happen before or after a.close()? }
has title: Are resources closed before or after the finally?
linked to: http://stackoverflow.com/q/218350
tagged with: try-with-resources
type: Question
possible better answer: http://stackoverflow.com/a/57994925
answer count: 2
tagged with: java-7
upvote count: 45
has answer: http://stackoverflow.com/a/24129101

http://stackoverflow.com/comment/37359907
type: Comment
comment on: http://stackoverflow.com/a/24198809
type: AnswerComment
score: 0
has text: @user2360087 A quick look at the [`ArrayList` javadoc](http://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html#subList-int-int-) reveals the answer

http://stackoverflow.com/q/24248369
has answer: http://stackoverflow.com/a/68597823
tagged with: character
has comment: http://stackoverflow.com/comment/37454326
linked to: http://stackoverflow.com/q/68581899
has comment: http://stackoverflow.com/comment/95609085
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37455535
downvote count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/37454297
has comment: http://stackoverflow.com/comment/37455322
has body: The Character.getType(int codePoint) returns an integer and I couldn't find a way to get the unicode category name, such as "Lu" or "Cn", out of it. What I want is a method such as Character.getCategoryTypeName(int codePoint) that returns a String representing the type. The category names are in the constants comments, and one way would be write a switch case for the returned type and then manually encode the type name, something like this: my original plan was something like this: for (int i = 0; i &lt;= 0x10FFFF; i++) { switch (Character.getType(i)) { // General category "Sc" in the Unicode specification. // public static final byte CURRENCY_SYMBOL = 26; case Character.CURRENCY_SYMBOL: map.put(i, "Sc"); break; .... } } however this will be very tedious. Is there an automatic way or a library to do the task?
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/37454264
type: Question
has title: How to get the category name of the character type in Java?
has comment: http://stackoverflow.com/comment/37455450
type: UnansweredQuestion
score: 7

http://stackoverflow.com/comment/37205524
type: Comment
has text: @ashok_p It can contain an unlimited amount of Strings, but each String has only 2 characters. Another example is {"SS", "Ff", "dd"} which should result in another String array which has the length of 2 * the source array's length (all combinations) with the Strings {"SFd", "SFd", "Sfd", "Sfd", ...).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24116634

http://stackoverflow.com/a/24182202
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24182128
score: 3
accepted answer of: http://stackoverflow.com/q/24182128
has comment: http://stackoverflow.com/comment/37327434
type: Answer
has body: Using a .ttf file for Font is always better than to have images for texts because: Less intensive on memory Easy to scale text across various screen sizes, using desity independent text size units : sp

http://stackoverflow.com/comment/37607560
type: Comment
comment on: http://stackoverflow.com/a/24296270
score: 0
type: AnswerComment
has text: I believe that it is not possible in general. Some servers use http header to prevent CSRF attacks (using referer header, or X-CSRF-Token header).

http://stackoverflow.com/comment/37234310
type: AnswerComment
comment on: http://stackoverflow.com/a/24131925
has text: @omega `super` refers to the superclass, not the containing class, so changing its semantics for this one case would almost certainly be rejected during language design. `super.this` is also somewhat contradictory -- you can't try to get something from the superclass's namespace and the current object's namespace simultaneously. It doesn't make sense.
score: 1
type: Comment

http://stackoverflow.com/q/24124273
has body: Has any one got a chance to work on RSA and AES in Java as well as in iOS. Basically i want to pass public key to Java platform from iOS and vice versa. Let me know if any one has already worked on this and got a solution. Chilkat is the helpful library i agree but it s costing around 180$. Let me know some useful links if you find. Regards, Bhat
tagged with: ios
answer count: 1
has title: AES and RSA encryption in iOS and JAva
has comment: http://stackoverflow.com/comment/37229053
has comment: http://stackoverflow.com/comment/37219820
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: rsa
accepted answer: http://stackoverflow.com/a/24128379
upvote count: 1
has answer: http://stackoverflow.com/a/24128379
downvote count: 1
favorite count: 0
tagged with: aes
type: Question
has comment: http://stackoverflow.com/comment/37228934
has comment: http://stackoverflow.com/comment/37227273

http://stackoverflow.com/comment/37305387
score: 0
comment on: http://stackoverflow.com/a/24148244
has text: Hello jjs, you want to access the class with a certain name in one dependency package without using or importing the class with same qualified name present in other dependency package, right?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37283694
has text: @Prag's 64 bit. Both JRE and JDK is for 64 bit as well.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24158129
type: QuestionComment

http://stackoverflow.com/comment/37365086
type: QuestionComment
comment on: http://stackoverflow.com/q/24199469
has text: Can someone help me to solve this.Expandable listView.
score: 0
type: Comment

http://stackoverflow.com/comment/37396603
has text: sorry .. it is image .. spelling mistake .. my bad ** + i re-sized it but nothing happened. Same error
type: QuestionComment
comment on: http://stackoverflow.com/q/24217961
type: Comment
score: 0

http://stackoverflow.com/q/24211335
has comment: http://stackoverflow.com/comment/37384213
accepted answer: http://stackoverflow.com/a/24212671
has answer: http://stackoverflow.com/a/24212671
tagged with: android
has comment: http://stackoverflow.com/comment/37386148
has comment: http://stackoverflow.com/comment/37384065
type: AnsweredQuestion
tagged with: udp
score: 1
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37384007
upvote count: 1
favorite count: 0
type: Question
has title: Why does my UDP message from Android not work?
has body: I have written a small java code script that sends a message via UDP to a server on my computer: @Override public void onClick(View view) { try { DatagramSocket clientSocket = new DatagramSocket(); InetAddress IP = InetAddress.getByName("192.168.1.5"); byte[] sendData = new byte[1024]; String sentence = "HELLO"; sendData = sentence.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IP, 9876); clientSocket.send(sendPacket); clientSocket.close(); } catch(IOException e) { } } I have tried the same code from another computer on the network, and the message is then correctly sent and received. When I am trying to run this from my Android phone, the server wont receive it. Why is that? EDIT I had forgot to add internet permisson in the manifest, but when I did that, the app crashes when I click the button: 06-13 21:14:26.932 13501-13501/com.example.omgandroid E/AndroidRuntime﹕ FATAL EXCEPTION: main android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1144) at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:175) at libcore.io.IoBridge.sendto(IoBridge.java:466) at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:182) at java.net.DatagramSocket.send(DatagramSocket.java:284) at com.example.omgandroid.MainActivity.onClick(MainActivity.java:72) at android.view.View.performClick(View.java:4475) at android.view.View$PerformClick.run(View.java:18786) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5419) 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:1046) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) at dalvik.system.NativeStart.main(Native Method) 06-13 2…

http://stackoverflow.com/q/24109399
type: Question
type: UnansweredQuestion
tagged with: java
has body: Background : I started playing with Groovy recently and am trying to embed a groovy script engine in an eclipse plugin to let my customers develop their own GUI extensions inside my eclipse-based product. This is very similar to the success story published on codehaus's website. Problem The groovy script (let's call it "main_eclipse.groovy") run from the eclipse plugin by a GroovyScriptEngine throws when trying to load a groovy class ("SwtGuiBuilder"), with the following error : BUG! Queuing new source whilst already iterating. Queued source is 'file:/home/nicolas/workspace/groovy-test/src/gui/SwtGuiBuilder.groovy' Question Did anyone run into the same problem ? How can it be fixed ? Any help will be highly appreciated ! Some observations : When using the groovy interpreter instead of a GroovyScriptEngine java object, I have no problem using my SwtGuiBuilder class (see script "main_groovy" here below). My problem does not seem to be a classpath issue, since the file containing my SwtGuiBuilder class is mentioned in the thrown exception. The error message is mentioned in two reported groovy bugs, GRECLIPSE-429 and GRECLIPSE-1037. I did not fully get the technicals details, but those bugs seemed to be related to performance issues when loading lots of classes, which is not relevant in my situation... Details SampleView.java public class SampleView { public SampleView() { super(); } public void createPartControl(Composite parent) { String groovyScript = null; String [] groovyPath = null; boolean shall_exit = false; do { // ask user for params GroovyLocationDialog groovyLocationDialog= new GroovyLocationDialog(parent.getShell() ); int return_code = groovyLocationDialog.open(); if ( return_code != Window.OK ) shall_exit = true; else { groovyScript= groovyLocationDialog.getInputScriptName(); groovyPath = groovyLocationDialog.getInputScriptPath(); // run it ScriptConnector scriptConnector = new ScriptConnector(parent); try { scriptConnector.runGuiComponentScript( groovyPat…
has title: GroovyScriptEngine fails to load imports of running groovy script
has answer: http://stackoverflow.com/a/24127276
tagged with: groovy
score: 1
downvote count: 0
answer count: 1
upvote count: 1
tagged with: groovyshell
favorite count: 0

http://stackoverflow.com/q/24160582
tagged with: servlets
type: AnsweredQuestion
tagged with: netbeans
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24160747
tagged with: tomcat
has title: Figuring out how to specify paths based on Netbeans project structure
type: Question
accepted answer: http://stackoverflow.com/a/24160747
has body: I have code that looks like this: String path; public DisplayDataServlet() { path=getServletContext().getRealPath("/leaflet/temp"); } This throws a huge NullPointerException,this might be because I am having trouble specifying a valid relative path using the Netbeans folder structure.The file location is Web Pages/leaflet/temp in the Netbeans IDE. Tried with getServletConfig().getServletContext(),still getting the same error. I have tried the following paths: 1. /leaflet/temp 2. /Web Pages/leaflet/temp 3. /webcontent/leaflet/temp 4. /WebContent/leaflet/temp 5. /build/web/leaflet/temp I keep getting the same error.

http://stackoverflow.com/comment/37263387
type: Comment
comment on: http://stackoverflow.com/q/24147313
score: 0
type: QuestionComment
has text: @Makoto Even the built-in Intellij code inspection can find these as Naming convention issues, I just wish it would provide an "apply fix" option.

gmail
type: Tag
tags question: http://stackoverflow.com/q/24144130
tags question: http://stackoverflow.com/q/24250144
tag name: gmail
tags question: http://stackoverflow.com/q/24259966

http://stackoverflow.com/comment/37402595
has text: However, note that having side-effects in `peek()` or `map()` behavioral parameters that may interfere with the source, or affect the result of other stream operations, is a no-no. The `peek()` method is really there just for debugging/logging, not for computing the result; similarly, `map()` should be used only for transforming, not for hiding side-effects.
type: Comment
score: 13
comment on: http://stackoverflow.com/a/24219249
type: AnswerComment

http://stackoverflow.com/comment/51948897
comment on: http://stackoverflow.com/a/24263838
has text: @eby I agree, this is crating two seperate tables and thus not aligning the columns properly. I also want to add a background to a column since I add rows by passing the table to a method that dynamicaly creates them and I do not want to fix column width. The only method I can currently think off is creating a stack for each cell and add in a drawable in the back. But if you want to have like somekind of border you need 3 different images (left, middle and right).
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24164227
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24164097
has comment: http://stackoverflow.com/comment/37295868
has body: You can use the the Apache Commons Langs library and use the initials() method , you can get more information from here http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/text/WordUtils.html#initials(java.lang.String) I am quoting a sample code snippet that might be useful : WordUtils.initials(null) = null WordUtils.initials("") = "" WordUtils.initials("Ben John Lee") = "BJL" WordUtils.initials("Ben J.Lee") = "BJ"

http://stackoverflow.com/q/24205905
has comment: http://stackoverflow.com/comment/37377792
type: Question
has body: I have a security constraint that covers some pages in my web application. The authentication is made with JAAS and form, and it works fine. (I've successfully implemented my LoginModule). However I need an alternate authentication via servlet. That's the code of the servlet: try { TokenCallbackHandler tokenCallbackHandler = new TokenCallbackHandler(properties,token); LoginContext lc = new LoginContext("myApp", tokenCallbackHandler); lc.login(); } catch (LoginException e) { e.printStackTrace(); } Debugging the code I saw that the initialize, login and commit were called without error. The servlet returns an html page with a js that redirect to a protected resource: function doRedirect() { location.href = "/protectedPath/ProtectedResource.html"; } window.setTimeout("doRedirect()", 1); But when the browser tried to get the protected page the app server returns to the login page. What I am missing? It is possible that with the js redirect I'm losing the session cookie? Or, is it possible that the problem is that i'm trying to access (through a redirect) to a protected resource from a unprotected resource? -- EDIT --- I've taken a look at the cookies: when I login with the servlet it returns a session cookie and when I try to get a protected resource I can see the browser passing that session cookie to the server, but it seems that it got refused, in fact it respond with another session cookie, going to the login form page -- EDIT --- Solved in another way. After some investigation on tomcat authentication mechanism I realized that what I was trying to do was something wrong. Having defined a security constraint and a form login config to protect my resources I have tell tomcat to manage authentication in its way. So as long as I didn't pass through tomcat authentication workflow I can't authenticate anything. Also I discovered that it's not possible to configure different login-configuration in the same web application, so having defined form authentication prevents me…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37375560
tagged with: jaas
has comment: http://stackoverflow.com/comment/37376001
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/37377727
has title: Tomcat and Jaas authentication servlet in a form-based security constraint
score: 0
tagged with: security-constraint
has comment: http://stackoverflow.com/comment/37376041
answer count: 1
has comment: http://stackoverflow.com/comment/37377918
has answer: http://stackoverflow.com/a/24220896
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37376390

http://stackoverflow.com/comment/37436004
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24231873
has text: And which line is *line 22* in UserIO ? You should trace or print the value or `path`, and control that neither `file` nor `writer` are null.
type: QuestionComment

flyway
type: Tag
tag name: flyway
tags question: http://stackoverflow.com/q/24229529

http://stackoverflow.com/q/24231207
has title: Gradle java project replace single line in file during build
score: 10
upvote count: 10
has answer: http://stackoverflow.com/a/29328168
accepted answer: http://stackoverflow.com/a/29328168
tagged with: build
type: AnsweredQuestion
answer count: 2
tagged with: java
downvote count: 0
has body: I have a simple Gradle build script to compile and package (similar to the application plugin) my Java application. The only thing I do not accomplish is to replace the current version number in a simple .properties file. I have created a file 'src/main/resources/app-info.properties' with a single line 'application.version = @version@'. No I want to replace this version string whenever the file is copied to the build folder (think this happens during the build task). I already tried a simple solution with ants ReplaceTokens. This one replaced the version but also broke my .png files in the resources.. So is there a simple solution to just replace tokens in one single file during the build task (or whatever task handles the copy to the build folder)? Thank you for any help! Ben ====== Edit based on the comment from Opal ===== Based on the hint I have added the following: import org.apache.tools.ant.filters.ReplaceTokens // ... build { from('src/main/resources') { include '*.properties' filter(ReplaceTokens, tokens: [version : project.version]) } } Which throws this error: Could not find method from() for arguments [src/main/resources, build_vbjud9ah7v3pj5e7c5bkm490b$_run_closure6_closure12@43ead1a8] on root project Seems like I am on the wrong task? ====== Edit for completeness adding the solution based on Opals suggest ===== Thanks man, the following is the working solution! processResources { from('src/main/resources') { include '*.properties' filter(ReplaceTokens, tokens: [version : project.version]) } }
tagged with: gradle
has answer: http://stackoverflow.com/a/24231671
favorite count: 0
possible better answer: http://stackoverflow.com/a/24231671
type: Question

http://stackoverflow.com/a/24256219
score: 2
has comment: http://stackoverflow.com/comment/37479020
has comment: http://stackoverflow.com/comment/37478922
has body: Definition for box2dCam: b2dCam = new OrthographicCamera(); b2dCam.setToOrtho(false, Game.getWidth() / PPM, Game.getHeight() / PPM); b2dCam.update(); Definition for regular Camera: cam = new OrthographicCamera(); cam.setToOrtho(false, Game.getWidth(), Game.getHeight()); // &lt;-- cam.update(); That's how it should be. Don't divide the tiled map's camera's viewport by the PPM ratio, since here you want it to be 1 unit = 1 px.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24254838
accepted answer of: http://stackoverflow.com/q/24254838
upvote count: 2
has comment: http://stackoverflow.com/comment/37479253
type: Answer
has comment: http://stackoverflow.com/comment/37479543
has comment: http://stackoverflow.com/comment/37480093

http://stackoverflow.com/comment/37309077
type: AnswerComment
has text: FWIW, it's possible to do the 4th option in a single pass by maintaining separate read vs. write offsets so it's still fairly efficient, but still error-prone (and can leave the file in an inconsistent state if the program crashes) so I'd still go the copy route unless there's a really good reason not to.
comment on: http://stackoverflow.com/a/24171693
type: Comment
score: 0

http://stackoverflow.com/comment/37388631
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24213608
has text: Just so you know, a CSV is nothing more than a comma delimited file. each row is a single line in the file. So for example you can have the following:Product,Price,Intel CPU,100$. Again You will have to add a newline(\n) for each line
score: 0

http://stackoverflow.com/comment/37508314
has text: Hai thanks for the reply.But actual case is for every minute web application gets refreshed.So, every minute it has to take log about all files,As I mentioned 50 to 100 processes(each process/command executed in cmd using java program) are scheduled at that time, that particular output only should be appended into same file for every minute. So if in that minute also I cant take output to individual files and then copy all that output to one file. It will be extra work to the web application. But tnx for the info.
comment on: http://stackoverflow.com/a/24265455
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37459313
score: 0
type: AnswerComment
type: Comment
has text: If it's not being used, it's safe to use. Just make sure you don't have any web server running
comment on: http://stackoverflow.com/a/24250618

http://stackoverflow.com/comment/37216491
type: AnswerComment
comment on: http://stackoverflow.com/a/24122674
has text: Also.. Nothing is mentioned about the elements being unique.. Assumptions are dangerous :)
type: Comment
score: 0

http://stackoverflow.com/q/24181325
downvote count: 0
has answer: http://stackoverflow.com/a/24182216
tagged with: inner-classes
upvote count: 1
accepted answer: http://stackoverflow.com/a/24182216
score: 1
tagged with: java
answer count: 1
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37326221
has comment: http://stackoverflow.com/comment/37325942
has comment: http://stackoverflow.com/comment/37326007
has title: Accessing java inner classes in struts.xml
tagged with: struts2
has body: Is it possible to access java inner classes in struts.xml file? For example, I have the following java class with a nested class: public class FooServiceAction { FooServiceImpl service = new FooServiceImpl(); public class ProductAction extends ActionSupport { private ProductImpl product = new ProductImpl(); public ProductAction() { } public ProductAction(ProductImpl product) { this.product = product; } public ProductImpl getProduct() { return product; } public void setProduct(ProductImpl product) { this.product = product; } public String productSetting() { return SUCCESS; } @Override public void validate() { if (this.getProduct().getName() == null || this.getUser().getName().equals("")) { addFieldError("name", "Product name is mandatory."); } else { service.createProduct(product); } } } I need to access the nested ProductAction class in struts.xml file. /launchapp.jsp /createUser.jsp Whenever I am trying to launch this project with jetty, an exception is thrown because struts.xml cannot locate the nested java class. [ERROR] Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.0.1:run (d efault-cli) on project foo-web: Failure: StrutsException: Unable to load configu ration. Action class [foo.action.FooServiceAction.ProductAction] not found -> [Help 1] How can I make the nested java class visible to struts.xml file? Many thanks in advance
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37326437

http://stackoverflow.com/q/24145544
has comment: http://stackoverflow.com/comment/37259654
tagged with: virtual-machine
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37259638
has title: How to run X Windows from a (headless) Ubuntu server?
has answer: http://stackoverflow.com/a/24145678
accepted answer: http://stackoverflow.com/a/24145678
tagged with: ubuntu
type: AnsweredQuestion
has body: We have an Ubuntu server VM that is running a Java application on it, and I need to profile it using Java's JVisualVM GUI tool. I need to SSH into the server (say, ssh admin@ourapp.example.com) and turn on X Windows so that I can run JVisualVM at the terminal and have the X Window "break out" of the VM and run on my host (a Windows 7 machine).
downvote count: 0
tagged with: jvisualvm
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/128458967
answer count: 1
tagged with: x11

http://stackoverflow.com/comment/37400698
comment on: http://stackoverflow.com/q/24220258
type: Comment
type: QuestionComment
has text: Why exactly do you need it if it opens a blank window?
score: 0

http://stackoverflow.com/comment/37457303
type: AnswerComment
has text: And could you explain: "The constructor is called many times during the injection process." ?
type: Comment
comment on: http://stackoverflow.com/a/24248518
score: 0

http://stackoverflow.com/comment/37788537
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24390986
has text: I dint try that but i hope this link may help you. [refer](http://www.baeldung.com/httpclient-custom-http-header)

http://stackoverflow.com/comment/37227885
has text: @ToTom, bear in mind if your not actually writing to the storage, just reading, it's probably better to use `READ_EXTERNAL_STORAGE` instead, although using `WRITE_EXTERNAL_STORAGE` will implicitly give you the READ permission anyway.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24128383
type: AnswerComment

http://stackoverflow.com/comment/37232284
score: 0
comment on: http://stackoverflow.com/a/24119063
type: Comment
has text: @newacct that's not quite right - the former still provides a guarantee that it's a sublcass of `Example<E>` - without that my `get3()` wouldn't compile.
type: AnswerComment

http://stackoverflow.com/comment/37387580
has text: I don't follow your new question, replace which reference in which text String?
comment on: http://stackoverflow.com/a/24213091
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/84518321
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24239639
has text: How to pass url parameters in this !? I have three parameters which needs to be passed but using this command only first parameter only going
type: Comment

http://stackoverflow.com/a/24171595
has body: there is no equivalent in Java for DuplicateAndClose Per this: http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.duplicateandclose(v=vs.110).aspx?cs-save-lang=1&amp;cs-lang=csharp#code-snippet-1 DuplicateAndClose deals with making a socket available across processes. This is not the same thing as doing it across threads. If you are using multiple threads in Java (likely) rather than multiple processes, you can just use the Socket object directly - you don't need any sort of DuplicateAndClose call for whatever you are doing. And if the problem is that you are trying to have another connection from the same client act like it has already logged in based on another earlier connection - that really has nothing to do with sockets - that's a matter of your internal application state. Make a synchronized map of your clients that have connected and write the logic you need.
has comment: http://stackoverflow.com/comment/37350868
answers question: http://stackoverflow.com/q/24171426
score: 4
downvote count: 0
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/37345300
has comment: http://stackoverflow.com/comment/37363091

http://stackoverflow.com/q/24113453
has title: How do I code the function of the Save button in Java?
type: Question
tagged with: text
score: 0
answer count: 2
type: UnansweredQuestion
has body: I have an existing text file and edited some stuff in it. I want to save a line of text to that same file. Currently, my Save button will create a new file for the text file I just edited. What I want is that my Save button will just overwrite the existing file. What code do I need to write on it? Here's my current code: private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fc = new JFileChooser(); int choice = fc.showSaveDialog(null); if (choice == JFileChooser.APPROVE_OPTION) { String filename = fc.getSelectedFile().getAbsolutePath(); writeToFile(filename); } } here's my writeToFile code: private void writeToFile(String filename) { Person p = getPersonFromDisplay(); PersonFileMgr.save(filename, p); }
tagged with: java
has comment: http://stackoverflow.com/comment/37199599
tagged with: save
has answer: http://stackoverflow.com/a/24116739
tagged with: file
tagged with: button
upvote count: 1
has comment: http://stackoverflow.com/comment/37199710
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24113487
has comment: http://stackoverflow.com/comment/37203982

http://stackoverflow.com/comment/52595447
type: Comment
score: 0
has text: [link](http://s28.postimg.org/ueff3pzr1/Screen_Shot_2015_09_02_at_21_12_32.png) with the highest optimization level possible in Swift 2 it takes 1ms. I think Java can achieve the same result. Even though Swift does the undesired thing filling the whole array with 0 at the beginning, but I think it the compiler will optimize this process, since it is unneeded in this scenario.
type: QuestionComment
comment on: http://stackoverflow.com/q/24194128

http://stackoverflow.com/comment/37470677
comment on: http://stackoverflow.com/q/24256702
type: Comment
type: QuestionComment
score: 0
has text: You also really, really should use expression language instead of scriptlets http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files/3180202#3180202

http://stackoverflow.com/q/24118667
tagged with: java
has body: I work with Java resource bundles that are included in the final JAR using Maven's resource tag: lang/ true ${basedir}/src/main/resources/ localization*.properties Due to the nature of the automatic resource loading, I need to include the English file two times: As the standard English file (localization_en.properties) and as the base file that provides a fallback if a more specific localization is not found (localization.properties). At the moment, both of these files are present in the resource directory, even through their content is exactly the same. I am looking for a way that lets Maven duplicate the present localization_en.properties and include it with the base name, so I do not need two separated files in the resource directory any more.
has title: Include a file multiple times with different names in a Maven-built JAR
score: 2
has answer: http://stackoverflow.com/a/24119775
tagged with: resourcebundle
answer count: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37208985
type: UnansweredQuestion
tagged with: localization
downvote count: 0
tagged with: maven
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24118795

http://stackoverflow.com/a/24189680
upvote count: 1
has body: If your CPU runs at 100% or you use all of available memory, it does not matter how many tasks you run in parallel. In fact, you may slow down the performance, not improve it, by pushing tasks in parallel. You already set localWorkers to 16. That's a lot of parallel threads. By passing two tasks you simply double the number of threads. If you get any performance improvement from increasing this number - go for it, although your results look surprising (either your app is very small or your computer is a monster). There are no optimization benefits from compiling modules sequentially vs in parallel, as far as I know. You can always verify it by looking the at the size of the compiled code. You may find this post interesting: GWT Compilation Performance
answers question: http://stackoverflow.com/q/24189518
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37343082
has comment: http://stackoverflow.com/comment/37360325
has comment: http://stackoverflow.com/comment/37357765
has comment: http://stackoverflow.com/comment/37358240
has comment: http://stackoverflow.com/comment/37360577
downvote count: 0
has comment: http://stackoverflow.com/comment/37342535

http://stackoverflow.com/q/24164014
has answer: http://stackoverflow.com/a/52753267
linked to: http://stackoverflow.com/q/31412918
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/61158618
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37322145
tagged with: spring-security
has answer: http://stackoverflow.com/a/24179151
favorite count: 0
has body: I have implemented a REST server using Spring Boot 1.0.2. I'm having trouble preventing Spring from setting HTTP headers that disable HTTP caching. My controller is as following: @Controller public class MyRestController { @RequestMapping(value = "/someUrl", method = RequestMethod.GET) public @ResponseBody ResponseEntity&lt;String&gt; myMethod( HttpServletResponse httpResponse) throws SQLException { return new ResponseEntity&lt;String&gt;("{}", HttpStatus.OK); } } All HTTP responses contain the following headers: Cache-Control: no-cache, no-store, max-age=0, must-revalidate Expires: 0 Pragma: no-cache I've tried the following to remove or change those headers: Call setCacheSeconds(-1) in the controller. Call httpResponse.setHeader("Cache-Control", "max-age=123") in the controller. Define @Bean that returns WebContentInterceptor for which I've called setCacheSeconds(-1). Set property spring.resources.cache-period to -1 or a positive value in application.properties. None of the above have had any effect. How do I disable or change these headers for all or individual requests in Spring Boot?
linked to: http://stackoverflow.com/q/24916894
type: Question
accepted answer: http://stackoverflow.com/a/24179151
has title: How to enable HTTP response caching in Spring Boot
type: AnsweredQuestion
answer count: 9
tagged with: spring-boot
has answer: http://stackoverflow.com/a/41299093
has answer: http://stackoverflow.com/a/39024337
has answer: http://stackoverflow.com/a/57483236
possible better answer: http://stackoverflow.com/a/54165872
upvote count: 76
score: 76
has answer: http://stackoverflow.com/a/36293562
has answer: http://stackoverflow.com/a/54165872
has answer: http://stackoverflow.com/a/68140551
has comment: http://stackoverflow.com/comment/37294467
tagged with: spring

http://stackoverflow.com/a/24194220
has comment: http://stackoverflow.com/comment/37350989
has comment: http://stackoverflow.com/comment/37350964
has comment: http://stackoverflow.com/comment/37350986
has comment: http://stackoverflow.com/comment/37351076
type: Answer
answers question: http://stackoverflow.com/q/24194188
has comment: http://stackoverflow.com/comment/37351150
upvote count: 4
has comment: http://stackoverflow.com/comment/37351317
has body: Put your restricted subset into one interface, and have the larger interface extend it. Then have A implement the child (larger) interface, and B implement the parent (smaller) one. Then both A and B implement the smaller interface, while only A implements the larger. Use the smaller interface for coding to whenever you can. public interface AInterface { void add(); void remove(); } public interface ASubInterface extends AInterface { void invalidate(); void move(); } public class AClass implements ASubInterface { /* 4 methods */ } public class BClass implements AInterface { /* 2 methods */ }
downvote count: 0
has comment: http://stackoverflow.com/comment/37350951
has comment: http://stackoverflow.com/comment/37351173
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37351111
score: 4
has comment: http://stackoverflow.com/comment/37351008
accepted answer of: http://stackoverflow.com/q/24194188

http://stackoverflow.com/comment/37206185
type: Comment
type: QuestionComment
has text: im sorry but im very new to this topic i dont really have an idea. But is there an existing codec that i can use? how do i implement it? T_T
comment on: http://stackoverflow.com/q/24116994
score: 0

http://stackoverflow.com/q/24124356
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24124638
tagged with: unit-testing
favorite count: 0
has body: I wrote the following test class in a package named "com.example.test". I included in the manifest the following instrumentation: but when I run it as an Android jUnit Test, I get the following error: junit.framework.AssertionFailedError: Class com.example.test.TestCase has no public constructor TestCase(String name) or TestCase() at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701) Can you help me, please? Thank you :) import com.example.MenuPage; import com.example.R; import android.content.Intent; import android.test.ActivityUnitTestCase; import android.test.suitebuilder.annotation.MediumTest; import android.widget.Button; public class TestCase extends ActivityUnitTestCase&lt;MenuPage&gt; { Intent mLaunchIntent; public TestCase(Class&lt;MenuPage&gt; activityClass) { super(activityClass); } @Override protected void setUp() throws Exception { super.setUp(); mLaunchIntent = new Intent(getInstrumentation().getTargetContext(), MenuPage.class); startActivity(mLaunchIntent, null, null); final Button launchNextButton = (Button) getActivity().findViewById(R.id.button1); } @MediumTest public void testNextActivityWasLaunchedWithIntent() { startActivity(mLaunchIntent, null, null); final Button launchNextButton = (Button) getActivity().findViewById(R.id.button1); launchNextButton.performClick(); final Intent launchIntent = getStartedActivityIntent(); assertNotNull("Intent was null", launchIntent); assertTrue(isFinishCalled()); } }
type: AnsweredQuestion
tagged with: android
tagged with: java
tagged with: junit
has comment: http://stackoverflow.com/comment/37219687
has answer: http://stackoverflow.com/a/24124638
type: Question
has title: Android jUnit test error
score: 2
upvote count: 2

http://stackoverflow.com/a/24134407
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24123120
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24123120
has body: Removing following dtd from web.xml solved this issue.

http://stackoverflow.com/q/24147057
tagged with: java
has comment: http://stackoverflow.com/comment/48606516
has comment: http://stackoverflow.com/comment/37264089
has comment: http://stackoverflow.com/comment/37301388
has comment: http://stackoverflow.com/comment/37294387
type: Question
has body: I am suffering of a massive lack of speed when it comes to mutual authenticate with the card. This takes about 13 to 20 seconds which seems at least 10 times to much. The slowest part is the "Get-Challenge" and I think it might be because of my construction of a non-leaking map and the seperate "rotate-left" public static byte[] NLM (byte[] x, byte[] y) { final byte[] f1 = new byte[] {(byte) 0x35, (byte) 0xB0,(byte) 0x88,(byte) 0xCC,(byte) 0xE1,(byte) 0x73}; //48-bit unsigned integer final byte[] constant = new byte[] {(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01}; //constant byte[] Y = new byte[6]; //48-bit unsigned integer byte[] Y1 = new byte[6]; //48-bit unsigned integer byte[] R = new byte[6]; //48-bit unsigned integer byte[] R1 = new byte[6]; //48-bit unsigned integer short size = 6; JCArrayInt[] Red = new JCArrayInt[2]; // array of 48-bit unsigned integers JCArrayInt[] Mul = new JCArrayInt[2]; // array of 48-bit unsigned integers byte k = 48; Red[0] = new JCArrayInt(size); Mul[0] = new JCArrayInt(size); Red[1] = new JCArrayInt(size); Mul[1] = new JCArrayInt(size); Red[1].jcint = Utils.XOR(f1, constant); Mul[1].jcint = x; Y = y; for (short i = 0; i &lt; 48; i++) { R = rotateLeft48(R); R1 = Utils.AND(R, constant); R = Utils.XOR(R, Red[R1[5]].jcint); Y = rotateLeft48(Y); Y1 = Utils.AND(Y, constant); R = Utils.XOR(R, Mul[Y1[5]].jcint); } return R; } public static byte[] rotateLeft48 (byte[] data) { byte t = (byte)((data[0] &gt;&gt;&gt; 7) &amp; 0x001); short l = (short) (data.length - 1); for (short i = 0; i &lt; l; ++i) { data[i] = (byte)(((data[i] &lt;&lt; 1) &amp; 0x0FE) | ((data[i + 1] &gt;&gt;&gt; 7) &amp; 0x001)); } data[l] = (byte)(((data[l] &lt;&lt; 1) &amp; 0x0FE) | t); return data; } I can live with it taking a little longer due to this overhead besides doing some XOR, AND, rotation and all they key generation and actual encrypting (done with AES-128). should I use transient arrays (would that make that big of a differenc…
has comment: http://stackoverflow.com/comment/37291354
has title: Java Card Encryption speed
tagged with: javacard
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/37293697
has comment: http://stackoverflow.com/comment/37337118
tagged with: aes
has comment: http://stackoverflow.com/comment/37333752
score: 0
tagged with: mutual-authentication
has comment: http://stackoverflow.com/comment/37297242
answer count: 0
has comment: http://stackoverflow.com/comment/37292543

http://stackoverflow.com/comment/37351051
score: 0
comment on: http://stackoverflow.com/q/24194194
has text: Because I don't know how to, would it enable me to read a larger response from the server though? Sounds like it would just compress the data.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24164798
has comment: http://stackoverflow.com/comment/37296039
tagged with: sql
has title: Hibernate Query not returning results
answer count: 1
has comment: http://stackoverflow.com/comment/37299588
has comment: http://stackoverflow.com/comment/37295935
type: AnsweredQuestion
has body: Long story short my hibernate query is only returning results on its first visit to the DAO from the calling loop. So far I've tried manually setting the values and that returns its expected result set every time however whenever it turns into a dynamic query it is returning and empty resultset. However that's not what it should be giving me. I've tried multiple instances of querying it with the exact same input for 2 instances through the loop and it will only ever give me results on the first time through. EDIT: I've narrowed down to my issue is involving the rate_class &amp; utility variables both of which are String's. If these two are 'hardcoded' ie; changing the query to just put in "x" and "y" I get what I want. I've updated the code with my modified version. Calling Loop: public void RetrievePricing(){ for(int x=0; x&lt;pricing.size(); x++){ //grab the pricing object to be priced currentlyPricing = pricing.get(x); //look back 7 days at max for pricing for(int y=0; y&lt;7; y++){ //query for pricing matches rate_class = currentlyPricing.getRateClass(); utility = currentUser.getUtility(); dataList = pricing_dataDao.findPricing(rate_class, utility, currentUser.getStart_month(), Integer.valueOf(currentUser.getStart_year()), d1, "12", totalVolume, totalVolume); //if we didn't find one decrement a day if(dataList.size() == 0 &amp;&amp; x&lt;=0){ Calendar cal = new GregorianCalendar(); cal.setTime(d1); cal.add(Calendar.DATE, -1); d2 = cal.getTime(); d1 = new java.sql.Date(d2.getTime()); } //if we did find something attempt to add it and break out of the inner loop else{ if(currentlyPricing.getName().isEmpty() == false &amp;&amp; dataList.isEmpty() == false){ pricingMap.put(currentlyPricing.getName(), dataList); break; } } } } } DAO Function public List&lt;Pricing_Data&gt; findPricing(String rate_class, String utility, String start_month, int start_year, Date expiration_date, String term, double low_kwh, double high_kwh) { List&lt;Pricing_Data&gt; tempList = new Arra…
tagged with: java
tagged with: hibernate
tagged with: spring
type: Question
score: 0
has answer: http://stackoverflow.com/a/24171802
accepted answer: http://stackoverflow.com/a/24171802
has comment: http://stackoverflow.com/comment/37295453

http://stackoverflow.com/comment/37190881
has text: @Farhan: I think he means that's its's made out of a single type of digit.
comment on: http://stackoverflow.com/q/24108874
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24185673
linked to: http://stackoverflow.com/q/38922754
tagged with: android
tagged with: datetime
score: -2
linked to: http://stackoverflow.com/q/12861893
has comment: http://stackoverflow.com/comment/84392975
has body: I have this date and I want to forward it ahead in time, adding a few weeks to it. This is how I do it int weeks = 4; newDate.set(Calendar.HOUR_OF_DAY, hoursAndMinutes.get(Calendar.HOUR_OF_DAY)); newDate.set(Calendar.MINUTE, hoursAndMinutes.get(Calendar.MINUTE)); newDate.set(Calendar.SECOND, 0); newDate.set(Calendar.MILLISECOND, Utils.returnRandomNumberBetween(1, 999)); dateFormat.format(newDate.getTime()); dateInMiliseconds = newDate.getTimeInMillis() + weeks * 604800000; // 604800000 is a week's worth of miliseconds Now, instead of moving the date like 4 weeks ahead, it moves it back to the same week day but in May? EDIT: To the guys that pointed out my question is a possible duplicate - it would have been a possible duplicate if I knew the problem was in casting, which I didnt know.
possible better answer: http://stackoverflow.com/a/24185730
type: AnsweredQuestion
tagged with: java
downvote count: 2
duplicate of: http://stackoverflow.com/q/12861893
has title: Android Java: Why does adding weeks worth of miliseconds to a date, makes it go back in time?
tagged with: calendar
favorite count: 0
accepted answer: http://stackoverflow.com/a/24185711
has comment: http://stackoverflow.com/comment/37333839
has answer: http://stackoverflow.com/a/24185711
type: Question
has answer: http://stackoverflow.com/a/24185730
upvote count: 0
answer count: 2

http://stackoverflow.com/comment/37356878
score: 0
type: Comment
type: QuestionComment
has text: Why do you have to run every half second?? Rethink the design.
comment on: http://stackoverflow.com/q/24197177

http://stackoverflow.com/q/24254306
tagged with: notify
has title: Postgresql notify and listen
tagged with: listen
tagged with: sql
upvote count: 1
type: UnansweredQuestion
answer count: 1
downvote count: 1
favorite count: 0
type: Question
tagged with: postgresql
has body: Hi every one I'm doing a small program to listen and notify using POSTGRESQL and JAVA. I just want to get notification message, to be stored in a file or MySQL database. Can any one guide me where I can find documentation or sample code for this.
score: 0
has answer: http://stackoverflow.com/a/24254421
tagged with: java

http://stackoverflow.com/q/24124001
type: Question
linked to: http://stackoverflow.com/q/413898
has answer: http://stackoverflow.com/a/24124066
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37235272
has answer: http://stackoverflow.com/a/24124067
has title: Java List<> behavior
tagged with: collections
answer count: 4
has answer: http://stackoverflow.com/a/24124055
has comment: http://stackoverflow.com/comment/37218995
tagged with: list
has body: I have odd behavior with a Java List&lt;> class, which is overriding all values with the last one added. Take for example the following code ... import java.io.*; import java.sql.*; import java.lang.*; import java.util.*; public class alist { // public static class item { public static String name; public static long type; item() {} item( String n, long t ) { name = n; type = t; } public String toString() { return "name: " + name + ", type: " + String.valueOf( type ); } } public static void main(String [] args) { List&lt;item&gt; lst = new ArrayList&lt;item&gt;(); lst.add( new item( "abc", 0 ) ); lst.add( new item( "xyz", 1 ) ); for ( item i : lst ) System.out.println( i.toString() ); } } I would have expected this to output the following ... name: abc, type: 0 name: xyz, type: 1 ... but instead it prints ... name: xyz, type: 1 name: xyz, type: 1 ... ideas? I'm sure it's something silly, where I simply cannot see the forest because of the trees. .
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37219064
has answer: http://stackoverflow.com/a/24124052

http://stackoverflow.com/a/24237779
downvote count: 0
score: 1
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24237558
has comment: http://stackoverflow.com/comment/37437046
has comment: http://stackoverflow.com/comment/37439796
answers question: http://stackoverflow.com/q/24237558
has comment: http://stackoverflow.com/comment/37497363
has body: I would try a different strategy. I would set a longish read timeout, with setSoTimeout(), and if it expires I would then leave the group, sleep for a bit, then rejoin. That way it will happen every time, not just at startup. You probably need to sniff the network to make sure that IGMP JOIN messages are actually going out when you do the re-join.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37439215

http://stackoverflow.com/comment/37913582
has text: now i am configuring the loadbalancer in my network settings of my application server layer. I have actually created a laodbalancer in the same zone and then changed the ports to 8080(as most people suggested). Also made the response timeout as 60 . but still when i try to access the lb, it gives me a connection refused error. i have tried restarting instances also. Please help me as to where am i going wrong!
comment on: http://stackoverflow.com/a/24248783
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24132298
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37234995
has comment: http://stackoverflow.com/comment/37234944
has comment: http://stackoverflow.com/comment/37235243
has answer: http://stackoverflow.com/a/24132329
tagged with: arraylist
score: 0
tagged with: android
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37234975
has body: I have an arraylist of bean. Each bean contains multiple elements. There is one element in bean 'userid'. This userid can be valid phone number, valid email, invalid phone number or invalid email id. I want to show valid phone numbers on top den valid email ids then invalid phone numbers and then invalid password. How do i do this using comparater Thanks in advance :-)
has title: how do i sort an arraylist of array using comparater?
type: Question

http://stackoverflow.com/comment/37466018
type: QuestionComment
comment on: http://stackoverflow.com/q/24254250
score: 0
type: Comment
has text: How large is going to be your map? What type of data are you inserting?

http://stackoverflow.com/q/24127151
type: Question
has title: Java Thread hanging without deadlocks
has comment: http://stackoverflow.com/comment/37228812
has answer: http://stackoverflow.com/a/27676567
has comment: http://stackoverflow.com/comment/37255456
has body: I am currently having some trouble with a process that is hanging. First of all, the below thread dump shows no deadlock. Another interesting thing is that the process is hanging at java.lang.System.identityHashCode method. The currently CPU usage of that process is 0%, sometimes peaks at 1%... normally the process uses 100%. It is using 1.7GB of RAM (which is normal for this process). The machine has plenty of CPUs, disk space and RAM available. Attaching to process ID 4146, please wait... Debugger attached successfully. Server compiler detected. JVM version is 23.7-b01 Deadlock Detection: No deadlocks found. Thread 12761: (state = BLOCKED) Thread 4159: (state = BLOCKED) Thread 4158: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Interpreted frame) - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=135 (Interpreted frame) - java.lang.ref.ReferenceQueue.remove() @bci=2, line=151 (Interpreted frame) - java.lang.ref.Finalizer$FinalizerThread.run() @bci=3, line=177 (Interpreted frame) Thread 4157: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Interpreted frame) - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame) - java.lang.ref.Reference$ReferenceHandler.run() @bci=46, line=133 (Interpreted frame) Thread 4147: (state = IN_VM) - java.lang.System.identityHashCode(java.lang.Object) @bci=0 (Compiled frame; information may be imprecise) - java.util.IdentityHashMap.hash(java.lang.Object, int) @bci=1, line=301 (Compiled frame) - java.util.IdentityHashMap.containsKey(java.lang.Object) @bci=17, line=358 (Compiled frame) - com.rits.cloning.Cloner.cloneInternal(java.lang.Object, java.util.Map) @bci=18, line=346 (Compiled frame) - com.rits.cloning.Cloner.cloneInternal(java.lang.Object, java.util.Map) @bci=368, line=404 (Compiled frame) - com.rits.cloning.Cloner.cloneInternal(java.lang.Object, java.util.Map) @bci=368, line=404 (Compiled frame) - com.rits.cloning.Cloner.cloneInternal(java.lang.Object, java.util.Map) @bci=368, line=404 (Compiled f…
upvote count: 5
type: UnansweredQuestion
tagged with: multithreading
answer count: 1
downvote count: 1
tagged with: process
score: 4
has comment: http://stackoverflow.com/comment/37225557
favorite count: 0
has comment: http://stackoverflow.com/comment/37225619
has comment: http://stackoverflow.com/comment/37232566
has comment: http://stackoverflow.com/comment/37263549
tagged with: java
tagged with: freeze
has comment: http://stackoverflow.com/comment/37226268

http://stackoverflow.com/q/24161916
tagged with: user-interface
has answer: http://stackoverflow.com/a/24163326
has comment: http://stackoverflow.com/comment/37289737
type: Question
possible better answer: http://stackoverflow.com/a/24162733
tagged with: android
tagged with: animation
accepted answer: http://stackoverflow.com/a/24163326
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37289558
has answer: http://stackoverflow.com/a/24162733
answer count: 3
has title: Android: run animation while loading stuff
has body: I'm reading a lot of files from the network. This takes quite a long time. Because of this i want to run a little animation (like a progress animation). But the animation only starts when the other stuff is finished. How can i run the animation on the UI Thread (in a Dialog!)? AnimationDrawable animation = (AnimationDrawable) ivAnimation.getBackground(); animation.start();
has answer: http://stackoverflow.com/a/24162074
tagged with: java
tagged with: multithreading

http://stackoverflow.com/a/24148057
has comment: http://stackoverflow.com/comment/37265992
answers question: http://stackoverflow.com/q/24147975
has comment: http://stackoverflow.com/comment/37266640
has comment: http://stackoverflow.com/comment/37265842
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37265234
has comment: http://stackoverflow.com/comment/37264406
has comment: http://stackoverflow.com/comment/37266098
has comment: http://stackoverflow.com/comment/37265731
accepted answer of: http://stackoverflow.com/q/24147975
has comment: http://stackoverflow.com/comment/37265381
has comment: http://stackoverflow.com/comment/37264382
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37264828
upvote count: 1
has body: You have to have this code (below) inside onCreate() TextView text = (TextView) findViewById(R.id.text); ImageView image = (ImageView) findViewById(R.id.image); Try it. Update: The code could look like this: public class MainActivity extends Activity { ImageView image = null; TextView text = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); text = (TextView) findViewById(R.id.text); image = (ImageView) findViewById(R.id.image); text.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (image.getVisibility() == View.GONE) { image.setVisibility(View.VISIBLE); text.setText("hide the image"); } else { image.setVisibility(View.GONE); text.setText("show the image"); } } }); } } and layout is here: &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:gravity="center" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:visibility="gone" /&gt; &lt;TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="show the image" /&gt; &lt;/LinearLayout&gt;

http://stackoverflow.com/q/24139469
type: UnansweredQuestion
answer count: 1
has body: I am having the following XSLT, while transforming a XML using this XSLT throws the following error &lt;xsl:stylesheet&gt; &lt;xsl:output method="xml" indent="yes" /&gt; &lt;xsl:key name="k1" match="*" use="."/&gt; &lt;!-- &lt;xsl:param name="string-value" select="'STRING_TO_FIND'"/&gt; --&gt; &lt;xsl:template match="*"&gt; &lt;rss&gt; &lt;xsl:copy-of select="key('k1', 'STRING_TO_FIND')"/&gt; &lt;/rss&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; ERROR ERROR: 'Could not compile stylesheet' FATAL ERROR: 'The string "--" is not permitted within comments.' :The string "--" is not permitted within comments. I replaced the following string in place of 'STRING_TO_FIND' in XSLT. This string can be generated dynamically. The sample string which throws the above error is as follows. &lt;description&gt;&lt;![CDATA[ &lt;p&gt;LANSING, MI -- An unusual photo and an "off-the-cuff remark" in the Michigan House on Thursday sparked a war of words about the "war on women" that stretched far beyond the walls of the state Capitol.&lt;/p&gt; &lt;p&gt;Republican state Reps. Roger Victory of Hudsonville, Pete Pettalia of Presque Isle and Ben Glardon of Owosso were photographed on the House floor holding a series of womens' fashion magazines.&lt;/p&gt; &lt;p&gt;"Don't say we don't understand women," Petallia joked, according to a&amp;nbsp;Michigan Public Radio Network&amp;nbsp;reporter, whose tweet quickly spread online and prompted widespread criticism from Democrats.&lt;/p&gt; &lt;center&gt; &lt;blockquote class="twitter-tweet" lang="en"&gt; &lt;p&gt;&lt;a href="https://twitter.com/MIHouseGOP"&gt;@MIHouseGOP&lt;/a&gt; members Victory, Pettalia, and Glardon: "Don't say we don't understand women." &lt;a href="https://twitter.com/search?q=%23mileg&amp;amp;src=hash"&gt;#mileg&lt;/a&gt; &lt;a href="http://t.co/zsifsqrZ1N"&gt;pic.twitter.com/zsifsqrZ1N&lt;/a&gt;&lt;/p&gt; &amp;#8212; Jake Neher (@GJNeher) &lt;a href="https://twitter.com/GJNeher/statuses/474599923149578240"&gt;June 5, 2014&…
has title: How to prevent FATAL ERRORS while transforming XML using XSLT
linked to: http://stackoverflow.com/q/24120542
tagged with: xslt
has comment: http://stackoverflow.com/comment/37247862
score: 0
has comment: http://stackoverflow.com/comment/37248061
tagged with: java
tagged with: http://stackoverflow.com/tag/xml
type: Question
has answer: http://stackoverflow.com/a/24140129
tagged with: transformation
has comment: http://stackoverflow.com/comment/37247902

arrays
tags question: http://stackoverflow.com/q/24109562
tags question: http://stackoverflow.com/q/24178900
tags question: http://stackoverflow.com/q/24222905
tags question: http://stackoverflow.com/q/24254431
tag name: arrays
tags question: http://stackoverflow.com/q/24220986
tags question: http://stackoverflow.com/q/24118437
tags question: http://stackoverflow.com/q/24155519
tags question: http://stackoverflow.com/q/24251047
tags question: http://stackoverflow.com/q/24260759
tags question: http://stackoverflow.com/q/24132719
tags question: http://stackoverflow.com/q/24137628
tags question: http://stackoverflow.com/q/24113194
tags question: http://stackoverflow.com/q/24108111
tags question: http://stackoverflow.com/q/24211216
tags question: http://stackoverflow.com/q/24202850
tags question: http://stackoverflow.com/q/24248714
tags question: http://stackoverflow.com/q/24231364
tags question: http://stackoverflow.com/q/24133773
tags question: http://stackoverflow.com/q/24109639
tags question: http://stackoverflow.com/q/24207614
tags question: http://stackoverflow.com/q/24145039
tags question: http://stackoverflow.com/q/24238329
type: Tag
tags question: http://stackoverflow.com/q/24128640
tags question: http://stackoverflow.com/q/24175087
tags question: http://stackoverflow.com/q/24229886
tags question: http://stackoverflow.com/q/24153406
tags question: http://stackoverflow.com/q/24202315
tags question: http://stackoverflow.com/q/24238830
tags question: http://stackoverflow.com/q/24191959
tags question: http://stackoverflow.com/q/24205104
tags question: http://stackoverflow.com/q/24187709
tags question: http://stackoverflow.com/q/24147871
tags question: http://stackoverflow.com/q/24174767
tags question: http://stackoverflow.com/q/24239773
tags question: http://stackoverflow.com/q/24206828
tags question: http://stackoverflow.com/q/24128256
tags question: http://stackoverflow.com/q/24216150
tags question: http://stackoverflow.com/q/24113489
tags question: http://stackoverflow.com/q/24248991
tags question: http://stackoverflow.com/q/24184945
tags question: http://stackoverflow.com/q/24154135
tags question: http://stackoverflow.com/q/24122510
tags question: http://stackoverflow.com/q/24137928
tags question: http://stackoverflow.com/q/24117008
tags question: http://stackoverflow.com/q/24205270
tags question: http://stackoverflow.com/q/24232141
tags question: http://stackoverflow.com/q/24106844
tags question: http://stackoverflow.com/q/24175145
tags question: http://stackoverflow.com/q/24206036
tags question: http://stackoverflow.com/q/24250994
tags question: http://stackoverflow.com/q/24229419
tags question: http://stackoverflow.com/q/24108335
tags question: http://stackoverflow.com/q/24193313
tags question: http://stackoverflow.com/q/24173965
tags question: http://stackoverflow.com/q/24114606
tags question: http://stackoverflow.com/q/24169216
tags question: http://stackoverflow.com/q/24163389
tags question: http://stackoverflow.com/q/24107176
tags question: http://stackoverflow.com/q/24179253
tags question: http://stackoverflow.com/q/24263231
tags question: http://stackoverflow.com/q/24147274
tags question: http://stackoverflow.com/q/24162282
tags question: http://stackoverflow.com/q/24201326
tags question: http://stackoverflow.com/q/24144993
tags question: http://stackoverflow.com/q/24131465
tags question: http://stackoverflow.com/q/24248499
tags question: http://stackoverflow.com/q/24217871
tags question: http://stackoverflow.com/q/24113144
tags question: http://stackoverflow.com/q/24263713
tags question: http://stackoverflow.com/q/24228762
tags question: http://stackoverflow.com/q/24123008
tags question: http://stackoverflow.com/q/24185350
tags question: http://stackoverflow.com/q/24179163
tags question: http://stackoverflow.com/q/24190537
tags question: http://stackoverflow.com/q/24143615
tags question: http://stackoverflow.com/q/24233857
tags question: http://stackoverflow.com/q/24173012
tags question: http://stackoverflow.com/q/24158424

http://stackoverflow.com/a/24163417
has body: You are using == not .equals() to compare strings. Use one[j].equals("a").
upvote count: 6
answers question: http://stackoverflow.com/q/24163389
accepted answer of: http://stackoverflow.com/q/24163389
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37292772
downvote count: 0
has comment: http://stackoverflow.com/comment/37292404
score: 6
type: Answer

http://stackoverflow.com/q/24209130
answer count: 2
tagged with: resultset
tagged with: java
tagged with: jdbc
tagged with: mysql
has comment: http://stackoverflow.com/comment/37379289
has comment: http://stackoverflow.com/comment/37379352
has comment: http://stackoverflow.com/comment/37379319
has answer: http://stackoverflow.com/a/50145592
has title: Stored Procedure Returning Null
type: Question
linked to: http://stackoverflow.com/q/13833804
has body: This question is similar to: Mysql - Stored procedure OUT variable return null, sadly their solutions did not work for me. I have a database populated with data about who used my program and when, and I am trying to create a stored procedure in MySql to retrieve all the data and send it to my java servlet, where it will be processed. This is what I have currently for my Stored Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `getTableData`(OUT time VARCHAR(45), OUT fName VARCHAR(45), OUT lName VARCHAR(45), OUT rVar INT) BEGIN SELECT rqTime, name, lastName, requestVar FROM pdata.userlist; END Here is how I call the query in Java: CallableStatement stmt = null; ResultSet rs = null; String sqlQuery = "{call getTableData (?, ?, ?, ?)}"; stmt = conn.prepareCall(sqlQuery); stmt.registerOutParameter(1, java.sql.Types.VARCHAR); stmt.registerOutParameter(2, java.sql.Types.VARCHAR); stmt.registerOutParameter(3, java.sql.Types.VARCHAR); stmt.registerOutParameter(4, java.sql.Types.INTEGER); stmt.execute(); When I try to call this stored procedure in Java (I've tried using result sets and the normal getString(), etc) all values return null. My table design is along the lines of: Request Time (millis), name, lastName, requestID 1402341252155, John, Doe, 11 Any help would be greatly appreciated. I feel as though the problem lies in the stored procedure itself, particularly the how I select the variables from the the table and assign them to the "out" parameters. Thanks!
has answer: http://stackoverflow.com/a/24209252
accepted answer: http://stackoverflow.com/a/24209252
possible better answer: http://stackoverflow.com/a/50145592
type: AnsweredQuestion
tagged with: stored-procedures
score: 0

http://stackoverflow.com/comment/37222646
type: AnswerComment
comment on: http://stackoverflow.com/a/24125365
has text: @JeffGohlke Thanks for the great answers and support!
type: Comment
score: 0

http://stackoverflow.com/comment/37483048
type: Comment
has text: thanks, but the `HashSet` isn't immutable, only the reference to it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24263571

http://stackoverflow.com/comment/133254352
comment on: http://stackoverflow.com/a/24114612
score: 0
has text: It doesn't work for me. I get "Unresolved compilation problem" from the `main()` signature line.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37230017
has text: Your code isn't lacking, something else is going on... I've tested using an IDE as well as the command line. No difference.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24129480
type: Comment

http://stackoverflow.com/comment/37208963
comment on: http://stackoverflow.com/q/24116760
type: QuestionComment
score: 0
has text: Symlinking/renaming war file to ROOT.war overrides context from jboss-web.xml and deployes to root context (/). Do Wildfly have simliar functionality as --contextroot for Glassfish to be able to set other contexts than root?
type: Comment

http://stackoverflow.com/comment/37265058
type: Comment
comment on: http://stackoverflow.com/a/24145672
type: AnswerComment
has text: I did research that package, and it doesn't seem that it will be ever available. It looks that it is some util for testing, that won't be exported.
score: 0

http://stackoverflow.com/comment/37257437
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24130351
has text: myDrawPanel.getPicture() returns an ArrayList (home grown, not Java's) of simple objects (which contain no graphics). No images at all, anywhere that I know of.
score: 0

http://stackoverflow.com/a/24219862
upvote count: 1
score: 1
type: Answer
downvote count: 0
has body: The following prints the substring that contains the word part in your string (a \w denotes a word characters including digits, while \W denotes a non-word character): Pattern p = Pattern.compile("(\\w+)[\\W\\s]*"); Matcher matcher = p.matcher("word!,(. [&amp;]"); if(matcher.find()) { System.out.println(matcher.group(1)); } Output: word
answers question: http://stackoverflow.com/q/24219697

http://stackoverflow.com/q/24145979
upvote count: 2
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37260391
downvote count: 2
has comment: http://stackoverflow.com/comment/37260174
tagged with: java
tagged with: stream
has answer: http://stackoverflow.com/a/24146002
answer count: 1
accepted answer: http://stackoverflow.com/a/24146002
favorite count: 0
type: Question
has body: I've recently come along this frustrating problem, where the scanner completely ignores some inputs from the System.in inputstream. Here's an example: Do you want a cookie? Yes or no. Now, I type yes: yes Result: Cookie for you! Now, if I say no: no no Result: No Cookie for you. Get it? If I say yes it just accepts it. If I say no, I have to type it 2 times. If you really need some code. Here's some of that :) public static void main(String[] paramArgs){ MainEW sMain = new MainEW(); Scanner s = sMain.scanner; System.out.println("Enter a file path."); System.out.println("Example: /Users/Some_User/Desktop/Some_Folder"); String defPath = s.next(); System.out.println("Enter a name for the file."); String defName = s.next() + ".txt"; System.out.println("Now, enter what you want to write to the file."); s.nextLine(); String defText = s.nextLine(); System.out.println("Do you want to create a new file? Yes or No"); if (s.next().equalsIgnoreCase("yes")) { WriterEW writer = new WriterEW(defPath, defName, defText, true); return; } else if (s.next().equalsIgnoreCase("no")) { WriterEW writer = new WriterEW(defPath, defName, defText, false); return; } else { System.out.println("Invalid input."); } } Thanks :)
has title: Scanner Ignores Some Inputs (System.in)
tagged with: input
has comment: http://stackoverflow.com/comment/37260404

http://stackoverflow.com/comment/37301839
type: AnswerComment
has text: [`SimpleJdbcTemplate` is deprecated as of 3.1](http://docs.spring.io/spring/docs/3.2.9.RELEASE/javadoc-api/). It was originally made as a wrapper for the `JdbcTemplate` but then most of the commonly used methods from `SimpleJdbcTemplate` were brought to `JdbcTemplate`
score: 1
comment on: http://stackoverflow.com/a/24154001
type: Comment

http://stackoverflow.com/comment/37366224
comment on: http://stackoverflow.com/a/24201955
has text: Yes, or mention the key space in each query. I prefer the latter since maintaining one session across a cluster of servers isn't practical.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24253072
has body: Use the Java Random class. This would give you either 1 or 2: Random rand = new Random(); int n = rand.nextInt(2) + 1; nextInt(n) gives you a random number from 0 to n-1 (inclusive). So you have to add 1 to the result.
score: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24252999
answers question: http://stackoverflow.com/q/24252999
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37370876
comment on: http://stackoverflow.com/q/24204749
type: Comment
score: 0
has text: What XML API are you using?
type: QuestionComment

http://stackoverflow.com/comment/37370269
type: QuestionComment
score: 0
has text: So you want to edit xml instead of build.gradle? So gradle will put this value in your AndroidManifest
type: Comment
comment on: http://stackoverflow.com/q/24202194

http://stackoverflow.com/comment/37434293
score: 1
has text: I'd prefer vars["aggregationX"] = row["Aggregation"]; (but see my answer about naming column bindings).
comment on: http://stackoverflow.com/a/24210744
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24159266
tagged with: textview
type: Question
has body: I want customize a string with results that will be written in a TextView but not works. I just want color some part of text using html tags but it's still all text with same color. This is what i wrote so far: @Override public String toString() { return (Html.fromHtml("&lt;font color=\"#e61624\"&gt;"+fromHour+"&lt;/font&gt;")) + " " + from + " / " + toHour + " " + to; } Thanks
has answer: http://stackoverflow.com/a/24159427
accepted answer: http://stackoverflow.com/a/24159334
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24159334
possible better answer: http://stackoverflow.com/a/24159662
has comment: http://stackoverflow.com/comment/37284797
has comment: http://stackoverflow.com/comment/37285229
has answer: http://stackoverflow.com/a/24159662
has title: HTML in Android seems not working
type: AnsweredQuestion
score: 0
answer count: 3
tagged with: java

http://stackoverflow.com/q/24170393
has answer: http://stackoverflow.com/a/37522425
accepted answer: http://stackoverflow.com/a/24171341
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/24171341
answer count: 3
score: 1
tagged with: java
downvote count: 0
has body: I am using Java6,Apache Tomcat and Jersey RESTful. While unmarshelling the XML to JAXB, I am getting the following exception.Can any body help me on this ? Note: This Exception is inconsistent. java.lang.NoClassDefFoundError: org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl$Parser at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.&lt;init&gt;(Unknown Source) at org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(Unknown Source) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.parse(RuntimeBuiltinLeafInfoImpl.java:543) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.parse(RuntimeBuiltinLeafInfoImpl.java:517) at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:241) at com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:61) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:462) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:367) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:245) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:214) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:358) at com.sun.xml.bind.v2.runtime.BridgeImpl.unmarshal(BridgeImpl.java:120) at com.sun.xml.bind.api.Bridge.unmarshal(Bridge.java:233) at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.readRequest(EndpointArgumentsBuilder.java:517) at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$Composite.readRequest(EndpointArgumentsBuilder.java:188) at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:243) at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.jav…
upvote count: 1
tagged with: jaxb
favorite count: 0
has title: NoClassDefFoundError for XMLGregorianCalendar in Java
type: Question
type: AnsweredQuestion
tagged with: rest
has answer: http://stackoverflow.com/a/35423738
possible better answer: http://stackoverflow.com/a/37522425

http://stackoverflow.com/a/24115578
has comment: http://stackoverflow.com/comment/37203573
answers question: http://stackoverflow.com/q/24115015
score: 0
has body: The URL is lacking the protocol part. Try http://devcare.dyndns.info:85/WCFServices/UserAuthServices.svc/Login otherwise devcare.dyndns.info will be mistaken as the protocol.
type: Answer

http://stackoverflow.com/q/24148128
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24148160
answer count: 3
has body: I have inherited a code base. The code is loading a file called "my.properties". That file is being loaded via the following code: public SomeConstructor(String filePath) { FileInputStream stream = new FileInputStream("my.properties"); ... } The code works. My problem is, the code I inherited has "my.properties" files all over the place (I'm talking 50 places). So I can't figure out which "my.properties" is actually being loaded. How can I print out the full path of the file loaded into the FileInputStream?
has answer: http://stackoverflow.com/a/24148289
tagged with: java
has comment: http://stackoverflow.com/comment/37264431
has comment: http://stackoverflow.com/comment/37264434
accepted answer: http://stackoverflow.com/a/24148160
type: Question
possible better answer: http://stackoverflow.com/a/24148233
has title: Determine File Path in Java
has answer: http://stackoverflow.com/a/24148233

http://stackoverflow.com/q/24150314
has body: I'm making an API call that returns JSON which has a particular field which either returns false or a map depending on content. It's a field that I don't care about. I expected GSON to ignore this particular field, though it doesn't seem to be. The object generation fails with the following message: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 403560 I've seen this particular question (Gson deserialize json with varying value types). I want to make sure I need to make a custom deserializer before doing so. I'm wondering if I may have another issue. edit: Example: "anonymous_flag": { } vs "anonymous_flag": "yes" Another Edit: I actually had the field in my model object... I was referencing the wrong class. Judge away :)
tagged with: android
has comment: http://stackoverflow.com/comment/37270333
linked to: http://stackoverflow.com/q/24125695
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24150688
linked to: http://stackoverflow.com/q/16992891
has title: Should GSON ignore varying types if they're not used in a class?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
answer count: 1
has comment: http://stackoverflow.com/comment/37268931
type: Question
has answer: http://stackoverflow.com/a/24150688

http://stackoverflow.com/q/24239473
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/24239869
has answer: http://stackoverflow.com/a/24239869
type: Question
has body: Hi I am a beginner to android application. I was writing a code for calculator using some tutorials.But the application wouldn't run and kept saying the application has stopped unexpectedly. I have attached my codes. Could somebody find out the error. My MainActivity.java package com.example.mycalc; import android.support.v7.app.ActionBarActivity; 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.TextView; public class MainActivity extends ActionBarActivity { TextView disp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); disp=(TextView)findViewById(R.id.textView1); disp.setText("0"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } MY manifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mycalc" android:versionCode="1" android:versionName="1.0" &…
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/37437789
has comment: http://stackoverflow.com/comment/37437346
has comment: http://stackoverflow.com/comment/37437386
accepted answer: http://stackoverflow.com/a/24239824
has comment: http://stackoverflow.com/comment/37437760
has answer: http://stackoverflow.com/a/24239824
type: AnsweredQuestion
score: 0
tagged with: java
has title: Android developer application says application stopped unexpectedly
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37437232

http://stackoverflow.com/q/24252520
has answer: http://stackoverflow.com/a/24971219
type: Question
tagged with: jlist
tagged with: java
has comment: http://stackoverflow.com/comment/37471331
accepted answer: http://stackoverflow.com/a/24257237
has comment: http://stackoverflow.com/comment/37466674
has title: Create an Interactable JList
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24257237
score: 2
has comment: http://stackoverflow.com/comment/37470126
answer count: 2
has body: As many might know, components in a JList are not interactable (you can't interact with them) and they are just like snapshots from the component's appearance. I'm working on a simple application and JList is what I want, except that the components in the list should be interactable. So far I've created this, by implementing a simple AbstractListModel, and ListCellRenderer: Each component in the JList is a JPanel, which as you can see contains other components like JProgressBar, JLable and JButton. The only problem is that the buttons (and all other components) are not interactable. How can I fix this ? NOTE: I don't want a single column JTable!
has comment: http://stackoverflow.com/comment/37466647
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/37463107
favorite count: 0
possible better answer: http://stackoverflow.com/a/24971219

http://stackoverflow.com/comment/37405575
type: AnswerComment
has text: You're looking to be efficient. A protocol decreases the time it takes to write code at the cost of efficiency and flexibility to handle different use cases. In particular the common protocols like HTTP and FTP are really only good for transfering files- it's what they were made for. They're horrible for bidirectional communication.
type: Comment
comment on: http://stackoverflow.com/a/24222021
score: 0

http://stackoverflow.com/a/24107574
has body: Why do you have your own fragment for this, when you could be using the PreferenceFragment which was designed for this purpose? (or PreferenceActivity under API Level 11) It does what you are doing automatically. Check out this link for more info: http://android-er.blogspot.hu/2012/07/example-of-using-preferencefragment.html
has comment: http://stackoverflow.com/comment/37189303
has comment: http://stackoverflow.com/comment/37189089
type: Answer
answers question: http://stackoverflow.com/q/24107552
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/37391741
type: AnswerComment
comment on: http://stackoverflow.com/a/24214465
type: Comment
has text: Heh, good point. More details here: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Touchpad.html
score: 0

http://stackoverflow.com/comment/37333310
comment on: http://stackoverflow.com/q/24185350
score: 0
has text: i dont understand how to generate an array out of what ever this code does.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37365869
score: 0
comment on: http://stackoverflow.com/q/24197201
type: QuestionComment
type: Comment
has text: By the way.... This *will* return an SSL context (and not a TLS exclusive context): `SSLContext.getInstance("TLS")`. There's hardening that should be applied to it, too - both protocol hardening and cipher suite hardening. For example, SSLv3 will be enabled, and TLS 1.1 and 1.2 will be disabled. See, for example, [Which Cipher Suites to enable for SSL Socket?](https://stackoverflow.com/questions/1037590/which-cipher-suites-to-enable-for-ssl-socket).

http://stackoverflow.com/a/24420430
has comment: http://stackoverflow.com/comment/125749449
answers question: http://stackoverflow.com/q/24247357
score: 3
has body: As to what's wrong with it: looking at the POM file, commons-beanutils-1.9.2 depends on commons-collections-3.2.1. The problem is that common-beanutils references classes that are no longer available in commons-collections-4.4.0.
type: Answer
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24247357
downvote count: 0

http://stackoverflow.com/comment/37386919
type: Comment
score: 0
has text: *the hashmap is empty to begin with though* can't see it, where is it though?
type: QuestionComment
comment on: http://stackoverflow.com/q/24212717

http://stackoverflow.com/a/24307431
has body: What you want cannot be done this way because, as the error message says, the annotation binding is inconsistent: You cannot bind all three annotations at the same time because they are in (possibly mutually exclusive) OR parts of the pointcut, i.e. usually only of of them can be bound (unless you assign multiple annotations to the same method). Your expectation might be that AspectJ can deal with this inconsistency by just assigning null to the other two if one is bound, but this is not how the compiler works right now. I can offer a workaround which involves reflection instead of using the @annotation() binding. Driver application: package de.scrum_master.app; import org.jbehave.core.annotations.Given; import org.jbehave.core.annotations.Then; import org.jbehave.core.annotations.When; public class Application { public static void main(String[] args) { doGiven("foo"); doSomething("bar"); doWhen(11); doSomethingElse(22); doThen(); } @Given("an input value") public static void doGiven(String string) {} @When("I do something") public static void doWhen(int i) {} @Then("I should obtain a result") public static boolean doThen() { return true; } public static void doSomething(String string) {} public static void doSomethingElse(int i) {} } Aspect: package de.scrum_master.aspect; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; @Aspect public class JBehaveInterceptor { @Pointcut("execution(@org.jbehave.core.annotations.* * *(..))") public void jBehavePointcut() {} @Before("jBehavePointcut()") public void jBehaveAdvice(JoinPoint.StaticPart thisJoinPointStaticPart) { Method method = ((MethodSignature) thisJoinPointStaticPart.getSignature()).getMethod(); for (Annotation jBehaveAnnotation : method.getAnnotations()) { if (jBehaveAnnotation.an…
type: Answer
answers question: http://stackoverflow.com/q/24127169
upvote count: 6
score: 5
downvote count: 1

http://stackoverflow.com/q/24135633
has answer: http://stackoverflow.com/a/24152430
favorite count: 0
has answer: http://stackoverflow.com/a/24136053
type: Question
has answer: http://stackoverflow.com/a/24136027
has title: JavaEE: Web Service Deployed Successfully but Tester is not Working
tagged with: ejb
downvote count: 0
tagged with: java-ee-7
tagged with: web-services
type: AnsweredQuestion
score: 3
answer count: 3
upvote count: 3
tagged with: java
has body: I am a student &amp; totally new in JavaEE development. I created an independent EJB Project and created Web services in it. I am consuming that service in a Java Web Application project using the Web Service WSDL. When I deployed the EJB project, I got something like this. i.e. deployed successsfully. Info: file:/media/benison/EXTRA/8th Sem Java Project/Projects/BusinessFacade/build/classes/_BusinessFacadePU logout successful Info: visiting unvisited references Info: visiting unvisited references Info: Entity.YearSemesterStudent actually got transformed Info: Entity.YearSemesterStudentPK actually got transformed Info: Entity.YearSemester actually got transformed Info: Entity.Student actually got transformed Info: Entity.CollegeCategory actually got transformed Info: Entity.Faculty actually got transformed Info: Entity.StudentMark actually got transformed Info: Entity.Exam actually got transformed Info: Entity.Setting actually got transformed Info: Entity.College actually got transformed Info: Entity.Subject actually got transformed Info: Entity.Contact actually got transformed Info: Entity.UserGroup actually got transformed Info: Entity.SubjectTeachingFaculty actually got transformed Info: Entity.SubjectTeachingFacultyPK actually got transformed Info: Entity.TeachingFaculty actually got transformed Info: Entity.DepartmentCourse actually got transformed Info: Entity.Event actually got transformed Info: Entity.News actually got transformed Info: Entity.Department actually got transformed Info: Entity.Employee actually got transformed Info: Entity.Course actually got transformed Info: Entity.UserType actually got transformed Info: Entity.User actually got transformed Info: EclipseLink, version: Eclipse Persistence Services - 2.5.0.v20130507-3faac2b Info: file:/media/benison/EXTRA/8th Sem Java Project/Projects/BusinessFacade/build/classes/_BusinessFacadePU login successful Warning: Container org.glassfish.webservices.JAXWSContainer@63cb3e9d doesn't support class com.su…
linked to: http://stackoverflow.com/q/23011547
accepted answer: http://stackoverflow.com/a/24152430
possible better answer: http://stackoverflow.com/a/24136027

http://stackoverflow.com/q/24215218
has answer: http://stackoverflow.com/a/24253271
tagged with: hadoop
downvote count: 2
has body: I have R and Hive on the same hostname, and I am trying to connect the two, so I can access Hive tables directly from R. While I have been able to do so (using RHive), I am unable to connect with RJDBC. I have two issues here, solving any of the two for now, would work with me. Issue1## Connection established between R and hive using RHIVE. I ran a simple query, rhive.query("CREATE TABLE test AS SELECT * FROM table_name WHERE column1='ABC'") This created the required table in the required database and run time wasn't much test123&lt;-rhive.query("SELECT * FROM table_name WHERE column1='ABC'") If I try to save the result in a temp object, test123, this query takes exceptionally long. How do I resolve this and why would there be so much difference? For example, test123 takes 30+ mins and still doesn't complete, whereas the table "temp" takes &lt; 1 minute Issue 2## I am unable to establish R and hive connection, using below. require(RJDBC) cp &lt;- c(list.files("/location/lib/hadoop/lib", pattern = "[.]jar", full.names=TRUE, recursive=TRUE), list.files("/location/lib/hive/lib", pattern = "[.]jar", full.names=TRUE, recursive=TRUE), recursive=TRUE)) drv &lt;- JDBC(driverClass = "org.apache.hadoop.hive.jdbc.HiveDriver", classPath = cp) hiveconnection &lt;- dbConnect(drv,"jdbc:hive://hostname.com:10000/default", "username", "password") Note: the jar files are the same, RHive or RJDBC, however, I get the below warning and Putty hangs post that. When using RHive, I get the same warning, but it goes further to establish the connection. SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CDH-4.6.0-1.cdh4.6.0.p0.26/lib/hadoop/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CDH-4.6.0-1.cdh4.6.0.p0.26/lib/hive/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an e…
upvote count: 1
score: -1
tagged with: hive
has comment: http://stackoverflow.com/comment/37395639
has title: R and Hive Connection -RJDBC + RHive
tagged with: http://stackoverflow.com/tag/r
type: AnsweredQuestion
tagged with: java
answer count: 1
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/24253271
favorite count: 0
type: Question

http://stackoverflow.com/comment/37400882
has text: Also make sure you are not confusing your fragment xml with your activity xml.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24220200

http://stackoverflow.com/q/24158235
tagged with: spring
type: AnsweredQuestion
score: 0
tagged with: job-scheduling
has answer: http://stackoverflow.com/a/24162969
tagged with: java
answer count: 1
tagged with: quartz-scheduler
type: Question
tagged with: scheduling
accepted answer: http://stackoverflow.com/a/24162969
has body: in execute internal method i am getting the Object but after its execution is completed Class level variable again become NULL ? Why? public class CampaignJob extends QuartzJobBean { Scheduler scheduler ; JobExecutionContext jobExecutionContext ; @Override protected void executeInternal(JobExecutionContext jobCtx) throws JobExecutionException { // TODO Auto-generated method stub System.out.println("ExecuteInternal method is called....."); SchedulerContext schedCtx = null; // jobCtx.getTrigger().getFinalFireTime().setSeconds(0); jobCtx.getTrigger().setStartTime(new Date()); try { schedCtx = jobCtx.getScheduler().getContext(); ApplicationContext appCtx = (ApplicationContext) schedCtx.get("applicationContext"); //here i am getting scheduler obj i want ot use in other method scheduler = jobCtx.getScheduler(); jobExecutionContext = jobCtx; } catch (SchedulerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
has title: quartz how can i change scope of JobExecutionContext & Scheduler to class level?

http://stackoverflow.com/q/24188963
tagged with: java
tagged with: multithreading
tagged with: process
answer count: 1
tagged with: publish
type: Question
tagged with: swingworker
has answer: http://stackoverflow.com/a/24189482
accepted answer: http://stackoverflow.com/a/24189482
has title: SwingWorker: process() method is not being called
has body: I have a SwingWorker thread which I'm using to update a UI JLabel, and aside from the the publish()/process() methods, the program works (in that the JLabel is successfully posted with the appropriate text/background/border etc.). However, I want to use a process() method to set the text of the JLabel to "Connecting..." while the doInBackground() does its work, but the process() method in my program is never called (I am obviously using the publish() method). Suggestions? Here's the SwingWorker: public class PcclientBackgroundWork extends SwingWorker &lt; String, String&gt; { public JLabel connectionStatus2; String msg; /* Constructor */ public PcclientBackgroundWork(JLabel label){ connectionStatus2 = label; } /*Background work to determine Application connection status and pass corresponding message (String msg) to done() */ @Override public String doInBackground() throws Exception { String serverName = "localhost"; //UDP is sent within same machine int port = 6789; try { Socket client = new Socket(serverName, port); BufferedReader in = new BufferedReader (new InputStreamReader(client.getInputStream())); while(!in.ready()){ publish("Connecting"); //Want this method called until the bufferedReader is ready. } //Loops until ready msg = in.readLine(); //Incoming text is only one line if(msg.equals("Connection Unsuccessful")) { msg = "Application Connection Failed"; } else { msg = "App Connected " + msg; } System.out.println("msg = " + msg); in.close(); //Close reader client.close(); //Close client socket } catch (IOException e) { e.printStackTrace(); msg = "Application Connection Failed"; //JLabel text set the same as } //if connection is unsuccessful (lines 66-68) return msg; } public void process(String msg){ System.out.println("process method called..."); connectionStatus2.setText(msg); } /*Method to set JLabel information when doInBackground() is complete */ @Override public void done() { try { connectionStatus2.setText(get()); //get() is the return value of doInB…
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/24238388
has body: try this code public static void triangle(int n){ for (int i=n;i&gt;0;i--){//number of lines for(int j=i-1;j&gt;0;j--){ System.out.print(" "); } for(int k=n;k&gt;=i;k--){ //use k&gt;=i System.out.print("*"); } System.out.print("\n"); }
answers question: http://stackoverflow.com/q/24227899
type: Answer
score: 0

http://stackoverflow.com/a/24137617
answers question: http://stackoverflow.com/q/24137389
score: 0
accepted answer of: http://stackoverflow.com/q/24137389
type: Answer
has body: I assume it is because the JLabel passed in DrawFrame is passed by reference (as it is an object) and statusLabel in DrawPanel is referring to testLabel and so both objects are referring to the same location in memory and are not separate objects, i.e. updating the text on statusLabel also updates the text on testLabel. Would that be correct? More or less, yes... Think of it this way, testLabel is a name to a point in memory, but only within the context where it was created (the constructor of the DrawFrame). But, what you do, is pass that address to the DrawPane and you give it the name statusLabel, both testLabel and statusLabel now refer to the same place in memory (or the object at that memory location). I could confuse you more and let you know that all object variables in Java are pointers, but unlike C/C++, you simply can manipulate the pointer (only the content it points to) ;)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37248419

http://stackoverflow.com/comment/37307103
score: 1
has text: You can use StringBuilder
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24170640

http://stackoverflow.com/comment/37311692
has text: This would also terminate if `ss.available() == 0` even if `gps.location.isValid()` is still `false`.
type: Comment
comment on: http://stackoverflow.com/a/24173135
type: AnswerComment
score: 1

http://stackoverflow.com/a/24225388
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24224687
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24224687
has body: Louis Wasserman's comment is the correct diagnosis. The number of calls to the random number generator strongly affects the performance, so short-circuiting is important. I modified the program to count the numbers of calls using a couple of methods like this: private static boolean normalCountedRandom() { normalCount++; return rng.nextBoolean(); } I also did multiple measurements in each run to eliminate any issue of start-up effects. A typical output was: Bitwise operator: 1985 Normal operator: 1560 Bitwise operator: 1967 Normal operator: 1547 Bitwise operator: 2046 Normal operator: 1557 Bitwise operator: 2009 Normal operator: 1553 Bitwise Random calls: 800006428 Normal Random calls: 600030931 The 4:3 ratio is as expected. Each if does one compulsory call. If using a short circuit operator, only half of those will result in a second call, for an expected 1.5 calls per if, compared to 2 per if without the short-circuit. This ratio is similar to the performance ratio, assuming the calls account for most, but not all, of the time. The short-circuit behavior is documented in the JLS. Technically, when applied to boolean operands, &amp; and | are Boolean Logical Operators. The "normal" operators are Conditional-And and Conditional-Or Operators. It is generally better to avoid having the number of iterations depend on a Random result, although in this case, with enough iterations, the variance between runs is small.

http://stackoverflow.com/q/24133000
tagged with: android
has answer: http://stackoverflow.com/a/24133100
accepted answer: http://stackoverflow.com/a/24133100
type: AnsweredQuestion
has body: I am playing with Android and RSS and in the part of the XML parser we have the DefaultHandler with its methods: public void startElement(String uri, String localName, String qName, Attributes atts) public void endElement(String uri, String localName, String qName) And the characters. Now I went through the documentation, but it doesn't really gives a deep insight, how are the method being exactly executed, also how are those arguments localName , qName, etc being exactly passed? I see in the code examples they just initialize the class, but where they put the variables. Also how do we defined the which elements to look for in the startElement method, like Title , Description etc, I see different examples looking for different strings, does this mean that we have to have a beforehand look at the XML from the URL, or is there a firm standard for the tags used.
downvote count: 0
has title: How does DefaultHandler work?
score: 1
upvote count: 1
tagged with: java
answer count: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/24159023
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37299025
answer count: 1
tagged with: javabeans
has answer: http://stackoverflow.com/a/24159208
accepted answer: http://stackoverflow.com/a/24159208
favorite count: 0
type: Question
has title: parse JavaBeans sources to json descriptor
linked to: http://stackoverflow.com/q/17783909
tagged with: javascript
has comment: http://stackoverflow.com/comment/37286694
type: AnsweredQuestion
has body: I'm looking for a tool or a way to analyze standard JavaBeans source code (with getters and setters) and generate some sort of json descriptors.. maybe with grunt or ant or whatever. example: FilterBean.java: package com.abc.beans; import java.io.Serializable; import java.util.List; import java.util.Map; public class FilterBean implements Serializable { private static final long serialVersionUID = 7490361447912259765L; private Map&lt;String, List&lt;LabelValueBean&gt;&gt; filterMapList; private String name; public Map&lt;String, List&lt;LabelValueBean&gt;&gt; getFilterMapList() { return this.filterMapList; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } } LabelValueBean.java: package com.abc.beans; import java.io.Serializable; import java.util.List; public class LabelValueBean implements Serializable { private static final long serialVersionUID = 1237198378921379812L; private String label; private Integer id; private List&lt;String&gt; values; public String getLabel() { return this.label; } public void setLabel(String label) { this.label = label; } public Integer getId() { return this.idlabel; } public List&lt;String&gt; getValues() { return this.values; } public void setValues(List&lt;String&gt; values) { this.values = values; } } outputs something like: com.abc.beans.FilterBean.json: { "name" : { "type" : "String", "setter" : true }, "filterMapList" : { "type" : "Map", "innerType" : "com.abc.beans.LabelValueBean", "setter" : false } } com.abc.beans.LabelValueBean.json: { "label" : { "type" : "String", "setter" : true }, "values" : { "type" : "Array", "innerType" : "String", "setter" : true }, "id" : { "type" : "Integer", "setter" : false } } any idea ?
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/24115136
type: Answer
has comment: http://stackoverflow.com/comment/37202613
answers question: http://stackoverflow.com/q/24115064
has body: Your main method belongs to OuterClass and is static in there. Since InnerClass is not a static class but implicitly depends on the generic type T (the generic type is available in the inner class, even if your example isn't using it), you cannot reference it from a static method. In other words, since InnerClass depends on the generic type, you cannot break it "lose" from OuterClass and use it outside of it. If your inner class won't depend on the generic type, you can just make it static. However, you might want to consider just extracting it into a separate class rather than nesting classes in this case: class OuterClass&lt;T&gt; { static class InnerClass { int k; } public static void main( String argv[] ) { InnerClass inner = new InnerClass(); } } If the generic is important for the inner class, you can tell the compiler which generic to infer for the outer class by specifying it (note that the generic type of outer and inner must match) or by using OuterClass.InnerClass in which case the compiler will use the raw type: class OuterClass&lt;T&gt; { class InnerClass { int k; } public static void main( String argv[] ) { OuterClass&lt;String&gt; outer = new OuterClass&lt;String&gt;(); // works and has the "correct" generic type OuterClass&lt;String&gt;.InnerClass inner1 = outer.new InnerClass(); // works, but uses the raw type OuterClass.InnerClass inner2 = outer.new InnerClass(); } } Note that you need an enclosing instance outer of type OuterClass&lt;T&gt; in order to instantiate InnerClass (since the class is not static, it belongs to an instance of OuterClass). This also goes for the example without generics: you will need an enclosing instance to instantiate the inner class, so class OuterClass { class InnerClass { int k; } public static void main( String argv[] ) { OuterClass outer = new OuterClass(); InnerClass in = outer.new InnerClass(); } } will work while class OuterClass { class InnerClass { int k; } public static void main( String argv[] ) { OuterClass …
has comment: http://stackoverflow.com/comment/37202788
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37203011

soa
type: Tag
tags question: http://stackoverflow.com/q/24165917
tags question: http://stackoverflow.com/q/24129457
tag name: soa

http://stackoverflow.com/q/24152533
has comment: http://stackoverflow.com/comment/37276896
has answer: http://stackoverflow.com/a/24152675
has comment: http://stackoverflow.com/comment/37296056
accepted answer: http://stackoverflow.com/a/24152675
favorite count: 0
type: Question
has title: Is there a way to avoid "java.lang.OutOfMemoryError: Java heap space" when reading large file attachments in lotus notes documents?
has answer: http://stackoverflow.com/a/24152609
tagged with: lotus-notes
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37276909
has comment: http://stackoverflow.com/comment/37276951
has comment: http://stackoverflow.com/comment/37295544
downvote count: 0
has answer: http://stackoverflow.com/a/24155963
possible better answer: http://stackoverflow.com/a/24155963
has comment: http://stackoverflow.com/comment/37273210
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37273098
has body: I made a java agent that generates an xml code containing texts per slide from powerpoint files attached in lotus notes documents. However, when it tries a 66 MB attachment the error is thrown. Here's the full code in the agent import java.io.*; import org.apache.poi.hslf.HSLFSlideShow; import org.apache.poi.hslf.model.Slide; import org.apache.poi.hslf.model.TextRun; import org.apache.poi.hslf.usermodel.SlideShow; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.xslf.usermodel.XMLSlideShow; import org.apache.poi.xslf.usermodel.XSLFShape; import org.apache.poi.xslf.usermodel.XSLFSlide; import org.apache.poi.xslf.usermodel.XSLFTextParagraph; import org.apache.poi.xslf.usermodel.XSLFTextShape; import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { System.out.println("Start"); try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); Database db = agentContext.getCurrentDatabase(); Document profdoc = db.getProfileDocument("f.SomeProfileDoc", ""); String siteurl = profdoc.getItemValueString("SomeField"); //System.out.println(siteurl); //ArrayList listFilenames = new ArrayList(); //int indexnum = 0; String extension = ""; String buildXMLStr = ""; InputStream fis = null; POIFSFileSystem fs = null; while (doc != null) { RichTextItem body = (RichTextItem)doc.getFirstItem("Attachments"); if(body != null) { RichTextNavigator rtnav = body.createNavigator(); String filename = ""; if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_FILEATTACHMENT)) { buildXMLStr = " "; do { EmbeddedObject att = (EmbeddedObject) rtnav.getElement(); filename = att.getSource(); int z = filename.lastIndexOf('.'); if (z > 0) { extension = filename.substring(z+1); } if(extension.equalsIgnoreCase("ppt") || extension.equalsIgnoreCase("pptx")) { buildXMLStr += "\n "; buildXMLStr += " " + extension+ " "; bu…
has answer: http://stackoverflow.com/a/24182261

http://stackoverflow.com/q/24199947
has body: I have started working on Fragments for its advantages.But always i get a NullPointer exception at fragmentManager. MainFragment.Java public class MainFragment extends Activity { Context mContext; public static FragmentManager fManager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(); } private void initialize() { mContext = getApplicationContext(); fManager = getFragmentManager (); } public static void startFragment(Fragment fragment, boolean isToBackStack) { /* * Restricting Fragment transition if same fragment available in top of * BackStack. * * If tempFragment is Null it means there is no fragment was added yet. */ Fragment tempFragment = fManager.findFragmentById(R.id.container); if (tempFragment != null &amp;&amp; tempFragment.getClass().getName().equals(fragment.getClass().getName())) { return; } /* * Actual transition of Fragment */ FragmentTransaction fragt = fManager.beginTransaction(); fragt.setCustomAnimations(android.R.anim.slide_out_right,android.R.anim.slide_in_left); fragt.replace(R.id.container, fragment); // hide background fragment fragt.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); if (isToBackStack) fragt.addToBackStack(fragment.getClass().getName()); fragt.commit(); } } MainActivity.Java public class MainActivity extends Activity { private FrameLayout container; private TextView headerid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate (savedInstanceState); setContentView (R.layout.main); initialize (); MainFragment.startFragment (new PersonalInfo (),true); } private void initialize() { container = (FrameLayout) findViewById (R.id.container); headerid = (TextView) findViewById (R.id.header_id); } } Logcat 06-13 12:52:30.112 31338-31338/com.jobs_on_call_fragments E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jobs_on_call_fragments/com.jobs_on_call_fragments.MainActivity}: java.la…
has title: Always getting Null Pointer at fragmentManager
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/24200098
type: AnsweredQuestion
tagged with: nullpointerexception
downvote count: 0
tagged with: android-fragments
upvote count: 1
score: 1
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24200098

http://stackoverflow.com/q/24200472
tagged with: excel
has comment: http://stackoverflow.com/comment/37363672
type: Question
has comment: http://stackoverflow.com/comment/37364337
has title: Updated excel file still returns old values
tagged with: java
accepted answer: http://stackoverflow.com/a/24200816
tagged with: jxl
has answer: http://stackoverflow.com/a/24200816
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/5937373
has body: My java code is reading an excel file by using jxl library. It first copies the original excel file to create temp.xls. While creating that file it changes some values, and it successfully creates the temp.xls with the formula. Original file: A 1 Y 3 (has formula: A+B) B 2 Copied File: A 5 Y 13 (has formula: A+B) B 8 However, even the copied file changes, the code still gives "3" as an output instead of "13". How can I make it give the correct output? import java.io.File; import java.io.IOException; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import jxl.write.*; import jxl.write.Number; import jxl.write.biff.RowsExceededException; public class Reader { public static void excelWriting() { try { Workbook workbook = Workbook.getWorkbook(new File( "D:\\parser\\calc.xls")); WritableWorkbook copy = Workbook.createWorkbook(new File( "D:\\parser\\temp.xls"), workbook); WritableSheet tempSheet = copy.getSheet(0); Number num1 = new Number(1, 2, 5); Number num2 = new Number(1, 3, 8); tempSheet.addCell(num1); tempSheet.addCell(num2); copy.write(); copy.setProtected(false); copy.close(); workbook.close(); } catch (BiffException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RowsExceededException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (WriteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] args) { excelWriting(); int value = 0; try { Workbook wrk1 = Workbook.getWorkbook(new File( "D:\\parser\\temp.xls")); // Obtain the reference to the first sheet in the workbook Sheet sheet1 = wrk1.getSheet(0); Cell cell = sheet1.getCell(4, 2); value = Integer.parseInt(cell.getContents()); } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println(value); } } in excelWriting() method num1 indicates "A"…
answer count: 1

http://stackoverflow.com/q/24110190
tagged with: image
accepted answer: http://stackoverflow.com/a/24110790
score: -1
has title: GUI not updating the image on every click because new image of graph take time in generating every new image, so GUI show the previous image
possible better answer: http://stackoverflow.com/a/24110574
has answer: http://stackoverflow.com/a/24110790
type: AnsweredQuestion
has body: i am having problem in displaying the current on the GUI, i am using Swing Worker which is not working according to my requirements. kindly someone help me to update image on every click while image generation take time because image is generated through graph viz. i am struck in my project ...enter code here private static void show1(){ SwingWorker&lt;Void,Void&gt; worker1= new SwingWorker&lt;Void,Void&gt;(){ @Override protected Void doInBackground() throws Exception { Thread.sleep(100); gp.GraphPanel();// here in graph panel image is not updated return null; } protected void done() { } }; worker1.execute(); } // show1 is called inside action listener public static JScrollPane GraphPanel() { // some code here ImageIcon imgIcon=new ImageIcon(FILE_NAME.filename+".png"); label.setIcon( imgIcon); pane2.add(label); JScrollPane grphPane= new JScrollPane(pane2); return grphPane; }
upvote count: 0
tagged with: java
answer count: 2
tagged with: swing
downvote count: 1
favorite count: 0
tagged with: graph
type: Question
tagged with: swingworker
has answer: http://stackoverflow.com/a/24110574

http://stackoverflow.com/comment/37204308
has text: With Log4j, I think you would need to write a custom appender to do this. But really don't think this is a good idea. Tracking problems across method call sequences involving multiple classes could be exceedingly awkward.
comment on: http://stackoverflow.com/q/24114788
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37398338
comment on: http://stackoverflow.com/a/24218736
type: Comment
type: AnswerComment
has text: something like https://stackoverflow.com/questions/13632442/how-to-organize-rmi-client-server-architecture ?
score: 0

http://stackoverflow.com/comment/37269644
type: Comment
comment on: http://stackoverflow.com/a/24132733
type: AnswerComment
has text: Thanks for all the comments guys! While I did learn a lot about arrays and lists thanks to all of your help, I found out the easiest thing to do is just make variables for A, B, C, etc (For the grades) and use them each as a counter
score: 0

http://stackoverflow.com/comment/37238133
comment on: http://stackoverflow.com/q/24133037
type: Comment
type: QuestionComment
has text: You don't appear to check that your blocks don't split words in half. From my experience the bottleneck for large files is the speed you can read them from disk, not CPU. If you make the code efficient enough, one thread will do the job. Note: if you always read from file cache, e.g. repeatedly, the disk speed doesn't matter.
score: 1

http://stackoverflow.com/comment/37357639
has text: This looks like Java code. Why did you tag it with c# as well?
score: 0
comment on: http://stackoverflow.com/q/24197744
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37185328
type: QuestionComment
comment on: http://stackoverflow.com/q/24105858
score: 3
has text: Why are your `if` and `else if` conditions identical? How will control ever reach the `else if` clause?
type: Comment

http://stackoverflow.com/q/24138026
type: Question
type: UnansweredQuestion
tagged with: jsp
has comment: http://stackoverflow.com/comment/37245250
tagged with: servlets
has comment: http://stackoverflow.com/comment/37245322
score: 0
has answer: http://stackoverflow.com/a/24138354
answer count: 2
has body: I want to pass two values to a servlet from a jsp page. 1- a result set value, 2- a get parameter value. It should look something like this in jsp page: SCcalculator.getValue(rs.getString("value1"),request.getParameter("value1")); on the servlet side how can i receive and manipulate this data in the SCcalculator package? any suggestions please?
tagged with: java
has comment: http://stackoverflow.com/comment/37245537
has title: Pass GET parameter and resultset to a servlet in Java
has answer: http://stackoverflow.com/a/24138244

http://stackoverflow.com/q/24248449
type: Question
tagged with: cdi
accepted answer: http://stackoverflow.com/a/24248518
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/24248518
has title: CDI order of injecting and constructor
has body: Simple question, but I can't solve it. As I know fields are initialized first and after that constructor is called. The following code public class Controller { @Inject private ReadCommand readCommand; public Controller() { if (readCommand==null){ System.out.println("NO"); }else{ System.out.println("YES"); } } } prints NO. But when I inject in constructor @Inject public Controller(ReadCommand readCommand) It prints YES. What am I doing wrong?
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/37263861
score: 0
comment on: http://stackoverflow.com/q/24145989
has text: I found this great article dealing with the issue: http://www.javacodegeeks.com/2011/12/spring-pitfalls-transactional-tests.html
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24122646
upvote count: 1
tagged with: tomcat
favorite count: 0
type: Question
has title: The web application not starting on tomcat when ehcache was upgraded from 1.5.0 to 2.8.3
score: 1
tagged with: java
tagged with: jdbc
type: AnsweredQuestion
tagged with: ehcache
has body: After upgraded the ehCache from version 1.5.0 to version 2.8.3 using Tomcat 7 the web application is not starting anymore and getting the following server logs error: SEVERE: Exception starting filter SimplePageCachingFilter java.lang.ClassNotFoundException: net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter The SimplePageCachingFilter is used in web.xml: SimplePageCachingFilter net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter But could not found an alternative of SimplePageCachingFilter in ehCache 2.8.x Would appreciate any idea to solve this issue.
accepted answer: http://stackoverflow.com/a/24136206
has answer: http://stackoverflow.com/a/24136206
downvote count: 0
answer count: 1

http://stackoverflow.com/q/24184422
type: UnansweredQuestion
score: 0
has body: I am working on an application in which I am using Tesseract for OCR. My code is working absolutely fine in windows 32 bit system. But when I try to run the same code in 64 bit machine using the 32 bit .dll files, the code is running but then the code is not giving the accurate results. So I am running it in 64 bit machine using the 64 bit .dll files. Now when I tried to run the same program, I got the following error in Console(Eclipse Kepler). Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: %1 is not a valid Win32 application. at com.sun.jna.Native.open(Native Method) at com.sun.jna.Native.open(Native.java:1759) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) at com.sun.jna.Library$Handler.&lt;init&gt;(Library.java:147) at com.sun.jna.Native.loadLibrary(Native.java:412) at com.sun.jna.Native.loadLibrary(Native.java:391) at net.sourceforge.tess4j.TessAPI.&lt;clinit&gt;(TessAPI.java:38) at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:293) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:227) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:176) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:159) I have downloaded the 64 bit .dll files (https://github.com/charlesw/tesseract/tree/master/src/lib/TesseractOcr/x64) compatible with 64 bit system but still i am getting the same error. I am using GhostScript v-8.71 on 64 bit machine. I have installed this in both Program Files and Program Files(x86). I have also set the environment variables accordingly.But still not working. Please please provide me with some solution!
has title: Tesseract OCR not working for 64 bit machine
has comment: http://stackoverflow.com/comment/37476174
tagged with: tesseract
tagged with: 32bit-64bit
has comment: http://stackoverflow.com/comment/37355006
has comment: http://stackoverflow.com/comment/37420884
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26497337
has comment: http://stackoverflow.com/comment/37371637
type: Question
has comment: http://stackoverflow.com/comment/37356436

http://stackoverflow.com/q/24116518
type: AnsweredQuestion
tagged with: java
downvote count: 0
score: 1
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24116606
type: Question
tagged with: ide
has body: Is there any Java IDE that allows me see the bytecode, what is going on the stack when i keep stepping into? Something similar what i've seen in visual (disassembly, memory, registers).
accepted answer: http://stackoverflow.com/a/24116606
has title: Advanced Java IDE Advice

http://stackoverflow.com/comment/37204695
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24111137
score: 1
has text: Why do you assume that all objects of type X are in the same Entity Group? They aren't, as that other post says. Either way the restriction is in the datastore itself, not in JPA or the JPA implementation - use that datastore and you have to work around such things

http://stackoverflow.com/q/24143330
tagged with: web-services
score: 0
has body: We have multiple web applications for different functional areas. There is no overlap of functionality between these apps and hence they are fairly independent. All these apps generate content like PDF and XML data. Currently all these apps are storing these documents in a path relative to their web root. The documents are accessed using url relative to the app specific web root. Now we want to move to a design where these apps store the data/files in one central location and these documents can be accessed thru a URL outside of the specific application web root. Also we want these documents to be available even if the specific application is down. We experimented with Apache Jackrabbit etc, but most of these are CMS tools that provide a lot more than what we want. We don't need full CMC capabilities since we don't really intend to do any web publishing, editing etc. We just need a simple way for multiple apps to store files in one single location and later access them thru a URL. Some thing probably like cloud storage. Are there any tools out there that could help us implement this? Or Design pattern? We need beans from multiple apps to be able to save files in one central location (we can't use fixed disk drive location) common url based access to these resources We use: Java web apps on Tomcat 7 using JSF/Myfaces
has answer: http://stackoverflow.com/a/24143468
has title: Document storage strategy for Java web apps
tagged with: java
answer count: 1
tagged with: web-applications
type: Question
type: UnansweredQuestion
tagged with: cloud
tagged with: tomcat7

http://stackoverflow.com/comment/37237688
comment on: http://stackoverflow.com/a/24132726
type: AnswerComment
score: 0
has text: Hey I accepted your and others answers also @Lavekush Agrawal
type: Comment

http://stackoverflow.com/a/24176149
type: Answer
type: AcceptedAnswer
downvote count: 0
score: 23
has comment: http://stackoverflow.com/comment/93453010
accepted answer of: http://stackoverflow.com/q/24160064
has comment: http://stackoverflow.com/comment/100097028
upvote count: 23
has body: Give annotation to amount field of Item class as follows class Item { @Digits(integer = 6, fraction = 2, message = "{javax.validation.constraints.Digits.message}") private BigDecimal amount; } In the above class integer and fraction are compulsory and message is optional parameter to @Digit and there we can configure custom error message. Now, we create a properties file with name ValidationMessages.properties in source directory. It will look like something.. javax.validation.constraints.Digits.message = "custom error message will be here"
answers question: http://stackoverflow.com/q/24160064

http://stackoverflow.com/comment/37486394
comment on: http://stackoverflow.com/a/24182271
type: Comment
type: AnswerComment
score: 0
has text: Thank you for your replies! I have already noticed the unique constraint but It seems to be slow and it takes the whole memory available. Right now I am trying to set relationships directly during the import process using import-cypher shell command. This command is mutch slower but it takes 1GB of ram at most and it is more versatile, there is a way to speedup this command?

hibernate
tags question: http://stackoverflow.com/q/24116962
tags question: http://stackoverflow.com/q/24259172
tags question: http://stackoverflow.com/q/24132167
tags question: http://stackoverflow.com/q/24210092
tags question: http://stackoverflow.com/q/24228783
tags question: http://stackoverflow.com/q/24233904
tags question: http://stackoverflow.com/q/24262707
tags question: http://stackoverflow.com/q/24257105
tags question: http://stackoverflow.com/q/24134658
tags question: http://stackoverflow.com/q/24190125
tags question: http://stackoverflow.com/q/24222814
tags question: http://stackoverflow.com/q/24190421
tags question: http://stackoverflow.com/q/24229260
tags question: http://stackoverflow.com/q/24163381
tags question: http://stackoverflow.com/q/24229529
tags question: http://stackoverflow.com/q/24119581
tags question: http://stackoverflow.com/q/24185466
tags question: http://stackoverflow.com/q/24197429
tags question: http://stackoverflow.com/q/24109509
tags question: http://stackoverflow.com/q/24175194
tags question: http://stackoverflow.com/q/24166292
tags question: http://stackoverflow.com/q/24256338
tags question: http://stackoverflow.com/q/24264268
tags question: http://stackoverflow.com/q/24254061
type: Tag
tags question: http://stackoverflow.com/q/24135352
tags question: http://stackoverflow.com/q/24201289
tags question: http://stackoverflow.com/q/24155264
tags question: http://stackoverflow.com/q/24141930
tags question: http://stackoverflow.com/q/24129016
tags question: http://stackoverflow.com/q/24108380
tags question: http://stackoverflow.com/q/24210887
tags question: http://stackoverflow.com/q/24238377
tags question: http://stackoverflow.com/q/24211115
tags question: http://stackoverflow.com/q/24196595
tags question: http://stackoverflow.com/q/24209175
tags question: http://stackoverflow.com/q/24250383
tags question: http://stackoverflow.com/q/24247884
tags question: http://stackoverflow.com/q/24246571
tags question: http://stackoverflow.com/q/24212625
tags question: http://stackoverflow.com/q/24177578
tags question: http://stackoverflow.com/q/24134080
tags question: http://stackoverflow.com/q/24237276
tags question: http://stackoverflow.com/q/24165112
tags question: http://stackoverflow.com/q/24167996
tags question: http://stackoverflow.com/q/24108442
tags question: http://stackoverflow.com/q/24135509
tags question: http://stackoverflow.com/q/24157571
tags question: http://stackoverflow.com/q/24106296
tags question: http://stackoverflow.com/q/24177680
tags question: http://stackoverflow.com/q/24184992
tags question: http://stackoverflow.com/q/24115722
tags question: http://stackoverflow.com/q/24200905
tags question: http://stackoverflow.com/q/24196239
tags question: http://stackoverflow.com/q/24256291
tags question: http://stackoverflow.com/q/24156130
tags question: http://stackoverflow.com/q/24244913
tags question: http://stackoverflow.com/q/24182516
tags question: http://stackoverflow.com/q/24222718
tags question: http://stackoverflow.com/q/24163226
tags question: http://stackoverflow.com/q/24195035
tags question: http://stackoverflow.com/q/24150255
tags question: http://stackoverflow.com/q/24125786
tags question: http://stackoverflow.com/q/24178570
tags question: http://stackoverflow.com/q/24164798
tags question: http://stackoverflow.com/q/24198672
tags question: http://stackoverflow.com/q/24125283
tags question: http://stackoverflow.com/q/24160026
tags question: http://stackoverflow.com/q/24138947
tags question: http://stackoverflow.com/q/24229225
tags question: http://stackoverflow.com/q/24121390
tags question: http://stackoverflow.com/q/24221836
tags question: http://stackoverflow.com/q/24147552
tags question: http://stackoverflow.com/q/24188462
tags question: http://stackoverflow.com/q/24164666
tags question: http://stackoverflow.com/q/24116561
tags question: http://stackoverflow.com/q/24137067
tags question: http://stackoverflow.com/q/24160433
tags question: http://stackoverflow.com/q/24180898
tags question: http://stackoverflow.com/q/24200123

sensors
type: Tag
tags question: http://stackoverflow.com/q/24236406
tags question: http://stackoverflow.com/q/24237705
tag name: sensors

http://stackoverflow.com/comment/37458056
score: 0
type: QuestionComment
has text: I want a program to suggest me some possibilities to fix bugs. At the moment eclipse quick fix can do. But, I am not sure if I can call that in an ordinary java application.
type: Comment
comment on: http://stackoverflow.com/q/24248523

http://stackoverflow.com/q/24187215
tagged with: java
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24187962
type: Question
possible better answer: http://stackoverflow.com/a/24195588
has answer: http://stackoverflow.com/a/24187962
tagged with: vector
upvote count: 2
has answer: http://stackoverflow.com/a/24195588
tagged with: scala
has body: I'm using mahout math vector (org.apache.mahout.math.Vector) and want to convert it into an array. Looking on the documentation I didn't find a function to convert with. What is the simplest way to convert it (using scala)?
tagged with: mahout
tagged with: arrays
score: 2
has title: scala - convert mahout vector to array
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/comment/37272081
score: 0
type: Comment
type: QuestionComment
has text: @RodAlgonquin There is no way in TCP to send and receive a single packet of data. It is a byte stream. You have to add metadata of your own.
comment on: http://stackoverflow.com/q/24150559

http://stackoverflow.com/q/24199292
tagged with: jakarta-mail
has body: i'm new to JavaMail API, i struggled to enable port 25 in windows 7, but still it works only after installing hmailserver, i uninstalled hmailserver now and i'm trying to trigger a mail using JavaMail API but it could not connect smtp port 25. My question is 1. does javamail need email server running to trigger emails 2. cant i run smtp server in localhost 3. can java mail be used as smtp server?
tagged with: java
answer count: 1
tagged with: email
has title: Do javamail need email server running to send and recieve mails?
has answer: http://stackoverflow.com/a/24212672
tagged with: smtp
type: Question
type: UnansweredQuestion
tagged with: email-client
score: 0

http://stackoverflow.com/comment/37371846
type: AnswerComment
score: 1
has text: You should add more detail to the question, you haven't mentioned this.
comment on: http://stackoverflow.com/a/24205148
type: Comment

http://stackoverflow.com/comment/37452868
type: QuestionComment
has text: I have replaced `==` with `equals()` but still it is not sorting.
comment on: http://stackoverflow.com/q/24247341
type: Comment
score: 0

http://stackoverflow.com/q/24130803
tagged with: java
answer count: 1
tagged with: multipartform-data
has comment: http://stackoverflow.com/comment/37247466
has body: I am essentially asking the exact same question here. As you can see, there are no solid answers. All I want to do is send a file using HTTPUnit to test a java servlet. So, I have a Java Servlet with this code (dumbed down): @WebServlet("/properties/StorePropertyAttachment") @MultipartConfig public class StorePropertyAttachment { @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ final Part p = req.getPart("propertyImage"); .... } } Here is the important part of my test case: ServletRunner servletRunner = new ServletRunner(); servletRunner.registerServlet("StorePropertyAttachment", StorePropertyAttachment.class.getName()); WebRequest webRequest = new PostMethodWebRequest(WEB_REQUEST_BASE_URL + STORE_PROPERTIES_ENDPOINT); UploadFileSpec spec = new UploadFileSpec(new File("C:/test.jpg"), "multipart/form-data"); webRequest.setParameter("propertyImage", new UploadFileSpec[] {spec}); ^^^^^ line 68 ^^^^^ ServletUnitClient servletClient = servletRunner.newClient(); WebResponse webResponse = servletClient.getResponse(webRequest); When I run this, I get this error: com.meterware.httpunit.IllegalNonFileParameterException: Parameter 'propertyImage' is not a file parameter and may not be set to a file value. at com.meterware.httpunit.WebRequest.setParameter(WebRequest.java:232) at com.amsgeo.mspworkmanager.services.properties.PropertyAttachmentTest.test(PropertyAttachmentTest.java:68) .... Just for kick, if I change line 68 to this (a normal parameter): webRequest.setParameter("propertyImage", "some string"); I get this error (from within my servlet my the way): java.lang.AbstractMethodError: com.meterware.servletunit.ServletUnitHttpRequest.getPart(Ljava/lang/String;)Ljavax/servlet/http/Part; at com.amsgeo.mspworkmanager.services.properties.StorePropertyAttachment.doPost(StorePropertyAttachment.java:40) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at com.amsgeo.webapi.services.ServiceStub.servi…
has title: How to send Multipart request with Httpunit in Java
tagged with: servlets
favorite count: 0
type: Question
upvote count: 5
score: 5
linked to: http://stackoverflow.com/q/10685883
tagged with: http-unit
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24131388
accepted answer: http://stackoverflow.com/a/24131388
downvote count: 0

jmockit
type: Tag
tag name: jmockit
tags question: http://stackoverflow.com/q/24235452
tags question: http://stackoverflow.com/q/24155856
tags question: http://stackoverflow.com/q/24261169
tags question: http://stackoverflow.com/q/24234332
tags question: http://stackoverflow.com/q/24113807
tags question: http://stackoverflow.com/q/24112799

http://stackoverflow.com/q/24165128
has comment: http://stackoverflow.com/comment/37295966
accepted answer: http://stackoverflow.com/a/24165262
score: 1
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/24165332
has answer: http://stackoverflow.com/a/24165262
has body: my data from my custom class isn't showing. I get my JSON object from php script and I store it in String result, then I try to insert it to my custom class Planets from that class I call specific variable by get Method but it doesn't show in my TextView result_tv here is code: String jsonString = result; Gson gson = new Gson(); Planets seznamPlanet = gson.fromJson(jsonString, Planets.class); this.result_tv.setText(seznamPlanet.getPlanetName()); //this.result_tv.setText(jsonString); this works my class is: public class Planets { public String name; public Integer size; public Integer o2; public Integer atmosphere; public String getPlanetName() { return name; } public Integer getPlanetSize() { return size; } public Integer getPlanetO2() { return o2; } public Integer getPlanetAtmosphere() { return atmosphere; } } and JSON object inside result string looks like this: {"Planets":[{"name":"Earth","size":"3","o2":"1","atmosphere":"1"},{"name":"Mars","size":"8","o2":"0","atmosphere":"0"}]}
has title: parsing JSONObject to custom class
has answer: http://stackoverflow.com/a/24165332
favorite count: 0
type: Question
answer count: 2
downvote count: 0
upvote count: 1
tagged with: string
tagged with: php
type: AnsweredQuestion

http://stackoverflow.com/comment/37485066
score: 0
has text: The failure still consists. Also simpler `@NamedQuery(name = "testUnusedVerses", query= "SELECT r.usedVerses FROM Receiver r WHERE r = :_receiver")` code returns same error.
type: Comment
comment on: http://stackoverflow.com/a/24264544
type: AnswerComment

http://stackoverflow.com/comment/37217280
has text: with either what ? Its not clear at all what your current error is an what java code caused it.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24122134

http://stackoverflow.com/a/24175103
has comment: http://stackoverflow.com/comment/37315195
answers question: http://stackoverflow.com/q/24175077
has body: "Java" is really just a programming language, and it's very unlikely that any "threats" actually exist in a the language itself. The Java vulnerabilities we hear about are usually in the Java VM, the software that executes the compiled Java bytecode. Java code written for Android apps on the other hand compiles to Dalvik bytecode, and thus is run by a Dalvik VM. So any vulnerabilities found in the Java VM wouldn't necessarily affect the Android Dalvik VM. But it could of course have vulnerabilities of its own.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37315228
accepted answer of: http://stackoverflow.com/q/24175077
type: AcceptedAnswer
score: 6
upvote count: 6

http://stackoverflow.com/comment/37476731
comment on: http://stackoverflow.com/q/24241177
type: QuestionComment
has text: in server.xml it should be Context instead of context and put inside the Host element. Also, you should not define your contexts in server.xml, they belong in /conf/Catalina/localhost/<warname>.xml.
score: 1
type: Comment

http://stackoverflow.com/q/24107418
has comment: http://stackoverflow.com/comment/37188029
tagged with: listview
has answer: http://stackoverflow.com/a/24107882
tagged with: java
tagged with: baseadapter
downvote count: 0
has body: I have a custom adapter that extends the baseadapter. It has a variety of different layouts some with thumbnails some without. When I add a new item that is the same type as the one before the row displays the same values. But when I check what is set in the holder it tells me that the correct items are set. public View getView(int position, View convertView, ViewGroup parent) { int layoutType = getItemViewType(position); ListViewRow item = null; if(convertView == null) { item = atIndex(position); holder = new ViewHolder(); convertView = getConvertView(layoutType, parent);//ViewHolder items declared here convertView.setTag(-1, holder); } else if(!viewMatchesType(layoutType, convertView.getId())){ item = atIndex(position); holder = new ViewHolder(); convertView = getConvertView(layoutType, parent);//ViewHolder items declared here convertView.setTag(-1, holder); } else { holder = (ViewHolder) convertView.getTag(-1); item = atIndex(position); } setDisplay(item, convertView);//I set values here if(holder.tv_name.getText() != item.getName()) { notifyDataSetInvalidated(); } return convertView; } //For performance, ui elements are saved in a holder private static class ViewHolder { public ImageView iv_thumbnail; public TextView tv_name; }
score: 1
upvote count: 1
answer count: 1
favorite count: 0
has title: ListView displays different items than what is in the holder
type: Question
tagged with: imageview
tagged with: android
has comment: http://stackoverflow.com/comment/37188130
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37188188

http://stackoverflow.com/q/24107552
type: Question
has answer: http://stackoverflow.com/a/24107574
tagged with: preferences
type: UnansweredQuestion
tagged with: android
tagged with: checkbox
tagged with: fragment
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37188251
answer count: 1
has body: I have a fragment with 29 Checkboxes, and I want to save the preferences of those (if they're selected or not), so that when I reopen the app the checkboxes are selected or not (depending on the previous use) I've implemented the sharedPreferences but it still won't save them. When I reopen the app (or when I change fragment and return), the checkboxes previously checked are unchecked (like reset). I'm kind of new to android programming, so please excuse my noobyness. This is my fragment.java public class PresencasFragment extends Fragment implements OnClickListener { CheckBox aula1; (...) CheckBox aula29; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_presencas, container, false); aula1 = (CheckBox) rootView.findViewById(R.id.aula1); (...) aula29 = (CheckBox) rootView.findViewById(R.id.aula29); loadSavedPreferences(); return rootView; } private void loadSavedPreferences() { // TODO Auto-generated method stub SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); boolean aula1Val = sharedPreferences.getBoolean("CheckBox_Value1", false); (...) boolean aula29Val = sharedPreferences.getBoolean("CheckBox_Value29", false); if (aula1Val){ aula1.setChecked(true);} else{ aula1.setChecked(false);} (...) if (aula29Val){ aula29.setChecked(true);} else{ aula29.setChecked(false);} } private void savePreferences(String key, boolean value){ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(key, value); editor.commit(); } @Override public void onClick(View v) { // TODO Auto-generated method stub if(aula1.isChecked()) savePreferences("CheckBox_Value1",aula1.isChecked()); (...) if(aula29.isChecked()) savePreferences("CheckBox_Value29",aula29.isChecked()); } So, what am I doing wrong?
has title: Save Preferences in Fragment

http://stackoverflow.com/q/24152543
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24152627
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24152627
tagged with: regex
type: Question
upvote count: 2
has title: Reported bug with Regular Expression \Q \E in Java 4 & 5
answer count: 1
downvote count: 1
favorite count: 0
has body: Quoting from here: Java 4 and 5 have bugs that cause \Q…\E to misbehave, however, so you shouldn't use this syntax with Java. I've made a program which splits Strings up based on given operators, and so I have this as part of my code: Pattern.quote( operator ) This program isn't working quite as expected, as it seems its splitting Strings wrong (with the above line being the split's parameter). When I do this: System.out.println( "Operator:" + Pattern.quote( operator ) ); The result is: Operator:\Q==\E This isn't a major issue and I'm still not sure that this line is causing issues. Hence this questions focus is on what the bug mentioned in the Regex is, not what the bug in my program is. So: what is the bug they mention? I've been unable to find any documentation on such a bug, and hence while we're on Java 8 I'm unsure if this bug has been fixed (I would assume it has been, but I'm still interested none-the-less).

http://stackoverflow.com/a/24201888
type: Answer
answers question: http://stackoverflow.com/q/24184746
score: 0
has comment: http://stackoverflow.com/comment/37372248
has comment: http://stackoverflow.com/comment/71544200
has comment: http://stackoverflow.com/comment/37383396
has body: I think the syntax is hadoop jar your.jar com.your.main.Class -Dfs.s3n.awsAccessKeyId=&lt;access-id&gt; -Dfs.s3n.awsSecretAccessKey=&lt;secrect-key&gt; Then the path to the common prefix you wish to read should be of the form s3n://bucket-name/common/prefix/path

http://stackoverflow.com/a/24122532
answers question: http://stackoverflow.com/q/24122365
type: Answer
has body: go after first method, create your public static instances of class, make your class final so it cant be extended, and make constructor private, so it cannot be instantiate outside of your class flaw with second method is, your static method myName each time creates new instance of Name which is unnecessary
score: 0

http://stackoverflow.com/comment/37424863
type: AnswerComment
score: 0
has text: Yes, that may resolve the issue. You could try Oracle's as well.
comment on: http://stackoverflow.com/a/24210335
type: Comment

http://stackoverflow.com/a/24228061
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37441151
has comment: http://stackoverflow.com/comment/37442094
upvote count: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37441208
answers question: http://stackoverflow.com/q/24203642
has body: Let's make sense of those statuses first. For each and every license, there are only two statuses: Approved or not (it's a checkbox, true or false). Out of this simple boolean value, Artifactory calculate a state of an artifact: Unknown - the found license doesn't match any of license types known to Artifactory Unapproved - we found one or more licenses, all of them are of unapproved type Not Found - there is no information about the license in pom.xml (ivy.xml) Neutral - we found multiple licenses, some of them are approved, others are not Approved - we found one or more licenses, all of them are of approved type Currently the list of triggers for the email notification is hard-coded to Unknown and Unproved. You're more than welcome to open a feature request to make it customizable (I can imagine a list of checkboxes for selecting/deselecting every one of the states)
score: 2
accepted answer of: http://stackoverflow.com/q/24203642

http://stackoverflow.com/comment/37415189
has text: i guess not. what you can atleast do is create a helper class with the hashmap impl in it and go to each class manually and change it.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24228001
type: Comment

http://stackoverflow.com/comment/37246333
has text: Line number 98 is: musicSrv.setSong(Integer.parseInt(view.getTag().toString()));
type: QuestionComment
comment on: http://stackoverflow.com/q/24138664
score: 0
type: Comment

http://stackoverflow.com/q/24163997
has comment: http://stackoverflow.com/comment/37293992
upvote count: 0
tagged with: java
tagged with: graph-algorithm
answer count: 1
downvote count: 3
has comment: http://stackoverflow.com/comment/37294816
has title: Depth First Search problems
favorite count: 0
type: Question
tagged with: algorithm
type: UnansweredQuestion
has body: http://usacotraining.blogspot.com/2013/10/problem-142-clocks.html I am attempting to use Depth First Search to solve this problem. I created a Node class based on a 3x3 array, and am using a visited array of size 4^9. However, this clearly is not working at all (it is not printing anything). My attempts of debugging (see comments) showed me that for some reason the array seems to be resetting each time, but I cannot figure out why. Also, I am sure that my code is unnecessarily complicated, and there is a better way to perform DFS like this. Can someone show me a better way? /* ID: akshajk1 LANG: JAVA TASK: clocks */ import java.util.*; import java.io.*; import java.lang.*; import java.math.*; class clocks { public static boolean[] visited; public static boolean done; public static String[] moves = {"ABDE", "ABC", "BCEF", "ADG", "BDEFH", "CFI", "DEGH", "GHI", "EFHI"}; public static Stack&lt;Integer&gt; ans = new Stack&lt;Integer&gt;(); public static Stack&lt;Integer&gt; finalans = new Stack&lt;Integer&gt;(); public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); // BufferedReader bf = new BufferedReader(new FileReader("clocks.in")); // PrintWriter out = new PrintWriter(new FileWriter("clocks.out")); // int n = Integer.parseInt(bf.readLine()); int[][] a = new int[3][3]; for(int i=0; i&lt;3; i++) { StringTokenizer st = new StringTokenizer(bf.readLine()); for(int j=0; j&lt;3; j++) a[i][j] = Integer.parseInt(st.nextToken()); } visited = new boolean[4*4*4*4*4*4*4*4*4]; Node x = new Node(a); dfs(x); for(int i : finalans) out.println(i + " "); out.close(); System.exit(0); } public static void dfs(Node a) { if(done) return; int n = 0; for(int i=0; i&lt;3; i++) for(int j=0; j&lt;3; j++) n = 4*n+a.get(i, j); if(visited[n]) return; // for(int i=0; i&lt;3; i++) { for(int j=0; j&lt;3; j++) System.out.print(a.get(i, j)); System.out.pri…
has answer: http://stackoverflow.com/a/24164760
score: -3
has comment: http://stackoverflow.com/comment/37295374

http://stackoverflow.com/comment/37250280
score: 0
type: Comment
type: QuestionComment
has text: There might be some support for the major tools (Spring for example) but all config/XML files have different format and semantics, it wouldn't be feasable to do a generic solution for that. There might be some plugins though that may help you with textual search & matching for example, but I'm not aware of such a tool.
comment on: http://stackoverflow.com/q/24140120

http://stackoverflow.com/q/24124091
answer count: 1
upvote count: 8
favorite count: 0
has body: I need to send encrypted data from a Java client to a C# server. Right now I'm learning how to encrypt data using AES (requirement). Following this accepted answer Image encryption/decryption using AES256 symmetric block ciphers I'm doing the following: byte[] keyStart = "qweroiwejrwoejlsifeoisrn".getBytes(); // Random character string byte[] toEncrypt = myMessageString.getBytes(); keyGen = KeyGenerator.getInstance("AES"); sr = SecureRandom.getInstance("SHA1PRNG"); sr.setSeed(keyStart); keyGen.init(128, sr); SecretKey secretKey = keyGen.generateKey(); byte[] secretKeyByte = secretKey.getEncoded(); SecretKeySpec skeySpec = new SecretKeySpec(secretKeyByte, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); cipher.doFinal(toEncrypt); Since the algorithm uses a SecureRandom using the keyStart I am not sure if this can be decoded in C# or even in another Java program, without the SecureRandom. Will this encryption/decryption work with just knowing the value of keyStart or since I'm using SecureRandom I still need to pass something else in order to decrypt? Also, is there a better way to do it or is this one just fine?
type: Question
has title: Better way to create AES keys than seeding SecureRandom
tagged with: c#
linked to: http://stackoverflow.com/q/6788018
tagged with: java
tagged with: cryptography
linked to: http://stackoverflow.com/q/2375541
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24125677
accepted answer: http://stackoverflow.com/a/24125677
downvote count: 0
tagged with: encryption

http://stackoverflow.com/a/24234925
answers question: http://stackoverflow.com/q/24234586
has comment: http://stackoverflow.com/comment/37428825
has comment: http://stackoverflow.com/comment/37428615
has comment: http://stackoverflow.com/comment/37428844
downvote count: 0
has comment: http://stackoverflow.com/comment/37428921
upvote count: 1
has body: I cleared up all the panels, leaving only the bottom panel for the purpose of demonstration. In the BottomPanel, I fixed all the public strings into public JButton. As Pat pointed out, that exitbtn should belong to something, and I made it belong to BottomPanel. You do not really need to implement interface ActionListener in JFrame. Here's the code for StudentGUI import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JOptionPane; public class StudentGUI extends JFrame { private static final long serialVersionUID = 1L; public StudentGUI() { super("StudentGUI Frame"); Dimension d = new Dimension(800,600); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800,600); setBackground(Color.PINK); this.setVisible(true); //BottomPanel BottomPanel bp; bp=new BottomPanel(); this.add (bp, BorderLayout.SOUTH); bp.exitBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e){ int selectedOption = JOptionPane.showConfirmDialog(null, "Do you want to close the window?", "Choose", JOptionPane.YES_NO_OPTION); if (selectedOption == JOptionPane.YES_OPTION) System.exit(1); return; } }); } public static void main(String[] args) { new StudentGUI(); } } And here is the code for BottomPanel: import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.*; public class BottomPanel extends JPanel { public JButton findbtn; public JButton insertBtn; public JButton updateBtn; public JButton deleteBtn; public JButton exitBtn; public BottomPanel() { findbtn=new JButton("Find"); add(findbtn); insertBtn=new JButton("Insert"); add(insertBtn); updateBtn=new JButton("Update"); add(updateBtn); deleteBtn=new JButton("Delete"); add(deleteBtn); exitBtn=new JButton("Exit"); add(exitBtn); } } This is DEFINITELY not the best practice, but at least it works.
has comment: http://stackoverflow.com/comment/37428593
score: 1
type: Answer

http://stackoverflow.com/comment/37459989
type: Comment
has text: Ok... can you buffer 10 values and call addPoint 10 times in succession? Also chk if loop is bottleneck or drawing. ATB
type: AnswerComment
comment on: http://stackoverflow.com/a/24250721
score: 0

http://stackoverflow.com/q/24203426
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37369352
accepted answer: http://stackoverflow.com/a/24204397
answer count: 2
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/24204397
has title: How to implement JScrollPane child behavior?
tagged with: java
tagged with: preferredsize
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/37369343
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7229226
has body: It is said in manual, that if child does not implement Scrollable, then JScrollPane rely on preferredSize properties of it's content. Apparently this is not true for me. I am increasing preferred height, but JScrollPane does not feel or react on it. package tests; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.Timer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Try01_JScrollPane extends JFrame { private static final long serialVersionUID = 4123186105171813186L; private static final Logger log = LoggerFactory.getLogger(Try01_JScrollPane.class); JPanel yellowPanel = new JPanel(); { yellowPanel.setPreferredSize(new Dimension(200,50)); yellowPanel.setSize(new Dimension(200,50)); yellowPanel.setBackground(Color.yellow); } JScrollPane scrollPane = new JScrollPane(yellowPanel); { scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); } AbstractAction increaseAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { yellowPanel.setPreferredSize(new Dimension(yellowPanel.getPreferredSize().width, yellowPanel.getPreferredSize().height+100)); log.debug("preferred height is now {}", yellowPanel.getPreferredSize().height); } }; Timer increaseTimer = new Timer(1000, increaseAction); { setLayout(new BorderLayout()); add(scrollPane, BorderLayout.CENTER); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(200, 400); setTitle("Try01_JScrollPane"); increaseTimer.start(); setVisible(true); } public static void main(String[] args) { new Try01_JScrollPane(); } }
score: 5
upvote count: 5
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/24204284
has comment: http://stackoverflow.com/comment/37369302
has comment: http://stackoverflow.com/comment/37369138
has answer: http://stackoverflow.com/a/24204284

http://stackoverflow.com/q/24139352
type: AnsweredQuestion
score: 36
accepted answer: http://stackoverflow.com/a/24176501
tagged with: amazon-s3
has answer: http://stackoverflow.com/a/54991506
tagged with: java
has answer: http://stackoverflow.com/a/24176501
has answer: http://stackoverflow.com/a/71701615
has answer: http://stackoverflow.com/a/53567726
type: Question
has answer: http://stackoverflow.com/a/69445731
upvote count: 36
downvote count: 0
has answer: http://stackoverflow.com/a/62639143
answer count: 7
possible better answer: http://stackoverflow.com/a/24139554
has body: I am trying to access a bucket and all its object using AWS SDK but while running the code i am getting an error as Exception in thread "main" com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: X), S3 Extended Request ID: Y= Kindly suggest, where i am lacking and why access denied error is occurring although i have taken all following permission to the bucket: s3:GetObject s3:GetObjectVersion s3:GetObjectAcl s3:GetBucketAcl s3:GetBucketCORS s3:GetBucketLocation s3:GetBucketLogging s3:ListBucket s3:ListBucketVersions s3:ListBucketMultipartUploads s3:GetObjectTorrent s3:GetObjectVersionAcl Code is as follows: AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.HTTP); AmazonS3 conn = new AmazonS3Client(credentials, clientConfig); conn.setEndpoint(bucketName); Bucket bucket = conn.createBucket(bucketName); ObjectListing objects = conn.listObjects(bucket.getName()); do { for (S3ObjectSummary objectSummary : objects.getObjectSummaries()) { System.out.println(objectSummary.getKey() + "\t" + objectSummary.getSize() + "\t" + StringUtils.fromDate(objectSummary.getLastModified())); } objects = conn.listNextBatchOfObjects(objects); } while (objects.isTruncated());
has title: AWS S3 Java SDK - Access Denied
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/24139554
favorite count: 0

http://stackoverflow.com/comment/104173667
has text: I'm still running out of heap space using Files.copy... is there a way to specify buffersize using this?
type: Comment
comment on: http://stackoverflow.com/a/24245646
type: AnswerComment
score: 1

http://stackoverflow.com/comment/37628225
comment on: http://stackoverflow.com/a/24331458
score: 0
has text: The PAD_ADDED-event actually solved the problem. I needed to link the source to the following element. Thanks for the solution! I might post some code example later.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37262335
score: 0
comment on: http://stackoverflow.com/a/24146692
type: Comment
type: AnswerComment
has text: Okay I was able to convert the keys and values to doubles but I can't get add the values, I don't know but its not finding the duplicates and adding the values. All it prints is 0. You can see the updated code in the question.

http://stackoverflow.com/comment/37302104
comment on: http://stackoverflow.com/q/24167677
type: Comment
score: 0
has text: I can't get past a NullPointerException on the `caller = new RCaller()` line.
type: QuestionComment

http://stackoverflow.com/a/24191088
score: 10
upvote count: 10
type: Answer
answers question: http://stackoverflow.com/q/24191040
downvote count: 0
has body: use a regex. This one only matches if it starts with, contains, and ends with only letters and spaces. ^[ A-Za-z]+$ In Java, initialize this as a pattern and check if it matches your strings. Pattern p = Pattern.compile("^[ A-Za-z]+$"); Matcher m = p.matcher("aaaaab"); boolean b = m.matches();
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24191040

http://stackoverflow.com/comment/37401502
score: 0
comment on: http://stackoverflow.com/a/24220448
type: Comment
has text: Of course not, as they will be directly asked from client browser. HTML, CSS, or images must be out of WEB-INF for the controller to serve them directly. But jsp are source elements (they will be translated to HTML) and should be hidden and accessed only via forward from a servlet.
type: AnswerComment

http://stackoverflow.com/comment/37445335
has text: The way your code is it's assuming the file is in the same directory as the executable. And even then you definitely want to grab the 'AbsolutePath' just as good practice
comment on: http://stackoverflow.com/q/24243599
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37434533
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24237222
has text: Thanks Jens.. Hope You are getting me. Kindly provide some code snippets for this. because I'm new to maven versions. It helps more when you back with some code.
type: Comment

http://stackoverflow.com/a/24106867
type: AcceptedAnswer
has body: I have found the solution, apparently my debug senses managed to get me in the right direction. So apparently reading the data with br = new BufferedReader(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream("res/xml/levels.xml"))); was a Terrible idea. The solution was to put the XML files into the /res/raw folder, and open them as raw resource. public LevelManager(Context context) { Serializer serializer = new Persister(); Levels levels = null; BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(context.getResources().openRawResource(R.raw.levels))); levels = serializer.read(Levels.class, br); } catch (Exception e) { Log.e(getClass().getSimpleName(), "Error in deserialization.", e); throw new RuntimeException(e); } finally { if (br != null) { IOUtils.closeQuietly(br); } } This way, the content of the file was properly read. I hope this will help someone in the future, and hopefully not just clogging up SO with a question I resolved after 20 minutes :D EDIT: Also, I needed to add @Root public class Levels { @ElementList(type=Level.class, inline=true) private List&lt;Level&gt; levels; public Levels() { } public Levels(@ElementList(name = "levels", type=Level.class, inline=true) List&lt;Level&gt; levels) { this.levels = levels; } public List&lt;Level&gt; getLevels() { return levels; } public void setLevels(List&lt;Level&gt; levels) { this.levels = levels; } } inline=true because otherwise it couldn't find the data according to my XML structure. But that wasn't really related to the issue.
type: Answer
answers question: http://stackoverflow.com/q/24106734
score: 0
accepted answer of: http://stackoverflow.com/q/24106734

http://stackoverflow.com/a/24134496
has body: Reverse Engineering the schema to get JPA entities is a process that you do one time, during development, and it's a process that doesn't need to be 100% automated unless you expect rapid schema changes that you are expected to follow. Just do it once and keep track of them by hand.
has comment: http://stackoverflow.com/comment/37309853
answers question: http://stackoverflow.com/q/24133803
type: Answer
score: 0

http://stackoverflow.com/a/39024337
score: 8
has body: I have found this Spring extension: https://github.com/foo4u/spring-mvc-cache-control. You just have to do three steps. Step 1 (pom.xml): net.rossillo.mvc.cache spring-mvc-cache-control 1.1.1-RELEASE compile Step 2 (WebMvcConfiguration.java): @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new CacheControlHandlerInterceptor()); } } Step 3 (Controller): @Controller public class MyRestController { @CacheControl(maxAge=31556926) @RequestMapping(value = "/someUrl", method = RequestMethod.GET) public @ResponseBody ResponseEntity<String> myMethod( HttpServletResponse httpResponse) throws SQLException { return new ResponseEntity<String>("{}", HttpStatus.OK); } }
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/24164014
has comment: http://stackoverflow.com/comment/133499199
type: Answer

http://stackoverflow.com/comment/37427286
has text: I understand whats going on somewhat but I just dont know how to apply it to my code.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24232360

http://stackoverflow.com/a/24265383
type: Answer
has comment: http://stackoverflow.com/comment/37486852
score: 0
has body: This is a quite old tutorial, but you don't need to mvn3 just go to the project's folder where the pom.xml resides (in dos) and type: mvn clean install If everything is right it compiles and packages your code that you can find under the target folder
has comment: http://stackoverflow.com/comment/37486762
answers question: http://stackoverflow.com/q/24265288
has comment: http://stackoverflow.com/comment/37486610
has comment: http://stackoverflow.com/comment/37486564

http://stackoverflow.com/a/24226295
score: 0
answers question: http://stackoverflow.com/q/24226090
has body: The quickest thing to do is in your C# code specify the encoding, instead of Encoding.Default.GetString(re) You should be able to use, System.Text.Encoding.GetEncoding(1252).GetString(re) According to the Wikipedia entry on Windows-1252 it is a superset of ISO-8859-1 (the Java default character encoding). You might consider explicitly using UTF-8 on both sides, System.Text.Encoding.UTF8.GetString(re) and in Java, new String("Test String").getBytes("UTF-8")
type: Answer
has comment: http://stackoverflow.com/comment/37412360

http://stackoverflow.com/a/24162963
has comment: http://stackoverflow.com/comment/37291888
type: Answer
has comment: http://stackoverflow.com/comment/37318482
has comment: http://stackoverflow.com/comment/37291975
has comment: http://stackoverflow.com/comment/37292400
downvote count: 0
has body: Try this public class Common_SingleLine_Alert extends Dialog implements View.OnClickListener { Button okBtn; TextView messagetv; String messageStr; public Common_SingleLine_Alert(Context context, Spannable message) { super(context); // TODO Auto-generated constructor stub this.messageStr = message; } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.marker_info_window); okBtn = (Button) findViewById(R.id.okBtn); messagetv = (TextView) findViewById(R.id.address); messagetv.setText(messageStr); okBtn.setOnClickListener(this); } public void onClick(View v) { // TODO Auto-generated method stub dismiss(); } } // the xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/title" android:textColor="@color/white" android:textStyle="bold" /> <TextView android:id="@+id/address" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/relativeLayout1" android:layout_centerHorizontal="true" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="5dp" android:gravity="center_horizontal" android:text="TextView" /> // how to use it dialog = new Common_SingleLine_Alert(this, getResources() .getString(Html.fromHtml("Name"))); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); dialog.setOnDismissListener(new Dialog.OnDismissListener() { public void onDismiss(DialogInterface d) { // TODO Auto-generated method stub } }); dialog.show();
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37293101
has comment: http://stackoverflow.com/comment/37291709
answers question: http://stackoverflow.com/q/24162766
has comment: http://stackoverflow.com/comment/37291459

http://stackoverflow.com/comment/37488400
comment on: http://stackoverflow.com/q/24265298
score: 0
type: QuestionComment
has text: @dARKpRINCE The necessary code is all there. If you need a minimal running example, look at the referenced question.
type: Comment

http://stackoverflow.com/q/24125439
accepted answer: http://stackoverflow.com/a/24125628
answer count: 4
has answer: http://stackoverflow.com/a/24125601
possible better answer: http://stackoverflow.com/a/24125601
score: 1
tagged with: java
has body: I have a repository interface parameterized with stored entities type. Among other methods in it, I have two of interest: the create() method which instantiates an entity, and the save() method that saves the entity: public interface INamedEntityRepository&lt;T extends INamedEntity&gt; { T create(String name); void save(T namedEntity); } ... Next follows a snippet of how this interface is used. I am getting a compilation error saying the type returned from the create() and that passed into save() are incompatible. INamedEntityRepository&lt;? extends INamedEntity&gt; repo = getEntityRepository(); INamedEntity toSave = repo.create("Named"); ... // configure the entity more... repo.save(toSave); ^ The method save(capture#7-of ? extends INamedEntity) in the type INamedEntityRepository&lt;capture#7-of ? extends INamedEntity&gt; is not applicable for the arguments (INamedEntity). I can understand this, because really INamedEntity is not necessarily the expected type. But even doing this repo.save(repo.create("Named"))); won't help: The method save(capture#7-of ? extends INamedEntity) in the type INamedEntityRepository&lt;capture#7-of ? extends INamedEntity&gt; is not applicable for the arguments (capture#8-of ? extends INamedEntity). What's the problem? How to correctly handle this situation? Thanks in advance.
downvote count: 0
has answer: http://stackoverflow.com/a/24126073
upvote count: 1
tagged with: generics
favorite count: 0
type: Question
has title: Java generics: incompatible wildcard capture
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2776975
tagged with: bounded-wildcard
has answer: http://stackoverflow.com/a/24127552
has answer: http://stackoverflow.com/a/24125628

http://stackoverflow.com/comment/37336786
score: 0
comment on: http://stackoverflow.com/a/24177155
type: Comment
has text: Thanks! However, can TabHosts be implemented in Android 2.3 (this is what I am trying to compile in)? Instead is it possible to do this same thing using ActionBarSherlock?
type: AnswerComment

http://stackoverflow.com/q/24152123
has comment: http://stackoverflow.com/comment/37273455
has comment: http://stackoverflow.com/comment/37312865
tagged with: jetty
has comment: http://stackoverflow.com/comment/37314595
has comment: http://stackoverflow.com/comment/37272636
has comment: http://stackoverflow.com/comment/37273987
has body: I recently started to bench my java webserver application and I detected a very weird 500ms network latency on the client side. When I request my webserver for the first time, I get the following timing: $ curl --max-redir 0 -w "%{time_total}\n" http://ip_to_my_domain/abc 0.527 Then all the subsequent calls will take the expected time: $ curl --max-redir 0 -w "%{time_total}\n" http://ip_to_my_domain/abc 0.067 $ curl --max-redir 0 -w "%{time_total}\n" http://ip_to_my_domain/abc 0.062 $ curl --max-redir 0 -w "%{time_total}\n" http://ip_to_my_domain/abc 0.063 After searching on Google and SO, I discovered this post where TCP delayed ACK is mentioned. Here is my own wireshark analysis: Not following redirect (1st call, 500ms): . Larger version Following redirect (1st call, 500ms): Larger version Following redirect (subsequent call, no 500ms): Larger version If this is indeed the the manifestation of the TCP delayed ACK and since I obviously I don't have access to the client OS/browser configuration, what can I do on the server side code or network configuration to avoid that behavior? I have access to the webserver application (running jetty 8.1.1) code and the servers/lb/firewall configurations. Thanks in advance for your help. EDIT: Same behavior on Chrome: And FF: EDIT: More data on the 302 (I selected the wireshark dump where I don't follow redirect): Frame: Eth: IP: TCP: HTTP:
has comment: http://stackoverflow.com/comment/37274359
answer count: 0
downvote count: 0
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/37273496
has comment: http://stackoverflow.com/comment/37272551
has title: 500ms latency on http requests
tagged with: http
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/11711218
has comment: http://stackoverflow.com/comment/37272319
tagged with: network-programming

http://stackoverflow.com/comment/37328926
comment on: http://stackoverflow.com/q/24182550
has text: Yes, it's added to the environment variable Path like this: C:\Program Files (x86)\Ant\bin
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24108164
has body: To answer your question you need to implement both compression and de-compression. The algorithm for compression (thanks @harold for the term "run-length encoding"), would be something like: // for an uncompressed image of height h and width w, stored in int colors[][] for row = 0 to height for column = 0 to width // gets the value value = colors[row][column] // calculates how long the value repeats runLength = 0 nextValue = value i = 0 while(nextValue == value) i++ runLength++ nextValue = colors[row][column + i] // sets the runlength and the value compressedColors[row][column] = runLength compressedColors[row][column + 1] = value // moves to next different value column = column + runLength Then, to decompress, you need to interpret every odd column as a run-length and every even column as a value.
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24107914
type: Answer

http://stackoverflow.com/comment/37320407
has text: Akash-can you check in browser console,if the angular js objects are populated by ng-controller list,before the page is loaded.Try putting a break point,as it seems,the data in object is populated post loading of DOM structure.
type: QuestionComment
comment on: http://stackoverflow.com/q/24135474
type: Comment
score: 0

http://stackoverflow.com/comment/37353141
type: QuestionComment
comment on: http://stackoverflow.com/q/24195179
has text: Ah! So I was writing an absolute directory rather than a relative one. setting `-Durl` to `file://m2-repo` created an `m2-repo` directory which it deployed to.
score: 0
type: Comment

http://stackoverflow.com/q/24199768
tagged with: output
has body: On the output part of my IDE (where all the system.out.println textx appear), I have several lines of text. I want to get them and save them to a text file. What would be the possible code for this?
favorite count: 0
linked to: http://stackoverflow.com/q/18859410
has comment: http://stackoverflow.com/comment/37361554
linked to: http://stackoverflow.com/q/12945537
linked to: http://stackoverflow.com/q/2885173
downvote count: 3
has title: How do you get the text in system.output.println?
has answer: http://stackoverflow.com/a/24199803
tagged with: java
duplicate of: http://stackoverflow.com/q/2885173
has comment: http://stackoverflow.com/comment/37361505
has comment: http://stackoverflow.com/comment/37361587
has comment: http://stackoverflow.com/comment/37361557
type: Question
linked to: http://stackoverflow.com/q/22241024
answer count: 2
upvote count: 1
type: UnansweredQuestion
score: -2
has answer: http://stackoverflow.com/a/24199842

http://stackoverflow.com/a/24279584
accepted answer of: http://stackoverflow.com/q/24229704
score: 1
type: AcceptedAnswer
upvote count: 1
has body: You are missing the ehcache.jar in your setup, or there are several of them, causing the version conflict. You can find the latest ehcache.jar on the Maven repository
answers question: http://stackoverflow.com/q/24229704
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37443911
has text: Yes HomePage extends MainActivity
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24242568
score: 0

http://stackoverflow.com/q/24260528
tagged with: solr-schema
has answer: http://stackoverflow.com/a/24401152
upvote count: 1
tagged with: solr4
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37668487
type: UnansweredQuestion
tagged with: java
has body: I am trying to build a jar for my custom filter in Solr 4.6. I am getting below error on running compile: CustomFilter.java:19: error: package org.apache.lucene.analysis does not exist import org.apache.lucene.analysis.TokenFilter; ^ CustomFilter.java:20: error: package org.apache.lucene.analysis does not exist import org.apache.lucene.analysis.TokenStream; ^ CustomFilter.java:21: error: package org.apache.lucene.analysis.tokenattributes does not exist import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; ^ CustomFilter.java:24: error: package org.apache.solr.util does not exist import org.apache.solr.util.NumberUtils; ^ CustomFilter.java:43: error: cannot find symbol public final class CustomFilter extends TokenFilter { ^ symbol: class TokenFilter CustomFilter.java:46: error: cannot find symbol private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); ^ symbol: class CharTermAttribute location: class CustomFilter CustomFilter.java:47: error: cannot find symbol private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class); I need some help regarding adding this custom filter to my schema. Without building this jar, I am getting below error on my solr admin if i try using the filter in the schema for a field: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Plugin init failure for [schema.xml] fieldType "textCustom": Plugin init failure for [schema.xml] analyzer/filter: Error instantiating class: 'org.apache.solr.analysis.Custom.CustomFilterFactory'. Schema file is /opt/solr5/collection3/schema.xml There are duplicate questions to this but no correct answers. Hence please don't close this question on those basis.
score: 0
has title: Unable to compile custom solr filter classes using javac
tagged with: apache
has comment: http://stackoverflow.com/comment/37640939
answer count: 1

http://stackoverflow.com/comment/37393324
comment on: http://stackoverflow.com/q/24215950
type: QuestionComment
has text: @BrettOkken Currently this is what I do. sql_statement4.setTimestamp(6,new Timestamp(currentDate.getTime()));
score: 0
type: Comment

http://stackoverflow.com/q/24151464
type: Question
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/37285899
has comment: http://stackoverflow.com/comment/37272441
upvote count: 0
type: UnansweredQuestion
tagged with: web-applications
has comment: http://stackoverflow.com/comment/37287637
has comment: http://stackoverflow.com/comment/37271631
has comment: http://stackoverflow.com/comment/37271541
tagged with: tomcat
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37271574
has title: Session timeout works different as i hope
tagged with: jsf
answer count: 3
has answer: http://stackoverflow.com/a/24159579
tagged with: java
has body: I'm trying to configure a session-timeout to my application. In web.xml i configured i minute, like this: 1 To have sure that everything is working i created i listener, see: br.com.sender.util.SessionListener See my listener class: package br.com.sender.util; import java.util.Date; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class SessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent event) { System.out.printf("Session ID %s created at %s%n", event.getSession().getId(), new Date()); } public void sessionDestroyed(HttpSessionEvent event) { System.out.printf("Session ID %s destroyed at %s%n", event.getSession().getId(), new Date()); } } When i login in my application the session is created (in this same moment i store a UserMB with sessionScope), see: Session ID 801040FAFEBC8D21C3C8E0DA56BF9B27 created at Tue Jun 10 18:44:33 BRT 2014 After some minutes without actions the session is destroyed: Session ID 801040FAFEBC8D21C3C8E0DA56BF9B27 destroyed at Tue Jun 10 18:46:26 BRT 2014 When user click in some Menu or Button the session is created again, but i hope that UserMB (SessionScope) is distroyed and user must loggin again, but it's dont happens, user continue using application without re-loggin.
has comment: http://stackoverflow.com/comment/37271143
has comment: http://stackoverflow.com/comment/37271236
score: -1
has answer: http://stackoverflow.com/a/24151533
has answer: http://stackoverflow.com/a/24165213

http://stackoverflow.com/q/24235603
has answer: http://stackoverflow.com/a/24290687
tagged with: java
has comment: http://stackoverflow.com/comment/37472309
has comment: http://stackoverflow.com/comment/37472049
has comment: http://stackoverflow.com/comment/37475942
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/37436989
has title: How to write existing excel (*.xlsx) file on different column using POI in Java?
type: UnansweredQuestion
answer count: 1
has body: Dear all member here!! I got a problem that need to ask your help. I already have an excel file (sample.xlsx). I need to use java code for appending my old data. Here is my specifications: My old data is in column A, 100 rows for example. Need to write other data (50 rows) in different column, column B for example. Appending data is also start from first row as the old data. Is it possible to do that in POI?
type: Question
has comment: http://stackoverflow.com/comment/37471143
has comment: http://stackoverflow.com/comment/37435033
score: 0

http://stackoverflow.com/comment/37232444
has text: @hexafraction I don't :(.
type: AnswerComment
comment on: http://stackoverflow.com/a/24130595
score: 0
type: Comment

http://stackoverflow.com/a/24112348
has body: Not the most efficient solution, but without deviating too much from the original version, this should do what you want: int totalRow = 5; int totalColumn = 20; char[][] myArray = new char[totalRow][totalColumn]; File file = new File("test.txt"); Scanner scanner = new Scanner(file); for (int row = 0; scanner.hasNextLine() &amp;&amp; row &lt; totalRow; row++) { char[] chars = scanner.nextLine().toCharArray(); for (int i = 0; i &lt; totalColumn &amp;&amp; i &lt; chars.length; i++) { myArray[row][i] = chars[i]; } } EDIT: On second thought, if you're confident about the column width, you can further simplify the code: int totalRow = 5; char[][] myArray = new char[totalRow][]; File file = new File("test.txt"); Scanner scanner = new Scanner(file); for (int row = 0; scanner.hasNextLine() &amp;&amp; row &lt; totalRow; row++) { myArray[row] = scanner.nextLine().toCharArray(); }
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24112111
accepted answer of: http://stackoverflow.com/q/24112111

http://stackoverflow.com/a/24131478
type: Answer
downvote count: 0
upvote count: 1
score: 1
has body: If you have a manifest.mf file in Game.jar which points out Main-Class, you can run Game.jar by java -jar Game.jar or double click it on your desktop! Another way to run Game.jar is java -classpath Game.jar Game.Main which does NOT require that the menifest.mf file exists in Game.jar.
answers question: http://stackoverflow.com/q/24131410

http://stackoverflow.com/q/24193354
has title: Converting from Interfaces to Traits
has answer: http://stackoverflow.com/a/24193727
has answer: http://stackoverflow.com/a/24193647
type: AnsweredQuestion
answer count: 2
has body: Here is an example of how I have used Java interfaces to construct a common contract for implementing a piece of functionality : package main.java; public class Main { interface Calculate { public int run(); } private class Calc1 implements Calculate { @Override public int run() { return 1; } } private class Calc2 implements Calculate { @Override public int run() { return 0; } } public static void main(String args[]){ Main m = new Main(); Calculate c = m.new Calc1(); System.out.println(c.run()); c = m.new Calc2(); System.out.println(c.run()); } } Moving to Scala traits here is how I've re-implemented same logic as above : package main.scala object traitsfun { println("Welcome to the Scala worksheet") //&gt; Welcome to the Scala worksheet trait Calc { def run: Int } class Calc1 extends Calc { override def run = 1 } class Calc2 extends Calc { override def run = 0 } val c1 = new Calc1().run //&gt; c1 : Int = 1 val c2 = new Calc2().run //&gt; c2 : Int = 0 } Is this the way in which Scala traits are meant to be used ?
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24193727
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37349738
tagged with: scala
downvote count: 0
possible better answer: http://stackoverflow.com/a/24193647

http://stackoverflow.com/a/24256741
type: AcceptedAnswer
score: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24256702
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/24256702
has body: You can send multiple parameters like, href="Search.jsp?item=&lt;%=search%&gt;&amp;item2=value2&amp;item3=value3.." Also to add &lt;%session.setAttribute("val",value1);%&gt; will be executed at server side irrespective of the click of the hyperlink. For the form you can add another input parameter in the form, &lt;input type="text" name="item1" value="&lt;%=value%&gt;"&gt;

http://stackoverflow.com/comment/37372010
has text: so what should i do get desired output.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24199496
type: QuestionComment

http://stackoverflow.com/comment/37372487
type: AnswerComment
comment on: http://stackoverflow.com/a/24205586
score: 0
type: Comment
has text: That's why the method is synchronized: only one thread can make use of it at a time, so whichever goes second would get into the method but should not do anything. Also, did you read the document I link in the question?

http://stackoverflow.com/a/24156289
score: 0
answers question: http://stackoverflow.com/q/24156130
has body: Try removing s.clear(). It is basically detaching the objects from the persistence context, which may be causing the exception detached entity passed to persist
has comment: http://stackoverflow.com/comment/101849182
type: Answer

http://stackoverflow.com/a/24231523
downvote count: 0
score: 1
upvote count: 1
has body: If you are trying to leanr an algorithm, then this kind of solution works. But here, Set is a basic idea for your question. Set does not have duplicates. So what you have to do it to convert the array into a Set. You can do it by implementing a Set data structure. I will give a library code for the sake of completion. So, I suggest you to stick to basic data-structures which can create more elegant solutions. :) It seems harsh to get down votes in the very beginning in SO. But do not give up keep learning. You can create your data structure for this. Set&lt;T&gt; mySet = new HashSet&lt;T&gt;(Arrays.asList(someArray));
type: Answer
answers question: http://stackoverflow.com/q/24231423

http://stackoverflow.com/comment/51927352
comment on: http://stackoverflow.com/a/24176501
type: AnswerComment
has text: Thanks It was the endpoint to get the list of keys. https://s3.amazonaws.com/bucket/?prefix=myfolder/&delimiter=/ I was missing the trailing slash for prefix
score: 0
type: Comment

http://stackoverflow.com/q/24158256
type: Question
has title: Why libgdx new version use tile unit to set the position of the camera?
score: 0
type: UnansweredQuestion
has body: I'm trying to put the new version of libgdx 0.9.8 -> 1.0.1. I use a tilemap and an OrthographicCamera with an OrthogonalTiledMapRenderer. This is my camera implementation : map = tileMapHelper.getMap(); renderer = new OrthogonalTiledMapRenderer(map, 1/128f); camera = new OrthographicCamera(width, height); camera.setToOrtho(false, 5, (float)(height/128f)); So when I try to move up the camera (just 2 pixels), I do this : camera.position.set(camera.position.x, camera.position.y + 2, 0); Unfortunately, this operation moves up the camera 2 tiles. How can I move my camera with only pixels ? Thanks.
has comment: http://stackoverflow.com/comment/37285137
answer count: 1
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/37290905
has answer: http://stackoverflow.com/a/24163359

http://stackoverflow.com/a/24154359
score: 1
upvote count: 1
has body: Use for each loop for(Block bl:bArray){ if(bl !=null) Listener.myMethod(b1); }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24154243

http://stackoverflow.com/q/24149035
type: Question
linked to: http://stackoverflow.com/q/513832
has title: Modifying one of HashMap key
tagged with: hashmap
type: UnansweredQuestion
has body: package always.confusing; import java.util.HashMap; import java.util.Map; class Dog { public Dog(String n) { name = n; } public String name; public boolean equals(Object o) { if((o instanceof Dog) &amp;&amp; (((Dog)o).name == name)) { return true; } else { return false; } } public int hashCode() {return name.length(); } } public class QustionToaAsk { public static void main(String[] args) { // TODO Auto-generated method stub Map&lt;Object, Object&gt; m = new HashMap&lt;Object, Object&gt;(); Dog d1 = new Dog("clover"); m.put(d1, "Dog key"); System.out.println("**" + m.get(new Dog("clover"))); d1.name = "magnolia"; System.out.println("state after magnolia"); System.out.println(m.get(new Dog("magnolia"))); System.out.println(m.get(d1)); // #1 System.out.println("**" + m.get(new Dog("clover")));///???????? System.out.println("size:" + m.size()); d1.name = "clover"; System.out.println("\nstate after clover"); System.out.println(m.get(new Dog("clover"))); // #2 System.out.println(m.get(d1)); System.out.println("size:" + m.size()); d1.name = "arthur"; System.out.println("\nstate after arthur"); System.out.println(m.get(new Dog("arthur"))); System.out.println(m.get(d1)); System.out.println("size:" + m.size()); } } O/p: **Dog key state after magnolia null null **null size:1 state after clover Dog key Dog key size:1 state after arthur Dog key Dog key size:1 why does 1st set of prints fail to fetch for Dog objects with clover and magnolia content but in other two sets it does as expected? ie why After trying to change to "magnolia", why next get()(still using proper object ie get(new Dog("clover")))) not able to fetch the value "Dog key"? after changing to equals.. still same output – //ignore
tagged with: dictionary
has answer: http://stackoverflow.com/a/24149460
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37266887
tagged with: java
has answer: http://stackoverflow.com/a/24149422
has answer: http://stackoverflow.com/a/24149373

http://stackoverflow.com/a/24207876
score: 1
downvote count: 0
has body: Other than the recommended ICloneable? (I say the recommended way, however cloning is usually seen as bad) I suppose if the objects are Serializable you could serialize and de-serialise as a new object. var formatter = new BinaryFormatter(); var stream = new MemoryStream(); using (stream) { formatter.Serialize(stream, yourObject); stream.Seek(0, SeekOrigin.Begin); return (YourObjectType)formatter.Deserialize(stream); } Add a null check and it would make a nice extension method for serialisable objects. Once again though, cloning probably is not a good solution for your problem, but I don't know enough about your use-case to recommend anything.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24207748

http://stackoverflow.com/comment/37268760
comment on: http://stackoverflow.com/a/24148215
score: 0
has text: Thank you very much. But is there also a way with which I can overlap those two sheets. Let's say by making the background of the upper sheet transparent?
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24122771
type: Question
has comment: http://stackoverflow.com/comment/37216991
type: UnansweredQuestion
tagged with: android
score: 0
has answer: http://stackoverflow.com/a/24122951
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24122977
has title: NPE at custom dialog box
has answer: http://stackoverflow.com/a/24122948
has body: I created an activity with two buttons in which a custom dialog box will be shown depending on the type of button clicked I have created an xml file for the dialog box dialog.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/lv_dialog" android:background="#FF0000" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="# Do you know?" android:layout_gravity="center" android:textSize="25px" android:layout_marginTop="10px" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="THE FACT IS DISPLAYED HERE" android:layout_gravity="center" android:textSize="30px" android:layout_marginTop="10px" android:id="@+id/txtfact" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="THE ANSWER STATUS IS DISPLAYED HERE" android:layout_gravity="center" android:textSize="32px" android:textColor="#FFFFFF" android:layout_marginTop="10px" android:id="@+id/txtanswer" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="THE SCORE IS DISPLAYED HERE" android:layout_gravity="center" android:textSize="32px" android:textColor="#FFFFFF" android:layout_marginTop="10px" android:id="@+id/txtscore" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="GOTO NEXT QUESTION" android:layout_gravity="center" android:textColor="#FFFFFF" android:layout_marginTop="20px" android:id="@+id/btngotonext" /&gt; &lt;/LinearLayout&gt; THe activity main is &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="verti…

http://stackoverflow.com/q/24160206
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37286618
has answer: http://stackoverflow.com/a/24161397
tagged with: initialization
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37287446
has body: I just tried out to set a variable, showing me that the super constructor has been finished without wasting my code. So I remembered how class variables are initialized; after the super constructor but before the class constructor. But there is something strange if you look at this example: public class Init { public Init() { System.out.println("Init instance of " + this.getClass().getSimpleName()); System.out.println("syso Init:"); this.syso(false); } protected void syso(boolean childCall) { System.out.println("should not be printed because the method is overwitten"); } public static class Child extends Init { private final boolean finalTrueA = true; private final boolean finalTrueB; private final boolean finalTrueC; private boolean nonFinalTrueA = true; private boolean nonFinalTrueB; private boolean nonFinalTrueC; { this.finalTrueB = true; this.nonFinalTrueB = true; } public Child() { super(); this.finalTrueC = true; this.nonFinalTrueC = true; System.out.println("\n\nsyso Child:"); this.syso(true); } @Override protected void syso(boolean childCall) { System.out.println("finalTrueA " + this.finalTrueA + " should be " + childCall); System.out.println("finalTrueB " + this.finalTrueB + " should be " + childCall); System.out.println("finalTrueC " + this.finalTrueC + " should be " + childCall); System.out.println(); System.out.println("nonFinalTrueA " + this.nonFinalTrueA + " should be " + childCall); System.out.println("nonFinalTrueB " + this.nonFinalTrueB + " should be " + childCall); System.out.println("nonFinalTrueC " + this.nonFinalTrueC + " should be " + childCall); } } public static void main(String[] args) { @SuppressWarnings("unused") Child child = new Child(); } } which has the following output: Init instance of Child syso Init: finalTrueA true should be false // &lt;-- why?????????? finalTrueB false should be false finalTrueC false should be false nonFinalTrueA false should be false nonFinalTrueB false should be false nonFinalTrueC false should be false syso …
answer count: 2
score: 5
tagged with: final
type: UnansweredQuestion
upvote count: 5
tagged with: variables
has title: Difference between initialization of final class variable
has answer: http://stackoverflow.com/a/24160611
tagged with: class

http://stackoverflow.com/comment/37356931
comment on: http://stackoverflow.com/a/24197304
type: Comment
has text: Thanks for your suggestion. Sorry I am just to take over the project and never implement SSL stuff before. I have searched for a while and there is some approach for paying to renew , and the "pinning" is the best apporach if I don't want to pay?
score: 0
type: AnswerComment

http://stackoverflow.com/q/24201575
score: 1
tagged with: java
has body: I am new to java and javascript. I have used infovis Spacetree for building a tree. I want to make the children node of parent node downloadable. I mean when the user clicks chilnode 1 of Parent node 1 it should download a pdf file stored from root directory. Could anyone suggest me how can achieve that. Here is my javascript code for spacetree in infovis var labelType, useGradients, nativeTextSupport, animate; (function() { var ua = navigator.userAgent, iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i), typeOfCanvas = typeof HTMLCanvasElement, nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'), textSupport = nativeCanvasSupport &amp;&amp; (typeof document.createElement('canvas').getContext('2d').fillText == 'function'); labelType = (!nativeCanvasSupport || (textSupport &amp;&amp; !iStuff))? 'Native' : 'HTML'; nativeTextSupport = labelType == 'Native'; useGradients = nativeCanvasSupport; animate = !(iStuff || !nativeCanvasSupport); })(); var Log = { elem: false, write: function(text){ if (!this.elem) this.elem = document.getElementById('log'); this.elem.innerHTML = text; this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px'; } }; function init(){ var json = { id: "node1", name: "Stocks", data: {}, children: [{ id: "node2", name: "Stock1", data: {}, children: [{ id: "node3", name: "A", data: {}, children: [{ id: "node4", name: "child 1", data: {}, children: [] }, { id: "node5", name: "child 2", data: {}, children: [] }, { id: "node6", name: "child 3", data: {}, children: [] }] }] }]}; var st = new $jit.ST({ injectInto: 'infovis', duration: 800, transition: $jit.Trans.Quart.easeInOut, levelDistance: 50, Navigation: { enable:true, panning:true }, Node: { height: 20, width: 100, type: 'rectangle', color: '#aaa', overridable: true }, Edge: { type: 'bezier', overridable: true }, onBeforeCompute: function(node){ Log.write("loading " + node.name); }, onAfterCompute: function(){ Log.write("done"); }, onCreateLabel: function(label, node){…
tagged with: infovis
has title: Downloading childnode in Spacetree in infovis javascript
type: UnansweredQuestion
answer count: 1
downvote count: 0
tagged with: thejit
tagged with: javascript
upvote count: 1
favorite count: 0
type: Question
tagged with: space-tree
has answer: http://stackoverflow.com/a/28340405

http://stackoverflow.com/a/24126101
accepted answer of: http://stackoverflow.com/q/24105909
score: 0
has body: Thanks to Hot Licks! Correct client code is: const void *bytes = [data bytes]; UInt16 packageId; // 16-bit value memcpy(&amp;packageId, bytes + 0, 2); // copy first 2 bytes packageId = CFSwapInt16BigToHost(packageId); // fix endianness for 16-bit value return packageId; // now we got correct value Or, and it's more convenient, modify Java code on the server with: java.nio.ByteBuffer buffer = java.nio.ByteBuffer.allocate(2 + 2 + 1 + bodySize); buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN); After this modification the initial client code will work correctly without using CFSwapInt... functions. Many-many thanks for your help!
type: Answer
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24105909

http://stackoverflow.com/comment/37411663
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24225871
has text: Yes, as a temporary string for further processing.
score: 0

http://stackoverflow.com/a/24174870
has body: Perform a SCAN operation for full table scan. You have the option to add filters to the scan. SCAN may not be as good as you may imagine. Firstly, it only scans at most 1MB of data at one time. You may make additional calls if you want more data. Besides, this 1MB limitation is applied before filtering. That is to say every SCAN looks up to 1MB of data and filter based on your criteria, instead of keep scanning while filtering until 1MB limitation is reached. Also, SCAN may cause sudden burst of read activity. Say if your record is 1KB and you make SCAN every one second, then a SCAN can return up to 1000 records, which consumes 500 read capacity. You may want to set a limit smaller than the default 1MB when doing the scan. Lastly, SCAN doesn't guarantee the order of result. You can't specify an 'order by', and no assumption should be made on the order it returns. DynamoDB is made for storing key-value data. You are supposed to query the value by key. If you are not always querying the primary key and get a unique record, you may add global secondary indexes which gives you the ability to query by two columns and order by one of them. Please refer to AWS documentation: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html
answers question: http://stackoverflow.com/q/24171989
has comment: http://stackoverflow.com/comment/137443276
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24171989
type: Answer
downvote count: 0
type: AcceptedAnswer
score: 6

http://stackoverflow.com/a/24202925
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37367978
downvote count: 0
upvote count: 1
has body: In order to do so you would have to execute the maven goals in the correct order so : cobertura:instrument test goalToAskCoberturaToGenerateReport But then comes the trouble : there is no such goal as cobertura:report, if you look at the documentation and source code of the maven plugin : The goal cobertura:cobertura is the only goal generating the report. I suspect it is as such because of some maven internal limitation. So in short, given the state of the maven plugin it is not possible. You might have a chance to manage what you want to achieve by executing cobertura from the command line.
answers question: http://stackoverflow.com/q/24202123

http://stackoverflow.com/comment/37728106
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24346567
has text: Ok. Thank you for the reply. I gonna provide the SSCCE. To reproduce this problem we need 2 diferents jdk installed. In my case i use ibm jdk 1.6(IBM-Java60-amd64) to serialize into xml and oracle jdk 1.6(orecle-jdk1.6.0-x86) to construct the collection again.
type: AnswerComment

http://stackoverflow.com/q/24193899
type: Question
has answer: http://stackoverflow.com/a/24194085
has body: This is a java web app and in the .jsp file I have: &lt;form method="post" action="&lt;% out.print(response.encodeRedirectURL(request.getContextPath()+"/target.do")); %&gt;" accept-charset="utf-8"&gt; &lt;label for="name"&gt; &lt;input type="text" name="name" id="name"/&gt; &lt;/label&gt; &lt;input type="submit"&gt; &lt;/form&gt; And target.do is mapped to a servlet where doPost is: HttpSession session = httpServletRequest.getSession(); session.setAttribute("sessionName",httpServletRequest.getParameter("name")); httpServletResponse.sendRedirect(getServletContext().getContextPath()+"/target.jsp"); And in target.jsp I simply show the name: Your Http Session name is: &lt;% String sessionName = (String) request.getSession().getAttribute("sessionName"); out.print(sessionName); %&gt; However, when cookies are disabled this will not work. I do not want to use .forward I need to use sendRedirect. Application is deployed to Tomcat. Putting the name in a request attribute is a possible solution but I am looking for URL encoding actually but I can not achieve it? Edit: encodeURL instead of encodeRedirectURL does not work either.
has title: How can I make the form work when cookies are disabled?
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37350631
tagged with: cookies
tagged with: java
answer count: 1
tagged with: jsp
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/24194085

http://stackoverflow.com/q/24254209
downvote count: 0
score: 8
favorite count: 0
tagged with: option-type
type: Question
upvote count: 8
has answer: http://stackoverflow.com/a/24254843
accepted answer: http://stackoverflow.com/a/24254843
has answer: http://stackoverflow.com/a/56791542
possible better answer: http://stackoverflow.com/a/56791542
has body: I was trying to refactor an old code to use streams, and my first approach was this: public void run() throws IOException { Files.list(this.source) .filter(Images::isImage) .map(Image::new) .filter(image -&gt; image.isProportional(this.height, this.width)) .map(image -&gt; image.resize(this.height, this.width)) .forEach(image -&gt; Images.write(image, this.destination)); } This is not compiling since new Image() and Images.write() throws IOExceptions. Wrapping those exceptions with UncheckedIOException wouldn't do the trick as I don't want to stop other images to be processed if one of them fails. So I ended writing 2 private methods: private Optional&lt;Image&gt; createImage(Path imagePath) { try { return Optional.of(new Image(imagePath)); } catch (IOException e) { return Optional.empty(); } } private void write(Image image) { try { Images.write(image, this.destination); } catch (IOException e) { // log error } } createImage() returns an Optional since this seems sensible. However after this my code got really ugly: public void run() throws IOException { Files.list(source) .filter(Images::isImage) .map(this::createImage) .filter(image -&gt; image.isPresent() &amp;&amp; image.get().isProportional(this.height, this.width)) .map(image -&gt; image.get().resize(this.height, this.width)) .forEach(this::write); } Is there a way to avoid using get() and isPresent() on that code? Thanks!
has title: Using Optional with Streams in Java
tagged with: java-8
type: AnsweredQuestion
answer count: 2
tagged with: java-stream
tagged with: java

http://stackoverflow.com/comment/37210911
comment on: http://stackoverflow.com/q/24118007
score: 0
has text: Thank you for your comment. I understand the fact that Play needs the `/public` folder to be in the classpath. Although its not very understandable why it triggers auto reload since the ressources it contains are supposedly _static_. Is there a way to serve ressources from an external folder that's not monitored using the `Assets` controller ? I haven't found a way yet.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37342633
comment on: http://stackoverflow.com/q/24190091
has text: ok, its possible to deploy the play 2.3.x app in websphere server 7 generating a war or ear file.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24152780
has body: Well, I have some session attributes that must be acessible to all application (DAO, Business Object, Beans and others). I can't create a class with static attribute because static attributes are shared to different sessions. I.E: User login in application and i need save the hour of login, i need store this value in a session attribute because in some point of my application like BO (Business Object) i will need know when user log in application. I can't acess HttpRequest in some places of my application, i need some another solution.
has answer: http://stackoverflow.com/a/24153474
has comment: http://stackoverflow.com/comment/37312963
tagged with: tomcat
type: AnsweredQuestion
tagged with: jsf-2
tagged with: jsf
answer count: 3
has title: Managing session attributes to access in all web application
downvote count: 0
accepted answer: http://stackoverflow.com/a/24153474
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24158485
tagged with: web-applications
possible better answer: http://stackoverflow.com/a/24157386
has comment: http://stackoverflow.com/comment/37304613
favorite count: 0
has answer: http://stackoverflow.com/a/24157386
type: Question

http://stackoverflow.com/comment/37405813
comment on: http://stackoverflow.com/a/24220982
score: 0
type: AnswerComment
has text: Not true! Thread t is clearly running! It could interrupt the thread on which this code is running. That interrupt would cause the join() to complete, prematurely and t would get set to null, before the thread completed.
type: Comment

http://stackoverflow.com/comment/37266411
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24148667
has text: @popovitsj i really do not know which AVD should choose and configure, ca i ask a question about that or it's off-topic?

http://stackoverflow.com/a/24116692
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37289729
has comment: http://stackoverflow.com/comment/37290358
has comment: http://stackoverflow.com/comment/37290996
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24116476
upvote count: 1
has comment: http://stackoverflow.com/comment/37290266
answers question: http://stackoverflow.com/q/24116476
has body: The case you describe is documented section 8 - Mapping SQL and Java Types of "Getting Started with the JDBC API" 8.3.12 DATE, TIME, and TIMESTAMP Because the standard Java class java.util.Date does not match any of these three JDBC date/time types exactly (it includes both DATE and TIME information but has no nanoseconds), JDBC defines three subclasses of java.util.Date to correspond to the SQL types. They are: java.sql.Date for SQL DATE information. The hour, minute, second, and millisecond fields of the java.util.Date base class should be set to zero. If the number of milliseconds supplied to the java.sql.Date constructor is negative, the driver will compute the date as the number of milliseconds before January 1, 1970. Otherwise, the date is computed as the specified number of milliseconds after January 1, 1970. java.sql.Time for SQL TIME information. The year, month, and day fields of the java.util.Date base class are set to 1970, January, and 1. This is the "zero" date in the Java epoch. java.sql.Timestamp for SQL TIMESTAMP information. This class extends java.util.Date by adding a nanoseconds field.
has comment: http://stackoverflow.com/comment/37290892

http://stackoverflow.com/comment/37231965
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24130491
type: Comment
has text: @Thilo Oh, I didn't realize that unreachable code was a compiler *error* in Java. It's merely a *warning* in the other languages that I work with (C++/C#). Yeah, in that case I agree that it would need to be specified.

http://stackoverflow.com/comment/37490088
comment on: http://stackoverflow.com/q/24261109
type: Comment
has text: Yes, with SBT but we have some conf strangeness (due to compatibility with other build systems), I'll post the answer when I find why it fails, thanks a lot
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37488856
score: 0
has text: "How is it possible to prove that AES algorithm is working" is easy, just encrypt and decript, and compare the actual with the expected.
comment on: http://stackoverflow.com/q/24261970
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37275977
score: 0
type: AnswerComment
has text: Okay, thanks. Now I type in: javac -cp .:./jl1.0.1.jar Runner.java. I receive the same error that I specified in the opening post... Am I importing the wrong thing? How would I know?
comment on: http://stackoverflow.com/a/24154087
type: Comment

http://stackoverflow.com/q/24152433
has answer: http://stackoverflow.com/a/24153024
tagged with: http://stackoverflow.com/tag/xml
score: 4
upvote count: 4
type: AnsweredQuestion
tagged with: xml-parsing
tagged with: java
answer count: 1
downvote count: 0
tagged with: jaxb
favorite count: 0
has title: remove under scores in java files generated using xjc command
type: Question
tagged with: xjc
accepted answer: http://stackoverflow.com/a/24153024
has body: I have the following lines in my xsd schema &lt;simpleType name="IdTypeEnum"&gt; &lt;restriction base="token"&gt; &lt;enumeration value="SIP1"&gt;&lt;/enumeration&gt; &lt;enumeration value="SIP2"&gt;&lt;/enumeration&gt; In generated java files, I have the following code @XmlEnumValue("SIP2") SIP_2("SIP2"), @XmlEnumValue("CUSIP3") SIP_3("SIP3"), I want to remove the underscores in generated java files so that the above code looks like this @XmlEnumValue("SIP2") SIP2("SIP2"), @XmlEnumValue("CUSIP3") SIP3("SIP3"), Is there any way in which we can tweak the xjc command so that it generates java files in above manner? My schema uses elementFormDefault="qualified"

http://stackoverflow.com/comment/37448618
comment on: http://stackoverflow.com/q/24245277
score: 0
type: Comment
type: QuestionComment
has text: @Fortega The triple click works right (lines become selected). `contents.getTransferData(DataFlavor.stringFlavor)` returns all time the same object from clipboard. It seems like ` Sequence(robot, 5, KeyEvent.CTRL_MASK, KeyEvent.VK_C)` doesn't work like CTRL-C.

http://stackoverflow.com/comment/37222819
type: Comment
type: QuestionComment
has text: By landscape I mean portrait
comment on: http://stackoverflow.com/q/24125580
score: 0

http://stackoverflow.com/q/24233806
answer count: 2
possible better answer: http://stackoverflow.com/a/24240059
upvote count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/29016353
has comment: http://stackoverflow.com/comment/37433598
has title: Generate java code in modelio
has answer: http://stackoverflow.com/a/29016353
tagged with: modelio
has body: I created a UML class diagram im Modelio, now I need to implement this diagram in Java. Is there any possibility to generate Java code out of a class diagram? I just want to export the classes and prototypes of the methods. I have already tried tu use "java designer 3.1.00", but i could not figure out if/how i can generate class files with this extention.
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24240059
tagged with: java
tagged with: uml
favorite count: 0
type: Question

http://stackoverflow.com/comment/37459262
type: Comment
type: QuestionComment
has text: Did you get the same errors, or new ones?
score: 0
comment on: http://stackoverflow.com/q/24249917

http://stackoverflow.com/comment/37369723
type: Comment
type: AnswerComment
has text: Does static initializer block run before `static final` variables are initialized?? Why? so surprised...
score: 0
comment on: http://stackoverflow.com/a/24203042

http://stackoverflow.com/q/24107005
accepted answer: http://stackoverflow.com/a/24107182
type: Question
has answer: http://stackoverflow.com/a/24107182
has comment: http://stackoverflow.com/comment/37187318
has title: Extracting words from array
downvote count: 4
has comment: http://stackoverflow.com/comment/37187355
upvote count: 0
has body: I have this strings: " one, two, three, 4," What I want to do is to get "one", "two", "three" in an array space so when I print the array I get "one" "two" "three". I have this code but all I get is "eeeeeeeeeeeeeeeeee" for(int j=0;j&lt;s.length();j++){ for(int i=0;i&lt;s.length();i++) if(Character.isLetter(s.charAt(i))&amp;&amp;s.charAt(i)!=',') words[j]=""+s.charAt(i); }
score: -4
has answer: http://stackoverflow.com/a/24107628
has answer: http://stackoverflow.com/a/24107059
favorite count: 0
type: AnsweredQuestion
answer count: 3
possible better answer: http://stackoverflow.com/a/24107628
tagged with: java
has comment: http://stackoverflow.com/comment/37187365

http://stackoverflow.com/a/24184445
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24179314
type: AcceptedAnswer
has body: Dont forget that JAR is a typical ZIP file. In provided link you can see how it is performed. zip manipulation with java eventually, use external libraries like JBoss ShrinkWrap. here's link to api good luck!
accepted answer of: http://stackoverflow.com/q/24179314

http://stackoverflow.com/comment/37191072
comment on: http://stackoverflow.com/q/24108998
score: 3
has text: Be more specific. *What* about it isn't working?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37444884
type: AnswerComment
comment on: http://stackoverflow.com/a/24243288
type: Comment
score: 0
has text: But when I query the same URL from the browser I get the complete HTML, with "http:". How is that possible?

http://stackoverflow.com/a/24178409
has comment: http://stackoverflow.com/comment/133810901
has comment: http://stackoverflow.com/comment/37359416
type: Answer
has comment: http://stackoverflow.com/comment/40707667
has comment: http://stackoverflow.com/comment/61055820
has comment: http://stackoverflow.com/comment/136665287
has comment: http://stackoverflow.com/comment/65220771
has comment: http://stackoverflow.com/comment/44966904
has comment: http://stackoverflow.com/comment/37334682
has comment: http://stackoverflow.com/comment/49116565
answers question: http://stackoverflow.com/q/24135682
has body: UPDATE : Please see more answer to know there is other way to achive your expect. At 2014, BLE allows you transfer maximum of 20 bytes. If you want to send more than 20 bytes, you should define array byte[] to contain how many packets you want. Following example worked fine if you want to send less than 160 characters (160 bytes). p/s : Let edit following as you want. Do not follow me exactly. Actually, when we are using BLE, mobile side and firmware side need to set up the Key (ex. 0x03 ...) to define the connection gate among both sides. The idea is : When we continue to transfer packets, not is the last one. The gate is byte[1] = 0x01. If we send the last one, The gate is byte[1] = 0x00. The data contruction (20 bytes): 1 - Byte 1 - Define the Gate ID : ex. Message gate ID byte[0] = 0x03. 2 - Byte 2 - Define the recognization : Is the last packet 0x00 or continue sending packets 0x01. 3 - Byte 3 (Should be 18 bytes after eliminating Byte 1 & Byte 2) - Attach the message content in here. please understand my logic before reading the code below. Below is an example of sending a Message with many packets, each packet is an array of size 20 bytes. private void sendMessage(BluetoothGattCharacteristic characteristic, String CHARACTERS){ byte[] initial_packet = new byte[3]; /** * Indicate byte */ initial_packet[0] = BLE.INITIAL_MESSAGE_PACKET; if (Long.valueOf( String.valueOf(CHARACTERS.length() + initial_packet.length)) > BLE.DEFAULT_BYTES_VIA_BLE) { sendingContinuePacket(characteristic, initial_packet, CHARACTERS); } else { sendingLastPacket(characteristic, initial_packet, CHARACTERS); } } private void sendingContinuePacket(BluetoothGattCharacteristic characteristic, byte[] initial_packet, String CHARACTERS){ /** * TODO If data length > Default data can sent via BLE : 20 bytes */ // Check the data length is large how many times with Default Data (BLE) int times = Byte.valueOf(String.valueOf( CHARACTERS.length() / BLE.DEFAULT_BYTES_IN_CONTINUE_PACKET)); Log.i(TAG, "CHA…
downvote count: 4
has comment: http://stackoverflow.com/comment/65141926
accepted answer of: http://stackoverflow.com/q/24135682
upvote count: 35
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/69431843
has comment: http://stackoverflow.com/comment/37355804
has comment: http://stackoverflow.com/comment/136666026
score: 31
has comment: http://stackoverflow.com/comment/37360448
has comment: http://stackoverflow.com/comment/40707768
has comment: http://stackoverflow.com/comment/37343178

string
tags question: http://stackoverflow.com/q/24115596
tags question: http://stackoverflow.com/q/24172642
tags question: http://stackoverflow.com/q/24133773
tags question: http://stackoverflow.com/q/24147177
type: Tag
tags question: http://stackoverflow.com/q/24182965
tags question: http://stackoverflow.com/q/24207236
tags question: http://stackoverflow.com/q/24192434
tags question: http://stackoverflow.com/q/24158590
tags question: http://stackoverflow.com/q/24164097
tags question: http://stackoverflow.com/q/24256232
tags question: http://stackoverflow.com/q/24253097
tags question: http://stackoverflow.com/q/24182902
tags question: http://stackoverflow.com/q/24174767
tags question: http://stackoverflow.com/q/24115211
tags question: http://stackoverflow.com/q/24116510
tags question: http://stackoverflow.com/q/24179793
tags question: http://stackoverflow.com/q/24192416
tags question: http://stackoverflow.com/q/24162192
tags question: http://stackoverflow.com/q/24151949
tags question: http://stackoverflow.com/q/24227968
tags question: http://stackoverflow.com/q/24138029
tags question: http://stackoverflow.com/q/24165128
tags question: http://stackoverflow.com/q/24122510
tags question: http://stackoverflow.com/q/24194896
tags question: http://stackoverflow.com/q/24111714
tags question: http://stackoverflow.com/q/24239474
tags question: http://stackoverflow.com/q/24177825
tags question: http://stackoverflow.com/q/24201530
tags question: http://stackoverflow.com/q/24110930
tags question: http://stackoverflow.com/q/24256469
tags question: http://stackoverflow.com/q/24213984
tags question: http://stackoverflow.com/q/24175145
tags question: http://stackoverflow.com/q/24181499
tags question: http://stackoverflow.com/q/24262495
tags question: http://stackoverflow.com/q/24119065
tags question: http://stackoverflow.com/q/24113492
tags question: http://stackoverflow.com/q/24193313
tags question: http://stackoverflow.com/q/24145057
tags question: http://stackoverflow.com/q/24120522
tags question: http://stackoverflow.com/q/24257335
tags question: http://stackoverflow.com/q/24107527
tags question: http://stackoverflow.com/q/24126902
tags question: http://stackoverflow.com/q/24213324
tags question: http://stackoverflow.com/q/24170640
tags question: http://stackoverflow.com/q/24183134
tags question: http://stackoverflow.com/q/24256196
tags question: http://stackoverflow.com/q/24160181
tags question: http://stackoverflow.com/q/24158424
tags question: http://stackoverflow.com/q/24153003
tags question: http://stackoverflow.com/q/24264997
tags question: http://stackoverflow.com/q/24219383
tags question: http://stackoverflow.com/q/24264597
tags question: http://stackoverflow.com/q/24178410
tags question: http://stackoverflow.com/q/24140101
tags question: http://stackoverflow.com/q/24201741
tags question: http://stackoverflow.com/q/24228673
tags question: http://stackoverflow.com/q/24114049
tags question: http://stackoverflow.com/q/24146029
tags question: http://stackoverflow.com/q/24107304
tags question: http://stackoverflow.com/q/24112237
tags question: http://stackoverflow.com/q/24171643
tags question: http://stackoverflow.com/q/24106845
tags question: http://stackoverflow.com/q/24121793
tags question: http://stackoverflow.com/q/24241501
tag name: string
tags question: http://stackoverflow.com/q/24172974
tags question: http://stackoverflow.com/q/24156005
tags question: http://stackoverflow.com/q/24256200
tags question: http://stackoverflow.com/q/24123829
tags question: http://stackoverflow.com/q/24176842
tags question: http://stackoverflow.com/q/24205888
tags question: http://stackoverflow.com/q/24156062
tags question: http://stackoverflow.com/q/24217126
tags question: http://stackoverflow.com/q/24227971
tags question: http://stackoverflow.com/q/24198771
tags question: http://stackoverflow.com/q/24111433
tags question: http://stackoverflow.com/q/24150438
tags question: http://stackoverflow.com/q/24218305
tags question: http://stackoverflow.com/q/24164185

http://stackoverflow.com/q/24262897
has answer: http://stackoverflow.com/a/24262965
linked to: http://stackoverflow.com/q/11114693
tagged with: hashset
score: 2
has answer: http://stackoverflow.com/a/24262970
answer count: 3
duplicate of: http://stackoverflow.com/q/11114693
has answer: http://stackoverflow.com/a/24262932
tagged with: java
has title: integer pair add to hashset java
has comment: http://stackoverflow.com/comment/37481769
has body: I set the integer pair class as below: public class pair{ int a; int b; pair(int p,int q){ this.a=p; this.b=q; } } When I add them into hashset, there are no duplicates: HashSet&lt;pair&gt; set=new HashSet&lt;pair&gt;(); pair temp=new pair(3,5); set.add(temp); pair temp1=new pair(3,5); set.add(temp1); for(pair p:set){ System.out.println(p.a+" "+p.b); } But it gives me this output: 3 5 3 5 What should I edit to have no duplicate in the hashset?
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/a/24165082
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24164341
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24164341
has body: Use a ListFragment for this, you can find the documentation and reference here: http://developer.android.com/reference/android/app/ListFragment.html you can google examples (e.g: http://www.vogella.com/tutorials/AndroidListView/article.html#listactivity)
score: 1
type: Answer

http://stackoverflow.com/a/24189656
score: 1
has comment: http://stackoverflow.com/comment/37344186
has comment: http://stackoverflow.com/comment/37342484
type: Answer
has comment: http://stackoverflow.com/comment/37342856
has body: Java 8 is functional too (somewhat): IntStream stream1 = IntStream.builder().add(1).add(2).add(3).add(4).build(); IntStream stream2 = IntStream.builder().add(1).add(2).add(5).build(); IntStream concatStream = IntStream.concat(stream1, stream2).distinct(); concatStream.forEach(x -&gt; System.out.println(x)); I have not used it much; I could not find a simpler way to create an IntStream.
answers question: http://stackoverflow.com/q/24189485
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37343894
score: 0
has text: @KevinL you are right, but it's still more efficient to avoid a binary search, and just get the new index with O(1).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24190537

http://stackoverflow.com/a/26863935
answers question: http://stackoverflow.com/q/24164862
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: I had the same problem when I missed this import: import org.springframework.http.HttpStatus; Eclipse didn't offer me to add it in Quick Fix, I added the row manually and it helped.

http://stackoverflow.com/comment/37703163
comment on: http://stackoverflow.com/q/24206634
score: 0
has text: @kriegaex Added the parent POM file. I thought I could add the configuration in the parent POM like this and it would apply for all the sub-modules, however it fails.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24327394
upvote count: 1
answers question: http://stackoverflow.com/q/24168557
has body: The return type is a NamingEnumeration&lt;SearchResult&gt; which is never null. You need to change your result check to use methods that the NamingEnumeration has available: if ( result.hasMore() ) { changeLdap( userDn ); } But it would be even better to actually use the results using a while loop, however that depends on your use-case: while ( result.hasMore() ) { try { SearchResult res = result.next(); String objDn = res.getNameInNamespace(); // Use the Dn of the returned object } catch (NamingException e) { // Whatever } }
type: Answer
score: 1
downvote count: 0

http://stackoverflow.com/comment/37422815
score: 0
comment on: http://stackoverflow.com/q/24231939
type: Comment
type: QuestionComment
has text: @AmolSawant: please stop asking for a fast solution. Try to find it by yourself while people are examining your problem and helping you for free. We're not at your service.

http://stackoverflow.com/a/24243726
downvote count: 1
has body: you need to put that in try-catch because it throws IOException which is checked Exception.Put the code in try-catch or handle the exception using "public static void main(String[] args) throws IOException"
answers question: http://stackoverflow.com/q/24243599
type: Answer
has comment: http://stackoverflow.com/comment/37445694
has comment: http://stackoverflow.com/comment/37445320
upvote count: 2
score: 1

http://stackoverflow.com/a/24250250
has comment: http://stackoverflow.com/comment/37460810
has comment: http://stackoverflow.com/comment/37458534
answers question: http://stackoverflow.com/q/24249917
has comment: http://stackoverflow.com/comment/37460388
type: Answer
has body: I'm guessing you're running the app in a way that doesn't bind it to the console, and therefore System.in is just reading EOF. For example, you're running it through a (dumber) IDE or you're using an older version of Maven to execute it. Try running directly from the console (your command prompt) and see if it works. If this was an IDE issue, let us know which one it was so it can be shamed.
has comment: http://stackoverflow.com/comment/37461282
score: 0

http://stackoverflow.com/comment/37456547
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24248715
has text: After a lot of work to stop having to deal with the latest "security", I am using 1.6.0_65.

http://stackoverflow.com/comment/37267253
score: 1
type: Comment
type: QuestionComment
has text: IMO, yes, yes, and yes.
comment on: http://stackoverflow.com/q/24149519

http://stackoverflow.com/q/24113570
tagged with: apache-camel
has body: There have been quite a few variations on this question, however I am still having problems working out a solution. I would like to load properties selectively from a list. First in the list that is found gets loaded: file:${catalina.home}/webapps/core.properties classpath:application.properties Since I first asked this question, I found that my Tomcat instance was corrupted, so I am trying again - hopefully with more clarity. Essentially, if the first file in the list is not found the application throws an Exception. If the first file is found it loads correctly. I am obviously looking for a fall through to occur to the first available properties file.
has comment: http://stackoverflow.com/comment/37274502
score: -1
type: Question
has comment: http://stackoverflow.com/comment/64929919
has comment: http://stackoverflow.com/comment/37199857
has comment: http://stackoverflow.com/comment/64855066
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24127344
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/37242274
upvote count: 1
tagged with: spring
favorite count: 0
has title: Setting camel properties from outside war
tagged with: java

xuggler
tags question: http://stackoverflow.com/q/24223925
tag name: xuggler
type: Tag

http://stackoverflow.com/comment/37199971
has text: your app context does not have mapping in between the request string and the controller to be called for that mapping. what i mean is that you have forgotten to use the <bean id=""> definition for the controller in your app context and its not correct also
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24113647
type: QuestionComment

http://stackoverflow.com/a/24157859
upvote count: 1
answers question: http://stackoverflow.com/q/24148683
score: 1
type: Answer
has body: Most likely you are using separators the wrong way, resulting in a wrong path. You could check this by debugging or even logging. Try getting the actual file's full path from your computer's explorer, and compare it with the path you are creating on runtime About using the Separator, you can try something like this: String SEPARATOR = System.getProperty("file.separator"); ServletContext ctxt = FacesService.getHttpServletRequest().getSession().getServletContext(); String filepath = ctxt.getRealPath("json"+SEPARATOR+"op.json"); System.out.println("File path = "+ filepath);
downvote count: 0

http://stackoverflow.com/comment/37342849
type: Comment
type: AnswerComment
has text: There are global parameters overwritten at test suite level, which is nice. Guess we'll have to use property files and configure them specifically for each test suite then. Sad news :(
score: 0
comment on: http://stackoverflow.com/a/24187183

http://stackoverflow.com/comment/37284964
score: 0
comment on: http://stackoverflow.com/q/24159407
type: QuestionComment
type: Comment
has text: Welcome to SO! Could you edit your question, adding you java code in order to let us see what the problem could be? And begging help is not necessary, you can just say "Hello, I have the following issue:"

http://stackoverflow.com/comment/37409567
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24224944
score: 0
has text: it would also be epic if you could say what was wrong so that i do not repeat the mistake in the future.

keypress
tags question: http://stackoverflow.com/q/24142788
tags question: http://stackoverflow.com/q/24258995
type: Tag
tag name: keypress
tags question: http://stackoverflow.com/q/24134680

http://stackoverflow.com/a/24173161
has body: because it is often useful to know if something was actually added, or alternately was already there.
answers question: http://stackoverflow.com/q/24173117
has comment: http://stackoverflow.com/comment/37311937
has comment: http://stackoverflow.com/comment/37318962
has comment: http://stackoverflow.com/comment/37312297
upvote count: 5
has comment: http://stackoverflow.com/comment/37338716
type: Answer
has comment: http://stackoverflow.com/comment/37312070
has comment: http://stackoverflow.com/comment/37311799
score: 2
has comment: http://stackoverflow.com/comment/37311650
has comment: http://stackoverflow.com/comment/37312574
downvote count: 3
has comment: http://stackoverflow.com/comment/37312208
has comment: http://stackoverflow.com/comment/37311720

http://stackoverflow.com/q/24206036
score: -6
downvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/24206075
type: Question
has comment: http://stackoverflow.com/comment/37373358
tagged with: arrays
possible better answer: http://stackoverflow.com/a/24206075
tagged with: data-structures
has body: This is my array code and I need to print it in reverse. public class Array1D { public static void main(String[] args) { int[] array = new int[3]; array[0] = 1; array[1] = 2; array[2] = 5; for (int i = 0; i &lt; array.length; i++) { //loop System.out.print("array["+i+"]="); System.out.println(array[i] + " "); } System.out.println("the last element in the matrix = " + array[array.length - 1]); // finding the last element in the array System.out.println(" "); } }
has answer: http://stackoverflow.com/a/24206092
type: AnsweredQuestion
answer count: 3
accepted answer: http://stackoverflow.com/a/24206060
tagged with: java
has comment: http://stackoverflow.com/comment/37373759
has title: How can I print an array in reverse?
has answer: http://stackoverflow.com/a/24206060
upvote count: 1

http://stackoverflow.com/comment/37386390
comment on: http://stackoverflow.com/a/24212549
type: AnswerComment
has text: That would be a solution, but how do I do that in Java?
score: 0
type: Comment

http://stackoverflow.com/comment/37447007
comment on: http://stackoverflow.com/a/24244564
score: 0
type: AnswerComment
has text: I am rotating by a constant 0.2 radians every 100 milliseconds. The rotate method is just not rotating it properly, I dont know why its decreasing the size of the triangle though.
type: Comment

http://stackoverflow.com/q/24116653
has body: There are several hints that Spring Data works with Google App Engine like: http://tommysiu.blogspot.com/2014/01/spring-data-on-gae-part-1.html http://blog.eisele.net/2009/07/spring-300m3-on-google-appengine-with.html Much of the examples are not "Spring Boot" so I've been trying to retrofit things with it. However, I've been stuck with this error for days and days: [INFO] Caused by: java.lang.NullPointerException [INFO] at org.datanucleus.api.jpa.metamodel.SingularAttributeImpl.isVersion(SingularAttributeImpl.java:79) [INFO] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.findVersionAttribute(JpaMetamodelEntityInformation.java:102) [INFO] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.&lt;init&gt;(JpaMetamodelEntityInformation.java:79) [INFO] at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65) [INFO] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:149) [INFO] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:88) [INFO] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:68) [INFO] at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:158) [INFO] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:224) [INFO] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:210) [INFO] at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) [INFO] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$6.run(AbstractAutow…
tagged with: google-app-engine
tagged with: jpa
has answer: http://stackoverflow.com/a/24117435
tagged with: spring
has title: Making Spring Data JPA work with DataNucleus (GAE) (Spring Boot)
type: AnsweredQuestion
tagged with: spring-data-jpa
answer count: 2
score: 1
upvote count: 1
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/24117435
favorite count: 0
has answer: http://stackoverflow.com/a/29823964
possible better answer: http://stackoverflow.com/a/29823964
type: Question

http://stackoverflow.com/a/24108321
score: 0
has body: You're using the right components, but have a Look and Feel (L&amp;F) problem. Take a look here: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html however, I can't guarantee that changing the look and feel will make it look exactly as you want. The general problem is that Swing abstracts away from the OS's GUI components. Eclipse is also Java, but SWT instead of Swing, so it doesn't have the problem. There may be third party libraries that integrate better with the native L&amp;F - Maurice seems to have found one. Alternatively, you could switch to SWT entirely, but that might be a bit much just to get the right L&amp;F.
type: Answer
answers question: http://stackoverflow.com/q/24108272
has comment: http://stackoverflow.com/comment/37189697
has comment: http://stackoverflow.com/comment/37189902
has comment: http://stackoverflow.com/comment/37189859

http://stackoverflow.com/a/24207340
has body: Think of a map as an array indexed by the key. It's not so much "Sorting" as placing the value at the key you specified. If you want to keep track of order, I'd recommend creating a list of tuples (or any other object to store both fields) to which you append each data set.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24207264

http://stackoverflow.com/comment/37357644
type: AnswerComment
comment on: http://stackoverflow.com/a/24197600
score: 0
type: Comment
has text: @MBlanc Just did. Still figuring out 5, but I *think* I got everything else. Thanks for the brain teaser!

http://stackoverflow.com/q/24222776
has title: Student Info System
tagged with: java
has answer: http://stackoverflow.com/a/24222812
favorite count: 0
type: Question
has body: **this is what I have done so far. This program need me to display student info. There is no error when I run the program but the grade just isn't displayed. ** import java.io.*; import java.math.MathContext; class StudInfo { public static DataInputStream d = new DataInputStream(System.in); public static String matricNo[] = new String[100]; public static String name[] = new String[100]; public static int courseWorkMark []= new int[100]; public static int finalExamMark[] = new int [100]; public static String grade[] = new String[100]; public static double mark1; public static double mark2; public static int x = 1; public static String sgrade; public static int scourseWorkMark; public static int sfinalExamMark; //MENU public static void main(String[] args)throws IOException { menu(); } public static void menu()throws IOException { System.out.println("&lt;&lt;&lt;-- MAIN MENU --&gt;&gt;&gt;"); System.out.println(""); System.out.println("[1] Add\n[2] Edit\n[3] Delete\n[4] Search\n[5] View\n[6] Exit"); System.out.println(""); System.out.print("Select a menu: "); int m = Integer.parseInt(d.readLine()); switch(m) { case 1: //ADD DATA addData(); break; case 2: //EDIT DATA editData(); break; case 3: //DELETE DATA DeleteData(); break; case 4: //SEARCH DATA SearchData(); break; case 5: //VIEW DATA viewData(); break; case 6: //EXIT SYSTEM break; default: break; } } //DELETE public static void DeleteData()throws IOException { boolean result = false; int index = 0; spacing(); System.out.print("&lt;&lt;&lt;-- DELETE RECORDS --&gt;&gt;&gt;\n\n"); System.out.print("Search Student Matric Number: "); String smatricNo = d.readLine(); for(int i=1;i&lt;matricNo.length;i++) { if(matricNo[i] !=null) { if(smatricNo.equalsIgnoreCase(matricNo[i])) { result = true; index = i; } } } if(result == true) { System.out.print("Matric: "+matricNo[index].toUpperCase()+ " "); System.out.print("Name: "+name[index].toUpperCase()+ " "); System.out.print("Course Work: "+courseWorkMark[index]+ " "); System.o…
upvote count: 0
downvote count: 5
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/24222812
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37405423
score: -5

http://stackoverflow.com/q/24215053
has body: I'm trying to compare the key code I get from KeyEvent.getKeyCode() from a key listener to something like KeyEvent.VK_SLASH however when I press the slash key (and I know it's slash because it shows a /), the comparison (if(e.getKeyCode() == KeyEvent.VK_SLASH)) is false. However when I compare it to KeyEvent.VK_DEAD_ACUTE, it returns true. Other keys such as ABCD or numbers are fine however some keys such as ` and / are different. Why is this? And how can I fix this? Edit: Other keys such as ' are affected too as it produces a . And pressing the key gives me VK_DEFINED
type: Question
has comment: http://stackoverflow.com/comment/37400612
has comment: http://stackoverflow.com/comment/37400307
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37391180
has answer: http://stackoverflow.com/a/42072249
has answer: http://stackoverflow.com/a/78295373
has comment: http://stackoverflow.com/comment/37391401
has title: Java key input is different to KeyEvent's VK keys
tagged with: keylistener
has comment: http://stackoverflow.com/comment/37397992
has comment: http://stackoverflow.com/comment/37391193
tagged with: awt
has comment: http://stackoverflow.com/comment/37399240
tagged with: keyevent
answer count: 2
score: 0
tagged with: java

http://stackoverflow.com/comment/37318411
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24176951
score: 1
has text: what is the type of runs and balls

http://stackoverflow.com/a/24114982
type: Answer
has comment: http://stackoverflow.com/comment/37202370
has comment: http://stackoverflow.com/comment/37202600
has body: This is a common problem that people encounter with the return statement. In situations such as this I generally create a new String and have it return that. For example: public String display() { String s = "Name: "; for (int i = 0; i &lt; 3; i++) { s = s + item.getName(); } return s; } That way, you are actively adding onto a new string that you plan to return later. This method has proved extremely helpful for me, not only with strings but also with integers and ArrayLists. Because return statements result in the exiting of your code, you are going to want to try and keep them at the end of your methods unless you have some specific reason for having the return statement earlier in the method.
answers question: http://stackoverflow.com/q/24114880
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/24108520
upvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/920362
linked to: http://stackoverflow.com/q/4112686
tagged with: jsp
tagged with: jquery
has body: I am able to have the response from a servlet and also able to show it on jsp page, but if I try to populate the same in a drop down, i am not able to- Servlet code String sql = "SELECT records from department"; ResultSet rs = s.executeQuery(sql); Map&lt;String, String&gt; options = new LinkedHashMap&lt;String, String&gt;(); while (rs.next()) { options.put(rs.getString("records"),rs.getString("records")); } String json = new Gson().toJson(options); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(json); JSP code--- JS code &lt;script type="text/javascript"&gt; $(document).ready(function () { // When the HTML DOM is ready loading, then execute the following function... $('.btn-click').click(function () { // Locate HTML DOM element with ID "somebutton" and assign the following function to its "click" event... $.get('/testservlet', function (responseJson) { // Execute Ajax GET request on URL of "someservlet" and execute the following function with Ajax response JSON... //alert(responseJson); var $select = $('#maindiv'); // Locate HTML DOM element with ID "someselect". $select.find('option').remove(); // Find all child elements with tag name "option" and remove them (just to prevent duplicate options when button is pressed again). $.each(responseJson, function (key, value) { // Iterate over the JSON object. $('&lt;option&gt;').val(key).text(value).appendTo($select); // Create HTML &lt;option&gt; element, set its value with currently iterated key and its text content with currently iterated item and finally append it to the &lt;select&gt;. }); }); }); }); &lt;/script&gt; HTML Code-- &lt;input type="button" class="btn-click" id="best" value="check"/&gt; &lt;div id="maindiv" style="display: block"&gt;&lt;/div&gt; If I create a &lt;ul&gt; and &lt;li&gt; I can have the data from the response on my page but not able to create the select options? Any help on this would be great.
has answer: http://stackoverflow.com/a/24108997
tagged with: servlets
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4233354
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has title: How to populate drop down values using servlet response
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24108997

http://stackoverflow.com/comment/37202631
score: 1
type: Comment
comment on: http://stackoverflow.com/a/24115129
type: AnswerComment
has text: Autoboxing was introduced in 1.5

http://stackoverflow.com/comment/37320940
score: 0
comment on: http://stackoverflow.com/q/24178383
has text: What happens if you call writeInt instead of writeObject? This should avoid auto boxing the int.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37330387
has text: So while using LocalBroadcastManagers, if I stick to my orginal plan of updating UI once every two seconds, Will it be okay then?
comment on: http://stackoverflow.com/a/24183608
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24214704
has title: Cannot get google tutorial to work
has comment: http://stackoverflow.com/comment/37390645
has answer: http://stackoverflow.com/a/24214836
upvote count: 1
has body: I just starting learning to develop an android app and for that i followed google's basic tutorial. In the tutorial there is simply a textbox and a button. On pressing the button it takes the text from the textbox and displays it in another activity. But somehow the button isn't working for me. Here is the code for the fragment_main.xml, MainActivity.java and DisplayMessageActivity.java. I just want to know if i am doing something wrong or if i am missing something. fragmant_main.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"&gt; &lt;EditText android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" onClick="sendMessage" /&gt; &lt;/LinearLayout&gt; MainActivity.java: package com.example.first; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @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(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the…
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24214836
has comment: http://stackoverflow.com/comment/37390610
tagged with: android
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/37413240
type: AnswerComment
score: 0
has text: Why I want to get the `Document` object is that I try to break the nodes and the document of the "to_be_added.xml", since the nodes can not added if they are still have connection with another document. Check this:http://stackoverflow.com/questions/3035953/how-to-add-a-xml-document-to-another-xml-document-in-java
type: Comment
comment on: http://stackoverflow.com/a/24220481

http://stackoverflow.com/comment/37468642
comment on: http://stackoverflow.com/q/24255679
type: Comment
type: QuestionComment
score: 0
has text: Maybe it is getting the response from server a bit late. Why don't you use `AsyncTask`? You can update your textview in `onPostExecute()`. Then you don't be having this problem.

http://stackoverflow.com/comment/37424275
score: 0
type: Comment
has text: switch is meh, it adds an extra break; after each line.
type: AnswerComment
comment on: http://stackoverflow.com/a/24232782

http://stackoverflow.com/q/24223097
answer count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37406036
has comment: http://stackoverflow.com/comment/37406028
has answer: http://stackoverflow.com/a/24223148
favorite count: 0
has title: Java REGEX pattern matching 2
accepted answer: http://stackoverflow.com/a/24223131
has body: Pattern pattern = Pattern.compile("^[a-zA-Z0-9]=[a-zA-Z0-9]+$"); I'm trying to make a pattern that will copy the PROPERTIES file format. But the code only works if the string before the equals sign is one character. My ending goal is to have a pattern that will look like this: AnyLetterOrNumberInUndefinedAmount=AnyLetterOrNumberInUndefinedAmount What can I do to fix my code.
type: Question
has answer: http://stackoverflow.com/a/24223131
has comment: http://stackoverflow.com/comment/37406117
has answer: http://stackoverflow.com/a/24223155
has answer: http://stackoverflow.com/a/24223208
has comment: http://stackoverflow.com/comment/37406131
has comment: http://stackoverflow.com/comment/37406374
possible better answer: http://stackoverflow.com/a/24223148
tagged with: regex
has comment: http://stackoverflow.com/comment/37406225
score: -3
has comment: http://stackoverflow.com/comment/37406200
has comment: http://stackoverflow.com/comment/37406249
has comment: http://stackoverflow.com/comment/37406205
has comment: http://stackoverflow.com/comment/37406184

http://stackoverflow.com/comment/37308362
type: AnswerComment
has text: @ruhigbrauner You haven't shown what type `procedure` is; I'm assuming it's `Object[]`. In that case, the assignment `procedure[1] = num` will implicitly box `num` to a `java.lang.Integer`.
comment on: http://stackoverflow.com/a/24171259
type: Comment
score: 0

http://stackoverflow.com/q/24109439
has comment: http://stackoverflow.com/comment/37191950
downvote count: 5
has comment: http://stackoverflow.com/comment/37191984
score: -3
has comment: http://stackoverflow.com/comment/37192186
has comment: http://stackoverflow.com/comment/37192292
type: AnsweredQuestion
has title: What exaclty happens when a you call a constructor(new Class),do instance initializer blocks runs first?
tagged with: oop
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37192218
has body: Im a complete beginner in the Java especially OOP so please pardon my naivety but recently while going through Head First Java,they said,A constructor is a code that runs when somebody says new on a class type. But then i tried this code to see what actually happened but to my surprise the output was totally different. public class Test { private int n; {System.out.println("Out1 "+n);} public Test() { n=10; System.out.println("Inside Constructor"); } public static void main(String args[]) { System.out.println("Hello World!"); Test obj=new Test(); } {System.out.println("Out2 "+n);} } The Output: Hello World! Out1 0 Out2 0 Inside Constructor My question:WHY?Shouldnt the instance variable get initialized as soon as i call the contructor to initialize the specific instance variable?Isnt that the whole purpose of constructors?to run before making the object!
favorite count: 0
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/37192126
has comment: http://stackoverflow.com/comment/37191938
tagged with: constructor
accepted answer: http://stackoverflow.com/a/24109569
upvote count: 2
has comment: http://stackoverflow.com/comment/37192082
has answer: http://stackoverflow.com/a/24109569

http://stackoverflow.com/comment/56943901
type: Comment
comment on: http://stackoverflow.com/a/24110187
type: AnswerComment
score: 2
has text: Worth noting that this is not best practice, as it opens you up to potential CSRF attacks. From the JavaDoc: `The URL that triggers log out to occur (default is "/logout"). If CSRF protection is enabled (default), then the request must also be a POST. This means that by default POST "/logout" is required to trigger a log out. If CSRF protection is disabled, then any HTTP method is allowed. It is considered best practice to use an HTTP POST on any action that changes state (i.e. log out) to protect against CSRF attacks. ...`

http://stackoverflow.com/q/24171643
has comment: http://stackoverflow.com/comment/37308726
has body: I have a List&lt;Bean&gt; in which I have object value which is String. These strings look like this "This is 1", "This is 10", "This is 2", "This is 11" My question is how to sort them using guava to be in the order 1, 2, 10, 11? List&lt;Bean&gt; orderedList = new ArrayList&lt;&gt;(); Function&lt;Bean, String&gt; getNameFunction = new Function&lt;Bean, String&gt;() { @Override public String apply(Bean from) { return from.getShape(); } }; Ordering&lt;Bean&gt; nameOrdering = Ordering.natural().onResultOf(getNameFunction); ImmutableSortedSet&lt;Bean&gt; sortedShapes = ImmutableSortedSet.orderedBy( nameOrdering).addAll(lb).build(); orderedList.addAll(sortedShapes); return orderedList; This is not working like I want it sorts them like 1, 10, 11, 2 Can you please help me? Thank you!
possible better answer: http://stackoverflow.com/a/24171721
tagged with: java
has answer: http://stackoverflow.com/a/24171721
tagged with: string
has title: Sort Strings in java
has comment: http://stackoverflow.com/comment/37308773
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37308949
tagged with: sorting
has comment: http://stackoverflow.com/comment/37308722
accepted answer: http://stackoverflow.com/a/24172890
type: AnsweredQuestion
score: 0
tagged with: guava
has answer: http://stackoverflow.com/a/24172890

selenium
tags question: http://stackoverflow.com/q/24242920
tags question: http://stackoverflow.com/q/24201611
tags question: http://stackoverflow.com/q/24237789
tags question: http://stackoverflow.com/q/24205871
tags question: http://stackoverflow.com/q/24164504
tags question: http://stackoverflow.com/q/24114398
tags question: http://stackoverflow.com/q/24161559
tags question: http://stackoverflow.com/q/24182305
tags question: http://stackoverflow.com/q/24177255
tags question: http://stackoverflow.com/q/24142937
tags question: http://stackoverflow.com/q/24198898
tags question: http://stackoverflow.com/q/24186985
tags question: http://stackoverflow.com/q/24172632
tags question: http://stackoverflow.com/q/24247490
tags question: http://stackoverflow.com/q/24180902
tags question: http://stackoverflow.com/q/24188566
tags question: http://stackoverflow.com/q/24161276
tags question: http://stackoverflow.com/q/24137375
type: Tag
tags question: http://stackoverflow.com/q/24224678
tags question: http://stackoverflow.com/q/24251739
tags question: http://stackoverflow.com/q/24107507
tags question: http://stackoverflow.com/q/24140039
tags question: http://stackoverflow.com/q/24193689
tags question: http://stackoverflow.com/q/24135787
tags question: http://stackoverflow.com/q/24130006
tag name: selenium
tags question: http://stackoverflow.com/q/24242469
tags question: http://stackoverflow.com/q/24138398
tags question: http://stackoverflow.com/q/24252705
tags question: http://stackoverflow.com/q/24130966
tags question: http://stackoverflow.com/q/24255352
tags question: http://stackoverflow.com/q/24219787
tags question: http://stackoverflow.com/q/24210559
tags question: http://stackoverflow.com/q/24158698

http://stackoverflow.com/q/24141942
has title: Getting wrong month when using SimpleDateFormat.parse
tagged with: simpledateformat
tagged with: android
tagged with: java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24141970
answer count: 3
possible better answer: http://stackoverflow.com/a/50232324
has answer: http://stackoverflow.com/a/24141970
has answer: http://stackoverflow.com/a/45934331
linked to: http://stackoverflow.com/q/9831950
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/50232324
downvote count: 0
score: 7
upvote count: 7
favorite count: 0
type: Question
has body: In my programm there is a very strange problem. Here you can see String birthday and Log to check it: birthday = String.valueOf(birthYear) + "-" + String.valueOf(birthMonth) + "-" + String.valueOf(birthDay); Log.i(TAG, "Birthday: " + birthday) Then I put it to SimpleDateFormat and check it with the Log: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); Date birthDate = sdf.parse(birthday); Log.i(TAG, "Birth date : " + birthDate); And then in Logcat I have: I/App﹕ Birthday: 1999-10-15 I/App﹕ Birth date: Fri Jan 15 00:10:00 GMT+04:00 1999 So as you see in the date it is Jan, but in the String it is 10 so date should look like: Fri Nov 15 00:10:00 GMT+04:00 1999 Where is my mistake? P.S I think my question is somehow connected with Getting wrong data when using SimpleDateFormat.parse()

http://stackoverflow.com/q/24216465
tagged with: eclipse
linked to: http://stackoverflow.com/q/20900832
has comment: http://stackoverflow.com/comment/37393842
tagged with: android-emulator
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/38749183
answer count: 3
accepted answer: http://stackoverflow.com/a/24216560
has answer: http://stackoverflow.com/a/24216560
downvote count: 0
score: 4
has body: I'm new to Android Programming. I'm following the guide on Android Developers to get started with Android. When trying to run simple Hello World App on the Emulator, the emulator shows "Unfortunately, My First App has stopped.", where My First App is name of the App. This is my AndroidManifest file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myfirstapp" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.myfirstapp.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; This is my mainactivity file: package com.example.myfirstapp; 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.os.Build; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @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 b…
favorite count: 0
has comment: http://stackoverflow.com/comment/37393986
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24216541
has title: Android Emulator: Unfortunately App has stopped
has comment: http://stackoverflow.com/comment/37393813
has answer: http://stackoverflow.com/a/24216541
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37393867

http://stackoverflow.com/q/24227899
type: UnansweredQuestion
tagged with: java
answer count: 1
downvote count: 3
tagged with: nested
upvote count: 1
tagged with: loops
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37435222
has body: I am trying to create some ASCII art in java using the code below. The triangle should be as follows, this method should work for any number of inputted integer. The triangle below is for an input of 3. * *** ***** This is my attempt. public static void triangle(int n){ for (int i=n;i&gt;0;i--){//number of lines for(int j=i-1;j&gt;0;j--){ System.out.print(" "); } for(int k=n;k&gt;i;k--){ System.out.print("*"); } System.out.print("\n"); }
score: -2
tagged with: ascii
has comment: http://stackoverflow.com/comment/37415005
has answer: http://stackoverflow.com/a/24238388
has title: ASCII Art , nested loop in Java

http://stackoverflow.com/a/24228746
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37417132
accepted answer of: http://stackoverflow.com/q/24228566
has comment: http://stackoverflow.com/comment/37416830
answers question: http://stackoverflow.com/q/24228566
has comment: http://stackoverflow.com/comment/37416640
type: Answer
has comment: http://stackoverflow.com/comment/37416700
has comment: http://stackoverflow.com/comment/37416525
has comment: http://stackoverflow.com/comment/37416771
has body: The exception is caused because of mDb value which is null, you have just initialized it in your onResumer method. I think you made a typo error in name of this method so replace public void onResumer(){ with @Override public void onResume(){
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/37492428
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24260797
type: QuestionComment
has text: The certificate by itself is not a keystore, you should create an empty keystore and [import that certificate into it](http://stackoverflow.com/questions/4325263/how-to-import-a-cer-certificate-into-a-java-keystore).

http://stackoverflow.com/comment/37289117
type: AnswerComment
has text: yes i have Checked the input file and aslo i hv setthe strict mode to false but then also its not working
type: Comment
comment on: http://stackoverflow.com/a/24139589
score: 0

http://stackoverflow.com/a/52913875
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24251183
type: Answer
has body: We couldn't use the library linked in the accepted answer as it glosses over an important detail: In XML Schema date/time values allow the timezone offset to be missing. An adapter must be able to handle this situation. Also, the fact that Java doesn't have a date-only datatype must be supported. jTextTime library solves this. The library revolves around the JDK8 OffsetXXX date/time classes as these are the (only) natural equivalent for the XML Schema types date, dateTime and time. Use like this: Add dependency: com.addicticks.oss jtexttime ... latest ... Annotate your classes: public class Customer { @XmlElement @XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class) @XmlSchemaType(name="dateTime") public OffsetDateTime getLastOrderTime() { .... } @XmlElement @XmlJavaTypeAdapter(OffsetDateXmlAdapter.class) @XmlSchemaType(name="date") public OffsetDateTime getDateOfBirth() { // returns a date-only value .... } } If you don't want to annotate each class individually then you can use package-level annotations as explained here. If you generate Java classes from XSD files using the xjc tool then this is also explained.
score: 1

http://stackoverflow.com/comment/37391279
score: 0
has text: In real world I am going to receive this file from some external systems and they told me you will receive these unicodes like "\u2019" in the input text file. For unit test purpose i tried to create the same type of file that I am going to receive.
type: Comment
comment on: http://stackoverflow.com/q/24215063
type: QuestionComment

http://stackoverflow.com/q/24239091
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/37436586
has answer: http://stackoverflow.com/a/24241211
linked to: http://stackoverflow.com/q/14265183
tagged with: jframe
has comment: http://stackoverflow.com/comment/37436569
downvote count: 0
tagged with: layout-manager
upvote count: 1
has comment: http://stackoverflow.com/comment/37436607
tagged with: swing
has body: I am creating a game in java using Swing. I am using mainJFrame.setExtendedState(mainJFrame.getExtendedState() | JFrame.MAXIMIZED_BOTH); on my JFrame to start it as a maximized window. After this I am using mainJFrame.pack(); to be able to get the correct x &amp; y coordinates of components in the GUI. I need those coordinates since i'm painting custom images to the GUI. So far everything is fine. When a user has passed a level, i rebuild the GUI to updated it to the new level settings and then i call pack() again. When calling pack() the components are placed in the wrong place, slightly below where they are supposed to be. However, manually resizing the window causes the components to go to the right place again. I have tried calling mainJFrame.revalidate() and mainJFrame.repaint() after the pack() but this gives no effect. If needed I can supply printscreens and code. Thanks for your time.
has comment: http://stackoverflow.com/comment/37436699
has title: .pack() causes the components to be in the wrong place but works after window resize
type: AnsweredQuestion
tagged with: java
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/37436901
accepted answer: http://stackoverflow.com/a/24241211

http://stackoverflow.com/a/24216323
has comment: http://stackoverflow.com/comment/37693460
has comment: http://stackoverflow.com/comment/37693396
has comment: http://stackoverflow.com/comment/37425443
has comment: http://stackoverflow.com/comment/37619558
type: Answer
has body: It would be a lot easier to use the HTTP protocol in order to have better control on the boundaries of your requests and the responses. Have a look at HTTPUrlConnection. Here is a nice sample. EDIT: After reviewing in detail the requirements (see comments), I suggested an alternate approach by using Spark streaming api in order to consume "stock tick data".
has comment: http://stackoverflow.com/comment/37615648
accepted answer of: http://stackoverflow.com/q/24214725
score: 0
has comment: http://stackoverflow.com/comment/37693010
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37728594
answers question: http://stackoverflow.com/q/24214725
has comment: http://stackoverflow.com/comment/37730505
has comment: http://stackoverflow.com/comment/37502977
has comment: http://stackoverflow.com/comment/37546647

http://stackoverflow.com/a/24199705
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24199640
downvote count: 0
type: Answer
has body: The problem is, you've create an inline anonymous inner class, which means you have no external reference to it... You could create the ActionListener, but first assign it to a instance variable private ActionListener actionListener; //... actionListener = new ActionListener() {...}; comboBox.addActionListener(actionListener); Then you could remove it later using... comboBox.removeActionListener(actionListener);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24199640

http://stackoverflow.com/q/24243854
type: AnsweredQuestion
downvote count: 11
possible better answer: http://stackoverflow.com/a/24243907
has body: public class MyStuff { String name; MyStuff(String n) { name = n; } public static void main(String[] args) { MyStuff m1 = new MyStuff("guitar"); MyStuff m2 = new MyStuff("tv"); System.out.println(m2.equals(m1)); } public boolean equals(Object o) { MyStuff m = (MyStuff) o; if (m.name != null) return true; return false; } } When i remove one of the return statements, compiler gives an error: This method must return a result of type boolean
has comment: http://stackoverflow.com/comment/37445554
has answer: http://stackoverflow.com/a/24243907
has answer: http://stackoverflow.com/a/24243915
tagged with: java
has answer: http://stackoverflow.com/a/24243957
has answer: http://stackoverflow.com/a/24243997
has comment: http://stackoverflow.com/comment/37446653
has comment: http://stackoverflow.com/comment/37445770
answer count: 4
has comment: http://stackoverflow.com/comment/37445867
favorite count: 0
type: Question
score: -9
has comment: http://stackoverflow.com/comment/37445550
accepted answer: http://stackoverflow.com/a/24243915
tagged with: return
tagged with: equals
has title: Why 2 return statements are mandatory in equals method
upvote count: 2
has comment: http://stackoverflow.com/comment/37445579
has comment: http://stackoverflow.com/comment/37445496
has comment: http://stackoverflow.com/comment/37445507

http://stackoverflow.com/q/24212191
downvote count: 1
has comment: http://stackoverflow.com/comment/37385738
tagged with: arraylist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37385685
has title: Randomly sorting (by fulfilling some conditions)
has comment: http://stackoverflow.com/comment/37385728
has comment: http://stackoverflow.com/comment/37385650
tagged with: java
has comment: http://stackoverflow.com/comment/37385692
has comment: http://stackoverflow.com/comment/37385691
accepted answer: http://stackoverflow.com/a/24212286
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24212286
has comment: http://stackoverflow.com/comment/37385839
upvote count: 2
tagged with: algorithm
has comment: http://stackoverflow.com/comment/37385810
answer count: 1
tagged with: sorting
score: 1
has body: I'm looking for an algorithm that can make a random sorting but by fulfilling some conditions. For example: List: {1,2,3,4,5,6,7,8,9} Conditions: {(4 before 8), (6 before 1), (3 before 2)} So in the random sort of the list number 4 must be before number 8 and so on... I need this in Java (with ArrayList) but I can't find an algorithm to do it! If anybody knows an algorithm that does this thing please write the name of Algorithm in answer or if you have a clue how to solve it a little explanation would be nice.

http://stackoverflow.com/a/24179812
upvote count: 105
type: Answer
answers question: http://stackoverflow.com/q/24113939
has comment: http://stackoverflow.com/comment/41551375
score: 104
downvote count: 1
has comment: http://stackoverflow.com/comment/81625490
has body: There's section 19.2 in Spring Boot Reference that tells you about starting your application with remote debugging support enabled. $ java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n \ -jar target/myproject-0.0.1-SNAPSHOT.jar After you start your application just add that Remote Java Application configuration in Run/Debug configurations, select the port/address you defined when starting your app, and then you are free to debug.

http://stackoverflow.com/a/24131641
answers question: http://stackoverflow.com/q/24131465
type: Answer
has body: if you want to shift right and circularly, from 1 to end by pos positions this is what you can do: public void shift(int pos) { while (pos-- &gt; 0) {//shift 1 right for pos number of times //notice the data.length-1 for the last item. data.length as index would be out of bound. int tmp = data[data.length - 1]; //start from the last and keep shifting the left one to current. for (int i = data.length - 1; i &gt; 1; i--) { data[i] = data[i - 1]; } //since it's a circular shift, last one (before shifting) will shift to 1 index. data[1] = tmp; } }
score: 0

http://stackoverflow.com/comment/37339135
has text: What browser are you using? Looks like the browser is requesting the source URL including the '?' for the .eot file and jetty is trying to resolve that to the local filesystem path without stripping off the '?', which would be invalid on Windows. The stylesheet for that font follows the guidance here -> http://stackoverflow.com/questions/8050640/how-does-iefix-solve-web-fonts-loading-in-ie6-ie8 Though not sure which is at fault here, the browser or Jetty.
comment on: http://stackoverflow.com/q/24171254
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37464551
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24253171
has text: Coffee=[1, 4], Bread=[1, 2, 3, 4, 5], Sundae=[3, 4, 5] ... If this is my map then check_set can have {"Bread","Sundae"} and the method should return {3,4,5}
type: Comment

http://stackoverflow.com/q/24218875
type: Question
answer count: 2
type: UnansweredQuestion
has body: I'm New to Junit and am stuck on an issue. Any help would be really appreciated. public void testGuaranteedRates() throws Exception { ParticipantSummary summary = new ParticipantSummary(); EasyMock.expect( iRequest.getPIN() ).andReturn( "1060720" ); DateFormat dateFormat = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" ); Date date = new Date(); EasyMock.expect( iRequest.getTradeDate() ).andReturn( date ).anyTimes(); EasyMock.expect( control.prepareServiceRequest( iRequest ) ).andReturn( rtvint ); EasyMock.replay(); ems.replayAll(); } The method prepareServiceRequest() is as below org.tiaa.transact.generated.jaxb.inquiry.RetrieveRetirementVintages prepareServiceRequest(InquiryRequest inquiryRequest) { logger.debug( "prepareServiceRequest enter" ); org.tiaa.transact.generated.jaxb.inquiry.ObjectFactory objectFactory = new org.tiaa.transact.generated.jaxb.inquiry.ObjectFactory(); org.tiaa.transact.generated.jaxb.inquiry.RetrieveRetirementVintages retirementVintages = objectFactory.createRetrieveRetirementVintages(); if( ( inquiryRequest ) != null ) { if( ( inquiryRequest.getPIN() ) != null ) { retirementVintages.setPIN( inquiryRequest.getPIN() ); } if( ( inquiryRequest.getTradeDate() != null ) ) { Calendar cal = new GregorianCalendar(); //retirementVintages.setTradeDate( TPDateUtil.convertDatetoXMLGregorianCalendar( inquiryRequest.getTradeDate() ) ); //retirementVintages.setTradeDate(( inquiryRequest.getTradeDate() ); } } logger.debug( "prepareServiceRequest exit" ); return retirementVintages; } When i tried to test it , I'm getting an error as below java.lang.IllegalStateException: missing behavior definition for the preceding method call: InquiryRequest.getPIN() Could anyone please let me know if anything is wrong here.
has comment: http://stackoverflow.com/comment/37398855
has answer: http://stackoverflow.com/a/24219074
score: 7
tagged with: java
tagged with: junit
downvote count: 0
tagged with: easymock
upvote count: 7
has answer: http://stackoverflow.com/a/26181269
has title: missing behavior definition for the preceding method call:Usage is: expect(a.foo()).andXXX()
favorite count: 0

http://stackoverflow.com/a/69539079
has comment: http://stackoverflow.com/comment/122912713
upvote count: 0
downvote count: 1
has body: public String generateRandomMacAddress() { Random r = new Random(); return RandomStringUtils.randomAlphabetic(1) + r.nextInt(11)+ &quot;:&quot; + r.nextInt(11) + r.nextInt(11) + &quot;:&quot; + RandomStringUtils.randomAlphabetic(2)+&quot;:&quot;+ r.nextInt(11)+RandomStringUtils.randomAlphabetic(1)+&quot;:&quot;+ r.nextInt(11)+RandomStringUtils.randomAlphabetic(1); } ``
type: Answer
answers question: http://stackoverflow.com/q/24261027
score: -1

http://stackoverflow.com/a/24232196
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24232141
type: Answer
has body: As you noticed when you are trying to put incorrect type into array JVM is able to stop at runtime by throwing ArrayStoreException. But in case of generics such mechanism is impossible (at least in if you are not using checked list) because of type erasure so since JVM can't stop you at runtime it stops you earlier at compilation time.
answers question: http://stackoverflow.com/q/24232141
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/37369095
comment on: http://stackoverflow.com/a/24203834
score: 0
type: AnswerComment
type: Comment
has text: thanku..In which file I have to do change?I am new to ubuntu..Should I re-install maven??

http://stackoverflow.com/q/24187746
upvote count: 1
accepted answer: http://stackoverflow.com/a/24191589
has answer: http://stackoverflow.com/a/24188679
favorite count: 0
has answer: http://stackoverflow.com/a/24191589
type: AnsweredQuestion
has title: JFrame and JOptionPane are not clear
score: 1
has comment: http://stackoverflow.com/comment/37338274
tagged with: java
has comment: http://stackoverflow.com/comment/37338425
has body: Whenever I execute JFrame of JOptionPane this is how its displayed. I have the latest version of eclipse and JDK. I use Windows 8. What might be the issue?! public static void main(String args[]){ String disp="2.40894673"; JOptionPane.showMessageDialog(null, disp); } the problem occurs in all the codes. This is a sample code I wrote th problem occurs in this too.
linked to: http://stackoverflow.com/q/4720190
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37338334
possible better answer: http://stackoverflow.com/a/24188679
downvote count: 0

http://stackoverflow.com/comment/37415941
score: 1
type: Comment
type: AnswerComment
has text: @lonesome Most likely the bottle neck is your download speed. Only if you seeing high CPU utilisation (ignoring system time) does it suggest a larger buffer might help btw there is no harm in trying this yourself. Try 4 KB, 16 KB, 64 KB etc and see if you think it makes a difference.
comment on: http://stackoverflow.com/a/24227784

http://stackoverflow.com/q/24183224
has comment: http://stackoverflow.com/comment/37331619
possible better answer: http://stackoverflow.com/a/24183769
has comment: http://stackoverflow.com/comment/37330503
has comment: http://stackoverflow.com/comment/37329299
has comment: http://stackoverflow.com/comment/37330521
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37330258
has comment: http://stackoverflow.com/comment/37330136
has comment: http://stackoverflow.com/comment/37329841
score: 3
accepted answer: http://stackoverflow.com/a/24184615
has comment: http://stackoverflow.com/comment/37329547
answer count: 3
has comment: http://stackoverflow.com/comment/37350360
has comment: http://stackoverflow.com/comment/37329364
has comment: http://stackoverflow.com/comment/37330106
tagged with: visibility
has answer: http://stackoverflow.com/a/24184615
has body: I have a JFrame that I create in the main function. I want to add a JTextField to it. The problem I'm having is that the JFrame is created and then - with about a second delay - the JTextField is added. Is there a way I can draw the text field to my window and then show all at once? Thanks in advance! For reference, here is my code: public class Window { public static final JFrame window = new JFrame(); public static final JTextField input = new JTextField(); private static void loadWindow(){ window.setSize(800, 600); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setLayout(new FlowLayout()); input.setPreferredSize(new Dimension(400, 60)); window.add(input); window.setVisible(true); } public static void main(String[] args){ loadWindow(); } } Here's the timeline of what's happening: First second: Second after:
upvote count: 3
has comment: http://stackoverflow.com/comment/37356494
tagged with: java
has comment: http://stackoverflow.com/comment/37330485
has comment: http://stackoverflow.com/comment/37330442
downvote count: 0
has comment: http://stackoverflow.com/comment/37330977
has title: Adding Contents to JFrame Before Setting Visible
tagged with: swing
has comment: http://stackoverflow.com/comment/37329768
favorite count: 0
has answer: http://stackoverflow.com/a/24183769
has comment: http://stackoverflow.com/comment/37329930
type: Question
has comment: http://stackoverflow.com/comment/37329674
tagged with: object
linked to: http://stackoverflow.com/q/15655012
has answer: http://stackoverflow.com/a/24184474
has comment: http://stackoverflow.com/comment/37329451
has comment: http://stackoverflow.com/comment/37330936
has comment: http://stackoverflow.com/comment/37330652
has comment: http://stackoverflow.com/comment/37330404
has comment: http://stackoverflow.com/comment/37329667
has comment: http://stackoverflow.com/comment/37329858
has comment: http://stackoverflow.com/comment/37330177

http://stackoverflow.com/q/24192199
possible better answer: http://stackoverflow.com/a/24192318
has answer: http://stackoverflow.com/a/24193218
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24192318
answer count: 2
tagged with: validation
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/6416065
favorite count: 0
type: Question
has title: Java regular expression for file path
has body: I am developing an application a where user need to supply local file location or remote file location. I have to do some validation on this file location. Below is the requirement to validate the file location. Path doesn't contain special characters * | " &lt; &gt; ?. And path like "c:" is also not valid. Paths like c:\, c:\newfolder, \\casdfhn\share are valid while c: non, \\casfdhn are not. I have implemented the code based on this requirement: String FILE_LOCATION_PATTERN = "^(?:[\\w]\\:(\\[a-z_\\-\\s0-9\\.]+)*)"; String REMOTE_LOCATION_PATTERN = "\\\\[a-z_\\-\\s0-9\\.]+(\\[a-z_\\-\\s0-9\\.]+)+"; Pattern locationPattern = Pattern.compile(FILE_LOCATION_PATTERN); Matcher locationMatcher = locationPattern.matcher(iAddress); if (locationMatcher.matches()) { return true; } locationPattern = Pattern.compile(REMOTE_LOCATION_PATTERN); locationMatcher = locationPattern.matcher(iAddress); return locationMatcher.matches(); Test: worklocation' pass 'C:\dsrasr' didnt pass (but should pass) 'C:\saefase\are' didnt pass (but should pass) '\\asfd\sadfasf' didnt pass (but should pass) '\\asfdas' didnt pass (but should not pass) '\\' didnt pass (but should not pass) 'C:' passed infact should not pass I tried many regular expression but didn't satisfy the requirement. I am looking for help for this requirement.
has comment: http://stackoverflow.com/comment/71299172
accepted answer: http://stackoverflow.com/a/24193218
tagged with: regex
score: 4

http://stackoverflow.com/q/24149519
type: Question
score: 5
type: UnansweredQuestion
has body: Should it pass the test when the expected exception takes place? Should it fail the test when an unexpected exception arises? Is it redundant to handle the exception since it'll fail the test and therefore act as a test?
has answer: http://stackoverflow.com/a/24279977
upvote count: 5
has answer: http://stackoverflow.com/a/24149620
has comment: http://stackoverflow.com/comment/37270028
answer count: 4
has answer: http://stackoverflow.com/a/24149651
has answer: http://stackoverflow.com/a/24149682
has comment: http://stackoverflow.com/comment/37267253
has title: How should a unit test deal with expected and unexpected exceptions?
tagged with: java
tagged with: junit
downvote count: 0
tagged with: unit-testing
favorite count: 0

http://stackoverflow.com/comment/37383261
comment on: http://stackoverflow.com/q/24210905
type: Comment
score: 0
type: QuestionComment
has text: Consider using an array of char or a StringBuilder object, and then swapping char's as needed.

http://stackoverflow.com/a/24161338
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24161127
type: Answer
has body: Your code is correct so far, but your Map should declare with type The map should be declared based on the type of reportID, //if String private Map&lt;String, List&lt;String&gt;&gt; accountByReport; //if int private Map&lt;Integer, List&lt;String&gt;&gt; accountByReport; //so on
score: 1

http://stackoverflow.com/q/24249172
has title: What Spring has to do with static context
answer count: 1
downvote count: 1
favorite count: 0
type: Question
tagged with: static
has body: I removed static from DAO methods and sessionFactory. Now IDE makes me switch back to use static DAO methods because it says Non-static method updatePrice(long) cannot be referenced form a static context. Neither of classes includes static keyword. What's wrong? How to fix it? ServiceActionDAO @Transactional public class ServiceActionDAO{ @Autowired SessionFactory sessionFactory; public void insert(ServiceActionEntity paramServiceAction){ Transaction localTransaction = null; try{ Session localSession = sessionFactory.getCurrentSession(); localSession.save(paramServiceAction); localSession.getTransaction().commit(); ServiceOrderDAO.updatePrice(paramServiceAction.getServiceOrderFk().longValue());// error } catch (Exception localException){ if (localTransaction != null) { localTransaction.rollback(); } } } UPDATE I find a quick way to solve this problem by replacing error line with: new ServiceOrderDAO().updatePrice(paramServiceAction.getServiceOrderFk().longValue()); Now it's not a static call. UPDATE 2 I have a lot of DAO classes and a number of controllers. I have to find quick fix with minimum code changes taking into account Spring architecture. I have one DAO calls one or more DAOs to perform some complex queries. As was denoted before: creating new instance of DAO would lead to unpredictable Spring session behavior. It appears that my controllers also have calls for DAO classes. What is the easiest way (with minimum code changes) to fix this problem? UPDATE 3 Ended up injecting DAO into DAOs and Controllers. It seems like quick fix but from the conceptual point of view I doubt that this is the best solution...
has answer: http://stackoverflow.com/a/24249269
accepted answer: http://stackoverflow.com/a/24249269
has comment: http://stackoverflow.com/comment/37455995
has comment: http://stackoverflow.com/comment/37458262
tagged with: spring
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37458217
upvote count: 1
tagged with: java

http://stackoverflow.com/a/24179933
upvote count: 2
answers question: http://stackoverflow.com/q/24179569
type: Answer
has comment: http://stackoverflow.com/comment/37325685
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24179569
has body: if you use eclipse IDE than with use of it you can change the VM argument double click on the server &gt; open Lunch Configuration &gt; Arguments &gt; VM Arguments and append below two lines in your VM Arguments field -Xms256m -Xmx1024m -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote -XX:PermSize=256m -XX:MaxPermSize=512m it will sure solve your problem

http://stackoverflow.com/a/53223864
answers question: http://stackoverflow.com/q/24172770
has body: Add this custom property com.ibm.ws.cdi.enableCDI to false under Java Virtual Machine. This will disable CDI and enable JSP reload without application or server restart.
score: 0
has comment: http://stackoverflow.com/comment/93337794
has comment: http://stackoverflow.com/comment/93360829
has comment: http://stackoverflow.com/comment/93360361
type: Answer

generics
tags question: http://stackoverflow.com/q/24213145
tags question: http://stackoverflow.com/q/24151641
tags question: http://stackoverflow.com/q/24227896
tags question: http://stackoverflow.com/q/24230580
tags question: http://stackoverflow.com/q/24164984
tags question: http://stackoverflow.com/q/24119122
tags question: http://stackoverflow.com/q/24125439
tags question: http://stackoverflow.com/q/24222861
tags question: http://stackoverflow.com/q/24199148
tags question: http://stackoverflow.com/q/24180679
tags question: http://stackoverflow.com/q/24150567
tags question: http://stackoverflow.com/q/24146505
tags question: http://stackoverflow.com/q/24230349
tags question: http://stackoverflow.com/q/24262426
tags question: http://stackoverflow.com/q/24249455
tags question: http://stackoverflow.com/q/24223470
tags question: http://stackoverflow.com/q/24144418
tags question: http://stackoverflow.com/q/24232141
tags question: http://stackoverflow.com/q/24115064
tags question: http://stackoverflow.com/q/24115354
tags question: http://stackoverflow.com/q/24179440
tags question: http://stackoverflow.com/q/24217213
tags question: http://stackoverflow.com/q/24130279
tags question: http://stackoverflow.com/q/24208531
tags question: http://stackoverflow.com/q/24182074
tags question: http://stackoverflow.com/q/24172694
tags question: http://stackoverflow.com/q/24254210
tags question: http://stackoverflow.com/q/24214650
tags question: http://stackoverflow.com/q/24240085
tags question: http://stackoverflow.com/q/24188824
tags question: http://stackoverflow.com/q/24181305
tags question: http://stackoverflow.com/q/24235827
tags question: http://stackoverflow.com/q/24113818
tags question: http://stackoverflow.com/q/24116180
tags question: http://stackoverflow.com/q/24251604
type: Tag
tags question: http://stackoverflow.com/q/24160311
tags question: http://stackoverflow.com/q/24197566
tags question: http://stackoverflow.com/q/24190997
tags question: http://stackoverflow.com/q/24222799
tags question: http://stackoverflow.com/q/24229225
tags question: http://stackoverflow.com/q/24139986
tags question: http://stackoverflow.com/q/24221753
tags question: http://stackoverflow.com/q/24188078
tags question: http://stackoverflow.com/q/24181773
tag name: generics
tags question: http://stackoverflow.com/q/24168578
tags question: http://stackoverflow.com/q/24188657
tags question: http://stackoverflow.com/q/24220606
tags question: http://stackoverflow.com/q/24123959
tags question: http://stackoverflow.com/q/24174525
tags question: http://stackoverflow.com/q/24152797
tags question: http://stackoverflow.com/q/24247687
tags question: http://stackoverflow.com/q/24168718
tags question: http://stackoverflow.com/q/24171300
tags question: http://stackoverflow.com/q/24263769
tags question: http://stackoverflow.com/q/24256855
tags question: http://stackoverflow.com/q/24145100
tags question: http://stackoverflow.com/q/24251117

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/24135937

http://stackoverflow.com/q/24253097
has answer: http://stackoverflow.com/a/24253136
accepted answer: http://stackoverflow.com/a/24253210
type: Question
has comment: http://stackoverflow.com/comment/37464097
has comment: http://stackoverflow.com/comment/37463941
has answer: http://stackoverflow.com/a/24253210
has comment: http://stackoverflow.com/comment/37463934
score: 0
upvote count: 1
tagged with: string
downvote count: 1
has body: I need to read the contents of a file. The file contains the names various foods and information regarding portions: Name: Portions: APPLE JUICE, CANNED 1 CUP APPLE PIE 1 PIE How can I read the entire name of a food item without including the portions?
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24253136
linked to: http://stackoverflow.com/q/1102891
answer count: 2
tagged with: java
has title: Read strings until an integer appears

http://stackoverflow.com/comment/37216813
type: Comment
comment on: http://stackoverflow.com/a/24119858
type: AnswerComment
score: 0
has text: It was a good idea; however, it doesn't seem to work when I copy and pasted the method into my program

http://stackoverflow.com/comment/78509253
type: Comment
has text: Just adding a note to say that code is not correct. A Java BigInteger has an extra zero byte prepended only if it's a positive value with the highest bit set in its magnitude (not including a sign bit). The inputs in the original post show this clearly. `F23456789A` has the highest bit in the first byte `F2` set, so it needs the extra byte (to contain the sign bit). `123456789A` doesn't. Similarly `723456789A` doesn't. But `823456789A` does. This can easily be checked.
type: AnswerComment
score: 4
comment on: http://stackoverflow.com/a/39790979

http://stackoverflow.com/q/24201382
tagged with: swing
has answer: http://stackoverflow.com/a/24201414
favorite count: 0
type: Question
tagged with: runtime-error
linked to: http://stackoverflow.com/q/218384
tagged with: nullpointerexception
score: 1
tagged with: java
has title: Swing NullPointer
has body: Hi i'm trying to add actionlistener that would take an input from the user and change the color of the background, but i'm getting this error... would you please be specific and give an answer for a beginner... thanks enter code here package Quizzes_practice; import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class TextField1 extends JFrame { private JPanel mainpanel; private JLabel text; private JTextField mytext; private JTextField bg; public TextField1(){ setLayout(new GridLayout(2,0)); JPanel mainpanel = new JPanel(); JLabel text = new JLabel("Enter value: "); JTextField mytext = new JTextField(10); JTextField bg = new JTextField(40); add(mainpanel); mainpanel.setLayout(new FlowLayout()); mainpanel.add(text); mainpanel.add(mytext); mainpanel.add(bg); myhand handler = new myhand(); mytext.addActionListener(handler); bg.addActionListener(handler); } private class myhand implements ActionListener{ public void actionPerformed (ActionEvent event){ int a2 = Integer.parseInt(event.getActionCommand()); Color mycol= new Color(a2); mainpanel.setBackground(mycol); } } } the error i'm getting is Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Quizzes_practice.TextField1$myhand.actionPerformed(TextField1.java:47) at javax.swing.JTextField.fireActionPerformed(Unknown Source) at javax.swing.JTextField.postActionEvent(Unknown Source) at javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source) at javax.swing.SwingUtilities.notifyAction(Unknown Source) at javax.swing.JComponent.processKeyBinding(Unknown Source) at javax.swing.JComponent.processKeyBindings(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) …
accepted answer: http://stackoverflow.com/a/24201414
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37364609
has comment: http://stackoverflow.com/comment/37364644
upvote count: 1
duplicate of: http://stackoverflow.com/q/218384
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37410510
has text: `doc.body().text()` Only removes `span` tags when it compiles text, but not if a div tag is used.
score: 0
comment on: http://stackoverflow.com/a/24225447
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24185025
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37332989
has answer: http://stackoverflow.com/a/24185896
type: Question
has comment: http://stackoverflow.com/comment/37332990
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37333205
has title: How to create xml from java object
has body: My xml output structure is as below and have created java ojects with this format. How do i create xml using JAXB - marshalling. I'm unable to set the element names and other details. Facing issues in creating the xml starting with the root element itself. <?xml version="1.0" encoding="UTF-8"?> <page-details> name1 <field> <srv_field>number</srv_field> <ui_field>No</ui_field> Y <field> name2 <field> <srv_field>number2</srv_field> <ui_field>No</ui_field> Y <field> <page-details> MenuDetails.class package com.ui.mig.menuvo; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "menu" }) @XmlRootElement(name = "menu-details") public class MenuDetails { protected List<MenuDetails.Menu> menu; public List<MenuDetails.Menu> getMenu() { if (menu == null) { menu = new ArrayList<MenuDetails.Menu>(); } return this.menu; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "group" }) public static class Menu { protected List<MenuDetails.Menu.Group> group; @XmlAttribute(name = "name", namespace = "http://www.com//") protected String name; public List<MenuDetails.Menu.Group> getGroup() { if (group == null) { group = new ArrayList<MenuDetails.Menu.Group>(); } return this.group; } public String getName() { return name; } public void setName(String value) { this.name = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "pageDetails" }) public static class Group { @XmlElement(name = "page-details", required = true) protected MenuDetails.Menu.Group.PageDetails pageDetails; @XmlAttribute(name = "name", namespace = "http://www..com/") protected String…
has comment: http://stackoverflow.com/comment/37332900

http://stackoverflow.com/comment/37598257
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24249900
has text: Regrettably this answers a different question.

http://stackoverflow.com/comment/37266645
type: Comment
has text: @naresh Do you mean Irish Standard Time, India Standard Time, or Israel Standard Time? Reread my second paragraph and Jon Skeet's comment.
comment on: http://stackoverflow.com/a/24149026
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37431354
type: QuestionComment
comment on: http://stackoverflow.com/q/24232351
score: 0
type: Comment
has text: @Pasoon: I pointed that out for a reason, since, now as suggested in the answer, you be mixing both `Swing` and `AWT` components together(JFrame - Canvas), which is not a good practice. Moreover, in the code, KeyListeners are used, when [KeyBinding](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html), is to be used. `paint()` method is used, instead `paintComponent()` should be used, these are some of the thingies I can see in a quick review. IMHO, I doubt, where this accepted answer will take you.

http://stackoverflow.com/comment/37246075
type: Comment
comment on: http://stackoverflow.com/a/24136551
type: AnswerComment
has text: As far as the Java code above is concerned, how should it be passed from Matlab to Java?
score: 0

http://stackoverflow.com/q/24107895
linked to: http://stackoverflow.com/q/5621338
type: Question
has answer: http://stackoverflow.com/a/24108287
answer count: 2
tagged with: jframe
tagged with: swing
linked to: http://stackoverflow.com/q/17874717
linked to: http://stackoverflow.com/q/9554636
possible better answer: http://stackoverflow.com/a/24108287
has title: Close the current window and open the previous window?
type: AnsweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/15302085
has body: I am a beginner to java and stuck with the below issue. The purpose is to display the login window when log out button is pressed. First JFrame window displayed is "Plain" with 2 fields username and password(I will be adding the log in functionality later) When I press the submit button the JFrame "NEw Window" is displayed with the button "LOGOUT" What I would like to do is that when the "LOGOUT" is pressed the "NEw Window" should close and the "Plain" window should open. Present issue: When "LOGOUT" button is pressed the "NEw Window" is opening up. Please correct the code so that I get the desired functionality import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; class Test implements ActionListener{ JButton submit; JFrame j; JFrame jf; public Test() { j = new JFrame("PLAIN"); j.setBounds(500,150,300,400); j.setVisible(true); j.setDefaultCloseOperation(j.EXIT_ON_CLOSE); JPanel panel = new JPanel(); j.add(panel); panel.setSize(50, 50); panel.setLayout(null); JLabel label = new JLabel("User Name"); label.setSize(10,10); label.setBounds(100, 30, 400, 30); panel.add(label); JTextField username = new JTextField(10); username.setSize(10,10); username.setBounds(300, 30, 400, 30); panel.add(username); JLabel password= new JLabel("Password"); password.setBounds(100, 90, 400, 30); panel.add(password); JPasswordField pass = new JPasswordField(10); pass.setBounds(300, 90, 400, 30); panel.add(pass); submit = new JButton("Submit"); submit.setSize(10, 10); submit.setBounds(300, 160, 200, 40); panel.add(submit); submit.addActionListener(this); } public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub j.setVisible(false); jf = new JFrame("NEw Window"); jf.setVisible(true); jf.setBounds(500,150,300,400); JPanel panel2 = new JPanel(); panel2.setLayout(null); jf.add(panel2); JButton logout = new JButton("LOGOUT"); logout.setBounds(100, 30, 400, 30); panel2.add(logout); logout.addActionListener(this); …
has comment: http://stackoverflow.com/comment/37197267
has answer: http://stackoverflow.com/a/24108135
accepted answer: http://stackoverflow.com/a/24108135
linked to: http://stackoverflow.com/q/7196889
has comment: http://stackoverflow.com/comment/37197261

http://stackoverflow.com/comment/37505585
has text: Thank you for your answer. I found the answer in your answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24250031
type: AnswerComment

http://stackoverflow.com/comment/37274358
comment on: http://stackoverflow.com/q/24152397
has text: You aren't the one calling `processTask`, Spring is. See the Spring documentation section on supported method arguments.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37227813
comment on: http://stackoverflow.com/q/24128318
type: QuestionComment
type: Comment
has text: No probs, glad I could help
score: 0

repaint
tags question: http://stackoverflow.com/q/24222976
tag name: repaint
type: Tag
tags question: http://stackoverflow.com/q/24125249

http://stackoverflow.com/a/24153521
answers question: http://stackoverflow.com/q/24153230
score: 0
has body: The way it looks like you are doing this is transforming the point coordinates so that they are aligned with and relative to the view. If you do this the right way then you can just check that the rotated z-value is positive and greater than the distance from the focal-point to the "lens". Find the view direction vector: V = (cos(a)sin(b), sin(a)sin(b), cos(b)), where a and b are the camera's rotation angles. Project the offset vector (xx, yy, zz) onto the view direction vector, and find the magnitude, giving the distance along the camera's view axis of the point: distance = xx * cos(a)sin(b) + yy * sin(a)sin(b) + zz * cos(b) Now just check that distance &gt; focalLength. This should work but you have to be careful to set everything up right. You might have to use a different calculation to find the view direction vector depending on how you are representing the camera's orientation.
type: Answer

http://stackoverflow.com/comment/37312283
comment on: http://stackoverflow.com/q/24173421
type: QuestionComment
has text: It looks like you never assign the input to your `choice` variable. You also have a class instance of Scanner, as well as a local one, not that it would cause any problems, but it's redundant code.
type: Comment
score: 0

http://stackoverflow.com/comment/37394015
type: AnswerComment
has text: @user3580294 - No, even that won't work. 1) You can only stop / pause the threads one at a time ... not all at once like the OP wants. 2) If you stopped / paused all of the threads, the thread that did the act would also be stopped / paused, and would be unable to unpause.
score: 2
type: Comment
comment on: http://stackoverflow.com/a/24216549

http://stackoverflow.com/q/24236101
tagged with: arrays
has answer: http://stackoverflow.com/a/24236150
has answer: http://stackoverflow.com/a/24236264
possible better answer: http://stackoverflow.com/a/24236148
type: Question
has answer: http://stackoverflow.com/a/24236148
type: AnsweredQuestion
has title: How to sort object array list in reverse order in java or android?
tagged with: android
tagged with: sorting
has body: I currently have a array list like this beaconsList = new Beacon[] {new Beacon("ebefd083-70a2-47c8-9837-e7b5634df520", "park",0),new Beacon("ebefd083-70a2-47c8-9837-e7b5634df521", "shop",0),new Beacon("ebefd083-70a2-47c8-9837-e7b5634df522", "menu",0),new Beacon("ebefd083-70a2-47c8-9837-e7b5634df523", "weather",0),new Beacon("ebefd083-70a2-47c8-9837-e7b5634df524", "video",0)} ; So , I have create a sorting method like this, whether the rssi is the last field of the object, it is a negative integer, I found the result is the opposite, so I wonder are there any way to reverse the order in comparison? Thanks for helping Arrays.sort(beaconsList, new Comparator&lt;Beacon&gt;() { @Override public int compare(Beacon lhs, Beacon rhs) { return Integer.compare(lhs.rssi, rhs.rssi); } });
answer count: 3
score: 0
accepted answer: http://stackoverflow.com/a/24236264
tagged with: java

http://stackoverflow.com/a/24265247
score: 1
answers question: http://stackoverflow.com/q/24265038
type: Answer
has comment: http://stackoverflow.com/comment/37486733
has comment: http://stackoverflow.com/comment/37487435
has body: The environment variables you are using are OS-dependent, so of course they will not work across all platforms. Try the following for OS X: public class Test { public static void main(String[] args) { System.out.println("Is 64Bit? " + is64BitMacOS()); } public static boolean is64BitMacOS() { java.io.BufferedReader input = null; try { String line; Process proc = Runtime.getRuntime().exec("sysctl hw"); input = new java.io.BufferedReader(new java.io.InputStreamReader(proc.getInputStream())); while ((line = input.readLine()) != null) { if (line.length() &gt; 0) { if ((line.indexOf("cpu64bit_capable") != -1) &amp;&amp; (line.trim().endsWith("1"))) { return true; } } } } catch (Exception ex) { System.err.println(ex.getMessage()); } finally { try { input.close(); } catch (Exception ex) { System.err.println(ex.getMessage()); } } return false; } }
has comment: http://stackoverflow.com/comment/37486770
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37486617

http://stackoverflow.com/comment/113584161
has text: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/222620/discussion-between-geek-and-ben75).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24228529
type: Comment

http://stackoverflow.com/comment/37413310
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24180756
has text: Thanks Andrei I, because i use the eclipse, and the if i added only it will not working fine so i have to add the class on the persistence.xml also to be working fine.

http://stackoverflow.com/a/24147592
has body: The tomcat loads jars in the following order (extract from here: http://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html): bootstrap (JRE/lib/ext folder) system (can't used to add yours) webapp libraries (first WEB-INF/classes, then WEB-INF/lib) common libraries (check the common.loader property , then tomcat instance/lib, then common tomcat folder/lib) So if you want to specify the order, just put the jars in the right place.
type: Answer
has comment: http://stackoverflow.com/comment/37264931
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/37276805
answers question: http://stackoverflow.com/q/24146028
downvote count: 0

http://stackoverflow.com/comment/37384065
comment on: http://stackoverflow.com/q/24211335
has text: The phone is of course connected to the Wifi, but I am not shure whether the message is sent via the wifi or 3g. How do I know that?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43248257
type: Comment
has text: http://stackoverflow.com/questions/27039042/in-littleproxy-how-to-set-proxy-ip-and-port
score: 0
comment on: http://stackoverflow.com/q/24235099
type: QuestionComment

http://stackoverflow.com/comment/37406666
score: 0
type: Comment
type: QuestionComment
has text: I've posted the error in the first post, you can see it now.
comment on: http://stackoverflow.com/q/24222507

http://stackoverflow.com/comment/37200211
type: QuestionComment
comment on: http://stackoverflow.com/q/24113776
has text: You can call the hidden method: http://stackoverflow.com/a/5059064/2670792
score: 0
type: Comment

deserialization
type: Tag
tags question: http://stackoverflow.com/q/24143440
tags question: http://stackoverflow.com/q/24112099
tags question: http://stackoverflow.com/q/24233687
tags question: http://stackoverflow.com/q/24228617
tags question: http://stackoverflow.com/q/24259683
tags question: http://stackoverflow.com/q/24171649
tags question: http://stackoverflow.com/q/24168154
tags question: http://stackoverflow.com/q/24172701
tags question: http://stackoverflow.com/q/24206618
tags question: http://stackoverflow.com/q/24263904
tags question: http://stackoverflow.com/q/24247687
tags question: http://stackoverflow.com/q/24190657
tag name: deserialization

http://stackoverflow.com/comment/37251245
type: AnswerComment
comment on: http://stackoverflow.com/a/24140992
score: 1
has text: It's fine. But really, this smells as a bad design. Try to explain what kind of task do you try to solve and probably you will get recommendations how to improve the design.
type: Comment

http://stackoverflow.com/q/24218525
tagged with: servlets
accepted answer: http://stackoverflow.com/a/24218671
upvote count: 2
type: AnsweredQuestion
score: 0
downvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37397459
answer count: 1
tagged with: web-applications
tagged with: tomcat
favorite count: 0
has title: how to get Tomcat's admin user and password to access Servlets list
type: Question
has body: when i access localhost tomcat, and click on "ManagerApp" this is what i get 403 Access Denied You are not authorized to view this page. If you have already configured the Manager application to allow access and you have used your browsers back button, used a saved book-mark or similar then you may have triggered the cross-site request forgery (CSRF) protection that has been enabled for the HTML interface of the Manager application. You will need to reset this protection by returning to the main Manager page. Once you return to this page, you will be able to continue using the Manager appliction's HTML interface normally. If you continue to see this access denied message, check that you have the necessary permissions to access this application. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp. For example, to add the manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above. &lt;role rolename="manager-gui"/&gt; &lt;user username="tomcat" password="s3cret" roles="manager-gui"/&gt; Note that for Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access. manager-gui - allows access to the HTML GUI and the status pages manager-script - allows access to the text interface and the status pages manager-jmx - allows access to the JMX proxy and the status pages manager-status - allows access to the status pages only The HTML interface is protected against CSRF but the text and JMX interfaces are not. To maintain the CSRF protection: Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles. If the text or jmx interfaces are accessed through a browser (e.g. for testing since these…
has comment: http://stackoverflow.com/comment/37397456
has answer: http://stackoverflow.com/a/24218671

http://stackoverflow.com/comment/37437789
score: 0
type: Comment
has text: @DerGolem textview1 is placed on the fragment layout
type: QuestionComment
comment on: http://stackoverflow.com/q/24239473

http://stackoverflow.com/q/24175685
tagged with: java
has comment: http://stackoverflow.com/comment/37316416
has body: For the final project in my computer class science class, I need to make a project that has 2 classes and reads CSV with coordinates for a rectangle(x,y,width,height) puts them on an array-list and print the 2 rectangles with the smallest distance from their corners(x,y) I have managed to println the smallest rectangle but i do not now how to print the the second smallest. here is my code public class Week09 { public static void main(String[] args)throws IOException { String theFile; theFile = getTheFileName(); ArrayList&lt;Rectangle&gt; arrayRectangle; arrayRectangle = getArraylist(theFile); displaySameArea(arrayRectangle,"Rectangles with same area: "); displaysmallDist(arrayRectangle,"Recangles with smallest distance: "); } public static String getTheFileName(){ String theFile; JFileChooser jfc = new JFileChooser(); jfc.showOpenDialog(null); return theFile = jfc.getSelectedFile().getAbsolutePath(); } public static ArrayList&lt;Rectangle&gt; getArraylist(String s) throws IOException { ArrayList &lt;Rectangle&gt; arrayRectangle = new ArrayList &lt;Rectangle&gt;(); FileReader fr = new FileReader(s); BufferedReader br = new BufferedReader(fr); int x = 0; int y = 0; int width = 0; int height = 0; String aLine; String arrayLine = "[,]"; try{ while ( (aLine=br.readLine()) != null){ String[] a = aLine.split(arrayLine); x = Integer.parseInt(a[0]); y = Integer.parseInt(a[1]); width = Integer.parseInt(a[2]); height = Integer.parseInt(a[3]); Rectangle b = new Rectangle(x,y,width,height); arrayRectangle.add(b); } } catch (IOException e) { e.printStackTrace(); } return arrayRectangle; } public static void displaysmallDist(ArrayList&lt;Rectangle&gt; arrayRectangle, String s) { int x = 0; int y = 0; int width = 0; int height = 0; int count1 = 0; int count2 = 1; Rectangle c = new Rectangle (x,y,width,height); Rectangle d = new Rectangle (x,y,width,height); double lowestDistance = Double.MAX_VALUE; for(int n = 0; n &lt; arrayRectangle.size(); n++) { c = arrayRectangle.get(n); for(i…
answer count: 4
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24175826
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/37316329
has comment: http://stackoverflow.com/comment/37316293
has comment: http://stackoverflow.com/comment/37316370
has answer: http://stackoverflow.com/a/24175747
tagged with: arraylist
upvote count: 0
has answer: http://stackoverflow.com/a/24176688
has title: Smallest 2 values from an arraylist
has answer: http://stackoverflow.com/a/24175825

http://stackoverflow.com/comment/37476592
type: QuestionComment
comment on: http://stackoverflow.com/q/24260089
type: Comment
has text: It is starting from 0.
score: 0

http://stackoverflow.com/comment/37254459
has text: Edited the post a bit to give more information on the desired effect.
comment on: http://stackoverflow.com/q/24132096
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24229991
accepted answer: http://stackoverflow.com/a/24456467
tagged with: authorization
has answer: http://stackoverflow.com/a/24456467
has title: How to extract authentication and authorization modules from OpenAm
type: AnsweredQuestion
score: 0
tagged with: java
has body: There are many modules in OpenAm what if I just want to use authentication\authorization modules So I wonder how to extract authentication and authorization modules from OpenAm and make the modules work functionally? Does anyone have some thoughts? Any tips would be appreciate!
tagged with: authentication
tagged with: openam
answer count: 1
type: Question

http://stackoverflow.com/comment/37284492
type: QuestionComment
score: 3
type: Comment
has text: you are not making a post request, or have the url/parameters wrong
comment on: http://stackoverflow.com/q/24159136

http://stackoverflow.com/q/24213048
tagged with: java
tagged with: boxlayout
type: Question
answer count: 2
tagged with: grid-layout
possible better answer: http://stackoverflow.com/a/24213425
has title: Java Swing making boxes with custom dimensions
has answer: http://stackoverflow.com/a/24213425
tagged with: jpanel
tagged with: swing
type: AnsweredQuestion
score: 0
has body: I need help making a layout in Java Swing. My boxes are coming out to be really small and can't figure out how to make them bigger. Here is what it looks like: https://i.sstatic.net/acRjl.png And here is what I want: https://i.sstatic.net/yoja3.png Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MPC { public static void main(String [] args) { createWindow(); } public static void createWindow() { JPanel main, left, right; JFrame frame = new JFrame("MPC"); Box [] box = new Box[16]; JSlider tempo = new JSlider(JSlider.VERTICAL, 0, 30, 15); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); main = new JPanel(); main.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); //Left side holds boxes left = new JPanel(); left.setLayout(new GridLayout(4, 4)); for(int i = 0; i &lt; 16; i++) { box[i] = new Box(BoxLayout.X_AXIS); box[i].setBorder(BorderFactory.createLineBorder(Color.black)); box[i].add(new JLabel(" " + (i+1) + " ")); left.add(box[i]); } //Right side for tempo right = new JPanel(); right.setLayout(new GridLayout(1, 1)); tempo.setMajorTickSpacing(10); tempo.setMinorTickSpacing(1); tempo.setPaintTicks(true); right.add(tempo); //Add everything to window main.add(left, BorderLayout.WEST); main.add(right, BorderLayout.EAST); frame.add(main); frame.getContentPane(); //Window Stuff frame.setBounds(50,50,500,500); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); } } What can I do to make it look like the second picture? Any help would be appreciated!
has answer: http://stackoverflow.com/a/24213248
accepted answer: http://stackoverflow.com/a/24213248

http://stackoverflow.com/comment/37356821
score: 0
type: Comment
has text: too much code,can you please limit it and show only the problem part
type: QuestionComment
comment on: http://stackoverflow.com/q/24197238

http://stackoverflow.com/a/24238006
upvote count: 6
has body: This is how I fixed the problem : I mainly selected the NeedNode.id in the subquery instead of the full object. This way, the IN statement works. public List&lt;NeedNode&gt; getRootsByTree(NeedsTreev2 tree) { List&lt;NeedNode&gt; ret; CriteriaBuilder cb = this.getEntityManager().getCriteriaBuilder(); CriteriaQuery&lt;NeedNode&gt; cq = cb.createQuery(NeedNode.class); Root&lt;NeedNode&gt; nNode = cq.from(NeedNode.class); Subquery&lt;Long&gt; sq = cq.subquery(Long.class); Root&lt;NeedLink&gt; nLink = sq.from(NeedLink.class); Join&lt;NeedLink, NeedNode&gt; d = nLink.join(NeedLink_.descendant, JoinType.INNER); sq.where(cb.notEqual(nLink.get(NeedLink_.ancestor), nLink.get(NeedLink_.descendant))); sq.select(d.get(NeedNode_.id)); sq.distinct(true); Predicate[] p = { cb.equal(nNode.get(NeedNode_.needsTree), tree), nNode.get(NeedNode_.id).in(sq).not() }; cq.where(cb.and(p)); TypedQuery&lt;NeedNode&gt; query = this.getEntityManager().createQuery(cq); ret = query.getResultList(); return (ret); } So the code needs a Join variable and the subquery to return Long instead of NeedNode. It works that way though I don't understand why it doesn't work as it's written in the question. IMO, making the subquery to select ids makes the Criteria query loose a little bit of its "Type-safe" feature.
type: AcceptedAnswer
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/24183862
answers question: http://stackoverflow.com/q/24183862
has comment: http://stackoverflow.com/comment/91555780
type: Answer

http://stackoverflow.com/q/24184256
has comment: http://stackoverflow.com/comment/37331228
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/24184442
score: 2
has title: Unsupported Operation on AbstractList.add()
tagged with: java
has answer: http://stackoverflow.com/a/24184442
has comment: http://stackoverflow.com/comment/37331351
downvote count: 0
has body: I got a method foo(list); that get's a List&lt;SomeEntit&gt; as input. My method foo looks somewhat like the following: public void foo(List&lt;SomeEntity someEntities) { someEntities.add(anotherEntity); } I then get an "javax.ejb.EJBException: java.lang.UnsupportedOperationException" caused by "java.lang.UnsupportedOperationException: null" at "at java.util.AbstractList.add(AbstractList.java:148)" Can you tell me why this is happening? I hope that my code example is not too minimal.
favorite count: 0
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24184446
upvote count: 2
has answer: http://stackoverflow.com/a/24184446
has comment: http://stackoverflow.com/comment/37331185

search-engine
type: Tag
tags question: http://stackoverflow.com/q/24214624
tags question: http://stackoverflow.com/q/24210841
tag name: search-engine

http://stackoverflow.com/comment/37341753
has text: @redFIVE Amazing! I like it, it will be a great if you guide me to an example that it does it after making the configuration file. Appreciate your help
comment on: http://stackoverflow.com/q/24126177
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37387116
type: Comment
has text: cool, I don't have any error message with that. Now I just need to fix some stuff in the code but that's ok, i'll get it done.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/24212471

http://stackoverflow.com/a/24250721
answers question: http://stackoverflow.com/q/24244037
type: Answer
has comment: http://stackoverflow.com/comment/37459806
has body: Instead of the addPoint line, could you do this? I may be wrong though.. datapoint = (float)(sixteenBitNumber[signalnodes[o][p].signalIndex + NbOfSampledSignal*k])*10/32767; //trace[o][p].addPoint(seriesindex[o][p], datapoint); avgX[o][p]+=seriesindex[o][p]; //Accumulate avgY[o][p]+=datapoint; //Accumulate avgCounter[o][p]++; //Keep track if(avgCounter[o][p]==10){ //Done accumulating... plot average trace[o][p].addPoint(avgX[o][p]/10, avgY[o][p]/10); //Add average point avgCounter[o][p]=0; //Clear data avgX[o][p]=0; //Clear data avgY[o][p]=0; //Clear data } seriesindex[o][p] = seriesindex[o][p] + ScreenPointJump;//seriesindex[o][p]++; } } } }
has comment: http://stackoverflow.com/comment/37461167
score: 0
has comment: http://stackoverflow.com/comment/37462328
has comment: http://stackoverflow.com/comment/90467029
has comment: http://stackoverflow.com/comment/37459989

http://stackoverflow.com/comment/37227651
score: 0
type: Comment
has text: @MalaAiko go here to learn about sharedpreferences http://www.tutorialspoint.com/android/android_shared_preferences.htm
type: AnswerComment
comment on: http://stackoverflow.com/a/24128245

http://stackoverflow.com/q/24135142
tagged with: transactions
tagged with: java
answer count: 1
tagged with: load-time-weaving
type: Question
has answer: http://stackoverflow.com/a/24137976
has title: Spring transaction stops to work when i add ejb module
has comment: http://stackoverflow.com/comment/37243024
has comment: http://stackoverflow.com/comment/37241976
type: UnansweredQuestion
tagged with: spring
has body: I have a ear which consist one ejb and one war module, and other local jar dependencies such as dao and services. I've placed project on github https://github.com/SunPj/spring-load-time-weaving I use spring load time weaving. My dao application context consists following lines &lt;tx:annotation-driven mode="aspectj"/&gt; &lt;context:load-time-weaver aspectj-weaving="on"/&gt; My cache context has&lt;cache:annotation-driven mode="aspectj"/&gt; My web module has a controller package ru.test.web; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import ru.test.service.TestService; import java.util.Map; @Controller public class TestController { @Autowired TestService testService; @RequestMapping("/userlist") public String userList(Map&lt;String, Object&gt; model) { String st = ArrayUtils.toString(testService.getUsers()); model.put("text", st); return "main"; } @RequestMapping("/remove-user") public String removeUser(@RequestParam("userId") int userId, Map&lt;String, Object&gt; model) { testService.removeUser(userId); model.put("text", "Removed userid = "+userId); return "main"; } @RequestMapping("/remove-user-ex") public String removeUserEx(@RequestParam("userId") int userId, Map&lt;String, Object&gt; model) { try { testService.removeUserWithException(userId); } catch (RuntimeException e){ model.put("text", "Exception = "+e.getMessage()); } return "main"; } @RequestMapping("/random") public String random(Map&lt;String, Object&gt; model) { String s = new String(); for (int i = 0; i&lt; 100; i++){ s = s + +testService.getRandom()+", "; } model.put("text", "Random = "+s); return "main"; } @RequestMapping({"/", "/home"}) public String index(Map&lt;String, Object&gt; model) { model.put("t…
score: 0
tagged with: websphere

http://stackoverflow.com/q/24158331
tagged with: command-line-arguments
has title: java command-line for garbage collecton
has comment: http://stackoverflow.com/comment/37283584
has answer: http://stackoverflow.com/a/24159179
has answer: http://stackoverflow.com/a/24158442
has comment: http://stackoverflow.com/comment/37292891
has comment: http://stackoverflow.com/comment/37289463
type: Question
has comment: http://stackoverflow.com/comment/37283208
has answer: http://stackoverflow.com/a/24159746
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37283195
downvote count: 0
tagged with: garbage-collection
upvote count: 1
linked to: http://stackoverflow.com/q/2414105
favorite count: 0
has comment: http://stackoverflow.com/comment/37283061
has comment: http://stackoverflow.com/comment/37283066
tagged with: heap-memory
answer count: 3
has body: I am working on a Swing based java application. And my application will holds lots and lots of object in the memory and which leads to "Out Of Memory" error. I knew that my code broken somewhere and not handled the memory leaks. When i was profiling my application, for a study, i have written a thread which will call System.gc() in a specific interval (example: for every 3 minutes) which was reducing the JVM used memory dramatically. I do understand that, the code was not written properly to clear the references of unused objects which giving this behavior. I am looking into such memory leaks in my code, but still i am having two questions, can i write such a thread which request for garbage collection? will it harm my application? i do accept, the performance will be reduced but its not worse than getting out of memory error. Instead of creating a thread, is there any start-up command-line argument which will request for garbage collection for the given specific time interval. Thanks in advance !!!
score: 1
tagged with: java

http://stackoverflow.com/comment/37302957
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24166019
has text: put it on property tag, it has this attribute. By default it's set to `true` that is why you see this symbol and we don't see how it's rendered. But at the moment we don't understand it, because it's printed unescaped.
type: Comment

http://stackoverflow.com/a/24193891
answers question: http://stackoverflow.com/q/24193507
downvote count: 0
has body: You should create a class with 3 doubles and use a list of that class: class Value { double theta; double radius; double amp; } List&lt;Value&gt; values = new ArrayList(); // fill list with values for (Value val: values) { System.out.println("Theta="+val.theta+", Radius="+val.radius+", Amp="+val.amp); }
has comment: http://stackoverflow.com/comment/37351251
type: Answer
has comment: http://stackoverflow.com/comment/37421562
score: 2
upvote count: 2

graphics2d
tags question: http://stackoverflow.com/q/24222821
tags question: http://stackoverflow.com/q/24220410
tags question: http://stackoverflow.com/q/24129926
tag name: graphics2d
type: Tag

http://stackoverflow.com/q/24215414
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24326996
tagged with: java
has answer: http://stackoverflow.com/a/24326996
answer count: 1
tagged with: jdbc
tagged with: apache-torque
favorite count: 0
type: Question
upvote count: 2
downvote count: 0
has body: How do I set the transaction isolation level for a specific transaction when using torque? My problem may be that I am using the org.apache.torque.util.Transaction class like this: Connection con=Transaction.begin(); // Use connection con.commit(); Con does have a setTransactionIsolation method, but the documentation for that method says: "If this method is called during a transaction, the result is implementation-defined." which seems odd, since the only way to get a Connection object is to begin a transaction. So the only time I can call that method, is during a transaction.
has title: Set transaction isolation level in torque
score: 2

http://stackoverflow.com/comment/37425147
comment on: http://stackoverflow.com/a/24233211
type: Comment
score: 0
has text: thank you. I was trying to find problem for an hour. thanks again
type: AnswerComment

http://stackoverflow.com/comment/118276158
type: QuestionComment
has text: Does this answer your question? [why we have Externalizable when we can override writeObject and readObject in java](https://stackoverflow.com/questions/16605376/why-we-have-externalizable-when-we-can-override-writeobject-and-readobject-in-ja)
comment on: http://stackoverflow.com/q/24112099
score: 1
type: Comment

http://stackoverflow.com/comment/37316395
score: 0
has text: With the above code, I want to illustrate in the most simplest way possible the aforementioned problem, so that I can get an input on what, in terms of mutual exclusion and memory consistency, is wrong with it. This is so that I can better my understanding of how `synchronized` works and doesn't work, and what the Java memory model stipulates, such that I can apply this general knowledge in future cases.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24175558

http://stackoverflow.com/q/24198968
has comment: http://stackoverflow.com/comment/37359872
tagged with: c++
type: Question
upvote count: 2
answer count: 2
has body: I have two variables, one which is local in a function and the other global. These two variables have the same name. During compilation, I have no errors. So when the code is running, and I use this variable, which one is chosen? Thank you.
favorite count: 0
has answer: http://stackoverflow.com/a/24198984
accepted answer: http://stackoverflow.com/a/24198984
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21183675
has comment: http://stackoverflow.com/comment/37359889
has comment: http://stackoverflow.com/comment/37455146
has answer: http://stackoverflow.com/a/24198994
has title: Local Variable and Global Variable with same name
possible better answer: http://stackoverflow.com/a/24198994
downvote count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/21183675
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/q/24123403
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/31078191
downvote count: 0
tagged with: gson
has body: I am serializing some rather complex objects using new Gson().fromJson(String, Class&lt;?&gt;) and even though all my properties look OK, I still get this stack trace: 06-09 10:10:58.768: E/AndroidRuntime(27775): FATAL EXCEPTION: main 06-09 10:10:58.768: E/AndroidRuntime(27775): Process: com.my.project, PID: 27775 06-09 10:10:58.768: E/AndroidRuntime(27775): java.lang.IllegalArgumentException: invalid value for field 06-09 10:10:58.768: E/AndroidRuntime(27775): at java.lang.reflect.Field.setField(Native Method) 06-09 10:10:58.768: E/AndroidRuntime(27775): at java.lang.reflect.Field.set(Field.java:585) 06-09 10:10:58.768: E/AndroidRuntime(27775): at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:95) 06-09 10:10:58.768: E/AndroidRuntime(27775): at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) 06-09 10:10:58.768: E/AndroidRuntime(27775): at com.google.gson.Gson.fromJson(Gson.java:803) 06-09 10:10:58.768: E/AndroidRuntime(27775): at com.google.gson.Gson.fromJson(Gson.java:768) 06-09 10:10:58.768: E/AndroidRuntime(27775): at com.google.gson.Gson.fromJson(Gson.java:717) 06-09 10:10:58.768: E/AndroidRuntime(27775): at com.google.gson.Gson.fromJson(Gson.java:689) ... more Is there any way to have Gson tell me the field name it's failing on?
favorite count: 0
type: Question
tagged with: serialization
type: UnansweredQuestion
tagged with: android
score: 2
tagged with: reflection
upvote count: 2
has title: How to tell which field failed Gson serialization

http://stackoverflow.com/a/24235466
score: 0
answers question: http://stackoverflow.com/q/24235194
has body: Check that the cases of the variables in the datastore matches the cases of those in the JSP page.That is, since it's "Pessoa" in the datastore,it should also be "Pessoa" in your JSP page.Also,you should use Firebug to debug your application.Use console.log() to see what is being returned from the datastore.
type: Answer

http://stackoverflow.com/comment/37483605
score: 0
comment on: http://stackoverflow.com/q/24263854
type: QuestionComment
type: Comment
has text: Additionally it would probably be useful to mention that this is an issue with the Apache HttpClient library. Again welcome

http://stackoverflow.com/q/24173514
answer count: 1
has comment: http://stackoverflow.com/comment/37425998
tagged with: cypher
upvote count: 1
tagged with: performance
score: 1
has answer: http://stackoverflow.com/a/24182271
tagged with: java
downvote count: 0
tagged with: query-performance
tagged with: neo4j
has title: Speedup relationship and node creation using cypher in Neo4j
favorite count: 0
type: Question
has body: i have 2 csv files A and B. File A contains 7000 rows with 6 properties and File B contains 10M rows with 11 properties. Moreover, File A has the property PKA which is used as primary key, whereas File B has the property FKA which is used as foreign key respect to PKA. I want to load these files into Neo4j in this way: 1 - insert a new node for each row of File A and File B 2 - add a relationship between any node created that represents the relationship primary and foreign key described. Currently, I have inserted these files with BatchInserter using the JAVA API adding a node for each row of these files and setting the labels "A" and "B" for File A and file B respectively. I have also create two index for PKA and FKA. To add the relationships my intention is to call the following cypher statement (from Neo4jShell): match (a:A), (b:B) where a.PKA=b.FKB create (a)&lt;-[:KEYREL]-(b); My problems are: - adding the nodes with BatchInserter takes 14minutes for File B (the biggest one) with only one commit at the end (~12k nodes/sec, ~130k properties/sec), I want to speedup the import process of a factor of 2. - the cypher query can't be handled with this dataset size but i would like to make is possible. Im running on a VM with an IntelXeon @2.6Ghz dual core and 8GB RAM with Windows 64bit and Java8 64 bit installed. I have run my import java program and Neo4jShell with the following java options: -server -XX:+UseConcMarkSweepGC -Xms2000m -Xmx5000m
type: UnansweredQuestion

http://stackoverflow.com/q/24176026
type: Question
has comment: http://stackoverflow.com/comment/37317077
accepted answer: http://stackoverflow.com/a/24213512
has title: Adding e-commerce functionality and blog feature in local java application
type: AnsweredQuestion
tagged with: payment-gateway
score: 0
tagged with: java
tagged with: e-commerce
answer count: 1
has answer: http://stackoverflow.com/a/24213512
has body: I am a student working on college project. A newbie in web development. I developed a local java application for book management system for a bookstore using JSP/Servlets in eclipse and tomcat server. It has registration screen, login screen etc. I have included session management. Now, I am asked to include following features in the same project. Requirement- Add: a) E-commerce functionality to it (Online Store, Shopping Kart, Payment Gateway). You may integrate the open source code available easily. b) Add a blog feature (again you may integrate available codes) I am not sure how we can include these features in local application. Could you please help?
tagged with: eclipse

web-services
tags question: http://stackoverflow.com/q/24159729
type: Tag
tags question: http://stackoverflow.com/q/24213029
tags question: http://stackoverflow.com/q/24238127
tags question: http://stackoverflow.com/q/24197615
tags question: http://stackoverflow.com/q/24259101
tags question: http://stackoverflow.com/q/24164081
tags question: http://stackoverflow.com/q/24146061
tags question: http://stackoverflow.com/q/24190214
tags question: http://stackoverflow.com/q/24261774
tags question: http://stackoverflow.com/q/24200021
tags question: http://stackoverflow.com/q/24187075
tags question: http://stackoverflow.com/q/24230673
tags question: http://stackoverflow.com/q/24119556
tags question: http://stackoverflow.com/q/24119904
tags question: http://stackoverflow.com/q/24122046
tags question: http://stackoverflow.com/q/24170456
tags question: http://stackoverflow.com/q/24242856
tags question: http://stackoverflow.com/q/24171934
tag name: web-services
tags question: http://stackoverflow.com/q/24184522
tags question: http://stackoverflow.com/q/24114853
tags question: http://stackoverflow.com/q/24169142
tags question: http://stackoverflow.com/q/24176491
tags question: http://stackoverflow.com/q/24192893
tags question: http://stackoverflow.com/q/24134688
tags question: http://stackoverflow.com/q/24168944
tags question: http://stackoverflow.com/q/24189944
tags question: http://stackoverflow.com/q/24156838
tags question: http://stackoverflow.com/q/24167833
tags question: http://stackoverflow.com/q/24257385
tags question: http://stackoverflow.com/q/24164013
tags question: http://stackoverflow.com/q/24217256
tags question: http://stackoverflow.com/q/24257774
tags question: http://stackoverflow.com/q/24256803
tags question: http://stackoverflow.com/q/24147548
tags question: http://stackoverflow.com/q/24259009
tags question: http://stackoverflow.com/q/24163478
tags question: http://stackoverflow.com/q/24140475
tags question: http://stackoverflow.com/q/24258544
tags question: http://stackoverflow.com/q/24160059
tags question: http://stackoverflow.com/q/24182416
tags question: http://stackoverflow.com/q/24143330
tags question: http://stackoverflow.com/q/24135633
tags question: http://stackoverflow.com/q/24117897
tags question: http://stackoverflow.com/q/24250294
tags question: http://stackoverflow.com/q/24238804
tags question: http://stackoverflow.com/q/24158939

http://stackoverflow.com/comment/37418466
comment on: http://stackoverflow.com/a/24229536
type: Comment
has text: @Unihedron Just wondering, is it possible at all to not having to `extend` in this case, in case that `class Test` already has extended something? Thanks.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24185350
has comment: http://stackoverflow.com/comment/37333310
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37333514
has comment: http://stackoverflow.com/comment/37333301
accepted answer: http://stackoverflow.com/a/24185885
tagged with: android
tagged with: java
answer count: 1
score: -1
has answer: http://stackoverflow.com/a/24185885
has comment: http://stackoverflow.com/comment/37333346
favorite count: 0
tagged with: http://stackoverflow.com/tag/mp3
type: Question
has title: List all .mp3 files recursive from directory
has comment: http://stackoverflow.com/comment/37333257
downvote count: 2
tagged with: arrays
has body: I know this has been asked several times, but i can't adapt the solutions to make it work for me. I need an string array that returns the absolute path of every mp3 in the directory /music/ and all its subdirectories. I found this: public void getMp3s(ArrayList&lt;File&gt; list, File dir){ File[] files = dir.listFiles(); for(File file : files){ if(file.isDirectory()){ getMp3s(list, file); }else{ } } } Everything i need is the method to return musiclist[] which contains the absolute path of the mp3 file. (test/testsub/song.mp3) (It's fine if it returns files which are not .mp3) edit: like this:? getMp3s(ArrayList&lt;File&gt; list, File dir,int i, String[] musiclist){ File[] files = dir.listFiles(); for(File file : files){ if(file.isDirectory()){ getMp3s(list, file,i, musiclist); }else{ musiclist[i] = file.getAbsolutePath(); i++; } } }
upvote count: 1

spring-bean
tags question: http://stackoverflow.com/q/24153546
tags question: http://stackoverflow.com/q/24137505
type: Tag
tag name: spring-bean
tags question: http://stackoverflow.com/q/24205876

http://stackoverflow.com/comment/37347272
score: 1
comment on: http://stackoverflow.com/a/24192320
type: Comment
has text: @theGreenCabbage Just updated my answer. The arguments for an operation/method are always evaluated before the operation/method is executed. So before `q.add()` can be called, `s.pop() + 5` has to be evaluated. And before `+` can be evaluated, `s.pop()` and `5` have to be evaluated.
type: AnswerComment

http://stackoverflow.com/a/24254553
has comment: http://stackoverflow.com/comment/37467500
answers question: http://stackoverflow.com/q/24254545
type: AcceptedAnswer
has body: Change public class LocateAdder&lt;Located&gt; implements GridAdder&lt;Located&gt; { to public class LocateAdder implements GridAdder&lt;Located&gt; { In the first sample, you're declaring a new type variable named Located which shadows the type called Located.
downvote count: 0
has comment: http://stackoverflow.com/comment/37467474
score: 6
has comment: http://stackoverflow.com/comment/37467176
type: Answer
has comment: http://stackoverflow.com/comment/37467650
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24254545
has comment: http://stackoverflow.com/comment/37467198

http://stackoverflow.com/q/24252741
has body: I have a strange problem that I need help with. This is a very simple application. I have a Rectangle Shape saved in a Car object. public class Car { private Rectangle rect; private TheFourCarDeadlock.direction direction; public Car(Rectangle r, TheFourCarDeadlock.direction d) { this.rect = r; this.direction = d; } public void move() { double xPos; double yPos; switch (direction) { case left: // make sure x is a positive nr between 0 and 600 xPos = (rect.getX() - 1) % 600; if (xPos &lt; 0) { xPos = 600; } rect.setX(xPos); System.out.println(String.format("move left, x: %1.0f", xPos)); break; case right: xPos = (rect.getX() + 1) % 600; rect.setX(xPos); System.out.println(String.format("move right, x: %1.0f", xPos)); break; case up: yPos = (rect.getY() - 1) % 600; rect.setY(yPos); break; case down: yPos = (rect.getY() + 1) % 600; rect.setY(yPos); break; default: throw new AssertionError(direction.name()); } } } The class Car move a car object to the left or right depending on the direction that is set. public class TheFourCarDeadlock extends Application { int maxWidth = 600; int maxHeight = 600; Car carFromLeft; Car carFromRight; public static enum direction { left, right, up, down }; @Override public void start(Stage primaryStage) { // setup Group root = new Group(); Scene scene = new Scene(root, maxWidth, maxHeight); // cars // cars on left side going right Rectangle leftSide = new Rectangle(0, 350 - 10, 20, 20); leftSide.setFill(Color.BLUE); root.getChildren().add(leftSide); carFromLeft = new Car(leftSide, direction.right); // cars on right side going left Rectangle rightSide = new Rectangle(600, 250 + 10, -20, -20); rightSide.setFill(Color.BLUE); root.getChildren().add(rightSide); carFromRight = new Car(rightSide, direction.left); primaryStage.setTitle("The Four Car Deadlock"); primaryStage.setScene(scene); primaryStage.show(); Thread t = new Thread(new DrawRunnable()); t.start(); } public void moveCars() { carFromLeft.move(); carFromRight.move(); } private class …
type: AnsweredQuestion
score: 0
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24258345
tagged with: multithreading
has answer: http://stackoverflow.com/a/24258345
answer count: 1
tagged with: game-physics
type: Question
has title: Moving Rectangle Shapes in JavaFX with a thread
tagged with: java
tagged with: shapes

http://stackoverflow.com/comment/37227591
has text: Do you have the `READ_EXTERNAL_STORAGE` permission?
comment on: http://stackoverflow.com/q/24128318
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24210989
tagged with: jna
tagged with: jnlp
has answer: http://stackoverflow.com/a/24266677
type: UnansweredQuestion
has body: I am attempting to launch a Java application using JNLP; the app includes a 3rd party library (Lab Streaming Layer) that relies on native libraries loaded with JNA. As far as I understand, I have followed all of the appropriate steps to make this work: All of the native libraries are in JAR files, separated by OS and architecture. All of the native library JAR files are on the server, accessible from the codebase URL. The JNLP file contains a &lt;resources&gt; element with os and arch specified with a &lt;nativelib&gt; element inside it with the correct href attribute. The JNLP file is not malformed and launches normally. When I go to run my application, I get a java.lang.UnsatisifiedLinkError that reports "Unable to load library 'liblsl32.dylib': Can't obtain InputStream for darwin/liblsl32.dylib". This happens after the program has started up, the first time it tries to make use of the library with the native lib dependency. I have corrected this exact error with this library with a separate, non-web-launch application by putting the dylib in the correct place. I have also tried renaming all the dylibs to be jnilibs, per this information: http://permalink.gmane.org/gmane.comp.java.jna.user/3328, but everything happens identically. It looks like I should be able to specify jna.library.path in the JNLP file, but I have no idea what this would be, if it would change from launch-to-launch, or how I would find out what it should be.
has title: How do you use JNA + native libaries with JNLP web launch [on a Mac]?
answer count: 3
score: 1
tagged with: java
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24248715
has answer: http://stackoverflow.com/a/24241378
favorite count: 0
type: Question

system
tag name: system
tags question: http://stackoverflow.com/q/24173153
type: Tag

http://stackoverflow.com/comment/37475599
score: 0
has text: In activity A, you have to make your selection from database inside onResume() not onCreate().
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24259219

http://stackoverflow.com/q/24165917
favorite count: 0
downvote count: 0
tagged with: java
tagged with: architecture
answer count: 1
has title: SOA (ish) architecture, where to place common code?
type: Question
score: 5
upvote count: 5
has body: we have a soa-ish architecture which looks like this frontend -&gt;domain A -&gt;db frontend-&gt;business A-&gt;domain B -&gt;db frontend -&gt;domain C -&gt;db frontend -&gt;domain A -&gt;db frontend-&gt;business B-&gt;domain B -&gt;db frontend -&gt;domain C -&gt;db other app A other app B we also have other applications which are not part of this soa stack. from time to time we have the following discussion/problem: "i have code in domain A that is also useful in domain B but not in business services - where should i put the stuff with its tests". let's assume the code is very abstract and domain agnostic, something very generic that could also be used by the "other" applications outside of soa. so the question is: a) put it in a "generic-domain-stuff" module which all domain inherit via maven dependencies. This will probably end up growing and growing until it is a mess…. b) create a module "generic-stuff" which can be used by soa and the "other" applications. This will probably lead to a lot of small maven modules…. c) duplicate the code until you have three use cases, then refactor to a) or b). This screems DRY (don't repeat yourself) i have people with 10+ years of "enterprise" experience around me but we never seem to find a proper solution/answer to the always same problems :) i would be interested in hearing you experiences
type: UnansweredQuestion
tagged with: maven
tagged with: dependency-management
tagged with: soa
has answer: http://stackoverflow.com/a/24166246

http://stackoverflow.com/q/24183354
has comment: http://stackoverflow.com/comment/37330676
has body: I want to convert my names.rtf file which contains (the names of people(String) names.rtf = ("ABHISHEK","ANKIT",........"ASHISH") ) into single String[] name such that name={"ABHISHEK","ANKIT",......"ASHISH"} Following is my code suggest please. import java.io.*; import java.util.Scanner; public class FileScan { public static void main(String[] args) throws IOException { Scanner s = null; String thestring =""; try { s = new Scanner(new BufferedReader(new FileReader("/Users/abhishekkumar/Desktop/names1.rtf"))); while (s.hasNextLine()) { thestring+=(s.nextLine()); thestring+="\n"; } } finally { if (s != null) { s.close(); } } System.out.println(thestring); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37330225
has title: How to use scanner class in java
has comment: http://stackoverflow.com/comment/37330002
has comment: http://stackoverflow.com/comment/37330440
score: -2
has comment: http://stackoverflow.com/comment/37329552
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37330087
upvote count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/37329866
answer count: 1
has answer: http://stackoverflow.com/a/24183928
accepted answer: http://stackoverflow.com/a/24183928
favorite count: 0

nokiax
tag name: nokiax
type: Tag
tags question: http://stackoverflow.com/q/24138890

lock-free
tag name: lock-free
type: Tag
tags question: http://stackoverflow.com/q/24209702

http://stackoverflow.com/comment/37413459
score: 0
type: AnswerComment
has text: Nice! Thanks a ton. I really appreciate it.
comment on: http://stackoverflow.com/a/24226903
type: Comment

maven
tags question: http://stackoverflow.com/q/24183024
tags question: http://stackoverflow.com/q/24204588
tags question: http://stackoverflow.com/q/24210468
tags question: http://stackoverflow.com/q/24166489
tags question: http://stackoverflow.com/q/24202480
tags question: http://stackoverflow.com/q/24237276
tags question: http://stackoverflow.com/q/24164498
tags question: http://stackoverflow.com/q/24144741
tags question: http://stackoverflow.com/q/24168431
tags question: http://stackoverflow.com/q/24218455
tags question: http://stackoverflow.com/q/24187906
tags question: http://stackoverflow.com/q/24139079
tags question: http://stackoverflow.com/q/24205701
tags question: http://stackoverflow.com/q/24182305
type: Tag
tags question: http://stackoverflow.com/q/24250345
tags question: http://stackoverflow.com/q/24221361
tags question: http://stackoverflow.com/q/24187049
tags question: http://stackoverflow.com/q/24186592
tags question: http://stackoverflow.com/q/24212937
tags question: http://stackoverflow.com/q/24191222
tags question: http://stackoverflow.com/q/24130900
tags question: http://stackoverflow.com/q/24105810
tags question: http://stackoverflow.com/q/24241967
tags question: http://stackoverflow.com/q/24208568
tags question: http://stackoverflow.com/q/24136661
tags question: http://stackoverflow.com/q/24137777
tags question: http://stackoverflow.com/q/24265427
tags question: http://stackoverflow.com/q/24262962
tags question: http://stackoverflow.com/q/24165787
tags question: http://stackoverflow.com/q/24107329
tags question: http://stackoverflow.com/q/24163913
tags question: http://stackoverflow.com/q/24185409
tags question: http://stackoverflow.com/q/24117309
tags question: http://stackoverflow.com/q/24106134
tags question: http://stackoverflow.com/q/24145858
tags question: http://stackoverflow.com/q/24183935
tags question: http://stackoverflow.com/q/24246857
tags question: http://stackoverflow.com/q/24200878
tags question: http://stackoverflow.com/q/24211943
tags question: http://stackoverflow.com/q/24206646
tags question: http://stackoverflow.com/q/24191084
tags question: http://stackoverflow.com/q/24111870
tags question: http://stackoverflow.com/q/24206634
tags question: http://stackoverflow.com/q/24220970
tags question: http://stackoverflow.com/q/24159306
tags question: http://stackoverflow.com/q/24246228
tags question: http://stackoverflow.com/q/24168352
tags question: http://stackoverflow.com/q/24242130
tags question: http://stackoverflow.com/q/24159136
tags question: http://stackoverflow.com/q/24137376
tags question: http://stackoverflow.com/q/24241350
tags question: http://stackoverflow.com/q/24219565
tags question: http://stackoverflow.com/q/24176894
tags question: http://stackoverflow.com/q/24263673
tags question: http://stackoverflow.com/q/24164929
tags question: http://stackoverflow.com/q/24246709
tags question: http://stackoverflow.com/q/24206013
tags question: http://stackoverflow.com/q/24110634
tags question: http://stackoverflow.com/q/24156244
tags question: http://stackoverflow.com/q/24259577
tags question: http://stackoverflow.com/q/24265288
tags question: http://stackoverflow.com/q/24203686
tags question: http://stackoverflow.com/q/24251952
tags question: http://stackoverflow.com/q/24248183
tags question: http://stackoverflow.com/q/24171745
tags question: http://stackoverflow.com/q/24195179
tags question: http://stackoverflow.com/q/24248853
tags question: http://stackoverflow.com/q/24142419
tags question: http://stackoverflow.com/q/24179569
tags question: http://stackoverflow.com/q/24165917
tags question: http://stackoverflow.com/q/24227492
tags question: http://stackoverflow.com/q/24201984
tags question: http://stackoverflow.com/q/24262282
tags question: http://stackoverflow.com/q/24159729
tags question: http://stackoverflow.com/q/24163101
tags question: http://stackoverflow.com/q/24125378
tags question: http://stackoverflow.com/q/24248873
tags question: http://stackoverflow.com/q/24164019
tags question: http://stackoverflow.com/q/24118667

http://stackoverflow.com/q/24105537
has title: Android: Code works only in onCreateOptionsMenu, not in OnCreate
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/37184682
duplicate of: http://stackoverflow.com/q/23653778
score: 0
has comment: http://stackoverflow.com/comment/37230955
tagged with: android
tagged with: java
has body: My App works only in onCreateOptionsMenu(Menu menu) method but not in OnCreate(). Why? Here it is: public class MainActivity extends ActionBarActivity { Button button2; TextView joke; Random ran = new Random(); @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(); } } @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); button2 = (Button) findViewById(R.id.b2); joke = (TextView) findViewById(R.id.joke); button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub StringBuilder sb = new StringBuilder(); ArrayList&lt;Integer&gt; al = new ArrayList&lt;Integer&gt;(); for(int i = 1; i &lt;= 49; i++) al.add(i); for(int i = 0; i &lt; 6; i++) { int y = al.remove(ran.nextInt(al.size()) ); sb.append(" " + y + " "); } joke.setText(sb); } }); return true; } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } So try to Cut &amp; Paste the code inside onCreate() method... you will see the error :(
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/23653778
has answer: http://stackoverflow.com/a/24105559
has comment: http://stackoverflow.com/comment/37185251

http://stackoverflow.com/comment/37481043
score: 0
comment on: http://stackoverflow.com/q/24262495
type: Comment
type: QuestionComment
has text: StringTokenizer is a legacy class (for several versions of Java now) and should not be used anymore. use regex or String's split method.

http://stackoverflow.com/a/24185468
has comment: http://stackoverflow.com/comment/37334922
answers question: http://stackoverflow.com/q/24185155
has body: Your JSON contains an array which has one single object element so you should parse it like that: JSONArray root = (JSONArray) JSONValue.parseWithException(json); JSONObject rootObj = (JSONObject) root.get(0); JSONArray array = (JSONArray) rootObj.get("friends"); for (int i = 0; i &lt; array.size(); i++) { JSONObject cap = (JSONObject) array.get(i); String first = (String) cap.get("name"); System.out.println(first); } If it can have more elements add a for loop instead of root.get(0).
accepted answer of: http://stackoverflow.com/q/24185155
has comment: http://stackoverflow.com/comment/37334177
downvote count: 0
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/37334421
type: AcceptedAnswer

http://stackoverflow.com/q/24218077
possible better answer: http://stackoverflow.com/a/24218143
upvote count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/24218204
linked to: http://stackoverflow.com/q/23906717
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37396666
answer count: 3
tagged with: file-io
has answer: http://stackoverflow.com/a/24218143
tagged with: java
has answer: http://stackoverflow.com/a/24218181
has body: For my A2 computing coursework I need to open and use media player or itunes from a Java program. the current code I have is so :- package random.file.opener; import java.io.IOException; public class RandomFileOpener { public static void main(String args[]) throws IOException { Runtime.getRuntime().exec("C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe"); //this is to try to run internet explorer as a proof of concept } } However this throws this error :- Exception in thread "main" java.io.IOException: Cannot run program "iexplore.exe" (in directory "C:\Users\Program Files (x86)\Internet Explorer\iexplore.exe"): CreateProcess error=267, The directory name is invalid at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at random.file.opener.RandomFileOpener.main(RandomFileOpener.java:19) Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:376) at java.lang.ProcessImpl.start(ProcessImpl.java:136) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) ... 1 more Java Result: 1 EDIT: However, I am able to run package random.file.opener; import java.io.IOException; public class RandomFileOpener { public static void main(String args[]) throws IOException { Runtime.getRuntime().exec("C:\\Windows\\System32\\taskmgr.exe"); } } Which runs perfectly.. Is there a specific way to deal with this error, as my code seems to be 'correct' but this error seems to keep bugging me. Any help would be much appreciated, thanks.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24218204
tagged with: netbeans
has title: Problems with file opening

http://stackoverflow.com/a/24159334
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24159266
answers question: http://stackoverflow.com/q/24159266
has comment: http://stackoverflow.com/comment/37284847
type: Answer
has body: I wouldn't use Html.fromHtml inside the toString() method. In toString(), simply return the corresponding text: return "&lt;font color=\"#e61624\"&gt;"+fromHour+"&lt;/font&gt; " + from + " / " + toHour + " " + to; Then call: textView.setText(Html.fromHtml(yourObject.toString());
downvote count: 0

http://stackoverflow.com/comment/37319977
comment on: http://stackoverflow.com/q/24177825
type: Comment
has text: use lenght() > 0 for empty check
type: QuestionComment
score: 0

http://stackoverflow.com/q/24148776
has title: java.lang.ClassCastException: casting an object, to his parent
tagged with: android-fragmentactivity
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24148827
answer count: 2
accepted answer: http://stackoverflow.com/a/24148827
downvote count: 0
upvote count: 1
tagged with: layout
favorite count: 0
has answer: http://stackoverflow.com/a/24148851
possible better answer: http://stackoverflow.com/a/24148851
type: Question
has body: I'm a IOS coder, but I'm trying to learn a little bit of android, but I'm getting problems. I have the following class: package com.example.fragmenttabhostdemo; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class Tab1 extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.tab1, container, false); } } When I try to run it, the console says: java.lang.ClassCastException: com.example.fragmenttabhostdemo.Tab1 cannot be cast to android.support.v4.app.Fragment Any ideas of what I'm doing wrong ? The problem I think, is occurring when I try to make the fragment activity for my android app layout, and add some tabs to the host: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabHost = (FragmentTabHost) findViewById(R.id.tabhost); tabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent); tabHost.addTab(tabHost.newTabSpec("Tab1").setIndicator("Lengueta 1"), Tab1.class, null); tabHost.addTab(tabHost.newTabSpec("Tab2").setIndicator("Lengueta 2"), Tab2.class, null); tabHost.addTab(tabHost.newTabSpec("Tab3").setIndicator("Lengueta 3"), Tab3.class, null); } So, I don't know what I'm doing wrong. Any other ideas to get a tab layout easily, I just can't do it. P.D. I'm trying to follow this tutorial: http://www.androidcurso.com/index.php/tutoriales-android-basico/32-unidad-2-diseno-de-la-interfaz-de-usuario-vistas-y-layouts/452-fragmenttabhost
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/a/24139252
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24138027
has body: Perhaps you can give us more info on how do you get newlist. One solution I could think of, with the information that you gave us is : add every line in a separate ArrayList, and add those ArrayLists in a HashSet. You would have : HashSet&lt;ArrayList&lt;string&gt;&gt;.
upvote count: 1
score: 1

http://stackoverflow.com/comment/37316410
has text: Yeah, but what are your expectations? This method is invoked by multiple threads? And what should it do? What does it actually do? It just blocks on the `wait()` at `c`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24175558
score: 0

http://stackoverflow.com/q/24182073
tagged with: android
tagged with: pagination
has title: Using Gson to persist a dynamic List for offline access
downvote count: 0
answer count: 0
score: 1
upvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
favorite count: 0
has body: I have a couple of class Foo and FooContainer. Foo is the JSONObject returned from the API I'm fetching from and I use FooContainer alongside Gson to parse the incoming request. What I'm unclear about is that the API involves pagination and each time I make a new request, I'm unsure how to save the previously loaded data along with the newest data. In other words, right now when I save the latest FooContainer, none of the previous data is saved along with it. I suppose I'm just unclear on how to effectively use Gson to save all of my data for offline access. FooContainer public class FooContainer { public List&lt;Foo&gt; foos; } put public void put(FooContainer fooContainer) { final File file = getFileForKey(FOO_CACHE); Writer writer = null; try { writer = new BufferedWriter(new FileWriter(file)); mGson.toJson(fooContainer, FooContainer.class, new JsonWriter(writer)); } catch (final IOException e) { LOGE(TAG, "put - Error adding FooContainer", e); } finally { IOUtils.closeQuietly(writer); } } get public FooContainer get() { Reader reader = null; try { reader = new BufferedReader(new FileReader(getFileForKey(FOO_CACHE))); return mGson.fromJson(reader, FooContainer.class); } catch (final IOException e) { LOGE(TAG, "get - Error retrieving FooContainer", e); } finally { IOUtils.closeQuietly(reader); } return null; } I'm using an AsyncTaskLoader to fetch the data, which basically just consists of: new Gson().fromJson(reader, FooContainer.class);
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/37330186
comment on: http://stackoverflow.com/q/24183526
type: Comment
type: QuestionComment
has text: Dumb question, is there enough space on your disk to do this right?
score: 0

http://stackoverflow.com/comment/37348318
has text: Using `getGraphics()` on the frame before the frame has been rendered (setVisible), will return a null `Graphics` object. Does not have to do with initializing of the frame. In any case, `getGraphics()` is not the correct way to perform custom painting.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24192606

http://stackoverflow.com/comment/37485171
type: Comment
has text: My App Already complete.Now My minsdkversion is 8 & Targetsdkversion is 19.Now i want to do My minsdkversion 11.how it possible?
type: AnswerComment
comment on: http://stackoverflow.com/a/24264304
score: 0

http://stackoverflow.com/comment/37451049
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24246639
has text: Windows 7 x64. 4GB RAM. 500GB HDD. Intel i5 4 core 2.9Ghz processor. I run `Eclipse` and `Netbeans` smoothly. Another games too.
type: Comment

http://stackoverflow.com/q/24205417
tagged with: quartz-scheduler
has answer: http://stackoverflow.com/a/24208464
type: Question
type: UnansweredQuestion
has title: Quartz API: Job gets called immediately even though scheduled for later
has body: I am creating a JobDetail as below, JobDetail job = JobBuilder.newJob(MyJob.class).withIdentity(queryId).usingJobData("ExecutionDelay",1).build(); I want it to first run after 1 hour. The Trigger for the same is as below, Trigger trigger = TriggerBuilder.newTrigger().withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(1)).build(); But, when I am creating more than 1 Thread of the above code in a class, the Job gets triggered immediately for some of the Jobs. Not sure what is wrong. Can some one help.
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/37372919
has text: The real problem is that when I shift the return here the compiler does not find the variable 'rgl_time' to return.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24205665

http://stackoverflow.com/comment/37463297
type: QuestionComment
has text: No that does not sound good. Using anarray list is much easier. But... it's up to you...
comment on: http://stackoverflow.com/q/24249239
score: 0
type: Comment

http://stackoverflow.com/comment/37368655
comment on: http://stackoverflow.com/q/24203574
has text: You need to read http://stackoverflow.com/questions/2860513/java-ee-and-jdk and http://stackoverflow.com/questions/2024143/jdk-java-se-jdk-java-ee and this one also http://stackoverflow.com/questions/10438127/is-there-a-java-ee-jdk
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37313241
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24173934
has text: You can have static methods
score: 0

http://stackoverflow.com/q/24233013
downvote count: 0
tagged with: java-3d
has answer: http://stackoverflow.com/a/45759667
linked to: http://stackoverflow.com/q/32423848
score: 2
has title: Group: only a BranchGroup node may be added
tagged with: java
answer count: 1
favorite count: 0
type: Question
upvote count: 2
has body: I'm trying to put a Behaviour into a BranchGroup but when I run the programm, it returns me this error: "Exception in thread "Thread-1" javax.media.j3d.RestrictedAccessException: Group: only a BranchGroup node may be added" I have to say that I put those setCapabilities: ramaVisible = new BranchGroup(); ramaVisible.setCapability(BranchGroup.ALLOW_DETACH); ramaVisible.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); ramaVisible.setCapability(BranchGroup.ALLOW_CHILDREN_READ); ramaVisible.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND); ramaVisible.setCapability(BranchGroup.ALLOW_BOUNDS_READ); ramaVisible.setCapability(BranchGroup.ALLOW_BOUNDS_WRITE); and this is what I do to put the behaviour into a BranchGroup Colisiones behaviourColision = new Colisiones(this.ramaVisible,this,this.juego); behaviourColision.setSchedulingBounds(new BoundingSphere()); this.ramaVisible.addChild(behaviourColision); I'm developing this program in Java3D
type: UnansweredQuestion

layout-manager
tags question: http://stackoverflow.com/q/24239091
tags question: http://stackoverflow.com/q/24254684
tags question: http://stackoverflow.com/q/24225504
tags question: http://stackoverflow.com/q/24146800
tags question: http://stackoverflow.com/q/24111830
tags question: http://stackoverflow.com/q/24234675
tags question: http://stackoverflow.com/q/24144497
tags question: http://stackoverflow.com/q/24241455
type: Tag
tag name: layout-manager

http://stackoverflow.com/comment/37476713
score: 0
comment on: http://stackoverflow.com/q/24260089
type: Comment
has text: because `it.next()` does not execute when `if(i != 3)`
type: QuestionComment

http://stackoverflow.com/a/24162267
answers question: http://stackoverflow.com/q/24161845
has body: Database.Schema.Table when referencing tables and Database.Schema.Table.Column when referencing columns You can write joins between databases this way and deffinately pull data from more than one database. USE [DatabaseA] SELECT * FROM DatabaseA.dbo.DSNA_tblMaiin INNER JOIN DatabaseB.dbo.DSNB_tblMaiin ON DatabaseA.dbo.DSNA_tblMaiin.Serialnumber = DatabaseB.dbo.DSNB_tblMaiin.Serialnumber INNER JOIN DatabaseB.dbo.DSNC_tblMaiin ON DatabaseA.dbo.DSNA_tblMaiin.Serialnumber = DatabaseC.dbo.DSNC_tblMaiin.Serialnumber
score: 0
type: Answer

http://stackoverflow.com/comment/37273868
has text: I thought that because being in white-list could be implemented, for what I did I can only use servlets. A doubt, amazon offers free relational database as well? Thanks for the help.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24152151
type: AnswerComment

http://stackoverflow.com/a/24152015
type: Answer
answers question: http://stackoverflow.com/q/24151016
has body: It depends on your application, but in general data from the tabs should be kept in temporary storage (session or statefull bean) and then saved on dialog OK button. There could be at least a few options: use stateful bean as facade Your facade implements all methods of your stateless beans and stores data in its variables, once the OK button is clicked it invokes save method on facade, facade calls each stateless session bean to save the data - all in one transaction either saved or rolled back. use http session for temporary storage This is your current design as I believe from description. But your backing beans should only keep data in session, not save it to the database (as my understanding is that all tabs must be filled for data to be valid). Then when the OK button is clicked you could use: either the UserTransaction object to begin the transaction, call all session beans with required data, and commit transaction or create a statless facade and call this facade with all required data (which would call all other session beans like in a stateful example), and let the container to handle transaction management.
has comment: http://stackoverflow.com/comment/37326993
has comment: http://stackoverflow.com/comment/37278958
score: 0

http://stackoverflow.com/a/24115308
has comment: http://stackoverflow.com/comment/37208028
has comment: http://stackoverflow.com/comment/37203277
score: 0
has comment: http://stackoverflow.com/comment/37205684
type: Answer
has comment: http://stackoverflow.com/comment/37207323
has comment: http://stackoverflow.com/comment/37206672
has comment: http://stackoverflow.com/comment/37203067
has body: If c is not equal to a new line character, print it out? if(c != '\n'){ System.out.println(c); } EDIT In the example below, I terminate the input with a full stop '.'. In the loop, store all the input in a String until it terminates, then print the String which now contains both lines. import java.io.IOException; public class Main { public static void main(String[] args){ int i; String line = ""; try { while ((i = System.in.read()) != '.') { char c = (char)i; line = line + c; } System.out.println(line); } catch (IOException e) { e.printStackTrace(); } } } My console looks like this. The first two lines are input, the last two are the output. This is the text I want to print And now I pressed Enter. This is the text I want to print And now I pressed Enter
answers question: http://stackoverflow.com/q/24115083

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/24198788
tag name: android-gridview

http://stackoverflow.com/comment/37317099
score: 0
has text: +1 I like that. I wonder if it would be better to create a "proxy" column model and apply it to the table or if that would be inferred as to much interference. The only other issue would if you had a few dozen columns :P (and yes, the place I work, a few dozen is a small set)
comment on: http://stackoverflow.com/a/24175985
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37383821
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24211099
has text: what makes you think it isn't caught? the jre itself catches it. And it is a public method, any other code could wrap it and call it and catch it as well.
type: QuestionComment

http://stackoverflow.com/a/24189411
score: 4
downvote count: 1
upvote count: 5
type: Answer
has body: What if you have multiple BundleActivator implementations in your bundle?? Are you really happy with a tool deciding, essentially at random, which one will be the main entry point of your bundle?? I feel that you are missing the point of the bnd file, which is to be your description of the content of the bundle. That is, it is a source file that you should write. Also, why do you want to export the package that contains the bundle activator? This package should be private in OSGi.
answers question: http://stackoverflow.com/q/24185603

http://stackoverflow.com/comment/37281895
has text: @cy3er, the reader is associated with the input stream and not the connection
score: 0
comment on: http://stackoverflow.com/q/24157345
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37389521
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24211670
has text: Befor doing this calcOpticalFlowPyrLK you should do this next2D = new MatOfPoint2D(). Did it work?
score: 0

http://stackoverflow.com/comment/37511096
score: 0
type: Comment
has text: Sorry my mistake. I have updated the answer with correct methods.
type: AnswerComment
comment on: http://stackoverflow.com/a/24238229

http://stackoverflow.com/comment/37378555
comment on: http://stackoverflow.com/q/24208531
has text: See [Array of Generic Interface](http://stackoverflow.com/a/3975913/).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37478551
comment on: http://stackoverflow.com/q/24260937
type: Comment
type: QuestionComment
has text: Hide that button :D and make it visible in onPostExecute().
score: 0

adapter
tags question: http://stackoverflow.com/q/24179400
tag name: adapter
tags question: http://stackoverflow.com/q/24259552
type: Tag

http://stackoverflow.com/q/24117089
possible better answer: http://stackoverflow.com/a/24117257
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
tagged with: io
accepted answer: http://stackoverflow.com/a/24117215
has title: Simple Java network IO is not working for large data
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24117257
tagged with: network-programming
has body: I'm experiencing a strange problem that does not appear on MACOS but only linux... When I run the following code in linux, i sometimes get an inconsistent message. The code just create two thread, where one sends a lot of byte array with all 1's to the other, and the other thread just check if all the contents are 1's. It happens occasionally(seems it depends on n..) that it receives 0. Can someone help me out? import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; public class TestIO { static final int n = 500000; final static byte d = 10; static class SenderRunnable implements Runnable { SenderRunnable () {} private ServerSocket sock; protected OutputStream os; public void run() { try { sock = new ServerSocket(12345); // create socket and bind to port Socket clientSock = sock.accept(); // wait for client to connect os = clientSock.getOutputStream(); byte[] a = new byte[10]; for(int i = 0; i &lt; 10; ++i) a[i] = d; for (int i = 0; i &lt; n; i++) { os.write(a); } os.flush(); sock.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } } static class ReceiverRunnable implements Runnable { ReceiverRunnable () {} private Socket sock; public InputStream is; public void run() { try { sock = new java.net.Socket("localhost", 12345); // create socket and connect is = sock.getInputStream(); for (int i = 0; i &lt; n; i++) { byte[] temp = new byte[10]; is.read(temp); for(int j = 0; j &lt; 10; ++j) if(temp[j] != d){ System.out.println("weird!"+" "+i+" "+j+" "+temp[j]); } } sock.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } } public static void test1Case() throws Exception { SenderRunnable sender = new SenderRunnable(); ReceiverRunnable receiver = new ReceiverRunnable(); Thread tSnd = new Thread(sender); Thread tRcv = new Thread(receiver); tSnd.start(); tRcv.start(); tSnd.join(); tRcv.join(); } public static void main(String[] args)throws Exception { test1Case(); test1Case(); te…
has answer: http://stackoverflow.com/a/24117215

http://stackoverflow.com/comment/37385109
comment on: http://stackoverflow.com/q/24211785
has text: This page may be helpful: https://help.ubuntu.com/community/Java
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40402255
type: Answer
has body: In test configuration you may wrap default message converter with another message converter which supports serialization of any object into String. package com.example; import org.apache.commons.io.IOUtils; import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpOutputMessage; import org.springframework.http.MediaType; import org.springframework.http.converter.AbstractHttpMessageConverter; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.http.converter.HttpMessageNotWritableException; import java.io.IOException; import java.util.Arrays; public class MockObjectHttpMessageConverter extends AbstractHttpMessageConverter { private final AbstractHttpMessageConverter primaryConverter; public MockObjectHttpMessageConverter(AbstractHttpMessageConverter primaryConverter) { this.primaryConverter = primaryConverter; setSupportedMediaTypes(Arrays.asList(MediaType.ALL)); } @Override protected boolean supports(Class clazz) { return true; } @Override protected Object readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { throw new UnsupportedOperationException(); } @Override protected void writeInternal(Object o, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { try { primaryConverter.write(o, MediaType.ALL, outputMessage); } catch (Exception e) { IOUtils.write(o.toString(), outputMessage.getBody()); } } } In Spring's context XML put: &lt;mvc:message-converters&gt; &lt;bean class="com.example.MockObjectHttpMessageConverter"&gt; &lt;constructor-arg&gt; &lt;bean class="org.springframework.http.converter.json.GsonHttpMessageConverter"&gt; &lt;property name="gson"&gt; &lt;bean class="com.google.gson.Gson" factory-bean="gsonBuilder" factory-method="create"/&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/constructor-arg&gt; &lt;/bean&gt; &lt;/mvc:message-converters&gt;
score: 0
answers question: http://stackoverflow.com/q/24199393

http://stackoverflow.com/a/24155349
answers question: http://stackoverflow.com/q/24155277
score: 1
type: Answer
downvote count: 0
upvote count: 1
has body: keyCode cannot be two keys at once. It can be either CTRL_LEFT or KEYCODE_S. This statement returns false because either one will be true but not both. (Its like a==3 &amp;&amp; a==4, a cannot be 3 and 4 at the same time) keyCode == KeyEvent.KEYCODE_CTRL_LEFT &amp;&amp; keyCode == KeyEvent.KEYCODE_S Probably you are looking for OR (||) operator: else if (keyCode == KeyEvent.KEYCODE_CTRL_LEFT || keyCode == KeyEvent.KEYCODE_S) { EDIT: If you want to check for two keypress. Here is the solution suggested in this post. One way would be to keep track yourself of what keys are currently down. When you get a keyPressed event, add the new key to the list; when you get a keyReleased event, remove the key from the list. Then in your game loop, you can do actions based on what's in the list of keys.

http://stackoverflow.com/comment/37425671
type: AnswerComment
has text: I think the answer should be edited, the `length()` method doesn't exist. Instead, you can use `size()`. Thank you for the brief start.
type: Comment
comment on: http://stackoverflow.com/a/24226427
score: 0

http://stackoverflow.com/comment/37235844
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24132719
score: 0
has text: @user2864740 You have to worry about the backing array in the sense that it will have performance impact to your code. I understand that we don't have to manually enlarging the backing array ourselves.

http://stackoverflow.com/a/24221663
has comment: http://stackoverflow.com/comment/37403317
type: AcceptedAnswer
has body: The ${latest.modified} contains the absolute path of the file. When you use this path in the include nested element, the copy task will not find the file in the directory specified in ${Engine.stagging.dir} and hence will not copy it. You can do the copy as follows: &lt;copy file="${latest.modified}" todir="${prjHop.release.dir}"/&gt;
type: Answer
accepted answer of: http://stackoverflow.com/q/24221439
answers question: http://stackoverflow.com/q/24221439
score: 0

http://stackoverflow.com/a/24121796
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37237616
has comment: http://stackoverflow.com/comment/37251707
score: 2
answers question: http://stackoverflow.com/q/24108591
has comment: http://stackoverflow.com/comment/37259720
type: Answer
has body: JVMTI capabilities you mentioned will not prevent from JIT compilation. However certain optimizations will be disabled, e.g. Escape Analysis and dead locals elimination. Also every thrown exception will cause deoptimization (switching to interpreter). Nevertheless, overall performance overhead should be negligible.

http://stackoverflow.com/comment/37396360
type: Comment
has text: @11684 I had similar problem earlier,and fruit was in my code,just typo.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24217911

http://stackoverflow.com/comment/37257684
type: QuestionComment
has text: You need to configure your firewall and set up port forwarding.
score: 0
comment on: http://stackoverflow.com/q/24144224
type: Comment

http://stackoverflow.com/comment/37419613
comment on: http://stackoverflow.com/a/24228290
type: Comment
score: 0
has text: Or you can look at the Swing tutorial on [Sorting and Filtering](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting) which has a working example that does exactly this along with explanations.
type: AnswerComment

http://stackoverflow.com/comment/37374971
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24139065
type: Comment
has text: Minimul and @nimishashrivastava for your consult but it did not work.I have tried to login with the second user with the oauth token values of previously saved logined user and all i understand the game depends on authorizeURL. when i tried to login with the authorizedURL of the previous saved user it gives me an "internal error" message and when i tried to login with the new authorizedURL it gives me the same error message "invalid database".So in both the cases i am not able to login with the second user. Any comments... Thanks in advance..

http://stackoverflow.com/a/24114140
answers question: http://stackoverflow.com/q/24114049
type: Answer
has body: String s1="C:\\Users\\me\\Desktop\\here"; String s2="C:\\Users\\me\\Desktop\\files\\1\\sample.txt"; String s3=s2.substring(s2.indexOf("\\files")); System.out.println(s1+s3); OUTPUT C:\Users\me\Desktop\here\files\1\sample.txt To get Absolute Path of file File f=new File("C:\\Users\\me\\Desktop\\files\\1\\sample.txt"); System.out.println(f.getAbsolutePath());
has comment: http://stackoverflow.com/comment/37201543
upvote count: 2
has comment: http://stackoverflow.com/comment/37201388
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24114049
score: 2

http://stackoverflow.com/comment/38700594
score: 0
has text: i tried that but that library does not work such type of images .they do not recognize the text.they given wrong output.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24140431

http://stackoverflow.com/comment/37396518
score: 0
type: AnswerComment
has text: @user3739735 Pls look at my comment above... You're missing backslashes. When you use a regex in Java you need a backslash before a regex backslash. Your `"(\[.*?\]\\s*){4}"` needs to be `"(\\[.*?\\]\\s*){4}"`
comment on: http://stackoverflow.com/a/24216897
type: Comment

http://stackoverflow.com/a/24237766
upvote count: 0
has body: If I understand correctly, then what you need is Maven, which is used for dependency management in Java projects. You define your dependencies inside a pom.xml file. Here is an example of such pom file (see the &lt; dependencies > tag ). Generally, when you need to use a 3rd-party library, you look it up in the Maven Central Repository, from which Maven looksup by default when you specify a dependency, and copy the &lt; dependency > element into you pom.xml file. NOTE: I don't know why, but right now the Maven site is down. You'll have to check back later. In the meantime try looking for some tutorials on google. If you need to import libraries which aren't in the Maven Repo, then you need to go to File>Project Structure>Libraries and click on the '+' symbol and add your .jar files from the your filesystem. You need to do this on every machine that needs to work on this project, and also include the jars in your final apk. I do not konw how to do the latter.
downvote count: 1
answers question: http://stackoverflow.com/q/24237606
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/37437628
has comment: http://stackoverflow.com/comment/37437798

http://stackoverflow.com/comment/37488390
has text: I just mean that if there is only one way, then that way is the fastest way by default.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24266256
score: 0

pojo
tags question: http://stackoverflow.com/q/24150609
type: Tag
tag name: pojo
tags question: http://stackoverflow.com/q/24173810
tags question: http://stackoverflow.com/q/24143012
tags question: http://stackoverflow.com/q/24204342
tags question: http://stackoverflow.com/q/24180208
tags question: http://stackoverflow.com/q/24207039

http://stackoverflow.com/q/24214291
upvote count: 1
favorite count: 0
type: Question
tagged with: network-programming
has title: Android coding: ViewRootImpl$CalledFromWrongThreadException. [Noob]
tagged with: android
has body: 06-13 17:29:30.750: W/dalvikvm(6257): threadid=13: thread exiting with uncaught exception (group=0xb1af0ba8) 06-13 17:29:30.780: E/AndroidRuntime(6257): FATAL EXCEPTION: Thread-251 06-13 17:29:30.780: E/AndroidRuntime(6257): Process: me.l0lkj.birthdaytimer, PID: 6257 06-13 17:29:30.780: E/AndroidRuntime(6257): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6094) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:857) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.view.ViewGroup.invalidateChild(ViewGroup.java:4320) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.view.View.invalidate(View.java:10935) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.view.View.invalidate(View.java:10890) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.widget.TextView.updateAfterEdit(TextView.java:7430) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.widget.TextView.handleTextChanged(TextView.java:7453) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:9183) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.text.SpannableStringBuilder.append(SpannableStringBuilder.java:253) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.text.SpannableStringBuilder.append(SpannableStringBuilder.java:30) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.widget.TextView.append(TextView.java:3409) 06-13 17:29:30.780: E/AndroidRuntime(6257): at android.widget.TextView.append(TextView.java:3396) …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24214421
score: 1
accepted answer: http://stackoverflow.com/a/24214421
tagged with: java
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37855128
score: 0
type: Comment
has text: Try increasing the buffer size, I've had problem with Kryonet due to too large packet.
type: QuestionComment
comment on: http://stackoverflow.com/q/24134655

http://stackoverflow.com/q/24248468
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24250386
has answer: http://stackoverflow.com/a/24250386
has comment: http://stackoverflow.com/comment/37455051
has body: I have a JPA Entities like this: @Entity class MyEntity{ @JsonIgnore @OneToMany(mappedBy = "application", cascade = ALL, fetch = LAZY) private List&lt;MyChildEnity&gt; myChildEntities; } ... @Entity class MyChildEnity { @ManyToOne(optional = false, fetch = FetchType.LAZY, cascade = { REFRESH, DETACH }) @JoinColumn(name = "APPLICATION_ID") private MyEntity application; } I access this entity from a REST call. When the number of elements is very large, and I try to delete the MyEntity Object the REST call hangs and then timeout. For small number of elements in MyChildEnity table it works fine. When I debugged, I saw that JPA fetches one record at a time and deletes it. This is too slow and too much work done. Is this an expected behavior? Shouldn't JPA be intelligent to convert this to a single DELETE call on the MyChildEnity table. I'm using OpenJPA with Derby and DB2 database.
tagged with: jpa
downvote count: 0
answer count: 1
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37455474
has title: Delete cascade hangs in JPA when large number of objects

python
tags question: http://stackoverflow.com/q/24130926
tags question: http://stackoverflow.com/q/24177277
tags question: http://stackoverflow.com/q/24211113
tags question: http://stackoverflow.com/q/24108965
type: Tag
tags question: http://stackoverflow.com/q/24225410
tags question: http://stackoverflow.com/q/24187976
tags question: http://stackoverflow.com/q/24256350
tags question: http://stackoverflow.com/q/24233812
tags question: http://stackoverflow.com/q/24166088
tag name: python
tags question: http://stackoverflow.com/q/24129693
tags question: http://stackoverflow.com/q/24224799
tags question: http://stackoverflow.com/q/24112194
tags question: http://stackoverflow.com/q/24185803
tags question: http://stackoverflow.com/q/24117957

http://stackoverflow.com/a/24207771
has comment: http://stackoverflow.com/comment/37376726
downvote count: 0
has comment: http://stackoverflow.com/comment/37397037
has comment: http://stackoverflow.com/comment/37376734
has body: Access to a local variable ist faster than to an instance variable. Also the new Java 8 Code (see Anubians answer) take account of this. This is the reason why they use a local variable h for the hash calculations and don't access the instance variable this.hash directly and create the local pointer char val[] = value;. But with this in mind I don't know why they don't use i &lt; val.length; or even better z = val.length; i &lt; z; in the for loop but i &lt; value.length;.
answers question: http://stackoverflow.com/q/24207236
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/37314764
type: QuestionComment
score: 0
has text: I think now I have accepted. And Please don't stop helping. stackoverflow is the best.
comment on: http://stackoverflow.com/q/24174694
type: Comment

http://stackoverflow.com/q/24134581
type: AnsweredQuestion
tagged with: actionlistener
possible better answer: http://stackoverflow.com/a/24134682
tagged with: java
score: -1
has body: I have been trying to show a message on the Frame saying that "Car is selected " After the I press the button OK ; i have been trying to fix this problem buti dont know how to can anyone please help me ? import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.HashMap; import java.util.Map; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; public class SelectWindow extends JFrame implements ItemListener { public static void main(String[] args) { new SelectWindow(); } Map&lt;String, String[]&gt; cars = new HashMap&lt;String, String[]&gt;(); JComboBox brands; JComboBox models; public SelectWindow() { initCars(); setTitle("Select a car"); brands = new JComboBox(); brands.addItem("&lt;none&gt;"); for (String brand : cars.keySet()) { brands.addItem(brand); } brands.addItemListener(this); models = new JComboBox(); models.setEnabled(false); models.addItemListener(this); Container c = getContentPane(); c.setLayout(new FlowLayout()); c.add(new JLabel("Select a brand: ")); c.add(brands); c.add(new JLabel("Select a model: ")); c.add(models); c.add(new JButton("OK")); setVisible(true); } @Override public void itemStateChanged(ItemEvent e) { if (e.getSource() == brands &amp;&amp; e.getStateChange() == ItemEvent.SELECTED) { String[] items = cars.get(e.getItem()); if (items == null) { models.removeAllItems(); models.setEnabled(false); } else { models.removeAllItems(); models.addItem("&lt;none&gt;"); for (String item : items) { models.addItem(item); } models.setEnabled(true); } JLabel texte = new JLabel("car was selected"); JButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { texte.setVisible(true); } }); } } private void initCars() { cars.put("Renault", new String[]{ "Twingo", "Clio", "Modus", "Kangoo", "Mégane", "Sénic", …
has comment: http://stackoverflow.com/comment/37239177
has answer: http://stackoverflow.com/a/24134784
type: Question
answer count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/37239128
has answer: http://stackoverflow.com/a/24134682
upvote count: 1
accepted answer: http://stackoverflow.com/a/24134784
tagged with: swing
tagged with: variables
has comment: http://stackoverflow.com/comment/37239089
has answer: http://stackoverflow.com/a/24134675
favorite count: 0
tagged with: jbutton
has title: Swing Java ActionListener
has comment: http://stackoverflow.com/comment/37239153

http://stackoverflow.com/q/24146479
type: UnansweredQuestion
has body: I build a JTable in which every cell is a JTable itself. I need to make the cells of the nested (inner) tables clickable so that some additional information will be displayed in a pop-up window on a mouse click. What is the best way to do this? Should I define every cell as a button? Thank you in advance.
tagged with: swing
linked to: http://stackoverflow.com/q/8257148
has comment: http://stackoverflow.com/comment/37261521
has comment: http://stackoverflow.com/comment/37263641
tagged with: jtable
linked to: http://stackoverflow.com/q/1378096
has answer: http://stackoverflow.com/a/24150805
score: 1
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37262909
upvote count: 1
has comment: http://stackoverflow.com/comment/37267349
has comment: http://stackoverflow.com/comment/37267258
favorite count: 0
type: Question
has title: JTable: defining a nested table with clickable cells

http://stackoverflow.com/a/24260233
upvote count: 6
score: 6
accepted answer of: http://stackoverflow.com/q/24259890
has comment: http://stackoverflow.com/comment/37476916
has comment: http://stackoverflow.com/comment/37477389
type: Answer
has body: Try comparing the year and the week in the year, using WEEK_OF_WEEK_BASED_YEAR: LocalDate now = LocalDate.now(); if(lastUpdate.get(IsoFields.WEEK_BASED_YEAR) != now.get(IsoFields.WEEK_BASED_YEAR) || lastUpdate.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR) != now.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR))
has comment: http://stackoverflow.com/comment/37476896
downvote count: 0
answers question: http://stackoverflow.com/q/24259890
has comment: http://stackoverflow.com/comment/37928538
type: AcceptedAnswer

http://stackoverflow.com/comment/37448249
score: 0
type: Comment
type: QuestionComment
has text: See http://stackoverflow.com/a/19444515/3190413
comment on: http://stackoverflow.com/q/24245215

http://stackoverflow.com/comment/37238468
has text: You're out of memory. It may be the bitmap is too big, it may be that you have a leak elsewhere. You need to look at your memory use in a heap profiler to tell what's going on.
type: Comment
comment on: http://stackoverflow.com/q/24134270
type: QuestionComment
score: 0

http://stackoverflow.com/q/24216484
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37393905
has comment: http://stackoverflow.com/comment/37393926
has body: So I'm wrapping my head around multithreading and I made a very basic program to play around with. The idea is simply I would start a couple of threads, and each would race down (decrement) to zero at which point one would be declared the winner and the others would stop immediately. I have used a boolean flag, which terminates the other threads but sometimes they carry on for a bit (I guess until they do the check in the while loop to see if run is still true). I have tried interrupts but my understanding is that these only work on threads that are sleeping, awaiting etc, and the threads I am using a pretty much running the whole time. I have used system.exit(1) but this doesn't stop them either, at least not immediately. Just wondering what more experienced people would do? Basically I just want a thread to say "OK everybody stop what you are doing RIGHT NOW". Here is the code: Runnable Class public class ThreadRunnable implements Runnable { private static boolean run; private int tick; public ThreadRunnable() { run = true; tick = 5; } public void run() { Thread t = Thread.currentThread(); while (run) { tickDeduction(); if (tick == 0) { System.out.println("Thread " + (Thread.currentThread().getId()) + " WINS"); this.run = false; return; } } } public synchronized void tickDeduction() { System.out.println("Thread " + (Thread.currentThread().getId()) + " is at tick " + this.tick); this.tick--; } } Main Class public static void main(String[] args) { ThreadRunnable runnableBlue = new ThreadRunnable(); ThreadRunnable runnableRed = new ThreadRunnable(); Thread teamBlue = new Thread(runnableBlue); Thread teamRed = new Thread(runnableRed); teamBlue.start(); teamRed.start(); }
tagged with: java
has comment: http://stackoverflow.com/comment/37394060
has comment: http://stackoverflow.com/comment/37393995
has comment: http://stackoverflow.com/comment/37393914
has comment: http://stackoverflow.com/comment/37393830
has comment: http://stackoverflow.com/comment/37394072
favorite count: 0
has comment: http://stackoverflow.com/comment/37393895
type: Question
has comment: http://stackoverflow.com/comment/37393956
has comment: http://stackoverflow.com/comment/37393890
has comment: http://stackoverflow.com/comment/37393937
answer count: 2
has answer: http://stackoverflow.com/a/24216549
accepted answer: http://stackoverflow.com/a/24216549
upvote count: 2
has comment: http://stackoverflow.com/comment/37393999
has title: How can I stop all alive threads from running
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37393898
has comment: http://stackoverflow.com/comment/37393955
downvote count: 0
has comment: http://stackoverflow.com/comment/37393927
has answer: http://stackoverflow.com/a/24216671
possible better answer: http://stackoverflow.com/a/24216671

http://stackoverflow.com/comment/37222793
type: AnswerComment
has text: I see 39 piece of my txt.
type: Comment
comment on: http://stackoverflow.com/a/24125808
score: 0

http://stackoverflow.com/q/24113659
tagged with: oop
has comment: http://stackoverflow.com/comment/37201270
tagged with: java
has title: Implementing a way to change a JLabel from another class in my game Part 3?
answer count: 1
has comment: http://stackoverflow.com/comment/37199975
has body: I am currently having trouble with being able to change the choiceDeclaration JLabel. My mindset behind the choiceDeclaration JLabel is to simply display text based on which JButton is clicked. Here is my current code for the project: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JLabel; import java.awt.event.*; public class prompt { public static void main(String []args) { /* Setting up the JPanel and its necessities for this program */ JFrame choicePrompt = new JFrame("Rock, Paper, Scissors Game"); JPanel choicePanel = new JPanel(); JButton rockButton = new JButton("ROCK"); JButton scissorsButton = new JButton("SCISSORS"); JButton paperButton = new JButton("PAPER"); JLabel choiceDeclaration = new JLabel(); choicePrompt.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); choicePrompt.setResizable(false); choicePrompt.setSize(300, 300); choicePrompt.setVisible(true); choiceDeclaration.setVisible(true); choicePrompt.add(choicePanel); choicePanel.add(choiceDeclaration); choicePanel.add(rockButton); choicePanel.add(scissorsButton); choicePanel.add(paperButton); choiceDeclaration.setVerticalTextPosition(JLabel.TOP); choiceDeclaration.setHorizontalTextPosition(JLabel.CENTER); /* ActionListeners for the JButtons */ rockButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { /*I have not placed any code in here because I have not gotten that far*/ } }); scissorsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { /*I have not placed any code in here because I have not gotten that far*/ } }); paperButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { /*I have not placed any code in here because I have not gotten that far*/ } }); } } I cannot use a setText method in my ActionListeners as shown below because it conflicts with my main class method a line below the declaration of my class. The…
type: Question
has answer: http://stackoverflow.com/a/24119858
tagged with: actionlistener
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
tagged with: swing
favorite count: 0
tagged with: jbutton

http://stackoverflow.com/comment/37279227
type: AnswerComment
comment on: http://stackoverflow.com/a/24140992
score: 0
type: Comment
has text: i am trying to make a recursive code for parsing a Plist... That's why i choose to solve it with recursion.

http://stackoverflow.com/q/24210992
tagged with: spring
has answer: http://stackoverflow.com/a/24233100
has answer: http://stackoverflow.com/a/24211817
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has body: I’m trying to set up a website using Spring. I already managed to read data from a database I've set up, but now encountered a problem when trying to update rows in it. I'm using the merge() function of the EntityManager. I don't get any errors or exceptions, it just wont update the data on the DB. I'll try to give all relevant code. The entity class I want to change: I already managed to fill it with data from the DB, so I think it should be alright. Benutzer.java @Entity @Table(name = "BENUTZER") @NamedQueries({ @NamedQuery(name = "Benutzer.findAll", query = "SELECT tt FROM Benutzer tt"), @NamedQuery(name = "Benutzer.findByKennung", query = "SELECT tt FROM Benutzer tt WHERE tt.kennung = :kennung"), public class Benutzer { @Id @GeneratedValue private BigInteger oid; @Size(min = 2, max = 20) @Pattern(regexp = "[A-Za-z ]*", message = "Titel darf nur Buchstaben und Leerzeichen beinhalten") private String titel; @NotNull @Size(min = 2, max = 25) @Pattern(regexp = "[A-Za-z ]*", message = "Anrede darf nur Buchstaben und Leerzeichen beinhalten") private String anrede; @NotNull @Size(min = 2, max = 45) @Pattern(regexp = "[A-Za-z ]*", message = "Name darf nur Buchstaben und Leerzeichen beinhalten") private String name; @NotNull @Size(min = 2, max = 45) @Pattern(regexp = "[A-Za-z ]*", message = "Vorname darf nur Buchstaben und Leerzeichen beinhalten") private String vorname; @NotNull @Size(min = 6, max = 16) @Pattern(regexp = "[0-9]*", message = "Telefonnummer darf nur aus Zahlen bestehen") private String telefonnummer; @Size(max = 25, message = "Fax darf maximal 25 Zahlen beinhalten") @Pattern(regexp = "[0-9]*", message = "Fax darf nur aus Zahlen bestehen") private String fax; @NotNull @Size(min = 2, max = 45) @Pattern(regexp = "[A-Za-z0-9 ]*", message = "Straße darf nur Buchstaben, Leerzeichen und Hausnummer beinhalten") private String strasse; @NotNull @Size(min = 2, max = 45) @Pattern(regexp = "[A-Za-z0-9 ]*", message = "Ort darf nur Buchstaben, Leerzeichen und PLZ beinh…
answer count: 3
has answer: http://stackoverflow.com/a/24233706
has title: Spring framework can't save in Database using EntityManager.merge()
tagged with: java
tagged with: hibernate
tagged with: hibernate-entitymanager
possible better answer: http://stackoverflow.com/a/24211817
accepted answer: http://stackoverflow.com/a/24233706
type: Question
linked to: http://stackoverflow.com/q/19388214

http://stackoverflow.com/comment/37415388
has text: Cant use text, has to be an object for .equal
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24228098
type: Comment

http://stackoverflow.com/q/24153152
has body: I would like to understand how to calculate maximum and minimum number of web container threads in web server e.g. Tomcat, WAS. I would like to understand optimum threads configuration for maximum performance. Thanks is advance! I found answer in thread below How many simultaneous threads in an application is a lot?
tagged with: tomcat
favorite count: 0
type: Question
score: -2
has title: How to calculate maximum and minimum number of web container threads in web server e.g. Tomcat, WAS
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24328673
upvote count: 0
tagged with: java
downvote count: 2
tagged with: multithreading
answer count: 1
linked to: http://stackoverflow.com/q/363079
has answer: http://stackoverflow.com/a/24328673

http://stackoverflow.com/comment/37272288
type: Comment
type: QuestionComment
has text: What's `e`? What is it?
score: 0
comment on: http://stackoverflow.com/q/24152109

http://stackoverflow.com/a/24109732
has comment: http://stackoverflow.com/comment/37192773
type: Answer
answers question: http://stackoverflow.com/q/24109562
score: 0
has body: Looks like what you're trying to do is: posObsc[i][0] = ordObsc; There's no need to use a setter if you're in the same class. If you want to be able to externally set an element value by index (instead of overwriting the whole array), there are two ways to go about it: 1) (Not recommended) Since you're exposing the whole array in your getter, you can theoretically call getPostObsc()[i][0] = ordObsc; 2) (Recommended) Change your getter and setter to public float getPosObsc(int x, int y){ return posObsc[x][y]; } public void setPosObsc(int x, int y, float val){ this.posObsc[x][y] = val; } Now you can update an element using the setter with an index: setPostObsc(i, 0, ordObsc);

http://stackoverflow.com/a/24133201
type: Answer
has body: Try changing &lt;textView android:text="I like totally love you" android:id="@+id/tvAbot" android:layout_height="wrap_content" android:layout_width="wrap_content" /&gt; to &lt;TextView android:text="I like totally love you" android:id="@+id/tvAbot" android:layout_height="wrap_content" android:layout_width="wrap_content" /&gt; Is there any class with name SWEET?. I think you should change startActivity (new Intent("com.example.thebasics.SWEET")); to startActivity (new Intent(this,Sweet.class));. Because logcat is showing ClassNotFoundException
score: 0
answers question: http://stackoverflow.com/q/24133093

http://stackoverflow.com/q/24113652
type: Question
has answer: http://stackoverflow.com/a/24113781
tagged with: android-layout
has comment: http://stackoverflow.com/comment/37199998
has answer: http://stackoverflow.com/a/24113853
possible better answer: http://stackoverflow.com/a/24113853
accepted answer: http://stackoverflow.com/a/24114145
tagged with: android
has answer: http://stackoverflow.com/a/24113894
has body: I am trying to make a simple Checkbook app, whose MainActivity stores a list of transactions. I would like a TextView at the top and bottom of the screen that show the account balance and an option to add a new transaction, respectively. I would like a list of transactions in between that scroll. I was able to implement a ListView and add a header and footer view, but if the transaction list exceeds the size of the screen the headers and footers can scroll off screen. Is there any way to position a ListView within the linear layout, or freeze the headers/footers to stay on the screen? Here is my XML file so far: And here is my onCreate, which has no syntax errors but I am unable to click the footerview to add a transaction: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_checkbook); ListView list = (ListView) findViewById(R.id.transaction_list_view); // Create a new Adapter mAdapter = new TransactionAdapter(list.getContext()); // Inflate footerView and headerView LayoutInflater inflater = getLayoutInflater(); TextView headerView = (TextView) inflater.inflate(R.layout.header_view, null); TextView footerView = (TextView) inflater.inflate(R.layout.footer_view, null); // Set listener for footerView footerView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent transactionIntent = new Intent(CheckbookActivity.this, AddTransactionActivity.class); startActivityForResult(transactionIntent, ADD_TRANSACTION_REQUEST); } }); list.setAdapter(mAdapter); }
answer count: 6
has answer: http://stackoverflow.com/a/24113815
linked to: http://stackoverflow.com/q/12946329
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24113875
has comment: http://stackoverflow.com/comment/37200041
tagged with: android-listview
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/24114145
tagged with: java
downvote count: 0
tagged with: android-linearlayout
has comment: http://stackoverflow.com/comment/37200090
has title: How can I implement a ListView within a LinearLayout?
favorite count: 0

http://stackoverflow.com/comment/37329825
comment on: http://stackoverflow.com/a/24183514
has text: It don't work even at the first time, my "offers" table is still empty. Moreover, if I understand SQL well, `UNIQUE (game_state_id, city_id, item_id)` is saying, that this tuple has to be unique, not only the `game_state_id`.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24234971
answers question: http://stackoverflow.com/q/24234901
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37428972
accepted answer of: http://stackoverflow.com/q/24234901
has comment: http://stackoverflow.com/comment/37429926
type: Answer
has body: It's very simple. As you have overridden init() method in both the classes hence init() method of ServletUtils is never called and userCalculation is never initialized. Read more about Oracle Java Tutorial - Polymorphism Oracle Java Tutorial - Overriding and Hiding Methods Try public class ServletAdicional extends ServletUtils { @Override public void init(ServletConfig config) { super.init(config); ... } } Let's have a look at simple program to understand it. interface Init { public void init(); } class ServletUtils implements Init { @Override public void init() { System.out.println("inside ServletUtils's init method"); } } class ServletAdicional extends ServletUtils { @Override public void init() { System.out.println("inside ServletAdicional's init method"); } } public static void main(String[] args) throws Exception { Init init = new ServletAdicional(); init.init(); } output: inside ServletAdicional's init method Some Points: Call super.init(config); in ServletUtils class as well. Try to avoid instance members in Servlet such as user if it's not a singleton because it's treated as shared object for multiple requests to the Servlet. If you don't want to provide any implementation they don't override these methods. Don't make HttpServletRequest and HttpServletResponse as instance members of the Servlet if needed then simply pass it as method arguments.
score: 1

http://stackoverflow.com/comment/37196868
score: 0
type: Comment
has text: `i` being what value?
type: AnswerComment
comment on: http://stackoverflow.com/a/24111748

http://stackoverflow.com/comment/37454182
has text: You would need to create the file in the copy of the webapp in the "dist" folder of your project IIRC. If anyone is more familiar with NetBeans in-place deployment, correct me if I'm wrong.
score: 0
comment on: http://stackoverflow.com/q/24231873
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37359947
score: 1
type: Comment
has text: @Abimaran Kugathasan : Thanks... I understood the concept lies beside.
type: AnswerComment
comment on: http://stackoverflow.com/a/24198655

http://stackoverflow.com/q/24154505
has body: I can't seem to get my web application to write to my WEB-INF/EmailList.txt My code is this Servlet: package email; import business.User; import data.UserIO; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Richard Davy */ @WebServlet(name = "AddToEmailServlet", urlPatterns = {"/AddToEmailServlet"}) public class AddToEmailServlet extends HttpServlet { /** * Processes requests for both HTTP GET and POST * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println(" "); out.println(" "); out.println(" "); out.println(" Servlet AddToEmailServlet "); out.println(" "); out.println(" "); out.println(" Servlet AddToEmailServlet at " + request.getContextPath() + " "); out.println(" "); out.println(" "); } } // /** * Handles the HTTP POST method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //get parameters from the form String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String email = request.getParameter("email"); //get relative file name ServletContext context …
tagged with: jsp
has comment: http://stackoverflow.com/comment/37277425
has comment: http://stackoverflow.com/comment/37277309
tagged with: tomcat
score: 0
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37276820
has answer: http://stackoverflow.com/a/24155497
has comment: http://stackoverflow.com/comment/37276716
has title: Print to txt file from servlet and jsp's
has answer: http://stackoverflow.com/a/24156271
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/37277189
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24155331

http://stackoverflow.com/comment/37377540
type: QuestionComment
has text: what is you issue? the output log?
comment on: http://stackoverflow.com/q/24206422
score: 0
type: Comment

http://stackoverflow.com/q/24116663
downvote count: 5
has comment: http://stackoverflow.com/comment/37205377
has comment: http://stackoverflow.com/comment/37205626
has comment: http://stackoverflow.com/comment/37205301
has answer: http://stackoverflow.com/a/24116797
score: -5
upvote count: 0
tagged with: java
answer count: 1
favorite count: 0
type: Question
has body: This is my code but it gives me this error class MultiplyDivide { public static void main (String args[]) { int i = 5; int j = 10; System.out.println("5 is " + i); System.out.println("10 is " + j); int k = i/j; System.out.println("5/10 is " + k); k = i * j; System.out.println("5 * 10 is " + k); } }
has title: Error Incompatible types in java
has comment: http://stackoverflow.com/comment/37205323
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37205344

http://stackoverflow.com/comment/37376390
score: 0
type: Comment
type: QuestionComment
has text: I'm redirecting to a page that is in the path covered by the security-costraint. Maybe the cookie is not secure? I have to chek, from now I could see that the cookie start from the browser when i call my servlet and the servlet return that same cookie.
comment on: http://stackoverflow.com/q/24205905

http://stackoverflow.com/q/24165670
has title: Trying jsoup: getting "cannot find symbol" when I just declared it the line before
tagged with: jsoup
accepted answer: http://stackoverflow.com/a/24165700
type: AnsweredQuestion
score: 0
has body: I need to find a value in an html table, so right now I'm trying to get the hang of JSoup. I'm trying to use implement this code: http://jsoup.org/cookbook/extracting-data/dom-navigation The first two lines I've implemented, but the third one (Element content = doc.getElementById("content");) causes an "error: cannot find symbol. symbol: variable doc. location: class testparse). Here is my code: import org.jsoup.*; import org.jsoup.nodes.*; import java.io.*; public class testparse { public static void main(String[] args){ try { File input = new File("abc.htm"); Document doc = Jsoup.parse(input, "UTF-8", ""); } catch(IOException exc){ System.out.println(exc); } Element content = doc.getElementById("content"); } } All help is greatly appreciated!
tagged with: java
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/37296859
has answer: http://stackoverflow.com/a/24165700
type: Question

http://stackoverflow.com/comment/37411177
comment on: http://stackoverflow.com/a/24170202
type: AnswerComment
score: 0
has text: never knew about that, I should really read up on java logic and what not. thanks!
type: Comment

http://stackoverflow.com/comment/37222246
has text: its the main calss which contains downloadit() and first one is myAsync name ofcourse :)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24125637
type: Comment

http://stackoverflow.com/a/24211612
has body: Try putStringArrayListExtra() instead: Intent i1= new Intent(context, WriteExcel.class); i1.putStringArrayListExtra("stock_list", arrTransfer); context.startService(i1); When you call startService(i1), android starts the activity WriteExcel (assuming you've done it correctly) by calling its onCreate() method and passing it the Intent. So this is where you should handle the Intent. Your onCreate() could look something like this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); ArrayList&lt;String&gt; stock_list = intent.getStringArrayListExtra("stock_list"); }
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37388502
has comment: http://stackoverflow.com/comment/37389031
answers question: http://stackoverflow.com/q/24211283
has comment: http://stackoverflow.com/comment/37388775
has comment: http://stackoverflow.com/comment/37389460

http://stackoverflow.com/comment/37366720
score: 0
type: Comment
type: QuestionComment
has text: A web service. CORBA. ...
comment on: http://stackoverflow.com/q/24193128

http://stackoverflow.com/comment/37271291
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24151250
has text: I guess he means that there is a circular dependency between the classes (source files). Some code quality tools may complain about this, especially if they are in different packages. But indeed I don't think it's really a problem in this case.
score: 0

http://stackoverflow.com/comment/37414807
type: QuestionComment
comment on: http://stackoverflow.com/q/24227215
score: 0
has text: If it is check if v has parent. If it does then call fromHelper(k, i-i, v.parent) but after running through many test cases, I realized this approach does not work because after a certain number of recursive calls, your size(v) becomes less than i but the answer is still one of the child nodes. I honestly have no idea how else to use the size function. I've been trying for a while but I honestly cannot think of one.
type: Comment

http://stackoverflow.com/comment/37429143
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24235036
score: 0
has text: @user3580294 The whole point is to keep the list from randomizing itself, randomly. I doubt he's randomizing it himself, at least not on purpose. `List` (specifically `ArrayList`, since that's the one I use most often) iterators go through the list in sequential order, based on insertion. So why wouldn't utilizing an `ArrayList` be a viable option (at least to test).

http://stackoverflow.com/a/24184188
type: Answer
has body: You are using the same object each time the Scanner read a new values, so you need to create a new Person object each time you able fetch new value. For Example: while(scn.hasNext()){ int age = scn.next(); String name = scn.nextInt(); Person p = new Person(name, age); lst.add(p); }
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24184062
downvote count: 0

http://stackoverflow.com/q/24241453
tagged with: php
score: 0
has answer: http://stackoverflow.com/a/24641537
has comment: http://stackoverflow.com/comment/37441680
has comment: http://stackoverflow.com/comment/37441038
has comment: http://stackoverflow.com/comment/38193818
tagged with: java
has body: I work in a android app which should show the details of a virtual database(WAMPSERVER i use) and make new documents. When i push the button of show details the app displays the above error.The following is the allproductsactivity.java file.I have see and other similar post but i can't understand and solve my problem. I put x.x.x.x:80 on IP address for security reasons. AllProductsActivity.java package com.panos.appphpconnect; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.http.NameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; 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.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; public class AllProductsActivity extends ListActivity { private ProgressDialog pDialog; JSONParser jParser=new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; productsList; // url to get all products list private static String url_all_products = "http://x.x.x.x:80/connect/get_all_products.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_CLASSES = "classes"; private static final String TAG_PID = "_id"; private static final String TAG_NAME = "username"; // products JSONArray JSONArray products = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.allproducts); // Hashmap for ListView productsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Loading products in Background Thread new LoadAllProducts().execute(); // Get listview ListView lv = getListView(); // on seleting single product // launching E…
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37542451
answer count: 1
has title: Error parsing dataorg.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
type: Question
has comment: http://stackoverflow.com/comment/37441044
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38193897

http://stackoverflow.com/a/24161441
type: Answer
score: 1
has body: public class MainActivity extends Activity implements OnClickListener { Button ShowText; TextView DisplayText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ShowText = (Button) findViewById(R.id.bShowText); DisplayText = (TextView) findViewById(R.id.tvShowText); ShowText.setOnClickListener(this); } @Override public void onClick(View v) { if (v.getId() == ShowText.getId()) // need to check ID because from which view has fire event soo we can handle appropriate DisplayText.setVisibility(View.VISIBLE); } }
has comment: http://stackoverflow.com/comment/37288762
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37288724
answers question: http://stackoverflow.com/q/24161231

http://stackoverflow.com/q/24126618
answer count: 1
tagged with: junit
downvote count: 0
upvote count: 1
has title: DefaultRollback after running all test cases
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I have an Integration test as shown below, and I want to rollback the changes to the database after going through the test cases. Now my question is is there a way to prevent default rollback from happening after each test case and have a roll back once all the test cases are done. After surfing a bit I found that TestNG can be helpful, but I don't want to use that. Is there any other alternative? @TransactionConfiguration(transactionManager = "myTransactionManager", defaultRollback = true) public class TestDependencies extends testBase { @Test public void testSetupData() throws SQLException, Exception{ //Some initial setup code. } @Test public void testFunctionality throws Exception{ //here i will further test some more functionality } }
tagged with: spring
tagged with: testng
has answer: http://stackoverflow.com/a/24150929
score: 1
tagged with: java

http://stackoverflow.com/q/24206355
has comment: http://stackoverflow.com/comment/37433732
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28721436
score: 3
tagged with: cassandra
answer count: 2
upvote count: 3
tagged with: java
downvote count: 0
has title: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/transport/TTransportException
has comment: http://stackoverflow.com/comment/37436653
has answer: http://stackoverflow.com/a/24208057
has body: I am new to Cassandra and i am trying to create a column and super-column family with the below program in Eclipse: import java.util.Arrays; import java.util.List; import me.prettyprint.cassandra.model.BasicColumnDefinition; import me.prettyprint.cassandra.model.BasicColumnFamilyDefinition; import me.prettyprint.cassandra.serializers.StringSerializer; import me.prettyprint.cassandra.service.ThriftCfDef; import me.prettyprint.hector.api.Cluster; import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; import me.prettyprint.hector.api.ddl.ColumnIndexType; import me.prettyprint.hector.api.ddl.ColumnType; import me.prettyprint.hector.api.ddl.ComparatorType; import me.prettyprint.hector.api.ddl.KeyspaceDefinition; import me.prettyprint.hector.api.exceptions.HectorException; import me.prettyprint.hector.api.factory.HFactory; public class HectorTutorial { private static final String TEST_KEYSPACE = "TestKeyspace"; private static final String TEST_CF= "TestColumnFamily"; private static final String TEST_SUPER= "TestSuperColumn"; private static StringSerializer stringSerializer = StringSerializer.get(); public static void main(String[] args) throws Exception { Cluster cluster = HFactory.getOrCreateCluster("TestCluster", "localhost:9160"); try { if ( cluster.describeKeyspace(TEST_KEYSPACE ) != null ) { cluster.dropKeyspace(TEST_KEYSPACE ); } BasicColumnDefinition columnDefinition = new BasicColumnDefinition(); columnDefinition.setName(stringSerializer.toByteBuffer("TestColumn")); columnDefinition.setIndexName("TestColumn_idx "); columnDefinition.setIndexType(ColumnIndexType.KEYS); columnDefinition.setValidationClass(ComparatorType.LONGTYPE.getClassName()); BasicColumnFamilyDefinition columnFamilyDefinition = new BasicColumnFamilyDefinition(); columnFamilyDefinition.setKeyspaceName(TEST_KEYSPACE ); columnFamilyDefinition.setName(TEST_CF); columnFamilyDefinition.addColumnDefinition(columnDefinition); BasicColumnFamilyDefinition superCfDefinition = new BasicColumnFamilyDefin…
tagged with: hector
favorite count: 0
type: Question

http://stackoverflow.com/a/24187468
has body: From the libGDX's wiki FreeTypeFont Gradle Core Dependency: compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" Desktop Dependency: compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" Android Dependency: compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" iOS Dependency: compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" Don't forget to refresh your dependencies ;)
has comment: http://stackoverflow.com/comment/37369638
type: AcceptedAnswer
score: 13
accepted answer of: http://stackoverflow.com/q/24187057
answers question: http://stackoverflow.com/q/24187057
type: Answer
upvote count: 13
has comment: http://stackoverflow.com/comment/37337788
has comment: http://stackoverflow.com/comment/37337742
downvote count: 0
has comment: http://stackoverflow.com/comment/37338077

http://stackoverflow.com/comment/37411167
comment on: http://stackoverflow.com/a/24225552
score: 0
type: Comment
has text: What would be the best layout (not java layout) for doing this? Should I make three panel grid arrays, and place labels in each of them, or should I make one panel, but make a grid of labels inside, and change them as I need to?
type: AnswerComment

http://stackoverflow.com/q/24253687
favorite count: 0
type: Question
has body: i'm trying to execute a simple oracle sql command from java like. So i have a Utility class in my project where i put these two codes: 1- connection to DB public static Connection DBConnec(){ Connection cn = null; try{ Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@" + Util.getPropertyValue("dbHost") + ":" + "1500" + ":" + "ddv"; //creating connection to Oracle database using JDBC cn = DriverManager.getConnection(url, Util.getPropertyValue("User"), Util.getPropertyValue("Password")); System.out.println("Connection...OK"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return cn; } 2- simple query public static ResultSet getData(Connection cn){ ResultSet result2 = null; try { String sql = ("SELECT * FROM TABLE"); PreparedStatement preStatement = cn.prepareStatement(sql); result2 = preStatement.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } return result2; } So i call the first method like this: public Query(Connection cn ){ //Connection to Database System.out.println("Connection to Database OK"); Utility.dbConnec(); It 's working perfectly. Now how can i call the second method: getData(Connection cn)// it's not working Please any help. thank you
tagged with: java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24253883
score: 1
answer count: 1
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24253883
has title: How to get data from table using java

abstract-syntax-tree
tags question: http://stackoverflow.com/q/24118420
type: Tag
tags question: http://stackoverflow.com/q/24208450
tags question: http://stackoverflow.com/q/24185601
tags question: http://stackoverflow.com/q/24230554
tag name: abstract-syntax-tree

http://stackoverflow.com/comment/37405707
type: AnswerComment
comment on: http://stackoverflow.com/a/24220982
score: 0
has text: It is said that thread t is started, so execution is started. Therefore nothing happens another thread sets t to null.
type: Comment

http://stackoverflow.com/q/24250345
accepted answer: http://stackoverflow.com/a/24250444
downvote count: 0
has title: Why during the install phase of maven cycle, package phase is called as well?
has answer: http://stackoverflow.com/a/24250444
tagged with: maven
has body: I have in my pom.xml a section <plugin> org.apache.maven.plugins maven-install-plugin ./lib/pom.xml ./lib/wls-maven-plugin.jar install install-file where i want to install the Weblogic plugin to my local repository. Note i indicated that i want this to be done in install phase. Then i want to use this plugin but in package and deploy phases. However when i try to run mvn install the package phase is invoked as well and i get error because my weblogic plugin is not installed yet. So why this is happening? I want my plugin to be installed first and then used. Sorry fo poor English.
has answer: http://stackoverflow.com/a/24250409
favorite count: 0
has answer: http://stackoverflow.com/a/71613196
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37459001
tagged with: java
tagged with: maven-package
possible better answer: http://stackoverflow.com/a/24250409
tagged with: maven-install-plugin
answer count: 4
has answer: http://stackoverflow.com/a/24250357
type: Question
score: 2
upvote count: 2

http://stackoverflow.com/q/24137628
has answer: http://stackoverflow.com/a/24140958
has comment: http://stackoverflow.com/comment/37247843
has comment: http://stackoverflow.com/comment/37244754
type: Question
has comment: http://stackoverflow.com/comment/37248395
has answer: http://stackoverflow.com/a/24139858
has comment: http://stackoverflow.com/comment/37244975
score: 0
tagged with: multidimensional-array
answer count: 5
has comment: http://stackoverflow.com/comment/37244741
has title: Why 2D array return 'null'?
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37245153
has answer: http://stackoverflow.com/a/24139440
has body: i make a 2D String array in main activity but i make NEW in another activity : public class MainActivity extends Activity { public String[][] arr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); requestpayment requestpayment=new requestpayment(getApplicationContext(), 1, 8, "boy"); TextView textView=(TextView)findViewById(R.id.text); textView.setText(arr[1][1].toString()); } } In second Activity i use 2d array in this form : int i=1; MainActivity mainActivity=new MainActivity(); mainActivity.arr= new String[5][5]; mainActivity.arr[i][0] = FLName; mainActivity.arr[i][1] = Old; mainActivity.arr[i][2] = Image; mainActivity.arr[i][3] = Gender; mainActivity.arr[i][4] = Description to here و Everything work good and i can use array amount in second activity. but when use 2d-array in mainactivity in this form : textView.setText(arr[1][1].toString()); return null : java.lang.RuntimeException: Unable to start activity ComponentInfo{com.../....main.MainActivity}: java.lang.NullPointerException before , i make a ArrayList and New in another activity then i use in main activity and that work right , but for 2d array not work; Now , how i can use this array that maked new in another activity
has comment: http://stackoverflow.com/comment/37245452
has comment: http://stackoverflow.com/comment/37246906
has comment: http://stackoverflow.com/comment/37245321
has comment: http://stackoverflow.com/comment/37245863
has comment: http://stackoverflow.com/comment/37247585
has comment: http://stackoverflow.com/comment/37247704
type: UnansweredQuestion
tagged with: arrays
has answer: http://stackoverflow.com/a/24139506
has comment: http://stackoverflow.com/comment/37246134
has answer: http://stackoverflow.com/a/52688889

http://stackoverflow.com/comment/37200163
type: AnswerComment
comment on: http://stackoverflow.com/a/24105543
has text: @user3719499 pass the activity context to the constructor of Calculation. make it a normal java class. Then use `context.startActivity()`. similarly the first param for toast must be context.
type: Comment
score: 0

http://stackoverflow.com/q/24112943
favorite count: 0
type: Question
upvote count: 4
downvote count: 0
tagged with: handshake
score: 4
tagged with: socket.io
has comment: http://stackoverflow.com/comment/50518547
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24128810
has title: Android developpement, Gottox socket.io-java-client: file not fount Exception /socket.io/1/
has body: here is my problem: i've been trying to use socket.io-java-client for an android app but i'm ending up with an handshake error (see below). here is my app source code: public void runIO(){ try { SocketIO socket = new SocketIO("http://192.168.1.60:1337"); socket.connect(new IOCallback() { @Override public void onMessage(JSONObject json, IOAcknowledge ack) { try { System.out.println("Server said:" + json.toString(2)); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onMessage(String data, IOAcknowledge ack) { System.out.println("Server said: " + data); } @Override public void onError(SocketIOException socketIOException) { System.out.println("an Error occured"); socketIOException.printStackTrace(); } @Override public void onDisconnect() { System.out.println("Connection terminated."); } @Override public void onConnect() { System.out.println("Connection established"); } @Override public void on(String event, IOAcknowledge ack, Object... args) { System.out.println("Server triggered event '" + event + "'"); } }); // This line is cached until the connection is establisched. socket.send("Hello Server!"); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } and my Node.js / Socket.io: var app = require('http').createServer(handler) var io = require('socket.io')(app); var fs = require('fs'); app.listen(1337); function handler (req, res) { fs.readFile(__dirname + '/index.html', function (err, data) { if (err) { res.writeHead(500); return res.end('Error loading index.html'); } res.writeHead(200); res.end(data); }); } io.on('connection', function (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); }); }); And i'm getting the following error: 06-09 03:59:53.955: W/System.err(11738): io.socket.SocketIOException: Error while handshaking 06-09 03:59:53.965: W/System.err(11738): at io.socket.IOConnection.handshake(IOConnection.java:322) 06-09 03:59:53.9…
tagged with: exception
has answer: http://stackoverflow.com/a/24128810
tagged with: android
tagged with: java
answer count: 1

http://stackoverflow.com/comment/37239312
type: Comment
type: QuestionComment
has text: so does the jar actually contain `org.apache.poi.poifs.filesystem.POIFSFileSystem` see http://www.findjar.com/class/org/apache/poi/poifs/filesystem/POIFSFileSystem.html
score: 0
comment on: http://stackoverflow.com/q/24134676

http://stackoverflow.com/comment/37406623
type: QuestionComment
has text: what is the issue here
type: Comment
comment on: http://stackoverflow.com/q/24223400
score: 0

http://stackoverflow.com/comment/137022743
score: 0
comment on: http://stackoverflow.com/a/24247565
type: Comment
has text: Here is the official web site of Selenium for [Working with IFrames and frames](https://www.selenium.dev/documentation/webdriver/interactions/frames/) using examples in multiple languages!
type: AnswerComment

http://stackoverflow.com/a/24263714
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24263521
accepted answer of: http://stackoverflow.com/q/24263521
score: 0
type: Answer
has body: It is thread safe provided that 1) The constructor does not leak a reference before its fully constructed. 2) No one has any way to access the collection. 3) No subclass can be created which can edit the collection. As a general rule though, if you want to implement this use an immutable collection from guava, that makes the behaviour explicit to the programmer, and it is then safe to return the whole map. I think that in pure java you can return an unmodifiable view of a collection.

http://stackoverflow.com/comment/37455631
type: AnswerComment
score: 0
has text: @LuiggiMendoza sure, I was just referring to working for a large company ;)
type: Comment
comment on: http://stackoverflow.com/a/24247603

http://stackoverflow.com/comment/37198239
has text: Yes, but what I am really interested in is where the local maven repository is going, not the jenkins job workspace. I need different jobs to be using the same local maven repository.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24112296

http://stackoverflow.com/a/24104997
has comment: http://stackoverflow.com/comment/37183670
score: 3
has comment: http://stackoverflow.com/comment/37183662
has comment: http://stackoverflow.com/comment/37184145
has comment: http://stackoverflow.com/comment/37184272
has comment: http://stackoverflow.com/comment/124182104
has comment: http://stackoverflow.com/comment/37183884
type: Answer
accepted answer of: http://stackoverflow.com/q/24104928
has comment: http://stackoverflow.com/comment/37184038
has comment: http://stackoverflow.com/comment/37183708
has comment: http://stackoverflow.com/comment/37184175
has body: Different font color in a JTextField You can't achieve it with JTextField instead use JEditorPane or JTextPane. Read more about How to Use Editor Panes and Text Panes Sample code using JTextPane directly from HERE import javax.swing.*; import javax.swing.text.*; import java.awt.*; public class StylesExample12 { public static void main(String[] args) { JFrame f = new JFrame("Styles Example 1"); // Create the StyleContext, the document and the pane StyleContext sc = new StyleContext(); final DefaultStyledDocument doc = new DefaultStyledDocument(sc); JTextPane pane = new JTextPane(doc); // Create and add the style final Style heading2Style = sc.addStyle("Heading2", null); heading2Style.addAttribute(StyleConstants.Foreground, Color.red); heading2Style.addAttribute(StyleConstants.FontSize, new Integer(16)); heading2Style.addAttribute(StyleConstants.FontFamily, "serif"); heading2Style.addAttribute(StyleConstants.Bold, new Boolean(true)); try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { try { // Add the text to the document doc.insertString(0, text, null); // Finally, apply the style to the heading doc.setParagraphAttributes(0, 1, heading2Style, false); } catch (BadLocationException e) { } } }); } catch (Exception e) { System.out.println("Exception when constructing document: " + e); System.exit(1); } f.getContentPane().add(new JScrollPane(pane)); f.setSize(400, 300); f.setVisible(true); } public static final String text = "Attributes, Styles and Style Contexts\n" + "The simple PlainDocument class that you saw in the previous " + "chapter is only capable of holding text. The more complex text " + "components use a more sophisticated model that implements the " + "StyledDocument interface. StyledDocument is a sub-interface of " + "Document that contains methods for manipulating attributes that " + "control the way in which the text in the document is displayed. " + "The Swing text package contains a concrete implementation of " + "StyledDocument calle…
has comment: http://stackoverflow.com/comment/64433804
answers question: http://stackoverflow.com/q/24104928
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37183901

http://stackoverflow.com/q/24154954
upvote count: 1
tagged with: web
score: 1
linked to: http://stackoverflow.com/q/441196
linked to: http://stackoverflow.com/q/3372687
favorite count: 0
has body: Out of the many things that we did to fix the issue of sticky session one was to make the session attributes implement the serializable interface. Now could someone explain it to me in layman terms what happens when this interface is implemented? what behavioural changes are observed in a class which implements this interface?
tagged with: nlb
tagged with: serialization
type: Question
duplicate of: http://stackoverflow.com/q/441196
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37277384
has answer: http://stackoverflow.com/a/24154996
has answer: http://stackoverflow.com/a/24155009
has title: Why does one need to implement the serializable interface?
tagged with: java
has answer: http://stackoverflow.com/a/24155903
answer count: 3
has comment: http://stackoverflow.com/comment/37277544
downvote count: 0

http://stackoverflow.com/q/24185378
has comment: http://stackoverflow.com/comment/110543064
linked to: http://stackoverflow.com/q/4547515
possible better answer: http://stackoverflow.com/a/26143126
has answer: http://stackoverflow.com/a/57597428
has title: Intellij Idea 13 UI Designer and automatic Gradle building
tagged with: ant
answer count: 6
linked to: http://stackoverflow.com/q/55844177
score: 15
has answer: http://stackoverflow.com/a/79178793
upvote count: 16
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/55725767
accepted answer: http://stackoverflow.com/a/55725767
has answer: http://stackoverflow.com/a/26143126
tagged with: java
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/27079572
tagged with: gradle
has answer: http://stackoverflow.com/a/66400148
downvote count: 1
has body: I've used the Intellij UI Designer to create forms for a project. Everything works fine when I'm building with idea as it handles compiling the forms for me, but as we recently switched to using Gradle for building it hasn't been possible to produce an executable jar file yet. My google-fu has led me to several posts that explains that an ant script is needed to compile (eg link, link2, link3 ,and the one i ended on following: link4) My project is a multi-module setup. root build.gradle subprojects { apply plugin: 'java' apply plugin: 'idea' repositories { mavenCentral() } } supproject build.gradle apply plugin:'application' mainClassName = "dk.OfferFileEditor.OfferFileEditorProgram" configurations { antTask } dependencies { compile 'org.json:json:20140107' compile project(":Shared:HasOffers Api") //dependencies for java2c antTask files('../../lib/javac2-13.1.1.jar', '../../lib/asm4-all-13.1.1-idea.jar', '../../lib/forms_rt-13.1.1.jar') antTask group: 'org.jdom', name: 'jdom', version: '1.1' } task compileJava(overwrite: true, dependsOn: configurations.compile.getTaskDependencyFromProjectDependency(true, 'jar')) { doLast { println 'using java2c to compile' project.sourceSets.main.output.classesDir.mkdirs() ant.taskdef name: 'javac2', classname: 'com.intellij.ant.Javac2', classpath: configurations.antTask.asPath ant.javac2 srcdir: project.sourceSets.main.java.srcDirs.join(':'), classpath: project.sourceSets.main.compileClasspath.asPath, destdir: project.sourceSets.main.output.classesDir, source: sourceCompatibility, target: targetCompatibility, includeAntRuntime: false } } But even though the compilation is successfull, a Nullpointer exception is thrown the first time I try to access one of the fields the UI Designer created. So something is not being compiled correctly. I'm probably missing some setting, but after unsuccesfully pouring several hours into forums and google I still haven't found any solution.
favorite count: 0
linked to: http://stackoverflow.com/q/10482610
type: Question

http://stackoverflow.com/comment/37372193
score: 1
comment on: http://stackoverflow.com/q/24199496
type: QuestionComment
has text: Then this is exactly the same question as you asked yesterday, and, as yesterday, the solution is in http://stackoverflow.com/questions/14187963/passing-parameters-javafx-fxml
type: Comment

http://stackoverflow.com/comment/37482468
score: 0
has text: @RossC, OP've updated the question and now it is clearer: the question is about Android app.
comment on: http://stackoverflow.com/q/24263078
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37306760
comment on: http://stackoverflow.com/q/24170564
score: 0
type: Comment
type: QuestionComment
has text: Thanks. I'm really new to this, and it seemed very confusing that another method is argument of that method.

http://stackoverflow.com/comment/37376335
type: Comment
has text: sorry i didnt mean the logarithm of 2 is smaller than 2. i meant 2 / Math.log10(wordlength) is smaller than 2.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24206884

http://stackoverflow.com/comment/37586182
comment on: http://stackoverflow.com/a/24254797
type: AnswerComment
score: 0
has text: No. When run with its output to a pipe instead of the console, stdio line buffering no longer happens. Java has nothing to do with it.
type: Comment

http://stackoverflow.com/q/24246431
type: Question
type: UnansweredQuestion
tagged with: jar
has body: I see a lot of opensource project use -cp as java -cp "libs/a.jar:libs/b.jar:libs/c.jar" instead of java -cp "libs/*" Are there any reason?
has comment: http://stackoverflow.com/comment/37450955
has title: Loading Java class path via wildcard or not?
linked to: http://stackoverflow.com/q/147454
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24246511
answer count: 1
tagged with: classpath
has comment: http://stackoverflow.com/comment/37450784

http://stackoverflow.com/q/24164485
favorite count: 0
has body: I have a ellipse with a mid-point 'mid' an a horizontal radius 'h' and a vertical radius 'v' and a Line2D. Now I need some code to calculate the two intersection points of the two. I already tried some code and tried it on my own but there always is a mistake. Does somebody have some working code?
type: Question
tagged with: geometry
has answer: http://stackoverflow.com/a/24167052
has answer: http://stackoverflow.com/a/24165749
upvote count: 2
type: UnansweredQuestion
tagged with: intersection
downvote count: 0
tagged with: line
has title: Ellipse and line intersection JAVA
score: 2
answer count: 3
tagged with: java
tagged with: ellipse
has answer: http://stackoverflow.com/a/24164983

http://stackoverflow.com/a/78894315
has comment: http://stackoverflow.com/comment/139099192
score: 0
has comment: http://stackoverflow.com/comment/139099172
answers question: http://stackoverflow.com/q/24233093
has body: TIMESTAMP in MySQL has an offset of zero I have in my MySQL database a TIMESTAMP field like this 2014-06-18 07:00:00. No, you don’t. The TIMESTAMP type in MySQL records a moment as seen with an offset from UTC of zero hours-minutes-seconds. You neglected to mention the context of an offset. A string representing a TIMESTAMP value would be described as 2014-06-18 07:00:00+00:00 or 2014-06-18 07:00:00Z where the Z is an abbreviation for an offset of zero, +00:00. java.time As an update to this old Question… You are using terribly-flawed date-time classes that are now legacy, supplanted by the modern java.time classes defined in JSR 310. Retrieve your TIMESTAMP value from MySQL using the OffsetDateTime class, as mapped in JDBC 4.2 and later. OffsetDateTime odt = myResultSet.getObject( … , OffsetDateTime.class ); Note that Jakarta Persistence (formerly JPA) has been updated to support java.time classes.
has comment: http://stackoverflow.com/comment/139098978
has comment: http://stackoverflow.com/comment/139099242
type: Answer
has comment: http://stackoverflow.com/comment/139099056

http://stackoverflow.com/comment/37191844
type: Comment
has text: perhaps You mean to say logcat does not display even a single line?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24109252

http://stackoverflow.com/q/24115211
tagged with: operators
favorite count: 0
type: Question
upvote count: 2
has title: Manipulating Java string containing math operands
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24117808
downvote count: 0
has comment: http://stackoverflow.com/comment/37202881
has body: Manipulating Java string containing math operands. I am amending a code for control signals. I have to convert this sort of strings: String str= "Red 0.20 + 0.60 Green 0.30 + 0.45 + 0.56 Blue 0.25 + 0.50 + 1.0 Yellow 3.0/2.0 "; to this: String str1= "RedNet0.8 GreenNet0.75 BlueNet1.75 YellowNet1.5 "; I can replace Red to RedNet, Green to GreenNet etc., but help me to proceed for remaining part.
tagged with: java
answer count: 1
tagged with: string

http://stackoverflow.com/comment/37316728
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24175391
has text: did you activity changes when button click ?if so can you please post your fragment on create view code?

xpath
tags question: http://stackoverflow.com/q/24201168
tag name: xpath
type: Tag
tags question: http://stackoverflow.com/q/24107507
tags question: http://stackoverflow.com/q/24222322
tags question: http://stackoverflow.com/q/24130966
tags question: http://stackoverflow.com/q/24255352
tags question: http://stackoverflow.com/q/24252410
tags question: http://stackoverflow.com/q/24205871
tags question: http://stackoverflow.com/q/24113648

http://stackoverflow.com/comment/37383965
comment on: http://stackoverflow.com/q/24211283
score: 0
type: Comment
type: QuestionComment
has text: deprecated means do not use the method. its no longer supported or recommended.

http://stackoverflow.com/a/24146410
has body: Your clip is null, by default instance variable are initialised to null. EDIT You need to wrap your client code with try-catch try{ Sb hats = new Sb("file path"); }catch(UnsupportedAudioFileException e){ // have some log statement }
score: 2
has comment: http://stackoverflow.com/comment/37261433
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37262326
answers question: http://stackoverflow.com/q/24146349
has comment: http://stackoverflow.com/comment/37272133
type: Answer

http://stackoverflow.com/a/24163173
type: Answer
answers question: http://stackoverflow.com/q/24162855
has body: I missed a simple line of code: shell.setLayout(new FillLayout());
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/q/24228921
tagged with: java
tagged with: filewriter
has comment: http://stackoverflow.com/comment/37416969
downvote count: 1
linked to: http://stackoverflow.com/q/15754523
has answer: http://stackoverflow.com/a/24228981
possible better answer: http://stackoverflow.com/a/24228981
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37417070
answer count: 5
has answer: http://stackoverflow.com/a/24229058
has answer: http://stackoverflow.com/a/24229099
score: -1
accepted answer: http://stackoverflow.com/a/24229099
has comment: http://stackoverflow.com/comment/37416856
has body: I'm new to java and currently trying to write some strings into a text file using this tut : http://www.homeandlearn.co.uk/java/write_to_textfile.html so here is my code : public void savefile() throws IOException { JOptionPane.showMessageDialog(null,"Hi,i'm in Try Block :|"); FileWriter write = new FileWriter("asd.txt", true); PrintWriter print = new PrintWriter(write); JOptionPane.showMessageDialog(null, "File Opened"); write.write("Knock Knock"); print.flush(); print.write("Hello ?"); print.flush(); print.printf("Hi?"); print.flush(); print.println("anybody there?"); print.flush(); JOptionPane.showMessageDialog(null, "Can you hear me ?"); print.close(); JOptionPane.showMessageDialog(null, "File Closed"); } and this is how I call the method: try { savefile(); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Error: " + e.getMessage()); } But nothing appears in the file! I'm really sick of this; what did I do wrong?
has comment: http://stackoverflow.com/comment/37417112
has answer: http://stackoverflow.com/a/24228986
has title: How to write text to a file in Java
has comment: http://stackoverflow.com/comment/37416910
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/37416805
has answer: http://stackoverflow.com/a/24229758
has comment: http://stackoverflow.com/comment/37417091

http://stackoverflow.com/comment/37243212
score: 0
has text: @AleksanderLidtke, Thanks a ton, it worked. Please have a look at the solution I added.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24135045

http://stackoverflow.com/comment/37231667
comment on: http://stackoverflow.com/q/24130382
has text: Statement in `Importer.java` class on line `201` tries to access the 1st element of an empty `ArrayList`.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37318469
score: 0
type: Comment
has text: @immibis AVOID Answering in comment!!
type: AnswerComment
comment on: http://stackoverflow.com/a/24176967

http://stackoverflow.com/a/24331089
type: AcceptedAnswer
upvote count: 7
score: 7
has body: For some systems where connection to the outside world is restricted by firewall or the site is temporary unavailable you can modify the location of DTD in the DOCTYPE declaration. You can extract DTD from the one of the core jars and place it for example under WEB-INF/dtds and modify DOCTYPE declaration in the following way &lt;!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "/WEB-INF/dtds/struts-2.3.dtd"&gt;
type: Answer
answers question: http://stackoverflow.com/q/24251126
accepted answer of: http://stackoverflow.com/q/24251126
downvote count: 0

http://stackoverflow.com/q/24164471
tagged with: java
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37323269
type: UnansweredQuestion
has title: Restricting specific file extensions getting uploaded (server side)
has body: I am working on below scenario since last two days, I have developed a java filter that check whether request is multipart type, If it is, I want to restrict .php file getting uploaded. In servlet filter I successfully retrieved type of file, if it's valid one, i have forwarded that request to proceed. Now my business logic that was working exactly fine without filter is now failed to upload. My project is using Spring framework. At business logic, I'm using MultipartRequest(class of spring) as casting in. Invoking request.getFileNames() which is returning nothing after involving filter. In filter, I have wrapped request after validating file extensions as follows: All form fields are set in parameter map that will be passed with request. And File type field is set as attribute in request object. Would you guys please help? Thanks, Namrata Shah
has answer: http://stackoverflow.com/a/24179846
has comment: http://stackoverflow.com/comment/37295329
score: 0
has answer: http://stackoverflow.com/a/24179687
tagged with: filter
answer count: 3
has comment: http://stackoverflow.com/comment/37325911
has answer: http://stackoverflow.com/a/24181439

http://stackoverflow.com/q/24227347
answer count: 1
has answer: http://stackoverflow.com/a/24227377
tagged with: applet
type: Question
has comment: http://stackoverflow.com/comment/37414152
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has title: Start: Applet is not initialized in Java application
has comment: http://stackoverflow.com/comment/37414099
has body: Friends I am writing a simple Swing Application. But when i am run this, "Start: Applet is not initialized" window is shown. My main class is import javax.swing.JFrame; public class Main { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(800,800); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new GameFrame()); frame.setResizable(false); frame.setVisible(false); } } My sub class is: import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JPanel; public class GameFrame extends JPanel { GameFrame(){ setFocusable(true); } public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.drawString("Hello am Haris..!!", 100, 100); ImageIcon ic = new ImageIcon(); Image i = ic.getImage(); g2d.drawImage(i, 500, 200, null); } }
score: 0
tagged with: java

http://stackoverflow.com/a/24173545
has comment: http://stackoverflow.com/comment/37312524
has comment: http://stackoverflow.com/comment/37312459
has comment: http://stackoverflow.com/comment/37312783
type: Answer
has comment: http://stackoverflow.com/comment/37312605
has comment: http://stackoverflow.com/comment/37312559
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24173463
downvote count: 0
has comment: http://stackoverflow.com/comment/37312506
has comment: http://stackoverflow.com/comment/37312520
has body: It is correct, but after 31 iterations, 1073741824 + 1073741824 doesn't calculate correctly (overflows) and after that prints only 0. You can refactor to use BigInteger, so your infinite loop will work correctly. public class Mathz { static BigInteger i = new BigInteger("1"); public static void main(String[] args) { while (true){ i = i.add(i); System.out.println(i); } } }
has comment: http://stackoverflow.com/comment/37312673

http://stackoverflow.com/comment/37218064
comment on: http://stackoverflow.com/a/24123463
type: Comment
score: 0
type: AnswerComment
has text: Make sure to catch the exception. Also, code samples would help to make your answer much more useful and clear.

http://stackoverflow.com/comment/37275967
type: AnswerComment
has text: @Hunter Define "RED" area? Until you can provide more context, everything we do is guess work...
comment on: http://stackoverflow.com/a/24153901
type: Comment
score: 0

http://stackoverflow.com/q/24193507
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37350322
has comment: http://stackoverflow.com/comment/37349715
has comment: http://stackoverflow.com/comment/37349993
has comment: http://stackoverflow.com/comment/37349802
has comment: http://stackoverflow.com/comment/37350968
has comment: http://stackoverflow.com/comment/37349906
tagged with: java
has answer: http://stackoverflow.com/a/24194049
tagged with: nested
possible better answer: http://stackoverflow.com/a/24193891
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37349886
accepted answer: http://stackoverflow.com/a/24194049
has answer: http://stackoverflow.com/a/24193891
has comment: http://stackoverflow.com/comment/37349729
tagged with: hashmap
has body: I have a nested hash map and I don't know how to convert the keys into a double. I have to convert them because later on I have to do some calculations. Is there anyway to convert them. The reason why I am doing this is because I want to map three elements together: the radius, theta, and the amplitude. As I read them in from an image which come in a specific format I would like to save that in hash map (I found the most convenient since it maps out elements). So I tried lists and array lists but I couldn't get it to save three elements so I used a nested hash map. Here is my code: // create a Map() original = new LinkedHashMap&lt;List&lt;RadTheta&gt;,String&gt;(); List&lt;RadTheta&gt; list = new ArrayList&lt;RadTheta&gt;(); // create a Map() for(int i =0; i&lt; 256;i++){ for(int y=0; y&lt; 256; y++){ //reading in the values. String x = image.getLocationAsString(i, y); String n = image.getValueAsString(i, y); //Parsing them into "key" and "value". String delim = ", value="; String [] tokens = n.split(delim); double num = Double.parseDouble(tokens[1]); String stringNum = String.valueOf(num); //System.out.println(num); String [] t = x.split("r="); String[] b = t[1].split(" mm/c"); //System.out.print("Meet b: "+b[0]); double radius = Double.parseDouble(b[0]); String stringRad = String.valueOf(radius); //System.out.print("The radius: "+radius); String [] split = x.split("theta= "); String [] split2 = split[1].split(Character.toString(IJ.degreeSymbol)); double theta = Double.parseDouble(split2[0]); //System.out.println(" theta: "+theta); String stringTheta = String.valueOf(theta); RadTheta rad = new RadTheta(radius, theta); list.add(rad); original.put(list, stringNum); //System.out.println(stringRad+" theta= "+stringTheta+" value= "+stringNum); } } Here I am iteration through the hash map and I want to convert the key (radius, theta) value to a double because then I have do some calculation on them. Is there any way to convert this? public void outputData(PrintWriter wri…
has comment: http://stackoverflow.com/comment/37349832
has title: How to convert a nested hash map key (string) into a double
has comment: http://stackoverflow.com/comment/37350106
has comment: http://stackoverflow.com/comment/37350099

http://stackoverflow.com/q/24168944
upvote count: 1
score: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has title: Not able to access google webservices its giving login required error in java
tagged with: android
tagged with: web-services
has comment: http://stackoverflow.com/comment/38509141
has comment: http://stackoverflow.com/comment/37485342
tagged with: google-play-services
linked to: http://stackoverflow.com/q/11115381
answer count: 0
has body: I have enabled Google Play Android Developer API in developerconsole.Still i m getting login required error. I have created new key for server application and used the same as API KEY in webserivices My Java Code: package com.razak.sample; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class TestGoogleAPI { /** * @param args */ public static void main(String[] args) { try { URL url = new URL("https://www.googleapis.com/androidpublisher/v1.1/applications/packageName/inapp/productId/purchases/token?key=AIza*************************"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); if (conn.getResponseCode() != 200) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } conn.disconnect(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } Output: { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } }
tagged with: java
tagged with: in-app-purchase
downvote count: 0

http://stackoverflow.com/q/24107527
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/163998
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37188214
has answer: http://stackoverflow.com/a/24107702
has comment: http://stackoverflow.com/comment/37188198
answer count: 1
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/37188486
tagged with: string
favorite count: 0
has body: //What should I do to subtract quan from objIn? //means quan has values 1,2,7,9 and objIn has values 5,6,7,8 then how to subtract so that result is 4,4,0,1 as i want operation quan[]=quan[]-objIn[] to be done? public static void Equalizer(int i, int s, String quan[], String objIn[]) { int j; Scanner Inp = new Scanner(System.in); for(j=0;j&lt;i;j++) { System.out.print(objIn[j]+"="); objIn[j]=Inp.nextLine(); } for(j=0;j&lt;s;j++) { System.out.print(quan[j]+"="); quan[j]=Inp.nextLine(); } }
has title: How to subtract two string arrays in java as they are shown in code
has comment: http://stackoverflow.com/comment/37188333

http://stackoverflow.com/a/24264292
has body: The @Produces annotation is used by the JAX-RS implementation to bind the incoming request to one of your Resource Methods, based on the accept header of the request. You can set the exact type of the response in the returned Response object using ResponseBuilder#type(MediaType) if you want to enforce one media type in particular. If you want to match the accept header of the incoming request ("application/vnd.ms-excel" vs "application/pdf" in your case), you can retrieve that header by adding a parameter annotated with @HeaderParam("accept") in your Java method. HTH.
answers question: http://stackoverflow.com/q/24257314
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/37478312
type: QuestionComment
comment on: http://stackoverflow.com/q/24250383
has text: Is there a way to select owner and associations in one query with JPA?
score: 0
type: Comment

http://stackoverflow.com/comment/37419343
type: Comment
type: AnswerComment
has text: @user3742134 please post exact error message or complete code
comment on: http://stackoverflow.com/a/24229198
score: 0

http://stackoverflow.com/comment/37427426
type: QuestionComment
comment on: http://stackoverflow.com/q/24234082
has text: @Anony-Mousse: no, the moderators did not delete your answer because of the link, but rather because it was only a link and not really an answer. You could edit it, provide more information to make it a more useful and informative answer, and it will likely be re-opened.
type: Comment
score: 1

http://stackoverflow.com/comment/37398249
type: Comment
score: 0
type: AnswerComment
has text: ok then need to change the regex. Let me try this case as well.
comment on: http://stackoverflow.com/a/24218934

http://stackoverflow.com/comment/37396570
has text: It should be `image` instead of `imege`. Simply re-size the frame and look what happens.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24217961

http://stackoverflow.com/comment/37471335
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24224825
has text: @Jules, http://jsfiddle.net/U4g3c/7/
score: 0

http://stackoverflow.com/a/24223452
type: Answer
has comment: http://stackoverflow.com/comment/37423965
downvote count: 0
upvote count: 1
has body: You can use the SwingUtilities.convertPoint(...) method. I would guess you need to convert the mouse point the coordinates of the viewport of the scroll pane. Maybe an easier approach is to use a JList with a custom renderer. You can set the JList to wrap components horizontally. Then in you custom renderer you just add a Border to the selected item. Read the section from the Swing tutorial on How to Use Lists for more information and examples.
answers question: http://stackoverflow.com/q/24223027
score: 1

http://stackoverflow.com/q/24129701
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24139680
accepted answer: http://stackoverflow.com/a/24139680
has comment: http://stackoverflow.com/comment/113064086
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37272794
upvote count: 1
tagged with: jco
favorite count: 0
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37230329
has body: I am extracting some SAP tables using the SAP Java Connector (via RFC_READ_TABLE or similar). Is it possible to pass some kind of maxlength for some fields of a table, e.g. if we have a field with size 3750 (like PROFS in table USH04) but I only want the first 100 characters - something like LEFT(PROFS, 100) in SQL? Thank you for your helpful response!
has comment: http://stackoverflow.com/comment/37248186
has title: SAP Java Connector: Is it possible to cut field values of extracted table?
tagged with: saprfc

http://stackoverflow.com/comment/37247248
type: QuestionComment
has text: It looks like you've already done it. What's the problem?
comment on: http://stackoverflow.com/q/24139214
score: 5
type: Comment

http://stackoverflow.com/comment/37338713
score: 1
comment on: http://stackoverflow.com/q/24181489
has text: @T.J. Crowder Yes, in a way. What I meant was that you had to think about the case where both the `try` and the `finally` blocks ended abruptly. If all that's "magically taken care of" then people would just ignore it. But you're right, the current solution isn't exactly watertight either so maybe auto-recording suppressed exceptions would actually improve matters.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24187243
answer count: 2
tagged with: java
downvote count: 0
has title: How to use 'compose' on GCS using the Java client
accepted answer: http://stackoverflow.com/a/24190034
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/57289334
has answer: http://stackoverflow.com/a/24190034
upvote count: 2
tagged with: google-app-engine
tagged with: google-cloud-storage
possible better answer: http://stackoverflow.com/a/57289334
score: 2
type: AnsweredQuestion
has body: I want to combine multiple GCS files into one big file. According to the docs there is a compose function, which looks like it does exactly what I need: https://developers.google.com/storage/docs/json_api/v1/objects/compose However, I can't find how to call that function from GAE using the Java client: https://developers.google.com/appengine/docs/java/googlecloudstorageclient/ Is there a way to do this with that library? Or should I mess around with reading the files one by one using channels? Or should I call the low level JSON methods? What's the best way?

http://stackoverflow.com/a/24165565
answers question: http://stackoverflow.com/q/24158385
upvote count: 8
type: Answer
score: 8
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24158385
has body: From the Spring documentation: The " classpath*:" prefix can also be combined with a PathMatcher pattern in the rest of the location path, for example " classpath*:META-INF/*-beans.xml". [...] But there is a restriction: Please note that " classpath*:" when combined with Ant-style patterns will only work reliably with at least one root directory before the pattern starts, unless the actual target files reside in the file system. This means that a pattern like " classpath*:*.xml" will not retrieve files from the root of jar files but rather only from the root of expanded directories. [...] So if I place my module's property files in src/main/resources/META-INF, I can load of them as follows: &lt;context:property-placeholder location="classpath*:/META-INF/*.properties" /&gt;
downvote count: 0

http://stackoverflow.com/comment/37452049
score: 1
comment on: http://stackoverflow.com/a/24246563
type: Comment
type: AnswerComment
has text: @Jeremy It's still not your graphics card.

http://stackoverflow.com/comment/37399360
score: 0
has text: Thanks bro.Helped a lot in ma project
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24219299

http://stackoverflow.com/comment/38082014
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24218736
has text: The SessionImpl object is specific to the user. It's a session. It contains his name, login details, bank accounts etc. as data members, whatever you need. Of course if he has more than one account you will have to provide a parameter. I don't know why you mentioned ThreadLocal in your previous comment, if you're not using it.

http://stackoverflow.com/a/24189866
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24188756
answers question: http://stackoverflow.com/q/24188756
type: Answer
has body: You have to use two Calendar instances, because the Calendar setTime method sets the hours and minutes to zero. package com.ggl.testing; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class FormatDate { private static final DateFormat inputDateFormat = new SimpleDateFormat("dd-MM-yyyy"); private static final DateFormat outputDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); private Calendar calendar; public String previousDateString(String dateString) throws ParseException { Calendar now = Calendar.getInstance(); calendar = Calendar.getInstance(); Date myDate = inputDateFormat.parse(dateString); calendar.setTime(myDate); calendar.set(Calendar.HOUR_OF_DAY, now.get(Calendar.HOUR_OF_DAY)); calendar.set(Calendar.MINUTE, now.get(Calendar.MINUTE)); return outputDateFormat.format(calendar.getTime()); } public static void main(String[] args) { String dateString = "10-06-2014"; try { String output = new FormatDate().previousDateString(dateString); System.out.println(output); } catch (ParseException e) { e.printStackTrace(); } } } Output - 2014-06-10 10:47
score: 0

http://stackoverflow.com/a/24141873
answers question: http://stackoverflow.com/q/24141235
type: Answer
has body: The correct way to open a PDF url with PDFBox is like this: PDDocument doc = PDDocument.load(new URL("http://www.host.com/xxx.pdf").openStream()); Even better is to use the non sequential parser: PDDocument doc = PDDocument.loadNonSeq(new URL("http://www.host.com/xxx.pdf").openStream(), null); To learn more about text extraction, look at the source code of ExtractImages, which you will find here.
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24227853
has comment: http://stackoverflow.com/comment/49798168
type: Answer
has comment: http://stackoverflow.com/comment/37449608
has body: My guess is that this is an optimisation scalac performs. The unapply method is synthetic, so the compiler knows its implementation and might improve on the runtime performance. If that theory is correct, the following should be different: object Cat { def unapply(c: Cat): Option[String] = Some(c.name) } class Cat(val name: String) extends Animal
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24227037
has comment: http://stackoverflow.com/comment/37416180
score: 3
has comment: http://stackoverflow.com/comment/37473898
has comment: http://stackoverflow.com/comment/37449589

http://stackoverflow.com/comment/37315120
has text: I would make `GameInstance` a lightweight proxy that reflects the server's game state. Anything you carry out on the `GameInstance` should actually be making those changes to the server's state instead of maintaining two copies (read states could be maintained locally if you were concerned about performance)
comment on: http://stackoverflow.com/q/24174973
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24233904
has title: org.hibernate.MappingException: Unknown entity: library.model.Person
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24234542
accepted answer: http://stackoverflow.com/a/24234542
type: Question
has comment: http://stackoverflow.com/comment/37427552
tagged with: java
tagged with: hibernate
tagged with: spring
has body: I've been struggling with this all day but haven't yet found a solution. I have a simple entity mapping to a database table: @Entity @Table(name = "PERSON") public class Person implements Serializable { // Attributes. @Id @Column(name = "ID", unique = true, nullable = false) @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; @Column(name = "NAME", nullable = false, length=50) private String name; @Column(name = "ADDRESS", nullable = false, length=100) private String address; @Column(name = "TELEPHONE", nullable = false, length=10) private String telephone; @Column(name = "EMAIL", nullable = false, length=50) private String email; @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name="PERSON_ID") private List<Book> books; // Constructors. public Person() { this.id = 0; this.name = (""); this.address = (""); this.telephone = (""); this.email = (""); this.books = null; } This entity is governed by a Spring controller with the following method: @RequestMapping(value = "/register", method = RequestMethod.POST) public String post(@ModelAttribute("person") Person person, BindingResult bindingResult, SessionStatus sessionStatus, Model model /* , HttpSession session */) throws DAOException { logger.info(PersonController.class.getName() + ".post() method called."); personValidator.validate(person, bindingResult); if (bindingResult.hasErrors()) { return "register"; } else { // Write Person to database. personService.insert(person); // Set view. sessionStatus.setComplete(); return "options"; } } The service class is: @Service("personService") @Transactional public class PersonService { @Autowired PersonDAO personDAO; public void insert(Person person) throws DAOException { personDAO.insert(person); } And the DAO is as follows: @Repository("PersonDAO") public class PersonDAOImpl implements PersonDAO { @Autowired private SessionFactory sessionFactory; static final Logger logger = Logger.getLogger(PersonDAOImpl.class.getName()); @Override publi…
has comment: http://stackoverflow.com/comment/37427496
has comment: http://stackoverflow.com/comment/37427512

http://stackoverflow.com/q/24188850
tagged with: java
has body: When running a .jar file in two scenarios, the way the arguments are processed are different. The problem occurs when passing arguments with spaces. Java uses space-delimiting for args however you can pass arguments with spaces in them, when surrounded by double quotes. I pass each argument with double quotes in case a user inputs an argument with spaces. In one instance I run the .jar file on it's own via the terminal, and all of the arguments are processed fine: java -jar jarFile.jar "key1=Tmp" "key2=This is a value." Output: Retrieving arguments: ==&gt; key1=Tmp ==&gt; key2=This is a value. Whereas in another instance I would like to execute this .jar from another Java class (Note: I do not want to create a class as I should, because I'm temporarily avoiding some bugs in the libraries I'm using) using the following: Process p = Runtime.getRuntime().exec("java -jar " + pluginPath + " " + "\"key1=Tmp\" \"key2=This is a value.\""); Output: Retrieving arguments: ==&gt; key1=Tmp ==&gt; key2=This ==&gt; is ==&gt; a ==&gt; value. The functionality in the plugin for parsing the arguments is as follows: logger.info("Retreiving arguments: "); String[] kvPairs = new String[args.length]; if (args.length &gt; 0) { for (int i=0; i &lt; args.length; i++) { kvPairs[i] = args[i].replaceAll("^\"|\"$", ""); logger.info("\t ==&gt; " + args[i]); } } // Enter the key-value pairs into a HashMap so we can retrieve the values easily. Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); for (String entry : kvPairs) { String[] keyValue = entry.split("="); map.put(keyValue[0].toLowerCase(), keyValue[1]); } Where the last section is only pertinent to how I store the values after I parse args. Is there any different functional difference in running the .jar from the terminal versus calling it via Process that could cause the same plugin to parse the arguments differently in the two scenarios?
has comment: http://stackoverflow.com/comment/37340327
accepted answer: http://stackoverflow.com/a/24189033
has answer: http://stackoverflow.com/a/24189033
answer count: 1
tagged with: jar
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37340663
has comment: http://stackoverflow.com/comment/37342083
favorite count: 0
type: Question
type: AnsweredQuestion
tagged with: args
has title: Java Arguments, Terminal vs. Process

http://stackoverflow.com/a/24148131
score: 0
has comment: http://stackoverflow.com/comment/37265360
type: Answer
has comment: http://stackoverflow.com/comment/37264631
has comment: http://stackoverflow.com/comment/37265647
answers question: http://stackoverflow.com/q/24147871
has comment: http://stackoverflow.com/comment/37265063
has body: You should change the List declaration to List&lt;Emloyee&gt;: List&lt;Emloyee&gt; empList = new ArrayList&lt;Emloyee&gt;(); (read more about generics in Java: http://docs.oracle.com/javase/tutorial/java/generics/) Then you can create a new Employee instance and add it to the list: Employee employee = new Employee("dob", "John Smith", "His Boss"); empList.add(employee); By the way: consider changing the type of boss from String to Employee (depending on you use case/meaning).

http://stackoverflow.com/comment/37456775
comment on: http://stackoverflow.com/a/24216644
score: 0
has text: if **top** consist of `key/value` pairs, then **arrayify** returns array of `value` objects.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37203508
type: Comment
comment on: http://stackoverflow.com/a/24115549
score: 0
type: AnswerComment
has text: I have added this permission before itself.

http://stackoverflow.com/comment/37262877
has text: I updated my question with my `form` declaration as well as my code for setting up my `ServletRunner`.
comment on: http://stackoverflow.com/a/24131388
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37419275
type: QuestionComment
has text: more than 500 chars in the server?? is there any special reason for walking that path
comment on: http://stackoverflow.com/q/24230238
score: 0
type: Comment

http://stackoverflow.com/q/24213006
has answer: http://stackoverflow.com/a/24312937
has comment: http://stackoverflow.com/comment/37387968
type: Question
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: jpanel
has title: JComponent, setEnabled() function only works properly the first time it is called
accepted answer: http://stackoverflow.com/a/24312937
tagged with: jcombobox
has body: I have set up a JPanel which can be navigated to, away from, and then returned to any number of times. This JPanel has on it two JRadioButtons and has inside a JScrollPane containing a varying number of JComboBoxes. I have coded it so that when one JRadioButton is selected the JScrollPane and the JComboBoxed are enabled, and when the other is pressed they are disabled using: private void automaticActionPerformed(java.awt.event.ActionEvent evt) { enableDisable(); check(); } private void manualActionPerformed(java.awt.event.ActionEvent evt) { enableDisable(); check(); } private void enableDisable() { boolean manual = manual.isSelected(); JPanel.setEnabled(manual); for (LabelComboPair pair :labelsAndCombos){ pair.label.setEnabled(manual); pair.combo.setEnabled(manual); } } public void aboutToDisplayPanel() { ... ... ... enableDisable(); } This works works exactly right the first time I navigate to the screen however when I navigate away from the screen and then return to it this does not work as expected. For example if the "manual" JRadioButton is selected which enables the JScrollPanes and the JComboBoxes when I navigate back to the page, clicking the "automatic" JRadioButton does not disable them, and vice versa. If I DOUBLE click on the JRadioButtons after returning to the screen the JScrollPanel and the JComboButtons appear to enable or disable correctly but when I click on them this is in fact not the case. Has anyone seen this issue before or have any suggestions for how to fix it? Thank you for your help
answer count: 1
tagged with: jradiobutton
tagged with: swing

http://stackoverflow.com/comment/37423647
has text: You could modify permissions, but maybe the best way is to put the file in a location where it can be read? Try creating a directory somewhere `/usr/share/weka` and set run the following `chmod 755 -R /usr/share/weka`
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/24232405

http://stackoverflow.com/a/24140300
answers question: http://stackoverflow.com/q/24139986
has body: Mathematical operators are not defined for Number. They are defined for numeric primitives: byte, short, int, long. The reason that you can say: Integer i = 5; int j = i + 2; is autoboxing that automatically replaces i by i.intValue() in expression i + 2. This is the reason that you cannot use + operator with generic type T. Method multVector() can return generic type: T[] multVector(T[] input). To do this you should pass your definition of*` to the method: interface MathOperator&lt;T&gt; { perform(T one, T two); } class MultiplyDouble implements MathOperator&lt;Double&gt; { perform(Double one, Double two) { return one * two; } } T[] multVector (T[] vector, MathOperator&lt;T&gt; operator){...} Now you can call this method as following: multVector (new Double[] {1.1, 2.2, 3.3}, new MultiplyDouble()); BTW creating instance of generic array is challenge too. TIP: user class java.lang.reflect.Array.
type: Answer
score: 0

http://stackoverflow.com/comment/37468141
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24255331
has text: public class with private access
score: 0

http://stackoverflow.com/a/53969987
accepted answer of: http://stackoverflow.com/q/24192416
has comment: http://stackoverflow.com/comment/94777675
type: Answer
upvote count: 3
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24192416
has body: I know this is an old question, but I had the same issue today and was able to work around it. Basically, when you set the currency on a NumberFormat, it overwrites the minimum and maximum fraction digits. You can see it here in this copy of the JDK code: https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/sun/util/locale/provider/NumberFormatProviderImpl.java#L212 Once you know this, it's pretty easy to workaround: you just set the currency before setting anything else. public static String formatValueString(String currencyISO, double value) { NumberFormat numberFormat = NumberFormat.getCurrencyInstance(); numberFormat.setCurrency(java.util.Currency.getInstance(currencyISO)); numberFormat.setMinimumFractionDigits(0); numberFormat.setMaximumFractionDigits(0); String result = numberFormat.format(value); return result; } That's it. Now you should have the correct number of fractional digits.
has comment: http://stackoverflow.com/comment/102517963
score: 3

database
tags question: http://stackoverflow.com/q/24238284
tags question: http://stackoverflow.com/q/24106845
tags question: http://stackoverflow.com/q/24164666
tags question: http://stackoverflow.com/q/24208029
tags question: http://stackoverflow.com/q/24133933
tags question: http://stackoverflow.com/q/24229529
tags question: http://stackoverflow.com/q/24266239
tags question: http://stackoverflow.com/q/24106728
tags question: http://stackoverflow.com/q/24222131
tags question: http://stackoverflow.com/q/24228903
tags question: http://stackoverflow.com/q/24156097
tags question: http://stackoverflow.com/q/24184059
type: Tag
tags question: http://stackoverflow.com/q/24241736
tags question: http://stackoverflow.com/q/24209259
tags question: http://stackoverflow.com/q/24161845
tags question: http://stackoverflow.com/q/24167780
tags question: http://stackoverflow.com/q/24205631
tags question: http://stackoverflow.com/q/24144538
tags question: http://stackoverflow.com/q/24202721
tags question: http://stackoverflow.com/q/24249412
tags question: http://stackoverflow.com/q/24191493
tags question: http://stackoverflow.com/q/24193128
tags question: http://stackoverflow.com/q/24133984
tags question: http://stackoverflow.com/q/24151026
tag name: database

http://stackoverflow.com/comment/37373769
comment on: http://stackoverflow.com/a/24206070
type: Comment
score: 0
type: AnswerComment
has text: Then post the code for the controller function that renders `home.scala.html` and the relevant code from the view, as the problem probably lies there.

http://stackoverflow.com/q/24200949
has answer: http://stackoverflow.com/a/24201069
has body: I can't figure out what the problem is someone please help. The program is supposed to find the index of the duplicate values in the array and print these out. Outputs java.lang.ArrayIndexOutOfBoundsException: 10. private static String s = ""; private static int num = 0; public static void main(String[] args) { int[] array = { 1, 5, 3, 8, 2, 3, 7, 1, 9, 3 }; for (int i = 1; i &lt;= array.length; ++i) { while (num &lt;= array.length - 2 &amp;&amp; array[num] == array[i]) { s += i + ","; num += 1; } } System.out.println("index 0 are at positions" +s); System.out.println(); }
has comment: http://stackoverflow.com/comment/37364624
duplicate of: http://stackoverflow.com/q/5554734
has title: java.lang.ArrayIndexOutOfBoundsException: 10
score: -5
has answer: http://stackoverflow.com/a/24201009
upvote count: 1
tagged with: java
answer count: 4
favorite count: 0
downvote count: 6
type: Question
has comment: http://stackoverflow.com/comment/37363999
has answer: http://stackoverflow.com/a/24201027
has answer: http://stackoverflow.com/a/24201015
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5554734

http://stackoverflow.com/a/24308090
type: Answer
has body: For security purposes, X servers won’t generally accept direct TCP connections from other hosts. Otherwise people could connect keyloggers to your X server, and your keystrokes would pass over the network unencrypted, allowing people to record passwords just by being on the same LAN. But SSH provides a secure way to forward X11 traffic over your SSH session, using the -X or -Y options. On your windows computer, make sure $DISPLAY is set correctly by trying to open an xterm from the command line. $DISPLAY will probably be set to :0 which stands for localhost:0. There are also additional tokens used to authenticate connections to the X server that are stored in ~/.Xauthority that you can view with xauth list. Now, run ssh -Y 10.10.101.96. If you get a message like X11 forwarding request failed on channel 0, then run ssh -v -Y 10.10.101.96 instead to get debugging messages. If the remote machine is a server, the reason will probably be that xauth isn’t installed. On CentOS, it’s in the xorg-x11-xauth RPM. On the remote machine, if everything went well, then $DISPLAY on the remote machine will now be set to a proxy display set up by SSH: $ echo $DISPLAY localhost:10.0 At which point you can run a command like xterm on the remote machine, and have the window pop up on your local display. Although there’s no X server running on the remote machine, you may still need to install a bunch of X11 libraries for Java to be able to talk to your local X server…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24153416
answers question: http://stackoverflow.com/q/24153416
upvote count: 9
score: 9

http://stackoverflow.com/a/24231705
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has body: Arrays.sort method code looks like public static &lt;T&gt; void sort(T[] a, Comparator&lt;? super T&gt; c) { if (c == null) c = NaturalOrder.INSTANCE; if (LegacyMergeSort.userRequested) legacyMergeSort(a, c); else TimSort.sort(a, 0, a.length, c, null, 0, 0); } so based on arguments, it uses sorting algorithms like in this case merge sort or tim sort passing to them array you want to sort and Comparator which should be used to decide how elements should be sorted (in case comparator will not be passed default one NaturalOrder.INSTANCE will be used). Since Comparator is functional interface because it has only one abstract method int compare(T o1, T o2); we can use method reference Utils::compareByLength which is same as using lambda (String s1, String s2) -&gt; Utils.compareByLength(s1,s2) so it is almost the same as passing instance of anonymous inner class which extends Comparator&lt;String&gt; interface and implements its compare method using body of lambda. So your code is similar to Arrays.sort(arr, new Comparator&lt;String&gt;() { @Override public int compare(String s1, String s2) { return Utils.compareByLength(s1, s2); } }); Now general contract is that Comparator#compare(value1, value2) returns 0 for equal values, negative value if first element is lesser then second, which means that in ascending order they are in correct places and positive value if first element is greater than second which means they are not ordered (using ascending order). This criteria are used in implementations of sorting algorithms so regardless if it is used merge sorting, quick sort or tim sort contract stays the same. Now each of this sorting algorithms can use comparator passed in sort method which in your case is Comparator which thanks to Lambdas or more precisely method reference is using Utils.compareByLength method to decide it two elements are suppose to be switched or not.
answers question: http://stackoverflow.com/q/24231464
accepted answer of: http://stackoverflow.com/q/24231464
score: 2

http://stackoverflow.com/comment/37451631
type: Comment
type: QuestionComment
has text: At least if the user scrolled to the bottom. It is enough :)
score: 0
comment on: http://stackoverflow.com/q/24246407

http://stackoverflow.com/comment/37468097
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24255359
score: 0
has text: yes, it has getInstance() method. SO i must create `Object xmlr = XMLRoutine.getInstance()` and then? I dont know what to do after this. Help pls.

http://stackoverflow.com/comment/37515591
has text: Why don't you create a custom class for this type of behavior and replace `new FlowLayout()` with `new MyFlowLayout()` for e.g. `class MyFlowLayout extends FlowLayout{public MyFlowLayout(){//orientation based code goes here}}`
type: Comment
comment on: http://stackoverflow.com/a/24226960
type: AnswerComment
score: 0

http://stackoverflow.com/q/24164990
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/30542914
tagged with: gwt
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37298107
has title: GWT SuperDev mode enabled, source maps enabled, compiled, yet no source maps appear
has comment: http://stackoverflow.com/comment/37306912
tagged with: gwt-super-dev-mode
score: 7
tagged with: java
has body: As the title says, I'm attempting to run SuperDev mode using the latest version of GWT (2.6.1) in Chrome. My application is being served by a Tomcat server. I have the SuperDev mode server running (via IntelliJ), which compiles and links the sources successfully, and source maps are enabled in Chrome. I go to the application (http://localhost:8081/example/#example). When it loads, I compile using the DevMode On bookmark. When it's done compiling, I don't see any Java sources in the Chrome developer tools. I also have the following properties set in my applications .gwt.xml &lt;add-linker name="xsiframe"/&gt; &lt;set-configuration-property name="devModeRedirectEnabled" value="true"/&gt; &lt;set-property name="compiler.useSourceMaps" value="true" /&gt; I'm not sure what else I'm missing? From the various resources I've found online, it appears I have all of my bases covered, so I'm not sure why the source maps won't show up.
has comment: http://stackoverflow.com/comment/37298351
downvote count: 0
answer count: 1
upvote count: 7
has comment: http://stackoverflow.com/comment/37303114

http://stackoverflow.com/comment/37421804
type: QuestionComment
score: 0
has text: did you read the link posted in the above comment. If you replace with `fragment_main.xml` get rid of the if statement and the fragment codes. instead os going through the old tutorial you are better off looking at the docs
comment on: http://stackoverflow.com/q/24231097
type: Comment

http://stackoverflow.com/q/24256469
has answer: http://stackoverflow.com/a/24256929
linked to: http://stackoverflow.com/q/17537216
tagged with: string
has comment: http://stackoverflow.com/comment/37470912
upvote count: 10
score: 10
has answer: http://stackoverflow.com/a/24256492
has comment: http://stackoverflow.com/comment/37470005
has comment: http://stackoverflow.com/comment/37470758
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37470646
has comment: http://stackoverflow.com/comment/37470459
has comment: http://stackoverflow.com/comment/37470404
duplicate of: http://stackoverflow.com/q/17537216
has comment: http://stackoverflow.com/comment/37470741
answer count: 5
has comment: http://stackoverflow.com/comment/37470717
possible better answer: http://stackoverflow.com/a/24257129
has comment: http://stackoverflow.com/comment/37470771
downvote count: 0
accepted answer: http://stackoverflow.com/a/24256737
has comment: http://stackoverflow.com/comment/37470837
has answer: http://stackoverflow.com/a/24257129
has comment: http://stackoverflow.com/comment/37470660
has answer: http://stackoverflow.com/a/24256737
has comment: http://stackoverflow.com/comment/37470883
has body: I have a string as follows Hey {1}, you are {2}. Here 1 and 2 are key whose value will be added dynamically. Now I need to replace {1} with the value that 1 represents and then I need to replace {2} with the value that 2 represents in the sentence above. How do I do it? I know what split function of a string does and I know very well that with that function I can do what I want but I am looking for something better. Note: I don't know what these keys are in advance. I need to retrieve the keys as well. And then according to the keys I need to replace the values in the string.
has answer: http://stackoverflow.com/a/24257118
has title: Replacing contents inside curly braces (for e.g. {1}) with something else
has comment: http://stackoverflow.com/comment/37470934
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37470588
tagged with: java

http://stackoverflow.com/q/24165440
type: AnsweredQuestion
tagged with: java
downvote count: 0
score: 1
favorite count: 0
has title: Closing a Webview in Android
has body: Basically, I want to load a webpage, wait for the user to log in and then automatically close the webpage and continue with the application. When the user is logged in on the page, the code parses the webpage using a Javascript function for an "A", an "I", or an "N," which gives the user varying levels of access to other features of the webpage. The problem is that I can't seem to get it to close the WebView immediately after logging in. Currently, I have implemented a closeWebview button that the user can click after they've logged in that will close the page, but when I try to close it automatically after authentication I can't get it to seem to work. It either closes immediately, or I can't close it at all. Here is my code for Authentication: private void Authentication(){ class MyJavaScriptInterface { @JavascriptInterface public void showHTML(String content) { // grants access based on authorization level if (content.contains("A")) { addAuthentication = true; inquireAuthentication = true; loggedIn = true; Toast.makeText(getApplicationContext(), "Logged In for Addition and Inquiry", Toast.LENGTH_SHORT).show(); }else if(content.contains("I")){ addAuthentication = false; inquireAuthentication = true; loggedIn = true; Toast.makeText(getApplicationContext(), "Logged In for Inquiry only", Toast.LENGTH_SHORT).show(); }else { addAuthentication = false; inquireAuthentication = false; loggedIn = true; Toast.makeText(getApplicationContext(), "No Access Granted", Toast.LENGTH_SHORT).show(); } } } // open up the login page final WebView wv = (WebView)findViewById(R.id.login_webview); wv.getSettings().setJavaScriptEnabled(true); wv.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT"); wv.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { //once page is finished loading, check id="role" and copy that value and pass it to showHTML wv.loadUrl("javascript:(function() { " + "window.HTMLOUT.showHTML(document.getElementB…
type: Question
tagged with: android
tagged with: javascript
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/24166696
has answer: http://stackoverflow.com/a/24166696

http://stackoverflow.com/a/24143847
downvote count: 0
score: 6
has body: Arrays.asList is a generic function that takes a parameter of T... array, in case of int[] the only applicable type is int[], i.e. your list will contain only one element, which is the array if integers. To fix it use boxed primitive types: Integer[] portOut = {4000,4001,4002,4003,4004,4005,4006,4007,4008,4009}; Integer[] result = {4001, 4005, 4003, 0, 0, 0, 0, 0, 0, 0};
answers question: http://stackoverflow.com/q/24143615
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24143615
type: AcceptedAnswer

http://stackoverflow.com/comment/75591766
comment on: http://stackoverflow.com/q/24176493
has text: possible duplicate of https://stackoverflow.com/questions/5704918/custom-guice-binding-annotations-with-parameters and https://stackoverflow.com/questions/41958321/guicebinding-annotations-with-attributes
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24193660
has comment: http://stackoverflow.com/comment/37350879
has title: How to check if email already exists in DB - JPA, Java, JBoss
has comment: http://stackoverflow.com/comment/37350414
tagged with: java
tagged with: jpa
has comment: http://stackoverflow.com/comment/37350702
has answer: http://stackoverflow.com/a/24195225
has comment: http://stackoverflow.com/comment/37350675
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/37350312
has comment: http://stackoverflow.com/comment/37350288
has comment: http://stackoverflow.com/comment/37350294
has comment: http://stackoverflow.com/comment/37350191
has comment: http://stackoverflow.com/comment/37350375
has comment: http://stackoverflow.com/comment/37350388
has comment: http://stackoverflow.com/comment/37350263
has comment: http://stackoverflow.com/comment/37350440
has comment: http://stackoverflow.com/comment/37350317
has comment: http://stackoverflow.com/comment/37350612
tagged with: jboss
has body: I am trying to check if the email the user enters already exists in the db. I have to methods (register and update) and one helper method in my UserBean.java: public String register() { if (emailAlreadyExists(this.user.getEmail())) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("This e-Mail is already in use.")); } else { this.conversation.end(); try { if (this.id == null) { this.entityManager.persist(this.user); return "thanks.xhtml"; } else { this.entityManager.merge(this.user); return "thanks.xhtml"; } } catch (EJBTransactionRolledbackException e) { Throwable t = e.getCause(); while ((t != null) &amp;&amp; !(t instanceof ConstraintViolationException)) { t = t.getCause(); } if (t instanceof ConstraintViolationException) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(e.getMessage())); return null; } } } return null; } public String update() { if (emailAlreadyExists(this.user.getEmail())) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("This e-Mail is already in use.")); } else { this.conversation.end(); try { if (this.id == null) { this.entityManager.persist(this.user); return "search?faces-redirect=true"; } else { this.entityManager.merge(this.user); return "view?faces-redirect=true&amp;id=" + this.user.getId(); } } catch (Exception e) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(e.getMessage())); return null; } } return null; } public boolean emailAlreadyExists(String emailAddr) { long counter = 0; counter = (Long) this.entityManager .createQuery( "SELECT COUNT(u.email) FROM User u WHERE u.email = :email") .setParameter("email", emailAddr).getSingleResult(); if (counter &gt; 0) { return true; } return false; } I don't know why but this code works perfect for the register method (whenever I enter an existing email address), but not for the update method, although they are very similar. Every time when I perform an user update, these SQL statements are performed in the foll…
has comment: http://stackoverflow.com/comment/37350089
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24195225
has comment: http://stackoverflow.com/comment/37350813

http://stackoverflow.com/q/24254487
tagged with: build
score: 0
tagged with: java
answer count: 1
type: Question
has body: I've tried looking at many other pages and nothing has seemed to solve the problem. I have a program that was written on another computer, and I would like to work on it on the computer I am currently using. I have a bunch of .java files from the other computer and I've put them into the source folder of a Java project I've just created on the computer I'm using, as I'm trying to reproduce the project on the computer I'm currently using. However when I try to run the code it only lets me use ant build. How can I get it to run normally? I do have a main method and I'm trying to run it from that main method.
type: UnansweredQuestion
tagged with: ant
has comment: http://stackoverflow.com/comment/37466853
tagged with: compilation
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37468182
has answer: http://stackoverflow.com/a/27737317
has title: Eclipse Won't Compile/Run Code Pasted Into the Source Folder, Only Ant Build Available

http://stackoverflow.com/a/24189356
has body: Depends on what exactly you want to do, there are mutliple ways to play a sampled sound at a different frequency. a.) You can open a line with explicitly a different sample rate and feed your sample data into it (lets say you open a line with 22khz and feed 44khz data into it, resulting in halved pitch and the sound becomming twice as long). This method can quickly hit the limits set by the audio hardware (allowed minimum and maximum sample rate are limited). b.) You use a line at a set sample rate and interpolate the sample data to make it longer/shorter (by inserting interpolated samples to make it longer or dropping samples to make it shorter). c.) Use a fourier transform to transform the sound into frequency samples and reconvert that to the desired output frequency (this requires some complex math). This way, you can change the pitch of a sound while keeping its duration the same.
answers question: http://stackoverflow.com/q/24187753
score: 0
type: Answer

http://stackoverflow.com/q/24125637
has comment: http://stackoverflow.com/comment/37222163
has answer: http://stackoverflow.com/a/24125710
tagged with: android
accepted answer: http://stackoverflow.com/a/24125710
score: -1
has comment: http://stackoverflow.com/comment/37222246
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/37222952
has title: Using for loop for asynctask
tagged with: java
has body: i have an asyntask that sends a request and receives images. it works fine for 1 item, the thing is here i have this method: Arraylist&lt;String&gt; todownload; . . public void downloadit(){ int size=todownload.size(); for (int i=0;i&lt;size;i++) { this.todo=todownload.get(i); System.out.println("Dowloading = " + todo); MyAsyncImagesDownload sync = new MyAsyncImagesDownload(); System.out.println("Size="+todownload.size()); sync.execute(); } to make it work for downloading more than 1 request. but let say the todownload has 2 values inside, the value of todo which is the one who Async works with, at the server is always the last one, i also tried to replace the for loop with: for(String todo:Todownload) . . still same thing. so i felt the loop is finishing its job before the execute job is finished, so i added Wait method to after execute and Notifyall() to the end of async task, but seems i get some errors with that. could you please help me what can i do to achieve this? thanks Async code is : BufferedOutputStream bos; OutputStream output; DataOutputStream dos; int len; int smblen; InputStream in; DataInputStream clientData; FileOutputStream fos; String filepath; String target; Socket clientSocket; @Override protected String doInBackground(String... Result) { // TODO Auto-generated method stub String REresponse = null; Log.i("lifemate","im here in the Async !"); try { socket = new Socket(server, 1450); } catch (UnknownHostException e5) { // TODO Auto-generated catch block e5.printStackTrace(); } catch (IOException e5) { // TODO Auto-generated catch block e5.printStackTrace(); } String msg = "Connection accepted " + socket.getInetAddress() + ":" + socket.getPort(); Log.i(LOGTAG, msg); try { sInput = new ObjectInputStream(socket.getInputStream()); } catch (StreamCorruptedException e4) { // TODO Auto-generated catch block e4.printStackTrace(); } catch (IOException e4) { // TODO Auto-generated catch block e4.printStackTrace(); } try { sOutput = new ObjectOutputStream(s…
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37222701
has comment: http://stackoverflow.com/comment/37222370
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37222772
has comment: http://stackoverflow.com/comment/37222813

http://stackoverflow.com/q/24222131
tagged with: database
tagged with: persistence
score: 0
has answer: http://stackoverflow.com/a/24222190
tagged with: java
answer count: 1
has body: I have concurrent application which needs to update the incremented/decremented (change in balance) to the balance column in account table. I'm using Oracle Toplink. One way to do the concurrent updates is to use Optimistic locking by using version column. 1) Optimistic Locking update account set balance=?, version=? where id=? and version=? 2) Atomic update update account set balance=balance + ? where id=? I would like to use 2) option as it is easier and doesn't require me to read the value first before updating (as in 1) ). SQLCall sc = new SQLCall("update account set balance=balance + #delta where id=#id"); DataModifyQuery data = new DataModifyQuery(sc); data.addArgument("delta", BigDecimal.class); data.addArgument("id", Long.class); Vector param = new Vector(2); param.add(new BigDecimal(.01)); param.add(new Long(12345)); getSession().executeQuery(data, param); I'm facing problem in executing the update query. The issue is that it doesn't reflect the amount at the end. is 2) option is really updating Atomically? Did I follow right coding approach. Anything wrong with this example? Please guide
tagged with: toplink
type: Question
type: UnansweredQuestion
has title: Oracle Toplink: Atomically incrementing/decrementing amount

http://stackoverflow.com/comment/37467498
score: 2
comment on: http://stackoverflow.com/q/24255009
has text: This is not a duplicate of that question. For instance, the example in the other Question involves mutating the array.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24256648
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24256606
score: 4
accepted answer of: http://stackoverflow.com/q/24256606
has body: You can put those objects in list list.add(R.drawable.ab1); list.add(R.drawable.ab2); list.add(R.drawable.ab3); list.add(R.drawable.ab4); . . . and then you can iterate through that list, using list.get(i) and pass each object in the method. for(int i =1; i&lt;11; i++) { b = decodeSampledBitmapFromResource(getResources(),list.get(i), reqHeight, reqWidth); }
type: Answer
upvote count: 4

http://stackoverflow.com/q/24106134
has comment: http://stackoverflow.com/comment/37203263
tagged with: maven
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37207240
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/21309252
has answer: http://stackoverflow.com/a/33548879
has comment: http://stackoverflow.com/comment/37206864
tagged with: macos
has title: Maven fail to deploy web application at Tomcat server in Mac OS X
score: 0
type: UnansweredQuestion
answer count: 1
has body: I am trying deploy a web application at Tomcat server in a Mac OS X system using Maven. I already accomplish do this in a Linux and Windows System. But in the Mac OS X I am facing this error: Uploading: http://localhost:8080/manager/text/deploy?path=%2Floja Uploaded: http://localhost:8080/manager/text/deploy?path=%2Floja (14335 KB at 73508.0 KB/sec) [ERROR] Tomcat return http status error: 403, Reason Phrase: Forbidden [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9.646s [INFO] Finished at: Sun Jun 08 09:19:55 GMT-03:00 2014 [INFO] Final Memory: 10M/81M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project cms: Tomcat return http status error: 403, Reason Phrase: Forbidden: [ERROR] &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; [ERROR] &lt;html&gt; [ERROR] &lt;head&gt; [ERROR] &lt;title&gt;403 Access Denied&lt;/title&gt; [ERROR] &lt;style type="text/css"&gt; [ERROR] &lt;!-- [ERROR] BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;font-size:12px;} [ERROR] H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} [ERROR] PRE, TT {border: 1px dotted #525D76} [ERROR] A {color : black;}A.name {color : black;} [ERROR] --&gt; [ERROR] &lt;/style&gt; [ERROR] &lt;/head&gt; [ERROR] &lt;body&gt; [ERROR] &lt;h1&gt;403 Access Denied&lt;/h1&gt; [ERROR] &lt;p&gt; [ERROR] You are not authorized to view this page. [ERROR] &lt;/p&gt; [ERROR] &lt;p&gt; [ERROR] If you have already configured the Manager application to allow access and [ERROR] you have used your browsers back button, used a saved book-mark or similar [ERROR] then you may have triggered the cross-site request forgery (CSRF)…

http://stackoverflow.com/comment/37272969
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24152336
has text: Sorry, they weren't there, I updated it, glad to help!

http://stackoverflow.com/q/24188916
tagged with: java
has body: I am using sezpoz in a mixed java/scala project compiled in Eclipse. It works perfectly fine (after a few modifications mentioned here: http://imagej.net/pipermail/imagej-devel/2011-January/000305.html) at locating the java annotations @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD }) @Retention(RetentionPolicy.SOURCE) @Indexable(type = TIPLPluginFactory.class) public static @interface PluginInfo { /** * The name of the plugin (VfilterScale is Filter so is FilterScale) * @return */ String pluginType(); ... } Is used as the annotation for labeling the plugins and they are read with the following function. public static List&lt;PluginInfo&gt; getAllPlugins() { for (final IndexItem&lt;PluginInfo, TIPLPluginFactory&gt; item : Index.load( PluginInfo.class, TIPLPluginFactory.class)) { final PluginInfo bName = item.annotation(); ... The java plugins have this in the class @TIPLPluginManager.PluginInfo(pluginType = "DistGrow", desc="Full memory distance growing", sliceBased=false) final public static TIPLPluginManager.TIPLPluginFactory myFactory = new TIPLPluginManager.TIPLPluginFactory() { @Override public ITIPLPlugin get() { return new DistGrow(); } }; The scala plugins have the nearly identical code @TIPLPluginManager.PluginInfo(pluginType = "GrayAnalysis", desc="Spark-based gray value analysis", sliceBased=false,sparkBased=true) val myFactory: TIPLPluginManager.TIPLPluginFactory = new TIPLPluginManager.TIPLPluginFactory() { override def get():ITIPLPlugin = { return new ShapeAnalysis; } }; Any idea why this doesn't work or how it might need to be modified to make it work correctly? An easy hack would be to make a new java class to have all these annotations for making the scala ones but that does not seem very elegant
tagged with: eclipse
type: Question
tagged with: scala
type: UnansweredQuestion
tagged with: annotations
has comment: http://stackoverflow.com/comment/41012734
has comment: http://stackoverflow.com/comment/39163039
score: 0
has comment: http://stackoverflow.com/comment/41058713
has title: Using sezpoz for a mixed java scala project
answer count: 0

http://stackoverflow.com/a/24234820
has comment: http://stackoverflow.com/comment/37428914
has body: Call secondMethod() from onFinish() of countdown().
has comment: http://stackoverflow.com/comment/37428629
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37428690
score: 0
accepted answer of: http://stackoverflow.com/q/24234685
type: Answer
answers question: http://stackoverflow.com/q/24234685

http://stackoverflow.com/q/24242027
tagged with: whatsapp
has title: Sharing images from one app to Whatsapp
type: AnsweredQuestion
score: 0
has body: I want to share images from my application to Whatsapp but I am not able to do this. I place all images into assets folder. What do I have to change? public void onClickWhatsApp() { Intent waIntent = new Intent(Intent.ACTION_SEND); waIntent.setType("text/plain"); String text = "Hey, check out this cool game for Android ‘Free Ticket Bollywood Quiz’ www.globussoft.com"; waIntent.setPackage("com.whatsapp"); if (waIntent != null) { waIntent.putExtra(Intent.EXTRA_TEXT, text);// startActivity(Intent.createChooser(waIntent, "Share with")); } else { Toast.makeText(this, "WhatsApp not Installed", Toast.LENGTH_SHORT) .show(); } }
linked to: http://stackoverflow.com/q/15900842
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24242275
answer count: 1
has comment: http://stackoverflow.com/comment/37442261
favorite count: 0
type: Question
upvote count: 2
downvote count: 2
accepted answer: http://stackoverflow.com/a/24242275

http://stackoverflow.com/comment/37191026
comment on: http://stackoverflow.com/q/24108442
score: 0
type: Comment
type: QuestionComment
has text: hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

http://stackoverflow.com/comment/40672393
comment on: http://stackoverflow.com/a/24186707
type: AnswerComment
score: 0
type: Comment
has text: This is still an issue in spring data 1.7.0? Please see https://stackoverflow.com/questions/25975159/pageable-and-param-in-a-spring-data-jparepository-method-issue-2

http://stackoverflow.com/comment/37369665
type: QuestionComment
comment on: http://stackoverflow.com/q/24203686
has text: line no 65 is conn = dataSource.getConnection();
score: 0
type: Comment

http://stackoverflow.com/a/24260348
has comment: http://stackoverflow.com/comment/37486101
answers question: http://stackoverflow.com/q/24260145
type: Answer
has comment: http://stackoverflow.com/comment/37480125
has body: You either do not have the spring-beans jar on the classpath or you have different versions. Make sure that you are building with the same version. Also make sure that all the versions of the various Spring jars are the same.
has comment: http://stackoverflow.com/comment/37482197
has comment: http://stackoverflow.com/comment/37477957
score: 0
has comment: http://stackoverflow.com/comment/37509544

http://stackoverflow.com/comment/37387032
score: 0
type: Comment
has text: http://pastebin.com/aav73i7x realized I was adding a new jpanel, but doesnt seem to be the problem
type: AnswerComment
comment on: http://stackoverflow.com/a/24212627

http://stackoverflow.com/comment/37419006
score: 0
type: AnswerComment
has text: I don't agree with you that verifying code is very difficult. this is not a big project for you to verify .. formal verification is did later only I posted code. if you read my question correctly, I clearly mentioned, is waiting stuff or better waiting properties common in both the case as both makes thread in waiting state.
comment on: http://stackoverflow.com/a/24229651
type: Comment

http://stackoverflow.com/comment/37350584
type: Comment
type: QuestionComment
has text: They are located on a separate memory address so they wont be equal
score: 0
comment on: http://stackoverflow.com/q/24194064

http://stackoverflow.com/comment/37247612
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24139273
score: 2
has text: Try it with `19/03/04`. It will accept it, though I guess it should not.

http://stackoverflow.com/comment/51633061
has text: Did you find a solution on this?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24157571

http://stackoverflow.com/comment/37470758
score: 0
comment on: http://stackoverflow.com/q/24256469
type: QuestionComment
has text: @DanTemple and Amit keys will integers and they will be inside curley braces {}.
type: Comment

http://stackoverflow.com/q/24109971
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37193253
answer count: 1
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/24110076
has title: Saving permanent data using shared preferences?
has answer: http://stackoverflow.com/a/24110076
has body: I am making a Highscore script for my game using Shared Preferences. I want this data to be only held for the phone it is installed on obviously. I have done the following, and the highscore shows and updates, but when I close out of the app and re open it, it resets. if(finalScore &gt; SharedPrefManager.getHighScore()) SharedPrefManager.SetHighScore(finalScore); SharedPrefManager.StoreToPref(); SharedPrefManager.java: package com.divergent.thumbler; import android.content.Context; import android.content.SharedPreferences; // all methods are static , so we can call from any where in the code //all member variables are private, so that we can save load with our own fun only public class SharedPrefManager { //this is your shared preference file name, in which we will save data public static final String MY_EMP_PREFS = "MySharedPref"; //saving the context, so that we can call all //shared pref methods from non activity classes. //because getSharedPreferences required the context. //but in activity class we can call without this context private static Context mContext; // will get user input in below variables, then will store in to shared pref private static int HighScore = 0; public static void Init(Context context) { mContext = context; } public static void LoadFromPref() { SharedPreferences settings = mContext.getSharedPreferences(MY_EMP_PREFS, 0); // Note here the 2nd parameter 0 is the default parameter for private access, //Operating mode. Use 0 or MODE_PRIVATE for the default operation, HighScore = settings.getInt("HighScore", HighScore); } public static void StoreToPref() { // get the existing preference file SharedPreferences settings = mContext.getSharedPreferences(MY_EMP_PREFS, 0); //need an editor to edit and save values SharedPreferences.Editor editor = settings.edit(); editor.putInt("HighScore", HighScore); // Age is the key and mAge is holding the value //final step to commit (save)the changes in to the shared pref editor.commit(); } public static void D…

http://stackoverflow.com/q/24231223
has answer: http://stackoverflow.com/a/41735266
possible better answer: http://stackoverflow.com/a/41735266
favorite count: 0
has body: In Java (using json-simple) I have successfully parsed a JSON string which was created in JavaScript using JSON.stringify. It looks like this: {"teq":14567,"ver":1,"rev":1234,"cop":15678} This string is storing the state of a custom JavaScript object which I now wish to re-constitute as a pure Java class. Its not going well - first foray into Java coming from a C# background. :-p The object is currently in the form of a org.json.simple.JSONObject since that is what json-simple made from the JSONParser.parse() operation. How can I cast this JSONObject to my new Java class? (the definition of which is below...) public class MyCustomJSObject { public int teq; public int ver; public int rev; public int cop; }
has title: How can I cast a JSONObject to a custom Java class?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37421216
answer count: 5
tagged with: java
has answer: http://stackoverflow.com/a/24231295
has answer: http://stackoverflow.com/a/24231305
accepted answer: http://stackoverflow.com/a/24231305
has answer: http://stackoverflow.com/a/24231324
type: Question
has comment: http://stackoverflow.com/comment/37421166
downvote count: 0
has comment: http://stackoverflow.com/comment/37421193
tagged with: json-simple
has answer: http://stackoverflow.com/a/24236703
upvote count: 29
has comment: http://stackoverflow.com/comment/37421590
score: 29

http://stackoverflow.com/comment/37350570
comment on: http://stackoverflow.com/q/24194064
has text: >but also should use the same reference and reference the same memory. no they are two differnet object with same value
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24286934
downvote count: 0
has comment: http://stackoverflow.com/comment/43401009
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24194221
type: Answer
answers question: http://stackoverflow.com/q/24194221
has body: I managed to come across the answer by accident while I was trying out some of the pre-generated code. Here is a working example of useing a WorldWindGLCanvas on a Top Component in the NetBeans 8.0 Platform. I hope this answer helps someone cause it took me way to long to accidently find this on my own. Below is the Topcomponent Class. package Earth; import gov.nasa.worldwind.*; import gov.nasa.worldwind.avlist.AVKey; import gov.nasa.worldwind.awt.WorldWindowGLCanvas; import java.awt.BorderLayout; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.windows.TopComponent; import org.openide.util.NbBundle.Messages; import gov.nasa.worldwind.layers.*; import gov.nasa.worldwind.layers.Earth.*; import java.awt.Dimension; import javax.swing.JInternalFrame; @TopComponent.Description( preferredID = "EarthTopComponent", //iconBase="SET/PATH/TO/ICON/HERE", persistenceType = TopComponent.PERSISTENCE_ALWAYS ) @TopComponent.Registration(mode = "explorer", openAtStartup = false) @ActionID(category = "Window", id = "Earth.EarthTopComponent") @ActionReference(path = "Menu/Window" /*, position = 333 */) @TopComponent.OpenActionRegistration( displayName = "#CTL_EarthAction", preferredID = "EarthTopComponent" ) @Messages({ "CTL_EarthAction=Earth", "CTL_EarthTopComponent=Earth Window", "HINT_EarthTopComponent=This is the Earth window" }) public final class EarthTopComponent extends TopComponent { public EarthTopComponent() { initcomp(); setName(Bundle.CTL_EarthTopComponent()); setToolTipText(Bundle.HINT_EarthTopComponent()); } private LayerList layerlist; //Holds all Layers private WorldWindowGLCanvas canvas; //Displays Model private Model model; //world and layers private OptionSideBar sidebar; private JInternalFrame layersPanel; private void initcomp() { canvas = new WorldWindowGLCanvas(); sidebar = new OptionSideBar(); //Creates a new model to display in the canvas model = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME); …
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/24208531
downvote count: 0
has comment: http://stackoverflow.com/comment/37383390
upvote count: 1
has comment: http://stackoverflow.com/comment/37378555
tagged with: generics
has comment: http://stackoverflow.com/comment/37379357
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37378377
linked to: http://stackoverflow.com/q/529085
has comment: http://stackoverflow.com/comment/37378494
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37382335
has title: Why array instantiation with a generic type does not work in Java?
tagged with: java
linked to: http://stackoverflow.com/q/2927391
linked to: http://stackoverflow.com/q/3975054
has comment: http://stackoverflow.com/comment/37378106
has answer: http://stackoverflow.com/a/24208641
has body: public interface Foo&lt;E&gt; { public void blah(E e); } public class MyClass&lt;E&gt; { private final Foo&lt;E&gt;[] fooArray = new Foo&lt;E&gt;[8]; // does not compile! // (...) } What is the correct way of addressing that generics limitation? Or maybe it is not a limitation and I am missing something?
has comment: http://stackoverflow.com/comment/37378858
duplicate of: http://stackoverflow.com/q/2927391
has comment: http://stackoverflow.com/comment/37378376
score: 1
answer count: 1

http://stackoverflow.com/comment/37287910
has text: A suggestion: check any libraries that are deployed with the application or you manually added to tomcat to be sure they're not zero bytes in size; judging from the stacktrace its the Java compiler failing due to a zip file not being loaded properly which most likely refers to a jar dependency file.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24160515

http://stackoverflow.com/q/24239046
has answer: http://stackoverflow.com/a/56730304
upvote count: 8
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24239265
tagged with: javafx-8
tagged with: java
tagged with: javafx
has title: java - open url in chrome browser only
has body: I have an url, I am trying to open that url in web view of JavaFX but the content was not compatible with web view. It's only compatible to the chrome and firefox. So I would like to open that Url in chrome browser only instead of opening it in web view. is it possible?(I don't want to open it in default browser.) I tried the below code but we got the error as "Cannot run program "chrome": error=2, No such file or directory". Runtime.getRuntime().exec(new String[] { "Chrome", "http://goo.gl/EsomR0" }); thanks,
score: 8
tagged with: javafx-2
tagged with: browser
has comment: http://stackoverflow.com/comment/37436823
downvote count: 0
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24239639
linked to: http://stackoverflow.com/q/22414646

http://stackoverflow.com/a/24268110
has body: Because none of these answeres worked for me, i finally decided to use jsoup to filter and remove all img tags. using jsop was a little bit complex but it worked!! EDIT Here is an example java code String content = " title "; if(content != null) { Document document = Jsoup.parse(content); document.select("img").remove(); content = document.toString(); }
has comment: http://stackoverflow.com/comment/46331874
score: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/46631417
has comment: http://stackoverflow.com/comment/46623657
has comment: http://stackoverflow.com/comment/46399431
type: Answer
accepted answer of: http://stackoverflow.com/q/24145382
downvote count: 0
answers question: http://stackoverflow.com/q/24145382
upvote count: 7

http://stackoverflow.com/q/24263479
answer count: 1
has title: NetBeans `Convert to for (Iterator...) {}' suggestion
type: Question
accepted answer: http://stackoverflow.com/a/24263882
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37483671
has body: I have the following piece of Java code ImmutableList&lt;Element&gt; elements = ...; for (Element e : elements) { e.doSomething(); } where ImmutableList is part of the Guava library. NetBeans suggest me to convert the code using the `Convert to for (Iterator...) {}' suggestion which results in the following transformation ImmutableList&lt;Element&gt; elements = ...; for (Iterator&lt;Element&gt; it = elements.iterator(); it.hasNext();) { Element e = it.next(); e.doSomething; } I fail to see a reason for this transformation. I'm using Java 1.7 and NetBeans 7.4. Can somebody enlighten me?
has comment: http://stackoverflow.com/comment/37483002
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37483058
tagged with: guava
linked to: http://stackoverflow.com/q/2113216
has answer: http://stackoverflow.com/a/24263882
score: 0
tagged with: java

http://stackoverflow.com/comment/37229786
has text: @Rod_Algonquin If you check the edit I have placed the rest of the code. It's initialized in the constructor of the Screen class.
score: 0
comment on: http://stackoverflow.com/q/24129192
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37320079
score: 0
has text: you can use the `required` Attribute, like `<h:inputText value="#{home_number}" required="true" />`
type: QuestionComment
comment on: http://stackoverflow.com/q/24177825
type: Comment

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/24239332
tag name: google-oauth
tags question: http://stackoverflow.com/q/24128234

http://stackoverflow.com/a/24236388
has body: JFrame (or any other window based container) can not be added to anything else, you need to change you UI so that the components extend from something like JPanel Don't ever extend directly from top level containers where possible (applets are a different beast). Instead, build you UI's around a simple container like JPanel. This allows you to decide how and when to use the components, without been locked into a single top level container, as you are now. The overall process is simple. JTabbedPane is a container, you add other components onto it. You then add that to an instance of JFrame (or what ever container you want to use), for example... Take a look at How to Use Tabbed Panes for more details import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TabbedExample { public static void main(String[] args) { new TabbedExample(); } public TabbedExample() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("Student", new StudentGUI()); tabbedPane.add("Courses", new CourseGUI()); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(tabbedPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class StudentGUI extends JPanel { public StudentGUI() { setLayout(new BorderLayout()); JPanel top = new JPanel(new BorderLayout()); top.setBackground(Color.BLUE); top.add(new JLabel("Top")); JPanel middle = new JPanel(new BorderLayout()); middle.setBackground(Color.GREEN); middle.add(new JLa…
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24235697
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24235697
has comment: http://stackoverflow.com/comment/37432051
type: AcceptedAnswer

http://stackoverflow.com/q/24231536
has comment: http://stackoverflow.com/comment/37421799
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24232057
linked to: http://stackoverflow.com/q/24206646
has comment: http://stackoverflow.com/comment/37421871
score: 0
has comment: http://stackoverflow.com/comment/37422769
tagged with: java
answer count: 1
has title: Read an image file within the Eclipse Project in java
has body: I am working on a simple 2D Sidescroller and I use this : bgData = new File("C:\\Users\\User\\Desktop\\Folder\\" + "Workspace\\Sidescroller\\src\\data\\bg.png"); Since it reads a file within the code base, why cant I access it? Exception got: javax.imageio.IIOException: Can't read input file! at javax.imageio.ImageIO.read(Unknown Source)
has comment: http://stackoverflow.com/comment/37421803
type: Question

http://stackoverflow.com/comment/37189991
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24108332
has text: I found for mac os x: http://joris.kluivers.nl/blog/2006/05/18/global-menu-bar-for-java/ Thank you so much.
score: 1

http://stackoverflow.com/q/24188752
tagged with: java
linked to: http://stackoverflow.com/q/22744920
linked to: http://stackoverflow.com/q/23478984
has body: I want to display a random image in this program when the button is clicked but i get an exception error and cant fix it. public class TestImage1 { public static void main(String args[]) throws IOException { String sonido = "Windows Navigation Start.wav"; InputStream in = new FileInputStream(sonido); AudioStream audio = new AudioStream(in); AudioPlayer.player.start(audio); try { TestImage1 obj = new TestImage1(); obj.run(args); } catch (Exception e) { } } public void run(String[] args) throws Exception { imgRandom form = new imgRandom(); form.setBounds(0, 0, 500, 400); form.setVisible(true); } public class imgRandom extends JFrame implements ActionListener { private JLabel label2; JButton boton; String cads[] = {"/img/duck.gif", "/img/luigi.png", "/img/mario.jpg"}; public imgRandom() throws IOException { setLayout(null); label2 = new JLabel("press"); label2.setBounds(10, 20, 100, 100); add(label2); boton = new JButton("Presioname!!"); boton.setBounds(150, 250, 200, 100); add(boton); boton.addActionListener(this); } public void actionPerformed(ActionEvent e) { if (e.getSource() == boton) { int ra = (int) (Math.random() * 3); URL url = this.getClass().getResource(cads[ra]); try { Image img = ImageIO.read(url); label2.setIcon(new ImageIcon(img)); } catch (IOException e1) { e1.printStackTrace(); } } } } } can sombedy tell me how to fix it. if the button is pressed it should display a random image but it throws an exception with a lot of other error.
score: 0
type: UnansweredQuestion
answer count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/15302085
has comment: http://stackoverflow.com/comment/37340656
type: Question
has title: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null
linked to: http://stackoverflow.com/q/7196889
has answer: http://stackoverflow.com/a/24188888
tagged with: exception

http://stackoverflow.com/comment/37375515
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24207039
has text: yes I tried getParameterType which is giving me Type .. But how to proceed further ! I want to dynamically convert the String to this Type.

http://stackoverflow.com/q/24267004
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37491800
linked to: http://stackoverflow.com/q/1242656
accepted answer: http://stackoverflow.com/a/24267337
tagged with: java
has answer: http://stackoverflow.com/a/24267337
answer count: 1
has title: Spring Autoregister Modules
type: Question
has body: I am currently doing a modular web application from scratch and I am using Spring 4. The main problem is that I want that each module will register to the core module so that their presence will be known. Here is the breakdown of the modules Base Module: module registration interface &amp; implementation Module 1 which will need to register to the Base Module. Module 2 which also will need to register to the Base Modules Module 1 (and other modules) are all optional. I am on quite a tight schedule so as much as possible, I want to use Spring IoC only. Thanks. EDIT: The modules do not need to be dynamically registered at runtime.
tagged with: spring

http://stackoverflow.com/a/24206895
upvote count: 1
score: 1
has body: I'm not sure what you are trying to achieve, but maybe this will help: Class[] classes = {SomeObject.class, SomeObject1 .class };
answers question: http://stackoverflow.com/q/24206828
downvote count: 0
type: Answer

http://stackoverflow.com/a/24179058
type: Answer
has comment: http://stackoverflow.com/comment/37482463
score: 0
has comment: http://stackoverflow.com/comment/37322262
has comment: http://stackoverflow.com/comment/37482515
has comment: http://stackoverflow.com/comment/37322422
has comment: http://stackoverflow.com/comment/37527295
answers question: http://stackoverflow.com/q/24179008
has body: First of all check your device have internet connection or not :- public static boolean CheckInternet(Context context) { ConnectivityManager connec = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); android.net.NetworkInfo wifi = connec.getNetworkInfo(ConnectivityManager.TYPE_WIFI); android.net.NetworkInfo mobile = connec.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); return wifi.isConnected() || mobile.isConnected(); } Read below documentation :- http://developer.android.com/reference/java/net/HttpURLConnection.html http://developer.android.com/reference/java/net/URLConnection.html private void downloadImage(String urlStr) { progressDialog = ProgressDialog.show(this, "", "Fetching Image..."); final String url = urlStr; new Thread() { public void run() { InputStream in = null; Message msg = Message.obtain(); msg.what = 1; try { in = openHttpConnection(url); bitmap = BitmapFactory.decodeStream(in); Bundle b = new Bundle(); b.putParcelable("bitmap", bitmap); msg.setData(b); in.close(); } catch (IOException e1) { e1.printStackTrace(); } messageHandler.sendMessage(msg); } }.start(); }
has comment: http://stackoverflow.com/comment/37322320

http://stackoverflow.com/a/24136027
type: Answer
has comment: http://stackoverflow.com/comment/37244916
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24135633
has comment: http://stackoverflow.com/comment/37247792
has comment: http://stackoverflow.com/comment/37250373
has body: I think you need to update the domain.xml file of the Glassfish server with something like: </java-config> ... -Djavax.xml.accessExternalSchema=all </java-config> Some other settings may also have to be done. See https://netbeans.org/kb/docs/websvc/jax-ws.html for more info. Hope it helps!!
has comment: http://stackoverflow.com/comment/37242624

httprequest
tags question: http://stackoverflow.com/q/24139695
tags question: http://stackoverflow.com/q/24266308
tags question: http://stackoverflow.com/q/24135508
type: Tag
tags question: http://stackoverflow.com/q/24145039
tag name: httprequest

http://stackoverflow.com/q/24209525
score: 0
answer count: 0
type: UnansweredQuestion
has body: I am developing an Eclipse plugin. That is using UI and file resources. Which required org.eclipse.core.resources;bundle-version="3.8.101" and filed if this dependency is not available on target eclipse. Eclipse version: Juno (for Android development). I want to install this jar if not available on target Eclipse. So my plugin run without any issue for target Eclipse. Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: ABC Bundle-SymbolicName: ABC;singleton:=true Bundle-Version: 1.0 Bundle-Activator: magic.Activator Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.core.resources;bundle-version="3.8.101" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Bundle-ClassPath: ., libs/java-json.jar, libs/json-lib-2.4-jdk15.jar Here is the error I got while installation Cannot complete the install because one or more required items could not be found. Software being installed: Feature 1.0.0 (com.confiz.android.codegen.feature.feature.group 1.0.0) Missing requirement: Feature 1.0.0 (com.confiz.android.codegen.feature.feature.group 1.0.0) requires 'org.eclipse.core.resources 3.8.101' but it could not be found
tagged with: java
has title: Dependency not installed when installing Eclipse
tagged with: eclipse-plugin
type: Question
has comment: http://stackoverflow.com/comment/37381012
has comment: http://stackoverflow.com/comment/37380233
has comment: http://stackoverflow.com/comment/37395052
has comment: http://stackoverflow.com/comment/37380500
tagged with: eclipse

jsp-tags
tags question: http://stackoverflow.com/q/24112812
tags question: http://stackoverflow.com/q/24262955
tags question: http://stackoverflow.com/q/24260271
tag name: jsp-tags
type: Tag

http://stackoverflow.com/q/24129480
has comment: http://stackoverflow.com/comment/37229909
has answer: http://stackoverflow.com/a/24129975
has title: Java: while loop for user input not executing
has comment: http://stackoverflow.com/comment/37229957
has comment: http://stackoverflow.com/comment/37229917
has body: Edit: the problem turned out to be caused by my closing System.in in a previous part of the program, thereby making it unusable later on. I'm trying to create a loop for user input but it's not functional... Here's what I've got: Scanner userkey = new Scanner(System.in); System.out.println("Enter commands"); while(userkey.hasNext()){ if (userkey.next().equals("exit")){ System.out.println("EXIT!!!!"); break; } System.out.println("In while loop test"); } I guess userkey.hasNext() is return false for some reason...
score: 0
has comment: http://stackoverflow.com/comment/37229761
answer count: 2
has comment: http://stackoverflow.com/comment/37230075
has comment: http://stackoverflow.com/comment/37229752
tagged with: java
has comment: http://stackoverflow.com/comment/37230302
has comment: http://stackoverflow.com/comment/37230017
upvote count: 1
tagged with: loops
has comment: http://stackoverflow.com/comment/37230079
has comment: http://stackoverflow.com/comment/37229897
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37230009
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/37229809
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21710168
has answer: http://stackoverflow.com/a/24129663
has comment: http://stackoverflow.com/comment/37230064
has comment: http://stackoverflow.com/comment/37229940

printers
tag name: printers
tags question: http://stackoverflow.com/q/24242555
tags question: http://stackoverflow.com/q/24123949
type: Tag

http://stackoverflow.com/a/24247703
downvote count: 0
has comment: http://stackoverflow.com/comment/37456553
has comment: http://stackoverflow.com/comment/37457914
upvote count: 8
score: 8
has comment: http://stackoverflow.com/comment/37456659
has comment: http://stackoverflow.com/comment/37453162
type: Answer
answers question: http://stackoverflow.com/q/24247461
has body: One use case that comes to mind.. Imagine you've got a class as follows.. public abstract class Animal { // Some stuff. } Then you say, okay, now I want a Giraffe class. Giraffe is specific, so there's no need to make it abstract.. public class Giraffe { // Some stuff that overrides or uses the Animal behaviour. } Now give it some time, when you've got six or seven applications that use your code. Then, one day when you're bored, you decide to look up Giraffes on Wikipedia, and you find out that in fact, Giraffe is extremely vague! There's spotted Giraffes, Stripy Giraffes, Long legged Giraffes.. and all of these appear in different countries! So what do you do? You could change Giraffe into an abstract class and extend it in a sub class.. but you've already got a lot of applications using your code. Do you instantly render them obsolete and force a mass update? You can create further classes that describe more specific forms of Giraffe, but.. StripyGiraffe isn't specific enough.. unless you can make that class abstract.. So what do you do? You take the latter option.. public abstract class StripyGiraffe extends Giraffe And you can continue to extend it.. public class AfricanStripyGiraffe extends StripyGiraffe That way, the old code works without a hitch, and you're still more than welcome to extend your object hierarchy as much as possible. You can maintain the integrity of your objects by declaring them as abstract when they're not specific enough to be instanciated, and using this method allows the user to still state. Giraffe geoffrey = new AfricanStripyGiraffe();

http://stackoverflow.com/comment/37266232
has text: It would help if you added the full stack trace to your question.
comment on: http://stackoverflow.com/q/24148715
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37379465
comment on: http://stackoverflow.com/a/24182321
has text: Morphia is the exact use-case that is causing problems. Unfortunately, merge() only handles top-level attributes, so anything deeper in the object gets silently removed if you try to save an object that is defined as a class that doesn't have those attributes. So, if I load and save an object in morphia, I risk losing fields that the Java code doesn't know about.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37338945
has text: If you set the max heap size to 1gb, you'll still get the error since you have 1gb. Set it to 2gb.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24188066
score: 0

http://stackoverflow.com/q/24236472
has body: I'm new using these tools so you'll probably find this very stupid. I'm getting this error, when trying to access my webapp (where I'm supposed to show every user in my database "User" table. HTTP ERROR 500 Problem accessing /maven-archetype-webapp/index. Reason: Neither BindingResult nor plain target object for bean name 'contact' available as request attribute Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'contact' available as request attribute at org.springframework.web.servlet.support.BindStatus.&lt;init&gt;(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188) at org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:130) at org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:120) at org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:90) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80) at org.apache.jsp.WEB_002dINF.jsp.usuario_jsp._jspx_meth_form_label_0(org.apache.jsp.WEB_002dINF.jsp.usuario_jsp:299) at org.apache.jsp.WEB_002dINF.jsp.usuario_jsp._jspx_meth_form_form_1(org.apache.jsp.WEB_002dINF.jsp.usuario_jsp:222) at org.apache.jsp.WEB_002dINF.jsp.usuario_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.usuario_jsp:106) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486) at org.apache.jasper.servle…
answer count: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37431925
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37433165
tagged with: spring
has title: Spring MVC + Hibernate + JSP
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/37434725
score: 2
has answer: http://stackoverflow.com/a/24236498
has comment: http://stackoverflow.com/comment/37431847
has answer: http://stackoverflow.com/a/24238229
has comment: http://stackoverflow.com/comment/37431968
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37434963
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/37428079
type: AnswerComment
has text: @AnubianNoob Still slow with `(int)`? Hmm. Works equally fast for me. Would you mind sharing the whole test?
comment on: http://stackoverflow.com/a/24233982
score: 0
type: Comment

http://stackoverflow.com/a/24107968
has comment: http://stackoverflow.com/comment/37189387
has comment: http://stackoverflow.com/comment/37189433
has comment: http://stackoverflow.com/comment/37189680
has comment: http://stackoverflow.com/comment/37189171
upvote count: 1
has comment: http://stackoverflow.com/comment/37189649
score: 1
has comment: http://stackoverflow.com/comment/37189837
has body: You have call it from inside the The Event Dispatch Thread. Try with SwingUtilities.invokeLater() or EventQueue.invokeLater() Sample code: SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent ae) { System.out.println("Hello"); } }; Timer timer = new Timer(1000, actionListener); timer.start(); timer.setRepeats(false); } });
answers question: http://stackoverflow.com/q/24107690
has comment: http://stackoverflow.com/comment/37189158
downvote count: 0
type: Answer

http://stackoverflow.com/comment/98327953
score: 0
type: Comment
type: QuestionComment
has text: I think the problem is nicely commented here https://stackoverflow.com/questions/3113885/difference-between-one-to-many-many-to-one-and-many-to-many \@OneToMany means, that you can assign multiple addresses to your contact, but the same address can not be assigned to more contacts. Therefore the unique constraint across the address_id and not address_id + contact_id. That is why \@ManyToMany works.
comment on: http://stackoverflow.com/q/24196239

http://stackoverflow.com/a/24225133
has comment: http://stackoverflow.com/comment/37426784
accepted answer of: http://stackoverflow.com/q/24224828
score: 2
has comment: http://stackoverflow.com/comment/37414587
has comment: http://stackoverflow.com/comment/37414627
upvote count: 2
has body: Try this for easy parsing using jsoup: // To parse the html page Document doc = Jsoup.connect("http://www.website.com").get(); Document doc1 = Jsoup.parse(" First parse " + " Parsed HTML into a doc. "); String content = doc.body().text(); // To get specific elements such as links Element links = doc.select("a[href]"); for(Element e: links){ System.out.println("link: " + e.attr("abs:href")); } To learn more, visit Jsoup Docs
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37414489
has comment: http://stackoverflow.com/comment/37427046
answers question: http://stackoverflow.com/q/24224828
has comment: http://stackoverflow.com/comment/37414939
type: Answer
has comment: http://stackoverflow.com/comment/37418976
has comment: http://stackoverflow.com/comment/37414432

http://stackoverflow.com/comment/37434158
score: 0
has text: what are reasons this errors occurs I mean what should I look for while checking res folder?
comment on: http://stackoverflow.com/a/24237720
type: Comment
type: AnswerComment

http://stackoverflow.com/a/29562155
upvote count: 5
downvote count: 0
type: Answer
has body: If the table of column type has TIMESTAMP try like this: select cast(CREATED_TIMESTAMP as date) CREATED_TIMESTAMP from dept; Use for all column type TIMESTAMP
score: 5
answers question: http://stackoverflow.com/q/24211080

http://stackoverflow.com/a/24150669
has comment: http://stackoverflow.com/comment/37306265
has comment: http://stackoverflow.com/comment/37305287
has comment: http://stackoverflow.com/comment/37304953
has comment: http://stackoverflow.com/comment/37305592
has comment: http://stackoverflow.com/comment/37269964
has body: Using the approach outlined here, I continue to deploy open-source Swing applications from a trusted site using a self signed certificate. Checking the SHA1 fingerprint ensures that I receive the JAR I signed, without relaxing security. This Subway simulation is a complete example.
answers question: http://stackoverflow.com/q/24148861
downvote count: 0
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37300306
type: Answer
has comment: http://stackoverflow.com/comment/37274177

http://stackoverflow.com/q/24214362
tagged with: camera
tagged with: android
tagged with: java
has title: How to effectively re-start the preview having taken a photo inside an Android app?
type: Question
accepted answer: http://stackoverflow.com/a/24218281
has body: I am attempting to code a tool that takes pictures at a dedicated interval (like a timelapse) and am having difficulty getting the camera to reset following the first capture so that it can then start on the next photo. Here is a sample of the code used: // gets called with the oncreate method and loads a preview fine public void startUpPreview(){ mCamera = getCameraInstance(); mPreview = new CameraPreview(this, mCamera); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(mPreview); } // gets called from a later loop public void getPicture() { mCamera.takePicture(null, null, mPicture); releaseCamera(); startUpPreview(); } With the code above, it throws the error: java.lang.RuntimeException: Method called after release() I am using the release code taken directly from the SDK guide which works otherwise: private void releaseCamera(){ if (mCamera != null){ mCamera.release(); mCamera = null; } } For a single picture adding a delay with a sleeping thread makes it work: try { Thread.sleep(1000); releaseCamera(); startUpPreview(); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } But this code does not work within a loop when attempting to take more than one picture. I assume that the loop is completing before all of that photo taking can catch up. Thanks in advance for any help that any one can provide.
has answer: http://stackoverflow.com/a/24218281
answer count: 1
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/37499942
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24263591
score: 1
has text: So you're saying that `Pair<String,List<? extends TestType>>` can't be assigned to a variable of type `Pair<String,List<? extends TestType>>`? I find nested generic types confusing sometimes, but even this seems rather odd...

http://stackoverflow.com/comment/37279141
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24156062
score: 0
has text: Either regexp or two indexOfs (sorry no regexp, you need to find the index)

http://stackoverflow.com/q/24177927
tagged with: java
has comment: http://stackoverflow.com/comment/37320144
accepted answer: http://stackoverflow.com/a/24178582
has comment: http://stackoverflow.com/comment/37320717
linked to: http://stackoverflow.com/q/19159590
has answer: http://stackoverflow.com/a/24178582
has answer: http://stackoverflow.com/a/24178664
tagged with: servlets
has title: getRequestURI issue in getting the request from the user
has body: I have set my url pattern in my servlet as "/register/*". I have also researched about getting only the pattern starting from the "/register" from the getReuestURI()). I have used request.getRequestURI().substring(request.getContextPath().length()) to get "/register/family" but it seems that it also returns the script source included in my header.jsp. Header.jsp Health Center GlassFish Server 4 stacktrace: INFO: /register/family INFO: /register/js/script.js INFO: /register/css/style.css INFO: /register/js/cufon-yui.js INFO: /register/js/jquery-1.3.2.min.js INFO: /register/js/arial.js INFO: /register/js/cuf_run.js INFO: /register/images/search.gif How can I fix this so that I can only get the "/register/family" only? Any help would be appreciated. Thanks! EDITED: 1 I used system.out.println to test what request value am I getting. I have also noticed that even if i use request.getServletPath() it outputs multiple: INFO: /register INFO: /register INFO: /register INFO: /register INFO: /register INFO: /register INFO: /register INFO: /register I also noticed that my css layout would not be used as it is redirected to another page. EDITED 2: I wanted to get "/register/family" from the requestURI because this will handle the request and determine the next page. Here is my code flow protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userPath = request.getRequestURI().substring(request.getContextPath().length()); if (userPath.equals("/register/family")) { // perform code registration userPath = "/familyRegistration"; // this is the .jsp page } else if (userPath.equals("/register/patient")) { // perform patient registration userPath = "/patientRegistration"; // this is . the .jsp page } // use RequestDispatcher to forward request internally String url = "/WEB-INF/view" + userPath + ".jsp"; try { request.getRequestDispatcher(url).forward(request, response); } catch (Exception ex) { ex.printStackTrace(); …
answer count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37321128
score: 0
possible better answer: http://stackoverflow.com/a/24178664
has comment: http://stackoverflow.com/comment/37320362
has comment: http://stackoverflow.com/comment/37320207
has comment: http://stackoverflow.com/comment/37321139
type: Question

http://stackoverflow.com/comment/37204375
has text: All primitives are auto(un)boxed to/from their wrapper classes. `int <-> Integer` is not a special case.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24115074
type: AnswerComment

http://stackoverflow.com/comment/37277581
comment on: http://stackoverflow.com/a/24155057
score: 0
type: AnswerComment
has text: why use map to hold just one int value?
type: Comment

http://stackoverflow.com/a/24116471
has comment: http://stackoverflow.com/comment/37205302
answers question: http://stackoverflow.com/q/24116355
upvote count: 9
type: Answer
accepted answer of: http://stackoverflow.com/q/24116355
has body: One of your DataSources has to be @Primary (see docs).
has comment: http://stackoverflow.com/comment/59693754
score: 9
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24194462
score: 0
tagged with: java
tagged with: jzy3d
has comment: http://stackoverflow.com/comment/37365048
tagged with: applet
has title: Embedding jzy3d in applet
type: Question
has comment: http://stackoverflow.com/comment/37365083
has answer: http://stackoverflow.com/a/25665000
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40106422
answer count: 1
tagged with: awt
has body: I am trying to create an applet that creates a graph, but the applet opens another window. I don't know what changes should be done in code in order to make it work. I understand that the reason for it is ChartLauncher. import java.applet.Applet; import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; import javax.media.opengl.GLAnimatorControl; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; import org.jzy3d.chart.Chart; import org.jzy3d.chart.ChartLauncher; import org.jzy3d.colors.Color; import org.jzy3d.maths.Coord3d; import org.jzy3d.plot3d.primitives.Point; import org.jzy3d.plot3d.primitives.Polygon; import org.jzy3d.plot3d.primitives.Shape; import com.jogamp.opengl.util.FPSAnimator; public class AppletPolygons extends Applet{ private GLAnimatorControl glanimatorcontrol; public void init() { GLProfile.initSingleton(); setLayout( new BorderLayout() ); final GLCanvas glcanvas = new GLCanvas(); glcanvas.addGLEventListener( new GLEventListener() { @Override public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) { } @Override public void init( GLAutoDrawable glautodrawable ) { // Build a polygon list double [][]distDataProp = new double[][] {{5,10, .20},{10, 20, .45}, {30, 40,.7}}; List&lt;Polygon&gt; polygons = new ArrayList&lt;Polygon&gt;(); for(int i = 0; i &lt; distDataProp.length -1; i++){ for(int j = 0; j &lt; distDataProp[i].length -1; j++){ Polygon polygon = new Polygon(); polygon.add(new Point( new Coord3d(i, j, distDataProp[i][j]) )); polygon.add(new Point( new Coord3d(i, j+1, distDataProp[i][j+1]) )); polygon.add(new Point( new Coord3d(i+1, j+1, distDataProp[i+1][j+1]) )); polygon.add(new Point( new Coord3d(i+1, j, distDataProp[i+1][j]) )); if ((j % 2) == 0) polygon.setColor(Color.RED); else polygon.setColor(Color.GREEN); polygons.add(polygon); } } Point p = new Point(); Coord3d n = new Coord3…

http://stackoverflow.com/comment/37247278
has text: This question appears to be off-topic because it is possibly about violating software licensing terms and not about creating software.
comment on: http://stackoverflow.com/q/24138508
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24169300
answer count: 2
tagged with: spring-integration
tagged with: java
has body: I have a functional Spring Integration context configuration file. I want to add jdbc functionality. When I import the XML namespaces I end up getting an error that seems to be coming from the framework. The configuration below works properly. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-file="http://www.springframework.org/schema/integration/file" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt; This configuration will cause an exception (even though I referenced the contents right from the examples Github project) &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-file="http://www.springframework.org/schema/integration/file" xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd http://www.springframework.…
has answer: http://stackoverflow.com/a/24169948
type: Question
type: UnansweredQuestion
has title: "spring-integration-2.0.xsd" error when specifying supporting XSDs for int-jdbc
tagged with: spring
tagged with: xsd
tagged with: spring-jdbc
has answer: http://stackoverflow.com/a/24170358
score: 0

http://stackoverflow.com/comment/37444795
has text: its not writing new line
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24243348
score: 0

http://stackoverflow.com/comment/37469408
type: QuestionComment
score: 0
has text: Swing is NOT thread safe, this means you should never update or modify the UI in anyway other then from the context of the event dispatching thread. See [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) for more details. For animation in Swing, consider using a [`javax.swing.Timer`](http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html). You may also want to have a read through [Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/)
type: Comment
comment on: http://stackoverflow.com/q/24255929

http://stackoverflow.com/a/24281088
score: 0
has body: So the problem seems to be the code asks for "string,string,string,integer,integer", but the provided data comes as "string, string,integer,string,integer" - hence BigQuery can't transform the string in column 4 to an integer. To get the exact error message run bq show -j job_yourjobid.
answers question: http://stackoverflow.com/q/24259394
type: Answer

http://stackoverflow.com/comment/37448236
type: AnswerComment
has text: I've rebuilt two engines, so I'd hazard a guess I'd get pretty far along in the process before needing to call in an expert. "Cars make life simpler" -- that's funny, because in many areas, and for many reasons, they actually complicate life immensely, e.g., NYC. Do you start off driving a car on the highway, or do you take baby steps and understand the fundamentals of driving, and the rules of the road first? The latter: what makes driving a car possible, and the rules around said activity, are learned first.
comment on: http://stackoverflow.com/a/24242917
score: 0
type: Comment

http://stackoverflow.com/a/24239341
answers question: http://stackoverflow.com/q/24238789
downvote count: 0
upvote count: 1
score: 1
has body: Have a custom Comparator (http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html) that can compare two segments, two camps or a mix of the two by comparing the dates then Collections.sort(segmentAndCampList, new SegmentAndCampComparator())
type: Answer

http://stackoverflow.com/comment/37200979
score: 0
has text: you are bypassing everything, it sounds like a patch
type: Comment
comment on: http://stackoverflow.com/q/24110214
type: QuestionComment

http://stackoverflow.com/q/24167216
has body: So I currently have a big blob of html text, and I want to generate an input form based on what is contained in that text. For example, if the text contains '[%Name%]', I want to be able to read that in and recognize 'Name' is there, and so in turn enable a form field for name. There will be multiple tags ([%age%], [%height%], etc.) I was thinking about using Regex, but after doing some research it seems that Regex is a horrible idea to parse html with. I came across parsing html pages with groovy, but it is not strictly applicable to my implementation. I am storing the html formatted text (which I am creating using ckeditor) in a database. Is there a efficient way to do this in java/groovy? Or should I just create an algorithm similar to examples shown here (I'm not too sure how effective the given algorithms would be, as they seem to be constructed around relatively small strings, whereas my string to parse through may end up being quite large (a 15-20 page document)). Thanks in advance
upvote count: 0
linked to: http://stackoverflow.com/q/600733
answer count: 1
has comment: http://stackoverflow.com/comment/37300092
has title: Parsing html text to obtain input fields
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24170263
has comment: http://stackoverflow.com/comment/37299966
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24170263
tagged with: java
score: -1
type: Question
tagged with: groovy

http://stackoverflow.com/a/24113926
answers question: http://stackoverflow.com/q/24113895
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37200611
score: 2
has comment: http://stackoverflow.com/comment/37200849
has comment: http://stackoverflow.com/comment/37200495
type: Answer
accepted answer of: http://stackoverflow.com/q/24113895
has body: Json Object is just like a Map, you can iterate it like this: JSONObject parse = JSON.parseObject(""); for (Map.Entry&lt;String, Object&gt; entry : parse.entrySet()) { System.out.println(entry.getKey() + "=" + entry.getValue()); } fastjson is available here:https://github.com/alibaba/fastjson

http://stackoverflow.com/comment/37491793
has text: I can't map Agent ids to the CustomerOrder ids because any time it diferent. Also i can,t change agent uuid to String because use third party xsd.
score: 0
comment on: http://stackoverflow.com/q/24257815
type: Comment
type: QuestionComment

ondraw
type: Tag
tags question: http://stackoverflow.com/q/24253321
tag name: ondraw

http://stackoverflow.com/comment/37402586
score: 0
has text: Try setting break-points on every OpenGL call, so that we have to find the call which causes crash.
comment on: http://stackoverflow.com/q/24220363
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37344591
comment on: http://stackoverflow.com/a/24189584
type: Comment
type: AnswerComment
has text: Scala's standard collections also suffer from boxing. But there are alternatives for Scala: https://github.com/non/debox
score: 0

http://stackoverflow.com/a/24175893
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24175752
downvote count: 0
upvote count: 1
has body: Android requires long operations like database query or network operations to be done in a separate thread. For this use AsyncTask because it provides painless threading because it synchronizes your Ui and background thread. So do your network operation inside doInBackground function of AsyncTask. private class LongOperation extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { postData(); return null; } @Override protected void onPostExecute(String result) { // runs in ui thread so update views here } @Override protected void onPreExecute() { //runs in ui thread start progress dialog here } }

http://stackoverflow.com/comment/37354016
comment on: http://stackoverflow.com/a/24187596
score: 0
type: Comment
type: AnswerComment
has text: @filcab : **"replace the whole program with anything"** what are you talking about. I have run this program on Visual studio 2012 and it runs perfectly fine for both `signed and unsigned` integers without any **undefined behavior**

http://stackoverflow.com/a/24123722
answers question: http://stackoverflow.com/q/24123621
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24123621
type: Answer
has body: You have an outer class called Foo, which has a private field called buzz. Within Foo, you are creating an anonymous inner class, which is implementation of SelectionListener. This anonymous inner class is non-static inner class (by default) of Foo. As per the java rules, a non static inner class has access to all the fields (including private fields) of enclosing class. Here's the JLS guidelines stating the same.
score: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37426844
comment on: http://stackoverflow.com/a/24228237
type: AnswerComment
score: 0
has text: Never said I did, complete beginner trying to get help online (:
type: Comment

http://stackoverflow.com/q/24130664
tagged with: regex
possible better answer: http://stackoverflow.com/a/24130736
has comment: http://stackoverflow.com/comment/37232344
has title: Validation of hypens through regex
has answer: http://stackoverflow.com/a/24130736
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37232313
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37238130
upvote count: 1
score: 1
tagged with: java
has body: I am trying to do a validator for a name. The name can consist of alphabetical letter (big and small caps), space, and no more than 2 optional hyphens (but not consecutively). For example, this is correct: alksjdasdlfj alsjdf ajsdfl lkj-asdfj alsdjflj lksaldf asldjf-jasfd-alsdjf This is incorrect: asjdfkl-ajsdf-asdjf-alsdjf (3 hyphens) lasdjf--asdjfj (consecutive hyphens) This is what I came up with: (^[a-zA-Z]([a-zA-Z ]+\-?)*[a-zA-Z]$)|(^[a-zA-Z]*$) But this regex does not limit the number of hyphens to just two occurrences. Thanks in advance for any suggestions.
has comment: http://stackoverflow.com/comment/37232049
has answer: http://stackoverflow.com/a/24130941
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24130905
accepted answer: http://stackoverflow.com/a/24130905

http://stackoverflow.com/q/24213029
tagged with: websphere
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24225694
downvote count: 0
type: UnansweredQuestion
tagged with: web-services
answer count: 1
score: 2
tagged with: java
has body: I am trying to create a Web Service with Eclipse to host on WebSphere 8.0. package peter.td.com; import javax.jws.*; @WebService public class First01 { @WebMethod public int Addition(int a, int b, int c) { return a+b+c; } } I did export(.ear) and took the EAR file and deployed it at WAS 8.0. when I do http://localhost:9080/WebService01: its giving me an page not found error. I looked all around and I couldn't find any good example to create Web Service to host on WebSphere. I am using Eclipse IDE. Please share or show me any tutorial link that I can create WebService for WAS 8.0 with Eclipse IDE.
tagged with: eclipse
has title: Web Service with Eclipse for WebSphere 8.0
favorite count: 0

http://stackoverflow.com/comment/37239560
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24134849
has text: http://stackoverflow.com/a/24113942/1553851 - Read the edit.
type: Comment

relative-path
type: Tag
tag name: relative-path
tags question: http://stackoverflow.com/q/24200417
tags question: http://stackoverflow.com/q/24262882

http://stackoverflow.com/comment/37291505
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24162733
has text: Well animations should run on UI only. Still, you said you are performing network related stuff. This doesn't necessarily mean downloading but as far as network is concerned, it should run in the background and then only publish the results to UI.
type: Comment

http://stackoverflow.com/a/24239824
has comment: http://stackoverflow.com/comment/37437949
has body: try this... public class MainActivity extends Activity { // changed extended activity TextView disp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main);//changed layout name disp=(TextView)findViewById(R.id.textView1); disp.setText("0"); } } and remove all other protected methods there..you are not using anyone of this..
score: 0
accepted answer of: http://stackoverflow.com/q/24239473
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37438257
has comment: http://stackoverflow.com/comment/37437902
answers question: http://stackoverflow.com/q/24239473
has comment: http://stackoverflow.com/comment/37438420
type: Answer

http://stackoverflow.com/comment/37302102
type: Comment
has text: IMO, you're trying to reduce simple, trivial code. Sure you could use reflection magic like Dozer or BeanUtils, but you would lose readability and the ability to refactor the code safely. Renaming a property of one of the objects would cause a silent bug at runtime rather than a compilation error.
type: QuestionComment
comment on: http://stackoverflow.com/q/24167996
score: 0

http://stackoverflow.com/comment/37231303
score: 0
comment on: http://stackoverflow.com/a/24130161
type: Comment
has text: I was thinking to use init() servlet method to get country list when the servlet is loaded and doPost() method when the form is submitted. Do you think it could work?
type: AnswerComment

http://stackoverflow.com/a/24129326
downvote count: 0
has comment: http://stackoverflow.com/comment/37233600
score: 3
accepted answer of: http://stackoverflow.com/q/24116398
type: Answer
answers question: http://stackoverflow.com/q/24116398
has body: Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserFactory You need to have XPP3 in your classpath. Besides, adding XMPPConnection under line ""Cannot instantiate XMPPConnection"" Use XMPPTCPConnection instead of XMPPConnection in Smack 4.
has comment: http://stackoverflow.com/comment/37243133
upvote count: 3
type: AcceptedAnswer

geronimo
tags question: http://stackoverflow.com/q/24159101
type: Tag
tags question: http://stackoverflow.com/q/24162088
tag name: geronimo

http://stackoverflow.com/q/24119122
tagged with: interface
has comment: http://stackoverflow.com/comment/37231710
has answer: http://stackoverflow.com/a/24119209
has title: How can I implement a class which extends an interface which accepts arguments of itself?
has comment: http://stackoverflow.com/comment/37227332
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24119209
tagged with: java
answer count: 1
tagged with: generics
type: Question
has body: I'm using the Idiom from this Discussion How can I make an interface instance method accept arguments of the same class only, really?: interface ITree&lt;SELF extends ITree&lt;SELF&gt;&gt;{ SELF getNode(int index); void setNode(int index, SELF node); } My question is, how can I implement the Tree which extends ITree in a right why? My current code looks like this: public class B { private ITree tree; public B (ITree tree){ this.tree = tree; } } As expected it throws warnings that I should add a Type. I want to let the class which uses B decide which Type it should use. Or better I don't want to use generics at all for such a minor Problem. Edit: I found the solution after evaluating the answers. The devils detail was in this line: &lt;T extends ITree&lt;T&gt;&gt; Here is the full source code: public class B&lt;T extends ITree&lt;T&gt;&gt; { private T tree; public B (T tree){ this.tree = tree; } }
has comment: http://stackoverflow.com/comment/37229297
linked to: http://stackoverflow.com/q/18553621

http://stackoverflow.com/a/24117107
type: Answer
score: 4
upvote count: 4
has body: if ((i+1) % 10 == 0) { System.out.printf("\n"); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24117008
accepted answer of: http://stackoverflow.com/q/24117008

http://stackoverflow.com/a/24252467
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24252419
downvote count: 0
has body: The Calendar class has a method getTimeInMillis that returns the unix epoc time value for the given calendar. That said, I don't fully understand what you're doing...
type: Answer

http://stackoverflow.com/a/24137894
type: Answer
has comment: http://stackoverflow.com/comment/37247325
score: 0
has body: Not clear whats the objective is. Two cases are possible here - 1.Assuming you have url in 'webdriver.url' variable. You can write it to second property file ('ExpectedResults.properties') as Properties prop = new Properties(); OutputStream output = null; try { output = new FileOutputStream("ExpectedResults.properties"); prop.setProperty("expected.url", webdriver.url); prop.store(output, null); } catch (IOException io) { io.printStackTrace(); } 2 You can read both property files &amp; compare URLs - Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream("filename.properties"); prop.load(input); System.out.println(prop.getProperty("webdriver.url")); } catch (IOException ex) { ex.printStackTrace(); }
has comment: http://stackoverflow.com/comment/37247624
answers question: http://stackoverflow.com/q/24137375

http://stackoverflow.com/q/24225871
downvote count: 5
tagged with: regex
has comment: http://stackoverflow.com/comment/37411253
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37411663
answer count: 2
has answer: http://stackoverflow.com/a/24226223
upvote count: 0
tagged with: java
score: -5
tagged with: paragraph
has comment: http://stackoverflow.com/comment/37411308
has body: I need a regex to extract a each paragraph and store as a string for additional processing from the text buffer containing many such similar paragraphs. Example: Say, the text buffer is like this: === Jun 11 14:05:39 - Person Details === Person Name = "Hurlman" Person Address = "2nd Street Benjamin Blvd NJ" Persion Age = 25 === Jun 11 14:05:39 - Person Details === Person Name = "Greg" Person Address = "3rd Street Benjamin Blvd NJ" Persion Age = 26 === Jun 11 14:05:42 - Person Details === Person Name = "Michel" Person Address = "4th Street Benjamin Blvd NJ" Persion Age = 27 And I need to iterate through all the paragraphs and store each one of them to further find the specific person details inside. Each paragraph I need to extract should be of the below format === Jun 11 14:05:42 - Person Details === Person Name = "Michel" Person Address = "4th Street Benjamin Blvd NJ" Persion Age = 27 Any help is much appreciated!
possible better answer: http://stackoverflow.com/a/24226135
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24226223
has answer: http://stackoverflow.com/a/24226135
has title: Regex to extract a paragraph
has comment: http://stackoverflow.com/comment/37411274

http://stackoverflow.com/comment/37310796
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24172663
type: Comment
has text: I doesn't matter means that both the operation will have same complexity? Which is O(n) or O(1)?

http://stackoverflow.com/a/24178053
answers question: http://stackoverflow.com/q/24177994
score: 0
type: Answer
has body: Change this String msgStr = String(byteArr); to String msgStr = new String(byteArr); This post may help you How To Convert Byte[] Array To String In Java

http://stackoverflow.com/a/24192881
has comment: http://stackoverflow.com/comment/37349499
has comment: http://stackoverflow.com/comment/37348704
has comment: http://stackoverflow.com/comment/37348851
answers question: http://stackoverflow.com/q/24192674
type: Answer
has comment: http://stackoverflow.com/comment/37348648
has body: If order of items in array of dates corresponds to order of items in array of prices, you need this: for (Car c : carOL) { d = c.getDate(); // returns array list with dates from OL p = c.getPrice(); // returns array list with prices from OL for (String dates : d.getDate()) { series.getData().add(new XYChart.Data&lt;&gt;(dates, p.get(id))); id++; } } Go through all dates and add them with appropriate prices.
has comment: http://stackoverflow.com/comment/37349561
has comment: http://stackoverflow.com/comment/37349206
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37348492
downvote count: 0

http://stackoverflow.com/a/24287473
accepted answer of: http://stackoverflow.com/q/24141607
upvote count: 2
answers question: http://stackoverflow.com/q/24141607
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: As DalmTo said in the comment above, the ID of the root folder is always "root". Additionally, the querying functionality you are looking for is in Drive.Files.list(), which has a q parameter for specifying a query.

http://stackoverflow.com/a/24252286
has comment: http://stackoverflow.com/comment/37479251
has body: First one, yes. Custom code from Sun which calls SSPI via JNI will react on NTLM on Windows only. Second, no. This is a MS resctriction. Unless you code a SSPI JGSS bridge. You maybe could swap the Authenticator for a custom one.
answers question: http://stackoverflow.com/q/24228159
score: 1
accepted answer of: http://stackoverflow.com/q/24228159
type: Answer
has comment: http://stackoverflow.com/comment/37478988
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24259800
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24259858
has body: Well i want to get the content of an Edittext, in order to set this text as label for Buttons. My problem is, that the Edittext is in another layout that I want to use it. So I have got a Class called "Collection.java" which is referred to the layout called "activity_collection.xml". In this Class I want to get the content of the Edittext. And there is an other Class called "OpenProject.java" which contain an Dialogbox, where the Edittext is. So I want to get the content from "Collection.java": private void onaddButtonClick() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( context); LayoutInflater inflater = thisActivity.getLayoutInflater(); alertDialogBuilder //zeigt den Inhalt von dialogbox.xml an .setView(inflater.inflate(R.layout.dialogbox, null)) .setCancelable(false) // OK button der Dialogbox hinzufügen .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { setContentView(R.layout.dialogbox); EditText text = (EditText) findViewById( R.id.projectname2); Log.d("text", "text " + text.getText().toString()); // TODO: Editfeld auslesen (Problem: verschiedene Layout Dateien) // newProjectButton( ) wird aufgerufen, wenn OK Button gedrückt wurde newProjectButton(dialog, id); dbHelper.addProject("Bitte Implementieren"); // TODO DO IT drawAllProjects("B"); } }) // Abbrechen Button der Dialogbox hinzufügen .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // zurückkehren zur aktuellen View dialog.cancel(); } }); // Das Dialogfeld erstellen AlertDialog alertDialog = alertDialogBuilder.create(); // das Dialogfeld anzeigen lassen alertDialog.show(); } As you can see, I tried it with: setContentView(R.layout.dialogbox); EditText text = (EditText) findViewById( R.id.projectname2); Log.d("text", "text " + text.getText().toString()); But everytime when I type something in, the content is empty. What can I do, …
tagged with: android-layout
answer count: 2
type: UnansweredQuestion
tagged with: android
downvote count: 0
has comment: http://stackoverflow.com/comment/37476192
upvote count: 1
tagged with: android-edittext
score: 1
tagged with: java
has title: How to get content of Edittext from another layout
has comment: http://stackoverflow.com/comment/37476157
has answer: http://stackoverflow.com/a/24259888

http://stackoverflow.com/comment/37332567
type: QuestionComment
has text: Are you looking for http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/view.html#view-jsp-formtaglib?
comment on: http://stackoverflow.com/q/24185032
score: 0
type: Comment

http://stackoverflow.com/comment/37408331
has text: @isi yes i am using 1.7
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24224272

http://stackoverflow.com/a/24208128
has comment: http://stackoverflow.com/comment/59577081
downvote count: 1
type: Answer
score: 2
has body: Did you read the docs to the class UserDefinedFileAttributeView? Reading carefully gives a few hints, why your code doesn't work properly. For example you can check that: ... This FileAttributeView is not intended for use where the size of an attribute value is larger than Integer.MAX_VALUE ... or check, if you have a security manager installed: ... in the case of the default provider at least, all methods that access user-defined attributes require the RuntimePermission("accessUserDefinedAttributes") permission when a security manager is installed. ... Or try out another method to get an attribute: ... Where dynamic access to file attributes is required, the getAttribute method may be used to read the attribute value. The attribute value is returned as a byte array (byte[]). ... Maybe any of the hints helps you, good luck! :-) EDIT Here's an example code, which checks, if your file system provides user defined file attributes and prints them (on succes): Path file = Paths.get("filename.ext"); // check that user defined attributes are supported by the file system FileStore store = file.getFileStore(); if (!store.supportsFileAttributeView("xattr")) { System.err.format("UserDefinedFileAttributeView not supported on %s\n", store); System.exit(-1); } UserDefinedFileAttributeView view = file.getFileAttributeView(UserDefinedFileAttributeView.class); // list user defined attributes if (args.length == 1) { System.out.println(" Size Name"); System.out.println("-------- --------------------------------------"); for (String name: view.list()) { System.out.format("%8d %s\n", view.size(name), name); } } Full source code here linked from this page your question code is from ;-)
upvote count: 3
answers question: http://stackoverflow.com/q/24207427

extjs
tags question: http://stackoverflow.com/q/24177522
tag name: extjs
type: Tag

http://stackoverflow.com/comment/37288553
type: Comment
has text: i renamed the function to "showmetext" but still no sucess
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24161313

http://stackoverflow.com/q/24168154
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/24245748
tagged with: java
tagged with: gson
answer count: 1
downvote count: 0
tagged with: deserialization
has title: Why does Gson Preconditions fail in this instance?
has answer: http://stackoverflow.com/a/24245748
tagged with: ormlite
favorite count: 0
type: Question
tagged with: android
has body: I am writing a deserializer for the class ForeignCollection, which is abstract, and provided to me in the ORMLite Android Library. See my code below. public class ForeignCollectionDeserializer implements JsonDeserializer&lt;ForeignCollectionDeserializer&gt; { @Override public ForeignCollection deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { ... } } I have also tried implementing JsonDeserializer&lt;?&gt; and JsonDeserialzer (with no generic type) I'm using GsonBuilder.registerTypeAdapter to register the deserializer. GsonBuilder gb = new GsonBuilder(); gb.registerTypeAdapter(ForeignCollection.class, new ForeignCollectionDeserializer()); Gson gson = gb.create(); However, registerTypeAdapter() is throwing this: 06-11 11:27:27.937: E/AndroidRuntime(15197): FATAL EXCEPTION: main 06-11 11:27:27.937: E/AndroidRuntime(15197): Process: com.myapp, PID: 15197 06-11 11:27:27.937: E/AndroidRuntime(15197): java.lang.IllegalArgumentException 06-11 11:27:27.937: E/AndroidRuntime(15197): at com.google.gson.internal.$Gson$Preconditions.checkArgument($Gson$Preconditions.java:42) 06-11 11:27:27.937: E/AndroidRuntime(15197): at com.google.gson.GsonBuilder.registerTypeAdapter(GsonBuilder.java:448) I am stepping through the code and I get to the offending piece, from GsonBuilder below. public GsonBuilder registerTypeAdapter(Type type, Object typeAdapter) { $Gson$Preconditions.checkArgument(typeAdapter instanceof JsonSerializer&lt;?&gt; || typeAdapter instanceof JsonDeserializer&lt;?&gt; || typeAdapter instanceof InstanceCreator&lt;?&gt; || typeAdapter instanceof TypeAdapter&lt;?&gt;); if (typeAdapter instanceof InstanceCreator&lt;?&gt;) { instanceCreators.put(type, (InstanceCreator) typeAdapter); } I evaluated typeAdapter instanceof JsonDeserializer&lt;?&gt; in debug mode and found that it is actually false Actually I've evaluated all of these: typeAdapter instanceof JsonDeserializer typeAdapter instanceof…
type: AnsweredQuestion

http://stackoverflow.com/comment/37433355
has text: multiplication and its running but it is printing zeros
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24237283
score: 0

jbox2d
tag name: jbox2d
type: Tag
tags question: http://stackoverflow.com/q/24207567

http://stackoverflow.com/a/24129537
downvote count: 0
has comment: http://stackoverflow.com/comment/37265678
type: Answer
score: 2
has body: You can route your requests as JMS messages over the components of your system. That way you can delegate the task of message persistence and delivery guarantee to JMS implementation (eg. Active MQ). If a component crashes, the message will be redelivered to it. Following section is added per OP's comment. UPDATE: The request can be resent, but the resource R which is in intermediate state 'Creating' which may have been created in real world, this is somehow like in a distributed system, a component crash causes whole system states inconsistent. what's some practice to design a system that can resync system after failure? This is highly dependent on the nature of the system in question and its components, here is one way to accomplish failure-resistant systems. 1) Messages between components should not be lost and their delivery should be guaranteed. This can be accomplished via a dedicated message queue. 2) Each operation should be idempotent, can be invoked more than once without any additional side effects. That way if an error occurs during the message processing, message queue will send the message again and the component will handle the message, eg. check its completion status against its local state and perform only necessary steps to complete the operation, skipping the already completed ones. For a more complete answer and system design guides please take a look at WS-BPEL
answers question: http://stackoverflow.com/q/24129457
upvote count: 2

http://stackoverflow.com/a/24179200
accepted answer of: http://stackoverflow.com/q/24179163
has body: The JSON you've got is for an array, not an object. You probably want JSONArray array = new JSONArray(jsonString); Full sample code: import org.json.*; public class Test { public static void main(String[] args) { String json = "[[\"1\",\"100\"],[\"2\",\"200\"],[\"3\",\"300\"]]"; JSONArray array = new JSONArray(json); JSONArray first = array.getJSONArray(0); System.out.println(first.getString(1)); // Prints 100 } }
answers question: http://stackoverflow.com/q/24179163
type: AcceptedAnswer
downvote count: 0
upvote count: 7
score: 7
type: Answer
has comment: http://stackoverflow.com/comment/47599451

http://stackoverflow.com/a/24125284
has comment: http://stackoverflow.com/comment/37266287
accepted answer of: http://stackoverflow.com/q/24121793
has comment: http://stackoverflow.com/comment/37233840
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24121793
upvote count: 8
score: 8
has body: Are you sure your proposed method is indeed faster than the regex-based one used by the String class - not just for your own test input, but for every possible input that a program might throw at it? It relies on String.indexOf to do substring matching, which is itself a naive implementation that is subject to bad worst-case performance. It's entirely possible that Pattern implements a more sophisticated matching algorithm such as KMP to avoid redundant comparisons. In general, the Java team takes performance of the core libraries very seriously, and maintains lots of internal benchmarks using a wide range of real-world data. I've never encountered a situation where regex processing was a bottleneck. My standing advice is to start by writing the simplest possible code that works correctly, and don't even begin to think about rewriting the Java built-ins until profiling proves that it's a bottleneck, and you've exhausted all other avenues of optimization. Regarding your latest edit - first, I would not describe the split method as heavily optimized. It handles one special case that happens to be extremely common and is guaranteed not to suffer from the poor worst-case complexity described above for the naive string matching algorithm - that of splitting on a single-character, literal token. It may very well be that the same special case could be optimized for replace, and would provide some measurable improvement. But look what it took to achieve that simple optimization - about 50 lines of code. Those lines of code come at a cost, especially when they're a part of what's probably the most widely-used class in the Java library. Cost comes in many forms: Resources - That's 50 lines of code that some developer must spend time writing, testing, documenting, and maintaining for the lifetime of the Java language. Risk - That's 50 opportunities for subtle bugs that slip past the initial testing. Complexity - That's 50 extra lines of code that any developer who wants to und…
type: Answer
has comment: http://stackoverflow.com/comment/37257295

http://stackoverflow.com/q/24244824
has comment: http://stackoverflow.com/comment/37533242
downvote count: 0
has comment: http://stackoverflow.com/comment/37460824
has comment: http://stackoverflow.com/comment/37526142
has comment: http://stackoverflow.com/comment/37524135
upvote count: 1
tagged with: jackson
favorite count: 0
has comment: http://stackoverflow.com/comment/37473016
score: 1
has comment: http://stackoverflow.com/comment/37555075
tagged with: java
has comment: http://stackoverflow.com/comment/37544003
has comment: http://stackoverflow.com/comment/37555597
has body: I had this code in production final Map&lt;String, String&gt; parameters = new HashMap&lt;String, String&gt;(); parameters.put(FIELDTRACES, new ObjectMapper().writer().writeValueAsString(dlcTransformer.toEntityList(vo.getFieldTraces()))); which was failing in some case (when the "vo" object was retrieved from a deserialized JMS message): the put operation was not adding anything to the map. After various tests I finished with this which seems to fix the problem : final String fieldTraces = new ObjectMapper().writer().writeValueAsString(dlcTransformer.toEntityList(vo.getFieldTraces())); parameters.put(FIELDTRACES, fieldTraces); How can a temporary variable change anything to the behavior ? The jackson mapper comes from jackson-mapper-asl-1.9.10 here is ObjectWriter.writeValueAsString() implementation public String writeValueAsString(Object value) throws IOException, JsonGenerationException, JsonMappingException { // alas, we have to pull the recycler directly here... SegmentedStringWriter sw = new SegmentedStringWriter(_jsonFactory._getBufferRecycler()); _configAndWriteValue(_jsonFactory.createJsonGenerator(sw), value); return sw.getAndClear(); } before I try to sacrifice a chicken, does someone have an idea ^^ ?
tagged with: dictionary
has comment: http://stackoverflow.com/comment/37472860
type: Question
has comment: http://stackoverflow.com/comment/37533510
has comment: http://stackoverflow.com/comment/37515491
answer count: 0
has title: jackson marshalling result put in a map - Strange behavior
has comment: http://stackoverflow.com/comment/37473700
type: UnansweredQuestion

http://stackoverflow.com/comment/37441157
has text: if u cant publish then how we will solve ur problum how we will help u?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24241281
score: 0

http://stackoverflow.com/comment/37511337
comment on: http://stackoverflow.com/a/24255768
has text: It would be very useful if you post the full stacktrace and the failing class
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37200012
score: 0
type: AnswerComment
has text: @JarrodRoberson-Firstly, I meant to say 45 minutes because I was eating while solving his problem. I was doing both work at the same-time. Secondly, my 45 minutes meant only 10+ minutes, this 45 was to make him realise how bad is it to give home-work questions! Lastly, I am a student and still in learning phase; I don't need a change in my profession--My E-mail is in accordance with "Latin characters" allowed for E-mail, not for the Greek,Chinese,etc and neither I care for them. characters-So,I hope replied fine in all aspect. Do you agree OR I am really left with some more points to go on?
comment on: http://stackoverflow.com/a/24107872
type: Comment

http://stackoverflow.com/comment/37327945
type: AnswerComment
comment on: http://stackoverflow.com/a/24177217
score: 0
type: Comment
has text: @ADTC I think what Marco is saying is that since Pascal is a *native language*, it compiles and runs faster than Java because Java is ultimately run as an *interpreted language* since the VM converts bytecode at run-time. So Java bytecode on **any** VM cannot be faster than native executables until the Java code is itself brought into executable form.

http://stackoverflow.com/q/24257449
favorite count: 0
has body: I have two classes, Foo and Bar, as follows: public class Foo { private Long fooId; private Bar bar; //Yes, this doesn't actually make any sense, //having both a list and a single object here, its an example. private List&lt;Bar&gt; bars; } public class Bar { private Long barId; private Foo foo; } How do I implement a (uni-directional/bi-directional) one-to-many, many-to-one or many-to-many relationship using annotations for Hibernate 4 for these classes? Also how do I configure my one-to-many for orphan removal, lazy loading and what causes a LazyInitialiaizationException when dealing with collections and how to solve the problem?
type: Question
has comment: http://stackoverflow.com/comment/37509763
accepted answer: http://stackoverflow.com/a/24257450
score: 18
tagged with: spring
has comment: http://stackoverflow.com/comment/37473113
has comment: http://stackoverflow.com/comment/37472284
has title: How do I use annotations to define different types of relationships in Hibernate 4 and Spring?
type: AnsweredQuestion
upvote count: 19
linked to: http://stackoverflow.com/q/2593029
has answer: http://stackoverflow.com/a/24257450
linked to: http://stackoverflow.com/q/24150199
tagged with: java
tagged with: hibernate
answer count: 1
has comment: http://stackoverflow.com/comment/37473034
downvote count: 1

http://stackoverflow.com/a/24143086
score: 1
has body: Don't use raw types! Change List data = new ArrayList(); to List&lt;String&gt; data = new ArrayList&lt;String&gt;(); and change writeToFile(java.util.List list, String path) { to writeToFile(java.util.List&lt;String&gt; list, String path) {
answers question: http://stackoverflow.com/q/24142608
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24245629
tagged with: java
answer count: 1
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37450843
has body: Can somebody help me in finding the root cause for below HUNG Thread.? Please find the stacktrace below. ThreadMonitor W WSVR0605W: Thread "WebContainer : 19" (0000004e) has been active for 765581 milliseconds and may be hung. There is/are 1 thread(s) in total in the server that may be hung. at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at com.sybase.timedio.RawDbio.reallyRead(RawDbio.java) at com.sybase.timedio.Dbio.doRead(Dbio.java) at com.sybase.timedio.InStreamMgr.readIfOwner(InStreamMgr.java) at com.sybase.timedio.InStreamMgr.doRead(InStreamMgr.java) at com.sybase.tds.TdsProtocolContext.getChunk(TdsProtocolContext.java) at com.sybase.tds.PduInputFormatter.readPacket(PduInputFormatter.java) at com.sybase.tds.PduInputFormatter.read(PduInputFormatter.java) at com.sybase.tds.TdsInputStream.read(TdsInputStream.java) at com.sybase.tds.TdsInputStream.readUnsignedByte(TdsInputStream.java) at com.sybase.tds.Tds.nextResult(Tds.java) at com.sybase.jdbc.ResultGetter.nextResult(ResultGetter.java) at com.sybase.jdbc.SybStatement.nextResult(SybStatement.java) at com.sybase.jdbc.SybStatement.queryLoop(SybStatement.java) at com.sybase.jdbc.SybStatement.executeQuery(SybStatement.java) at com.sybase.jdbc.SybCallableStatement.executeQuery(SybCallableStatement.java) at com.ibm._jsp._prodStatHandlingAgent._jspService(_prodStatHandlingAgent.java:247) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:937) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(Generic…
accepted answer: http://stackoverflow.com/a/24246818
has answer: http://stackoverflow.com/a/24246818
type: AnsweredQuestion
tagged with: sybase
has comment: http://stackoverflow.com/comment/37450015
tagged with: websphere
has comment: http://stackoverflow.com/comment/37450663
has title: Need help in finding the root cause for HUNG Threads in java application which runs on WebSphere server
score: 0

http://stackoverflow.com/comment/37483817
type: AnswerComment
has text: Thanks for the answer, but that wouldn't explain why when I retry the same file with the same name I don't get any failure. I think the reason could be related to the load. In fact, I never got a failure when sending files individually, only when I send a batch of around 30 I'm starting to get trouble. The problem is that I don't have any clue based on the stack trace.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24263951

http://stackoverflow.com/q/24213068
answer count: 1
tagged with: combinations
has comment: http://stackoverflow.com/comment/37387618
type: Question
accepted answer: http://stackoverflow.com/a/24213246
has comment: http://stackoverflow.com/comment/37387727
tagged with: http://stackoverflow.com/tag/csv
tagged with: java
has answer: http://stackoverflow.com/a/24213246
has body: I'm trying to create a program which computes X Choose Y and creates a list of possible combinations (order does not matter, no repetition). So for example, A, B, C, and D choose 2: AB, AC, AD, BC, BD, CD would be generated and stored. Each letter represents a chemical reagent in a test tube. A resides in Tube 1, B in Tube 2, and so on. A procedure would then create a CSV or text file where it would read each combination and store it as a line. For example, it would read AB and convert it to Tube 1, Tube 2 Read AC and convert it to Tube 1, Tube 3 and so on. What would be the most efficient way to generate the list of combinations, store it, and then read it to create a text/CSV file? Thanks.
has comment: http://stackoverflow.com/comment/37387477
score: -1
favorite count: 0
tagged with: combinatorics
linked to: http://stackoverflow.com/q/12013584
linked to: http://stackoverflow.com/q/101100
downvote count: 2
has title: Combinatorics in Java and CSV
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/37264660
has text: Support for `@JsonFormat` with dates was added at a later point (2.3.3 I think); so you may want to try Jackson 2.4.0.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24142892
type: Comment

http://stackoverflow.com/comment/37383067
has text: @Brice glad you got it working,I'll try to write an useful answer, thanks.
comment on: http://stackoverflow.com/q/24125326
score: 0
type: Comment
type: QuestionComment

jframe
tags question: http://stackoverflow.com/q/24112208
tags question: http://stackoverflow.com/q/24132413
tags question: http://stackoverflow.com/q/24213483
tags question: http://stackoverflow.com/q/24216688
tags question: http://stackoverflow.com/q/24214909
tags question: http://stackoverflow.com/q/24177138
tags question: http://stackoverflow.com/q/24192824
tags question: http://stackoverflow.com/q/24142079
tags question: http://stackoverflow.com/q/24106222
tags question: http://stackoverflow.com/q/24111940
tags question: http://stackoverflow.com/q/24154923
tags question: http://stackoverflow.com/q/24227347
tags question: http://stackoverflow.com/q/24201612
tags question: http://stackoverflow.com/q/24158585
tags question: http://stackoverflow.com/q/24232351
tags question: http://stackoverflow.com/q/24161248
tag name: jframe
tags question: http://stackoverflow.com/q/24247194
tags question: http://stackoverflow.com/q/24249093
tags question: http://stackoverflow.com/q/24158642
tags question: http://stackoverflow.com/q/24176086
tags question: http://stackoverflow.com/q/24202118
tags question: http://stackoverflow.com/q/24266770
type: Tag
tags question: http://stackoverflow.com/q/24113614
tags question: http://stackoverflow.com/q/24134697
tags question: http://stackoverflow.com/q/24171118
tags question: http://stackoverflow.com/q/24107895
tags question: http://stackoverflow.com/q/24158902
tags question: http://stackoverflow.com/q/24239091
tags question: http://stackoverflow.com/q/24249489
tags question: http://stackoverflow.com/q/24192561

http://stackoverflow.com/comment/37341265
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24188824
score: 0
has text: @SotiriosDelimanolis Aaaaand turns out I forgot to change the line back from when I was experimenting with it. I get failures too.

http://stackoverflow.com/a/24219794
upvote count: 1
has body: How would I go about doing that with a regex? You can try something like this: ^.*?\p{Punct} ^ matches start of string .*? matches anything reluctantly \p{Punct} matches one of !"#$%&amp;'()*+,-./:;&lt;=>?@[]^_`{|}~ Can I get the index of the first regex match? In general, you can obtain the indices of regex matches with Matcher#start.
score: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24219697

http://stackoverflow.com/a/24144393
type: Answer
answers question: http://stackoverflow.com/q/24144126
has comment: http://stackoverflow.com/comment/37260763
has comment: http://stackoverflow.com/comment/37263287
has body: There are a couple of issues here. Most important is that JSP is display technology. You shouldn't be trying to do anything in a jsp that's more than just displaying some data provided by the environment (such as properties on the HttpResponse that were set by a servlet). You certainly shouldn't be trying to access the file system from a jsp. Even from a servlet, you shouldn't do that. You should put the file in the classpath, and use getClass().getClassLoader().getResource or getResourceAsStream. Accessing a file in the file system directly from a web app can be done, but it's not recommended, and not portable. Edit: @LocHa's answer will probably work, but you really shouldn't do that.
downvote count: 0
has comment: http://stackoverflow.com/comment/37258264
has comment: http://stackoverflow.com/comment/37258785
has comment: http://stackoverflow.com/comment/37258180
upvote count: 5
score: 5

http://stackoverflow.com/q/24247503
tagged with: java
has title: How to search a RDF object with Apache Jena?
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/37455345
type: Question
tagged with: http://stackoverflow.com/tag/rdf
tagged with: jena
downvote count: 2
accepted answer: http://stackoverflow.com/a/24248866
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/24248866
type: AnsweredQuestion
has body: My program as the following reads an external RDF file. Model model = ModelFactory.createDefaultModel(); InputStream in = FileManager.get().open(fileName); model.read(in, "RDF/XML"); NodeIterator iter = model.listObjects(); while (iter.hasNext()) { System.out.println(" " + iter.next().toString()); } What I want to implement further is... return whether there is a RDF object whose rdf:resource is "http://dbpedia.org/resource/Coconut" (In this case, return true) Extract the value of rdf:about (In this case, return ../descriptor/14066-0) Example RDF &lt;rdf:Description rdf:about="../descriptor/14066-0"&gt; &lt;skos:closeMatch rdf:resource="http://dbpedia.org/resource/Coconut"/&gt; &lt;/rdf:Description&gt; Which methods can I use?

http://stackoverflow.com/comment/37405796
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24222799
has text: I was trying to think of a way that you could have `TypeA`, `TypeB`, etc., store the `IStrategy` as static members for each type, and then have a polymorphic `IType` method return the static member, that you could call via `o.getStrategyForType()`. Problem is, I think that to be polymorphic it would have to return `IStrategy` with no type parameter, and then casting to `IStrategy<T>` would still be an unchecked cast.

http://stackoverflow.com/q/24194601
type: Question
answer count: 0
type: UnansweredQuestion
score: 1
downvote count: 0
upvote count: 1
favorite count: 0
has body: How can I get the user and password in request in Jersey 2.4? The client request sets user and password as below protected HttpAuthenticationFeature feature = HttpAuthenticationFeature.universalBuilder() .credentialsForBasic("user", "123456") //these are not in header .credentials("adminuser", "hello") .build(); WebTarget loginTarget = webTarget.path("u").path("login"); loginTarget.register(feature); ReturnMessage bean = loginTarget.request(MediaType.APPLICATION_JSON_TYPE).post(.. [Added] More research suggests that those values can be got in http header in JERSEY1.x, but not in 2.x
has title: Jersey Get DIGEST or Basic HTTP Authentication User and Password
tagged with: jersey
tagged with: digest-authentication
tagged with: java
tagged with: basic-authentication

http://stackoverflow.com/a/24245185
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24242184
has body: The QR code you posted decodes just fine with the library: http://zxing.org/w/decode?u=http%3A%2F%2Fi.stack.imgur.com%2FhCj3w.jpg Something is wrong in your code, and it's impossible for anyone to say since there is no further detail. But this much should be OK.

servlets
tags question: http://stackoverflow.com/q/24138026
tags question: http://stackoverflow.com/q/24130083
tags question: http://stackoverflow.com/q/24197141
tags question: http://stackoverflow.com/q/24246502
tags question: http://stackoverflow.com/q/24247366
tags question: http://stackoverflow.com/q/24167186
tags question: http://stackoverflow.com/q/24115646
tags question: http://stackoverflow.com/q/24152856
tags question: http://stackoverflow.com/q/24176684
tags question: http://stackoverflow.com/q/24113330
tags question: http://stackoverflow.com/q/24116637
tags question: http://stackoverflow.com/q/24186403
tags question: http://stackoverflow.com/q/24132836
tags question: http://stackoverflow.com/q/24177758
tags question: http://stackoverflow.com/q/24151037
tags question: http://stackoverflow.com/q/24261552
tags question: http://stackoverflow.com/q/24108520
tags question: http://stackoverflow.com/q/24234901
tags question: http://stackoverflow.com/q/24258162
tags question: http://stackoverflow.com/q/24110264
tags question: http://stackoverflow.com/q/24167274
tags question: http://stackoverflow.com/q/24251119
tags question: http://stackoverflow.com/q/24179859
tags question: http://stackoverflow.com/q/24144126
tags question: http://stackoverflow.com/q/24177071
tags question: http://stackoverflow.com/q/24109200
tags question: http://stackoverflow.com/q/24106622
tags question: http://stackoverflow.com/q/24232745
tags question: http://stackoverflow.com/q/24157734
tags question: http://stackoverflow.com/q/24113861
tags question: http://stackoverflow.com/q/24154505
tags question: http://stackoverflow.com/q/24207835
tags question: http://stackoverflow.com/q/24141156
tags question: http://stackoverflow.com/q/24193651
tags question: http://stackoverflow.com/q/24237016
tags question: http://stackoverflow.com/q/24136270
tags question: http://stackoverflow.com/q/24146395
tags question: http://stackoverflow.com/q/24222845
tags question: http://stackoverflow.com/q/24130803
tags question: http://stackoverflow.com/q/24147935
tags question: http://stackoverflow.com/q/24233528
tags question: http://stackoverflow.com/q/24177927
tags question: http://stackoverflow.com/q/24202623
tags question: http://stackoverflow.com/q/24186664
tags question: http://stackoverflow.com/q/24218525
tags question: http://stackoverflow.com/q/24232091
tags question: http://stackoverflow.com/q/24162441
tags question: http://stackoverflow.com/q/24176382
tag name: servlets
tags question: http://stackoverflow.com/q/24120224
tags question: http://stackoverflow.com/q/24160177
tags question: http://stackoverflow.com/q/24231990
tags question: http://stackoverflow.com/q/24205905
tags question: http://stackoverflow.com/q/24259377
tags question: http://stackoverflow.com/q/24191572
tags question: http://stackoverflow.com/q/24148290
tags question: http://stackoverflow.com/q/24220192
tags question: http://stackoverflow.com/q/24125380
tags question: http://stackoverflow.com/q/24258937
tags question: http://stackoverflow.com/q/24127066
tags question: http://stackoverflow.com/q/24147946
tags question: http://stackoverflow.com/q/24180554
tags question: http://stackoverflow.com/q/24111962
tags question: http://stackoverflow.com/q/24128543
type: Tag
tags question: http://stackoverflow.com/q/24211087
tags question: http://stackoverflow.com/q/24169872
tags question: http://stackoverflow.com/q/24140728
tags question: http://stackoverflow.com/q/24105043
tags question: http://stackoverflow.com/q/24170556
tags question: http://stackoverflow.com/q/24146089
tags question: http://stackoverflow.com/q/24160582
tags question: http://stackoverflow.com/q/24172449
tags question: http://stackoverflow.com/q/24215177
tags question: http://stackoverflow.com/q/24258319
tags question: http://stackoverflow.com/q/24136084
tags question: http://stackoverflow.com/q/24134633
tags question: http://stackoverflow.com/q/24242809
tags question: http://stackoverflow.com/q/24261062
tags question: http://stackoverflow.com/q/24140501

http://stackoverflow.com/comment/37392064
type: Comment
type: QuestionComment
has text: I need it to print the employees names and the biweekly pay they should get based upon the info I enter to be stored into the array.
score: 0
comment on: http://stackoverflow.com/q/24215501

http://stackoverflow.com/q/24168118
tagged with: primefaces
type: AnsweredQuestion
tagged with: jsf-2
has body: I have a a primefaces datascroller that I use to show a simple list and a set of filters that can filter that list. Everything is on RequestScoped beans, I'm trying to avoid view/session beans because it's a b2c site and is supposed to have lots of visitors. My problem is that when I filter the list everything is ok, but when i scroll down filter state are lost (filters are not set in the bean). I'm almost sure that this is because datascroller is using a partial process (javax.faces.partial.execute) so that filters are not processed... but datascroller doesn't have options for that. Any ideas? Thanks
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1
has title: Primefaces 5.0 datascroller and pagination
has answer: http://stackoverflow.com/a/24168267
accepted answer: http://stackoverflow.com/a/24168267
favorite count: 0
type: Question

http://stackoverflow.com/comment/37454017
type: AnswerComment
has text: Yes... The problem is... all the income isn't known as of yet. If I ask now, I know for sure they'll tell me that it won't change so much. And suddenly later they'll tell me something that will absolutely need a database table this time...
comment on: http://stackoverflow.com/a/24247603
type: Comment
score: 0

http://stackoverflow.com/q/24145753
favorite count: 0
has comment: http://stackoverflow.com/comment/37259993
type: Question
type: UnansweredQuestion
tagged with: double
score: 1
tagged with: java
tagged with: bigdecimal
has title: Java BigDecimal / Double precision error
has comment: http://stackoverflow.com/comment/37259713
has answer: http://stackoverflow.com/a/24146017
linked to: http://stackoverflow.com/q/588004
has answer: http://stackoverflow.com/a/24145947
answer count: 4
has answer: http://stackoverflow.com/a/24146064
has body: I'm trying to simulate the ATM amount input in Java, ie. say the user keeps inputting "1", the amount shown should be: 0.00 0.01 0.11 1.11 11.11 111.11 I tried both Double and BigDecimal for processing: println( ((new BigDecimal(current)).multiply(new BigDecimal(10)).add(new BigDecimal(0.01))).setScale(2, RoundingMode.HALF_UP).toString()) ) println( "" + Double.parseString(current) * 10 + 0.01 ) However both seems to show this instead: 0.00 0.01 0.11 1.11 11.1 &lt;&lt;&lt; missing the 0.01 at the end 111.01 are they both due to a precision rounding error (I thought BigDecimal does not have this problem) or am I doing something wrong?
has comment: http://stackoverflow.com/comment/37259835
has comment: http://stackoverflow.com/comment/37260627
has comment: http://stackoverflow.com/comment/37260493
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37259894
has answer: http://stackoverflow.com/a/24146058

http://stackoverflow.com/comment/37267651
type: AnswerComment
has text: Not working. That's what I get for trying to teach myself. :-) I'm sure there are so many problems with my code that I'll have to go back to the drawing board.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24149010

http://stackoverflow.com/comment/44998103
has text: Thanks for this! TL;DR HTTP.UTF_8 should be StandardCharsets.UTF_8 going forward.
score: 10
type: Comment
comment on: http://stackoverflow.com/a/24128459
type: AnswerComment

http://stackoverflow.com/comment/37461282
score: 0
type: AnswerComment
type: Comment
has text: @Dwill34: You also have some unrelated style issues that are serious enough that you'll lose points for them. `SIZE` is not a constant, so it should not be capitalized. `Salesman` appears to be acting as a a utility class instead of holding data for each individual salesperson, which is most likely what was intended.
comment on: http://stackoverflow.com/a/24250250

http://stackoverflow.com/comment/37434453
has text: Are you using plain java DOM parser? or any thir party libraries? Because in java there is no method called "getElementsByTag" it is "getElementsByTagName"
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24237888
type: QuestionComment

http://stackoverflow.com/a/24225633
answers question: http://stackoverflow.com/q/24225504
upvote count: 2
has comment: http://stackoverflow.com/comment/37430501
score: 2
has comment: http://stackoverflow.com/comment/37423495
has comment: http://stackoverflow.com/comment/37410890
has comment: http://stackoverflow.com/comment/37411069
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37411144
has body: One way to get what you need is to use the same technique I used in the Chess GUI with the columns (A-H) and rows (8-1) as seen below. Have a look over the code and see if you can implement that in your own code. Failing that, post an MCVE (Minimal Complete and Verifiable Example) of your own (as opposed to uncompilable code snippets). One way to get image(s) for an example is to hot-link to the images seen in this answer (again as the linked code does).
has comment: http://stackoverflow.com/comment/37410924
accepted answer of: http://stackoverflow.com/q/24225504
type: Answer

http://stackoverflow.com/comment/37231810
type: Comment
comment on: http://stackoverflow.com/a/24129857
score: 0
type: AnswerComment
has text: According to you , onRestoreInstanceState is called only if the activity was destroyed . But according to the official documentation , it may be called after the onStart method . So there is two possible lifecycle : oncreate --> onRestoreInstanceState and onStart --> onRestoreInstanceState . Am i wrong ??

http://stackoverflow.com/comment/37364426
type: AnswerComment
has text: @user3079666 You can use the code button (looks like curly braces) to mark up source-code — it will give syntax highlighting too :)
score: 1
type: Comment
comment on: http://stackoverflow.com/a/24201103

http://stackoverflow.com/comment/54854155
comment on: http://stackoverflow.com/a/24218368
type: AnswerComment
type: Comment
has text: Is there a way to not get overwriting behavior? I would like to have Morphia throw an exception if Im trying to create a new document with an already existing id.
score: 4

http://stackoverflow.com/q/24211457
score: -1
has comment: http://stackoverflow.com/comment/37384875
has title: I unintentionally changed my JRE in Eclipse - how can I get it back?
tagged with: java
answer count: 1
tagged with: eclipse
downvote count: 1
favorite count: 0
type: Question
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24211534
tagged with: android
has body: In my efforts to figure how to exercise various features of the Android system, I have downloaded several sample codes and run them on my phone. One of those that I downloaded would not compile. The autofix gave me an option that I believe to have changed my build path. The fix worked but it can with a painful side-effect: Now none of my other sample codes compile. I followed the instructions in Accidentally changed Eclipse JRE and added the only JRE that Eclipse seems to have found on my computer (JRE System Library [Java SE 6 [1.6.0_65-b14-462]] ). However, I still get compile errors which suggest to me that it is not finding a JRE. (e.g. public class MainActivity extends Activity - I get "Activity cannot be resolved to a type." Is there a way to get back to the build path I had an hour ago?

http://stackoverflow.com/q/24186111
has answer: http://stackoverflow.com/a/24191304
tagged with: struts2
tagged with: type-conversion
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23470075
upvote count: 2
has body: I am doing a project using Struts2 and I have a problem assigning a set collection. Here's my Action (I eliminated the irrelevant part) public class TeamAction extends BaseAction implements ModelDriven&lt;Team&gt; { Team team=new Team(); } Here's my model Team (I eliminated the irrelevant part) private TeamId id; private Set students = new HashSet(0); Here's my JSP part &lt;input type="text" name=team.student[0].id /&gt; Now the problem is I can't insert the right value into this Set collection in by ModelDriven, it will throw a exception. Could you please tell me what to write in JSP file, so I can insert a value to Set collection in my model?
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37340226
downvote count: 0
tagged with: jsp
favorite count: 0
has title: How to insert a value into Set collection in Struts 2
type: Question
tagged with: ognl
accepted answer: http://stackoverflow.com/a/24191304

http://stackoverflow.com/comment/37813239
score: 0
comment on: http://stackoverflow.com/q/24140475
has text: Im having the same issue using WAS7 and RSA 8.5. Can anyone please offer a suggestion?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37461764
type: QuestionComment
score: 0
has text: @dave : Maybe my answer [Changing SplashScreen Image](http://stackoverflow.com/a/23284181/1322642) can help you !
comment on: http://stackoverflow.com/q/24232462
type: Comment

http://stackoverflow.com/a/24252101
upvote count: 1
has comment: http://stackoverflow.com/comment/37462263
answers question: http://stackoverflow.com/q/24251610
type: Answer
score: 1
has body: OK, I suppose you want to map x to, say sqrt(x). You could concurrently obtain the square roots, and put them in a corresponding array. However, depending on the time needed for sqrt and reading/writing menory, you might saturate your mem access with two threads. Make sure each concurrent job runs for at least a µs or the fork/join overhead becomes too big.
downvote count: 0

http://stackoverflow.com/q/24237735
favorite count: 0
type: Question
tagged with: jakarta-ee
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/6560969
has title: In what order does the filters are invoked by container ,when they are not declared in web.xml?
has body: I have 2 filters and a servlet in my web app. I registered the filters programmatically using @WebFilter annotation. They have same URL Pattern. Now first filter is calling FilterChain.doFilter and second filter is invoking the RequestDispatcher.forward method to forward the request to the servlet.The code runs fine as First filter is invoking second one and second one is invoking the servlet. I wonder ,no entries of filters are there in web.xml, and container is invoking them in correct order. So its just a coincidence or we can have ordering here in annotation based configuration? Please find the code below. First Filter : @WebFilter(urlPatterns={"/*"},displayName="FirstFilterInFilterChain") public class FirstFilterInFilterChain implements Filter{ @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { System.out.println("Calling the Second Filter"); chain.doFilter(req, res); System.out.println("Returning from Filter 1"); } @Override public void destroy() { System.out.println("Inside Destroy method of Filter no 1"); } @Override public void init(FilterConfig config) throws ServletException { System.out.println("Inside Init method of Filter no 1"); } } Second Filter : @WebFilter("/*") public class SecondFilterInFilterChain implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { RequestDispatcher dispatcher = request.getRequestDispatcher("/PostFilterServlet"); dispatcher.forward(request, response); System.out.println("Returning from Filter 2"); } public void init(FilterConfig fConfig) throws ServletException { System.out.println("Inside Init method of Filter no 2"); } } Servlet code: @WebServlet("/PostFilterServlet") public class PostFilterServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws S…
has comment: http://stackoverflow.com/comment/37434413
duplicate of: http://stackoverflow.com/q/6560969
downvote count: 0
answer count: 0
upvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/24248866
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24247503
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24247503
has body: This question doesn't make sense as written. In the data you've provided, there is there is a single triple &lt;../descriptor/14066-0&gt; skos:closeMatch &lt;http://dbpedia.org/resource/Coconut&gt; rdf:about is just an artifact of the RDF/XML serialization, and it indicates the URI of the resource, just like rdf:resource does in the property value. Given that, what you're probably is asking by return whether there is a RDF object whose rdf:resource is "http://dbpedia.org/resource/Coconut" (In this case, return true) Extract the value of rdf:about (In this case, return ../descriptor/14066-0) is values of ?resource such that: ?resource skos:closeMatch dbpedia:Coconut That's easiest to do with a SPARQL query, but you can also do it programmatically. Here's an example. Note that subjects can also be blank nodes, in which case they won't have a URI. import java.io.ByteArrayInputStream; import java.io.IOException; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.ResultSetFormatter; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.StmtIterator; public class CoconutExample { public static void main(String[] args) throws IOException { final String data = "" + "@prefix skos: &lt;http://skos.com/&gt; .\n" + "@prefix dbpedia: &lt;http://dbpedia.org/resource/&gt; .\n" + "@prefix : &lt;http://stackoverflow.com/q/24247503/1281433&gt; .\n" + "\n" + ":lovelyBunch skos:closeMatch dbpedia:Coconut .\n" + ":uglyBunch skos:closeMatch dbpedia:Banana .\n" + "_:blankBunch skos:closeMatch dbpedia:Coconut .\n"; Model model = ModelFactory.createDefaultModel(); try ( ByteArrayInputStream in = new ByteArrayInputStream( data.getBytes() ) ) { model.read( in, null, "TTL" ); } // Show the model System.out.println( "=== Model ===" ); RDFDataM…
type: Answer
upvote count: 2

http://stackoverflow.com/comment/115674500
has text: Could it also indicate it's waiting for a response from a connection? Like a backend call?
comment on: http://stackoverflow.com/a/26239873
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/q/24141943
tagged with: lucene
has body: (I use Windows 7 64Bit) I'm trying to use this tutorial: http://lucene.apache.org/core/4_8_1/demo/overview-summary.html But I'm getting some errors: I downloaded the Lucene Framework Put the 4 jars in my classpath like it said in the tutorial (Classpath=D:\Lucene\lucene-4.8.1\core\lucene-core-4.8.1.jar%D:\Lucene\lucene-4.8.1\queryparser\lucene-queryparser-4.8.1.jar%D:\Lucene\lucene-4.8.1\demo\lucene-demo-4.8.1.jar%D:\Lucene\lucene-4.8.1\analysis\common\lucene-analyzers-common-4.8.1.jar) And now I wanted to, for example index the files in Java/src with the command: java org.apache.lucene.demo.IndexFiles -docs D:/Java/src But it says, that it couldn't find the main class "org.apache.lucene.demo.IndexFiles". Did I set the classpath/environment variable wrong?
score: 0
tagged with: java
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/24204757
tagged with: classpath
tagged with: command
type: Question
has comment: http://stackoverflow.com/comment/37370678
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37252850
has title: Simple Lucene Usage?

http://stackoverflow.com/a/24107809
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24107657
score: 2
type: Answer
has body: The possibility to call methods like this has existed since the inner classes had been introduced. The mechanism for resolving the instance that a method is called on is described in detail in Java Language Specification, Section 15.12.4.1., Compute Target Reference (If Necessary). You are probably refering to the fact that you don't need the "Qualified this". But this this is mainly intended to resolve ambiguities when the inner instance and the outer instance have a method with the same signature.
accepted answer of: http://stackoverflow.com/q/24107657
upvote count: 2

http://stackoverflow.com/q/24204683
answer count: 1
has comment: http://stackoverflow.com/comment/37372844
has body: Check the below lines : Map&lt;String,Object&gt; map=new HashMap&lt;String,Object&gt;; map.put("a",a); map.put("b",b); map.put("c",c); Note : All the 3 variables do have values. I am creating a map and adding 3 key-value pairs in it. But on inspecting the object, its size is 3 but the values added in the HashMap are always only a and b. Any idea of the solution or cause of the problem?
has comment: http://stackoverflow.com/comment/37371055
has comment: http://stackoverflow.com/comment/37370732
has title: Map issues in adding key-value pairs
has comment: http://stackoverflow.com/comment/37371230
type: Question
tagged with: hashmap
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37372388
has comment: http://stackoverflow.com/comment/37372668
tagged with: dictionary
has answer: http://stackoverflow.com/a/24206894
has comment: http://stackoverflow.com/comment/37370953
has comment: http://stackoverflow.com/comment/37370788
score: 0
has comment: http://stackoverflow.com/comment/37374039
has comment: http://stackoverflow.com/comment/37370729
has comment: http://stackoverflow.com/comment/37371680
tagged with: java
has comment: http://stackoverflow.com/comment/37370985

http://stackoverflow.com/comment/37477849
has text: Yes I modified my answer. I mis-read it and thought he already done the loop on the fields.
comment on: http://stackoverflow.com/a/24260852
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37274124
type: AnswerComment
has text: Nice thorough explanation. :)
comment on: http://stackoverflow.com/a/24143079
score: 1
type: Comment

http://stackoverflow.com/comment/37215582
type: Comment
comment on: http://stackoverflow.com/a/24122134
type: AnswerComment
score: 0
has text: @MrMorgan You need to change to lowercase library to get the initial form

http://stackoverflow.com/comment/37225118
score: 0
comment on: http://stackoverflow.com/q/24122677
type: Comment
type: QuestionComment
has text: Did you perhaps mistype your second code block? If so you could do a translation before serialization to avoid writing a custom de/serializer.

http://stackoverflow.com/a/24130161
has comment: http://stackoverflow.com/comment/37242424
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24130083
has comment: http://stackoverflow.com/comment/37231151
upvote count: 1
has comment: http://stackoverflow.com/comment/37231256
has comment: http://stackoverflow.com/comment/37231168
has comment: http://stackoverflow.com/comment/37231558
has body: Compare: @WebServlet(name = "MainControllerServlet", loadOnStartup = 1, urlPatterns = {"/signup", "/submit"}) with: String url = "/WEB-INF/view" + userPath + ".jsp"; Even if userPath = "/signup"; you'll never get to the signup servlet, because you appeneded that ".jsp" in there. Also, if you ever did get to /signup it looks like it would be an infinite loop forwarding to itself over and over. BTW, it would probably be a lot simpler to actually make separate servlets for each different operation than to double up on them and do this kind of string manipulation.
has comment: http://stackoverflow.com/comment/37231453
type: Answer
has comment: http://stackoverflow.com/comment/37231487
has comment: http://stackoverflow.com/comment/37231303
has comment: http://stackoverflow.com/comment/37231409
accepted answer of: http://stackoverflow.com/q/24130083

http://stackoverflow.com/a/24184803
accepted answer of: http://stackoverflow.com/q/24161848
score: 0
answers question: http://stackoverflow.com/q/24161848
type: AcceptedAnswer
has body: Brothers, I found that the method to getData is all wrong.. The Right Method is.. // Getting all data public Cursor getData() { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_DATA, new String[] { "UserName", "Email", "Password", "BirthDate", "PinCode", "Country", "PaypalID", "mNUMBER", "FBID" }, null, null, null, null, null, null); return cursor; } means No parameters in a method, like i did before, because we are not adding or updating any fields, so no need for that in case of fetching data.. And in Activity, DatabaseHandler db = new DatabaseHandler(AccountActivity.this); // getAllData(); Cursor cursor = db.getData(); if (cursor.moveToFirst()) { do { Log.i("counttttttttttttt", "" + cursor.getCount()); name = cursor.getString(0); email = cursor.getString(1); password = cursor.getString(2); birthdate = cursor.getString(3); pincode = cursor.getString(4); country = cursor.getString(5); paypal = cursor.getString(6); mobile = cursor.getString(7); fbid = cursor.getString(8); } while (cursor.moveToNext()); } db.close; name, email, password are Strings inside and you can set it respectively.. Thanks for your help..
type: Answer

http://stackoverflow.com/comment/37323426
has text: i meant what i have add in the persistence.xml, since i get "Class CommonFields is managed, but is not listed in the persistence.xml file"
score: 0
comment on: http://stackoverflow.com/a/24177760
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37436506
type: QuestionComment
comment on: http://stackoverflow.com/q/24238975
score: 0
has text: I know that it is purely subjective, but note that the hungarian notation is redundant and quite rare anyways in Java (with few notable exceptions).
type: Comment

http://stackoverflow.com/comment/37430594
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24235889
has text: I found it weir, but I saw this from other ppl too, and just now I tried with <java classname="Tarea2" ...> and didn't work too...
type: Comment

http://stackoverflow.com/comment/37485182
score: 2
comment on: http://stackoverflow.com/q/24264597
type: Comment
type: QuestionComment
has text: Do `input.nextLine()` instead and it will work.

http://stackoverflow.com/q/24165748
has answer: http://stackoverflow.com/a/24167350
type: Question
has body: I will be very thankful if someone could help me to solve this problem as I have already spent a lot of time on it. The frontend of my application sends employee data to server end, which creates Emmployee object and saves the data on datastore. My application provides the keyword search functionality on title, company and jobDesc so I am using Search Api. The problem is that I want to use datastore for storing the complete data and document for storing searchable data. How can I link datastore with document? I know it can be achieved if I set employee’s key as document id but the problem is how will I get the key of the data which is being store. If I try to get key using e.getKey() that obviously returns nullPointerException because it does have the key at that time. I can achieve this by reading all employee data stored on datastore and creating document with it and setting employee’s key as document id but I want to create document as the data is received from frontend of application. //EmployeeServlet PersistenceManager pm = PMF.get().getPersistenceManager(); Employee e = new Employee(title, company, location, category, jobType, gender, careerLevel, salaryRange, sector, jobDesc); Document newDoc = Document.newBuilder().setId(???) .addField(Field.newBuilder().setName("title").setText(title)) .addField(Field.newBuilder().setName("company").setText(company)) .addField(Field.newBuilder().setName("jobDesc").setText(jobDesc)).build(); SearchIndexManager.INSTANCE.indexDocument("Employee", newDoc); pm.makePersistent(e); //Employee @PersistenceCapable public class Employee { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String title; @Persistent private String company; @Persistent private String location; @Persistent private String category; @Persistent private String jobType; @Persistent private String gender; @Persistent private String careerLevel; @Persistent private String salaryRange; @Persistent private …
tagged with: google-app-engine
type: AnsweredQuestion
score: 0
has title: How to link datastore with document using key
tagged with: google-cloud-datastore
tagged with: java
tagged with: gae-search
answer count: 1
accepted answer: http://stackoverflow.com/a/24167350

http://stackoverflow.com/a/24125570
has body: Running out of memory does not always imply a memory leak. It may simply mean you don't have enough memory to do what you're trying to do. 10 megs isn't much at all. It's likely that the in-memory representations of JavaFX nodes differ somewhat between Mac and Windows and perhaps the Windows representation requires a bit more space, or the base consumption of the memory pool is higher to start with on Windows. Bottom line: it's not realistic to expect that exact same memory usage across platforms. Also, the implementation of the -Xmx option itself may even differ. After glancing at your code, I don't see any leaks, especially since you're not instantiating new TextField instances each time. And yes, it is very, very possible to leak memory in Java. In some ways it's almost more likely because it gives you a false sense of security.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24116033

http://stackoverflow.com/a/24152627
downvote count: 0
type: Answer
has body: According to this bug report, that bug (or what seems to be the bug your link was referring to) has been fixed in Java 5, so I would suspect your bug lies elsewhere.
answers question: http://stackoverflow.com/q/24152543
score: 3
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37273225
accepted answer of: http://stackoverflow.com/q/24152543

http://stackoverflow.com/q/24227344
answer count: 0
linked to: http://stackoverflow.com/q/23222251
has comment: http://stackoverflow.com/comment/37414124
has comment: http://stackoverflow.com/comment/38373497
has body: I am tasked with making a program (In Java, since its the only language I can code in right now) where a watchdog monitors the system. If one process uses more than 1GB of RAM, the system kicks the dog and the watchdog prints a message in the console (I.E.: "Process -name- used more than 1 GB of memory"). I've made the Watchdog, however...I have yet to come across a way to get every process' information from the system in Java. EDIT: To rectify, I need help on Windows 7 64bit. I require the process info of let's say running games or application (Skype, etc). Any help would be tremendously useful! Watchdog: import java.util.Enumeration; import java.util.Vector; public class Watchdog implements Runnable { private Vector observers = new Vector(1); private final long timeout; private boolean stopped = false; public Watchdog(final long timeout) { if (timeout &lt; 1) { throw new IllegalArgumentException("timeout must not be less than 1."); } this.timeout = timeout; } public void addTimeoutObserver(final TimeoutObserver to) { observers.addElement(to); } public void removeTimeoutObserver(final TimeoutObserver to) { observers.removeElement(to); } protected final void fireTimeoutOccured() { Enumeration e = observers.elements(); while (e.hasMoreElements()) { ((TimeoutObserver) e.nextElement()).timeoutOccured(this); } } public synchronized void start() { stopped = false; Thread t = new Thread(this, "WATCHDOG"); t.setDaemon(true); t.start(); } public synchronized void stop() { stopped = true; notifyAll(); } public synchronized void run() { final long until = System.currentTimeMillis() + timeout; long now; while (!stopped &amp;&amp; until &gt; (now = System.currentTimeMillis())) { try { wait(until - now); } catch (InterruptedException e) { } } if (!stopped) { fireTimeoutOccured(); } } } Main class: import java.io.File; public class Main { public static void main(String[] args) { /* Total number of processors or cores available to the JVM */ System.out.println("Available processor…
tagged with: java
downvote count: 0
tagged with: process
favorite count: 0
type: Question
tagged with: watchdog
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37414167
score: 2
has title: In Java - How to check if a running process is using more than 1GB of memory?

http://stackoverflow.com/comment/37345097
type: AnswerComment
has text: yeah, that's what I was thinking also. Just wasn't sure if there was another directory things of that nature would need to go under.
comment on: http://stackoverflow.com/a/24191329
score: 0
type: Comment

http://stackoverflow.com/a/33678591
has body: In such cases you can use fourth, remote repository to share artifacts between them: although each build tool needs its own local 'cache', you will have common repository for all them and then you can clear those caches from time to time if it takes too much space. You can create the remote repository with a tool like Sonatype Nexus, or just treat a local or network directory as a remote repository (Maven supports this kind of remote repositories, I think that SBT too).
score: 1
type: Answer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24186221
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24186221

http://stackoverflow.com/a/24116673
answers question: http://stackoverflow.com/q/24116561
score: 1
has body: Use the @jsonignore annatotion, part of jackson - springs default converter. You can then just annaote you don't want to be serialzed, its nto clear from your snippets how you are performing json serialzation. But jackson is the way to go if you are using spring.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/37436586
comment on: http://stackoverflow.com/q/24239091
type: Comment
has text: This is because `pack()` tries to shrink your objects to a minimum size. Try using setPreferredSize instead :)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37316965
has text: Hey, i just had question regarding the update method to the player class. So in my case i start off with a coin toss and say the computer wins the coin toss i would have to use the update method to set the type as computer right?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24175543

http://stackoverflow.com/comment/37391137
has text: The difficulty is that the documentation generates images of the flow from the eclipse canvas, otherwise it would be easy to create a way to do this from maven/command line. I agree having an automated command line way to do to this would be a great improvement.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24187906
type: Comment

http://stackoverflow.com/comment/37384970
has text: Well, interfaces generally define contracts, right? If you have different implementations going off and defining the arguments to mean different things, interfaces would be far less useful than they currently are, and could possibly in fact be considered broken that way. Having names makes it absolutely clear what parameter should mean what. I really don't see any benefit to leaving off a name, and see benefits to requiring it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24210368
score: 0

http://stackoverflow.com/comment/37373141
comment on: http://stackoverflow.com/q/24203773
type: QuestionComment
has text: Why do you think that error is caused by the version of the JDK you're using?
score: 0
type: Comment

http://stackoverflow.com/q/24256694
has answer: http://stackoverflow.com/a/24259113
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/24259113
tagged with: jsoup
answer count: 3
score: 1
tagged with: java
has title: Ho do I get tag and classname containing a word in the content of html code
downvote count: 0
has answer: http://stackoverflow.com/a/24258916
upvote count: 1
has answer: http://stackoverflow.com/a/24256837
favorite count: 0
has comment: http://stackoverflow.com/comment/37470548
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24256837
has body: Given content contain "Posted by"word My approach is this: Get all contents from web. Find "Posted by" words in the contents. Get tag and class name which it has this content. I need to find all posted date in various websites such as http://www.testthisblog.com/ HTML code of this website has some content which is contain "Posted by" word. Posted by Eric Jacobson at Tuesday, May 27, 2014 so I try to search "Posted by" word in content using this Java code String url = "http://www.testthisblog.com"; /*step1*/ Document doc = Jsoup.connect(url).get(); String htmlTxt = doc.text().toLowerCase(); Pattern pattern = Pattern.compile(".*Posted by.*"); /*step2*/ Matcher matcher = pattern.matcher(htmlTxt); if(matcher.find()){ System.out.println("Find a word!!!"); /*step3*/ >>What is possible? can I get tag and class name here?<< } I use Jsoup library and this method should be flexible for other website.

http://stackoverflow.com/a/24242275
answers question: http://stackoverflow.com/q/24242027
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/37446595
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24242027
type: AcceptedAnswer
downvote count: 0
has body: Your title is about sharing image, but you try sharing text. Well. try any of these. Try this to share text: Intent whatsappIntent = new Intent(Intent.ACTION_SEND); whatsappIntent.setType("text/plain"); whatsappIntent.setPackage("com.whatsapp"); whatsappIntent.putExtra(Intent.EXTRA_TEXT, "This is a test text"); try { activity.startActivity(whatsappIntent); } catch (android.content.ActivityNotFoundException ex) { ToastHelper.MakeShortText("Whatsapp have not been installed."); } Try this to share image: Intent whatsappIntent = new Intent(Intent.ACTION_SEND); Uri uri=Uri.parse("file:///android_asset/myimage.png"); whatsappIntent.setType("image/*"); whatsappIntent.setPackage("com.whatsapp"); sendIntent.putExtra(Intent.EXTRA_STREAM,uri); try { activity.startActivity(whatsappIntent); } catch (android.content.ActivityNotFoundException ex) { ToastHelper.MakeShortText("Whatsapp have not been installed."); } Hope it helps.
has comment: http://stackoverflow.com/comment/37442607

http://stackoverflow.com/q/24155615
tagged with: multithreading
answer count: 1
has body: We keep monitoring our threads in tomcat 7 and off lately we started seeing that at times the number of threads would become double the normal value i.e. around 200 threads (rather than the usual around 80 threads). Upon taking a thread dump, I see that during the time the number of threads increase, the increase due to presence of a large number (around 100) of threads as shown below (all waiting on 588cc7d5): "http-bio-8080-exec-201" - Thread t@2856 java.lang.Thread.State: TIMED_WAITING at sun.misc.Unsafe.park(Native Method) - parking to wait for &lt;588cc7d5&gt; (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source) at java.util.concurrent.LinkedBlockingQueue.poll(Unknown Source) at org.apache.tomcat.util.threads.TaskQueue.poll(TaskQueue.java:86) at org.apache.tomcat.util.threads.TaskQueue.poll(TaskQueue.java:32) at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - None Does anyone know what can cause this behavior?
score: 4
tagged with: tomcat
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27598810
tagged with: java
upvote count: 4
has title: Multiple TIMED_WAITING threads seen on tomcat 7 thread dump
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24123683
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/24123981
tagged with: mockito
tagged with: junit
downvote count: 0
has title: Spring jdbcTemplate unit testing
upvote count: 10
has comment: http://stackoverflow.com/comment/37218596
has comment: http://stackoverflow.com/comment/37218898
tagged with: unit-testing
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/38374823
possible better answer: http://stackoverflow.com/a/24123981
has comment: http://stackoverflow.com/comment/76807099
has body: I am new to Spring and only somewhat experienced with JUnit and Mockito I have the following method which requires a unit test public static String getUserNames(final String userName { List&lt;String&gt; results = new LinkedList&lt;String&gt;(); results = service.getJdbcTemplate().query("SELECT USERNAME FROM USERNAMES WHERE NAME = ?", new RowMapper&lt;String&gt;() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return new String(rs.getString("USERNAME"); } } return results.get(0); },userName) Does anyone have any suggestions on how I might achieve this using JUnit and Mockito? Thank you very much in advance!
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/24127275
accepted answer: http://stackoverflow.com/a/24127275
tagged with: spring

http://stackoverflow.com/comment/37693049
score: 0
type: Comment
type: AnswerComment
has text: @Ruud Please check this. http://jsfiddle.net/f6RmN/7/ I have wrote my changes over your code.
comment on: http://stackoverflow.com/a/24266432

http://stackoverflow.com/comment/37192263
has text: Perhaps you should just have one label and change the text.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24109621
type: Comment

http://stackoverflow.com/comment/37393969
score: 0
type: AnswerComment
has text: Well, there *technically* is. But if I remember correctly the methods to do that were deprecated some time ago because they were unsafe to use.
type: Comment
comment on: http://stackoverflow.com/a/24216549

http://stackoverflow.com/comment/37485040
has text: Can you demonstrate the behavier as an example?
comment on: http://stackoverflow.com/q/24264597
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24261697
type: Answer
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24261672
type: AcceptedAnswer
has body: Tweaking your code a little: class Animal { // ... } class Dog extends Animal { // ... } public class Test { public static void main(String args[]) { Animal obiect = new Dog(); // A DOG (RHS) is ALSO an ANIMAL(LHS) } } NOTE: If you point to a DOG and say that its an ANIMAL, it can only do what ALL animals do (general behaviour defined in ANIMAL class). It can sleep(), eat() etc. But it can't call bark() because ALL ANIMALS don't bark. I.e, by referring to a subclass instance using a superclass reference, you are limiting the access of all methods of the subClass i.e, you can access only the overriden methods.
has comment: http://stackoverflow.com/comment/37479803
answers question: http://stackoverflow.com/q/24261672
downvote count: 0

http://stackoverflow.com/comment/37481999
has text: I did, but I can't remove that equals because I need it to compare non-array values as well. Why does it only fail in Number[] and String[]?
score: 0
comment on: http://stackoverflow.com/q/24262833
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24174219
score: 3
has answer: http://stackoverflow.com/a/24213927
type: UnansweredQuestion
has title: NetBeans doesn't find projects on OneDrive
has body: I have a pc and a laptop both running Windows Pro 8.1 and latest version of Netbeans. I log on the pc and the laptop with the same hotmail/windows account. I build my java projects on the pc and i save them on a OneDrive directory just fine all working ok. BUT when i try to open them on my laptop NetBeans sees the folders with all the files in them but doesnt find the projects so it is unable to open them. So i cant edit or work on any of my projects on my laptop. Is using a usb drive to save my projects my only way to mobility?
has comment: http://stackoverflow.com/comment/37348070
has answer: http://stackoverflow.com/a/24213669
tagged with: netbeans
answer count: 3
has answer: http://stackoverflow.com/a/29865148
upvote count: 3
has comment: http://stackoverflow.com/comment/37314227
tagged with: java
downvote count: 0
tagged with: onedrive
tagged with: projects
favorite count: 0
type: Question

http://stackoverflow.com/comment/42367761
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24173725
score: 0
has text: I asked a similar question here: http://stackoverflow.com/questions/26908906/acrobat-javascript-convert-javascript-page-links-to-real-links

http://stackoverflow.com/q/24220303
type: Question
has comment: http://stackoverflow.com/comment/37476204
has title: Real time scenario for a custom entity provider
accepted answer: http://stackoverflow.com/a/24221551
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24221551
score: 3
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
tagged with: jax-rs
has body: In JAX-RS there is an option to define a custom entity provider(message body workers or message body readers and writers) so that you can map a java bean to MIME type (say application/myBean). Are there any scenario where one would need it?
favorite count: 0

http://stackoverflow.com/q/24253282
tagged with: java
type: Question
score: 0
tagged with: onclicklistener
has comment: http://stackoverflow.com/comment/37464315
has comment: http://stackoverflow.com/comment/37464303
type: UnansweredQuestion
answer count: 1
tagged with: implementation
has answer: http://stackoverflow.com/a/24253988
has comment: http://stackoverflow.com/comment/37464327
tagged with: android
has comment: http://stackoverflow.com/comment/37464288
has body: So I'm trying to implement the OnClickListener in my class but I can't seem to get it to work correctly. The point of this class is to have two 'buttons' one is a TextView, the other a ImageView. When the TextView is clicked, the image becomes visible (set as 'gone' from the start). Then when the image is clicked it returns to it's gone state. When I do it without implementing the onClick class,I get it to work perfectly but I'd rather use the implementation to make it easier for my self since I'm going to do the same thing with multiple images. here's my java: TextView shrimp = (TextView) findViewById(R.id.shrimp); final ImageView shrimp1 = (ImageView) findViewById(R.id.stmSrimp); shrimp.setTextColor(Color.BLUE); shrimp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub shrimp1.setVisibility(View.VISIBLE); } }); shrimp1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub shrimp1.setVisibility(View.GONE); } }); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.shrimp: shrimp1.setVisibility(View.VISIBLE); break; } As you can see, the top part is how I originally using the OnClickListener, and the last part is where I tried using the implementation and I get an error on the shrimp1.setVisibility(View.VISIBLE); (shrimp1) part. What the hell am I doing wrong? Should I be referring to the image by some other way?
has title: Implementing onClickListener

http://stackoverflow.com/q/24121801
has body: I have the private key stored as .key file.. -----BEGIN RSA PRIVATE KEY----- [binary] -----END RSA PRIVATE KEY----- And i extracted public key from ssl certificate file.. Below is the code i tried to verify if private key matches with ssl certificate or not.. I used the modulus[i.e. private key get modulus==public key get modulus] to check if they are matching.. And this seems to hold only for RSAKEYS.. But i want to check for other keys as well.. Is there any other alternative to do the same..?? private static boolean verifySignature(File serverCertificateFile, File serverCertificateKey) { try { byte[] certificateBytes = FileUtils.readFileToByteArray(serverCertificateFile); //byte[] keyBytes = FileUtils.readFileToByteArray(serverCertificateKey); RandomAccessFile raf = new RandomAccessFile(serverCertificateKey, "r"); byte[] buf = new byte[(int) raf.length()]; raf.readFully(buf); raf.close(); PKCS8EncodedKeySpec kspec = new PKCS8EncodedKeySpec(buf); KeyFactory kf; try { kf = KeyFactory.getInstance("RSA"); RSAPrivateKey privKey = (RSAPrivateKey) kf.generatePrivate(kspec); CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); InputStream in = new ByteArrayInputStream(certificateBytes); //Generate Certificate in X509 Format X509Certificate cert = (X509Certificate) certFactory.generateCertificate(in); RSAPublicKey publicKey = (RSAPublicKey) cert.getPublicKey(); in.close(); return privKey.getModulus() == publicKey.getModulus(); } catch (NoSuchAlgorithmException ex) { logger.log(Level.SEVERE, "Such algorithm is not found", ex); } catch (CertificateException ex) { logger.log(Level.SEVERE, "certificate exception", ex); } catch (InvalidKeySpecException ex) { Logger.getLogger(CertificateConversion.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { logger.log(Level.SEVERE, "Signature verification failed.. This could be because the file is in use", ex); } return false; } And the code isn't working either.. throws invalidkeyspec excepti…
upvote count: 5
accepted answer: http://stackoverflow.com/a/24167548
possible better answer: http://stackoverflow.com/a/24126692
has answer: http://stackoverflow.com/a/24123410
tagged with: ssl
answer count: 6
linked to: http://stackoverflow.com/q/13500368
has answer: http://stackoverflow.com/a/24167548
has answer: http://stackoverflow.com/a/37317796
has comment: http://stackoverflow.com/comment/37215349
linked to: http://stackoverflow.com/q/23265698
has comment: http://stackoverflow.com/comment/101257403
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31858690
has title: How to verify if the private key matches with the certificate..?
tagged with: java
downvote count: 0
tagged with: cryptography
has answer: http://stackoverflow.com/a/24126692
favorite count: 0
has answer: http://stackoverflow.com/a/46774188
type: Question
score: 5
tagged with: bouncycastle

http://stackoverflow.com/comment/37407923
type: Comment
comment on: http://stackoverflow.com/a/24223830
type: AnswerComment
has text: Try swapping the Typeface definition around with the textview, and have you remembered to add it as a ressource in xml?
score: 0

http://stackoverflow.com/comment/37256484
type: AnswerComment
score: 0
has text: i used --Process p = Runtime.getRuntime().exec("cmd /c start ext.bat"+" "+args1 +" "+args2); console is opening with first question Please enter the path for code.. and hangs there..
type: Comment
comment on: http://stackoverflow.com/a/24124036

http://stackoverflow.com/q/24249754
accepted answer: http://stackoverflow.com/a/24249867
answer count: 1
tagged with: eclipse
has answer: http://stackoverflow.com/a/24249867
downvote count: 1
favorite count: 0
type: Question
has title: Having trouble with a jar file I have created
has comment: http://stackoverflow.com/comment/37457149
tagged with: jar
upvote count: 1
has comment: http://stackoverflow.com/comment/37457283
has body: I have created a class file where there are some methods which I need to use in other projects. I have tried to "export" the file and create a "JAR file" and there is no problem until this point. I have tried to import the "JAR file" in another project and I used te command "Build Path". The problem is that when I create the class object which is into the JAR File I cannot use any methods I have built for that object. Can anyone help me, please ? Thank you!
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/24159245
tagged with: log4j
has body: One of the advantages of using something like slf4j is that it avoids String concatenation by using parameterized logging. However how do you avoid the performance hit when you have a long log message? logger.debug("This is a very long message that prints two values." + " However since the message is long, we still incur the performance hit" + " of String concatenation when logging {} and {} ", value1, value2); Is there any way to avoid this performance cost, without using an ugly if block to check the log level? if (logger.isDebugEnabled()) { logger.debug("This is a very long message that prints two values." + " However since the message is long, we still incur the performance hit" + " of String concatenation when logging {} and {}", value1, value2); }
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24159291
upvote count: 1
has answer: http://stackoverflow.com/a/24159291
favorite count: 0
tagged with: slf4j
type: AnsweredQuestion
has title: Avoid String concatenating for large log messages
score: 1
tagged with: java

http://stackoverflow.com/a/24118246
has comment: http://stackoverflow.com/comment/37210768
has body: This is how shared libray is referenced. Logon to the Websphere Application Server console. Go to Environment -> Shared Libraries Create your own Shared Library. Add the classpath pointing to your JAR files. Apply and save this configuration. Now, Go to Servers -> Application Servers -> Select the server-> Java and Process Management -> ClassLoader. Click on that class loader. Click on the Shared Library References Click on Add. Add your shared library. Save and restart Websphere Servers.
has comment: http://stackoverflow.com/comment/37208798
has comment: http://stackoverflow.com/comment/83020866
type: Answer
has comment: http://stackoverflow.com/comment/37254288
upvote count: 15
score: 15
downvote count: 0
has comment: http://stackoverflow.com/comment/37246915
answers question: http://stackoverflow.com/q/24117960

http://stackoverflow.com/comment/37311208
score: 0
comment on: http://stackoverflow.com/a/24170091
type: Comment
type: AnswerComment
has text: Sure, Check out [IndexSearcher itself](http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/3.0.0/org/apache/lucene/search/IndexSearcher.java#IndexSearcher.search%28org.apache.lucene.search.Weight%2Corg.apache.lucene.search.Filter%2Cint%2Corg.apache.lucene.search.Sort%2Cboolean%29). Under the covers, it uses a collector to collect hits using the method I've recommended. It can be used if you need to have more control over the process, I suppose, but if you just need to run a search and get results, it's generally not necessary to use it directly.

http://stackoverflow.com/q/24216931
tagged with: swing
has body: What I am trying to accomplish is to take a pre-defined file path and display every folder and file within that file path inside of a JTree. Simply; Folder1 Folder2 Folder3a -&gt;File3a -&gt;File2a -&gt;File2b What I have so far is the following: public class GUI extends JPanel { public GUI() { super(new GridLayout(1, 2, 20, 0)); setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (final Exception ignored) { } final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setContentPane(this); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } I would love some direction on how to proceed. Everything this far has been a compilation of a ton of readings I have gone through, and I'm not really sure how to accomplish what I want.
duplicate of: http://stackoverflow.com/q/14831901
has comment: http://stackoverflow.com/comment/37394834
has comment: http://stackoverflow.com/comment/37395371
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/14831901
has answer: http://stackoverflow.com/a/24217137
type: Question
type: UnansweredQuestion
has title: How can I display the contents of a folder in a JTree?
answer count: 1
tagged with: user-interface

http://stackoverflow.com/a/24152835
type: Answer
has body: Start by breaking your code down into reusable chunks For example, you could try keeping your coordinates within one or more, multi-dimensional arrays... int[][] xPoints = {{1,1,4,4}, {...}}; int[][] yPoints = {{1,4,1,4}, {...}}; And then use a for-loop to paint them... for (int index = 0; index &lt; xPoints.length; index++) { int[] x = xPoints[index]; int[] y = yPoints[index]; page.fillPolygon(x,y,x.length); } Now, I don't know about, but this get's really hard to manage as the number of elements increases... Another idea might be to create a simple "helper" class which focus on managing a single element... You could start with a simple interface which simply knows how to paint itself, for example... public interface PolyPainter { public void paint(Graphics g); } The create implementations that are self contained portions of the whole... public class PolyHelper implements PolyPainter { private int[] xPoints; private int[] xPoints; public PolyHelper() { } public PolyHelper(int[] xPoints, int[] yPoints) { this.xPoints = xPoints; this.yPoints = yPoints; } public void paint(Graphics g) { if (xPoints != null &amp; yPoints != null) { g.fillPolygon(xPoints, yPoints , xPoints.length); } } } Then you could either create each instance as you need to... PolyHelper helper = new PolyHelper(new int[]{1,1,4,4}, new int[]{1,4,1,4}); Or create specialty classes... public class TopPart extends PolyHelper { public TopPart() { super(new int[]{1,1,4,4}, new int[]{1,4,1,4}); } } In either case, you could then manage these classes in either a List or an array... public class ShadowApplet extends Applet private List&lt;PolyPainter&gt; polyPainters = new ArrayList&lt;&gt;(25); public void init() { polyPainers.add(new PolyHelper(new int[]{1,1,4,4}, new int[]{1,4,1,4})); polyPainers.add(new TopPart()); //... } Then you would simply need iterate the list to paint them... public void paint(Graphics g) { super.paint(g); for (PolyPainter painter : polyPainters) { painter.paint(g); } } Now having…
answers question: http://stackoverflow.com/q/24152414
downvote count: 0
has comment: http://stackoverflow.com/comment/37280706
upvote count: 1
score: 1

http://stackoverflow.com/a/24157755
answers question: http://stackoverflow.com/q/24141988
type: Answer
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/138527630
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24141988
has comment: http://stackoverflow.com/comment/69516216
has body: I've tested your code with version 53.1 and got correct Turkish output. I then retested with version 3.4.4 and got English output as you described in your question. Most likely, you are pulling in an older version through a transitive maven dependency.

http://stackoverflow.com/a/24206211
answers question: http://stackoverflow.com/q/24205631
type: Answer
has body: It seems from the comments that your Java program has the responsibility of joining, on the client side, information from two different data bases. This is notoriously difficult, especially when both data bases are large. In cases where there are a lot of changes to the data are going on, you're going to have a hard time producing consistent results. This may be OK, but you have to program defensively around the data changing underneath your process. I would, if I were you, start my program by retrieving all the name / id pairs from the stm database connection. I would put them in a HashMap. Then while reading from the rs result set I would look up the ids from the names in the HashMap. This strategy will cost some memory but will eliminate the nested query. Here is a sketch of the code. It is not debugged. I don't have time to debug it for you, sorry to say. If you're going to put this in your program you need to understand it well enough to debug it. /* preload name and empID values into a hashmap */ HashMap&lt;String, Integer&gt; name_id = new HashMap&lt;String, Integer&gt;(); String query = "SELECT name, empID from Employee"; rs2 = stm.executeQuery(query); while (rs2.next()) { String name = rs2.getString("name"); Integer id = rs2.getInteger("empID); name_id.put(name, id); } rs2.close(); /* loop over the result set from the other database */ while(rs.next()) { String name = rs.getString("name"); Integer empID = name_id.get(name); } Here the name_id.get() function takes the place of the query in your question. Because you have preloaded all the name/id pairs into memory, this will be very fast compared to a query for each row in your rs resultset.
score: 0

http://stackoverflow.com/a/24146520
has body: change executeQuery() to executeUpdate() which returns either the row count if the update is successful else zero, invoke conn.commit()
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24146089
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24176343
tagged with: device
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24176435
type: Question
has body: I have a problem wherein I can't run my project on my device, I use an active device because pc is slow. My project is a simple calculator and it should run from android 2.3.3 up to 4.2 jellybean. I've set the minimum required sdk API 10 android 2.3.3 Gingerbread and the target API 18 Android 4.3 Jellybean. Also should I compile it with API 10 android 2.3.3? or API 18 Android 4.1 Jellybean? So I've chosen still the API 10 android 2.3.3 and I created this class. package main; import com.Foracles.R; import android.os.Bundle; import android.app.Activity; public class Main extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } THE XML: <?xml version="1.0" encoding="utf-8"?> MANIFEST: <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" /> First I got the error about buffer exception etc. then I searched it on the net said I should add support library from android tools and it is done. But when I run it it says this: [2014-06-13 12:06:39 - Foracles] Performing sync [2014-06-13 12:06:39 - Foracles] Uploading Foracles.apk onto device '430841b9' [2014-06-13 12:06:39 - Foracles] Installing Foracles.apk... [2014-06-13 12:06:43 - Foracles] Success! [2014-06-13 12:06:44 - Foracles] \Foracles\bin\Foracles.apk installed on device [2014-06-13 12:06:44 - Foracles] Done! I had used my device recently on another project but it doesn't have the condition like this wherein it installs the apk on my device but it doesn't show up or run automatically.
tagged with: android
has comment: http://stackoverflow.com/comment/37317424
has comment: http://stackoverflow.com/comment/37317640
tagged with: manifest
accepted answer: http://stackoverflow.com/a/24176435
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Application won't run on active device (Samsug Galaxy grand 2)
score: 0

multithreading
tags question: http://stackoverflow.com/q/24111441
tags question: http://stackoverflow.com/q/24188963
tags question: http://stackoverflow.com/q/24108380
tags question: http://stackoverflow.com/q/24122100
tags question: http://stackoverflow.com/q/24224372
tags question: http://stackoverflow.com/q/24241335
tags question: http://stackoverflow.com/q/24117284
tags question: http://stackoverflow.com/q/24235251
tags question: http://stackoverflow.com/q/24140069
tags question: http://stackoverflow.com/q/24253298
tags question: http://stackoverflow.com/q/24177275
tags question: http://stackoverflow.com/q/24169223
tags question: http://stackoverflow.com/q/24165097
tags question: http://stackoverflow.com/q/24158250
type: Tag
tags question: http://stackoverflow.com/q/24154321
tags question: http://stackoverflow.com/q/24239172
tags question: http://stackoverflow.com/q/24110884
tags question: http://stackoverflow.com/q/24185921
tags question: http://stackoverflow.com/q/24220260
tags question: http://stackoverflow.com/q/24219785
tags question: http://stackoverflow.com/q/24255009
tags question: http://stackoverflow.com/q/24243170
tags question: http://stackoverflow.com/q/24172106
tags question: http://stackoverflow.com/q/24191762
tags question: http://stackoverflow.com/q/24252671
tags question: http://stackoverflow.com/q/24145137
tags question: http://stackoverflow.com/q/24254532
tags question: http://stackoverflow.com/q/24191195
tags question: http://stackoverflow.com/q/24111649
tags question: http://stackoverflow.com/q/24197177
tags question: http://stackoverflow.com/q/24145989
tags question: http://stackoverflow.com/q/24203612
tags question: http://stackoverflow.com/q/24205234
tags question: http://stackoverflow.com/q/24107907
tags question: http://stackoverflow.com/q/24110247
tags question: http://stackoverflow.com/q/24234799
tags question: http://stackoverflow.com/q/24202405
tags question: http://stackoverflow.com/q/24116858
tags question: http://stackoverflow.com/q/24168672
tags question: http://stackoverflow.com/q/24193508
tags question: http://stackoverflow.com/q/24153504
tags question: http://stackoverflow.com/q/24140523
tags question: http://stackoverflow.com/q/24144655
tags question: http://stackoverflow.com/q/24248699
tags question: http://stackoverflow.com/q/24162758
tags question: http://stackoverflow.com/q/24171426
tags question: http://stackoverflow.com/q/24133037
tags question: http://stackoverflow.com/q/24190125
tags question: http://stackoverflow.com/q/24205270
tags question: http://stackoverflow.com/q/24161916
tags question: http://stackoverflow.com/q/24226933
tags question: http://stackoverflow.com/q/24168386
tags question: http://stackoverflow.com/q/24251610
tags question: http://stackoverflow.com/q/24220007
tags question: http://stackoverflow.com/q/24258937
tags question: http://stackoverflow.com/q/24200936
tags question: http://stackoverflow.com/q/24226661
tags question: http://stackoverflow.com/q/24262956
tags question: http://stackoverflow.com/q/24178900
tags question: http://stackoverflow.com/q/24229521
tags question: http://stackoverflow.com/q/24138186
tags question: http://stackoverflow.com/q/24234968
tags question: http://stackoverflow.com/q/24175558
tags question: http://stackoverflow.com/q/24241960
tags question: http://stackoverflow.com/q/24166747
tags question: http://stackoverflow.com/q/24247776
tags question: http://stackoverflow.com/q/24130382
tags question: http://stackoverflow.com/q/24163900
tags question: http://stackoverflow.com/q/24234977
tags question: http://stackoverflow.com/q/24169879
tags question: http://stackoverflow.com/q/24130604
tags question: http://stackoverflow.com/q/24228778
tags question: http://stackoverflow.com/q/24194267
tags question: http://stackoverflow.com/q/24112872
tags question: http://stackoverflow.com/q/24116468
tags question: http://stackoverflow.com/q/24226634
tags question: http://stackoverflow.com/q/24153152
tags question: http://stackoverflow.com/q/24145528
tags question: http://stackoverflow.com/q/24177601

http://stackoverflow.com/comment/37346120
score: 1
type: Comment
has text: That's bizarre. That was the first thing I tried and it didn't work, so I placed a few all over the place and it worked. Thanks a lot.
type: AnswerComment
comment on: http://stackoverflow.com/a/24191796

http://stackoverflow.com/a/24195092
answers question: http://stackoverflow.com/q/24195072
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/24195072
has body: There are multiple valid ways to construct a Scanner. Take a look at the documentation to see all of them. There is nothing wrong with the approach that you have shown in your question.
score: 5

http://stackoverflow.com/comment/37484117
has text: Duplicate of either [How can I convert a byte array into a double and back?](http://stackoverflow.com/questions/2905556/how-can-i-convert-a-byte-array-into-a-double-and-back) or [Best and efficient way to convert double value into a byte array in Java](http://stackoverflow.com/questions/14062904/best-and-efficient-way-to-convert-double-value-into-a-byte-array-in-java) which both suggest to use `ByteBuffer` if you do not want to convert `double` to `long` and `long` to `byte[]` manually.
type: QuestionComment
comment on: http://stackoverflow.com/q/24263713
score: 0
type: Comment

http://stackoverflow.com/q/24230511
score: 0
accepted answer: http://stackoverflow.com/a/24231028
has body: I have created a MusicService in my app, started the service and it doesn't play. I have started the service from my main menu, and added it(the Service) to the manifest, i have read several posts about it and none has helped so far.(it extends service) class MusicService extends Service { MediaPlayer mediaPlayer; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { mediaPlayer = MediaPlayer.create(this, R.raw.song); mediaPlayer.setLooping(true); mediaPlayer.setVolume(100, 100); } @Override public int onStartCommand(Intent intent, int flags, int startId) { try { mediaPlayer.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (!mediaPlayer.isPlaying()) { mediaPlayer.start(); } else if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); } return 1; } and the call from the Main Screen: Intent music = new Intent(this, MusicService.class); startService(music); and the service declaration on the manifest: &lt;service android:name="com.example.trviaForBagrut.MusicService" android:enabled="true" /&gt;
answer count: 1
has title: Music Service doesn't play
type: Question
has answer: http://stackoverflow.com/a/24231028
tagged with: android
tagged with: java
tagged with: eclipse
type: AnsweredQuestion

http://stackoverflow.com/comment/37290162
has text: That's a nice place to popup the 'do you really want to exit?' dialog, too.
score: 0
comment on: http://stackoverflow.com/q/24161248
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24111349
has answer: http://stackoverflow.com/a/24132316
has answer: http://stackoverflow.com/a/24378476
has comment: http://stackoverflow.com/comment/37398901
type: AnsweredQuestion
upvote count: 1
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/24378476
has comment: http://stackoverflow.com/comment/37402158
accepted answer: http://stackoverflow.com/a/24132316
has title: codility challenge, test case OK , Evaluation report Wrong Answer
has body: the aluminium 2014 gives me wrong answer [3 , 9 , -6 , 7 ,-3 , 9 , -6 , -10] got 25 expected 28 but when i repeated the challenge with the same code and make case test it gives me the correct answer Your test case [3, 9, -6, 7, -3, 9, -6, -10] : NO RUNTIME ERRORS (returned value: 28) what is the wrong with it ??? the challenge :- A non-empty zero-indexed array A consisting of N integers is given. A pair of integers (P, Q), such that 0 ≤ P ≤ Q &lt; N, is called a slice of array A. The sum of a slice (P, Q) is the total of A[P] + A[P+1] + ... + A[Q]. The maximum sum is the maximum sum of any slice of A. For example, consider array A such that: A[0] = 3 A[1] = 2 A[2] = -6 A[3] = 3 A[4] = 1 For example (0, 1) is a slice of A that has sum A[0] + A[1] = 5. This is the maximum sum of A. You can perform a single swap operation in array A. This operation takes two indices I and J, such that 0 ≤ I ≤ J &lt; N, and exchanges the values of A[I] and A[J]. To goal is to find the maximum sum you can achieve after performing a single swap. For example, after swapping elements 2 and 4, you will get the following array A: A[0] = 3 A[1] = 2 A[2] = 1 A[3] = 3 A[4] = -6 After that, (0, 3) is a slice of A that has the sum A[0] + A[1] + A[2] + A[3] = 9. This is the maximum sum of A after a single swap. Write a function: class Solution { public int solution(int[] A); } that, given a non-empty zero-indexed array A of N integers, returns the maximum sum of any slice of A after a single swap operation. For example, given: A[0] = 3 A[1] = 2 A[2] = -6 A[3] = 3 A[4] = 1 the function should return 9, as explained above. and my code is :- import java.math.*; class Solution { public int solution(int[] A) { if(A.length == 1) return A[0]; else if (A.length==2) return A[0]+A[1]; else{ int finalMaxSum = A[0]; for (int l=0 ; l&lt;A.length ; l++){ for (int k = l+1 ; k&lt;A.length ; k++ ){ int [] newA = A; int temp = newA[l]; newA [l] = newA[k]; newA[k]=temp; int maxSum = newA[0]; int current_max = newA[0]…
has comment: http://stackoverflow.com/comment/39955811
favorite count: 0
type: Question
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/37196723

http://stackoverflow.com/q/24121478
tagged with: java
has title: MySQL insert with auto increment
has answer: http://stackoverflow.com/a/24121529
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24121507
answer count: 3
score: 0
tagged with: mysql
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24121899
has answer: http://stackoverflow.com/a/24121899
has body: Im trying to insert some data from my application into my database, but I keep getting the error stated below. I have 4 columns in my table and one is set to auto increment. I suspect that is causing the error. Can anyone help me out with this? Table Columns: Id (auto increment), userID(generated from application), username, name Code: String sql = "insert into details values (?, ?, ?)"; PreparedStatement preparedStatement = connect.prepareStatement(sql); preparedStatement.setInt(1, userID); preparedStatement.setString(2, username); preparedStatement.setString(3, name); preparedStatement.executeUpdate(); preparedStatement.executeUpdate(sql); Error: 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 '?, ?, ?)' at line 1
has answer: http://stackoverflow.com/a/24121507

http://stackoverflow.com/comment/37302642
has text: Java's `float` is a IEEE float, with 24 bits of precision (23 actual bits plus one implied `1` bit). Its `double` is 53 bits of precision (52 actual bits plus one implied `1` bit). If I remember correctly, C++ `double`s are also IEEE, which explains why the output is the same if `double`s are used in Java too.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24168449
type: AnswerComment

http://stackoverflow.com/q/24171195
answer count: 1
tagged with: jfreechart
type: Question
tagged with: jasper-reports
type: UnansweredQuestion
has title: Jaspersoft studio duplicated bar series
has body: I am using Jaspersoft Studio 5.5.2. I need to change the color of a single bar from its series default. I've found how to create and assign a customizer class and also how to create my own bar renderer and override it as well. The problem is, as soon as I do this the chart displays a duplicate series of bars shifted to the right and slightly lower on the Y scale. At first I thought this was a shadow of some sort but the getItemPaint method is being called twice for every row,column combination. My Customizer and Renderer (simplified, but tested to show same affect) public class BarCustomizer extends JRAbstractChartCustomizer{ public void customize(JFreeChart chart, JRChart jasperChart){ CategoryPlot plot = (CategoryPlot) chart.getPlot(); MyBarRenderer newRenderer = new MyBarRenderer(); plot.setRenderer(newRenderer); } } class MyBarRenderer extends BarRenderer { public MyBarRenderer() {} @Override public Paint getItemPaint(final int row, final int column) { if (column == 17) return Color.red; return super.getItemPaint(row, column); } } I'd like to show images of the 'good' and 'bad' charts, but don't have sufficient reputation, sorry. Commenting the plot.setRenderer(newRenderer) will generate a proper chart but without the bar highlighting that I need. Does anyone know how I can provide a customizer that overrides the BarRenderer without getting this crazy extra series? I've tried a million things and searched with no success.
score: 0
has answer: http://stackoverflow.com/a/24189722
tagged with: java

http://stackoverflow.com/comment/37247091
type: Comment
type: QuestionComment
has text: Did you try with `JSP`?
score: 2
comment on: http://stackoverflow.com/q/24139122

http://stackoverflow.com/q/24259577
upvote count: 1
score: 1
answer count: 1
tagged with: maven
favorite count: 0
tagged with: unit-testing
tagged with: resources
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37475768
tagged with: java
has comment: http://stackoverflow.com/comment/37475800
has title: Java unit test cannot access resource from application project
has comment: http://stackoverflow.com/comment/37476175
tagged with: eclipse
has body: The unit tests are located in a different project than the actual application. If I run a method which references a resource, I do not find it from within the test. If I run the same method in the application, everything works fine. So far I tried these two approaches to get an URL to the resource: new URL("platform:/plugin/application/res/its_name.xml") and this.getClass().getResource("/its_name.xml"); Is there any simple way (in eclipse) to make the resource accessible to the test project, or do I need to put the test into the same project as the application? The folder structure is like this: application \src \packages \res tests \src
has comment: http://stackoverflow.com/comment/37476070
type: Question
has answer: http://stackoverflow.com/a/24259740
accepted answer: http://stackoverflow.com/a/24259740
downvote count: 0

http://stackoverflow.com/a/24212624
downvote count: 0
has comment: http://stackoverflow.com/comment/37386514
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24212445
has body: Maybe: class Base() { public: void setLabel(); protected: virtual void doSetLabel(); private: houseKeepingBefore(); houseKeepingAfter(); } void Base::setLabel() { houseKeepingBefore(); doSetLabel(); houseKeepingAfter(); } But, this will not solve your problem, if you have a houseKeepingInbetween.

http://stackoverflow.com/comment/37406553
has text: @Squonk What GabeSechan said. I didn't know that. Try, however, just killing it with a simple kill -9. It will restart.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24222968
type: Comment

http://stackoverflow.com/q/24112129
linked to: http://stackoverflow.com/q/7056749
downvote count: 1
has comment: http://stackoverflow.com/comment/37197358
favorite count: 0
type: Question
has body: Could someone show me what i'm doing wrong, this part of code should scan for name of restaurant, menu name and names of menu items and their prices, but it's giving me some sort of exception, also it seems to skip completely the first scan, just jumps to second, ideally it should scan for 1 resturant that has 1 menu and that contains 2 menu items with their names and prices String newRestaurant, newMenu; String[] newMenuItem = { "", "" }; double[] price = {0.0, 0.0}; int x = 0; System.out.println("---------------------------------------"); System.out.println("CREATE A RESTAURANT, MENUS, and MENU ITEMS:"); System.out.println("Please input the name of the new Restaurant:"); newRestaurant = scan.nextLine(); System.out.println("What is the name of the Menu you wish to create (type 'none', if you are done):"); newMenu = scan.nextLine(); if (newMenu == "none") System.out.println("Saving entry..."); else { System.out.println("What is the name of the Menu item you wish to create (type 'none', if you are done):"); newMenuItem[x] = scan.nextLine(); if(newMenu != "none") { System.out.println("What is the price?"); price[x]= scan.nextDouble(); x++;
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37197755
tagged with: exception
has answer: http://stackoverflow.com/a/24112518
has comment: http://stackoverflow.com/comment/37197359
score: -1
has comment: http://stackoverflow.com/comment/37197317
has title: Java, using scanner, exception
has comment: http://stackoverflow.com/comment/37197454
upvote count: 0
has comment: http://stackoverflow.com/comment/37197389
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37197414
has comment: http://stackoverflow.com/comment/37197405
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37197329

jackson-modules
type: Tag
tags question: http://stackoverflow.com/q/24188589
tag name: jackson-modules

http://stackoverflow.com/comment/37251154
has text: I strongly recommend using a better tutorial.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24141076
score: 0

gwt-designer
type: Tag
tags question: http://stackoverflow.com/q/24208710
tag name: gwt-designer

http://stackoverflow.com/comment/37368024
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24203042
score: 0
has text: Oppss!! Agree.Need to spend more time With JavaDoc. _Thanks for the clarification._ (_By the way +10 for your answer_)

http://stackoverflow.com/comment/37434585
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24237490
has text: Yes appreciate that, but I have to connect using Bluetooth RFCOMM socket. I have refereed Bluetooth chat application of android. In that insecure connection is possible. Same thing I have do it for laptop Bluetooth .
score: 0

http://stackoverflow.com/a/24241540
has body: Keep a shared variable between the two functions. Then you can use it as while(rs.next() &amp;&amp; isEnabled){ }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37441289
answers question: http://stackoverflow.com/q/24241209

http://stackoverflow.com/comment/37373588
comment on: http://stackoverflow.com/q/24206022
score: 0
has text: sorry I had TextView tv; under where I defined ListView, but I still get error:The method SetText(String) is undefined for the type TextView from that line of code
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24123622
has comment: http://stackoverflow.com/comment/37225791
has comment: http://stackoverflow.com/comment/37225844
type: Answer
has comment: http://stackoverflow.com/comment/37225939
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37225899
accepted answer of: http://stackoverflow.com/q/24123373
has body: The TCP connection is full-duplex. There are two independent byte streams, one in each direction. You can close the write half of the connection , this is called half-close. Any data currently in the socket send buffer will be sent, followed by TCP's normal connection termination sequence. The server will read 0 bytes then in a call to recv what indicates shutdown from client side. I am not a Java expert but quick googling is telling me that shutdownOutput() function is what you are using in Java to close sending half of the connection. http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#shutdownOutput()
answers question: http://stackoverflow.com/q/24123373

http://stackoverflow.com/comment/37408726
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24224272
has text: To display a java.util.Date using the current machine's local date format, pass the Date object to the [format](http://docs.oracle.com/javase/8/docs/api/java/text/DateFormat.html#format-java.util.Date-) method of `DateFormat.getDateInstance(DateFormat.SHORT)`.
score: 0

http://stackoverflow.com/comment/37379031
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24208641
type: Comment
has text: @LuiggiMendoza Your suggestion gives a warning (rawtype). Is that normal, expected?

http://stackoverflow.com/comment/37207191
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24117547
type: Comment
has text: @GermannArlington i added my reason in the question

http://stackoverflow.com/comment/37324193
type: AnswerComment
has text: As a double, they're *exactly* equal. As a BigDecimal, they're not.
score: 0
comment on: http://stackoverflow.com/a/24180355
type: Comment

http://stackoverflow.com/comment/37405750
has text: Note that what happens on a failed cast is not an "error", but an exception that can be caught. Do not assume you cannot do something just because you want to continue processing after an exception it can throw. I do agree that instanceof is better for class checks.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24222419

http://stackoverflow.com/comment/37368437
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24199148
has text: When getting really weird errors, I wouldn't trust the Eclipse compiler (yet). Try to doublecheck it with other IDE or the javac compiler. Eclipse's Java 8 support seems to be rather buggy in edgecases.

http://stackoverflow.com/comment/37359797
comment on: http://stackoverflow.com/a/24198809
type: Comment
has text: is there anything similar to substring for arraylists?
score: 0
type: AnswerComment

http://stackoverflow.com/q/24251119
has comment: http://stackoverflow.com/comment/37460859
has comment: http://stackoverflow.com/comment/37460245
has body: Here is my html: Beer Selection Page Select beer Characteristics Color: light amber brown dark Here is my xml: <?xml version="1.0" encoding="UTF-8"?> Test2 Ch3 beer BeerSelect Ch3 beer /SelectBeer.do And here, is my servlet: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; /** * Servlet implementation class BeerSelect */ public class BeerSelect extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public BeerSelect() { // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text.html"); PrintWriter out = response.getWriter(); out.println("Beer Selection Advice"); String c= request.getParameter("color"); out.println("Got beer color " + c); } } And when I run it on the server, the response is HTTP Status 404 - /Test2/ type Status report message /Test2/ description The requested resource is not available. Test2 .....Java Resources ...................src ......................default package .....................................BeerSelect.java .....WebContent ...............META-INF ...............WEB-INF ......................lib ......................web.xml ...............Beer.html Also, does anybody know why the returned String "c" in the servlet is null??
has comment: http://stackoverflow.com/comment/37465347
duplicate of: http://stackoverflow.com/q/11731377
tagged with: java
has answer: http://stackoverflow.com/a/24251538
has comment: http://stackoverflow.com/comment/37460678
has answer: http://stackoverflow.com/a/24251530
accepted answer: http://stackoverflow.com/a/24251530
has comment: http://stackoverflow.com/comment/37460450
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/11731377
has title: Why my servlet doesn't run?
possible better answer: http://stackoverflow.com/a/24251538
tagged with: servlets
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 0
answer count: 2

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/24158331
tags question: http://stackoverflow.com/q/24155628
type: Tag
tags question: http://stackoverflow.com/q/24130815
tags question: http://stackoverflow.com/q/24200663

http://stackoverflow.com/comment/37244918
type: QuestionComment
has text: @Simeon I can't really tell what is wrong, but is it possible for you to move that part of the configuration to Java Config? It will make the code a a lot easier to read and possible easier to debug
comment on: http://stackoverflow.com/q/24137505
score: 1
type: Comment

http://stackoverflow.com/comment/37277822
score: 0
type: Comment
type: QuestionComment
has text: I am now able to startup both the standalone client and as a JConsole plugin. However, in both instances, i see "LoggerContext: sun.misc.Launcher$AppClassLoader@3b26456a", as opposed to the "LoggerContext: AsyncLoggerContext". And also, nothing is displayed under the StatusLogger tab. When I click on the Configuration Tab, and click on Reconfigure from Location, StatusLogger tab is refreshed with the a bunch of warnings:
comment on: http://stackoverflow.com/q/24121921

http://stackoverflow.com/q/24211266
tagged with: jpanel
has comment: http://stackoverflow.com/comment/37384278
type: AnsweredQuestion
tagged with: keyevent
upvote count: 2
score: 1
accepted answer: http://stackoverflow.com/a/24211559
tagged with: java
has title: Delay between pressing a key and the key being read as held down
answer count: 1
has answer: http://stackoverflow.com/a/24211559
linked to: http://stackoverflow.com/q/7439382
tagged with: swing
downvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7940173
has body: I have noticed that while holding a key down, there is a short delay between the key being read as being held down. What I mean is this; hold down any key and observe closely. The pattern goes like this: h.....hhhhhhhhhhhhhhhhhhhhhh where . symbolizes a pause. This is fine, because when we type, it would be harder trying to write a single letter e.g. 'i'. But what if we want to make a game? I mean, we wouldn't like the delay. This is exacly my problem. So now, let me show you my code: import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JPanel; public class Tutorial3{ static MyPanel panel; public static void main(String[] agrs){ createAndStartGui(); new gameplay(); } static void createAndStartGui(){ JFrame f = new JFrame("tutorial 3"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().setPreferredSize(new Dimension(500, 300)); f.addKeyListener(new MyKeyListener()); panel = new MyPanel(); f.add(panel); f.pack(); f.setVisible(true); } } class gameplay { static String current_key = "stop"; public gameplay(){ begin(); } void begin(){ while (true){ try { Thread.sleep(100); } catch (InterruptedException ex) { Logger.getLogger(Tutorial3.class.getName()).log(Level.SEVERE, null, ex); } Tutorial3.panel.user.move(current_key); Tutorial3.panel.repaint(); System.out.println(current_key); current_key = "stop"; } } static void key_event(){ } } class MyKeyListener extends KeyAdapter{ public void keyPressed(KeyEvent e){ int keyCode = e.getKeyCode(); switch(keyCode){ case KeyEvent.VK_UP: gameplay.current_key = "up"; break; case KeyEvent.VK_DOWN: gameplay.current_key = "down"; break; case KeyEvent.VK_LEFT: gameplay.current_key = "left"; break; case KeyEvent.VK_RIGHT: gameplay.current_key = "right"; break; default: gameplay.current_key = "stop"; } } } class MyRectan…
tagged with: animation

osx-mavericks
type: Tag
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/24235485
tags question: http://stackoverflow.com/q/24193384

http://stackoverflow.com/comment/37277384
has text: The `Serializable` interface is merely a marker interface. From the perspective of the application server and sticky sessions, one should mark session attributes as Serializable for replication and clustering.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24154954

http://stackoverflow.com/comment/37494550
comment on: http://stackoverflow.com/a/24266460
has text: i used the ip address of the computer which was running the server in my client app,("rmi://ip address of the server computer:1099/Hello"); The problem is when i use the public ip address of the server computer i'm unable to connect. As i said i'm quite new to programming so please be kind enough to give me some detailed answer.Tnx
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37291951
comment on: http://stackoverflow.com/q/24162637
type: Comment
score: 0
has text: Yes, first stream - is parallel.
type: QuestionComment

http://stackoverflow.com/q/24121302
has title: How to set JMS_IBM_MQMD_ACCOUNTINGTOKEN in JMSMessage
type: Question
tagged with: ibm-mq
has body: After processing a message I need to set the Accounting Token on the msg. How do I set it in the outbound message. I have tried the following and it does not work msg.setObjectProperty(JmsConstants.JMS_IBM_MQMD_ACCOUNTINGTOKEN,value) where value set is a byte[]. But when I observe the message the AccountingToken is not getting set. Is there something I am missing over here?
has comment: http://stackoverflow.com/comment/37249344
accepted answer: http://stackoverflow.com/a/24158227
possible better answer: http://stackoverflow.com/a/24123552
has answer: http://stackoverflow.com/a/24158227
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24123552
answer count: 2
tagged with: java
tagged with: jms

http://stackoverflow.com/a/24234100
answers question: http://stackoverflow.com/q/24234054
downvote count: 0
score: 7
upvote count: 7
has body: It's mouseClicked not mouseClick Small spelling mistake?
type: Answer
has comment: http://stackoverflow.com/comment/37427118

http://stackoverflow.com/q/24174484
has comment: http://stackoverflow.com/comment/37314380
tagged with: android
has comment: http://stackoverflow.com/comment/37314427
has comment: http://stackoverflow.com/comment/37314367
has comment: http://stackoverflow.com/comment/37314284
type: AnsweredQuestion
score: 0
tagged with: nullpointerexception
has title: Button used to close dialog throws nullpointerexception
tagged with: dialog
accepted answer: http://stackoverflow.com/a/24174718
tagged with: java
answer count: 1
tagged with: button
has answer: http://stackoverflow.com/a/24174718
has body: I have a dialog that comes up that will display images. I have a button inside the dialog that is supposed to close the dialog, so it is an exit button. When it is pressed, I get a null pointer exception. Here is my code containing the dialog: buildMoreButton = (Button) findViewById(R.id.buildMore); buildMoreButton.setText("BUILD"); buildMoreButton.setBackgroundColor(-65536); buildMoreButton.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { buildMoreButton.setBackgroundColor(-1); }//end if else if (event.getAction() == MotionEvent.ACTION_UP) { buildMoreButton.setBackgroundColor(-65536); }//end else if //open dialog for building choices buildingSelect = new Dialog(runGraphics.this); buildingSelect.setContentView(R.layout.dialog); buildingSelect.setTitle("Building Selection"); exit = (Button) findViewById(R.id.exit); exit.setText("X"); exit.setBackgroundColor(-65536); exit.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { exit.setBackgroundColor(-1); }//end if else if (event.getAction() == MotionEvent.ACTION_UP) { exit.setBackgroundColor(-65536); }//end else if buildingSelect.dismiss(); return false; }//end onTouch });//end OnTouchListener colonyHut = (ImageView) findViewById(R.id.colonyHut); buildingSelect.show(); return false; }//end onTouch function });//end OnTouchListener Here is the xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/colonyHut" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/mainhut" /&gt; &lt;Button android:id="@+id/exit" android:layout_width="wrap_content" android:layout_height=…
type: Question
has comment: http://stackoverflow.com/comment/37314307
has comment: http://stackoverflow.com/comment/37314349

http://stackoverflow.com/q/24146890
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37262071
answer count: 1
tagged with: sax
favorite count: 0
has comment: http://stackoverflow.com/comment/37315869
has title: SAX Parser, how to dynamically ignore & in input xml file for SAXParser.parse
has answer: http://stackoverflow.com/a/24175973
has body: I have a scenario where I get an XML from another service and I parse this file and render it to another file. But, sometimes, we get &amp; in the input file inside any tag and when we try to parse this file we get SAXException. Is there a way we can dynamically replace &amp;, or we can ignore the &amp; sign while parsing?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37262465
tagged with: parsing
type: Question
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37403658
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24221753
has text: What is "wild card" in Java? Capture-of is the `?`. Template type is the `T`, but could also by `TYPE` or `FRED`.
score: 0

http://stackoverflow.com/comment/66326066
type: AnswerComment
type: Comment
has text: Why using this line gives me a, **method addEventFilter in class Scene cannot be applied to given types; required: EventType<T>,EventHandler<? super T> found: int,(event)->S[...]de())** compile time error
comment on: http://stackoverflow.com/a/24126049
score: 0

http://stackoverflow.com/q/24137446
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24137509
favorite count: 0
has comment: http://stackoverflow.com/comment/37244637
type: Question
has title: What is better ? Using a double backward slash ('\\') as file seperator or Files.seperator to remove O.S. Dependency while working with files in java
tagged with: filesystems
answer count: 2
upvote count: 2
type: UnansweredQuestion
has body: So i have made an application which performs some reading/writing to files. I want to make the Path Traversal as independent of O.S. Different operating systems use different characters as file separators. For example, Microsoft Windows systems use "\", while UNIX systems use "/". When applications have to run on different platforms, the use of hardcoded file separators can lead to incorrect execution of application logic. So i came up with using a double backward slash '\\'. But now i came to that i can use public static final String FILE_SEPARATOR = System.getProperty("file.separator"); public static final String PATH_SEPARATOR = System.getProperty("path.separator"); reference here http://www.javapractices.com/topic/TopicAction.do?Id=38. Am i wrong ? What is the correct way ?
has answer: http://stackoverflow.com/a/24137652
score: 2

http://stackoverflow.com/comment/37233587
type: Comment
has text: Have you tried using `Calendar`? Or [JodaTime](http://www.joda.org/joda-time/)? Or [Java 8's `java.time`](http://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html)?
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/24131507

http://stackoverflow.com/q/24182367
possible better answer: http://stackoverflow.com/a/36993908
tagged with: httpresponse
has answer: http://stackoverflow.com/a/36993908
answer count: 4
upvote count: 13
type: AnsweredQuestion
has title: How to add X-Content-Type-Options to tomcat configuration
downvote count: 0
tagged with: tomcat
favorite count: 0
score: 13
type: Question
tagged with: security
has answer: http://stackoverflow.com/a/47182147
accepted answer: http://stackoverflow.com/a/24182978
has comment: http://stackoverflow.com/comment/78469713
tagged with: mime-types
has answer: http://stackoverflow.com/a/26975461
has body: My client want me to fix Web App vulnerability of My Web App below is message about vulnerability of My Web App The Anti-MIME-Sniffing header X-Content-Type-Options was not set to 'nosniff' This check is specific to Internet Explorer 8 and Google Chrome. Ensure each page sets a >Content-Type header and the X-CONTENT-TYPE-OPTIONS if the Content-Type header is unknown Although I already found some solution to this issue , I am looking for solution from tomcat configuration. Is it possible to make changes to tomcat configuration to accomplish this? please give me any idea.
tagged with: java
has answer: http://stackoverflow.com/a/24182978

http://stackoverflow.com/a/24194332
has body: In addition to @David Xu answer I would also recommend using @NonNull annotation. This way you protecting yourself from having null pointer exception, by compile time testing. public PictureFrame(@NonNull final Bitmap pBitmap) { this.mBitmap = pBitmap; // Loaded externally, recycle() has not been called }
upvote count: 2
answers question: http://stackoverflow.com/q/24194218
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/37408254
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24224231
has text: Please try to provide a minimal example. Remove all unnecceray code e.g. all `System.out.println` calls. Maybe you find the error yourself by reducing the problem.
score: 2

http://stackoverflow.com/a/24258420
has comment: http://stackoverflow.com/comment/37473857
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37473536
has comment: http://stackoverflow.com/comment/37473689
has comment: http://stackoverflow.com/comment/37473727
score: 2
answers question: http://stackoverflow.com/q/24258162
has body: What about... Every ten seconds it will print your string and it doesnt need many changes! long ini = System.currentTimeMillis(); while ((s = stdInput.readLine()) != null) { refreshString = refreshString + s; if(System.currentTimeMillis() - ini &gt;= 10 * 1000){ ini = System.currentTimeMillis(); System.out.println(s); } } edited: sorry you meant every ten seconds! Hope it helps!
type: Answer

http://stackoverflow.com/comment/37476157
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24259800
has text: While navigating to the next activity pass the value of your edittext.

http://stackoverflow.com/comment/37221986
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24125303
has text: I have had running this fine on Jboss-4.2. I included proper jars for that in my classpath.

http://stackoverflow.com/a/24106117
has comment: http://stackoverflow.com/comment/37185828
accepted answer of: http://stackoverflow.com/q/24106024
type: Answer
answers question: http://stackoverflow.com/q/24106024
has body: We have a following cycle: while ((line = r.readLine()) != null) { total.append(line); } So, obviously, line equals to null in the end of it. Now, let's take a look at Writer#write(String) implementation. It invokes 3-argument version of the write() function which looks like so: public void write(String str, int offset, int count) throws IOException { if ((offset | count) &lt; 0 || offset &gt; str.length() - count) { throw new StringIndexOutOfBoundsException(str, offset, count); } char[] buf = new char[count]; str.getChars(offset, offset + count, buf, 0); synchronized (lock) { write(buf, 0, buf.length); } } If str is null then str.length() will fail with NullPointerException. I think what you need is outputStreamWriter.write(total.toString());, not the outputStreamWriter.write(line);.
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/37222775
comment on: http://stackoverflow.com/a/24123388
score: 2
type: AnswerComment
has text: ajc does indeed use the eclipse compiler.
type: Comment

http://stackoverflow.com/comment/37270445
type: Comment
has text: use `PreparedStatement` instead of `Statement`
type: AnswerComment
comment on: http://stackoverflow.com/a/24151113
score: 1

http://stackoverflow.com/comment/37369089
type: Comment
has text: hi @pingw33n got your point, still my question is, are there any way to remove this warning without using suppresswarning?
type: AnswerComment
comment on: http://stackoverflow.com/a/24202787
score: 0

http://stackoverflow.com/comment/37290905
type: QuestionComment
has text: Thank you ! Which viewport can I choose ? Can you explain me their role ?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24158256

http://stackoverflow.com/q/24210164
has answer: http://stackoverflow.com/a/24210217
has title: Creating my own Java Exception subclass
upvote count: 3
answer count: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24210249
favorite count: 0
type: Question
score: 3
has body: I am creating my own Exception class for a simple command line tool I created. Basically the purpose is to decide when a fatal Exception is thrown and to terminate the program in that case. So my ReconToolException class has a boolean flag to record a fatal Exception. However, my question is, what is the proper way to "throw" the Exception? Should I do it this way?: if(columnNumberForGroupByColumnFile1 == null || columnNumberForGroupByColumnFile2 == null || columnNumberForCountColumnFile1 == null || columnNumberForCountColumnFile2 == null ){ new ReconToolException("Can't find column number. Likely that there are unexpected headers in the CSV files. Check your CSV configuration enum .java files to see if they match the actual input CSV files."); } or should I do it the following way?: if(columnNumberForGroupByColumnFile1 == null || columnNumberForGroupByColumnFile2 == null || columnNumberForCountColumnFile1 == null || columnNumberForCountColumnFile2 == null ){ try { throw new ReconToolException("Can't find column number. Likely that there are unexpected headers in the CSV files. Check your CSV configuration enum .java files to see if they match the actual input CSV files."); } catch (ReconToolException e) { e.printStackTrace(); } } the former seems to require that I explicitly code a print out statement in my ReconToolException class to print the error to the command line. The latter will catch itself (which is very strange AND honestly seems incorrect) and will print out the stack trace in the catch block. The former seems to make more sense, but the latter seems to work better. Is there a correct way? here is the Exception class I created: public class ReconToolException extends Exception { private boolean isFatal; public ReconToolException() { // TODO Auto-generated constructor stub } public ReconToolException(boolean isFatalException, String msg) { super(msg); this.setFatal(isFatalException); } public ReconToolException(String message) { super(message); // TODO A…
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37381593
has answer: http://stackoverflow.com/a/74730710

http://stackoverflow.com/comment/37341894
has text: @dotnetnate depends on if you're sorting primitives or objects. Sorting an array of objects uses Timsort (a type of mergesort), and sorting primitives uses quicksort. So worst case could in fact be O(n lg n)
comment on: http://stackoverflow.com/a/24189546
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24256702
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/24256727
has answer: http://stackoverflow.com/a/24256794
linked to: http://stackoverflow.com/q/3177733
has comment: http://stackoverflow.com/comment/37470628
has answer: http://stackoverflow.com/a/24256785
has answer: http://stackoverflow.com/a/24256741
score: 2
accepted answer: http://stackoverflow.com/a/24256741
type: AnsweredQuestion
has title: How to pass value of more than one variable in jsp?
tagged with: java
possible better answer: http://stackoverflow.com/a/24256727
downvote count: 0
tagged with: jsp
has body: I want to pass values of two variables when a link is clicked to another page I am using query parameter but I am only able to send one variable through it. I know about session.setAttribute() but don't know how can I use it based upon links...Foreg: &lt;a href="Search.jsp?item=&lt;%=search%&gt;&lt;%session.setAttribute("val",value1);%&gt;" class="classname" style=" margin-top:20px;margin-left:800px;"&gt;&lt;p&gt; &lt; &lt;/p&gt;&lt;/a&gt; &lt;a href="Search.jsp?item=&lt;%=search%&gt;&lt;%session.setAttribute("val",value);%&gt;" class="classname1" &gt; &gt; &lt;/a&gt; This is my code I know its wrong..I just want is If I click on first link than value1 should be passed and If I click on 2nd link value should be passed.P.S.:I have already passes search variable through query parameter but now If I try to pass second parameter through session only the final value i.e second initialized value only counts? what to do? EDIT: suppose my code is this: &lt;form class="navbar-form navbar-right" action="Search.jsp" method="get"&gt; &lt;input type="text" class="form-control" placeholder="Search..." name="search"&gt; Here one variable search is passes through form How can I pass another variable value?should it be like: &lt;form class="navbar-form navbar-right" action="Search.jsp?item1=&lt;%=value%&gt;" method="get"&gt; &lt;input type="text" class="form-control" placeholder="Search..." name="search"&gt;
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24256778
linked to: http://stackoverflow.com/q/16175861
has comment: http://stackoverflow.com/comment/37470677

http://stackoverflow.com/q/24213491
has comment: http://stackoverflow.com/comment/37388228
type: UnansweredQuestion
tagged with: heap-dump
has comment: http://stackoverflow.com/comment/37388332
has comment: http://stackoverflow.com/comment/37388415
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/52064916
tagged with: java
has comment: http://stackoverflow.com/comment/39693150
upvote count: 19
score: 19
has title: How do I produce a heap dump with only a JRE?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24213542
has body: We have a JRE installed on our production environment, but not a JDK. The versions of the JRE and OS are below. [me@mymachine ~]$ java -version java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode) [me@mymachine ~]$ uname -a Linux mymachine.mydomain.com 3.10.35-43.137.amzn1.x86_64 #1 SMP Wed Apr 2 09:36:59 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux It doesn’t appear as if the jmap tool is present anywhere on the system, and without root access, I’m not in a position to install it in any system location. What can I do to get a heap dump (i.e. produce a .hprof file)? Also, we're using JBoss 7.1.3.AS if that matters.
has answer: http://stackoverflow.com/a/25441052

http://stackoverflow.com/q/24150677
tagged with: font-face
has answer: http://stackoverflow.com/a/24151003
tagged with: wkhtmltopdf
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/24151003
type: Question
tagged with: fonts
has title: Georgian characters is not rendered by wkhtmltopdf on ubuntu 12.04
has body: I'm generating pdf with wkhtmltopdf tool. I'm executing that process from Java and passing html with OutputSteam and getting result from process' InputStream. Everything is working fine on my dev Ubuntu 14.04 but on Ubuntu Server 12.04 Georgian fonts is not renderd, question marks is rendered instead like this: ????????? Does anyone have some experience to render Chinese or some other font that English with wkhtmltopdf?
tagged with: ubuntu

http://stackoverflow.com/q/24258449
has comment: http://stackoverflow.com/comment/37494528
has comment: http://stackoverflow.com/comment/37500903
has body: I'm having some problem using this particular method in order to handle problems in my parser. This is my code provided in Java: void handleErrors(Exception e, int kind, String strError) { //ParseException e = generateParseException(); System.err.println("Errore nel parsing: &lt;" + strError + "&gt;"); System.err.println(e.toString()); Token t; do { t = getNextToken(); } while(t.kind != kind &amp;&amp; t!=null &amp;&amp; t.kind != EOF ); } Something is going wrong, when I try to parse this simple function declaration (make reference on AutoIt documentation) Func askjd ($cas) the parser should throw an exception telling me that something is wrong with my function declaration, but it only says general suggestions like: ParseException: Encountered &lt;EOF&gt; at line 1, column 18. Was expecting one of: "If" ... "For" ... "While" ... "Do" ... "Switch" ... "Func" ... "Return" ... "EndFunc" ... "Const" ... &lt;VARNAME&gt; ... &lt;NAMEFUNC&gt; ... It should tell me that ONLY EndFunc is missing, not other tokens
has comment: http://stackoverflow.com/comment/37494427
score: 0
tagged with: javacc
tagged with: java
has comment: http://stackoverflow.com/comment/37473910
has title: JavaCC not matching right tokens during error handling
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/37473831
type: UnansweredQuestion

http://stackoverflow.com/comment/37354684
comment on: http://stackoverflow.com/a/24195637
has text: Wait..where is your `TextView` coming from? I was talking about a `ListView`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37427226
type: Comment
comment on: http://stackoverflow.com/q/24234195
has text: Just a reminder: `H` = hour in day `(0-23)`, `h` = hour in am/pm `(1-12)`
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37478680
has text: So...it is the inverse? Correcting this line b = (byte)(b | (byte)(0x00 << 7)); //unicast with 0x01 will do?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24261150

http://stackoverflow.com/comment/37359429
type: AnswerComment
comment on: http://stackoverflow.com/a/24198721
has text: Thanks for Replying.What we do in out project is use xml File for generating Beans by calling BeanGenerator.java which reads XML file and generates beans accordingly.This Process Happens through ANT codegen file.Is there a way track the parts of code while doing this.That is while running ANT Script.
type: Comment
score: 0

http://stackoverflow.com/comment/37299729
type: AnswerComment
has text: By the way, if you delete and re-add a Liberty server instance, there is a high chance it will not work properly. Worklight provides a customized instance of server.xml that you won't have if you delete the pre-defined one and add a new Liberty instance by hand.
comment on: http://stackoverflow.com/a/24166664
score: 0
type: Comment

http://stackoverflow.com/comment/37303440
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24164478
has text: Thank you Peter. I will try with c3p0. But how can i modify my applet for use the transactions?
score: 0

http://stackoverflow.com/comment/37379823
has text: In my case, somehow `DATABASECHANGELOG` table itself was empty. However, other tables were in tact
comment on: http://stackoverflow.com/a/24196802
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/q/24211903
type: Question
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24212073
tagged with: classcastexception
answer count: 1
downvote count: 1
favorite count: 0
tagged with: fatal-error
tagged with: forceclose
tagged with: android
tagged with: java
has title: Fatal Exception During Web Service Call
has body: I'm getting a fatal exception during the execution of my web service call. I've recently implemented a callback (in an effor to remove get() calls which were previously implemented) however I seem to have overlooked something since when debugging I throw an exception and the app is crashing with a fatal exception. The issue is stemming from the following line: appIdResponse = (ActionCompletedListener) new GetappIdTask( variables.login, variables.MAC, listener).execute(); However I'm not sure how to modify that line to resolve the issue and avoid the ClassCastException. Source: ActionCompletedListener appIdResponse = null; try { ActionCompletedListener listener = new ActionCompletedListener() { @Override public void callback(Object o) { // O is your response, cast to the type you need GetappIdResponse appIdResponse = (GetappIdResponse) o; // Handle response if (appIdResponse != null) { variables.login.entityID = ((GetappIdResponse) appIdResponse) .getappID(); } else { Toast toast = Toast .makeText( getApplication(), "Could not properly retrieve app data. Please check your network connection", Toast.LENGTH_LONG); toast.show(); AlertDialog.Builder builder = new AlertDialog.Builder( ActivityMain.this); builder.setMessage( getResources().getString(R.string.app_id_failure)) .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int id) { } }); AlertDialog alert = builder.create(); alert.show(); // return false; } } }; appIdResponse = (ActionCompletedListener) new GetappIdTask( variables.login, variables.MAC, listener).execute(); LogCat: 06-12 12:21:12.180: W/System.err(3294): java.lang.ClassCastException: com.example.login.wstasks.GetappIdTask cannot be cast to com.example.common.utils.ActionCompletedListener 06-12 12:21:12.180: D/dalvikvm(3294): GC_CONCURRENT freed 478K, 10% free 4666K/5184K, paused 1ms+3ms, total 15ms 06-12 12:21:12.180: W/System.err(3294): at com.example.app.ActivityMain.getap…
score: -1

http://stackoverflow.com/comment/37416180
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24227853
type: Comment
has text: And also because of hierchy. So that checking instanceOf would be more efficent. That's my guess. And I agree with you.

http://stackoverflow.com/a/24257545
answers question: http://stackoverflow.com/q/24257256
score: 0
has body: you can add your javascript.js file in the assest folder do your coding whatever you want. Inside the html you can add onclick="callFunction(); to any the tag. and you are done...
type: Answer

http://stackoverflow.com/q/24266346
has body: This is my game project. It's very simple version of "Flappy Bird" and I have some serious problems with how the collisions algorithm works. I wrote 2 separate code fragments for collision, for wall1 and wall2. The problem begins when the ball is trying to go through a hole because somehow the program is detecting a collision with a wall. I'm almost positive that the collision algorithm was written correctly because I have been checking it all day. import java.applet.*; import java.awt.*; import java.awt.event.*; import java.util.Random; import java.util.Timer; import java.util.logging.Level; import java.util.logging.Logger; public class Game extends Applet implements KeyListener, Runnable { Image bground; Random generator = new Random(); int r1; int wall1x; int wall1y; int wall1long; int wall2x; int wall2y; int wall2long; Timer timer; private Image i; private Graphics doubleG; int r2; int blok_x1 = 800; int blok_y1; int blok_x = 800; int blok_y = 0; int blok_x_v = 2; int ballX = 20; int ballY = 20; int dx = 0; int dyclimb = 1; int dyrise = 1; double gravity = 3; double jumptime = 0; int FPS = 100; public int tab[]; public boolean grounded = true, up = false; boolean OVER = false; @Override public void init() { bground = getImage(getCodeBase(), "12.png"); this.setSize(600, 400); tab = new int[100]; for (int t = 0; t &lt; 100; t++) { tab[t] = generator.nextInt(380) + 1; } addKeyListener(this); } @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { ballX -= 10; } if (e.getKeyCode() == KeyEvent.VK_RIGHT) { ballX += 10; } if (e.getKeyCode() == KeyEvent.VK_UP) { ballY -= 10; up = true; } if (e.getKeyCode() == KeyEvent.VK_DOWN) { ballY += 10; } } @Override public void paint(Graphics g) { g.drawImage(bground, 0, 0, this); if (OVER == false) { for (int i = 0; i &lt; 100; i++) { g.setColor(Color.green); wall1x = blok_x + i * 400; wall1y = blok_y; wall1long = tab[i]; g.fillRect(wall1x, wall1y, 20, wall1long); g.setColor(Color.green); wall2x…
accepted answer: http://stackoverflow.com/a/24266644
tagged with: applet
tagged with: awt
has answer: http://stackoverflow.com/a/24266644
linked to: http://stackoverflow.com/q/14616829
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
upvote count: 1
tagged with: collision-detection
linked to: http://stackoverflow.com/q/16771435
downvote count: 1
favorite count: 0
has title: Why collision algorithm in my applet game does not work properly ?
type: Question

http://stackoverflow.com/a/24230619
score: 0
accepted answer of: http://stackoverflow.com/q/24230529
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37424308
has comment: http://stackoverflow.com/comment/37421208
type: Answer
answers question: http://stackoverflow.com/q/24230529
has body: You can save user data in many ways that you want to do it! Saving the user's data must be the top most priority for the service that lets users chat and talk. Because a user data makes it a social application. If you keep loosing or deleting the data it would cause a havoc among the users and they would leave your application. If Cloud and Android, use Google Cloud There are several ways of doing that, in the Mobile Application field. Since it is Android, you can always use Google Cloud. Google Cloud lets you have its API and would take care of most of the applications itself and you would have to just stylize your application and handle just a few things. https://cloud.google.com/ Understand the Cloud But wait, using Cloud is not that much simple. You first need to understand what Cloud Networking actually is. Techniques And yes, never save data on the User's phone if you want to save the data permanently. Otherwise you can save the data on the user's phone while they interact. Save data on Users' Device One example of this project (application) where the data is stored on the Users' phones is WhatsApp. They don't save the message or photos on their server or any service related to them. Users' phone gets a Database created to store the data. Save data online. But like Facebook Messenger, the messages are stored on the Server of Facebook where they story the details and data and each user gets the messages sent to them even if they get a new phone or a new everything! It totally depends on your criteria.

http://stackoverflow.com/q/24182550
downvote count: 0
answer count: 1
upvote count: 1
has body: I have a problem with setting up the work environment for Cordova on Windows 7 for Android. I use NetBeans 8 and followed this guide: Link Here New project -> Cordova -> Hello World Template. Whenever I try to build a Cordova project (in NetBeans) I get this message: BUILD FAILED C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml:90: Cannot find C:\Users\Administrator\SkyDrive\Skolegang\DataingeniÃ¸r\Android\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml imported from C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml Total time: 0 seconds C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\node_modules\q\q.js:126 throw e; Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen Error: C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\run.bat: Command failed with exit code 8 at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5) Command finished with error code 8: C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\platforms\android\cordova\run.bat --emulator C:\Users\Administrator\Documents\NetBeansProjects\HTML5Application2\nbproject\build.xml:272: exec returned: 1 BUILD FAILED (total time: 47 seconds) I have googled it for hours but can't seem to find a solution. Some people get some of the same errors(not exact, but similar), but the solutions did not work for me. One issue was regarding Java 8 and ant versions beneath 1.9.0 (I use Node 0.10.26, java 1.7.0_25, cordova 3.5.0…
has comment: http://stackoverflow.com/comment/37328577
type: AnsweredQuestion
has title: Can't build cordova projects
has answer: http://stackoverflow.com/a/24231064
tagged with: android
tagged with: java
score: 1
has comment: http://stackoverflow.com/comment/37328926
favorite count: 0
type: Question
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/24231064
tagged with: cordova

http://stackoverflow.com/comment/37232602
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24130936
has text: would autocomplete listView be helpful in your situation ?

solr4
tags question: http://stackoverflow.com/q/24260528
tags question: http://stackoverflow.com/q/24131011
tag name: solr4
type: Tag

http://stackoverflow.com/q/24227792
accepted answer: http://stackoverflow.com/a/24227999
has answer: http://stackoverflow.com/a/24227999
has title: When method signature is written inside print statement what is the output?
score: -2
tagged with: java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37414884
upvote count: 0
downvote count: 2
answer count: 1
has body: Ok now this is so confusing. I used to remember when method signature is written inside print statement it used to print only the return value of that method that it doesn't print the method itself as it is, it is only the return value gets printed. And that we cannot write a method inside print statement where the method does not return any value. But now I see it completely different I am sure when the above was not correct it used to give an error. But now when I write the method inside print statement not only the return value but also values printed inside the methods get printed... How did this happen?
favorite count: 0
type: Question

http://stackoverflow.com/comment/37443026
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24242440
has text: You can have a look at [this](http://stackoverflow.com/questions/2857164/cannot-use-a-like-query-in-a-jdbc-prepared-statement/2857417#2857417), perhaps of some help.

http://stackoverflow.com/comment/37207463
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24117284
score: 0
has text: Please see edit above.

http://stackoverflow.com/comment/88806714
has text: @OwenCao When i use the first function in my class , I am getting cannot fnd symbol error for TokenResponse and GoogleRefreshTokenRequest. Can you tell how to solve this. Whether i need to include jar files?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24144327

http://stackoverflow.com/q/24171254
has answer: http://stackoverflow.com/a/24277589
upvote count: 1
type: AnsweredQuestion
tagged with: hawtio
accepted answer: http://stackoverflow.com/a/24277589
has comment: http://stackoverflow.com/comment/37339135
downvote count: 0
has comment: http://stackoverflow.com/comment/37341227
linked to: http://stackoverflow.com/q/8050640
score: 1
tagged with: java
answer count: 1
has title: Hawtio not starting
has body: I am trying to update my hawtio from 1.2.0 to 1.4.4 but I am getting a exception: java.io.FileNotFoundException: C:\Users\myUser\AppData\Local\Temp\jetty-0.0.0.0-9950-hawtio-default-offline-1.4.4.war-_ccf-any-\webapp\app\themes\fonts\Open-Sans\OpenSans-Italic-webfont.eot? (The filename, directory name, or volume label syntax is incorrect) I am deploying hawtio in my jetty server (8.1.14) and I am running on Windows. I have also tried hawtio 1.3.0 and it's working fine. From version 1.4.0 to 1.4.4 none of them work and they throw the mentioned exception. Is this a bug or am I missing something? Thank you!
favorite count: 0
type: Question

http://stackoverflow.com/q/24136880
has comment: http://stackoverflow.com/comment/37258197
has answer: http://stackoverflow.com/a/24147209
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37252264
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has title: Java - Client recieving blank messages from Server, but only over network
answer count: 1
tagged with: client
favorite count: 0
type: Question
has body: I was unsure whether this issue is to do with the network, but I'm trying to get a simple server to send messages to multiple clients. It works fine when testing on my own computer, but over the network to a different computer has issues. The client connects to the server fine, the first message sent to the client SHOULD be 'Server : Hello, World!', but a blank string comes through. Then the second string is always read as it should be, and all the rest usually come out as blank strings. The server sends info via a PrintStream, using autoflush. Below is the part of the Client program which reads input. I believe if anything, there is an issue here, but I'm not sure what since I'm a little new to sockets and networking things. The server sends a line of text each 500 milliseconds, counting up to each client. I've tried changing this number to something higher but the client still doesn't receive the correct messages. The client should receive the messages and print them to the screen, replying with the replies seen below at 5,10,15 and 20. try { socket.setSoTimeout(10); String line; while((line = input.readLine())!=null){ if (!line.equals("")){ // Replies if (output != null) { if (line.endsWith(" 20")){ output.println("Reached 20!"); }else if (line.endsWith(" 15")){ output.println("Reached 15!"); }else if (line.endsWith(" 10")){ output.println("Reached 10!"); }else if (line.endsWith(" 5")){ output.println("Reached 5!"); } } messages.add(line); if (messages.size() &gt;= 8){ messages.remove(0); } }else{ messages.add("EMPTY STRING!!"); if (messages.size() &gt;= 8){ messages.remove(0); } } } } catch (SocketTimeoutException e){ // Timed out } catch (Exception e) { System.err.println("Connection lost"); break; } (Quick Edit: Should probably mention this is in a while loop inside the run method since I implemented Runnable on my class.) When using input.readLine(), should I be checking something before to make sure it doesn't come out as just empty strings? Is it because of…
accepted answer: http://stackoverflow.com/a/24147209
tagged with: jakarta-ee
tagged with: network-programming
tagged with: sockets

http://stackoverflow.com/a/24194699
upvote count: 10
accepted answer of: http://stackoverflow.com/q/24194638
score: 10
has body: Use @Schedule(second="*", minute="*", hour="*"). the default values for hour and minute are "0" which can be quite irritating and effectively forces you to set these.
type: Answer
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24194638
downvote count: 0

http://stackoverflow.com/comment/37191188
has text: @AKIWEB Does the Launch configuration you selected have the included resource in its classpath?
type: Comment
comment on: http://stackoverflow.com/a/24109005
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37349993
score: 0
has text: @ajb the reason why I have to use a map is before this code I have written code where I do the summation of values that correspond to the radius. The image contains many radius that are repeated over and over because the amplitude and thetas are different. So when I do the summations I first check the radius and if the hash map is empty then I add the radius with its corresponding value. Then next time I come across the same radius number, instead of adding it to the hash map I just add the value.
comment on: http://stackoverflow.com/q/24193507
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24244648
has body: I've seen lots of great articles explaining JUnit and articles explaining Annotations but nothing quite explaining how the two actually tie together. I know that the annotation @test is places in front of a method that you want to be used a JUnit test, but can someone please explain what's going on in the background? How are annotations converted into useful Java code? Where does it happen? How can I make something like this myself?
type: UnansweredQuestion
tagged with: junit
tagged with: annotations
has answer: http://stackoverflow.com/a/24244746
tagged with: java
has answer: http://stackoverflow.com/a/24244793
type: Question
score: 0
answer count: 2
has title: What's happening in the background of @test annotation?

http://stackoverflow.com/comment/37292404
score: 1
comment on: http://stackoverflow.com/a/24163417
has text: After so many years...still `==equals` bringing lots of votes... :) Can't Stop MySelf +1.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24530075
accepted answer of: http://stackoverflow.com/q/24204269
answers question: http://stackoverflow.com/q/24204269
type: Answer
score: 0
has body: for Redhat systems, pls do $sudo yum install pig and open pig in local mode. this worked for me.
type: AcceptedAnswer

http://stackoverflow.com/q/24126177
has comment: http://stackoverflow.com/comment/37242135
has comment: http://stackoverflow.com/comment/37341886
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37223294
has comment: http://stackoverflow.com/comment/37313572
has comment: http://stackoverflow.com/comment/37260560
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24146139
has body: I have a java project in netBeans that deals with some paths in order to be able to work. It is headache to change the paths every time that you are run it on other machine. Thus, I am wondering if there is a way that help me to come over this issue. One suggested to me to use configuration file, but I don't have any idea about how to do it. So, kindly could you help me in this, please?
has comment: http://stackoverflow.com/comment/37226554
has title: How to store paths in configuration file in netbeans?
tagged with: path
tagged with: java
has comment: http://stackoverflow.com/comment/37313372
has comment: http://stackoverflow.com/comment/37341753
has comment: http://stackoverflow.com/comment/37313366
accepted answer: http://stackoverflow.com/a/24146139
type: Question
has comment: http://stackoverflow.com/comment/37254311
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37348570

http://stackoverflow.com/q/24231068
has answer: http://stackoverflow.com/a/24231126
upvote count: 1
type: UnansweredQuestion
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/37420940
favorite count: 0
score: 0
tagged with: java
downvote count: 1
has body: Environemnt - Java + Junit +WebDriver My requirement is this: I have 120 XLS test cases, they are in xls. (Example -> 1st test case -Discussion_DOcuOne.xls 2nd test case -Discussion_DOcuTwo.xls etc...) I have relevant Java files (one .java file for each xls test case). (Example -> 1st test case -Discussion_DOcuOne.java 2nd test case -Discussion_DOcuTwo.java etc...) Through Java code, I am reading one by one xls test case. And I need to call the related .Java file. if testCaseName=Discussion_DOcuOne,then, ---- I need to call the Discussion_DOcuOne.java file I have tried switch+case (by assigning numbers to all xls test cases). But I need to write 120 case statements, which is not at all practical. -----Here I stuck. I don't know how to RUN/CALL the specific Java file. //For example the testCaseName is "Discussion_DOcuOne", I need to call/run the Discussion_DOcuOne.java. I don't get any idea how to link these two. Please find the example Java class (nothing but Java code for each manual test case, we call it TEST SCRIPT). Every .Java file has one method runTestCase(), and I need to call that specific method which belongs to that specific test script. ---------------------- Here is the Discussion_DOcuOne.Java file--------------- public class Discussion_DOcuOne(){ String varOne="abc"; String varTwo="efg"; public void runTestCase(){ //do some thing using the variables above } }
tagged with: webdriver
type: Question
has title: Call .Java files, based on the test case name

http://stackoverflow.com/q/24197375
tagged with: java
has comment: http://stackoverflow.com/comment/37357160
linked to: http://stackoverflow.com/q/14084104
upvote count: 2
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37359078
tagged with: concurrenthashmap
tagged with: collections
answer count: 1
favorite count: 0
has body: I needed to ask on the below aspects of the ConcurrentHashMap,as I am unable to figure it out from the source code. (Please note that I am not asking about the behaviour ,which is well understood. Its about the mechanism the iterator adopts to display the behaviour) "The iterator is guaranteed to reflect the state of the map at the time of it's creation." 1.Does this mean that the iterator gets its own copy of the backing map? Why else would volatile reads not give true state of 'value' ,even after creation of the iterator? (exact location of the code will be appreciated) 2.How does the non-blocking read and iteration manage to behave consistently,even when a segment is undergoing re-hashing?
accepted answer: http://stackoverflow.com/a/24199345
has title: Concurrenthashmap Iterator data structure
has answer: http://stackoverflow.com/a/24199345
type: Question

http://stackoverflow.com/a/24247327
has body: For large vocabulary recognition you can use generic US English language model https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/US%20English%20Generic%20Language%20Model/ To learn more about CMUSphinx read the tutorial http://cmusphinx.sourceforge.net/wiki/tutorial
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24243954
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24243954

http://stackoverflow.com/a/24245765
score: 0
has body: Because you are switching on an int, not a byte.
type: Answer
answers question: http://stackoverflow.com/q/24245708

http://stackoverflow.com/a/24161423
downvote count: 0
has body: You can use it to log some infos like this: frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { log.info("Programm exit."); System.exit(0); super.windowClosed(e); } }); A shorter version would be: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
upvote count: 4
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24161248

http://stackoverflow.com/comment/37328492
has text: yes that's a work around.. if I am running on `http://localhost:9000/login` and then page request comes I get `localhost:9000/login` and I check if string contains `login`
type: Comment
comment on: http://stackoverflow.com/a/24180745
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37471670
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24210092
type: Comment
has text: Did you define the "Test" class as a spring bean ?

http://stackoverflow.com/a/24211559
downvote count: 0
has comment: http://stackoverflow.com/comment/37384499
accepted answer of: http://stackoverflow.com/q/24211266
has body: What you are doing right now is setting current_key to "stop" after each 100 ms, and listening for keyPressed to assign a direction again. The problem with this is you are limited by how often keyPressed is being fired. What you really want to do is start moving when a direction is pressed, and stop moving when the key is released. An easy way to do this is to remove the stop line from your main loop, and instead make a keyReleased method in your MyKeyListener which sets the current_key to "stop". This way whenever a key is pressed, we keep moving in that direction until it is released. e.g. class gameplay { static String current_key = "stop"; public gameplay() { begin(); } void begin() { while (true) { try { Thread.sleep(100); } catch (InterruptedException ex) { Logger.getLogger(Tutorial3.class.getName()).log(Level.SEVERE, null, ex); } Tutorial3.panel.user.move(current_key); Tutorial3.panel.repaint(); System.out.println(current_key); // current_key = "stop"; // only "stop" when the key is released } } static void key_event() {} } class MyKeyListener extends KeyAdapter { // set direction to "stop" when a key is released @Override public void keyReleased(KeyEvent e) { gameplay.current_key = "stop"; } public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); switch (keyCode) { case KeyEvent.VK_UP: gameplay.current_key = "up"; break; case KeyEvent.VK_DOWN: gameplay.current_key = "down"; break; case KeyEvent.VK_LEFT: gameplay.current_key = "left"; break; case KeyEvent.VK_RIGHT: gameplay.current_key = "right"; break; default: gameplay.current_key = "stop"; } } }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24211266
type: Answer
upvote count: 4
score: 4

http://stackoverflow.com/comment/37474038
comment on: http://stackoverflow.com/a/24257960
score: 0
type: AnswerComment
type: Comment
has text: Actually I was using this, but it seems matcher.matches() doesn't reset the state, which created some issues.

http://stackoverflow.com/q/24109621
downvote count: 1
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37192346
tagged with: java
has body: Just a recap from my last question, I am a 15 year old new to the stackoverflow community. I am currently trying to independently develop a Rock Paper Scissors game using java. I thought working on this project would be an informing experience to help me learn java and its fundamentals. I am somewhat new with the java programming language so please do not criticize me, I am slowly learning by trial and error. For this particular project, I decided to use Eclipse as I like its user interface better than other IDEs. Anyway, I decided to implement JPanel to make the game more visual. My code is as follows copy and pasted from my eclipse project: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JLabel; import java.awt.event.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class prompt extends JPanel implements ActionListener { public static void main(String []args) { JPanel panel = new JPanel(); JButton rockButton = new JButton("ROCK"); JButton scissorsButton = new JButton("SCISSORS"); JButton paperButton = new JButton("PAPER"); JFrame choicePrompt = new JFrame("Rock, Paper, Scissors Game"); choicePrompt.add(panel); choicePrompt.setSize(300, 300); choicePrompt.setVisible(true); panel.add(rockButton); panel.add(scissorsButton); panel.add(paperButton); rockButton.addActionListener(new ActionListener() { public void rockChosen(ActionEvent r) { JLabel rock = new JLabel("You have chosen Rock!"); panel.add(rock); } } scissorsButton.addActionListener(new ActionListener() { public void scissorsChosen(ActionEvent s) { JLabel scissors = new JLabel("You have chosen Scissors!"); panel.add(scissors); } } paperButton.addActionListener(new ActionListener() { public void paperChosen(ActionEvent p) { JLabel paper = new JLabel("You have chosen Paper!"); panel.add(paper); } } } } What is wrong with my ActionListeners under adding buttons to the JPanel? The way I want this program to work is that when the…
has comment: http://stackoverflow.com/comment/37192263
has title: Implementing ActionListeners to My Game Part 2
has answer: http://stackoverflow.com/a/24109760
possible better answer: http://stackoverflow.com/a/24109760
favorite count: 0
type: Question
tagged with: actionlistener
answer count: 2
has comment: http://stackoverflow.com/comment/37192272
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/24109804
accepted answer: http://stackoverflow.com/a/24109804

http://stackoverflow.com/comment/37404547
comment on: http://stackoverflow.com/a/24222257
type: AnswerComment
has text: okay thanks got it...i didn't knew about references in java,thanks a lot :) this linked helped me too http://www.coderanch.com/t/407807/java/java/difference-object-object-reference
score: 0
type: Comment

http://stackoverflow.com/comment/37482070
has text: Thanks for the ref. Is there any way to implement this in JAVA..!? as I can see that its a PHP thing not java..
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24259377

http://stackoverflow.com/q/24259058
tagged with: mule
has body: I am trying to set the Accounting Token on the a message which my system received from inbound queue. I am setting this token using the following. msg.setObjectProperty(JmsConstants.JMS_IBM_MQMD_ACCOUNTINGTOKEN,value) Also I have the following properties in my JmsSUpport class ((JmsDestination) dest).setBooleanProperty(WMQConstants.WMQ_MQMD_READ_ENABLED, true); ((JmsDestination) dest).setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true); ((MQDestination) dest).setMQMDWriteEnabled(true); ((MQDestination) dest).setMQMDReadEnabled(true); ((MQDestination) dest).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ); Since the outbound queue is MQDestination I have to set the above properties. Now I am observing that I am correctly setting the value on the outbound message. But when the other application reads the message from the MQ it has default value for Accounting Token. Could this be because the MQ is configured in such way to override the value? Or is it because the other application is not reading MQ message correctly? Or should I be using any other property to enable accounting token? Is it because I am setting ((MQDestination) dest).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ); the msg gets stripped of MQMD Headers?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24267669
tagged with: mq
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24267669
upvote count: 1
score: 1
linked to: http://stackoverflow.com/q/24424781
tagged with: jms
answer count: 1
favorite count: 0
tagged with: ibm-mq
type: Question
has title: MQDestination overriding accounting token value

http://stackoverflow.com/comment/37298885
comment on: http://stackoverflow.com/q/24163071
type: Comment
type: QuestionComment
score: 0
has text: Find the solution here [Set a selected text color using Swing](http://stackoverflow.com/questions/24052862/set-a-selected-text-color-using-swing?answertab=votes#tab-top)

http://stackoverflow.com/comment/37318084
type: Comment
type: QuestionComment
has text: @Raghunandan jsonarray = jsonobject.getJSONArray(strReceived);
score: 0
comment on: http://stackoverflow.com/q/24176719

http://stackoverflow.com/comment/37248199
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24139065
has text: Thanks for the help , but how do i subscribe more than one user to my app ? So that i can use the app oauth values for multiple users.I am using the quickbooks online plus version and I have given rights to 3 user into my quickbooks online plus account but from the project that we developed , it only lets me login with a single user.
type: AnswerComment

http://stackoverflow.com/comment/37277644
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24146217
has text: Yes, sometimes the fingers don't type what the mind is thinking :)

http://stackoverflow.com/comment/37212786
type: QuestionComment
comment on: http://stackoverflow.com/q/24120704
type: Comment
has text: I think this is a java question actually, since he's asking about htmlunit.
score: 0

http://stackoverflow.com/q/24236579
answer count: 1
has answer: http://stackoverflow.com/a/24239116
favorite count: 0
tagged with: apache-httpclient-4.x
has title: HttpClient: Can i safely reuse HttpContext for different domains by multiple threads?
type: Question
upvote count: 5
score: 5
tagged with: java
type: AnsweredQuestion
has body: Can i safely reuse HttpClientContext to store cookies for different domains by multiple threads, or perhaps it's better to create one context for each domain, or even narrower, create one context for each thread per domain ? What i imagine is to behave like a browser that can handle cookies for each domains and which can open multiple tabs on pages that originates from the same or different domains. Here's how i initiate the context only once to be reusable by multiple threads : HttpClientContext context = HttpClientContext.create(); context.setCookieStore(this.createCookieStore()); I'm also using the latest version of the HttpClient.
downvote count: 0
tagged with: httpclient
accepted answer: http://stackoverflow.com/a/24239116

http://stackoverflow.com/q/24125834
type: Question
linked to: http://stackoverflow.com/q/16163482
has answer: http://stackoverflow.com/a/24136449
accepted answer: http://stackoverflow.com/a/24136449
has title: ELKI Maven OPTICS
type: AnsweredQuestion
tagged with: optics-algorithm
linked to: http://stackoverflow.com/q/7453131
has body: I'm trying to use ELKI (http://elki.dbs.ifi.lmu.de/#GettingELKI:DownloadandCitationPolicy) but cant find the maven dependency. Does anyone know where I could find it? I want to do some experiments with the OPTICSXi implementation but I'm finding it very difficult. Could someone please give me some advice? Links? Something to get me started? Is this a good OPTICS implementation to use? I found these links: Running OPTICS algorithm on ELKI How to cluster an instance with Weka&#39;s DBSCAN? But they dont really help me..
downvote count: 0
upvote count: 1
tagged with: elki
score: 1
tagged with: java
tagged with: data-mining
tagged with: cluster-analysis
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/37239185
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24132823
has text: Assuming all ints are exactly 6 digits: `List<String> result = new ArrayList<String>(); for (int d: getLoyaltyExpiryDate()) {String s = Integer.toString(d); result.add(s.substring(6) + "/" + s.substring(4,6) + "/" + s.substring(0,4));}` Better would be to parse and format the dates using a `SimpleDateFormat`.
score: 1

http://stackoverflow.com/q/24188066
has comment: http://stackoverflow.com/comment/37339036
has comment: http://stackoverflow.com/comment/37338945
has answer: http://stackoverflow.com/a/24188130
has answer: http://stackoverflow.com/a/24188117
answer count: 4
has body: I downloaded the sample program , for file transfer between the client and server. When I try running the program with 1 GB file , I get the Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Client.main(Client.java:31). Edit: Line no 31: byte [] mybytearray = new byte [FILE_SIZE]; public final static int FILE_SIZE = 1097742336; // receive file long startTime = System.nanoTime(); byte [] mybytearray = new byte [FILE_SIZE]; InputStream is = sock.getInputStream(); fos = new FileOutputStream(FILE_TO_RECEIVED); bos = new BufferedOutputStream(fos); bytesRead = is.read(mybytearray,0,mybytearray.length); current = bytesRead; do { bytesRead = is.read(mybytearray, current, (mybytearray.length-current)); if(bytesRead &gt;= 0) current += bytesRead; } while(bytesRead &gt; -1); bos.write(mybytearray, 0 , current); bos.flush(); Is there any fix for this?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37338885
has comment: http://stackoverflow.com/comment/37338987
tagged with: java
has comment: http://stackoverflow.com/comment/37339029
has comment: http://stackoverflow.com/comment/37338858
possible better answer: http://stackoverflow.com/a/24188117
has comment: http://stackoverflow.com/comment/37339156
has title: Java Out of memory - Out of heap size
downvote count: 1
has comment: http://stackoverflow.com/comment/37338930
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24188411
linked to: http://stackoverflow.com/q/1951347
has comment: http://stackoverflow.com/comment/37338814
has answer: http://stackoverflow.com/a/24188411
upvote count: 0
has answer: http://stackoverflow.com/a/24188162
has comment: http://stackoverflow.com/comment/37339053
has comment: http://stackoverflow.com/comment/37339004
score: -1

http://stackoverflow.com/a/24195902
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24195849
has body: I want to draw two rectangles on two different JPanels Read the section from the Swing tutorial on Custom Painting for working examples of custom painting. The key is to override the getPreferredSize() method to return the size of the panel containing the rectangle. I want to add both the JPanels on JFrame Read the section from the Swing tutorial on Layout Manager. You then just add the panels to the frame like any other Swing component. The real question is why do you want two panels? Just draw the two Rectangles on the same panel. See Playing With Shapes for more ideas on how to do this type of painting.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37365686
has comment: http://stackoverflow.com/comment/37377287

http://stackoverflow.com/q/24261623
score: 4
has comment: http://stackoverflow.com/comment/37480126
answer count: 0
has body: I'm able to get the buildNumber and build time stamp in manifest.mf file by configuring as shown below: ${maven.build.timestamp} ${buildNumber} Can you please suggest me how to get the last changed revision and last changed date of scm? 0 N/A
downvote count: 0
tagged with: java
has title: how to get last changed revision number and last changed date of source code in maven pom.xml
has comment: http://stackoverflow.com/comment/37479932
favorite count: 0
has comment: http://stackoverflow.com/comment/37480484
type: Question
has comment: http://stackoverflow.com/comment/37480176
has comment: http://stackoverflow.com/comment/37479509
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4874813
tagged with: maven
has comment: http://stackoverflow.com/comment/37515748
has comment: http://stackoverflow.com/comment/37480005
upvote count: 4

http://stackoverflow.com/comment/42488155
score: 0
type: Comment
has text: Did you find any solution to your problem? I am looking for the exact same thing. Thank you for sharing your solution, if you have any.
type: AnswerComment
comment on: http://stackoverflow.com/a/25708102

http://stackoverflow.com/q/24209291
tagged with: java
has comment: http://stackoverflow.com/comment/37379863
type: Question
has answer: http://stackoverflow.com/a/24240752
type: UnansweredQuestion
tagged with: netty
answer count: 1
has body: When I read the source code of the UnpooledDirectByteBuf.java of Netty5, the "private ByteBuffer tmpNioBuf;" field makes me confused. In the code of UnpooledDirectByteBuf.java like this: private void getBytes(int index, byte[] dst, int dstIndex, int length, boolean internal) { ... ... if (internal) { tmpBuf = internalNioBuffer(); } else { tmpBuf = buffer.duplicate(); } tmpBuf.clear().position(index).limit(index + length); tmpBuf.get(dst, dstIndex, length); } We can see that, sometimes we can use the internalNioBuffer() method to get the "tmpNioBuf" as the tmpBuf by setting the "boolean internal" param "true",such as:readBytes(byte[], int, int)method and sometimes we use the "buffer.duplicate()" to get the tmpBuf. Why did the author design it like this? Thanks!
has comment: http://stackoverflow.com/comment/37380132
score: 0
has title: Netty tmpNioBuf UnpooledDirectByteBuf

http://stackoverflow.com/comment/37280669
has text: he just wrote *But Iam able unzip it programmatically using ZipInputStream and ZipEntry classes. Its properly unzipping. I want to show the progress of unzipping operation. How to do that?*
comment on: http://stackoverflow.com/a/24156966
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24248593
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/297938
has comment: http://stackoverflow.com/comment/37456080
has answer: http://stackoverflow.com/a/24249205
score: -1
has comment: http://stackoverflow.com/comment/37456584
has comment: http://stackoverflow.com/comment/37456555
has body: I am trying to use a JDialog at the right of the screen, everything is almost perfect, but, if someone press the button on ther right end of the TaskBar, click on "Show Desktop area" my JDialog disappears I have to use ALT + TAB to get it back in in front. I can't set it AlwaysOnTop because I use other 3rd party programs that are fullscreen. I tried: jdigCentral.setAutoRequestFocus(true); jdigCentral.setAlwaysOnTop(true); and others, but without success How can I have my JDialog to stay over just the Desktop Area?
upvote count: 0
has comment: http://stackoverflow.com/comment/37456819
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/37455168
answer count: 1
has title: JDialog over Desktop area
tagged with: swing
favorite count: 0
tagged with: jdialog
type: Question
has comment: http://stackoverflow.com/comment/37456730

http://stackoverflow.com/comment/37208044
type: Comment
comment on: http://stackoverflow.com/a/24114451
score: 0
type: AnswerComment
has text: Yes, ok. But it doesnt do what I need when minimized by pressing button. That is the problem. It starts even if it needs to stop...

http://stackoverflow.com/a/24109569
has comment: http://stackoverflow.com/comment/37192230
score: 3
upvote count: 3
has body: The constructor executes in the following order: Calls the constructor of the superclass. Runs the instance initializer blocks in the order they were defined. Executes the rest of the body of the constructor. I.e., both of your sysout statements execute just before the assignment n=10;. That's how it should be. See JLS §12.5.
answers question: http://stackoverflow.com/q/24109439
type: Answer
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24109439

http://stackoverflow.com/comment/37470289
has text: Don't put code in comments. It's pretty much unreadable.
type: QuestionComment
comment on: http://stackoverflow.com/q/24256463
type: Comment
score: 0

http://stackoverflow.com/comment/37457334
type: Comment
score: 0
type: AnswerComment
has text: For some IDEs the code which is generated is really ugly but for the better ones it is more or less the same as handwritten. Take a look at the [google window builder eclipse plugin](http://stackoverflow.com/a/13671987/3165552). IMO it produces beautiful code and allows round trip code editing. But for tables i wouldn't use the gui guilder as well, but for wiring tables into controls.
comment on: http://stackoverflow.com/a/24248881

http://stackoverflow.com/a/24130374
accepted answer of: http://stackoverflow.com/q/24130251
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24130251
has body: See for yourself: JVM fails in getting enough memory for the heap and exits. I don't think there is a way to make JVM use a specific amount of memory for paging, but you can use: -XX:+|-UseLargePages --for large page support and -XXLargePageSizeInBytes=&lt;n&gt; --for specifying how large your large pages can be. Look at http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/java.html
type: Answer

http://stackoverflow.com/a/24156640
has body: I think you need to do following stuff. App1 :: Authenticate User App2 :: any app App3 :: any app Design Content Provider for Authorization of Apps. The content provider will be a component of App1. Other app will query Content Provider to know whether user of app2/app3 is authorized or not? If not then apps will fire an intent as a startActivityForResult for App1 to perform login action on behalf of other apps. We need to send user credentials, package name etc in intent. We need to define proper request and response codes for login action i.e in startActivityForResult. App1 will store user authentication data against each package(i.e app) Here main thing we need to take care of is when should App1 refresh it's user authentication data stored against each package.This mainly depends on your requirements. You might need to add some more use cases as per you requirements.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24155248
type: Answer
answers question: http://stackoverflow.com/q/24155248
score: 2
upvote count: 2
downvote count: 0

swipe
type: Tag
tags question: http://stackoverflow.com/q/24227599
tag name: swipe
tags question: http://stackoverflow.com/q/24153172

http://stackoverflow.com/comment/37425126
type: Comment
score: 0
type: AnswerComment
has text: what does the java -version output to console?
comment on: http://stackoverflow.com/a/24210335

http://stackoverflow.com/a/24229058
has body: In order to handle files,there are different kinds of Java classes like character streams and bytes stream. Programs use byte streams to perform input and output of 8-bit bytes. All byte stream classes are descended from InputStream and OutputStream.All character stream classes are descended from Reader and Writer. There are different style to write to text file.So better to follow this link http://www.tutorialspoint.com/java/java_files_io.htm.Happy Coding
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24228921

http://stackoverflow.com/a/24111817
has body: You can put int variable count as the index, where each time you add to the array of String count will increment thus giving you the number of occupied spaces. example: public static void main(String args[]) { int count = 0; String carlist[] = new String[50]; carlist[count] = "ferrari"; carlist[++count] = "bentley"; System.out.println("occupied spaces" + (count + 1)); System.out.println("empty spaces" + (carlist.length - (count + 1))); }
type: Answer
answers question: http://stackoverflow.com/q/24111792
score: 0

http://stackoverflow.com/a/24225386
score: 4
has body: Use javax.swing.Timer to pace the animation. Typical controls that invoke the timer's start() and stop() methods are examined here. This fleet simulation, which uses such a Timer, may also be if interest.
accepted answer of: http://stackoverflow.com/q/24225305
type: Answer
answers question: http://stackoverflow.com/q/24225305
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37460843
type: QuestionComment
comment on: http://stackoverflow.com/q/24251117
score: 0
has text: Did the duplicate answer your question?
type: Comment

http://stackoverflow.com/q/24131693
has comment: http://stackoverflow.com/comment/37233921
downvote count: 3
tagged with: java
answer count: 1
favorite count: 0
type: Question
has title: Exporting my android app to iphone?
tagged with: iphone
tagged with: android
linked to: http://stackoverflow.com/q/644225
has answer: http://stackoverflow.com/a/24131721
has body: Ive made an app on Android and I want to be able to sell the app for iphone and android. I dont want to have to learn objective C. Is there any possible way I can do this?
accepted answer: http://stackoverflow.com/a/24131721
score: -1
tagged with: http://stackoverflow.com/tag/c
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/q/24112237
score: 1
tagged with: java
has body: we are supposed to create a program that reads a word from a JTextField and compare it to a list, then we have to count how many lines to the word if it exist and display the same line from another text file in the same program into another JTextField (it's supposed to be a Dictionary of some sort) here is what i have: boton1.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String palabra=tx1.getText(); boton3.setEnabled(true); try{ // here is where i open my file FileInputStream fstream = new FileInputStream("src/archivos/translator.txt"); DataInputStream entrada = new DataInputStream(fstream); BufferedReader buffer = new BufferedReader(new InputStreamReader(entrada)); String strLinea; while ((strLinea = buffer.readLine()) != null) { System.out.println (strLinea); int i=0; while (!(strLinea.equals(palabra))){ i++; } tx2.setText(String.valueOf(i)); } entrada.close(); }catch (IOException x){ System.err.println("Oh no, ocurrió un error: " + x.getMessage()); } }} );
answer count: 2
has answer: http://stackoverflow.com/a/24112320
type: UnansweredQuestion
has title: Compare word to Text file Java
downvote count: 0
upvote count: 1
tagged with: swing
tagged with: string
has answer: http://stackoverflow.com/a/24112279
favorite count: 0
type: Question
tagged with: buffer
tagged with: while-loop

http://stackoverflow.com/comment/37413876
type: Comment
has text: Thankyou very much that was exactly what i was looking for the solution and then why.
type: AnswerComment
comment on: http://stackoverflow.com/a/24225325
score: 0

http://stackoverflow.com/a/24146495
has comment: http://stackoverflow.com/comment/37262357
type: Answer
has comment: http://stackoverflow.com/comment/37276464
has body: Although there is an accepted answer, In this case even a simple BoxLayout with vertical axis Y_AXIS should work fine. http://docs.oracle.com/javase/tutorial/uiswing/layout/box.html
score: 0
answers question: http://stackoverflow.com/q/24145582
has comment: http://stackoverflow.com/comment/37276173
has comment: http://stackoverflow.com/comment/37276481

http://stackoverflow.com/q/24150879
tagged with: java
type: Question
tagged with: tabs
has comment: http://stackoverflow.com/comment/37270352
has comment: http://stackoverflow.com/comment/37270014
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: checkbox
has comment: http://stackoverflow.com/comment/37270081
score: 0
has body: So I have a UI that I made with Swing using Java. It is very complex and I want to save the user some time by making the UI simpler. Imagine you have a page with many CheckBox. Once you select whatever CheckBox you desire, the next button makes a JFrame appear with the same tabs as you selected inside a Tabbed Pane. Here is a small sample of my code which should give an idea of what I want the button to do: btnNewButton_7.addActionListener(new ActionListener(){ @SuppressWarnings("static-access") public void actionPerformed(ActionEvent e){ Admin.set.frame.setVisible(false); Admin.adv.setVisible(true); Admin.adv.jp2.setVisible(chckbxNewCheckBox_42.isSelected()); Admin.adv.jp3.setVisible(chckbxNewCheckBox_43.isSelected()); Admin.adv.jp4.setVisible(chckbxNewCheckBox_44.isSelected()); } }); So the next Button should set the JFrame (set.frame) invisible. Then, it should open adv (a new frame). So far, everything is working. Now, my tabe are JPanel inside adv. I would love to make them disappear whenever the CheckBox 42,43 and 44 are selected or unselected, should I add an onChangeListener?
has title: Making Tab appear or disappear onChangeListener on Checkbox in Swing

http://stackoverflow.com/q/24144859
has comment: http://stackoverflow.com/comment/37258112
linked to: http://stackoverflow.com/q/31051527
has comment: http://stackoverflow.com/comment/37258164
has comment: http://stackoverflow.com/comment/37262624
type: UnansweredQuestion
score: -3
answer count: 1
has comment: http://stackoverflow.com/comment/37259266
has body: public class Adder { public static void main(String arr[]) { //System.in represents Standard Input Device (Keyboard) //Explain this next line, please: Scanner in = new Scanner(System.in); System.out.println("Enter First No."); int a = in.nextInt(); System.out.println("Enter Second No."); int b = in.nextInt(); int c = a+b; System.out.println("Sum is: "+c); } } I just started learning JAVA and i came across this code.Can someone explain me what does the marked line signify ?
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/31051527
tagged with: java
has title: Scanner in = new Scanner(System.in);
downvote count: 7
has comment: http://stackoverflow.com/comment/37258118
upvote count: 4
has answer: http://stackoverflow.com/a/25075113

http://stackoverflow.com/comment/37451138
type: AnswerComment
comment on: http://stackoverflow.com/a/24244478
has text: my response didn't show well: what i wanna say is instead of using this way of joining. i use now left join and it gets me the List<Facture> not List<Object> @Peter Wroblewski
type: Comment
score: 0

http://stackoverflow.com/a/24160550
score: 1
type: Answer
has body: You forgot to initialize pdao, that's why its firing Null Pointer, Initialize it: PostsDAO pdao = new PostsDAO();
answers question: http://stackoverflow.com/q/24160453
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24116802
has body: I have a JSP with this form: &lt;s:form action="GestionPagos.action"&gt; &lt;s:hidden key="actividad.id" /&gt; &lt;s:submit type="image" src="&lt;s:url value ="/Internal Resources/imagenes/alta.png"/&gt;"&gt; &lt;/s:submit&gt; &lt;/s:form&gt; But, when I try to render it in my browser, struts throws this error: org.apache.jasper.JasperException: /Private/GestionCalendarios/MenuCalendario.jsp (línea: 144, columna: 1) /Private/GestionCalendarios/ListadoActividadColaboradores.jsp (línea: 51, columna: 64) Tag &lt;s:submit not ended I'm pretty sure that this tag worked before, but after a update, it didn't work anymore. I can make it work using a classic HTML input tag, or splitting the button into two steps: using the url tag with a variable and then, using in the src field of the submit. But I want to know why isn't working together and what is the correct form of the tag.
favorite count: 0
tagged with: struts2
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24116904
tagged with: http://stackoverflow.com/tag/html
has title: Struts2 s:url for a image in s:submit not working
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24116904
tagged with: ognl
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/24116892
possible better answer: http://stackoverflow.com/a/24116892

http://stackoverflow.com/comment/37426687
score: 0
comment on: http://stackoverflow.com/q/24227968
type: QuestionComment
type: Comment
has text: @LukePeterson Yes the string format will remain the same. Yes there are 2 timings - Start time & End Time

http://stackoverflow.com/q/24140439
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24142277
has title: Error looking up function 'HelloWorld': The specified procedure could not be found
tagged with: java
answer count: 1
has body: I am trying to access a VB .NET dll method that I have made in my java code. I am trying to achieve this using JNA. Here's my Java code. Hello.java (invokes the dll method) import com.sun.jna.Native; public class Hello { public static void main(String[] args) { String myPath = System.getProperty("user.dir"); System.setProperty("java.library.path", myPath); NativeInterface nInterface = (NativeInterface) Native.loadLibrary( "SampleDLLProject", NativeInterface.class); nInterface.HelloWorld(); } } And here's the interface NativeInterface.java import com.sun.jna.*; public interface NativeInterface extends com.sun.jna.Library { public void HelloWorld(); } The error that I am facing is: Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'HelloWorld': The specified procedure could not be found. at com.sun.jna.Function.(Function.java:179) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:345) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:325) at com.sun.jna.Library$Handler.invoke(Library.java:203) at $Proxy0.HelloWorld(Unknown Source) at Hello.main(Hello.java:10) Also I checked the dll for any kind of discrepancy using ildasm. There is no difference between the method name present in dll and name in Hello.java. Interestingly, I tried to test the code for the puts() method of windows dll msvcrt.dll and it works perfectly fine. So the problem is for the DOT NET dlls . Please help!
type: Question
tagged with: jna
has answer: http://stackoverflow.com/a/24142277
tagged with: dll
tagged with: .net

http://stackoverflow.com/comment/37363190
has text: Better go with the second solutions, assert statements can be turned off by JVM arguments so you cannot relay on them. Use logging to write log files (always!), use if statements to do programming logic and use a debugger to debug.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24200109

http://stackoverflow.com/comment/37434151
type: Comment
comment on: http://stackoverflow.com/a/24237747
type: AnswerComment
has text: Thanks @BobTheBuilder So what I need to do, is reverse the loop when I tried to check if the sentence is contains the pattern?
score: 0

http://stackoverflow.com/comment/37377229
has text: Moreover this is a trivial example, it will not possible to tell in this case: Employee[] emps = someFucntionReturningArray()
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24207439

http://stackoverflow.com/comment/37444212
type: Comment
type: QuestionComment
has text: Yes, I agree, it would save a comparison only in some cases.
comment on: http://stackoverflow.com/q/24243092
score: 1

http://stackoverflow.com/q/24216075
upvote count: 1
downvote count: 0
answer count: 1
has body: I have been following the Android documentation showing you how to display openGL graphics using Android. I am pretty sure I have followed the code correctly but nothing is displaying. Here is my code: OpenGLES20Activity.java import javax.microedition.khronos.opengles.GL10; import android.app.Activity; import android.content.Context; import android.opengl.EGLConfig; import android.opengl.GLES20; import android.opengl.GLSurfaceView; import android.os.Bundle; public class OpenGLES20Activity extends Activity { private GLSurfaceView mGLView; private MyGLRenderer renderer; private static Triangle mTriangle; private static Square mSquare; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create a GLSurfaceView instance and set it // as the ContentView for this Activity. mGLView = new MyGLSurfaceView(this); setContentView(mGLView); } class MyGLSurfaceView extends GLSurfaceView { public MyGLSurfaceView(Context context){ super(context); // Create an OpenGL ES 2.0 context setEGLContextClientVersion(2); // Set the Renderer for drawing on the GLSurfaceView renderer = new MyGLRenderer(); setRenderer(renderer); } } public static class MyGLRenderer implements GLSurfaceView.Renderer { public void onSurfaceCreated(GL10 unused, EGLConfig config) { } public void onDrawFrame(GL10 unused) { // Redraw background color GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); mTriangle.draw(); } public void onSurfaceChanged(GL10 unused, int width, int height) { GLES20.glViewport(0, 0, width, height); } @Override public void onSurfaceCreated(GL10 gl, javax.microedition.khronos.egl.EGLConfig config) { // Set the background frame color GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // initialize a triangle mTriangle = new Triangle(); } public static int loadShader(int type, String shaderCode){ // create a vertex shader type (GLES20.GL_VERTEX_SHADER) // or a fragment shader type (GLES20.GL_FRAGMENT_SHADER) int shader = GLES20.glCreateShader(type); // add the s…
favorite count: 0
has title: Trying to display openGL graphics using Android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24216173
score: 1
tagged with: android
tagged with: java
tagged with: opengl-es
type: Question
accepted answer: http://stackoverflow.com/a/24216173

entity-system
tag name: entity-system
type: Tag
tags question: http://stackoverflow.com/q/24220204

http://stackoverflow.com/comment/37478317
type: QuestionComment
has text: @Anirban, yes i am lan connected, so if i just give http://my_computer1_ip/index.jsp instead of http://localhost:8080/index.jsp, it should behave the same r8?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24261062

http://stackoverflow.com/a/24136895
downvote count: 0
answers question: http://stackoverflow.com/q/24136831
has comment: http://stackoverflow.com/comment/37243664
has comment: http://stackoverflow.com/comment/37244470
type: Answer
has body: Try below code: gvProducts.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { Intent intent = new Intent(MainActivity.this, FullImageActivity.class); intent.putExtra("IMAGEPATH",products.get(position).imagePath); startActivity(intent); } }); In Activity: String path = getIntent().getStringExtra("IMAGEPATH");
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/37243719

http://stackoverflow.com/q/24215327
has answer: http://stackoverflow.com/a/24215332
accepted answer: http://stackoverflow.com/a/24215332
tagged with: java
has answer: http://stackoverflow.com/a/24215330
possible better answer: http://stackoverflow.com/a/24215330
type: AnsweredQuestion
has title: ArrayList iterator not working when declared in loop
answer count: 2
has body: Why is the first snip running in an endless loop while the second works? //Initial code ArrayList&lt;String&gt; myList = new ArrayList&lt;String&gt;(); myList.add("A"); myList.add("B"); myList.add("C"); myList.add("D"); myList.add("E"); while(myList.iterator().hasNext()) { System.out.println(myList.iterator().next()); } System.out.println(); //Correct code ArrayList&lt;String&gt; myList = new ArrayList&lt;String&gt;(); myList.add("A"); myList.add("B"); myList.add("C"); myList.add("D"); myList.add("E"); Iterator itr = myList.iterator(); while(itr.hasNext()) { System.out.println(itr.next()); } System.out.println();
has comment: http://stackoverflow.com/comment/37391969
score: 4
downvote count: 1
favorite count: 0
type: Question
upvote count: 5

http://stackoverflow.com/comment/37357565
comment on: http://stackoverflow.com/a/24197600
score: 0
type: Comment
type: AnswerComment
has text: Superb answer! Please take a look at the follow up question

http://stackoverflow.com/q/24113021
tagged with: java
has body: Good night guys. I'm doing a java applet to handle that uses the database, in times of insertion works right, the problem is in the update and delete the executeUpdate loops. for example, if I try to insert the following code by java will not. Now the cmd will. UPDATE CIDADE SET NOME_CIDADE = 'Alegre', UF = 'ES' WHERE CODCIDADE = '4' My class connection to the database is as follows: package gbd1.util.conexoes; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class ConexaoOracle implements IConexoes { private Connection con; private String nomeUsuario; private String senha; private String database; private PreparedStatement ps = null; private Statement stat = null; @Override public Connection IniciarConexao(String database, String usuario, String senha) throws SQLException { this.database = database; this.nomeUsuario = usuario; this.senha = senha; try { Class.forName("oracle.jdbc.OracleDriver"); con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE", "Paula", "2011204415"); stat = con.createStatement(); return con; } catch (ClassNotFoundException e) { throw new SQLException(e.getMessage()); } } public ResultSet querySelect(String sql) throws SQLException { ResultSet rs = null; rs = stat.executeQuery(sql); return rs; } public int updadeBanco(String sql) throws SQLException { stat = con.createStatement(); int i = stat.executeUpdate(sql); return i; } } This is the where clase call the executeUpdate.. public class RecuperacaoDados { private static IConexoes conexao; public static void recuperar(String sgbd, String nomeBd, String nomeUsuario, String senha) throws Exception{ //conexao = CriarConexao.create(sgbd); conexao = new ConexaoOracle(); conexao.IniciarConexao("", "", ""); //--------------------------------------- LogsCollection logs = LogsCollection.getLogs(null); String query; String atri; String valu; int i, j=0;…
has comment: http://stackoverflow.com/comment/37199330
has comment: http://stackoverflow.com/comment/37199236
has comment: http://stackoverflow.com/comment/37199500
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37199848
has comment: http://stackoverflow.com/comment/37199530
has title: loop in executeUpdate (java application, oracle)
has comment: http://stackoverflow.com/comment/37199535
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37200247
has comment: http://stackoverflow.com/comment/37199159
has comment: http://stackoverflow.com/comment/37199246
has comment: http://stackoverflow.com/comment/37199479
has comment: http://stackoverflow.com/comment/37199182
has comment: http://stackoverflow.com/comment/37200113
has comment: http://stackoverflow.com/comment/37199140
has comment: http://stackoverflow.com/comment/37199069
has comment: http://stackoverflow.com/comment/37199956
has comment: http://stackoverflow.com/comment/37199989
has comment: http://stackoverflow.com/comment/37199131
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/37199407
has comment: http://stackoverflow.com/comment/37199733
has comment: http://stackoverflow.com/comment/37199903
has comment: http://stackoverflow.com/comment/37200174
tagged with: oracle-database
upvote count: 1
score: 1

http://stackoverflow.com/a/24144151
has body: Background: java.lang.NullPointerException Somewhere in your code you have a NullPointerException. It will be in your logs, read through it. If would also suggest reading this article on how to debug small programs.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24143727
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37256940
accepted answer of: http://stackoverflow.com/q/24143727
score: 1

http://stackoverflow.com/a/43094378
score: 0
has body: DatabaseMetaData databaseMetaData = conn.getMetaData(); ResultSet resultSet = databaseMetaData.getPrimaryKeys(null, null , tablename); while (resultSet.next()) { String primarykeys= resultSet.getString(4); System.out.println(primarykeys); }
answers question: http://stackoverflow.com/q/24196801
type: Answer

http://stackoverflow.com/comment/37434007
type: AnswerComment
score: 0
has text: I think my description was not clear. Again, applet can open socket to host from where it was downloaded. The host names are compared as strings. For example even if you surf to `http://localhost/bla` and then open socket to `127.0.0.1` you fail on security restriction. When you start your applet not over HTTP the host name is "fake", so all your attempts to open socket will fail. Try to access over HTTP.
comment on: http://stackoverflow.com/a/24232412
type: Comment

http://stackoverflow.com/comment/37428010
type: QuestionComment
has text: possible duplicate of [Easy way to keeping angles between -179 and 180 degrees](http://stackoverflow.com/questions/2320986/easy-way-to-keeping-angles-between-179-and-180-degrees)
comment on: http://stackoverflow.com/q/24234609
score: 0
type: Comment

http://stackoverflow.com/comment/37373703
comment on: http://stackoverflow.com/a/24206092
type: Comment
score: 0
type: AnswerComment
has text: @RajarshiGoswami Well, you're right, the index out of bounds not matter. I was speaking for the counter ;)

http://stackoverflow.com/q/24192635
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24192690
tagged with: split
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/24192690
has comment: http://stackoverflow.com/comment/37347641
downvote count: 0
has title: How can i split a string using two delimeters with one being double tab?
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24192882
has answer: http://stackoverflow.com/a/24192882
tagged with: java
has body: I'm creating a parser in java and what i'm parsing is separated by a tab, and at one point it is separated by a double tab. Here's what i tried. The output only shows as if it is being split by one tab. Here's my code to split: String[] array1 = nextline.split("(\t)|(\t{2})"); i've also tried String[] array1 = nextline.split("(\t)|(\t\t)");
score: 2

ms-access-2007
tag name: ms-access-2007
tags question: http://stackoverflow.com/q/24193404
tags question: http://stackoverflow.com/q/24132855
type: Tag

http://stackoverflow.com/q/24174868
has comment: http://stackoverflow.com/comment/100887869
answer count: 2
has answer: http://stackoverflow.com/a/26713502
downvote count: 0
has answer: http://stackoverflow.com/a/24175702
favorite count: 0
has body: I'm trying to detect rectangles using OpenCV. However, sometimes this is getting pretty difficult after running the Canny method, because two of the edges are usually being erased out. I've tried many different sets of thresholds and blurring it before applying Canny, but I haven't got major positive results yet. Currently, I'm not blurring the image, so this is pretty much what I'm doing: Mat imgSource = Highgui.imread(filepath); Imgproc.Canny(imgSource, imgSource, 300, 600, 5, true); Example: original http://imagizer.imageshack.us/a/img822/8776/27i9j.jpg Canny http://imagizer.imageshack.us/a/img841/9868/wkc95.jpg Then, I'm trying OpenCV's findContours method to detect the rectangle, it works 80% of the time, how can I improve it?
tagged with: opencv
type: Question
tagged with: android
tagged with: java
has title: Edge detection using OpenCV (Canny)
type: UnansweredQuestion
upvote count: 10
score: 10
has comment: http://stackoverflow.com/comment/37328610

http://stackoverflow.com/q/24199241
accepted answer: http://stackoverflow.com/a/24201956
answer count: 1
tagged with: jax-rs
type: Question
tagged with: rest
has answer: http://stackoverflow.com/a/24201956
has body: I'm currently writing a REST API that uses a CXF interceptor to add certain headers to each request. The code of this interceptor is: public class TestHeaderInterceptor extends AbstractOutDatabindingInterceptor { public TestHeaderInterceptor() { super(Phase.SEND); } @SuppressWarnings("unchecked") @Override public void handleMessage(Message message) { MultivaluedMap&lt;String, Object&gt; headers = (MetadataMap&lt;String, Object&gt;) message.get(Message.PROTOCOL_HEADERS); if (headers == null) { headers = new MetadataMap&lt;String, Object&gt;(); } headers.add("X-Test", "test"); message.put(Message.PROTOCOL_HEADERS, headers); } } So, as you can see I'm adding a header called X-Test with value test. When I use a CXF REST client (proxy based), I'm using the following code to add the interceptor to the client: Client client = WebClient.client(clientObj); ClientConfiguration config = WebClient.getConfig(client); List&lt;Interceptor&lt;? extends Message&gt;&gt; interceptors = new ArrayList&lt;Interceptor&lt;? extends Message&gt;&gt;(); interceptors.add(new TestHeaderInterceptor()); config.setOutInterceptors(interceptors); My REST API only has 2 actions: @GET @Produces(JSON_UTF8) @Path("test/{id}") Test test(@PathParam("id") String id); @POST @Produces(JSON_UTF8) @Path("test2/{type}") @Consumes(JSON_UTF8) Test test2(Test obj, @PathParam("type") Type type); The test/{id} method works successfully and it adds the header (checked with Wireshark). However, the test2/{type} call does not add the header to the request. The weirdest thing is that, while using debug, the interceptor code is clearly invoked, which leaves me to think that somehow Apache CXF is ommitting the headers I add. That's also the reason why I'm using the Phase.SEND phase in stead of Phase.MARSHALL, just because I thought my headers are ommitted somewhere in the process of running through all these phases. But even now the headers are still missing.
type: AnsweredQuestion
has title: CXF AbstractOutDatabindingInterceptor header omitted during certain requests
score: 0
tagged with: cxf
tagged with: java

http://stackoverflow.com/comment/61293750
type: Comment
comment on: http://stackoverflow.com/a/24166163
has text: @linqu that is a valid approach. Some like the idea of decoupling the JSON representation from the syntax of your code so that changing a property name has less refactor scope. I think it either way is good.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37477903
comment on: http://stackoverflow.com/a/24260636
type: Comment
type: AnswerComment
score: 1
has text: thank you :) Since I am newbie in the Stackoverflow I can not vote up your answer. But I am voting up your answer "abstractly".

http://stackoverflow.com/q/24174764
type: Question
has comment: http://stackoverflow.com/comment/58657180
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37338072
tagged with: apache-camel
linked to: http://stackoverflow.com/q/4450925
has comment: http://stackoverflow.com/comment/37320660
has body: I am trying to read from OracleAQ using camel. i followed the steps given in http://activemq.apache.org/jms-bridge-with-oracle-aq.html I guess this would work if the messages are of type text. In my case it's an object and I am getting a JMS-137 error. I am unable to get around it using camel. any ideas/pointers would be appreciated.
answer count: 0
tagged with: activemq-classic
score: 1
tagged with: java
downvote count: 0
upvote count: 1
tagged with: jms
has title: Reading OracleAQ message using Camel
has comment: http://stackoverflow.com/comment/37425111
favorite count: 0

http://stackoverflow.com/q/24187082
type: UnansweredQuestion
has body: I have a problem with autowiring component with spring. Im trying inject bean (UserRepository) into java class Reader. When im using autowire annotation the object is allways null. I try add into spring-config.xml bean 'reader' whith property 'userRepository' but this not working too. What is missing? spring-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" 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"> <context:component-scan base-package="reader" /> <context:annotation-config/> </beans> Reader.java: @Service @Path("/") public class Reader { @Autowired private UserRepository userRepository; @GET @Path("/test") public void test(){ System.out.println("test"); userRepository.findAll(); //this is allways null } @POST @Path("/dom2") public Response read(String nonParsedWords){ Words parsedWords = WordParser.parseWords(nonParsedWords); for(String word : parsedWords.getWords()){ System.out.println(word); } return Response.status(200).entity(nonParsedWords).build(); } public void setUserRepository(UserRepository userRepository) { this.userRepository = userRepository; } } Is there something wrong with context of application? Why this bean cant not be injected? Spring version: 2.5.6 EDIT: hibernate.cfg.xml: <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration> true true org.hibernate.dialect.SQLiteDialect org.sqlite.JDBC jdbc:sqlite:IntelliDOM.sqlite update <mapping class="entity.User"/> </hibernate-configuration>
tagged with: java
has comment: http://stackoverflow.com/comment/37337201
has comment: http://stackoverflow.com/comment/37336885
tagged with: spring
has comment: http://stackoverflow.com/comment/37338428
has comment: http://stackoverflow.com/comment/37338128
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37338237
score: 0
has comment: http://stackoverflow.com/comment/37339628
answer count: 0
has comment: http://stackoverflow.com/comment/37339012
has title: Spring autowire null value
has comment: http://stackoverflow.com/comment/37336931
has comment: http://stackoverflow.com/comment/37338371
linked to: http://stackoverflow.com/q/19745187
has comment: http://stackoverflow.com/comment/37338187
has comment: http://stackoverflow.com/comment/37338777
type: Question
has comment: http://stackoverflow.com/comment/37339445

http://stackoverflow.com/comment/139099172
comment on: http://stackoverflow.com/a/78894315
has text: With MySQL, all date-time types "on the wire" have the form `2014-06-18 07:00:00`. In other words, the protocol encodes all date-time types as strings without an offset when they are transmitted to the database. Upon storage, the database server uses the current session timezone to convert that string to UTC if the target field is a `TIMESTAMP`. This is reversed when the `TIMESTAMP` is read. I haven't verified how the driver handles `OffsetDateTime`, but based on `Calendar` treatment, I expect the offset to be used by the driver when encoding the offset date-time to a string for transmission.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24111792
possible better answer: http://stackoverflow.com/a/24111817
has answer: http://stackoverflow.com/a/24111804
score: -1
has comment: http://stackoverflow.com/comment/37196706
type: AnsweredQuestion
upvote count: 0
tagged with: java
has title: How to determine length of occupied spaces in arrays
answer count: 2
tagged with: arrays
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24111817
has body: I have an array and I need to check the number of elements which are not null. For example: String carlist[] =new String[50] carlist[0] = ferrari carlist[1] = bentley //all other values will be null. How do I find out the answer, 2, which is the number of occupied places?
type: Question
tagged with: null
accepted answer: http://stackoverflow.com/a/24111804

http://stackoverflow.com/comment/37416273
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24178699
score: 1
has text: Yeah way ids are only 200K http://wiki.openstreetmap.org/wiki/Stats ... re tags: would also be nice to have in core GH e.g. via configuration. Maybe you can provide a PR :)

http://stackoverflow.com/comment/37333691
has text: Ok yep, that makes sense--just clarifying.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24171649
score: 0

http://stackoverflow.com/q/24132806
score: 0
has answer: http://stackoverflow.com/a/24132838
tagged with: android
tagged with: java
answer count: 1
has title: Eclipse Project Starts With Errors
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/24132838
has comment: http://stackoverflow.com/comment/37235862
type: AnsweredQuestion
has body: I'm following along with the beginners tutorial for android development in Eclipse. I followed the instructions given in the tutorial for starting the project to the letter, and yet it begins with errors that make it so you can't even run the test "hello world" program. The container 'Android Dependencies' references non existing library C:\Users\Public\Documents\Android Development\Workspace\appcompat_v7_2\bin\appcompat_v7_2.jar' The project cannot be built until build path errors are resolved appcompat_v7_2 The project cannot be built until build path errors are resolved MyFirstApp This confuses me greatly, and these errors are not addressed in the tutorial. I'd appreciate any help in resolving these errors so that I can hopefully learn something. Thanks,

http://stackoverflow.com/comment/37442412
has text: @FamilyMaze - If your problem has been solved, don't forget to upvote any answers you found helpful and accept the answer that best answered your question by clicking the grey tick. If none of the answers so far were adequate, you can post your own if you found another solution.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24108391
score: 0

http://stackoverflow.com/q/24230633
type: Question
tagged with: numberformatexception
has comment: http://stackoverflow.com/comment/37420273
type: UnansweredQuestion
downvote count: 2
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37444750
has comment: http://stackoverflow.com/comment/37420105
favorite count: 0
has comment: http://stackoverflow.com/comment/37420049
has comment: http://stackoverflow.com/comment/37420052
has comment: http://stackoverflow.com/comment/37488113
has body: I get this exception from custom's logs: java.lang.NumberFormatException: Invalid int: "12px" at java.lang.Integer.invalidInt(Integer.java:137) at java.lang.Integer.parse(Integer.java:374) at java.lang.Integer.parseInt(Integer.java:365) at java.lang.Integer.parseInt(Integer.java:331) Then I check the related codes, but I cannot understand why this exception occurs: String fontSize = styles.getStyle("font-size"); if (fontSize.endsWith("px")) { fontSize = fontSize.substring(0, fontSize.length() -2); } setWeight(Integer.parseInt(fontSize)); Thanks! This is my fix: try { setWeight(Integer.parseInt(fontSize)); } catch (NumberFormatException e) { setWeight(12); }
has answer: http://stackoverflow.com/a/24230771
tagged with: java
has comment: http://stackoverflow.com/comment/37420244
score: -1
has title: Why my codes throw NumberFormatException?
has comment: http://stackoverflow.com/comment/37420029

http://stackoverflow.com/comment/37426352
score: 0
type: QuestionComment
has text: My apologies , Anubian Noob and Sotirios DElimanolis was correct, i just changed the second code with IOException and Exception, and i have the message the error is already handled. That is what i noticed in first time
type: Comment
comment on: http://stackoverflow.com/q/24233659

http://stackoverflow.com/a/24174129
type: Answer
has body: Kepler SR2 isn't supported for Worklight 6.1x. I don't know if this is the cause, but there was some unpredictable behavior with SR2. I would suggest trying it on Kepler SR1 and see if you get the same behavior. Get links to supported eclipse releases and editions here: https://www.ibm.com/developerworks/mobile/worklight/download/
answers question: http://stackoverflow.com/q/24164379
score: 0
has comment: http://stackoverflow.com/comment/37390601

http://stackoverflow.com/comment/37435116
score: 2
comment on: http://stackoverflow.com/q/24238293
has text: 0.0 == -0.0 isn't a specificity of Java : it's specified by IEEE754
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37456065
score: 0
type: QuestionComment
has text: I'm sorry... I will change now.
type: Comment
comment on: http://stackoverflow.com/q/24249136

http://stackoverflow.com/a/24142914
upvote count: 3
has body: Change this line: for (String s : list) { to for (Object s : list) {
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24142608
answers question: http://stackoverflow.com/q/24142608
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/37254569
has comment: http://stackoverflow.com/comment/37254505

http://stackoverflow.com/a/24196815
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37357509
score: 2
has body: It's a difficult question to answer, as there is some opinion for both arguments. However, if we look at the byte code for each: Remove Lowest no intermediates public void removeLowest(); Code: 0: aload_0 1: aload_0 2: aload_0 3: invokespecial #2 // Method lowScore:()D 6: invokespecial #3 // Method find:(D)I 9: invokespecial #4 // Method remove:(I)V 12: return Lowest with Intermediates public void removeLowest2(); Code: 0: aload_0 1: invokespecial #2 // Method lowScore:()D 4: dstore_1 5: aload_0 6: dload_1 7: invokespecial #3 // Method find:(D)I 10: istore_3 11: aload_0 12: iload_3 13: invokespecial #4 // Method remove:(I)V 16: return So you can see here that the intermediates do require more operations and storage. However, remember that the JVM is smart - so at runtime it will likely perform optimisations to this bytecode. Chances are if you call this a certain number of times it would inline the methods all into the same block anyway and remove the local storage. In terms of your question, I'd go for readability over trying to write your code more compact at the cost of legibility. This is purely because that from your code -> byte code -> hotspot so much will happen to optimize this code that your main concern is writing the most maintainable code possible. As others have mentioned a few intermediate storage values that represent meaning cost very little in the bigger picture.
upvote count: 2
answers question: http://stackoverflow.com/q/24196631

http://stackoverflow.com/comment/37415422
score: 0
type: Comment
type: QuestionComment
has text: @AntP Did I ask more than one question?
comment on: http://stackoverflow.com/q/24227971

http://stackoverflow.com/comment/37341253
comment on: http://stackoverflow.com/q/24188329
type: Comment
has text: @Gimby could this error I'm getting trying to access the bean on the jboss server mean that it is not deployed or for some other reason? Could not obtain connection to any of these urls: apprd:4447
type: QuestionComment
score: 0

http://stackoverflow.com/q/24221922
upvote count: 10
linked to: http://stackoverflow.com/q/43693393
has comment: http://stackoverflow.com/comment/37403719
type: Question
accepted answer: http://stackoverflow.com/a/24224347
has answer: http://stackoverflow.com/a/31595129
score: 9
has answer: http://stackoverflow.com/a/24224347
downvote count: 1
has body: In the Spring Boot make the frontend part update without restarting the application?
possible better answer: http://stackoverflow.com/a/44172607
favorite count: 0
has comment: http://stackoverflow.com/comment/37403775
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/44172607
linked to: http://stackoverflow.com/q/72642346
answer count: 5
tagged with: java
linked to: http://stackoverflow.com/q/24762657
tagged with: spring-tool-suite
has answer: http://stackoverflow.com/a/37727280
has title: Spring Boot, update frontend without restarting the application
has answer: http://stackoverflow.com/a/60074764

http://stackoverflow.com/comment/37190191
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24108518
type: Comment
has text: Also see [Encapsulation](http://en.wikipedia.org/wiki/Encapsulation_%28object-oriented_programming%29)

http://stackoverflow.com/q/24173690
score: 0
tagged with: java
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/37312674
tagged with: subclass
tagged with: hashtable
has comment: http://stackoverflow.com/comment/37312770
has answer: http://stackoverflow.com/a/24173729
accepted answer: http://stackoverflow.com/a/24173729
has body: I'm having some problems doing an HashTable in Java with an Object as value. So, I have a superclass called "Bonus" and I got some subclasses called HammerBonus, BombBonus, etc. I have created my HashTable like this: private Hashtable&lt;String, Bonus&gt; hashBonusElement= new Hashtable&lt;String, Bonus&gt;(); But now I cant add any subclass as a value, for exemple: hashBonusElement.put(Hammer.class.getSimpleName(), HammerBonus); It says that "HammerBonuscannot be resolved to a variable". I have tried somethings like "(Bonus)HammerBonus", "HammerBonus.class" but nothing works... Is there anything that I can do for make it work? Thank you in advance for your help!
has comment: http://stackoverflow.com/comment/37312708
has title: HashTable superclass as value
has comment: http://stackoverflow.com/comment/37312728
type: AnsweredQuestion

http://stackoverflow.com/comment/37925877
comment on: http://stackoverflow.com/q/24171551
type: Comment
type: QuestionComment
score: 0
has text: why was this closed as unclear? It may have been a duplicate, but then why not merge it simply with the other one?

http://stackoverflow.com/q/24202480
upvote count: 2
tagged with: maven
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24204769
has answer: http://stackoverflow.com/a/24204769
tagged with: java
has body: We're trying to build and deploy our web application to WebLogic 12c server. Our problem is that our generated application.xml is missing trailing slashes. Our generated application.xml looks as follows: <?xml version="1.0" encoding="UTF-8"?> app-ear app-web-0.3.0.war our-application common-ejb-0.1.jar app-ejb-0.3.0.jar app-dao-0.3.0.jar lib If we manually inserts slashes: <?xml version="1.0" encoding="UTF-8"?> app-ear /app-web-0.3.0.war /our-application /common-ejb-0.1.jar /app-ejb-0.3.0.jar /app-dao-0.3.0.jar lib everything works just fine. Unfortunately we're not able to manually edit application.xml on production. Does anyone know how to handle this problem?
answer count: 1
downvote count: 0
has title: Required trailing slashes in application.xml
tagged with: deployment
favorite count: 0
type: Question
tagged with: jakarta-ee
tagged with: weblogic

http://stackoverflow.com/a/24163254
answers question: http://stackoverflow.com/q/24146395
has comment: http://stackoverflow.com/comment/78507440
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24146395
type: Answer
score: 3
has body: I have managed to save the image somehow. Not sure if that is an efficient way of doing this. Please comment if you feel this might not be an efficient way of doing this. Appreciate your feedback. My JavaScript code: var canvasServer = document.getElementById("canvasThumbResult"); var context = canvasServer.getContext("2d"); var imageDataURL = canvasServer.toDataURL('image/png'); var ajax = new XMLHttpRequest(); ajax.open("POST",trinityCvaServicesUrl+"common/uploadImage",false); ajax.setRequestHeader("Content-Type", "application/upload"); ajax.send(imageDataURL); My Java Code: InputStream in = null; FileOutputStream fos = null; try { HttpServletRequestWrapper wrappedRequest = new HttpServletRequestWrapper(req); InputStream is = wrappedRequest.getInputStream(); StringWriter writer = new StringWriter(); IOUtils.copy(is, writer, "UTF-8"); String imageString = writer.toString(); imageString = imageString.substring("data:image/png;base64," .length()); byte[] contentData = imageString.getBytes(); byte[] decodedData = Base64.decodeBase64(contentData); String imgName = ReloadableProps .getProperty("local.image.save.path") + String.valueOf(System.currentTimeMillis()) + ".png"; fos = new FileOutputStream(imgName); fos.write(decodedData); } catch (Exception e) { e.printStackTrace(); String loggerMessage = "Upload image failed : "; CVAException.printException(loggerMessage + e.getMessage()); } finally { if (in != null) { in.close(); } if (fos != null) { fos.close(); } }
upvote count: 3

http://stackoverflow.com/comment/37413767
score: 2
type: Comment
comment on: http://stackoverflow.com/q/24227043
type: QuestionComment
has text: "My encryption function returns encrypted value as String" - let me ask the obvious... Why are you returning a `String` when you don't want or need it?

http://stackoverflow.com/q/24122672
tagged with: aspectj
has answer: http://stackoverflow.com/a/24123388
has comment: http://stackoverflow.com/comment/37217372
tagged with: lambda
tagged with: java-8
has title: ajc wont compile lambda as an vararg argument
upvote count: 2
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24123388
downvote count: 0
tagged with: java
answer count: 1
has body: I'm using ajc 1.8, java 8 and experiencing compiler issue. Here's the sample code. public class ExecutorTests { List&lt;Runnable&gt; tasks = Arrays.asList( () -&gt; { System.out.println("task1 start"); try { Thread.sleep(1000); } catch (Exception ignored) {} System.out.println("task1 end"); }, () -&gt; { System.out.println("task2 start"); try { Thread.sleep(1000); } catch (Exception ignored) {} System.out.println("task2 end"); }, () -&gt; { System.out.println("task3 start"); try { Thread.sleep(1000); } catch (Exception ignored) {} System.out.println("task3 end"); } ); @Test public void executeInSync(){ tasks.stream().forEach(Runnable::run); } } This code properly compiles and executes with javac meanwhile ajc fails with following : If I replace lambdas with anonymous classes this will compile and run, but I'd like to find workaround that didnt force me to get back to anonymous classes, any vm arguments or any other workarounds? My recent issue with java 8 code compilation issue with ajc were solved using -noverify flag. Maybe I'll get rid of all issues using load time weaving?
favorite count: 0
type: Question

http://stackoverflow.com/comment/37411400
comment on: http://stackoverflow.com/a/24225540
type: Comment
has text: @user1282256 `What is the problem with the regex` Which one?... The first, the second, or the one you modified? Tell me which one you're planning to use, I'll tell you the problems (if any remain.)
type: AnswerComment
score: 0

http://stackoverflow.com/a/24141781
answers question: http://stackoverflow.com/q/24141156
type: Answer
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24141156
score: 2
has body: postArray = request.getParameterValues("postData"); I think you can replace this with actual field names commentName = request.getParameter("name"); comment = request.getParameter("comment"); this will solve your problem

http://stackoverflow.com/a/24206821
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24204966
score: 1
type: Answer
has body: In my opinion the replace mechanism is good enough for comparing strings without considering white spaces. You can use following (using regex): // regular expression \s for white space tab etc System.out.println(a.replaceAll("\s", "").equals(b.replaceAll("\s", ""))); This will take care of all white space (including tabs) at leading, trailing and in-between of string.

http://stackoverflow.com/comment/37325930
type: Comment
comment on: http://stackoverflow.com/q/24181369
type: QuestionComment
has text: What version of Java are you using?
score: 0

http://stackoverflow.com/comment/37389885
score: 0
type: Comment
type: QuestionComment
has text: @Braj Do I just replace the TokenHelper with the UUID and use UUID.randomUUID() instead of TokenHelper.generateGUID?
comment on: http://stackoverflow.com/q/24214205

http://stackoverflow.com/a/24264080
score: 0
has body: You basically answered your own question. Evaluation order makes all the difference. basic left to right evaluation results in different type casting than your explicit evaluation order in your second example
type: Answer
answers question: http://stackoverflow.com/q/24264029

http://stackoverflow.com/q/24157810
has comment: http://stackoverflow.com/comment/37282289
upvote count: 0
has answer: http://stackoverflow.com/a/24176014
tagged with: reflection
has body: I'm working with two branches of a code base, where in the former a call to classA.newInstance() invokes classA's no-arg constructor, but in the latter the object is created without invoking classA's no-arg constructor, although the constructor exists in both, and I need it to be invoked because it does some trivial initialization. Both versions of classA are nearly identical, minus a couple lines of code in an insignificant method and an additional import statement. Its no-arg constructor doesn't throw exceptions and is publicly accessible in each version. The calling class is also identical, except in the version that doesn't work it is in a slightly different package than it's other branch. I can't understand how it's ignoring the no-arg constructor. The class name is correct, access is the same, etc. Am I missing something obvious? I'm stumped after researching online..maybe I'll start stepping through the class.newInstance code itself. Hope this question makes sense!
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question
has title: Class.newInstance() oddity
tagged with: constructor
type: UnansweredQuestion
score: -1

http://stackoverflow.com/q/24116587
score: 0
has body: I have an EditText view: &lt;EditText android:id="@+id/commentEditText" android:layout_width="180dp" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:ems="10" android:imeOptions="actionDone" android:inputType="textMultiLine" /&gt; I want to disable the "enter" key when user insert input. Instead I want the keyboard to have a "done" key that will close the softkeyboard. does adding android:imeOptions="actionDone" isn't enough? The "enter" key is still on my Nexus 4 and no done key is there. Do I have to override onEditorAction or does "action_done" has a default behavior? Thanks,
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24116644
accepted answer: http://stackoverflow.com/a/24116644
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24116640
possible better answer: http://stackoverflow.com/a/24116640
has title: Do I have to override `onEditorAction` or does "action_done" has a default behavior?
tagged with: android-softkeyboard
type: AnsweredQuestion

http://stackoverflow.com/comment/37398520
type: Comment
has text: As far I understood curl -X is a command line client tool for URL manipulations,it meant making a call to the REST API given with the sets of data.U might try with \n once
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24219023

http://stackoverflow.com/q/24221361
has answer: http://stackoverflow.com/a/50733212
tagged with: java
has answer: http://stackoverflow.com/a/24221401
has answer: http://stackoverflow.com/a/24221385
answer count: 11
tagged with: eclipse
has answer: http://stackoverflow.com/a/75295551
has comment: http://stackoverflow.com/comment/53525400
has answer: http://stackoverflow.com/a/72975766
type: Question
has answer: http://stackoverflow.com/a/46296728
has body: I have just installed maven. I downloaded distributive, extracted files and set bin value environment variables, but when I type mvn -version in CMD I am getting message: 'mvn' is not recognized as an internal or external command, operable program or batch file. I am writing project. I have one project DatabaseAPI where I have logic of database and POJO classes. second project is CoreAPI where I have some methods. For DatabaseAPI I make a jar file using eclipse (export -> jar). In core I add external jar (DatabaseAPI.jar). For CoreAPI I make a jar file using eclipse (export -> jar). In core I add external jar (CoreAPI.jar) and I tried to start tomcat (I have servlets in my project and swing too). I got error during starting and error is ClassNotFoundException (One of the classes in CoreAPI did not find). Is it problem of exporting using Eclipse ?
has answer: http://stackoverflow.com/a/34588704
has answer: http://stackoverflow.com/a/59564010
type: UnansweredQuestion
upvote count: 59
downvote count: 0
tagged with: jar
tagged with: maven
has answer: http://stackoverflow.com/a/32136289
tagged with: tomcat
has title: Checking Maven Version
favorite count: 0
has answer: http://stackoverflow.com/a/78470439
has answer: http://stackoverflow.com/a/34587875
score: 59

http://stackoverflow.com/q/24119467
downvote count: 0
has title: java explicit type conversion gives different results
has answer: http://stackoverflow.com/a/55889850
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/37211831
has comment: http://stackoverflow.com/comment/37210455
score: 1
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37210694
has body: I would like to know in which order does the explicit type conversion work and in what area does it work. In the next example I receive different results. float S = 0; for (int i = 1; i &lt;= 10; i++) for (int j = 3; j &lt;= 20; j++) S += (i * j - 5.)/(2. * i + j / 3); the result is 621.8933 float S = 0; for (float i = 1; i &lt;= 10; i++) for (float j = 3; j &lt;= 20; j++) S += (i * j - 5)/(2. * i + j / 3); S = 607.3105 float S = 0; for (int i = 1; i &lt;= 10; i++) for (int j = 3; j &lt;= 20; j++) S += (float)(i * j - 5)/(2 * i + j / 3); S = 621.8933 float S = 0; for (int i = 1; i &lt;= 10; i++) for (int j = 3; j &lt;= 20; j++) S += (i * j - 5)/(2 * i + j / 3.); S = 607.3105 Obviously the correct result is 607.3105. Why doesn't it promote when I write (float) or multiply by 2., but it works when I divide by 3.? Thanks in advance.
upvote count: 1
favorite count: 0
type: Question
tagged with: promotions
has comment: http://stackoverflow.com/comment/37212068
tagged with: explicit
type: UnansweredQuestion

http://stackoverflow.com/comment/37363250
score: 0
comment on: http://stackoverflow.com/a/24200672
type: Comment
type: AnswerComment
has text: A modal dialog won't be enough to cause a game running in another thread to wait, will it?

ant
tags question: http://stackoverflow.com/q/24191161
tags question: http://stackoverflow.com/q/24106371
tag name: ant
tags question: http://stackoverflow.com/q/24131339
tags question: http://stackoverflow.com/q/24116082
tags question: http://stackoverflow.com/q/24203290
tags question: http://stackoverflow.com/q/24114790
tags question: http://stackoverflow.com/q/24185378
tags question: http://stackoverflow.com/q/24146359
tags question: http://stackoverflow.com/q/24245571
tags question: http://stackoverflow.com/q/24205481
tags question: http://stackoverflow.com/q/24198692
tags question: http://stackoverflow.com/q/24254487
type: Tag
tags question: http://stackoverflow.com/q/24221439
tags question: http://stackoverflow.com/q/24164498
tags question: http://stackoverflow.com/q/24204953
tags question: http://stackoverflow.com/q/24189518
tags question: http://stackoverflow.com/q/24265457
tags question: http://stackoverflow.com/q/24123003
tags question: http://stackoverflow.com/q/24240340
tags question: http://stackoverflow.com/q/24185603
tags question: http://stackoverflow.com/q/24259160
tags question: http://stackoverflow.com/q/24128987

http://stackoverflow.com/a/24121802
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37215079
has comment: http://stackoverflow.com/comment/37214901
upvote count: 8
has body: dispatchKeyEvent fire twice: the first time for key down, and the second time for key up, so you have to filter: if (event.getAction()!=KeyEvent.ACTION_DOWN) return true; switch (keyCode) { case KeyEvent.KEYCODE_1 : MakeToast(1); break; case KeyEvent.KEYCODE_2 : MakeToast(2); break; case KeyEvent.KEYCODE_3 : MakeToast(3); break; }
type: Answer
score: 8
answers question: http://stackoverflow.com/q/24121644
accepted answer of: http://stackoverflow.com/q/24121644

http://stackoverflow.com/q/24173005
tagged with: java
tagged with: mapreduce
tagged with: hadoop
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24175763
tagged with: hdfs
has title: Arguments in Hadoop Mapper Class
type: Question
has body: I am developing a sentiment analysis tool that receives the content from a .txt file and need to check in a dictionary if the word is positive or negative. I use FileInputFormat.addInputPath(args[0]) to reference the .txt file that contain the words to be analyzed. I tried to create an ArrayList with the content of the dictionary (.txt file 64KB) and pass it an static object to a Class ReadDictionary that is used in the Mapper clas. Running it on eclipse is ok, but when I try to run on Hadoop I get some errors. How can I pass the content of the dictionary (.txt file 64KB) to map class in a efficient way to run on Hadoop (HDFS)?
score: 0
has answer: http://stackoverflow.com/a/24173350

http://stackoverflow.com/a/24142474
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24142378
has comment: http://stackoverflow.com/comment/37277495
downvote count: 0
upvote count: 1
has body: You could try using the URLDecoder.decode() and URLEncoder.encode() classes from java.net: URLDecoder.decode("String with Hindi characters", "UTF-8"); URLEncoder.encode("String with Hindi characters", "UTF-8");

http://stackoverflow.com/q/24192998
score: 2
has comment: http://stackoverflow.com/comment/37348496
answer count: 3
tagged with: locking
upvote count: 2
has comment: http://stackoverflow.com/comment/37348434
tagged with: java
tagged with: signals
has answer: http://stackoverflow.com/a/24198787
tagged with: multithreading
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/37348571
accepted answer: http://stackoverflow.com/a/24193168
has body: I have a following code. ReadWriteLock someLock = new ReentrantReadWriteLock(); Condition someCondition = someLock.writeLock().newCondition(); public someMethod() { // do some stuff someCondition.await(); //Lock here. System.out.prinltn("This never prints"); } public doSomeStuff() { new Thread(new Runnable() { @Override public void run() { try { someMethod(); System.out.println("thread finished"); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("thread is going to die"); } }).start(); } When the thread calls the method someMethod() it gets executed. But since there is an await() method on that function. It never ends / it does not print 'This never prints', unless its woken up by singnalAll(). But I want the thread to be finished once its executed. I cannot refactor the whole thing. I just need a workaround to this problem. Its used in Swing application. So thread is important.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24193168
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37348457
possible better answer: http://stackoverflow.com/a/24193589
linked to: http://stackoverflow.com/q/24197744
has title: Method call from thread does not finish - How to end the thread - Workaround
has answer: http://stackoverflow.com/a/24193589
has comment: http://stackoverflow.com/comment/37349062

http://stackoverflow.com/a/24228508
downvote count: 0
answers question: http://stackoverflow.com/q/24225994
score: 1
type: Answer
upvote count: 1
has body: This tells you, that you dont have resource refernce with the name jdbc/xyz. You need to either define one in web.xml, or check, if somewhere in the code you are using annotation @Resource. It should have name jdbc/xyz, like this: @Resource(name="jdbc/xyz") DataSource ds;

http://stackoverflow.com/a/24237107
has body: Regular expressions may help you: String str = "www.google.co.in"; String [] res = str.split("(\\.|//)+(?=\\w)"); System.out.println(res[1]); A regular expression is a way to represent a set of strings. This set is composed by any string matching the expression. In the code above, the string used as split argument is the regular expression that matches: Any "." followed by an alphanumeric text OR "//" followed by an alphanumeric text. So these "." and "//" substrings are the separators used to split the string in parts, being the first one the site name. In "www.google.co.in", the string would be splited this way: goole, co, in. Since the solution is using the first element of the spit array, the result is: google.
has comment: http://stackoverflow.com/comment/37433118
type: Answer
has comment: http://stackoverflow.com/comment/37433289
has comment: http://stackoverflow.com/comment/37433187
has comment: http://stackoverflow.com/comment/37433492
has comment: http://stackoverflow.com/comment/37432968
has comment: http://stackoverflow.com/comment/37433169
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37433395
answers question: http://stackoverflow.com/q/24237036

http://stackoverflow.com/q/24242594
score: 0
has title: jboss 6.x: sending e-Mails if any type of Exception is thrown
tagged with: java
tagged with: email
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/24244582
type: UnansweredQuestion
tagged with: jboss
has body: I am using JBoss for my application and I want to setup automatic email sending feature in JBoss. Please find below code of my JBossp-logging.xml file: <only-once/> <level name="ERROR"/> 50 <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/> After adding this when I start JBoss server, I am getting following error: 15:19:15,149 ERROR [AbstractKernelController] Error installing to Parse: name=vfs:///D:/2.0.10branch/platformV2/jboss-2.0.10/server/default/deploy/jboss-logging.xml state=PreParse mode=Manual requiredState=Parse: org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfs:///D:/2.0.10branch/platformV2/jboss-2.0.10/server/default/deploy/jboss-logging.xml at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.2.GA] at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:383) [:2.2.2.GA] at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:343) [:2.2.2.GA] at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:315) [:2.2.2.GA] at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:255) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.2.GA] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2] at org.jboss.dependency.plugins.AbstractContro…
tagged with: jboss6.x

http://stackoverflow.com/q/24116672
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/68585608
favorite count: 0
tagged with: nashorn
has body: We are currently in the process of adding a server-side scripting capability to one of our products. As part of this I am evaluating JSR 223 script engines. As we may potentially be running large numbers of scripts on the server, I am particularly concerned about memory usage of these script engines. Comparing Rhino (Apple JDK 1.6.0_65-b14-462-11M4609, Mac OS X 10.9.2) with Nashorn (Oracle JDK 1.8.0-b132) there seems to be a dramatic difference in memory usage per ScriptEngine instance. To test this, I use a simple program that fires up 10 blank ScriptEngine instances and then blocks reading from stdin. I then use jmap to take a heap dump (jmap -dump:format=b,file=heap.bin ) and then search for the relevant script engine instance in the dump: import javax.script.*; public class test { public static void main(String...args) throws Exception { ScriptContext context = new SimpleScriptContext(); context.setWriter(null); context.setErrorWriter(null); context.setReader(null); ScriptEngine js[] = new ScriptEngine[10]; for (int i = 0; i &lt; 10; ++i) { js[i] = new ScriptEngineManager().getEngineByName("javascript"); js[i].setContext(context); System.out.println(js[i].getClass().toString()); } System.in.read(); } } The reason for nulling out the various reader/writer fields in the context is because we do not use them, and earlier heap dumps for Rhino suggest that they constitute a significant fraction of the per-instance overhead (and do not appear to be shared). Analysing these heap dumps in Eclipse MAT then I get the following per-instance retained heap sizes: Rhino: 13,472 bytes/instance (goes up to 73,832 bytes/instance if I do not null the reader/writer fields) Nashorn: 324,408 bytes/instance Is this 24x increase in size for Nashorn to be expected? Execution speed is not a major concern for the scripts we will be executing (which will mostly be I/O bound), so I am considering shipping our own copy of Rhino for use in Java 8+.
tagged with: java
has comment: http://stackoverflow.com/comment/51699645
score: 10
upvote count: 10
has title: How much memory does a Nashorn ScriptEngine use?
type: Question
has comment: http://stackoverflow.com/comment/49459763
tagged with: jsr223
type: UnansweredQuestion

http://stackoverflow.com/comment/37213517
score: 0
type: Comment
has text: well, you've got a point there... maybe I'll try mockito... thnx for your help :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24119124

http://stackoverflow.com/comment/37286722
has text: if `myClass` never changes it should be `final` rather than `volatile`. Having both, `myClass` and `bolVal`, being mutable doesn’t look sound to me.
comment on: http://stackoverflow.com/q/24160405
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/46163243
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24198789
score: 0
has text: Question is so confusing. Parser is written in 3 languages?? The parser well might be in Java as well. Please explain the question further.

http://stackoverflow.com/q/24239558
linked to: http://stackoverflow.com/q/1590306
has comment: http://stackoverflow.com/comment/37437501
type: AnsweredQuestion
downvote count: 0
answer count: 1
tagged with: jms
favorite count: 0
has title: JMS creating topics dynamically
type: Question
has comment: http://stackoverflow.com/comment/37437484
has answer: http://stackoverflow.com/a/24239789
accepted answer: http://stackoverflow.com/a/24239789
has body: I am developing a webapp using Spring and there are several other apps that are influenced by the information generated in mine. Basically they want to know when a change has been made in the data I manage. This data can be filtered by a certain A property. Since the number of apps to "subscribe" to this information is variable, I thought about implementing a JMS publisher/subscriber model in which I create queues according to the filtering A property and then notify of changes to that queue. All subscribers would then receive the notification through their JMS listeners. Is this scenario even possible? That is, can I embed a JMS queue in my Spring webapp (how?) and can I create these queues dynamically (i.e. I create queues for my A catalogue, then if a new element gets added to that catalogue, a new queue should be created dynamically without human intervention). Or is there any better solution to create this filtering functionality?
tagged with: java
tagged with: spring
score: 4
upvote count: 4

http://stackoverflow.com/comment/37446531
comment on: http://stackoverflow.com/q/24244037
type: Comment
type: QuestionComment
has text: Store the last data array and compare with the new data array. If the data has changed then update the chart. If there is no change in data skip the redraw.
score: 0

http://stackoverflow.com/comment/37302689
score: 1
type: Comment
type: QuestionComment
has text: (Hint: SO isn't a code-writing service. If you want help, you need a more specific question)
comment on: http://stackoverflow.com/q/24168572

http://stackoverflow.com/comment/37385810
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24212191
score: 0
has text: Sorry @bali182 I had written 4 can't be before 8 that was wrong :(

http://stackoverflow.com/comment/37450495
has text: @JeeshuMittal [this site offers some good advices](http://eclipsesource.com/blogs/2012/09/18/must-reads-for-java-developers-from-beginner-to-professional-2/) journey mans list is a complete must read including "clean code", "effective java", "pragmatic programmer", "design patterns (GoF)", "refactorings"
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24246027

http://stackoverflow.com/comment/37464097
comment on: http://stackoverflow.com/q/24253097
type: QuestionComment
has text: The best approach would be to use a regular expression. See the java.util.regex package.
type: Comment
score: 2

http://stackoverflow.com/comment/37336885
comment on: http://stackoverflow.com/q/24187082
type: QuestionComment
has text: Does UserRepositoryHibernate implements UserRepository?
type: Comment
score: 0

http://stackoverflow.com/comment/37387254
type: AnswerComment
score: 0
type: Comment
has text: @ZackMacomber Please post the full stacktrace and full error message.
comment on: http://stackoverflow.com/a/24209354

http://stackoverflow.com/a/24121758
has comment: http://stackoverflow.com/comment/37215807
answers question: http://stackoverflow.com/q/24121712
has comment: http://stackoverflow.com/comment/37215266
has body: They are using a MultiThreaded Socket Wheel. Means, there is a ForegroundService which handle different Threads within the Service. The ForegroundService make sure that it will be kept alive. The Threads itself are single Processes which run in a Background Thread. Threre are several ThreadExecutors available which make sure that you have only a few Threads running paralell or process them thread by thread. Here is a good tutorial making a SocketWheel http://www.javaspecialists.eu/archive/Issue023.html Sources: ThreadExecutor http://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.html ThreadPoolExecutor ExectuorService vs ThreadPoolExecutor (which is using LinkedBlockingQueue) ForegroundService Android - implementing startForeground for a service? Edited: for some code public class DLService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { Notification note=new Notification(R.drawable.somegraphics, "some title", randomnr); Intent i=new Intent(this, ActivityClassToOpenWhenClicked.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi=PendingIntent.getActivity(this, 0, i, 0); note.setLatestEventInfo(this, "downloadmanager","downloading.. nothing", pi); note.flags|=Notification.FLAG_NO_CLEAR; startForeground(1337, note); // if (intent.hasExtra("dlurl")) { new Thread(new Runnable() { public void run() { new Client("http://yourfile.com/file.jpg"); } }).start(); return START_NOT_STICKY; } class Client { public Client(String filetodownload) throws Exception { //do your http connection. for example one download # // HttpUrlConnection httpConnection = new ..... } } } Its just a quick coded example, not tested. But it shows the concept. The service itself accept a Intent which can be a url where the file is located. Then it creates a new Thread which do the job. The Thread will run aslong as it takes to download the file. The foregroundService makes sure that th…
has comment: http://stackoverflow.com/comment/37216494
type: Answer
has comment: http://stackoverflow.com/comment/37215492
has comment: http://stackoverflow.com/comment/37215648
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24121712
upvote count: 1
has comment: http://stackoverflow.com/comment/37215935

http://stackoverflow.com/a/24262744
score: 0
answers question: http://stackoverflow.com/q/24262690
type: Answer
has body: This is being called from increase() of F public void upA() { a = a + a; // a=2+2 } Not, public void upA() { a = a + 1; //not a=2+1 }

http://stackoverflow.com/comment/88074969
type: Comment
comment on: http://stackoverflow.com/q/24173399
type: QuestionComment
has text: The difficulty with system monitoring is that they are very OS dependent. Even if it is decided that any jvm implenentation must provide some api, I guess it is difficult to define a common api that works for all OS
score: 0

http://stackoverflow.com/comment/37200787
has text: Keep in mind that nodeChecker.getData().getRole() can also return NULL.
type: Comment
comment on: http://stackoverflow.com/a/24114073
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37437660
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24239633
has text: To `b` or not to `b`... Great answer.
score: 0

http://stackoverflow.com/a/24113696
has comment: http://stackoverflow.com/comment/37233450
score: 14
has comment: http://stackoverflow.com/comment/37235996
type: Answer
has comment: http://stackoverflow.com/comment/37235909
has comment: http://stackoverflow.com/comment/92672002
has comment: http://stackoverflow.com/comment/37235958
upvote count: 15
has comment: http://stackoverflow.com/comment/37235559
answers question: http://stackoverflow.com/q/24113529
has body: You can get the element's name in startElement and endElement. You can also get attributes in startElement. Values you should get in characters. Here is a very basic example on how to get the value of an element using a ContentHandler: public class YourHandler extends DefaultHandler { boolean inFirstNameElement = false; public class startElement(....) { if(qName.equals("firstName") { inFirstNameElement = true; } } public class endElement(....) { if(qName.equals("firstName") { inFirstNameElement = false; } } public class characters(....) { if(inFirstNameElement) { // do something with the characters in the &lt;firstName&gt; element } } } If you have a simple example, setting boolean flags for each tag is OK. If you have a more complex scenario, you might prefer store the flags in a map using element names as keys, or even create one or more Employee classes mapped to your XML, instantiate them every time &lt;employee&gt; is found in startElement, populate its properties, and add it to a Collection in endElement. Here is a complete ContentHandler example that works with your example file. I hope it helps you get started: public class SimpleHandler extends DefaultHandler { class Employee { public String firstName; public String lastName; public String location; public Map&lt;String, String&gt; attributes = new HashMap&lt;&gt;(); } boolean isFirstName, isLastName, isLocation; Employee currentEmployee; List&lt;Employee&gt; employees = new ArrayList&lt;&gt;(); @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { if(qName.equals("employee")) { currentEmployee = new Employee(); for(int i = 0; i &lt; atts.getLength(); i++) { currentEmployee.attributes.put(atts.getQName(i),atts.getValue(i)); } } if(qName.equals("firstName")) { isFirstName = true; } if(qName.equals("lastName")) { isLastName = true; } if(qName.equals("location")) { isLocation = true; } } @Override public void endElement(String uri, String localNam…
downvote count: 1

http://stackoverflow.com/comment/37335486
has text: When you say "modifying source" would I be correct in assuming these are Java classes, not just static assets, HTML and JavaScript etc?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24175703

http://stackoverflow.com/comment/37570513
type: Comment
has text: As I understand it, I should use an alternative solution as long as storm messaging does not fit to my use case, right?
type: AnswerComment
comment on: http://stackoverflow.com/a/24255669
score: 0

http://stackoverflow.com/a/24232792
type: Answer
answers question: http://stackoverflow.com/q/24232731
has comment: http://stackoverflow.com/comment/37424306
score: 1
downvote count: 0
has body: In the method append, the line n = n.next won't affect the original node passed as argument, in your case head. Why? Because Java is pass by value. This means that if inside the method, you modify the reference of head (which is received as n inside the method), it won't affect the original reference. Therefore, head will still refering to the same location in memory (the same object). Also, your method test doesn't do anything because you are creating a local variable: Node next = ...; and then assigning n.next to it. But this variable only exists inside that method, so it won't affect anything outside it.
upvote count: 1

http://stackoverflow.com/comment/44966904
score: 5
type: AnswerComment
has text: For something like this, I feel like you should really get a reply via {@code}onCharacteristicWrite(){@code} instead of sleeping the thread for a random amount of time. You remove the risk of (a) not sleeping long enough and (b) sleeping too long, thus make your code very inefficient depending on how many bytes you are sending
type: Comment
comment on: http://stackoverflow.com/a/24178409

http://stackoverflow.com/q/24222937
has title: Wifi Broadcast android inside android intent
has body: I'm learning android and I'm stuck here: The app which I'm writing scans for Wifi signals in background periodically. I am using android intent service for the same. The problem is, application never executes onReceive() method of BroadCastReceiver Intent Code: public class BackgroundIntent extends IntentService { // Default Constructor public BackgroundIntent() { super("BackgroundIntent"); // TODO Auto-generated constructor stub } WifiManager mainWifi; BroadcastReceiver receiverWifi; private final Handler handler = new Handler(); @TargetApi(Build.VERSION_CODES.GINGERBREAD) @Override protected void onHandleIntent(Intent intent) { // TODO Auto-generated method stub // Get mainWifi mainWifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); if (mainWifi.isWifiEnabled() == false) { mainWifi.setWifiEnabled(true); } receiverWifi = new WifiReceiver(); doInback(); } // Basically a thread which calls itself after 5000milli sec public void doInback() { handler.postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub mainWifi.startScan(); Log.i("Inside ", "doInBack"); // Call itself CODE GOES HERE :D doInback(); } }, 5000); } public class WifiReceiver extends BroadcastReceiver { @TargetApi(Build.VERSION_CODES.GINGERBREAD) public void onReceive(Context c, Intent intent) { // CODE NEVER GOES HERE :( List&lt;ScanResult&gt; wifiList; wifiList = mainWifi.getScanResults(); Log.i("Inside receiver", "yes"); } } } MainActivity code which invokes android intent service public class MainActivity extends Activity { TextView texty; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Intent is called here Intent myIntent = new Intent(MainActivity.this, BackgroundIntent.class); startService(myIntent); texty = (TextView) findViewById(R.id.textView1); } public boolean onMenuItemSelected(int featureId, MenuItem item) { return super.onMenuItemSelected(featureId, it…
type: AnsweredQuestion
tagged with: java
downvote count: 0
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/24223012
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24307308
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/24223012
has answer: http://stackoverflow.com/a/24307308
tagged with: android-intent
tagged with: android-wifi

http://stackoverflow.com/comment/135402679
type: AnswerComment
has text: @AlexBurdusel: you are right, we can replace by ListIterator<String> iter = lst.listIterator(); in ListIterator have method set()
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24232559

http://stackoverflow.com/a/24173092
has comment: http://stackoverflow.com/comment/37311541
accepted answer of: http://stackoverflow.com/q/24173012
answers question: http://stackoverflow.com/q/24173012
type: AcceptedAnswer
downvote count: 0
has body: Because sorting reference types is guaranteed to be stable, whereas sorting primitives does not need to be (so quicksort, a non-stable sorting algorithm, can be used; merge sort on the other hand is in fact stable). Also note that quicksort is generally more optimal than mergesort (see this as well), which explains why it's taken advantage of when sorting primitives. From Arrays.sort: This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
upvote count: 10
score: 10
type: Answer

http://stackoverflow.com/a/24121561
has comment: http://stackoverflow.com/comment/37215480
has body: Seems like the best solution for this would be making a BufferedReader over the FileReader to read the file. Then you can make java.io.File objects and put those into a java.util.ArrayList. Then you can get the files easily from from the ArrayList and dispose the readers. You can also add an refresh method to refresh the list if needed.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24121255
has comment: http://stackoverflow.com/comment/37214563

http://stackoverflow.com/comment/37221038
comment on: http://stackoverflow.com/a/24124036
score: 0
type: AnswerComment
has text: Are you trying to automate the execution of a batch file from your java code, or are you trying to execute a java class from the batch file? The code that I posted was assuming that you are trying to execute batch files from the java program.
type: Comment

http://stackoverflow.com/comment/37263977
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24147219
has text: Provided the supplied information was the issue, that is the only possibility. I have never seen 'Space' used in a Java regex, but I am 100% positive that in Java " " and "\\s" work for what he needs. That is was makes it a GIGO scenario.

http://stackoverflow.com/a/24122814
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24122510
type: Answer
has body: Assuming you have a Person class as follows: public class Person { private int id; private String firstName; private String lastName; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Person(int id, String firstName, String lastName) { super(); this.id = id; this.firstName = firstName; this.lastName = lastName; } } you can sort the list of Person objects using the static sort method of Collections as shown below: List&lt;Person&gt; persons = new ArrayList&lt;Person&gt;(); persons.add(new Person(1, "John", "Smith")); persons.add(new Person(2, "Joe", "Blow")); persons.add(new Person(3, "Cat", "Dog")); Collections.sort(persons, new Comparator&lt;Person&gt;() { public int compare(Person p1, Person p2) { String lastName1 = p1.getLastName(); String lastName2 = p2.getLastName(); return lastName1.compareTo(lastName2); } });

http://stackoverflow.com/q/24105454
tagged with: cypher
accepted answer: http://stackoverflow.com/a/24105495
type: AnsweredQuestion
has body: Here I am using neo4j rest api, in first step I want to collect information like how many relationships are there between two given nodes. Sample : MATCH (n:Node {id: {parameter1}})-[r:someType]-(m:Node {id: {parameter2}}) RETURN COUNT(r) Then I would like to collect all the values assigned to the edges so I can calculate further calculations. I need all the different types of relationships and their properties between two given nodes. If it is possible I would like to do it in single cypher.
tagged with: playframework
tagged with: java
downvote count: 0
answer count: 1
tagged with: neo4j
has answer: http://stackoverflow.com/a/24105495
has title: Neo4j cypher to count and display all the relationship between two given nodes
favorite count: 0
type: Question
tagged with: graph
score: 5
upvote count: 5

http://stackoverflow.com/q/24139097
score: 19
favorite count: 0
type: Question
tagged with: resteasy
accepted answer: http://stackoverflow.com/a/24167741
has body: I am trying to write simple RESTEasy client. Below given is sample code: Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target("http://localhost:8080/context/path"); Response response = target.request().post(Entity.entity(object, "application/json")); //Read output in string format String value = response.readEntity(String.class); I get exception at line: Client client = ClientBuilder.newBuilder().build(); I see following errors in my console: 16:07:57,678 ERROR [stderr] (http-localhost/127.0.0.1:8080-1) java.lang.NoSuchMethodError: org.jboss.resteasy.spi.ResteasyProviderFactory.<init>(Lorg/jboss/resteasy/spi/ResteasyProviderFactory;)V 16:07:57,679 ERROR [stderr] (http-localhost/127.0.0.1:8080-1) at org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration.<init>(ClientConfiguration.java:44) 16:07:57,680 ERROR [stderr] (http-localhost/127.0.0.1:8080-1) at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:317) 16:07:57,680 ERROR [stderr] (http-localhost/127.0.0.1:8080-1) at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:49) I have added resteasy client dependancy in pom.xml as: org.jboss.resteasy resteasy-client 3.0.8.Final My code is deployed on JBOSS EAP 6.1. JDK version is 1.7. Update: I also tried adding resteasy jax-rs dependancy in my pom. I also verified if ResteasyProviderFactory is enabled by adding following lines in my web.xml: org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap Please find below list of maven dependancies: org.jboss.spec.javax.ejb jboss-ejb-api_3.1_spec provided javax.enterprise cdi-api provided org.hibernate.javax.persistence hibernate-jpa-2.0-api provided org.hibernate hibernate-validator provided org.jboss.resteasy resteasy-jaxrs 3.0.8.Final provided org.jboss.resteasy resteasy-client 3.0.8.Final com.google.code.gson gson 2.2.4 junit junit test org.jboss.arquillian.junit arquillian-junit-container test org.jboss.arquil…
has comment: http://stackoverflow.com/comment/37247095
possible better answer: http://stackoverflow.com/a/26391277
tagged with: maven
has answer: http://stackoverflow.com/a/26391277
has title: RESTEasy Client + NoSuchMethodError
tagged with: jboss6.x
has comment: http://stackoverflow.com/comment/37247602
has comment: http://stackoverflow.com/comment/37247724
type: AnsweredQuestion
upvote count: 19
has comment: http://stackoverflow.com/comment/37286202
answer count: 3
has answer: http://stackoverflow.com/a/67724732
tagged with: java
has answer: http://stackoverflow.com/a/24167741
downvote count: 0
has comment: http://stackoverflow.com/comment/37249334
tagged with: nosuchmethoderror

baseadapter
tags question: http://stackoverflow.com/q/24107418
type: Tag
tags question: http://stackoverflow.com/q/24233184
tag name: baseadapter

http://stackoverflow.com/a/24204859
score: 0
answers question: http://stackoverflow.com/q/24204177
has body: Add @XmlTransient to pageDescription will do the trick.
has comment: http://stackoverflow.com/comment/37372644
type: Answer

http://stackoverflow.com/comment/47501875
score: 2
has text: Huge workaround that probably won't help 99% of the people here as they won't want to use VIM emulation. But, I happen to already have this plugin installed so it works for me :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/29668046

http://stackoverflow.com/comment/37279528
type: QuestionComment
comment on: http://stackoverflow.com/q/24155519
has text: Happy to help. Check my answer, hope it cleares your doubt, otherwise leave a comment there.
score: 0
type: Comment

http://stackoverflow.com/a/24182501
has comment: http://stackoverflow.com/comment/37330679
has comment: http://stackoverflow.com/comment/37361994
downvote count: 0
has comment: http://stackoverflow.com/comment/37330756
has comment: http://stackoverflow.com/comment/37329382
has comment: http://stackoverflow.com/comment/37331123
type: Answer
has body: This might be the explanation: Successive calls fail because you do not terminate the first call appropriately: Before the return, you need to call db.close and cusrsor.close(). db.close is more essential. Not doing this causes an error on the 2nd call, which causes the cursor to be null. This exception closes the db intrinsically. Therefore the 3rd call results in success.
answers question: http://stackoverflow.com/q/24181972
has comment: http://stackoverflow.com/comment/37330713
score: 2
upvote count: 2

http://stackoverflow.com/q/24218239
accepted answer: http://stackoverflow.com/a/24219958
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37397155
has answer: http://stackoverflow.com/a/24219958
has body: I want to jsoup parse as utf -8 but I cant. I try everything I know and I searched on google. What is my goal: String tmp_html_content ="Öç"; InputStream is = new ByteArrayInputStream(tmp_html_content.getBytes()); Document doc_tbl = Jsoup.parse(is, "UTF-8", ""); doc_tbl.outputSettings().charset().forName("UTF-8"); doc_tbl.outputSettings().escapeMode(EscapeMode.xhtml); But doc_tbl is not UTF-8. please help about that
tagged with: jsoup
upvote count: 2
has title: Why JSOUP does not read as UTF-8?
has comment: http://stackoverflow.com/comment/37399142
answer count: 1
downvote count: 0
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37397027
tagged with: utf-8

http://stackoverflow.com/comment/37428127
type: Comment
has text: @HovercraftFullOfEels It shouldn't compile. I found mismatched braces and parentheses when trying to auto-indent in emacs.
type: QuestionComment
comment on: http://stackoverflow.com/q/24234586
score: 0

http://stackoverflow.com/comment/37416525
type: Comment
has text: Oh my god. Thanks alot. I can't laugh at my foolish mistake. Anyway one more thing. Can I enquire why the database only record the first EditText field but not both when I have two? Thank you for your help.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24228746

http://stackoverflow.com/q/24231097
has body: I'm trying to follow the video series on YouTube by "The New Boston". I'm getting an error when trying to display a variable on a toast. Heres' what I did.. First off, I created a textView.. &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:id="@+id/CountView" android:text="Number Value is 0" /&gt; Then, public class MainActivity extends ActionBarActivity { int Counter; TextView countView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Counter = 0; countView= (TextView)findViewById(R.id.CountView); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } public void Button1Click(View view) { Counter+=1; Toast.makeText(this, "Added 1", Toast.LENGTH_SHORT).show(); countView.setText(String.valueOf(Counter)); } It says that the program has stopped working. LogCat Log -> FATAL EXCEPTION: main java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3606) at android.view.View.performClick(View.java:4211) at android.view.View$PerformClick.run(View.java:17446) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:5297) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at android.vie…
has comment: http://stackoverflow.com/comment/37422693
has comment: http://stackoverflow.com/comment/37421933
has title: Error on displaying int value | Android
accepted answer: http://stackoverflow.com/a/24231149
possible better answer: http://stackoverflow.com/a/24231109
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24231149
tagged with: java
has comment: http://stackoverflow.com/comment/37421726
linked to: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/37421804
type: Question
has comment: http://stackoverflow.com/comment/37421967
has comment: http://stackoverflow.com/comment/37421779
has answer: http://stackoverflow.com/a/24231109
tagged with: android
has answer: http://stackoverflow.com/a/24231391
has answer: http://stackoverflow.com/a/24231222
answer count: 5
has answer: http://stackoverflow.com/a/24231106

http://stackoverflow.com/q/24131842
has comment: http://stackoverflow.com/comment/37234158
has body: My name is sam and i'm a beginner in java.I have actually tried this "factorial" program on my own and i can't see whats going wrong with logic....I'm not getting the expected output,can anyone tell me why? Thanks in advance,grt day to all the users :) Factorial: import java.util.*; class factorial { public static void main(String[] args) { int i; System.out.println("enter a number"); Scanner in=new Scanner(System.in); int n=in.nextInt(); int x=n; while(x!=0) { x=x*(n-1); n--; } System.out.println(x); } } When I enter (for example) 5, I expect to get the factoial of 5 (120). Instead, I get zero. This happens for all inputs.
answer count: 4
has comment: http://stackoverflow.com/comment/37234172
has comment: http://stackoverflow.com/comment/37234124
has answer: http://stackoverflow.com/a/24131906
downvote count: 0
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/24131918
has comment: http://stackoverflow.com/comment/37234118
tagged with: java
has answer: http://stackoverflow.com/a/24374469
has answer: http://stackoverflow.com/a/44515046
favorite count: 0
type: Question
tagged with: factorial
has title: can't get expected output to this "Factorial" program?
type: UnansweredQuestion

multidimensional-array
tags question: http://stackoverflow.com/q/24106844
tags question: http://stackoverflow.com/q/24179253
tags question: http://stackoverflow.com/q/24137628
tags question: http://stackoverflow.com/q/24112111
tags question: http://stackoverflow.com/q/24181194
type: Tag
tags question: http://stackoverflow.com/q/24108111
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/24107914

http://stackoverflow.com/a/24173099
type: Answer
has body: I'd make me an Iterable /** * Returns all pairs of the list except those where i == j. * @param &lt;T&gt; */ public class AllPairs&lt;T&gt; implements Iterable&lt;Pair&lt;T, T&gt;&gt; { // The list. private final List&lt;T&gt; list; public AllPairs(List&lt;T&gt; list) { this.list = list; } @Override public Iterator&lt;Pair&lt;T, T&gt;&gt; iterator() { return new PairIterator(); } private class PairIterator implements Iterator&lt;Pair&lt;T, T&gt;&gt; { // The indexes. int i = 0; int j = 0; // The next to return. Pair&lt;T, T&gt; next = null; // Easier to read. int size = list.size(); @Override public boolean hasNext() { while (next == null &amp;&amp; (i &lt; size || j &lt; size)) { // Step j. j += 1; // Wrap j. if (j &gt;= size &amp;&amp; i &lt; size) { j = 0; i += 1; } if (i &lt; size &amp;&amp; j &lt; size &amp;&amp; j != i) { // Grab it. next = new Pair&lt;&gt;(list.get(i), list.get(j)); } } return next != null; } @Override public Pair&lt;T, T&gt; next() { Pair&lt;T, T&gt; it = next; next = null; return it; } } } /** * A simple Pair */ public static class Pair&lt;P, Q&gt; { public final P p; public final Q q; public Pair(P p, Q q) { this.p = p; this.q = q; } } public void test() { System.out.println("Hello"); List&lt;Integer&gt; l = Arrays.asList(0, 1, 2, 3); for (Pair&lt;Integer, Integer&gt; p : new AllPairs&lt;&gt;(l)) { System.out.println("[" + p.p + "," + p.q + "]"); } } Then define an interaction mechanism - this would be almost trivial using Lambdas: // Objects that can interact with each other. public interface Interacts&lt;T extends Interacts&lt;T&gt;&gt; { public void interact(T with); } public static &lt;T extends Interacts&lt;T&gt;&gt; void interactAllPairs(List&lt;T&gt; l) { // Interact all pairs. for (Pair&lt;T, T&gt; p : new AllPairs&lt;&gt;(l)) { p.p.interact(p.q); } } Then you can make your message objects interact - here's a simple example: // Interact by sending a message. public class Messenger implements Interacts&lt;Messenger&gt; { private fin…
score: 0
answers question: http://stackoverflow.com/q/24172709

http://stackoverflow.com/comment/37365148
score: 3
type: Comment
type: QuestionComment
has text: We can`t help you without code of `MainActivity`
comment on: http://stackoverflow.com/q/24201647

http://stackoverflow.com/a/24218204
has comment: http://stackoverflow.com/comment/37397145
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24218077
has body: If you want to start some executable from your java application ,then it's recommanded to use ProccessBuilder , where you will avoid the problem of having white space in your path , check this answer it may help you when using ProccessBuilder. When you have to open file , browser or any GUI application from your Java program, you can use the Desktop class that invoke the default application in your OS to open the specific file , example : import java.awt.Desktop; import java.io.File; public class MyClass { public static void main(String[] args) throws IOException { File file = new File("myFile.txt"); Desktop desktop = Desktop.getDesktop(); if(file.exists()) desktop.open(file); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/37397934
has comment: http://stackoverflow.com/comment/37397360
answers question: http://stackoverflow.com/q/24218077
has comment: http://stackoverflow.com/comment/37397386
type: Answer
has comment: http://stackoverflow.com/comment/37397896
has comment: http://stackoverflow.com/comment/37396900

http://stackoverflow.com/q/24144538
type: Question
has comment: http://stackoverflow.com/comment/37269936
has comment: http://stackoverflow.com/comment/37289319
has title: Why do I get SQLCODE=-204, SQLSTATE=42704 with DB2 LUW and WebSphere App Server?
tagged with: websphere
answer count: 2
linked to: http://stackoverflow.com/q/12686832
tagged with: database
has answer: http://stackoverflow.com/a/24266769
possible better answer: http://stackoverflow.com/a/77880428
tagged with: db2
has answer: http://stackoverflow.com/a/77880428
upvote count: 16
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37261744
linked to: http://stackoverflow.com/q/1588687
accepted answer: http://stackoverflow.com/a/24266769
tagged with: java
downvote count: 0
score: 16
linked to: http://stackoverflow.com/q/7183433
favorite count: 0
has comment: http://stackoverflow.com/comment/37258492
has body: There are numerous web pages where people show this message as a symptom (with the value after SQLERRMC and the driver level varying): DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=M51Dev.CUSTOMER, DRIVER=3.61.65 including several here on StackOverflow. The error codes mean that an object -- nearly always a table -- is not found, and the value of the SQLERRMC parameter contains the name of the object in question. In every other occurrence of this I can find, the solution was just that they needed to qualify the table name with the schema name. However, as you can see from the line above, that isn't the case here. The schema is M51Dev, and the table is CUSTOMER, and both of them exist. The environment is WebSphere Application Server (7.0.0.31 in this particular case, but I somehow doubt that's relevant) running on Windows Server 2003 R2, with DB2 9.7.300.3885 on an old XP machine. The datasource is defined in WAS and retrieved via JNDI. the application is written in Java, and our SQL is executed using JDBC via Spring's JdbcTemplates. The datasource definition in WAS includes a custom property called currentSchema, which is set to M51Dev. This is the relevant line of SQL (or one of them, as we get the same symptom for every table): SELECT rundateOverride FROM customer WHERE customerId=1 And here's an extract from the stack trace. I can provide more if it helps. bad SQL grammar [SELECT rundateOverride FROM customer WHERE customerId=1]; nested exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=M51Dev.CUSTOMER, DRIVER=3.61.65 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406) at org.springframework.jdbc.core.JdbcTemplate.q…

http://stackoverflow.com/a/24230146
has body: @Override public void setViewport(Viewport v) { super.setViewport(v); this.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); Camera c = this.getViewport().getCamera(); c.position.set(c.viewportWidth/2, c.viewportHeight/2, 0); init(); } This works, but you should also be able to update the Viewport like that at the begin of your application, if you continue to use the same one. I set the position like that instead of centering because some of my Stages will be larger than the screen.
type: Answer
accepted answer of: http://stackoverflow.com/q/24228748
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24228748
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/37194144
score: 0
type: Comment
has text: So, what's the problem with your key listener? What is it doing? What is it supposed to be doing? Just dumping your code and saying "I'm stuck, write it for me" isn't get to get you a useful answer.
type: QuestionComment
comment on: http://stackoverflow.com/q/24110034

http://stackoverflow.com/comment/37478801
comment on: http://stackoverflow.com/q/24261321
type: QuestionComment
type: Comment
score: 0
has text: You need to provide a default constructor in Class A for this to work fine, because java requires implicit super constructor when extended, which is undefined in your case or call super constructor in B.

http://stackoverflow.com/comment/37382169
has text: He says that he wants a number in the range from -0.3 and 0.3. He is a bit unclear but he means "how can I get also negative values in nextInt and how can I get a float random value?"
type: AnswerComment
comment on: http://stackoverflow.com/a/24210369
score: 0
type: Comment

http://stackoverflow.com/a/24132454
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/24132425
type: Answer
score: -1
has body: At any rate, you have to implement your threads in a way where if notifyAll() get called then there will be no race condition or any problems in your code such as deadlock and as a rule of thumb, use notifyAll() instead of notify().

http://stackoverflow.com/q/24177569
tagged with: java
has body: Here is the thing: I am trying to run the example program in the joda-time project. The start of the Examples.java file looks like this: package org.joda.example.time; import java.util.Locale; import org.joda.time.DateTime; import org.joda.time.Instant; /** * Example code demonstrating how to use Joda-Time. * * @author Stephen Colebourne */ public class Examples { public static void main(String[] args) throws Exception { try { new Examples().run(); } catch (Throwable ex) { ex.printStackTrace(); } } And all the classes for compiling this Example.java is in a joda-time-2.3.jar. I can successfully compile this program by using javac -cp somewhere/joda-time-2.3.jar Example.java And it generate an Example.class, but I jut cannot execute that. So far I have tried: java Examples java -cp somewhere/joda-time-2.3.jar Examples java -cp somewhere/joda-time-2.3.jar org.joda.example.time.Examples But they all generate this kind of errors: Error: Could not find or load main class org.joda.example.time.Example Error: Could not find or load main class Examples And I've tried both in the org/joda/example/time folder and the parent folder of org Anyone can give an instruction on how to execute that? Really appreciate it!
downvote count: 1
has comment: http://stackoverflow.com/comment/37319560
favorite count: 0
type: Question
has title: How to run a java program in command line?
has answer: http://stackoverflow.com/a/24177625
accepted answer: http://stackoverflow.com/a/24177625
score: -1
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/9879679
answer count: 2
has answer: http://stackoverflow.com/a/24177614
possible better answer: http://stackoverflow.com/a/24177614

http://stackoverflow.com/q/24184763
tagged with: ocr
favorite count: 0
has body: I'm trying to solve the Tess4J installing problem , 1 I had created a folder in WEB-INF\win32-x86 2 and I putted there the libtesseract302.dll and liblept168.dll and I add it to source/native library in the java build path when I run I found the error java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302': Native library (win32-x86/libtesseract302.dll) not found in resource path ([file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/classes/, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/ghost4j-0.5.1.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/jai_imageio.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/jna-4.1.0.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/junit-4.10.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/log4j-1.2.17.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/tess4j.jar]) com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271) com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) com.sun.jna.Library$Handler.&lt;init&gt;(Library.java:147) com.sun.jna.Native.loadLibrary(Native.java:412) com.sun.jna.Native.loadLibrary(Native.java:391) net.sourceforge.tess4j.TessAPI.&lt;clinit&gt;(Unknown Source) net.sourceforge.tess4j.Tesseract.init(Unknown Source) net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) ocrTest.doGet(ocrTest.java:39) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) Note I had checked that I'm using 32 j…
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/37355268
linked to: http://stackoverflow.com/q/14018817
accepted answer: http://stackoverflow.com/a/24213295
linked to: http://stackoverflow.com/q/6150428
has answer: http://stackoverflow.com/a/24213295
type: AnsweredQuestion
has title: Tess4j issue java.lang.UnsatisfiedLinkError
score: 2
tagged with: java
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37371263
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24204559
has text: Yes, but it depends on the application. I mean I can write application in which there will be no short lived objects at all. What if so?
score: 0

http://stackoverflow.com/comment/42286500
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26856103
has text: Thank you for the reply, it's quite a while back I ran into this problem and I have forgotten how I solved it, probably with some workaround like you.

http://stackoverflow.com/q/24141607
type: Question
tagged with: google-drive-api
accepted answer: http://stackoverflow.com/a/24287473
tagged with: google-api-java-client
has answer: http://stackoverflow.com/a/24287473
tagged with: android
has body: So, in Google Play Services, it's final DriveFolder rootFolder = Drive.DriveApi.getRootFolder(mGoogleApiClient); To get root folder and then you can use parents feature. In REST API, to list root children you had to add 'root' in parents to a query parameter. But there is no search query feature in Google Api Java client, or is it just that I haven't found it? I can't use Drive.Children.list(String) because I have to find out the root folder id first.
has title: Google Api Java client list root folder children
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37254521
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/37431567
type: QuestionComment
comment on: http://stackoverflow.com/q/24235697
has text: 1) Use a consistent and logical indent for code blocks. The indentation of the code is intended to help people understand the program flow. 2) A single blank line of white space in source code is *always* enough. Blank lines after `{` or before `}` are also typically redundant. 3) *"WARNING: VERY IGNORANT BEGINNER AT HAND!"* Stop **SHOUTING** at us!
score: 1
type: Comment

http://stackoverflow.com/a/24220398
has body: Constructors are not inherited for a good design reason. If they are inherited, then you'd have problems trying to hide them in the inherited class. Consider this example: class Plane{ public Plane(int passengerCapacity, int cargoCapacity){...} } class F18 extends Plane{ public F18(){ super(0,0); .... } } Now, does the following constructor make sense? Plane p = new F18(0,0); Not really, because the child class is a special case of the parent class. In this particular example, it does not make sense to provide the Plane constructors in the F18 class; the child class wishes to control how the parent class is constructed. If constructors are inherited and someone wish to hide the parent constructors, they may attempt to do something like this: class F18{ Plane innerPlane; public F18(){ innerPlane = new Plane(0,0); } } Not really a solution because in every method and property, one would have to write return innerPlane.SomeMethod();, which pretty much defeats the purpose of inheritance. This principals apply to other OOP languages (e.g. C#) as well. But what if I really want to inherit constructors in many child class... Then your architecture is wrong. You don't actually need inheritance to solve your problem. You can abstract the parts that are different in another base class / interface. e.g. class Plane{ IPilot Pilot; public Plane(int passengerCapacity, int cargoCapacity, IPilot pilot){...} } Constructors are ways to construct an object. Do you really need many child class which can be constructed in the same way (and using the same logic, since they're inherited), or a class which has the flexibility to swap out some of its components?
has comment: http://stackoverflow.com/comment/37404468
accepted answer of: http://stackoverflow.com/q/24220082
score: 7
type: Answer
answers question: http://stackoverflow.com/q/24220082
has comment: http://stackoverflow.com/comment/37413779
type: AcceptedAnswer
downvote count: 0
upvote count: 7

executorservice
type: Tag
tags question: http://stackoverflow.com/q/24191762
tags question: http://stackoverflow.com/q/24216680
tags question: http://stackoverflow.com/q/24168815
tags question: http://stackoverflow.com/q/24134372
tag name: executorservice
tags question: http://stackoverflow.com/q/24169879

http://stackoverflow.com/a/24266336
score: 0
answers question: http://stackoverflow.com/q/24266335
has body: String[][] strings2 = convertStringArrayList(listOfStringLists); Convert ArrayList&lt;ArrayList&lt;String&gt;&gt; to String[][] method: private String[][] convertStringArrayList( ArrayList&lt;ArrayList&lt;String&gt;&gt; listOfStringLists ) { String[][] stringGroups = new String[listOfStringLists.size()][]; for ( int i=0; i&lt; listOfStringLists.size(); i++ ) { ArrayList&lt;String&gt; stringArray = listOfStringLists.get(i); String[] stringsChildren = Arrays.copyOf(stringArray.toArray(), stringArray.toArray().length, String[].class); stringGroups[i] = stringsChildren; } return stringGroups; }
type: Answer

http://stackoverflow.com/comment/37333081
type: Comment
comment on: http://stackoverflow.com/a/24185170
score: 0
type: AnswerComment
has text: Am I mistaken or effectively the same regex has already been posted http://stackoverflow.com/a/24185054/1393766?

http://stackoverflow.com/q/24133968
score: 0
tagged with: jsf
has body: I'm involve in JSF+Spring security project Here I saw this code fragment &lt;http auto-config="true"&gt; &lt;intercept-url pattern="/login" access="ROLE_USER" /&gt; &lt;logout logout-success-url="/login" /&gt; &lt;/http&gt; can we use Users from tables instead of use hardcode ROLE_USER in config.xml like above.? can we use method in there.? access="method()" then what it need to return.? boolean or view.?
has answer: http://stackoverflow.com/a/24135666
tagged with: java
type: Question
answer count: 1
tagged with: spring
tagged with: spring-security
has title: Spring security ROLE_USER from Tables
accepted answer: http://stackoverflow.com/a/24135666
type: AnsweredQuestion

http://stackoverflow.com/comment/37412378
has text: Now how is this better than just creating new threads for all users?
type: Comment
comment on: http://stackoverflow.com/a/24216770
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37199989
has text: Are you sure? Isn't the return value from the updateBanco method should be an Integer?
comment on: http://stackoverflow.com/q/24113021
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24159208
answers question: http://stackoverflow.com/q/24159023
score: 3
has comment: http://stackoverflow.com/comment/37301854
type: Answer
has comment: http://stackoverflow.com/comment/37311318
accepted answer of: http://stackoverflow.com/q/24159023
has body: There's plenty of tools that will take an object-graph and convert them to JSON. Jackson and GSON are two that are commonly used. But these things only represent data, and may not given you the full picture about the structure. If you want to communicate the structure outside of a Java environment what you may want to do is generate a "JSON Schema". There's another question which discusses how you might do that with a Jackson module.
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37328575
downvote count: 0

http://stackoverflow.com/comment/37407784
has text: That's the best you can do, onReceive() won't execute immediately because its still probably scanning. Scanning can take between 1 second to 1 hour, best you can do is set-up a receiver & cross your fingers :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24223012
score: 0

http://stackoverflow.com/comment/37443348
type: QuestionComment
score: 0
has text: @Kieveli the jdk version is irrelevant, as is the ide
comment on: http://stackoverflow.com/q/24242657
type: Comment

http://stackoverflow.com/comment/37412480
type: AnswerComment
has text: This answer has nothing to do with the real question.
comment on: http://stackoverflow.com/a/24226400
score: 1
type: Comment

http://stackoverflow.com/q/24170319
tagged with: android
tagged with: adt
has body: When I run this code: package com.example.topliga; public class Update extends AutomaticUpdaterActivity { private Object context; protected String doInBackground(String... sUrl) { String path = "http://192.168.1.20/android/TopLiga.apk"; try { URL url = new URL(sUrl[0]); URLConnection connection = url.openConnection(); connection.connect(); int fileLength = connection.getContentLength(); InputStream input = new BufferedInputStream(url.openStream()); OutputStream output = new FileOutputStream(path); byte data[] = new byte[1024]; long total = 0; int count; while ((count = input.read(data)) != -1) { total += count; publishProgress((int) (total * 100 / fileLength)); output.write(data, 0, count); } output.flush(); output.close(); input.close(); } catch (Exception e) { Log.e("YourApp", "Well that didn't work out so well..."); Log.e("YourApp", e.getMessage()); } return path; } private void publishProgress(int i) { } @Override protected void onPostExecute(String path) { Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive" ); Log.d("Lofting", "About to install new .apk"); ((Activity) this.context).startActivity(i); } } import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.HashMap; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import com.example.updater.AutomaticUpdaterActivity; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.annotation.SuppressLint; import android.app.Activity; import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.ListAdapter; import andr…
score: -1
has comment: http://stackoverflow.com/comment/37306106
has answer: http://stackoverflow.com/a/24170771
tagged with: java
answer count: 1
tagged with: eclipse
downvote count: 1
favorite count: 0
has title: Eclipse Java ADT errors
type: Question
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/24258250
has body: Let you have a set of number 1-100. And then you say between(30-60), it will return you 31,32....58,59. If you want to include 30 and 60 in your range, you should call between(29,61). I think this answers the 1st part of your query. The second part, between(1,1) will always be null. So in your case, if yo wish to fetch some events for a particular day between 01/01/2014 and 01/01/2014: You can ommit the use of between operator and use equals operator in this case Or else store your date in a LONG foramt using Calendar.getInstance().getTimeInMilis(). Then you can use between operation more precisely to include the time range as well.
answers question: http://stackoverflow.com/q/24258060
type: Answer
has comment: http://stackoverflow.com/comment/37511390
score: 0
has comment: http://stackoverflow.com/comment/37500030

http://stackoverflow.com/q/24200938
has answer: http://stackoverflow.com/a/24206967
has body: I'm currently working on timestamps that are converted from and to UTC. All articles that I found were based on conversion to and from String. Like this one: SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date myDate = simpleDateFormat.parse(rawQuestion.getString("AskDateTime")); But I wonder if there is a way to simply work with the Date instance/class or the calendar to convert the local Date into UTC and vice versa without converting it to String in between.
linked to: http://stackoverflow.com/q/230126
linked to: http://stackoverflow.com/q/6049207
answer count: 4
has answer: http://stackoverflow.com/a/24201278
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37364955
possible better answer: http://stackoverflow.com/a/24201262
duplicate of: http://stackoverflow.com/q/230126
score: 1
tagged with: java
has title: How to get UTC time without SimpleDateFormat?
has comment: http://stackoverflow.com/comment/84393287
downvote count: 0
linked to: http://stackoverflow.com/q/308683
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24201035
accepted answer: http://stackoverflow.com/a/24206967
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/24201262
tagged with: utc
tagged with: datetime

http://stackoverflow.com/comment/37266891
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24131752
has text: Thanks for answering, but I actually want to **disable** the logging since it clutters `stderr`.

http://stackoverflow.com/q/24262467
has body: This question may be silly, I'm quite new to Java and to object-oriented programming. Right now, I'm studying for my semester exams, and I have this question: Are Runnable and Thread abstract classes?
has answer: http://stackoverflow.com/a/24262513
tagged with: class
tagged with: oop
has title: Are Runnable and Thread abstract classes?
tagged with: java
tagged with: runnable
answer count: 1
upvote count: 7
has comment: http://stackoverflow.com/comment/37481349
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37480902
type: UnansweredQuestion
score: -2
downvote count: 9
has comment: http://stackoverflow.com/comment/39906295

http://stackoverflow.com/comment/37491205
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24263003
has text: @MicSim I see in console debugging values - and I see correct `Česká Třebová`. It mean that input data correct.
score: 0

http://stackoverflow.com/a/24196793
accepted answer of: http://stackoverflow.com/q/24196600
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24196600
has body: Dont use the afterTextChanged that it is dangerous because it will be called recursively that you might get yourself into an infinite loop. as the documentation is saying: It is legitimate to make further changes to s from this callback, but be careful not to get yourself into an infinite loop, because any changes you make will cause this method to be called again recursively use the onTextChanged instead. In your problem You forgot to add the character a into your string public void onTextChanged (CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub if(s.length() &gt; 0 &amp;&amp; s.toString().charAt(s.length()-1) == 'q') { current_string = s.toString(); current_string = current_string.substring(0, (current_string.length()-1)); et.setText(current_string + "a"); //add the a after q is deleted } } }
type: Answer

http://stackoverflow.com/comment/37371616
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24205017
score: 0
has text: I answered this same question for you a few days ago :-)

http://stackoverflow.com/comment/37232244
score: 0
has text: That looks like it might have worked (wrote 4KB file). But trying to read it back in gives another bunch of errors (see main post).
type: AnswerComment
comment on: http://stackoverflow.com/a/24130351
type: Comment

http://stackoverflow.com/comment/37481705
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24262858
type: QuestionComment
has text: p=b.getplan(plantype); you didn't instantiate plantype. you also don't seem to know you should never compare Strings (or any other objects) using the == operator.

http://stackoverflow.com/comment/37218032
score: 0
comment on: http://stackoverflow.com/a/24123463
type: Comment
has text: I have not worked with Java sockets in a while, but if I remember correctly, then yes. Look at the basic EchoTest-example: http://hepunx.rl.ac.uk/~adye/javatutorial/networking/sockets/readingWriting.html. However, the exception should not be thrown before the last byte is sent.
type: AnswerComment

http://stackoverflow.com/comment/37447113
type: Comment
type: QuestionComment
has text: @leemes my bad. Its 1 am here xD
comment on: http://stackoverflow.com/q/24244405
score: 0

http://stackoverflow.com/comment/37230922
score: 0
has text: @drewmore for 3D applications you can use an openGL binding (e.g. JMonkey) which will very much be on the GPU. Graphics2D may pass the finished image to a graphics card (I'm not sure) but I wouldn't really count that as running on the graphics card
comment on: http://stackoverflow.com/q/24129926
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37368892
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24180435
type: AnswerComment
has text: There you have your two routes with the same id.

http://stackoverflow.com/q/24189402
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/37341678
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37341516
type: Question
has body: Here is my Mytask code and when I debug it will give me an error: 06-12 16:08:22.032: E/AndroidRuntime(4063): FATAL EXCEPTION: AsyncTask #1 06-12 16:08:22.032: E/AndroidRuntime(4063): java.lang.RuntimeException: An error occured while executing doInBackground() 06-12 16:08:22.032: E/AndroidRuntime(4063): at android.os.AsyncTask$3.done(AsyncTask.java:299) 06-12 16:08:22.032: E/AndroidRuntime(4063): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 06-12 16:08:22.032: E/AndroidRuntime(4063): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) protected String doInBackground(String... urls) { String host = "web.vlivetech.com"; //getText(R.id.host); String port = "5222"; //getText(R.id.port); 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); XMPPConnection connection = new XMPPConnection(connConfig); try { connection.connect(); Log.i("XMPPClient", "[SettingsDialog] Connected to " + connection.getHost()); } catch (XMPPException ex) { Log.e("XMPPClient", "[SettingsDialog] Failed to connect to " + connection.getHost()); MainActivity.setConnection(null); } try { 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); MainActivity.setConnection(connection); } catch (XMPPException ex) { Log.e("XMPPClient", "[SettingsDialog] Failed to log in as " + username); MainActivity.setConnection(null); } return null; }
tagged with: android
tagged with: java
has title: XMPP and Android An error occured while executing doInBackground()

http://stackoverflow.com/comment/37440419
type: AnswerComment
has text: Thank you, I was afraid that would be the case. Thank you for confirming it, I will mark your answer as accepted as I think that having those two processes will be the only possibility.
comment on: http://stackoverflow.com/a/24190433
type: Comment
score: 0

http://stackoverflow.com/q/24254527
answer count: 2
has comment: http://stackoverflow.com/comment/37466784
upvote count: 3
has comment: http://stackoverflow.com/comment/37466797
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37466946
has title: URL Decode Difference between C# and Java
has answer: http://stackoverflow.com/a/24254777
favorite count: 0
type: Question
score: 3
type: UnansweredQuestion
has body: I got a url encode string %B9q while I use C# code: string res = HttpUtility.UrlDecode("%B9q", Encoding.GetEncoding("Big5")); It outputs as 電，which is the correct answer that I want But when I use Java decode function: String res = URLDecoder.decode("%B9q", "Big5"); Then I got the output ?q Does anyone knows how it happens and how should I solve it? Thanks for any suggestions and helps!
linked to: http://stackoverflow.com/q/27621643
has answer: http://stackoverflow.com/a/27635950
tagged with: decode
has comment: http://stackoverflow.com/comment/37466816

http://stackoverflow.com/comment/37400752
has text: @PankajDwivedi What would it mean to have a constructor part of an *instance*? Ctors are used to *create* instances.
score: 0
comment on: http://stackoverflow.com/q/24220082
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24231149
score: 1
upvote count: 1
has body: Try this: Toast.makeText(this, ""+Counter, Toast.LENGTH_SHORT).show();//auto type conversion really convinent
answers question: http://stackoverflow.com/q/24231097
has comment: http://stackoverflow.com/comment/37421626
has comment: http://stackoverflow.com/comment/37422203
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24231097
type: Answer
downvote count: 0

http://stackoverflow.com/q/24265392
score: 0
tagged with: textarea
tagged with: java
answer count: 1
type: Question
has body: I am trying to make a functionality of word suggestion in my textarea . Like if a user enter " this is test " and press ctrl this should give user the options which matches "test" .. like on press of ctrl it should give a popup with word "testing" for example. for that what I need to get is the word on which user press ctrl.. i.e "test" in that case. I was thinking to get the cursor index when user press ctrl.. and then go back until there is a space , til that index will be my word.. But I dont know how to get the character at some specified cursor index. Any idea .. thanks
has title: how to get the charachter at some specific index in GWT Text area
has answer: http://stackoverflow.com/a/24265619
tagged with: gwt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24265619
tagged with: keyevent

http://stackoverflow.com/comment/37470179
comment on: http://stackoverflow.com/q/24256566
type: Comment
type: QuestionComment
has text: what is the json? post it
score: 0

http://stackoverflow.com/q/24133984
answer count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37238012
has comment: http://stackoverflow.com/comment/37238190
type: UnansweredQuestion
has title: how can I synchronise two transactions of two different projects?
has body: I have a java project and from this project i call web service request. Within the request I execute database update queries, and after that, in my local application I execute other update queries. But I have a problem: if there is any update problem or exception handling in local (second) update, I want to rollback the transaction which is executed in web service request. Briefly, to synchronise, two transactions of the two different application. How can I do it? I think, JTA could be solution. But I could not find any structure or example or anything exactly which I can apply to my projects.
downvote count: 0
tagged with: database
upvote count: 1
tagged with: jta
has answer: http://stackoverflow.com/a/55889296
has comment: http://stackoverflow.com/comment/37238065
tagged with: transactions
score: 1
tagged with: java

http://stackoverflow.com/q/24205104
score: 0
linked to: http://stackoverflow.com/q/3947227
has comment: http://stackoverflow.com/comment/37371598
tagged with: java
has title: 2d Array not deep cloning, changes affect both arrays
tagged with: arrays
answer count: 1
has body: I need to clone a 2d array of Cell objects but it doesn't work as it should. Whenever i clone the maze, it clones it but when i make changes to one, it is also visible on the other somebody knows what the problem is??? public void cloneMaze(boolean backup) { if (backup) { backupMaze = (Cell[][]) maze.clone(); for (int i = 0; i &lt; maze.length; i++) { backupMaze[i] = (Cell[]) maze[i].clone(); } } else { maze = (Cell[][]) backupMaze.clone(); for (int i = 0; i &lt; backupMaze.length; i++) { maze[i] = (Cell[]) backupMaze[i].clone(); } } }
type: Question
tagged with: maze
tagged with: clone
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37371702
has answer: http://stackoverflow.com/a/24205188
has comment: http://stackoverflow.com/comment/37371593
has comment: http://stackoverflow.com/comment/37372050

http://stackoverflow.com/comment/37450897
has text: @SergeBallesta I will try it just now and write the result here ASAP.
comment on: http://stackoverflow.com/q/24246391
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24204544
tagged with: optimization
has answer: http://stackoverflow.com/a/26629048
has answer: http://stackoverflow.com/a/24204713
answer count: 3
has title: Change only textfield background color of editable JComboBox
upvote count: 1
score: 1
tagged with: java
tagged with: jcombobox
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28495360
downvote count: 0
has body: After some research I figured a way out to only change the background color of the textfield of an editable JComboBox, but is there a nicer way to do it? What I want: My result should look like this: What I am doing at the moment: To clarify, I already get the above result but I think that the code to achieve it is too hacky, because in a first step I paint everything (textfield, button and the list) with the wanted color. Afterwards I remove the color from the button and then I remove the color from the list via a BasicComboBoxRenderer. My code: public static void changeOnlyEditorBackgroundColorOfEditableJComboBox(final JComboBox cb, final Color color) { //paint the whole ComboBox cb.getEditor().getEditorComponent().setBackground(color); //remove the color from the button final Component[] comps = cb.getComponents(); for (int i = 0; i &lt; comps.length; i++) { // hack valid only for Metal L&amp;F if (comps[i] instanceof MetalComboBoxButton) { final MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton)comps[i]; coloredArrowsButton.setBackground(null); break; } } //remove the color from the list cb.setRenderer(new RemoveColorFromComboBoxListRenderer()); } private static class RemoveColorFromComboBoxListRenderer extends BasicComboBoxRenderer { // only slightly changed from the original implementation. @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { // these lines were changed to always set the background white and the forground black setBackground(Color.white); setForeground(Color.black); } setFont(list.getFont()); if (value instanceof Icon) { setIcon((Icon)value); } else { setText((value == null) ? "" : value.toString()); } return this; } } So I hope I have overseen something and there is a nicer way of doing this. Finally …
tagged with: swing

http://stackoverflow.com/q/24251952
has title: Where do I place the pom.xml file?
has answer: http://stackoverflow.com/a/69336524
has answer: http://stackoverflow.com/a/24252025
answer count: 3
downvote count: 0
score: 7
tagged with: android
upvote count: 7
tagged with: java
has answer: http://stackoverflow.com/a/24252492
has body: I have been going through this tutorial and got maven installed, created my environment variables, created a new android project but i do not know where to place the pom.xml file ? also, how do I run my maven build so a new .apk file is created ?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37461924
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/37462437

http://stackoverflow.com/a/24177792
score: 1
downvote count: 0
has body: The problem is with the way dates work in java, 21114 is a valid year according to java in the format YYYY. As its already well explianed by Westos and bstar55, about java and date formats. A solution to this might be adding your own validations to make sure date format is the way you need. For example if you need the date to be like this dd (not more than 2 digits), month (not more than 2 digits ) and year (not more than 4 digits) public static void main(String[] args) { boolean a= isThisDateValid("12/12/21114","MM/dd/yyyy"); System.out.println(a); } public static boolean isThisDateValid(String dateToValidate, String dateFromat){ if(dateToValidate == null){ return false; } SimpleDateFormat sdf = new SimpleDateFormat(dateFromat); sdf.setLenient(false); String[] Arr=dateToValidate.split("/"); try { if(Arr[0].length()&gt;2 || Arr[1].length()&gt;2 || Arr[2].length()&gt;4){ throw new ParseException("Error in date: "+dateToValidate,0); } //if not valid, it will throw ParseException Date date = sdf.parse(dateToValidate); System.out.println(date); } catch (ParseException e) { e.printStackTrace(); return false; } return true; }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24177111

http://stackoverflow.com/a/24173739
type: Answer
has body: It's because of the relationship between hashCode() and equals(). If two objects are equal, they must have the same hash code, but the reverse is not necessarily true. Thus, if you want to see if a collection contains something, you cannot use hashCode() for equality checks, otherwise if you happen to have two unequal objects that return the same number for hashCode(), you start to run into major problems. In addition, hashCode() is more intended to complement equals(), and is primarily intended for hash collections, due to the way hash tables work. From the javadoc for Object: public int hashCode() Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap. Hash tables work by calculating a "hash" for an object, which, after some math, provides an index into a backing array. Given a good hashCode() implementation, this allows for a collection with amortized O(1) put(), get(), contains(), and other methods, which is a highly desirable property. However, this is mainly just a convenience feature. In the end, the map must still use equals() to ensure that the object you're retrieving is actually the one you want. It is possible, in fact, to write Map implementations that don't use hashCode() at all, such as TreeSet, which uses compareTo().
score: 2
has comment: http://stackoverflow.com/comment/37312782
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37312752
answers question: http://stackoverflow.com/q/24173730

http://stackoverflow.com/comment/37262326
comment on: http://stackoverflow.com/a/24146410
has text: I've worked it out. But now the sample plays only once. Any ideas ?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24215622
type: Question
has title: How can I modify an element of a PriorityQueue in Java?
linked to: http://stackoverflow.com/q/6952660
tagged with: iterator
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37392463
has body: I got the following issue to solve: I'm with a PriorityQueue of a specific object, and the attribute I use to compare it with others are set with the same value for all the objects. The problem is: I need to modify one of it's objects (I mean, find it by another attribute, and modify the comparable attribute) and take it off of the queue. And I got no ideia of how to do it, since peek() and poll() just remove and return the head of the queue, and remove() just remove the object, and it's not exactly what I want. I also don't know how could I use Iterator here as well. That's the code I got until now: public void inicializaDijkstra(Grafo grafo, Vertice v0){ Comparator&lt;Grafo&gt; comparator = new verticecomparator(); PriorityQueue&lt;Grafo&gt; Queue = new PriorityQueue&lt;Grafo&gt;(grafo.getNumeroDeVertices,grafo); for (Vertice vertice : conjuntoDeVertices) { queue.add(vertice); } I just though of gettinng the element I want with the Iterator, remove it from the queue, modify it and (if I didn't want to remove it) add it again on the queue. Would it work?
has comment: http://stackoverflow.com/comment/37392298
has answer: http://stackoverflow.com/a/24215946
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/24215946
score: 3
tagged with: priority-queue
tagged with: java
tagged with: updates
tagged with: queue
favorite count: 0

http://stackoverflow.com/a/24169329
score: 1
upvote count: 1
has body: We can not enforce shut down until any of the runnable task is still in progress (non-daemon thread). You can try loop with large iterations and see. eg. ExecutorService e = Executors.newCachedThreadPool(); e.execute(new Runnable() { @Override public void run() { for(int i =0 ; i&lt; 5000; i++){ System.out.println("run me in a different thread" + i); } } }); e.shutdown();
has comment: http://stackoverflow.com/comment/37318298
has comment: http://stackoverflow.com/comment/37315962
type: Answer
answers question: http://stackoverflow.com/q/24168815
downvote count: 0

http://stackoverflow.com/comment/37325112
type: Comment
type: QuestionComment
score: 0
has text: Post some code please
comment on: http://stackoverflow.com/q/24180902

http://stackoverflow.com/comment/37389704
type: Comment
comment on: http://stackoverflow.com/a/24207485
score: 0
type: AnswerComment
has text: I noticed this issue. `emp[0]` is just the element of `emp`.I confused it with `emp` which is the actual reference.Something mistake with my conception.Thank you very much and I appreciate your help.:)

http://stackoverflow.com/q/24116496
accepted answer: http://stackoverflow.com/a/24116563
has body: Im using activiti and spring in project, XML manner previously configured as follows: &lt;bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /&gt; &lt;bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" /&gt; &lt;bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" /&gt; &lt;bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" /&gt; &lt;bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" /&gt; How is configured to convert into JAVA?
tagged with: http://stackoverflow.com/tag/xml
type: Question
score: 0
tagged with: spring
answer count: 1
has answer: http://stackoverflow.com/a/24116563
has title: Spring:xml config convert to java config
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/24237826
upvote count: 2
answers question: http://stackoverflow.com/q/24208118
type: Answer
score: 2
has body: First rule: Always give your column bindings meaningful names (not just: "Aggregation", but "numRows" or something similar)! Second rule: Report variables are global variables and as such they are considered bad practice - use them only if you don't find any other solution. In the most common case you can put the table (based on data set) y into a detail row of table x. Then you can access the count using the syntax row._outer["numRows"]. And if you also need the count in the data set y, you can easily pass it as a data set parameter (use the "parameter binding" button in the binding tab). You only need the report variable solution given by Dominique if (for any reason) your layout does not allow you to put table y inside table x's detail row.
downvote count: 0

http://stackoverflow.com/a/24126303
score: 0
has comment: http://stackoverflow.com/comment/37223564
answers question: http://stackoverflow.com/q/24125894
type: Answer
has body: Is this ok for you? public class A { private static created = false; public static A create() { if (created) { throws new RuntimeException(); } else { created = true; return new A(); } } protected A() { } } public class B extends A { private static created = false; public static B create() { if (created) { throws new RuntimeException(); } else { created = true; return new B(); } } protected B() { } } public class C extends A { private static created = false; public static C create() { if (created) { throws new RuntimeException(); } else { created = true; return new C(); } } protected C() { } } You can create A, B, and C using: A a = A.create(); B b = B.create(); C c = C.create();
has comment: http://stackoverflow.com/comment/37223776

http://stackoverflow.com/comment/37233459
type: AnswerComment
has text: But why wouldn't it error when I first sort it if that was the problem. When I call the function for the first 24 rows it works fine but when I use the cursor mark for the next it errors. When I do this through the solr admin page it works with the cursor mark. I'm stumped.
type: Comment
comment on: http://stackoverflow.com/a/24131231
score: 0

http://stackoverflow.com/comment/37320563
type: AnswerComment
comment on: http://stackoverflow.com/a/24154959
has text: [{"city_id":1,"city_name":"TRIVANDRUM"},{"city_id":2,"city_name":"KANNUR"}] I got this way how can I parse it to display it in spinner. when I select TRIVANDRUM from spinner I should get 1 as the value...
type: Comment
score: 0

http://stackoverflow.com/comment/37258309
score: 0
type: QuestionComment
has text: It's java, not javascript.
type: Comment
comment on: http://stackoverflow.com/q/24144872

http://stackoverflow.com/comment/37269387
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24150502
has text: oh ok. Sorry, I was looking for the coded logic not the iteration. Thanks for pointing out and good catch.
score: 0

http://stackoverflow.com/comment/37314349
type: Comment
has text: is runGraphics an activity??
type: QuestionComment
comment on: http://stackoverflow.com/q/24174484
score: 0

http://stackoverflow.com/comment/37362383
type: QuestionComment
comment on: http://stackoverflow.com/q/24177516
score: 0
type: Comment
has text: @Basil Bourque, please remove the duplicate statement, that question you refer was for current monday of the week, not next monday after date specified, that is one different question and different kind of answer. better kept this post for other who face same scenario as me, beside, this post was the extension of this 2011 post http://stackoverflow.com/questions/7565356/get-first-monday-after-certain-date

http://stackoverflow.com/q/24232351
has comment: http://stackoverflow.com/comment/37423632
has comment: http://stackoverflow.com/comment/37423883
has comment: http://stackoverflow.com/comment/37430120
has comment: http://stackoverflow.com/comment/37431354
has body: Really need help!!! wondering how i could change my applet into a JFrame. Im not liking the applet the guy used in his tutorial and i would like to switch to a JFrame. I am very new to java and yes i have very little knowledge. Any help would be greatly appreciated! The game is a snake game. TUTORIAL: https://www.youtube.com/watch?v=FABTl1Q1byw APPLET CLASS: import java.applet.Applet; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Color; public class snakeApplet extends Applet{ private SnakeCanvas c;//410x310 public void init(){ c = new SnakeCanvas(); c.setPreferredSize(new Dimension(410, 310)); c.setVisible(true); c.setFocusable(true); this.add(c); this.setVisible(true); this.setSize(new Dimension(410, 310)); } public void paint(Graphics g){ this.setSize(new Dimension(410, 310)); } } GAME CLASS: public class SnakeCanvas extends Canvas implements Runnable, KeyListener{ private final int BOX_HEIGHT = 10; private final int BOX_WIDTH = 10; private final int GRID_WIDTH = 25; private final int GRID_HEIGHT = 25; private LinkedList&lt;Point&gt; snake; private Point fruit; private int direction = Direction.NO_DIRECTION; private Thread runThread; private int score = 0; private String highscore = ""; public void init() { } public void paint(Graphics g) { if (snake == null) { snake = new LinkedList&lt;Point&gt;(); GenerateDefaultSnake(); PlaceFruit(); } if (runThread == null) { this.setPreferredSize(new Dimension(640, 480)); this.addKeyListener(this); runThread = new Thread(this); runThread.start(); } if (highscore.equals("")) { highscore = this.GetHighScore(); } drawFruit(g); drawGrid(g); drawSnake(g); drawScore(g); } public void update(Graphics g) { Graphics offScreenGraphics; //Graphics used to draw offscreen BufferedImage offscreen = null; Dimension d = this.getSize(); offscreen = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB); offScreenGraphics = offscreen.getGraphics(); offScreenGraphics.setColor(this.getBackground());//CHANGE BAC…
type: Question
score: 0
tagged with: jframe
answer count: 1
upvote count: 1
tagged with: applet
tagged with: swing
accepted answer: http://stackoverflow.com/a/24232901
downvote count: 1
linked to: http://stackoverflow.com/q/12449889
favorite count: 0
has title: How to change my code from applet to JFrame?
has answer: http://stackoverflow.com/a/24232901
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37423731
has comment: http://stackoverflow.com/comment/37424001
tagged with: java

http://stackoverflow.com/comment/37277986
type: Comment
type: QuestionComment
has text: @BlueGreen: I haven't done Android programming before but I'm assuming that you're getting the keycode from a KeyEvent, correct? Wouldn't you want to check another property of the event such as its [meta state](http://developer.android.com/reference/android/view/KeyEvent.html#getMetaState()) as well?
comment on: http://stackoverflow.com/q/24155277
score: 2

http://stackoverflow.com/q/24116625
has answer: http://stackoverflow.com/a/28622382
has comment: http://stackoverflow.com/comment/37208218
has body: When connecting to a server with a Java client socket I had this two different connection timeout exceptions. Caused by: java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:381) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) I checked the documentation but for SocketTimeoutException it's written that "Signals that a timeout has occurred on a socket read or accept", but this is not the situation in my case. Because I am getting it during connection establishment. What is the difference between between these two exceptions? Actually I was expecting getting the ConnectException in any connection problem (firewall, port down, etc.)
has comment: http://stackoverflow.com/comment/37207714
has answer: http://stackoverflow.com/a/24118788
has comment: http://stackoverflow.com/comment/37209443
has title: java.net.SocketTimeoutException vs java.net.ConnectException
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37205133
has answer: http://stackoverflow.com/a/24117902
answer count: 4
has answer: http://stackoverflow.com/a/24116709
favorite count: 0
score: 12
type: Question
upvote count: 12
type: UnansweredQuestion
tagged with: sockets

http://stackoverflow.com/comment/37556126
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24259183
score: 0
has text: So I used a class that inherits from Thread and implementing the Awt.Robot, I start() just before the driver.get(url). How the robot starts, wait a bit, id tap keyboard, press 'tab',type keyboard password, press 'enter', and kills himself. Suddenly pop up is enabled,I can access the web (local) site and driver.get(url) can finish his treatment. Hoping for was clear.

http://stackoverflow.com/q/24172155
tagged with: mongodb
score: 0
type: UnansweredQuestion
answer count: 1
tagged with: morphia
has title: extend(obj, opts) function?
tagged with: extend
has body: Is there a way to do something like: db.coll.extend({_id:1,{field1:'test',field2:'test'}}, {deep:true}); This would find the object with _id 1 in coll (or create one), and then do a jquery-style deep extend on that object. This would be extremely useful when working with static-type languages (e.g., java/morphia) We could do a morphia.extend() call on an existing object without worrying about clobbering existing fields that may have been defined in other applications using the same data store. Is something like this possible?
tagged with: java
has answer: http://stackoverflow.com/a/24182321
type: Question

http://stackoverflow.com/a/24150358
accepted answer of: http://stackoverflow.com/q/24149122
has comment: http://stackoverflow.com/comment/37269014
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24149122
upvote count: 1
has body: Open the histogram view (there is a toolbar button for this, which looks like a bar graph). In the first row of the histogram view where it says "Regex", type WeakReference to filter the view. Find the java.lang.ref.WeakReference line, right-click, and choose "Show Objects By Class" -> "By Outgoing References". The resulting view should be summarize the objects being referred to, grouped by class as you require. The Objects column should indicate the number of instances for each class.
type: Answer

http://stackoverflow.com/q/24171171
has comment: http://stackoverflow.com/comment/37310745
has answer: http://stackoverflow.com/a/24172359
has comment: http://stackoverflow.com/comment/37428660
tagged with: handler
score: 1
has comment: http://stackoverflow.com/comment/37311060
tagged with: java
has comment: http://stackoverflow.com/comment/37309513
has comment: http://stackoverflow.com/comment/37310394
has comment: http://stackoverflow.com/comment/37310606
tagged with: user-interface
has comment: http://stackoverflow.com/comment/37309449
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37310496
has comment: http://stackoverflow.com/comment/37310947
upvote count: 1
has comment: http://stackoverflow.com/comment/37309019
has comment: http://stackoverflow.com/comment/37318374
has body: I am developing an android application that needs to transmit some data through sockets. At this moment it connects to the socket, send messages when clicking the interface buttons, but I want to alert the user with a AlertDialog on my interface when the socket class receives a message. I've been searching and found information about Handlers but I could not use them. How can I solve this problem? Thanks
favorite count: 0
has comment: http://stackoverflow.com/comment/37313764
type: Question
has title: Communication between Socket Class and UI
type: UnansweredQuestion
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/37311522
has comment: http://stackoverflow.com/comment/37311215
has comment: http://stackoverflow.com/comment/37309630
has comment: http://stackoverflow.com/comment/37309726

http://stackoverflow.com/comment/37300429
type: Comment
has text: Agreed -- this is the way to go. You should also check out the book, Implementing Domain Driven Design, by Vaughn Vernon: http://www.amazon.com/Implementing-Domain-Driven-Design-Vaughn-Vernon/dp/0321834577
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24166246

http://stackoverflow.com/comment/37393914
has text: Well, the thing is that the output is synchronized, so a thread might be blocked on it waiting to print. So it could be Thread 8 is waiting for Thread 9 to finish printing, after which it can print. *Then* it checks `run`, sees that it is `false`, then exits. So your guess was in the right direction.
score: 1
comment on: http://stackoverflow.com/q/24216484
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37476956
score: 0
type: Comment
has text: upgraded LibGdx to the latest 1.1.0 version. Now the pause() and resume() are called (hide() is not called in this scenario) inside the Screen implementation. But setting input processor to 'null' in pause and then reinitializing it on resume() didn't solve the issue. The application still does not captures the back button press.
type: AnswerComment
comment on: http://stackoverflow.com/a/24227360

http://stackoverflow.com/comment/37356689
comment on: http://stackoverflow.com/q/24197062
type: Comment
type: QuestionComment
has text: yes, the answer http://stackoverflow.com/a/12274406/217324 to that question has the right answer: use object instances to maintain state.
score: 0

http://stackoverflow.com/q/24122862
favorite count: 0
type: Question
has body: Im trying to print the same strings as the user are pasting into the console. My code looks like this: import java.util.Scanner; public class reader { public static void main(String[ ] args) { Scanner scan = new Scanner( System.in ); StringBuffer buf = new StringBuffer(); while ( scan.hasNextLine() ) { buf.append( scan.nextLine() ); buf.append( "\n" ); } String s = buf.toString(); System.out.print(s); } } The problem (i think) is that the loop is endless even if the user is only pasting 4 lines in the console it will not break the while loop. What I want is the "System.out.print(s);" to print s. What should I do?Can I break the loop when the user is pressing Enter?
tagged with: while-loop
type: UnansweredQuestion
score: -2
has answer: http://stackoverflow.com/a/24123054
has comment: http://stackoverflow.com/comment/37216802
has answer: http://stackoverflow.com/a/24122903
tagged with: java.util.scanner
answer count: 3
upvote count: 0
tagged with: java
downvote count: 2
has title: Java endless Scanner loop
has answer: http://stackoverflow.com/a/24122902
tagged with: loops

http://stackoverflow.com/a/24136731
has comment: http://stackoverflow.com/comment/37243290
has body: compareTo is a generic method. Generics are not used so compareTo(Object) is the only method you can override. Please check that: Maven uses a java to compile that supports generics. Source-Level is >= 5. execute mvn -V to see what version of java maven uses to compile. Regards
has comment: http://stackoverflow.com/comment/37247926
score: 3
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37247120
answers question: http://stackoverflow.com/q/24136661
type: Answer

http://stackoverflow.com/comment/37222996
type: Comment
comment on: http://stackoverflow.com/a/24122443
type: AnswerComment
has text: Maybe try the `availble` method, like this -> `instream.available()`, this returns a int but if you go like... `if(instream.available() > 0)`; I'm taking a shot in the dark :P
score: 0

http://stackoverflow.com/q/24252739
tagged with: jsp
tagged with: javascript
tagged with: jquery
has comment: http://stackoverflow.com/comment/37463473
tagged with: ajax
has comment: http://stackoverflow.com/comment/37464003
score: 0
tagged with: java
has title: How do I return an image from a java bean through an AJAX call?
answer count: 1
has comment: http://stackoverflow.com/comment/37463316
has body: I have a jsp that makes an AJAX call to a helper jsp which calls a java bean that creates an image. The helper JSP then loads the image into a byte array encodes it to Base64 using Apache commons and returns the string. File imageFile = new File("test.png"); response.setHeader("Content-Type", getServletContext().getMimeType(imageFile.getAbsolutePath())); response.setHeader("Content-Length", String.valueOf(imageFile.length())); FileInputStream is = new FileInputStream(imageFile); byte[] buffer = new byte[(int)imageFile.length()]; // 32k buffer int offset = 0; while ( offset &lt; buffer.length ) { int count = is.read(buffer, offset, buffer.length - offset); offset += count; } byte[] encoded = Base64.encodeBase64(buffer); String encodedFile = Base64.encodeBase64String(encoded); out.print(encodedFile); out.flush(); Here is the javascript that makes and receives the request for the image: function getContourImage(startDate, stopDate){ $.ajax("services/contour.jsp", { data: { startDate: startDate, stopDate: stopDate }, dataType: "json", traditional: true, success: contourImageHandler() }); } function contourImageHandler(resp){ alert("resp: " + resp); $( "#plot" ).attr("src","data:image/png;base64," + resp); } This is the image display area in the html: &lt;div id="imageDisplay" name="imageDisplayDiv" img name="contourImageLocation" id="plot" src="images/test.png" width="1200" height="1200"&gt; I can see the response in the firebug panel and it seems to have data. The alert statement in the ajax response handler says the response is undefined and no image is placed in the plot location. Does anyone know what I have done wrong?
type: Question
has answer: http://stackoverflow.com/a/24256152
type: UnansweredQuestion

http://stackoverflow.com/q/24208828
tagged with: spring
has comment: http://stackoverflow.com/comment/37378937
has comment: http://stackoverflow.com/comment/37378785
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/43204174
score: 36
has answer: http://stackoverflow.com/a/74048975
has body: Update 02/05/2018 (about 4 years later)...I tested this again as people have been upvoting my question/answer and Sotirios Delimanolis is correct that I should not have to write the code in my answer to make this work. I used basically the same RestTemplate/REST service setup as shown in my question with the REST service having a confirmed response content type of application/json and RestTemplate was able to process the response with no issues into a Map. I'm invoking a rest service that returns JSON like this: { "some.key" : "some value", "another.key" : "another value" } I would like to think that I can invoke this service with a java.util.Map as the response type but that's not working for me. I get this exception: org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [interface java.util.Map] Should I just specify String as the response type and convert the JSON to a Map? Edit I Here's my restTemplate call: private Map&lt;String, String&gt; getBuildInfo(String buildUrl) { return restTemplate.getForObject(buildUrl, Map.class); } Here's how I'm setting up the restTemplate: @PostConstruct public void initialize() { List&lt;ClientHttpRequestInterceptor&gt; interceptors = new ArrayList&lt;&gt;(); interceptors.add(new ClientHttpRequestInterceptor() { @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { HttpRequestWrapper requestWrapper = new HttpRequestWrapper(request); requestWrapper.getHeaders().setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); return execution.execute(requestWrapper, body); } }); restTemplate.setInterceptors(interceptors); } Edit II Full error message: org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [interface java.util.Map] and content type [application/octet-stream] at org.springframework…
has comment: http://stackoverflow.com/comment/37379034
has comment: http://stackoverflow.com/comment/37378917
tagged with: java
accepted answer: http://stackoverflow.com/a/24209354
has answer: http://stackoverflow.com/a/45469786
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/40524987
downvote count: 0
answer count: 7
linked to: http://stackoverflow.com/q/28646572
has answer: http://stackoverflow.com/a/24209354
has answer: http://stackoverflow.com/a/24209447
possible better answer: http://stackoverflow.com/a/43204174
has comment: http://stackoverflow.com/comment/37378683
has answer: http://stackoverflow.com/a/63682904
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37378763
upvote count: 36
tagged with: resttemplate
has title: resttemplate getForObject map responsetype

http://stackoverflow.com/comment/37406210
has text: Where is class A being instantiated? I feel like you provided half the code, and it wasn't the half we needed.
score: 0
comment on: http://stackoverflow.com/q/24223149
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37472379
has text: I recently found that the support for static includes "<%@include file="reuse.html"%>" and scriptlets have been discontinued with Tomcat 8. Can you share where you found this??
score: 0
comment on: http://stackoverflow.com/q/24257736
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24118880
has title: Can I parse XML in an AsyncTask right after making a HttpPost to retrieve it? Using SAX parse
answer count: 1
has body: This might seem like a bit of a basic question but I've sort of confused myself, going around in circles based on tutorials. I have to do an authorization in my HttpPost with a Hmac_Sha-1 code, add it to the header. The XML comes back just fine but obviously it's not parsed. The AsyncTask is in it's own class i.e extends AsyncTask&lt;Void, Void, String&gt;. Is there a way to Parse it straight after? Maybe if I put the result into a string? I'm just unsure if it all can be done right there and then, much like JSON can be parse right there. Obviously that's different though. Tutorials show lots of classes are needed. The reason for doing this is because I want to run the HttpPost request the second my app starts, get the request and hopefully parse it, then use an interface listener or whatever to send it to the correct Fragment. A lot of the tutorials have done InputStream is = readerXML.parse(new InputSource(url.openStream())); which I can't do because I need to add a header to my post request otherwise I won't even return an XML to parse. At least to my knowledge. This is more of a theory question but it will get me in the direction I need. Appreciate any help! Thank you. EDIT: Typical, just post a question and basically find half my answer. I can parse the string I get from my HttpPost in my SAXParser and I can do it in the AsyncTask.
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-asynctask
type: Question
tagged with: android
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24259748
accepted answer: http://stackoverflow.com/a/24259748
tagged with: xml-parsing
tagged with: java

http://stackoverflow.com/comment/85935842
type: Comment
comment on: http://stackoverflow.com/q/24149438
type: QuestionComment
has text: Possible duplicate of [How to programmatically log out from Facebook SDK 3.0 without using Facebook login/logout button?](https://stackoverflow.com/questions/14328148/how-to-programmatically-log-out-from-facebook-sdk-3-0-without-using-facebook-log)
score: 0

http://stackoverflow.com/comment/37206818
score: 0
comment on: http://stackoverflow.com/q/24117547
has text: @ashok_p i added an example of text
type: Comment
type: QuestionComment

oauth-2.0
type: Tag
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/24113087
tags question: http://stackoverflow.com/q/24117748
tags question: http://stackoverflow.com/q/24128234

http://stackoverflow.com/q/24156327
downvote count: 0
answer count: 1
tagged with: unicode
favorite count: 0
has title: Print Unicode Character Android TextView
type: Question
tagged with: android
tagged with: java
type: UnansweredQuestion
tagged with: textview
has body: I am trying to use emoji icons listed here http://apps.timwhitlock.info/emoji/tables/unicode#block-6a-missing-emoticons Each icon has a unicode character with it like U+1F601 is the Unicode of "GRINNING FACE WITH SMILING EYES" = My question here is how can i set this unicode character in textview. I cannot create a char from this value as it will require only four hexadecimal values. For example i created a char like this char c = '\u27A1'; This c works great if i append that to textview and shows me the image properly. How can i create a char of Unicode value U+1F601 - Bytes UTF-8 \xF0\x9F\x98\x81 Also there are certain unicode characters with double values like this U+1F1F7 U+1F1FA = Bytes UTF-8 \xF0\x9F\x87\xB7\xF0\x9F\x87\xBA How can i display them all in textview ?
has comment: http://stackoverflow.com/comment/44618726
score: 4
upvote count: 4
tagged with: char
has answer: http://stackoverflow.com/a/24160579

http://stackoverflow.com/comment/37343304
score: 0
comment on: http://stackoverflow.com/a/24188944
type: Comment
has text: Answer was posted before the render code was posted.
type: AnswerComment

http://stackoverflow.com/comment/37481337
score: 1
type: Comment
has text: Interesting point of view. Thread is the abstract class that is not an abstract class. I can see how that creates confusion and in that light I see far less reason to vote this question down.
type: AnswerComment
comment on: http://stackoverflow.com/a/24262513

http://stackoverflow.com/q/24225432
has comment: http://stackoverflow.com/comment/37410499
has title: Applying custom fonts in buttons for android
has comment: http://stackoverflow.com/comment/37410523
tagged with: http://stackoverflow.com/tag/xml
score: 2
has comment: http://stackoverflow.com/comment/37410468
linked to: http://stackoverflow.com/q/6372458
has answer: http://stackoverflow.com/a/45853298
answer count: 3
upvote count: 2
tagged with: fonts
has comment: http://stackoverflow.com/comment/37410511
has answer: http://stackoverflow.com/a/45852444
has body: I am trying to add a custom roboto font to my android button; however, most solutions aren't working in this case. I am trying to use solutions from here...Setting Button text font in android I have fonts right here in my assets folder. Here is a snippet of my code: Button block_block_font =(Button) findViewById(R.id.block_button); Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"); block_block_font.setText("show"); block_block_font.setTypeface(typeface); Button security_settings_button_font =(Button) findViewById(R.id.security_settings_button); security_settings_button_font.setText("show"); security_settings_button_font.setTypeface(typeface); Button blacklist_whitelist_button_font =(Button) findViewById(R.id.blacklist_whitelist_button); blacklist_whitelist_button_font.setText("show"); blacklist_whitelist_button_font.setTypeface(typeface); However, when I apply that solution for editing I produce this error: 06-14 16:59:56.677 26389-26389/com.spicycurryman.getdisciplined10.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.spicycurryman.getdisciplined10.app/com.spicycurryman.getdisciplined10.app.MainActivity}: java.lang.RuntimeException: native typeface cannot be made at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2247) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2297) at android.app.ActivityThread.access$700(ActivityThread.java:152) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5328) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvi…
tagged with: java
has comment: http://stackoverflow.com/comment/37410488
downvote count: 0
linked to: http://stackoverflow.com/q/7531856
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24225596
has comment: http://stackoverflow.com/comment/37410464
tagged with: android-layout
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/37401872
type: Comment
has text: if i want to pass the error message with the redirect what will i do
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24208456

http://stackoverflow.com/comment/37417069
type: Comment
comment on: http://stackoverflow.com/a/24229024
has text: ya i used ur suggestion bt when getSupportActionBar() write it .it give error
score: 0
type: AnswerComment

machine-learning
type: Tag
tags question: http://stackoverflow.com/q/24151442
tag name: machine-learning
tags question: http://stackoverflow.com/q/24251608

http://stackoverflow.com/comment/37330679
score: 0
comment on: http://stackoverflow.com/a/24182501
type: AnswerComment
has text: Added a reference counter to the DB creation statement, all references seem to be cleaned up properly but the problem still exists
type: Comment

http://stackoverflow.com/q/24136661
has title: @Override not working in Maven project
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24138031
possible better answer: http://stackoverflow.com/a/24136803
has comment: http://stackoverflow.com/comment/37242920
accepted answer: http://stackoverflow.com/a/24138031
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24136731
upvote count: 3
score: 3
has answer: http://stackoverflow.com/a/24136803
tagged with: maven
has comment: http://stackoverflow.com/comment/37242987
has comment: http://stackoverflow.com/comment/37243344
tagged with: eclipse
linked to: http://stackoverflow.com/q/2335655
answer count: 3
downvote count: 0
tagged with: java
has body: I have several override methods like this: @Override public int compareTo(Property p) { return getText().compareTo(p.getText()); } As a Java project, it works fine, but as a Maven project, it returns the following error: The method compareTo(Property) of type Property must override a superclass method After researching into this, I think I'm suppose to include my JRE System Library (jdk1.6_u25) as a dependency in my POM file, or is this a completely different problem all together? Many thanks.

http://stackoverflow.com/comment/37288948
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24160747
has text: Try it once with the `request` object, move your code where `request` is available
type: Comment

http://stackoverflow.com/q/24133364
type: Question
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/24139022
type: UnansweredQuestion
has body: I wanted to apply decorators (that is images) to my custom label provider which is of tree viewer form displaying the list of some folder names. I googled it out but unfortunately only i got the information of how to create decorators. For example : i have a label provider by name "ViewLabelProvider" which is able to display list of folders. I want to differentiate these folders by applying some icons through decorators, but I am not able to establish a relationship between the custom decorators to the above label provider mentioned. Please let me know, how to achieve this. Thanks in advance...
has comment: http://stackoverflow.com/comment/37242750
has comment: http://stackoverflow.com/comment/37243354
score: 0
has comment: http://stackoverflow.com/comment/37242641
has title: How to apply decorators to the label provider in RCP eclipse environment?
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37239084
has comment: http://stackoverflow.com/comment/37238928
has comment: http://stackoverflow.com/comment/37242919

http://stackoverflow.com/comment/37308815
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24171201
has text: Post your [SSCCE](http://sscce.org/) that demonstrates the problem. The code you posted doesn't help because we don't know the context of how the class is used and how the text field is added to the frame.
score: 2

http://stackoverflow.com/comment/37200934
type: QuestionComment
comment on: http://stackoverflow.com/q/24114155
score: 0
has text: for format part of question: http://stackoverflow.com/questions/11356109/improper-result-of-simpledateformat
type: Comment

http://stackoverflow.com/comment/37366887
type: QuestionComment
has text: You want a to know how to resize the icon of a label so it meets the requirements of its container? First, JLabel doesn't resize the icon when it's size changes, second, to resize the image, you have a number of possible choices as listed on the two linked examples (and other examples I linked in the comments)
comment on: http://stackoverflow.com/q/24201612
score: 0
type: Comment

http://stackoverflow.com/comment/37402674
type: Comment
type: QuestionComment
has text: It looks like you forgot `glEnableClientState(GL_VERTEX_ARRAY)` before `glDrawArrays`, as well as disabling them after.
score: 0
comment on: http://stackoverflow.com/q/24220363

http://stackoverflow.com/comment/37422354
has text: IMHO, `IntentService` is not designed for `while(true)` scenarios. `WakefulIntentService` is very much not designed for `while(true)` scenarios. In either case, roll your own service, one that has a threading model that fits your needs (and its own `WakeLock` as needed).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24231819
type: Comment

http://stackoverflow.com/q/24239791
type: AnsweredQuestion
score: 0
has body: I have n jars with same functionality but different package name ( since different regions). I have same operation performed using this n jars. Now I want to load the corresponding region of jars, for my operation. What is the best design pattern to use in this case. I tried with reflection by changing the package name and loading dynamically. But is there any best pattern available for this case ?
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24239975
possible better answer: http://stackoverflow.com/a/24239975
linked to: http://stackoverflow.com/q/60764
has answer: http://stackoverflow.com/a/24240084
has comment: http://stackoverflow.com/comment/37438202
accepted answer: http://stackoverflow.com/a/24240084
type: Question
has comment: http://stackoverflow.com/comment/37437840
tagged with: jar
has comment: http://stackoverflow.com/comment/37437925
has title: what is best pattern to apply while loading jars dynamically
duplicate of: http://stackoverflow.com/q/60764

http://stackoverflow.com/q/24243161
tagged with: android
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24243447
has comment: http://stackoverflow.com/comment/37444381
type: Question
has comment: http://stackoverflow.com/comment/37444735
has body: I have two framelayout in my main.xml file. I add framelayouts to the class that extends Fragment. my main class extends FragmentActivity and this is Oncreate method of it: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); FragmentManager fm =getFragmentManager(); FragmentTransaction ft=fm.beginTransaction(); Fragment f=new Freg1(); Fragment f2=new Freg1(); ft.add(R.id.frame1, f); ft.add(R.id.frame2, f2); ft.commit(); tf=Typeface.createFromAsset(this.getAssets(),"font/Byekan.ttf" ); tv1=(TextView) findViewById(R.id.textView1); tv1.setTypeface(tf); Log.i(TAG,"1"); lv1=(ListView) findViewById(R.id.listView1); lv2=(ListView) findViewById(R.id.listView2); Log.i(TAG,"2"); List&lt;String&gt; stringList = new ArrayList&lt;String&gt;(Arrays.asList(s1)); Log.i(TAG,"3"); ListAdapter listAdapter = new CustomListAdapter(MainActivity.this , R.layout.custom_list ,stringList); Log.i(TAG,"4"); lv1.setAdapter(listAdapter); Log.i(TAG,"5"); lv2.setAdapter(listAdapter); Log.i(TAG,"6"); } when i run the codes, it crashed after LOG no4. that mean setAdapter() method do not work. how can i resolve this problem? this is my logcat resource: Shutting down VM threadid=1: thread exiting with uncaught exception (group=0x40a13300) FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.taxitabriz/com.example.taxitabriz.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) at android.app.ActivityThread.access$600(ActivityThread.java:130) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect…
downvote count: 0
accepted answer: http://stackoverflow.com/a/24243447
has title: how to set listadapter for fragment
upvote count: 1
has comment: http://stackoverflow.com/comment/37444276
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37444405
tagged with: android-fragments
score: 1

http://stackoverflow.com/comment/37291359
comment on: http://stackoverflow.com/a/24151142
score: 0
type: AnswerComment
has text: That makes sense. I would definitely start with setting up a connection pool, that's the lowest hanging fruit here and might be enough for your use case. If you still see slow performance, I'd tackle the batch updates but you might need to refactor your schema slightly (as indicated in my update) to make that work effectively.
type: Comment

http://stackoverflow.com/comment/37452137
comment on: http://stackoverflow.com/a/24209993
score: 0
type: Comment
type: AnswerComment
has text: So you mean *prepareSession* of ApplicationModuleImpl is not being called?

http://stackoverflow.com/comment/39297487
has text: That's indeed the solution I used in the end, though it should be mentioned that it's not a JPA solution but it's a Hibernate annotation. But it looks like it's the only way, except from normalizing the database.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25173077

http://stackoverflow.com/comment/37477070
has text: "mvn install". At what stage does the compile happen -- is it before or after the dependencies are downloaded?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24252640
type: QuestionComment

http://stackoverflow.com/comment/37401284
type: AnswerComment
comment on: http://stackoverflow.com/a/24220450
type: Comment
has text: So in your second case is there are two real objects are created?
score: 0

http://stackoverflow.com/comment/37230182
has text: "*from the same folder where the Bar.class lives*" do you mean `Foo` folder?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24129592

http://stackoverflow.com/q/24231432
tagged with: interface
tagged with: java
has body: I'm working on an assignment where the program has to process a file and read every line then print it out in all caps. I'm pretty sure I have most of it written out, however, I am having trouble with my main method. I am supposed to call my go method in my FileProcessor class and have it use the StringProcessor interface to call my Upper class. I'm using an interface because I will be adding other classes later, but for now I am having trouble with implementing it all in my Driver class. How do I declare a StringProcessor object in my Driver class and how can I use it so that it would create the file in all caps? Here's my code so far: Driver.java import java.util.Scanner; import java.io.FileNotFoundException; import javax.swing.JFileChooser; import java.io.File; public class Driver { public static void main(String[] args) { try { JFileChooser chooser = new JFileChooser(); Scanner in = null; File selectedFile = null; if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { selectedFile = chooser.getSelectedFile(); in = new Scanner(selectedFile); FileProcessor filePro = new FileProcessor(selectedFile); while (in.hasNext()) { String line = in.next(); System.out.println(line); } } } catch (FileNotFoundException e) { e.printStackTrace(); } } } FileProcessor.java import java.util.Scanner; import java.io.FileNotFoundException; import java.io.File; import javax.swing.JFileChooser; public class FileProcessor { private Scanner in; /** * Processes file to be able to use * @param f file to be processed */ public FileProcessor(File f) throws FileNotFoundException { in = new Scanner(System.in); } public void go(StringProcessor s) throws FileNotFoundException { while (in.hasNextLine()) { s.process(in.nextLine()); } } } StringProcessor.java public interface StringProcessor { void process(String s); } Upper.java public class Upper implements StringProcessor { public void process(String s) { System.out.println(s.toUpperCase()); } } I'm sorry if I didn't post the best ques…
has answer: http://stackoverflow.com/a/24231546
has title: Using interface to process a file and return in a different format
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24231454
tagged with: file
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/24212985
type: Answer
has body: Your checkInput() function should throw its own exception if the input is not correct. Spliting the code into a validator and a parser would result in parsing the input twice.
answers question: http://stackoverflow.com/q/24209568
score: 0

http://stackoverflow.com/comment/37401554
score: 0
has text: You need to put it in your activity xml or get the view from the fragment
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24220675

http://stackoverflow.com/q/24264475
type: AnsweredQuestion
score: 0
tagged with: visualization
has title: Intellij IDEA Java/Scala project subpackage display
tagged with: java
tagged with: scala
tagged with: package
tagged with: intellij-idea
answer count: 1
has body: In Intellij Idea, in Project window where the Java/Scala packages hierarchy is displayed, how to visualise a specific subpackage only ? Namely, how to trim some prefixes in the package tree ? Update In a similar way as in Eclipse 'Goto...' option on packages display.
has answer: http://stackoverflow.com/a/24264715
accepted answer: http://stackoverflow.com/a/24264715
type: Question

http://stackoverflow.com/comment/37217032
type: AnswerComment
has text: Oh I restartet the emulator an now I can safe datas:) thank you:)
type: Comment
comment on: http://stackoverflow.com/a/24122443
score: 0

http://stackoverflow.com/comment/38557876
type: Comment
type: QuestionComment
has text: Glassfish is open source, no? Why not read the relevant code to find out if or how it is possible?
comment on: http://stackoverflow.com/q/24150521
score: 1

http://stackoverflow.com/comment/37423343
has text: run `env` from your terminal, and check what the classpath is set to there.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24232263

intellij-idea
tags question: http://stackoverflow.com/q/24180575
tags question: http://stackoverflow.com/q/24142419
tags question: http://stackoverflow.com/q/24264475
tags question: http://stackoverflow.com/q/24246533
tags question: http://stackoverflow.com/q/24261325
tags question: http://stackoverflow.com/q/24205701
tags question: http://stackoverflow.com/q/24149994
tags question: http://stackoverflow.com/q/24223216
tags question: http://stackoverflow.com/q/24262222
tags question: http://stackoverflow.com/q/24189718
tags question: http://stackoverflow.com/q/24185378
tags question: http://stackoverflow.com/q/24117615
tags question: http://stackoverflow.com/q/24191754
tags question: http://stackoverflow.com/q/24108604
tags question: http://stackoverflow.com/q/24264811
tags question: http://stackoverflow.com/q/24217611
tags question: http://stackoverflow.com/q/24137376
tags question: http://stackoverflow.com/q/24266917
tags question: http://stackoverflow.com/q/24261986
tags question: http://stackoverflow.com/q/24135687
tags question: http://stackoverflow.com/q/24147313
tags question: http://stackoverflow.com/q/24113584
type: Tag
tags question: http://stackoverflow.com/q/24150304
tags question: http://stackoverflow.com/q/24173901
tags question: http://stackoverflow.com/q/24176199
tags question: http://stackoverflow.com/q/24169576
tags question: http://stackoverflow.com/q/24243371
tag name: intellij-idea
tags question: http://stackoverflow.com/q/24188704
tags question: http://stackoverflow.com/q/24237606
tags question: http://stackoverflow.com/q/24206315
tags question: http://stackoverflow.com/q/24260688
tags question: http://stackoverflow.com/q/24241350
tags question: http://stackoverflow.com/q/24263280
tags question: http://stackoverflow.com/q/24119743
tags question: http://stackoverflow.com/q/24210717

http://stackoverflow.com/a/24155331
has body: Change the add method in UserIO class as below : public static void add(User user, String filepath) throws IOException { BufferedWriter buffer; buffer = new BufferedWriter(new FileWriter(filepath, true)); buffer.write(user.getEmail() + "|" + user.getFirstName() + "|" + user.getLastName()); buffer.newLine(); buffer.close(); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24154505
has comment: http://stackoverflow.com/comment/37278526

http://stackoverflow.com/q/24162758
has answer: http://stackoverflow.com/a/24163847
tagged with: java
accepted answer: http://stackoverflow.com/a/24163043
has answer: http://stackoverflow.com/a/24163043
has comment: http://stackoverflow.com/comment/37291946
type: Question
has comment: http://stackoverflow.com/comment/37291649
has comment: http://stackoverflow.com/comment/37291202
possible better answer: http://stackoverflow.com/a/24163847
answer count: 3
score: 1
has body: I have a program that creates multiple threads, and i need that any one of them will write to the DB. the problem is that if i use the same connection the data is incorrect due to the access of multiple threads to the same Variables (like statment.setString()). if i use different connection it Takes all the benefit from the threads. In summary: i need that all threads will access a class or another thread that will hold 1 connection and will hold a batch of queries and once in a while will perfome execute batch. thank you!
tagged with: multithreading
downvote count: 0
has comment: http://stackoverflow.com/comment/37291992
upvote count: 1
has title: How can multiple Threads write to the database by using the same connection in java?
favorite count: 0
has answer: http://stackoverflow.com/a/24162987
type: AnsweredQuestion

http://stackoverflow.com/q/24193588
tagged with: protocol-buffers
has comment: http://stackoverflow.com/comment/37359323
has comment: http://stackoverflow.com/comment/37349666
tagged with: java
has body: I am attempting to write and read Uids from Accumulo Value (key,Value) into Uid.List using protobuf. Specifically: org.apache.accumulo.examples.wikisearch.protobuf.Uid;import org.apache.accumulo.examples.wikisearch.protobuf.Uid.List.Builder I use the following code to write Uid.List where I declare UidListCount as #of uids in List Cseq: Builder uidBuilder = Uid.List.newBuilder(); uidBuilder.setIGNORE(false); for String entry : seq){ uidBuilder.addUID(entry); } Uid.List uidList = uidBuilder.build(); Value newAccumuloValue = new Value(uidList.toByteArray()); This seems to work fine. When I Try to read the Uid.List out of accumulo value,where value is a protobuf Uid.List, its a no-go: byte[] byteVal = value.getBytes; //retrieving Accumulo Value containing Uid.List Uid.List uids= Uid.List.parseFrom(byteVal); while (counter &lt;= counter){ String uidStr = uids.getUID(counter).toString(); system.out.println(uidStr); } I keep getting "tag errors" I would really like to understand how to read out what goes in. Thanks!
has comment: http://stackoverflow.com/comment/37355161
has comment: http://stackoverflow.com/comment/37355227
accepted answer: http://stackoverflow.com/a/24208611
has comment: http://stackoverflow.com/comment/37355212
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37355791
answer count: 1
has title: Protobuf in java : Uid.Lists from Accumulo Values go in but they don't come out
tagged with: accumulo
has answer: http://stackoverflow.com/a/24208611
type: Question

http://stackoverflow.com/q/24139466
has comment: http://stackoverflow.com/comment/37248573
tagged with: java
tagged with: hibernate
tagged with: h2
has title: Spring Hibernate H2 database encoding
has comment: http://stackoverflow.com/comment/37248670
has comment: http://stackoverflow.com/comment/37248208
has comment: http://stackoverflow.com/comment/37248352
has comment: http://stackoverflow.com/comment/37248940
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/37249721
has comment: http://stackoverflow.com/comment/37249474
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37249663
has body: i have an encoding problem when reading from the H2 database for arabic charachters i see in my page ????????? even i configured UTF-8 in several places Web.xml encoding-filter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encoding-filter /* in Spring servlet.xml classpath:hibernate.cfg.xml ${jdbc.dialect} true create-drop true UTF-8 UTF-8 and in the JSP page also in the getter of the entity public String getaName() throws UnsupportedEncodingException { return new String(aName.getBytes(),"UTF-8"); } I Have run out of ideas ,any Help please?
linked to: http://stackoverflow.com/q/3029401
score: 0

http://stackoverflow.com/a/24189513
answers question: http://stackoverflow.com/q/24189049
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37341561
type: Answer
has comment: http://stackoverflow.com/comment/37341621
has body: You're assigning the views before the onCreate is called, move them inside the onCreate method. Also, change your if statement to use .equals instead of == as you're comparing Strings. Another problem in your code is that you're assigning 2 different TextViews to the same TextView object (both R.id.answer and R.id.textBox). I removed the second assignment in the code below. import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Spinner; import android.widget.TextView; import java.util.Random; public class MainActivity extends ActionBarActivity{ public Button button; public TextView text; public Spinner a; public String b; public int d; public Random r=new Random(); @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); text = (TextView)findViewById(R.id.answer); a=(Spinner)findViewById(R.id.choices); button=(Button)findViewById(R.id.button); setContentView(R.layout.activity_main); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ b=(String)a.getSelectedItem(); if(b.equals("2")){ d=2+r.nextInt(1); if(d==1){ text.setText("A"); } else if(d==2){ text.setText("B"); } } } }); }
score: 0
has comment: http://stackoverflow.com/comment/37341902
accepted answer of: http://stackoverflow.com/q/24189049

http://stackoverflow.com/a/24215051
score: 0
answers question: http://stackoverflow.com/q/24214952
has body: Use the split() method! It is definitely the best way of doing it! Other ways can be harder or take up more performance! String[] strings = myString.split(" ");
type: Answer

http://stackoverflow.com/q/24260680
has title: Android ADT plugin fails to open XML files on Eclipse
score: 3
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25155130
tagged with: eclipse
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
type: UnansweredQuestion
tagged with: android
tagged with: adt
has body: I'm struggling with this strange bug with ADT on Eclipse (version 22.6.3): after few lucky runs, when I try to open an XML file it shows an empty and non-editable blank file. I've already tried EVERYTHING, from resetting/reinstalling all the plugins to using a fresh installed Eclipse on a fresh new workspace, the problem persists. This is the error from the eclipse log: Caused by: java.lang.NoSuchFieldError: ACTION_BAR at com.android.layoutlib.bridge.Bridge.init(Bridge.java:206) at com.android.ide.common.rendering.LayoutLibrary.init(LayoutLibrary.java:297) at com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData.getLayoutLibrary(AndroidTargetData.java:327) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.updateCapabilities(GraphicalEditorPart.java:1202) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.onTargetChange(GraphicalEditorPart.java:1194) at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.onDescriptorsChanged(LayoutEditorDelegate.java:916) at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegateInitUiRootNode(LayoutEditorDelegate.java:835) at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegateXmlModelChanged(LayoutEditorDelegate.java:393) at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.xmlModelChanged(CommonXmlEditor.java:329) at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor$XmlModelStateListener.modelChanged(AndroidXmlEditor.java:1653) at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.createTextEditor(AndroidXmlEditor.java:835) at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.createAndroidPages(AndroidXmlEditor.java:320) at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.addPages(AndroidXmlEditor.java:310) at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.addPages(CommonXmlEditor.java:285) at org.eclipse.ui…

http://stackoverflow.com/q/24182206
has title: Distributed Event Processing
type: UnansweredQuestion
tagged with: hazelcast
has answer: http://stackoverflow.com/a/24192413
has body: Hi this might be a bit of a noob question, but I can't seem to find an appropriate solution for the following use case: On the backend we have x number of services distributed across VMs, each providing the same service (distributed replication). These services are all listening on a distributed event bus (such as Hazelcast). When an event arrives, say GetDataA, the EventBus infrastructure sends the event to each of the back end services one at a time. If a service decides its going to process the event it does so and returns the data to the publisher of the event via the EventBus. Once a service decides its going to process an event, then the EventBus should stop sending that event to other listeners (services), and continue routing the next event (i.e. it should be non-blocking) So this solution requires a kind of request/response distributed event architecture running asynchronously. Does anyone know of any scalable solutions in this space. I've looked at Hazelcast, but the event mechanism means that all listeners will get the event. I've looked at the Executor service, but this sends code to other nodes, while what I am looking for is for another single node to process the request.
score: 0
answer count: 2
tagged with: java
tagged with: events
tagged with: jms
has answer: http://stackoverflow.com/a/71698701
type: Question

http://stackoverflow.com/a/24217820
has body: In the catch block of POST() add a line result="Exception: " + e.getMessage(); Then in onPostExecute Toast (....,result,...);
type: Answer
answers question: http://stackoverflow.com/q/24216470
score: 0

http://stackoverflow.com/comment/37427496
comment on: http://stackoverflow.com/q/24233904
type: QuestionComment
score: 0
type: Comment
has text: Need more of the stack trace. Usually when I see something like this its a subtle typo.

http://stackoverflow.com/comment/37217434
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24113807
has text: The result of the create() method would have to be a mock and so on and so on. This seems like a rat's nest to me. What's the reason for mocking the CuratorFramework instance?

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/24263381

http://stackoverflow.com/q/24157808
has comment: http://stackoverflow.com/comment/37283580
has comment: http://stackoverflow.com/comment/37283895
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37284090
has body: I am trying to use different methods of JH Labs Free Java Library with ColdFusion. I am having a bit of a hard time sorting this Method. I am using Javaloader by Mark to dynamically handle the JAR file. Now here is the following code: &lt;cfscript&gt; imgscalrPath = ExpandPath("filters/Filters.jar"); loader = new javaloader.javaLoader([imgscalrPath]); Scalr = loader.create( "com.jhlabs.image.BoxBlurFilter" ); WriteDump(Scalr); sourceImage = ImageNew("#UploadDir2#/#form.uploadfile#"); &lt;/cfscript&gt; &lt;cfimage action="writeToBrowser" source="#sourceImage#" format="jpg" /&gt; &lt;cfscript&gt; smallerImage = Scalr.blur([1,2],[2,3],20,5,3); ImageWrite(smallerImage,"#UploadDir2#/getoff.jpg"); &lt;/cfscript&gt; I dumped the Scalr and it gave me the following image which shows the method, but when I try to use the method, ColdFusion says the method is not found. I am not sure what is going on here. Can any expert throw some advice? http://i.share.pho.to/f973fa61_o.gif
has comment: http://stackoverflow.com/comment/37282929
has comment: http://stackoverflow.com/comment/37283319
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37319281
has comment: http://stackoverflow.com/comment/37314041
has title: Using the JH Labs Java Image Library With Coldfusion
has comment: http://stackoverflow.com/comment/37338158
tagged with: coldfusion
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37283475
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24152109
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/61879247
answer count: 2
has comment: http://stackoverflow.com/comment/37272288
tagged with: java
downvote count: 0
has title: syntax error on token "-", -- expected
favorite count: 0
has comment: http://stackoverflow.com/comment/37272349
type: Question
has answer: http://stackoverflow.com/a/61879247
accepted answer: http://stackoverflow.com/a/24152138
has comment: http://stackoverflow.com/comment/37272290
has answer: http://stackoverflow.com/a/24152138
tagged with: java-8
score: 4
has body: I am using Eclipse IDE for Java Developers, Kepler Service Release 2, with jdk1.8.0 installed as the JRE. I am using Java All-in-one For Dummies to learn Java SE 8, and, when writing a program, using Swing, I am getting this error: syntax error on token "-", -- expected With this code: button1 = new JButton("Click me!"); button1.addActionListener(e -&gt; button1Click() ); panel1.add(button1); exitButton = new JButton("Exit"); exitButton.addActionListener(e -&gt; exitButtonClick() ); panel1.add(exitButton); this.add(panel1); button1 and exitButton have been declared as JButtons already, and I have imported javax.swing.* and java.awt.event.*. How can I fix this?
has comment: http://stackoverflow.com/comment/37272407
tagged with: eclipse
upvote count: 4

http://stackoverflow.com/q/24177407
score: 0
has comment: http://stackoverflow.com/comment/37320701
accepted answer: http://stackoverflow.com/a/24177431
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24177431
type: Question
has body: I have a regex \d+(?:[.,]\d+ that matches decimal strings with either dot or comma, like 123.123 or 123,123 so the value is valid. Now my problem is to generate a Float value from the String which is either 123.123 or 123,123
has title: Create float from String
tagged with: regex
has comment: http://stackoverflow.com/comment/37319260
type: AnsweredQuestion

jetty-9
tag name: jetty-9
tags question: http://stackoverflow.com/q/24182782
type: Tag
tags question: http://stackoverflow.com/q/24123120

http://stackoverflow.com/q/24185409
tagged with: java
answer count: 1
downvote count: 0
tagged with: maven
favorite count: 0
has answer: http://stackoverflow.com/a/24185467
type: Question
score: 3
has title: What is Apache Maven error " error: annotations are not supported in -source 1.3"?
has comment: http://stackoverflow.com/comment/37337557
has body: When I try to compile a Spring project in Maven I am keep getting following error. What could be the reason for this error? this is my pom.xml 4.0.0 com.springmvc.e1 SpringMVCe1 1.0-SNAPSHOT war SpringMVCe1 http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.version>4.0.5.RELEASE</spring.version> org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} junit junit 3.8.1 test this is the error I get [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Compilation failure ../Controller.java:[7,1] error: annotations are not supported in -source 1.3 [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.BuildFailureException: Compilation failure /home/harsha/workspace/web/SpringMVCe1/src/main/java/com/springmvc/e1/controller/Controller.java:[7,1] error: annotations are not supported in -source 1.3 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) at sun.reflect.NativeMethodAccesso…
accepted answer: http://stackoverflow.com/a/24185467
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37333827
upvote count: 3

http://stackoverflow.com/comment/37511961
type: AnswerComment
comment on: http://stackoverflow.com/a/24255545
type: Comment
score: 0
has text: What should be added to the else statement as the revalidate repaint doesnt work? I couldn't use game state like in the FasterAnimation classes

http://stackoverflow.com/comment/37272455
score: 0
type: Comment
has text: if that is too frequent you should have them as part of single maven project tree, you build once and all gets built
type: AnswerComment
comment on: http://stackoverflow.com/a/24152104

http://stackoverflow.com/comment/37338404
type: QuestionComment
has text: oh the paintComponent is in the same class as all of this, it's called spacePanel
comment on: http://stackoverflow.com/q/24186733
score: 0
type: Comment

http://stackoverflow.com/q/24144497
has comment: http://stackoverflow.com/comment/37274289
type: Question
tagged with: cardlayout
answer count: 1
tagged with: layout-manager
tagged with: swing
has comment: http://stackoverflow.com/comment/37299074
has comment: http://stackoverflow.com/comment/37311207
has comment: http://stackoverflow.com/comment/37310768
type: AnsweredQuestion
score: 0
tagged with: java
has body: I am very new to this site and a novice programmer so I'm hoping someone here can help me with the problem I'm facing. I am making a simple program that uses a card layout to select/enter several user-specific options that will be stored in string variables and then after the last question, used to give a unique answer. Right now the program advances slide's successfully and displays the proper question, however it does not clear the JRadioButton from the first card and keeps using this radio button instead of the desired component for the duration of the program. For example, The second and third card should have JTextField's while the 4th card should have a JComboBox. I have two main class files, one that is the actual frame and the other that is displayed below which does the work behind the scenes. For future reference, I plan to modify this into an applet once it is working properly so any advice on that would be great. Any help will be greatly appreciated, thanks. I believe the problem may stem from the creation of multiple card objects here, the ScreenPanel objects each take the same parameters but depending on the different card, a different Component needs to be produced. // set up questions String question1 = "Sex: "; String[] responses1 = {"Female", "Male"}; ask[0] = new ScreenPanel(question1, responses1); String question2 = "Height in inches: "; String[] responses2 = new String[1]; ask[1] = new ScreenPanel(question2, responses2); String question3 = "Weight in pounds: "; String[] responses3 = new String[1]; ask[2] = new ScreenPanel(question3, responses3); String question4 = "Event: "; String[] responses4 = {"Shot Put", "Discus Throw", "Long Jump", "Triple Jump", "High Jump", "Pole Vault", "4 x 800 Relay", "100 Meter Hurdles", "100 Meter Dash", "4 x 200 Relay", "1600 Meter Run", "4 x 100 Relay", "400 Meter Dash", "300 Meter Hurdles", "800 Meter Run", "200 Meter Dash", "3200 Meter Run", "4 x 400 Relay"}; ask[3] = new ScreenPanel(question4, responses4); Stri…
has title: Advance to next card object with different elements while using java's cardlayout
tagged with: applet
has answer: http://stackoverflow.com/a/24172893
accepted answer: http://stackoverflow.com/a/24172893

http://stackoverflow.com/comment/37363912
score: 0
type: Comment
type: QuestionComment
has text: 1. depends of value stored in XxxTableModel, 2. XxxListener isn't neccessary, cant see reason to notify the clouds in the sky, 3. JTable/XxxTableModel knows JCheckBox as renderer/editors Component, , 4. please whats reason for editor in JTableHeader (isnt right place for editor) and in this form, a few times here and without side effects, 5. be sure that 99,99 pct of readers don't understand the code nor attn description, 6. for better help sooner post an SSCCE/MCVE, short, runnable, compilable with hardcoded value in local variable for JTable/XxxTableModel
comment on: http://stackoverflow.com/q/24200913

http://stackoverflow.com/q/24112096
has title: How to make PrintWriter overwrite old file
tagged with: java
has answer: http://stackoverflow.com/a/59924973
has body: I'm working on a project where I need to print some data to a file. During debugging phase, I would like to overwrite the old textfile so that I don't have to delete the old file just to see the result of some changes that I've made in the code. Currently, the new output data is either added to the old data in the file, or the file doesn't change at all (also, why could this be?). The following is, in essence, the printing part of the code: public class Test { public static void main(String[] arg) { PrintWriter pw = null; try { pw = new PrintWriter(new FileOutputStream("Foo.txt", true)); } catch (Exception e){} double abra = 5; double kadabra = 7; pw.printf("%f %f \n", abra, kadabra); pw.close(); } } Thanks!
has comment: http://stackoverflow.com/comment/37197322
score: 11
type: AnsweredQuestion
answer count: 2
upvote count: 12
has comment: http://stackoverflow.com/comment/37197399
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24112109
type: Question
has comment: http://stackoverflow.com/comment/37197282
possible better answer: http://stackoverflow.com/a/59924973
has answer: http://stackoverflow.com/a/24112109

http://stackoverflow.com/comment/37215477
has text: use a seperate thread
type: Comment
comment on: http://stackoverflow.com/q/24122100
type: QuestionComment
score: 2

http://stackoverflow.com/a/24212080
answers question: http://stackoverflow.com/q/24211959
has comment: http://stackoverflow.com/comment/37393277
score: 0
has comment: http://stackoverflow.com/comment/37396594
has comment: http://stackoverflow.com/comment/37386489
type: AcceptedAnswer
has body: Well first of all you don't use your Bullet class at all. Your bullet class should extend Circle and then you can use that in your main class instead of Circle. public class Bullet extends Circle { private int startX; private int startY; public Bullet(int startX, int startY){ super(); this.startX = startX; this.startY = startY; } // I added some constructors. public Bullet(Circle circle, int startX, int startY){ super(circle); this.startX = startX; this.startY = startY; } public Bullet(float x, float y, float radius, int startX, int startY){ super(x, y, radius); this.startX = startX; this.startY = startY; } public Bullet(Vector2 position, float radius, int startX, int startY){ super(position, radius); this.startX = startX; this.startY = startY; } //getters and setters here... }
accepted answer of: http://stackoverflow.com/q/24211959
has comment: http://stackoverflow.com/comment/37393229
type: Answer

http://stackoverflow.com/comment/37402345
type: QuestionComment
comment on: http://stackoverflow.com/q/24218442
has text: @Andrei Volgin I'm not sure. SpreadsheetService or one of its superclasses. The constructor is not even called. Might be a problem with static initializers?
score: 0
type: Comment

http://stackoverflow.com/comment/37227608
type: Comment
has text: And that is fine, but what I want to do next is to save it in SharedPreferences... So I would like to take name out of range of method >.< (And because of it I left Log.d out so I can test it...)
type: AnswerComment
comment on: http://stackoverflow.com/a/24128245
score: 0

http://stackoverflow.com/q/24212824
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/25017471
accepted answer: http://stackoverflow.com/a/25017471
tagged with: java
linked to: http://stackoverflow.com/q/15030588
tagged with: spring
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24228037
tagged with: jpa
tagged with: spring-data
has title: Auditing Info for JoinTable using @ManyToMany
type: Question
has body: I cannot get the AuditInfo columns to be created when using @ManyToMany relations. Both @Entity objects extend AbstractAuditable and the correct columns are created when using create-drop. The AutitInfo columns do not show in the auto created join table. I see this post regarding Hibernate Audit info, and it says it should be autmatically created. Audit ManyToMany Relationships using Hibernate Envers Should that work with Spring JPA since Hibernate is the provider?
possible better answer: http://stackoverflow.com/a/24228037

http://stackoverflow.com/q/24194221
has title: Unable to use Worldwind components in Topcomponent on the NetBeans 8.0 Platform
answer count: 2
tagged with: jogl
has comment: http://stackoverflow.com/comment/37369856
type: Question
possible better answer: http://stackoverflow.com/a/27421147
tagged with: exception
has answer: http://stackoverflow.com/a/27421147
has body: I have created a TopComponent in an NetBeans 8.0 platform application. I would like to display the canvas on it, but when ever the code is called to bring out a worldwind component and exception is thrown: "A java.lang.IllegalStateException exception has occurred. Click Show Details or see the messages.log file located in your C:\Users\abradford\Desktop\NetBeans Projects\MTAET\MTAET\build\testuserdir\var\log folder." java.lang.IllegalStateException: Cannot find TopComponent with preferredID EarthTopComponent, see IDE log for more details. For this the TopComponent is dependant on the WorldWind.jar files and Jogl files. While the WorldWind.jar files is only dependent on Jogl files. All Im asking is if someone can shed some light on why the worldwind components wont work with the TopComponent. and if someone has an already working piece of code that bridges it or works it out that would be awesome too. Its been a while since I have programmed Java and I may have started in a little strong with all this so forgive me if the answer is obvious. Here is the Code I am using: V This Is the TopComponent V import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.util.NbBundle; import org.openide.windows.TopComponent; @TopComponent.Description( preferredID = "EarthTopComponent", persistenceType = TopComponent.PERSISTENCE_ALWAYS ) @TopComponent.Registration( mode = "editor", openAtStartup = true ) @ActionID( category = "Window", id = "EarthTopComponent" ) @ActionReference( path = "Menu/Window" ) @TopComponent.OpenActionRegistration( displayName = "Earth", preferredID = "EarthTopComponent" ) @NbBundle.Messages({"CTL_EarthViewer=Earth View", "HINT_EarthViewer=This is the Earth View" }) public class EarthTopComponent extends TopComponent { public EarthTopComponent() { setName(Bundle.CTL_EarthViewer()); setToolTipText(Bundle.HINT_EarthViewer()); GUIWorldWind gui = new GUIWorldWind(); add(gui.getFrame()); } } _______________________________________…
tagged with: java
accepted answer: http://stackoverflow.com/a/24286934
has answer: http://stackoverflow.com/a/24286934
tagged with: worldwind
type: AnsweredQuestion
tagged with: netbeans
linked to: http://stackoverflow.com/q/20076253
score: 0

http://stackoverflow.com/comment/37413844
type: QuestionComment
has text: @user3580294 Class B will inherit the main method from class A, so what Anoop claims is true. However the output shouldn't be -12, I suspect there should be a space in-between them!
comment on: http://stackoverflow.com/q/24227114
type: Comment
score: 0

http://stackoverflow.com/comment/76553873
has text: The catch block may need the resource to complete it's task.
score: 2
type: Comment
comment on: http://stackoverflow.com/a/24129101
type: AnswerComment

http://stackoverflow.com/comment/37456794
has text: Yes my program need to be refreshed for every minute. collecting all the commands and executing at once is not possible I guess because for each iteration in the while loop instance_id changes, please look into my code in the string array. so executing each command when its turn comes is proper way. If you can suggest me any other idea it would be very helpful.
comment on: http://stackoverflow.com/a/24230302
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/74810681
type: AnswerComment
has text: Can you provide all code of example, where PDF contains a multiple pages ? Thanks in advance ! :)
type: Comment
comment on: http://stackoverflow.com/a/24240356
score: 0

http://stackoverflow.com/a/24176047
type: Answer
has comment: http://stackoverflow.com/comment/37316990
has comment: http://stackoverflow.com/comment/37317042
score: 9
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37317025
has body: Making those variables final also makes them constant variables. That means the compiler can replace the use of the variables with the value they are initialized with. As such, the compiler attempts to produce the following while (10 &lt; 20) This is equivalent to while (true) That will make it an infinite loop and the code that comes after the block will become unreachable. This is specified in the Java Language Specification, here A while statement can complete normally iff at least one of the following is true: The while statement is reachable and the condition expression is not a constant expression (§15.28) with value true. There is a reachable break statement that exits the while statement. None of those is satisfied, so the while statement cannot complete normally. Everything after it is unreachable.
has comment: http://stackoverflow.com/comment/37316856
upvote count: 9
accepted answer of: http://stackoverflow.com/q/24176030
answers question: http://stackoverflow.com/q/24176030

http://stackoverflow.com/a/24228037
answers question: http://stackoverflow.com/q/24212824
score: 0
has comment: http://stackoverflow.com/comment/37682671
has comment: http://stackoverflow.com/comment/37842344
type: Answer
has body: Spring Data auditing only captures the reference to latest modifying and creating user as well as the creation and modification date. It does not keep revisions of entities around. If you need the latter, the tool of choice is Hibernate Envers which we have a custom Spring Data extension for.

http://stackoverflow.com/comment/37423704
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24232379
has text: `dispatcherContext.xml` is picking up if i remove the `dispatcherContext.xml`
type: Comment

apache-poi
tags question: http://stackoverflow.com/q/24134676
tags question: http://stackoverflow.com/q/24213939
tags question: http://stackoverflow.com/q/24262080
tag name: apache-poi
tags question: http://stackoverflow.com/q/24156372
tags question: http://stackoverflow.com/q/24109239
tags question: http://stackoverflow.com/q/24155238
tags question: http://stackoverflow.com/q/24174156
tags question: http://stackoverflow.com/q/24157183
tags question: http://stackoverflow.com/q/24255371
tags question: http://stackoverflow.com/q/24187209
tags question: http://stackoverflow.com/q/24132601
tags question: http://stackoverflow.com/q/24215842
type: Tag
tags question: http://stackoverflow.com/q/24212980
tags question: http://stackoverflow.com/q/24165124
tags question: http://stackoverflow.com/q/24203087
tags question: http://stackoverflow.com/q/24246258
tags question: http://stackoverflow.com/q/24238461
tags question: http://stackoverflow.com/q/24246924
tags question: http://stackoverflow.com/q/24221460
tags question: http://stackoverflow.com/q/24160089
tags question: http://stackoverflow.com/q/24133288
tags question: http://stackoverflow.com/q/24143683
tags question: http://stackoverflow.com/q/24228129
tags question: http://stackoverflow.com/q/24235603
tags question: http://stackoverflow.com/q/24138783

http://stackoverflow.com/q/24138120
has comment: http://stackoverflow.com/comment/37246885
has comment: http://stackoverflow.com/comment/37246170
answer count: 0
has title: Java application( hosted on Tomcat)session timeout while trying to access through NLB
score: 1
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37246084
tagged with: tomcat5.5
tagged with: web
upvote count: 1
tagged with: tomcat
favorite count: 0
type: Question
tagged with: nlb
has comment: http://stackoverflow.com/comment/37276930
type: UnansweredQuestion
has body: There is a NLB ip which is mapped to five different servers. Each server has the same java application deployed on Tomcat5.5. Now, while trying to access the java application through NLB the application is opening alright but after a few clicks somehow the session is getting expired. What could be the issue and how can it be resolved?

http://stackoverflow.com/a/24340305
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Aslo configure sqlMapClient in Spring Container <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="configLocation" value="WEB-INF/sqlmap-config.xml"/> <property name="dataSource" ref="dataSource"/> And in your DAO did you specified it as property? <property name="sqlMapClient" ref="sqlMapClient"/> In Sqlmap user.xml: Specify namespace="User" <sqlMap namespace="User"> ...
accepted answer of: http://stackoverflow.com/q/24185559
answers question: http://stackoverflow.com/q/24185559
type: Answer

http://stackoverflow.com/q/24210373
has comment: http://stackoverflow.com/comment/37384066
has comment: http://stackoverflow.com/comment/37382106
duplicate of: http://stackoverflow.com/q/421280
favorite count: 0
accepted answer: http://stackoverflow.com/a/24210585
type: Question
has comment: http://stackoverflow.com/comment/37382023
answer count: 2
tagged with: constructor
has body: Here's what I'm trying to do: In my code, I have sets of classes that create objects of other classes. What I am trying to do is, in the constructor of the class that's constructor gets called, find the class which called the constructor in the first place. For example: Main.java: public class Main { public static void main(String[] args) { Test t = new Test(); } } Test.java: public class Test { public Test(){ //somehow find the class where I came from :( } }
downvote count: 2
linked to: http://stackoverflow.com/q/421280
has answer: http://stackoverflow.com/a/24210409
has title: In a constructor, find which class created the object?
has answer: http://stackoverflow.com/a/24210585
type: AnsweredQuestion
score: 3
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/24210409

http://stackoverflow.com/a/24127770
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24127638
has body: I am afraid that won't be possible as long as the img field is static. The truth is, the img field will be overwritten whenever you create a new instance, be it of type A or B and the reason is img being static. Make your img non static: class Base { public /*static*/ Image img; } Everything should work out of the box: Base a = new A(); Base b = new B(); a.img; // Contains the image A created b.img; // Contains the image B created
accepted answer of: http://stackoverflow.com/q/24127638
has comment: http://stackoverflow.com/comment/37268538
score: 3
has comment: http://stackoverflow.com/comment/37263592
type: Answer
upvote count: 3

http://stackoverflow.com/comment/37270230
type: QuestionComment
has text: Try copying the hive-serdes jar into `/usr/lib/hive/lib`
comment on: http://stackoverflow.com/q/24147490
score: 1
type: Comment

http://stackoverflow.com/q/24116561
type: UnansweredQuestion
tagged with: jpa
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/37204994
tagged with: java
tagged with: hibernate
has title: how to remove unwanted details in json
tagged with: http://stackoverflow.com/tag/json
tagged with: spring
has answer: http://stackoverflow.com/a/24116673
score: 0
has body: I have following classes @Configurable @Entity public class QuestionOption { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @Version @Column(name = "version") private Integer version; private boolean isDeleted; public boolean isDeleted() { return isDeleted; } public void setDeleted(boolean isDeleted) { this.isDeleted = isDeleted; } private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getVersion() { return version; } public void setVersion(Integer version) { this.version = version; } public String getName() { return name; } public void setName(String name) { this.name = name; } } @Configurable @Entity public class ClientQuestionOption { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @Version @Column(name = "version") private Integer version; @ManyToOne private ClientQuestion cqid; @ManyToOne private QuestionOption oid; private boolean isDeleted; public boolean isDeleted() { return isDeleted; } public void setDeleted(boolean isDeleted) { this.isDeleted = isDeleted; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getVersion() { return version; } public void setVersion(Integer version) { this.version = version; } public ClientQuestion getCqid() { return cqid; } public void setCqid(ClientQuestion cqid) { this.cqid = cqid; } public QuestionOption getOid() { return oid; } public void setOid(QuestionOption oid) { this.oid = oid; } } ///////////////////////////// @Configurable @Entity public class ClientQuestion { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @Version @Column(name = "version") private Integer version; @NotNull @ManyToOne private Client cid; @ManyToOne private ParentQuestion pqid; @ManyToOne private QuestionType qtid; private boolean isDeleted; public boolean isDeleted() { return isDeleted; } public void setDeleted(boolea…

http://stackoverflow.com/comment/37409038
type: QuestionComment
has text: @Amir, I found this is a code given by my professor, and I am trying to find the output, i am not sure either about in
score: 0
comment on: http://stackoverflow.com/q/24224629
type: Comment

http://stackoverflow.com/a/24179748
has comment: http://stackoverflow.com/comment/37323816
type: Answer
answers question: http://stackoverflow.com/q/24179101
score: 0
has comment: http://stackoverflow.com/comment/37325414
has comment: http://stackoverflow.com/comment/37323467
has body: take a look at this example of contex, maybe can help you. I use the same transaction manager. <?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:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util" xmlns:mockito="http://www.mockito.org/spring/mockito" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.mockito.org/spring/mockito https://bitbucket.org/kubek2k/springockito/raw/tip/springockito/src/main/resources/spring/mockito.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:annotation-config /> <tx:annotation-driven/> <context:component-scan base-package="cat.base.gpt.logica" /> <import resource="classpath:tip-appConfiguration.xml" /> <qualifier type="cat.base.gpt.domini.serveis.IServeiGpt" value="gptServei" /> <constructor-arg type="javax.sql.DataSource" ref="dataSource"/> <constructor-arg type="javax.sql.DataSource" ref="dataSource"/> classpath*:cat/base/gpt/serveis/impl/logica.properties classpath*:entorn-servidor.properties </beans>

http://stackoverflow.com/comment/37340999
score: 1
has text: @Anubian Noob can you please check my edited question. I've edited my code to use a synchronizedList but I'm still getting the exception
comment on: http://stackoverflow.com/a/24188702
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37405634
type: AnswerComment
has text: @Braj I have to practice typing faster :D
comment on: http://stackoverflow.com/a/24222858
type: Comment
score: 0

http://stackoverflow.com/a/24119891
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24119551
type: Answer
score: 0
has body: You need to keep track of the line you are on. So create a variable lineNo. int lineNo=1; You also need to store the number of characters in the second line: int charsInSecondLine=0; and at the end of the while loop increment this variable: lineNo++; Then in the while loop (before the increment) add an if statement that checks if it is the second line if(lineNo==2){ charsInSecondLine=line.length(); } So the code becomes: Scanner input = new Scanner(new FileReader("C:/.../mrr569.fasta")); int lines = 0; int characters = 0; int maxCharacters = 0; int lineNo = 1; int charsInSecondLine = 0; String longestLine = ""; while (input.hasNextLine()) { String line = input.nextLine(); lines++; characters += line.length(); if (maxCharacters &lt; line.length()) { maxCharacters = line.length(); longestLine = line; } if(lineNo==2){ charsInSecondLine=line.length(); } lineNo++; } System.out.println(lines); System.out.println(characters); System.out.println(longestLine); System.out.println(charsInSecondLine);
accepted answer of: http://stackoverflow.com/q/24119551

http://stackoverflow.com/q/24226526
has answer: http://stackoverflow.com/a/24226716
has answer: http://stackoverflow.com/a/24226628
type: UnansweredQuestion
has body: I want to make a condition if the first name and the last name are in the database the score will be updated, else the data will be inserted normally as a new user. My code: public void data(View view) { scor=String.valueOf(qc1.scor); db.execSQL("UPDATE Student SET email='"+scor+"' WHERE fname ='"+exo.fname+"' AND lname ='"+exo.lname+"';"); Toast toast = Toast.makeText(getApplicationContext(), "data updated", Toast.LENGTH_LONG); toast.show(); }
tagged with: android
has title: how to make a condition in java with sqlite
answer count: 4
has answer: http://stackoverflow.com/a/24226647
has comment: http://stackoverflow.com/comment/37412625
downvote count: 0
score: 1
upvote count: 1
tagged with: java
tagged with: sqlite
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24226587

http://stackoverflow.com/comment/37194081
comment on: http://stackoverflow.com/q/24110416
score: 1
type: Comment
type: QuestionComment
has text: please read this : http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors

virtual-machine
tag name: virtual-machine
tags question: http://stackoverflow.com/q/24145544
type: Tag

http://stackoverflow.com/comment/37438651
has text: @Thilo Not a dupe? Looks like a dupe from a quick glance at least...
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24240215

http://stackoverflow.com/comment/37332415
has text: but this method is valid for only select query not for `update,delete,insert` what to do with that.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24184342
type: AnswerComment

http://stackoverflow.com/comment/37461231
type: QuestionComment
comment on: http://stackoverflow.com/q/24251376
score: 0
has text: Secondary question: If I change `throw this;` to `throw new RuntimeException("something");`, then line 6 (or 7) appears in the backtrace. But as written, with `throw this;`, the first line of the backtrace is line 13 (or 14). So what happened to `throw this;`? Did that `throw` never really happen?
type: Comment

http://stackoverflow.com/comment/51191318
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24216945
has text: The only half decent explanation I could find anywhere on how RowFilter works. Not one of the better Swing APIs....

http://stackoverflow.com/comment/37337941
has text: Of course, there are a lot of caveats to this approach as well. a) what if startTime isn't in the list? b) What if there are multiple events at startTime in the list?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24187668

http://stackoverflow.com/comment/37366122
score: 0
comment on: http://stackoverflow.com/q/24176719
has text: @Raghunandan boss i never ever worked with this kind of JSON, so please guide me and show me the code what should i need to use ? as you can see in my JSON i have to show three level lists, for an example: if user do tap on Inner Locations then need to show Delhi and NCR in a second activity's list and when user do click on Delhi then need to show Connaught Place and Lajpat Nagar
type: Comment
type: QuestionComment

http://stackoverflow.com/a/39790979
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24158629
has comment: http://stackoverflow.com/comment/66912951
has comment: http://stackoverflow.com/comment/78509253
has comment: http://stackoverflow.com/comment/132329013
answers question: http://stackoverflow.com/q/24158629
has body: Thanks Jon Skeet for your answer. Here's some code I'm using to convert, very likely it can be optimized. import java.math.BigInteger; import java.util.Arrays; public class UnsignedBigInteger { public static byte[] toUnsignedByteArray(BigInteger value) { byte[] signedValue = value.toByteArray(); if(signedValue[0] != 0x00) { throw new IllegalArgumentException("value must be a psoitive BigInteger"); } return Arrays.copyOfRange(signedValue, 1, signedValue.length); } public static BigInteger fromUnsignedByteArray(byte[] value) { byte[] signedValue = new byte[value.length + 1]; System.arraycopy(value, 0, signedValue, 1, value.length); return new BigInteger(signedValue); } }
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/66912815
downvote count: 2

http://stackoverflow.com/comment/37360625
has text: ESC sequences could steer a terminal's behaviour. Your client is the terminal. @chrisapotek
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24161610

http://stackoverflow.com/a/24175325
accepted answer of: http://stackoverflow.com/q/24175203
has comment: http://stackoverflow.com/comment/37315663
has comment: http://stackoverflow.com/comment/37315543
answers question: http://stackoverflow.com/q/24175203
has comment: http://stackoverflow.com/comment/37315541
type: AcceptedAnswer
type: Answer
has body: You need to parameterize BubbleSort and use an array of a reference type, not a primitive type (since generics only works with reference types): Double[] A = { 3d, 2d, 4d, 6d, 7d, 1d, 2d, 3d }; // notice Double ref. type BubbleSort&lt;Double&gt; bs = new BubbleSort&lt;Double&gt;(A); // notice &lt;Double&gt; type param. Also notice that I've attached [] to the type of the array, which is Double. It is also valid to attach it to the variable name as you have done, but it is more conventional to attach it to the type.
upvote count: 3
score: 3
downvote count: 0

itext
tags question: http://stackoverflow.com/q/24200300
tags question: http://stackoverflow.com/q/24260323
tags question: http://stackoverflow.com/q/24131733
tags question: http://stackoverflow.com/q/24161141
tags question: http://stackoverflow.com/q/24220668
tags question: http://stackoverflow.com/q/24124838
type: Tag
tags question: http://stackoverflow.com/q/24149640
tags question: http://stackoverflow.com/q/24128353
tag name: itext

http://stackoverflow.com/a/24207434
answers question: http://stackoverflow.com/q/24207127
score: 5
has comment: http://stackoverflow.com/comment/37384394
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/24207127
has body: Try binding to the key release event, rather than the key press event, so that the key has been definitely released by the time the dialog opens: KeyStroke btnShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_1, 0, true); ^^^^
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24215063
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/24215166
tagged with: character-encoding
tagged with: string
possible better answer: http://stackoverflow.com/a/47311457
has comment: http://stackoverflow.com/comment/37391279
has answer: http://stackoverflow.com/a/24215166
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/47311457
answer count: 2
tagged with: encoding
has comment: http://stackoverflow.com/comment/37391249
has title: Unicode Replacement with ASCII
has comment: http://stackoverflow.com/comment/37391457
has comment: http://stackoverflow.com/comment/37391583
type: AnsweredQuestion
score: 3
has body: I have created a text file on windows system where I think default encoding style is ANSI and contents of the file looks like this : This is\u2019 a sample text file \u2014and it can .... I saved this file using the default encoding style of windows though there were encoding styles were also available like UTF-8,UTF-16 etc. Now I want to write a simple java function where I will pass some input string and replace all of the unicodes with the corresponding ascii value. e.g :- \u2019 should be replaced with "'" \u2014 should be replaced with "-" and so on. Observation : When i created a string literal like this String s = "This is\u2019 a sample text file \u2014and it can ...."; My code is working fine , but when I am reading it from the file it is not working. I am aware that in Java String uses UTF-16 encoding . Below is the code that I am using to read the input file. FileReader fileReader = new FileReader(new File("C:\\input.txt")); BufferedReader bufferedReader = new BufferedReader(fileReader) String record = bufferedReader.readLine(); I also tried using the InputStream and setting the Charset to UTF-8 , but still the same result. Replacement code : public static String removeUTFCharacters(String data){ for(Entry&lt;String,String&gt; entry : utfChars.entrySet()){ data=data.replaceAll(entry.getKey(), entry.getValue()); } return data; } Map : utfChars.put("\u2019","'"); utfChars.put("\u2018","'"); utfChars.put("\u201c","\""); utfChars.put("\u201d","\""); utfChars.put("\u2013","-"); utfChars.put("\u2014","-"); utfChars.put("\u2212","-"); utfChars.put("\u2022","*"); Can anybody help me in understanding the concept and solution to this problem.
upvote count: 3

http://stackoverflow.com/comment/37492495
score: 0
type: QuestionComment
has text: +1 for using JSTL and EL instead of Scriplet.
type: Comment
comment on: http://stackoverflow.com/q/24261552

http://stackoverflow.com/comment/37481677
has text: With a logging library you do not configure any notification mechanism. You simply write the same logging info to several destinations. Each such destination may have its own rules, what exactly to write out.
comment on: http://stackoverflow.com/q/24262556
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37279230
comment on: http://stackoverflow.com/q/24156121
has text: and your question is ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24147557
tagged with: excel
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24147725
tagged with: java
has answer: http://stackoverflow.com/a/24147858
has comment: http://stackoverflow.com/comment/37263369
downvote count: 1
favorite count: 0
type: Question
has body: i am able to read the excel file in java &amp; i am trying to remove the duplicates in column 1 by keeping the row values as it is and transforming the row values to a unique value in a same line as shown below. My input excel sheet contains like this My output file should look like this by deleting duplicates and tanspose the row values in a single line using a java program. I used multimap to get the key values but how to get the key values seperated by a line with out mentioning the key in myMultimap.get("Key") which are stored in arraylist. ArrayList l=new ArrayList(); l.add(row.getCell(0).toString()); ArrayList l1=new ArrayList(); l1.add(row.getCell(1).toString()); Multimap&lt;String, String&gt; myMultimap = ArrayListMultimap.create(); myMultimap.put( ""+l, ""+l1); Collection&lt;String&gt; l2 = myMultimap.get(l); System.out.print(l2); Thanks in advance
has title: Trying to Removing Duplicates in 1st column with out deleting rows. and the row values should be transposed to a original value. using java
answer count: 2
possible better answer: http://stackoverflow.com/a/24147725
accepted answer: http://stackoverflow.com/a/24147858
upvote count: 1
has comment: http://stackoverflow.com/comment/37263303

http://stackoverflow.com/q/24231631
has comment: http://stackoverflow.com/comment/37422556
tagged with: java
has comment: http://stackoverflow.com/comment/37422217
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37422590
type: Question
has comment: http://stackoverflow.com/comment/37422506
has comment: http://stackoverflow.com/comment/37422107
has comment: http://stackoverflow.com/comment/37423122
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24232412
tagged with: applet
has body: I am trying to make an applet that accesses a database and reads the table information. I don't care about any security risks whatsoever, just want this to work. Whenever I run the applet in the appletviewer, it accesses the database just fine and does what I want it to do. However, when I try to add the .class to an HTML website, I get a class not found exception. I've looked around and nothing seems to be working. I have my .class, my JDBC .jar, and my .html all in a folder on a my desktop. Here is my HTML code: applet My applet code (even though I'm sure it's correct): import java.applet.Applet; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class testing extends Applet{ public void init() { try { Class.forName("com.mysql.jdbc.Driver"); String URL = "https://ca.news.yahoo.com/-a-kick-in-the-teeth---pc-supporters-respond-to-hudak-s-resignation-195516571.html"; Connection con = DriverManager.getConnection("jdbc:mysql://BLOCKED/BLOCKED", "BLOCKED", "BLOCKED"); PreparedStatement statement = con.prepareStatement("INSERT INTO voting (URL, Votes) VALUES ('" + URL + "', 2) "); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } } } New error: java.lang.ExceptionInInitializerError at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at testing.init(testing.java:11) at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "file.encoding" "read") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Sou…
has title: Issues adding external JDBC jar to applet
score: 0
has comment: http://stackoverflow.com/comment/37422763

http://stackoverflow.com/comment/37398776
type: Comment
has text: I have updated the post with the devicelist class..@shazin
type: QuestionComment
comment on: http://stackoverflow.com/q/24218540
score: 0

http://stackoverflow.com/comment/37461976
type: Comment
type: QuestionComment
score: 0
has text: @MadProgrammer there it is. None of what I added is really relevant to the problem I'm having though....
comment on: http://stackoverflow.com/q/24250717

http://stackoverflow.com/a/24147197
has comment: http://stackoverflow.com/comment/37263829
type: Answer
has comment: http://stackoverflow.com/comment/37263966
upvote count: 4
has comment: http://stackoverflow.com/comment/37263630
answers question: http://stackoverflow.com/q/24147177
has body: You can do it just by: text.split(" ");
has comment: http://stackoverflow.com/comment/37264280
has comment: http://stackoverflow.com/comment/37263712
has comment: http://stackoverflow.com/comment/37263886
has comment: http://stackoverflow.com/comment/37262789
downvote count: 1
has comment: http://stackoverflow.com/comment/37265325
has comment: http://stackoverflow.com/comment/37264375
score: 3

http://stackoverflow.com/a/24617357
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24187209
type: Answer
answers question: http://stackoverflow.com/q/24187209
has body: Well I figured out my own problem. I was approaching this the wrong way. My code is correct the only problem was that in my finally block I also have a file write. So when my program would execute all the way through without interruption it would execute the write twice which was the cause of the exception. I fixed this by checking if the finally block was executed and if it was the write in the shutdown hook is skipped. Finally: finally { // Print out statuses printStatus(); for(UserCredential user : creds) { Accel.setRow(user.getMap(), user.getRowIndex()); } try { Accel.writeToFile(); } catch (IOException e) { e.printStackTrace(); } didFinally = true; LOGGER.info(Log("Fin.")); System.exit(0); } Shutdown Hook private static class TerminationThread extends Thread { public void run() { System.out.println("Shutdown Initiated..."); if(!didFinally){ for(UserCredential user : creds) { Accel.setRow(user.getMap(), user.getRowIndex()); } System.out.println("Writing to file..."); try { Accel.writeToFile(); } catch (IOException e) { e.printStackTrace(); } } System.out.println("Terminated!"); } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37357509
comment on: http://stackoverflow.com/a/24196815
type: Comment
has text: your answer is accurate. Personally I don't think compact code means less readability, unless some one really overdo(obfuscate) it. As long as identifier names are intuitive, even a compact code can be easy to understand and maintain. Also, splitting statements with obvious meanings don't help much. java already provides syntactical support to write compact code, implicit for loops, the try-with-resources, empty type parameters with constructors etc
score: 0
type: AnswerComment

http://stackoverflow.com/a/24243609
has comment: http://stackoverflow.com/comment/37445179
downvote count: 0
answers question: http://stackoverflow.com/q/24243356
has comment: http://stackoverflow.com/comment/37445609
upvote count: 1
score: 1
type: Answer
has body: Really you should look at using some existing frameworks rather than re-inventing the wheel. Depending on just what you are doing look for android animation and/or graphics/games libraries and find one with the facilities you need.
has comment: http://stackoverflow.com/comment/37446678

http://stackoverflow.com/a/24178876
score: 2
answers question: http://stackoverflow.com/q/24178813
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37321772
has body: You could simply use String#substring to remove the last " And " from the String, but a more efficent method would to use a StringBuilder and "prefix" " And " to it when the index is greater than 0, for example String deleteQids = "qid&lt;&gt; "; StringBuilder sb = new StringBuilder(128); for (int i = 0; i &lt; 10; i++) { if (i &gt; 0) { sb.append(" And "); } sb.append(deleteQids).append(i); } System.out.println(sb.toString()); Which ends up printing something like... qid&lt;&gt; 0 And qid&lt;&gt; 1 And qid&lt;&gt; 2 And qid&lt;&gt; 3 And qid&lt;&gt; 4 And qid&lt;&gt; 5 And qid&lt;&gt; 6 And qid&lt;&gt; 7 And qid&lt;&gt; 8 And qid&lt;&gt; 9
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24178813
has comment: http://stackoverflow.com/comment/37321813

http://stackoverflow.com/q/24210850
tagged with: java
has answer: http://stackoverflow.com/a/24211057
linked to: http://stackoverflow.com/q/8885192
favorite count: 0
has answer: http://stackoverflow.com/a/24210983
has comment: http://stackoverflow.com/comment/37383065
answer count: 4
has answer: http://stackoverflow.com/a/24211124
downvote count: 0
has body: Suppose I have a class like this: class ASDF { int a; int b; int c; } ASDF[] myArray; And an array of ASDF of some size. Is there any way to write a function that accepts the name of a member of ASDF, and the array of ASDF, and sums all members of the given member name? ie, I would want a function that would work like this: sumMember(myArray, a); would return the sum of all 'a' member variables in ASDF. There are much more than three member variables though, so having a function for each isn't realistic.
has title: Reference member by parameter name?
upvote count: 1
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/37383068
has answer: http://stackoverflow.com/a/24211032
type: Question

http://stackoverflow.com/q/24165623
has answer: http://stackoverflow.com/a/24166900
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24457717
type: Question
has answer: http://stackoverflow.com/a/24230404
has answer: http://stackoverflow.com/a/24504496
has comment: http://stackoverflow.com/comment/37306673
has comment: http://stackoverflow.com/comment/37775327
has title: Read Excel file into R with XLConnect package from URL
has comment: http://stackoverflow.com/comment/37307107
has body: There are lots of good examples out there on how to read Microsoft Excel files into R with the XLConnect package, but I can't find any examples of how to read in an Excel file directly from a URL. The reproducible example below returns a "FileNotFoundException (Java)". But, I know the file exists because I can pull it up directly by pasting the URL into a browser. fname &lt;- "https://www.misoenergy.org/Library/Repository/Market%20Reports/20140610_sr_nd_is.xls" sheet &lt;- c("Sheet1") data &lt;- readWorksheetFromFile(fname, sheet, header=TRUE, startRow=11, startCol=2, endCol=13) Although, the URL is prefixed with "https:" it is a public file that does not require a username or password. I have tried to download the file first using download.file(fname, destfile="test.xls") and got a message that says it was downloaded but when I try to open it in Excel to check to see if it was successful i get a Excel popup box that says "..found unreadable content in 'test.xls'. Below are the specifics of my system: Computer: 64-bit Dell running Operating System: Windows 7 Professional R version: R-3.1.0 Any assistance would be greatly appreciated.
tagged with: excel
tagged with: http://stackoverflow.com/tag/r
has comment: http://stackoverflow.com/comment/37297357
type: AnsweredQuestion
score: 3
upvote count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/24504496
has comment: http://stackoverflow.com/comment/37950884
possible better answer: http://stackoverflow.com/a/24166900
tagged with: java
has comment: http://stackoverflow.com/comment/37768504

http://stackoverflow.com/q/24210717
has answer: http://stackoverflow.com/a/24210760
has title: How create a java project for both intellij and eclipse ide's
tagged with: eclipse
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: intellij-idea
has body: I would like to create a java project but be able to open the project in both eclipse and intellij IDE's, could someone please point me in the right direction on how to setup a project in either ide but able to open in both. Thanks in advance.
score: 3
upvote count: 3
downvote count: 0
tagged with: project
tagged with: java
answer count: 1

http://stackoverflow.com/q/24152038
answer count: 1
has comment: http://stackoverflow.com/comment/37272286
favorite count: 0
accepted answer: http://stackoverflow.com/a/24152154
tagged with: android-support-library
type: Question
upvote count: 9
score: 9
has body: I just switched from ActionBarSherlock to ActionBarCompat and everything was working well until I ran into this small error. I have a base activity that extends ActionBarActivity and has 3 fragments associated with it. In one of the Fragments onAttach method, I try executing this code: @Override public void onAttach(Activity activity) { super.onAttach(activity); final ActionBar actionBar = ((ActionBarActivity)activity).getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setTitle(""); } It works fine until I try to change my screen orientation. Then I get a NullPointerException for this line of code: actionBar.setHomeButtonEnabled(true);. How can I fix this? Edit: Here is the entire error log: 06-10 18:53:31.440: E/AndroidRuntime(18586): FATAL EXCEPTION: main 06-10 18:53:31.440: E/AndroidRuntime(18586): Process: com.packagename.appname, PID: 18586 06-10 18:53:31.440: E/AndroidRuntime(18586): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.packagename.appname/com.packagename.appname.activities.NewActivity}: java.lang.NullPointerException 06-10 18:53:31.440: E/AndroidRuntime(18586): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2328) 06-10 18:53:31.440: E/AndroidRuntime(18586): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2386) 06-10 18:53:31.440: E/AndroidRuntime(18586): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3947) 06-10 18:53:31.440: E/AndroidRuntime(18586): at android.app.ActivityThread.access$1000(ActivityThread.java:169) 06-10 18:53:31.440: E/AndroidRuntime(18586): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) 06-10 18:53:31.440: E/AndroidRuntime(18586): at android.os.Handler.dispatchMessage(Handler.java:102) 06-10 18:53:31.440: E/AndroidRuntime(18586): at android.os.Looper.loop(Looper.java:136) 06-10 18:53:31.440: E/AndroidRu…
has title: NullPointerException when calling getSupportActionBar() from inside of Fragment (ActionBarCompat)
tagged with: android
tagged with: android-actionbar
tagged with: android-actionbar-compat
has answer: http://stackoverflow.com/a/24152154
has comment: http://stackoverflow.com/comment/37272450
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18320713
downvote count: 0
tagged with: java

http://stackoverflow.com/q/24149034
has title: ImageButtons being squished when my drag and drop ImageButton is moved
has answer: http://stackoverflow.com/a/24149092
possible better answer: http://stackoverflow.com/a/24149092
tagged with: mobile
has body: So I have 4 normal imagebuttons that I have set up and then a 5th imagebutton that is a drag and drop. I want the 4 non drag and drop imagebuttons to stay in a particular spot no matter what happens with the imagebutton that is drag and drop. When I move my drag and drop imagebutton, the other imagebuttons get moved and are being squished also. Any idea how I can move this drag and drop imagebutton without affecting the other imagebuttons in any way? Here is my xml: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gllayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/mars" &gt; &lt;TextView android:id="@+id/scores" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;ImageButton android:id="@+id/mainHut" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/mainhut" /&gt; &lt;ImageButton android:id="@+id/polarCapButton1" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/polarcap" /&gt; &lt;ImageButton android:id="@+id/polarCapButton2" android:layout_marginTop="-70dp" android:layout_marginLeft="575dp" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/polarcap" /&gt; &lt;ImageButton android:id="@+id/spaceRockButton1" android:layout_marginTop="100dp" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/spacerock" /&gt; &lt;ImageButton android:id="@+id/spaceRockButton2" android:layout_marginTop="-140dp" android:layout_marginLeft="520dp" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/spacerock" /&gt; &lt;ImageButton android:id="@+id/m…
has comment: http://stackoverflow.com/comment/37267461
downvote count: 0
upvote count: 1
tagged with: imagebutton
linked to: http://stackoverflow.com/q/15975988
type: AnsweredQuestion
tagged with: drag-and-drop
answer count: 3
score: 1
tagged with: android
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/24149751
type: Question
has answer: http://stackoverflow.com/a/24149180
accepted answer: http://stackoverflow.com/a/24149751

http://stackoverflow.com/comment/37318961
has text: *"it doesn't work"* - What does that mean? Doesn't compile, doesn't show up the screen, doesn't appear the you wanted? If you've the scroll pane and frame, then it won't show on the screen.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24177138

http://stackoverflow.com/a/24240630
has body: The removeNulls method is a very "simple" example, and it's hard to imagine what further kinds of "modifiers" you may be working with. From your description, it sounds that your actual intention might nicely be supported by the new Streams API in Java 8. For example, removing the null elements from a Stream could easily be accomplished with // Filter out all null elements collection.stream().filter((e) -> e != null).... // Further operations The nice thing here is that your actual problem is handled internally: The characteristics of the stream are (as far as possible) preserved during the operations. For example, a stream that was sorted before will remain sorted. An alternative way of handling such a situation for pre-Java-8 versions is to specify the output collection (or at least, give the option to do so). For the example: You could write the method as public <T> Collection<T> removeNulls(Collection<? extends T> input, Collection<T> output) { if (output == null) { // Create some default collection or // report an error... } for (T t : input) { if (t != null) { output.add(t); } } return output; } // Convenience method public <T> Collection<T> removeNulls(Collection<? extends T> input) { return removeNulls(input, new ArrayList<T>()); } To be called as Set<String> mySet = new SortedSet<>(); mySet.add(10); mySet.add(9); // I know that my collection is now sorted Collection<String> myFilteredSet = removeNulls(mySet, new SortedSet<>()); (Note: One could even further exploit the power of type inference and generics here - this ist just to show the basic idea) In any case, I consider it as very important to clearly specify any assumptions as pre- and postconditions in the JavaDoc, e.g. /** * Creates a new collection with the same contents as the given collection, * but without any null entries * * The order of output elements will be the same as the input elements * or alternatively: * No assumptions may be made about the order of the output collection * * @return The …
upvote count: 2
answers question: http://stackoverflow.com/q/24240085
downvote count: 0
score: 2
type: Answer

http://stackoverflow.com/comment/37188493
has text: No, I just want to understand the exact name resolution rules here.
score: 0
comment on: http://stackoverflow.com/q/24107657
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37451135
type: QuestionComment
comment on: http://stackoverflow.com/q/24245393
type: Comment
score: 0
has text: The question is: what happens with that state after the instance is returned to the pool? If you do this you must also take control of cleaning it up. But better is to just not do it and keep all logic within the EJB method invocation where it belongs and rely on dependency injection for the rest.

http://stackoverflow.com/a/24148746
answers question: http://stackoverflow.com/q/24148667
has body: The link to the ADT of the previous answer contains eclipse already. I am using the ADT as well, but there is also an early access tool, called Android Studio, maybe this is more to your taste? http://developer.android.com/sdk/installing/studio.html
score: 0
has comment: http://stackoverflow.com/comment/37265658
type: Answer
has comment: http://stackoverflow.com/comment/37266118

http://stackoverflow.com/comment/37235283
has text: @user3580294 *Providing full and perfectly accurate* reachability analysis across the entire program would be equivalent to solving the halting problem. However, there are plenty of ways to *look* and get incomplete but useful results back, using a more advanced heuristic. (In general, whenever *anyone* says a given compiler task is equivalent to solving the halting problem, they're wrong for this reason. "Halting problem" should be one of your insta-"no" trigger phrases.)
score: 4
comment on: http://stackoverflow.com/q/24130399
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37555854
type: Comment
has text: This is quite a surprise- should it be reported to AS 7 team?
comment on: http://stackoverflow.com/a/24301361
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37190628
has text: So what do you think the error means?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24108712

http://stackoverflow.com/comment/61267678
type: AnswerComment
has text: this is not the case. i gave -Xmx4g but still my virtual memory usage went to 40G. i am using jdk8
comment on: http://stackoverflow.com/a/24148770
type: Comment
score: 0

http://stackoverflow.com/q/24126741
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24126855
type: Question
has title: Error in JColorChooser
type: UnansweredQuestion
answer count: 1
has body: I have written a simple codeby using JColorChooser to allow the user to choose Colours from the panel. But i am getting one error all-through. The GUI code has one button which performs an action of opening up of Color Panel when the user clicks it. Please help me correct the error! import java.awt.event.*; import java.awt.*; import javax.swing.*; class Colour1 implements ActionListener { JFrame f; JPanel p; JButton b; Colour1() { f=new JFrame(); p=new JPanel(); b=new JButton("choose"); } void configure() { f.add(p); f.setSize(200,200); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); p.add(b); b.addActionListener(this); f.setVisible(true); } public void actionPerformed(ActionEvent ae) {Color initialcolor=Color.RED; Color color=JColorChooser.showDialog(this,"Select a color",initialcolor); //ERROR found at this statement. p.setBackground(color); } public static void main(String args[]) { Colour1 c=new Colour1(); c.configure(); } }

http://stackoverflow.com/a/24148610
type: Answer
has body: This is easy enough to try yourself. Try it and note the result. public Test() { Test t1 = new Test(); } public static void main(String[] args) { Test t = new Test(); }
answers question: http://stackoverflow.com/q/24148519
score: 0

http://stackoverflow.com/comment/37369372
has text: Because the person who wrote that code didn't know that you can have a finally block without catch block. There should not be a catch block here: it's useless, and even harmful because it loses the actual line where the original exception was thrown. Closing all the streams in the finally block is also useless, since closing the top-evel one will close the other ones.
score: 10
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24203910

http://stackoverflow.com/q/24241998
possible better answer: http://stackoverflow.com/a/24242085
answer count: 3
has answer: http://stackoverflow.com/a/24242085
downvote count: 0
accepted answer: http://stackoverflow.com/a/24242089
upvote count: 1
has title: Stop current process of loop when null value and continue with next value
has body: Now when as[i].getUser() = null, the program stops with NullPointerException. But what I want is to stop the current process of the loop only and continue with next value, the best will be from the method convertUser() since it's used in many places. I know that catching the NullPointerException is not recommended. public Project[] convertProjects(){ ProjectR[] as = getProjects(); Project[] bs = new Project[a.length]; for(int i = 0; i &lt; as.length; i++){ Project b = new Project(); b.setName(as[i].getNameR()); b.setUser(convertUser(as[i].getUserR())); b.setCenter(convertCenter(as[i].getCenterR())); bs[i]=b; } return bs; } private Center convertCenter(CenterR centerR) { Center centerL = new Center(); centerL.setManager(convertUser(centerR.getUser())); centerL.setName(centerR.getName()); centerL.setResID(centerR.getID()); return centerL; } private User convertUser(UserR uR) { User userL = new PFPWSUser(); userL.setID(uR.getID()); userL.setFirstName(uR.getFirstName()); userL.setLastName(uR.getLastName()); userL.setEmail(uR.getEmail()); return userL; }
favorite count: 0
has answer: http://stackoverflow.com/a/24242089
type: Question
type: AnsweredQuestion
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24242093
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37441995

http://stackoverflow.com/q/24245066
answer count: 1
downvote count: 0
upvote count: 1
tagged with: libraries
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24245997
has answer: http://stackoverflow.com/a/24245997
tagged with: sublimetext2
has title: I can't find the javaC.sublime-build
tagged with: compilation
type: AnsweredQuestion
has body: I just started programming with SublimeText 2 and I was trying to add libraries so that my code would work. But the problem is, everywhere I look on the internet, everyone says "Open the file JavaC.sublime-build and replace all the code in the file with the code below". The thing is, I'm unable to find it. If I listen to what I read, it is supposed to be in "Java/jdkX.XX.XX/bin/" but I can't find it. Is it because I never managed to compile Java Code before ? Do I have to create it ? Or is it somewhere else ?
score: 1
tagged with: java

http://stackoverflow.com/comment/37233193
has text: double transform = (dy-y)/(dx-x);
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24131263
type: QuestionComment

http://stackoverflow.com/comment/37384052
score: 0
comment on: http://stackoverflow.com/q/24155978
type: QuestionComment
has text: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringEscapeUtils at com.microsoft.windowsazure.services.table.client.AtomPubParser.parseEntity(AtomPubParser.java:101) -- please help me with this... I don't know what this error means, and how to resolve this. any suggestions are highly appreciable.
type: Comment

http://stackoverflow.com/a/24240324
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24240179
score: 0
has body: You need to set the default Java used by your system. You can achieve this by changing the JAVA_HOME environment variable. It should point to the desired Java installation. If you don't know how to change the system variables just google it, there are a lot of tutorials on how to do it. For Unix systems make sure you search for a persistent change.
accepted answer of: http://stackoverflow.com/q/24240179

http://stackoverflow.com/q/24115560
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24115620
has answer: http://stackoverflow.com/a/24115620
has body: I am using an arraylist to store list of timestamps of past 5 weeks. i.e., if today is 2014-06-09, I want to store 2014-06-02 2014-05-26 2014-05-19 2014-05-12 2014-05-05 Here is my code. public class Test { public static void main(String ap[]) throws InterruptedException{ List&lt;Timestamp&gt; ts = new ArrayList&lt;Timestamp&gt;(); Timestamp t = new Timestamp(new java.util.Date().getTime()); Timestamp temp = null; for(int i=0;i&lt;5;i++){ t.setTime(t.getTime()-(7*24 * (long)60* (long)60) * (long)1000); temp = t; System.out.println(t); ts.add(temp); temp = null; } } } But the problem is always I am getting the list of overrided values i.e., list contains all the elements as last timestampI i.e 2014-05-05) Can anybody reply to this question?
has title: List of timestamps overrides the previous timestamp
tagged with: timestamp
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/24165480
has comment: http://stackoverflow.com/comment/37296975
answers question: http://stackoverflow.com/q/24165394
score: 0
has comment: http://stackoverflow.com/comment/37297526
type: Answer
has comment: http://stackoverflow.com/comment/37296605
has comment: http://stackoverflow.com/comment/37297100
has body: You just have to set a longClickListener on the desired view : ImageView iv = (ImageView) findViewById(R.id.ImageView); iv.setOnLongClickListener(vlong); private View.OnLongClickListener vLong = new View.OnLongClickListener() { public boolean onLongClick(View view) { // do any thing return true; } };

http://stackoverflow.com/a/24136376
type: Answer
has comment: http://stackoverflow.com/comment/37246180
answers question: http://stackoverflow.com/q/24135787
has comment: http://stackoverflow.com/comment/37245314
score: 0
has body: Normally if you connect into a remote machine by SSH as I expect you do you relate that connection with the user that open the socket. so if you connect by ssh as 'Foo' you should do it as: 'ssh -i ./ssh_key foo@selenium_ip' so for that machine foo is connected.
has comment: http://stackoverflow.com/comment/37244703
has comment: http://stackoverflow.com/comment/37245900

http://stackoverflow.com/comment/37412049
has text: Additionally, if you're doing a *lot* of removals, ArrayList might not be the data structure you are looking for.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24226205
score: 0

http://stackoverflow.com/a/24215159
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37392034
has comment: http://stackoverflow.com/comment/37391888
has comment: http://stackoverflow.com/comment/37391717
answers question: http://stackoverflow.com/q/24215065
upvote count: 0
has body: 1) Maintain a master Data list. Intially the table model data will reflect the Master data. 2) When the user "press show only over due vidoes", iterate the master data and filter only the required elements and clear the table model and add only the filtered data to the table model and fire table model changed.
score: -2
has comment: http://stackoverflow.com/comment/37392401

http://stackoverflow.com/comment/37412653
score: 0
has text: Roman, Clockwork-mus, Elliot - I still don't have the solution yet. I thought in this question I clearly mentioned the requirement along with my current code. Let me clear that this is not a deliberate action from me to make a duplicate entry.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24134080

http://stackoverflow.com/q/24155850
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: android
tagged with: java
tagged with: textview
favorite count: 0
score: -1
has title: Android setting TextView text without declaring variable
possible better answer: http://stackoverflow.com/a/24155870
has body: I normally set a TextView's text this way: TextView tv = (TextView) findViewById(R.id.lbC1Voice); tv.setText("ss"); Isn't there a way to set it without declaring tv? e.g. (TextView) findViewById(R.id.lbC1Voice).setText("ss"); Thanks
accepted answer: http://stackoverflow.com/a/24155887
upvote count: 0
has answer: http://stackoverflow.com/a/24155870
answer count: 3
has answer: http://stackoverflow.com/a/24155861
has answer: http://stackoverflow.com/a/24155887

http://stackoverflow.com/q/24136339
answer count: 1
has answer: http://stackoverflow.com/a/24139454
favorite count: 0
type: Question
tagged with: nashorn
has title: Get extended Java class from Nashorn
has body: Is there a way to get and use an extended Java class from JavaScript (Nashorn)? What I am trying to do is to extend a Java class in Nashorn and then pass it back to Java. For example, we define a class which extends another class in JS: var SomeClass= Java.type("com.test.SomeClass"); var MySomeClass = Java.extend(SomeClass, { aMethod1: function() { print("m1"); }, aMethod2: function() { print("m2"); }, }); Then I've tried to get this extended object in Java like so: Object mySomeClass = scriptEngine.get("MySomeClass"); However, I am unable to make any method calls on this object in Java. It always throws an exception when I am trying to cast it to a base class - com.test.SomeClass. Is it possible to use an extended class created in Nashorn (JS) in Java?
tagged with: javascript
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/24139454
upvote count: 2
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/a/24238312
has body: Source Memento Pattern Motivation It is sometimes necessary to capture the internal state of an object at some point and have the ability to restore the object to that state later in time. Such a case is useful in case of error or failure. Consider the case of a calculator object with an undo operation such a calculator could simply maintain a list of all previous operation that it has performed and thus would be able to restore a previous calculation it has performed. This would cause the calculator object to become larger, more complex, and heavyweight, as the calculator object would have to provide additional undo functionality and should maintain a list of all previous operations. This functionality can be moved out of the calculator class, so that an external (let's call it undo manager class) can collect the internal state of the calculator and save it. However providing the explicit access to every state variable of the calculator to the restore manager would be impractical and would violate the encapsulation principle.
answers question: http://stackoverflow.com/q/24238251
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37674305
score: 1
downvote count: 0

http://stackoverflow.com/a/24186515
answers question: http://stackoverflow.com/q/24186403
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24186403
has body: Create a form for each button, with hidden input that contain the id : Button 1 : Button 2 :
type: Answer

http://stackoverflow.com/comment/37345552
score: 1
has text: Character.isLetter() returns true for *much more* than just A-z. Its probably not what the OP needs (I suspect it to be a homework assignment and that the task is to solve both the character ok/bad decision as well as the string loop logic).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24191083

http://stackoverflow.com/comment/37304025
type: AnswerComment
comment on: http://stackoverflow.com/a/24166696
score: 0
has text: Hmm. So the start new activity/inflate fragment part isn't what I needed, but checking to see if the URL was the URL of the _logged in_ page was helpful. Thanks!
type: Comment

http://stackoverflow.com/comment/37384110
type: AnswerComment
comment on: http://stackoverflow.com/a/24209252
score: 0
type: Comment
has text: If you can, use a `PreparedStatement` and directly execute your `SELECT` statement. If you must use a stored procedure, then execute the `SELECT` statement directly in your procedure and retrieve the `ResultSet` from the `CallableStatement`.

http://stackoverflow.com/comment/37469612
has text: I change the size of component with setSize but it still doesn't changed can you give me an simple example
type: Comment
comment on: http://stackoverflow.com/a/24227483
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37313330
has text: To nitpick this is not correct. If `object` was final we'd be in the clear. Whether making `val` final is enough depends on the constructor of the class that uses it - if we publish the instance before the constructor is finished we *do* have a problem. Obviously bad practice, but it is possible.
comment on: http://stackoverflow.com/a/24116492
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24168716
downvote count: 0
has comment: http://stackoverflow.com/comment/37302911
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24168578
has comment: http://stackoverflow.com/comment/37302933
accepted answer of: http://stackoverflow.com/q/24168578
has body: To support the covariant return type, a bridge method must be created to be able to call the method in code that expects the declared return type. In short, this bridge method is the method that would be called in the following scenario, where T is erased to Object: public &lt;T&gt; T doSomething(Referenceable&lt;T&gt; obj) { return obj.getReference(); } Use m.isBridge() to tell which is the bridge method.
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/a/24117134
has comment: http://stackoverflow.com/comment/37206175
has comment: http://stackoverflow.com/comment/37206149
accepted answer of: http://stackoverflow.com/q/24116637
has body: Create interface Action and several its implementations. In your case Init and Submit. Register these actions in init method of servlet, so that they are stored in Map&lt;String, Action&gt; actions. Now your processRequest() will look like: String actionName = (String)request.getParameter("action"); Action action = actions.get(actionName); action.perform(); However it seems that you try to re-invent the wheel. Use one of available frameworks. For example Struts does approximately what I explained here. Spring is much stronger and has the same concept.
type: Answer
answers question: http://stackoverflow.com/q/24116637
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37308545
type: Comment
comment on: http://stackoverflow.com/a/24169975
score: 0
type: AnswerComment
has text: This helps, but it does not space out the times in which the TextViews appear and disappear. Example(TextView1 appears, then TextView2 appears 0.1 seconds later, then TextView3 appears 0.1 seconds after TextView 2,etc. Thus, they came in the right order, but it's so fast that it seems they appear and disappear at the same time.)

http://stackoverflow.com/q/24233857
tagged with: arrays
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24233881
has body: I played around a little bit with Java's arrays and I realized that a 1GB big byte array needs 4GBs RAM. That's my code (make sure you have at least 4GB unused RAM or your PC might freeze): public static void main(String[] args) throws InterruptedException { Byte[] array = new Byte[1073741823]; // Equals 1GB System.out.println("Done"); Thread.sleep(10000); System.out.println("Completely done"); } That's my machine: MacBook Pro (64bit; running OS X 10.9 on it) Java: Java SE 6 (1.6.0_65-b14-462) and Java SE 7 (1.7.0_45). RAM: 16 Used RAM: about 10GB When I start this application, it uses 4GB instead of 1. I used these arguments to start that program: -Xmx8g -d64.
favorite count: 0
has answer: http://stackoverflow.com/a/24233881
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37426490
tagged with: java
tagged with: ram
linked to: http://stackoverflow.com/q/5199359
has comment: http://stackoverflow.com/comment/37426488
type: Question
has title: Java - Byte array uses 4 times as much ram as set
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37426457

http://stackoverflow.com/q/24156468
has answer: http://stackoverflow.com/a/24156624
type: Question
has comment: http://stackoverflow.com/comment/37279975
has comment: http://stackoverflow.com/comment/37279777
has answer: http://stackoverflow.com/a/24157016
has comment: http://stackoverflow.com/comment/37279751
answer count: 3
score: -2
has body: Just for playing I tried to write a program so I can make a acute triangle with using a for loop, so my out put will like this: 0 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 but when I want to go more than 10 my acute triangle gets messed up like this: 0 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 12 12 12 12 12 12 12 12 12 12 12 12 12 My code is as follows public class Triangel { /** * @param args the command line arguments */ public static void main(String[] args) { for (int i = 20; i &gt; 0; i--) { for (int j = i - 1; j &gt; 0; j--) { System.out.print(" "); } for (int k = 20; k &gt; i - 1; k--) { if (i =&lt; 9) { System.out.print(" " + (20 - i)); } else if (i &gt; 9) { System.out.print( " "+(20 - i)); } } System.out.println(); } } } Any idea how I can make it perfect acute triangle when I wanna print after 9? Note: I thought that the if statement would help, but it seems it does not.
tagged with: java
has answer: http://stackoverflow.com/a/24157051
has comment: http://stackoverflow.com/comment/37280107
possible better answer: http://stackoverflow.com/a/24156624
accepted answer: http://stackoverflow.com/a/24157016
type: AnsweredQuestion
tagged with: for-loop
has title: How Can I Make Perfect Acute Triangle with for loop?
downvote count: 3
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/37188504
type: QuestionComment
has text: If your comment is your actual question, that changes a lot.
comment on: http://stackoverflow.com/q/24107657
score: 0
type: Comment

http://stackoverflow.com/comment/37432105
comment on: http://stackoverflow.com/q/24236406
type: Comment
score: 0
has text: Actually I created Login Screen, Patientdetail screen, Shimmer Graph which is showing 4 options 1. i need to connect a shimmer 2. Select Sensor type 3. Start streaming First 2 options work but when i click on "Start Streaming" it returns of patient activity screen.....
type: QuestionComment

http://stackoverflow.com/comment/37334666
comment on: http://stackoverflow.com/q/24184960
has text: Why on earth would you want to do that?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24228046
has comment: http://stackoverflow.com/comment/37431021
has body: From the JavaDoc for Console: Provides a formatted prompt, then reads a single line of text from the console. How does this work? Well, it uses a format string with parameters. The parameters are a varargs array so you can pass none or many without any special syntax. For example console.readLine("No arguments"); Will just output "No arguments" onto the prompt. final String a = "A"; console.readLine("With string, %s", a); Will output "With string, A" onto the prompt. final String a = "A"; final int b = 10; console.readLine("With string %s and a formatted number %.2f", a, b); Will output "With string A and a formatted number 10.00" onto the prompt.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37415409
answers question: http://stackoverflow.com/q/24227971
score: 3
has comment: http://stackoverflow.com/comment/37431093
has comment: http://stackoverflow.com/comment/37416046
upvote count: 3
has comment: http://stackoverflow.com/comment/37417508
has comment: http://stackoverflow.com/comment/37416458
has comment: http://stackoverflow.com/comment/37426596
has comment: http://stackoverflow.com/comment/37417594

http://stackoverflow.com/comment/37451347
type: AnswerComment
comment on: http://stackoverflow.com/a/24246639
has text: It used about 400MB ram. And there is still about 1GB and half ram left... Nop it is just a small project.
type: Comment
score: 0

http://stackoverflow.com/a/24118739
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37208973
answers question: http://stackoverflow.com/q/24118719
has body: You are checking for the wrong condition, you need to check for hasNextline() instead of hasNext(). So the loop will be while(in.hasNextLine()){ String line = in.nextLine(); System.out.println(line); }

http://stackoverflow.com/q/24226554
tagged with: java
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/55354479
tagged with: hadoop
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27644920
tagged with: encryption
has body: Actually i have written an Hive UDF in Java for Encryption and Decryption. But it has some minor Bug in it. I couldn't find it, someone can Please rectify and suggest me some changes.. Problem: When i tried to execute this code using Hive it is showing some 'Null' columns for each row. Encrypted Ex: 1 fdfsvansjw= NULL NULL 2 adf4vandjw= NULL NULL Actually it has to be displayed without NULL Values.When i tried to decrypt the above data it is adding Newline Character '/n' in place of Null. Decrypted Ex: 1 AAA /n /n 2 BBB /n /n Code for Encryption : package Encrypt; import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.io.Text; import java.security.*; import org.apache.commons.codec.binary.Base64; import java.io.*; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import javax.swing.JOptionPane; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public final class En1 extends UDF { public Text evaluate(final Text s) throws Exception { if (s == null) { return null; } byte[] sharedvector = { 0x01, 0x02, 0x03, 0x05, 0x07, 0x0B, 0x0D, 0x11 }; String EncText = ""; byte[] keyArray = new byte[24]; byte[] temporaryKey; String key = "developersnotedotcom"; byte[] toEncryptArray = null; //try // { toEncryptArray = s.toString().getBytes("UTF-8"); MessageDigest m = MessageDigest.getInstance("MD5"); temporaryKey = m.digest(key.getBytes("UTF-8")); if(temporaryKey.length &lt; 24) // DESede require 24 byte length key { int index = 0; for(int i=temporaryKey.length;i&lt; 24;i++) { keyArray[i] = temporaryKey[index]; } } Cipher c = Cipher.getInstance("DESede/CBC/PKCS5Padding"); c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keyArray, "DESede"), new IvParamet…
has title: Hive Udf (Encryption and Decryption) in Java
tagged with: hive
has answer: http://stackoverflow.com/a/24244935
score: 3
answer count: 3
upvote count: 3

http://stackoverflow.com/comment/37324677
has text: Fixed it! I used just liked BalusC said.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24178582

http://stackoverflow.com/comment/37337404
has text: Oh wow, that's amazingly stupid. I was too busy looking at people causing array index out of bounds exceptions to notice that!
type: Comment
comment on: http://stackoverflow.com/a/24186545
score: 0
type: AnswerComment

http://stackoverflow.com/q/24240373
score: 1
tagged with: java
answer count: 1
tagged with: log4j
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
has title: slf4j and log4j log messages visible in the console but not appending into logfile
upvote count: 1
tagged with: logging
tagged with: slf4j
has body: I have a problem with slf4j and log4j.. I can see the log messages in the console but those messages are not appending to the file i am using the following jars. slf4j-log4j12-1.7.5.jar slf4j-api-1.7.1.jar log4j-1.2.17.jar My log4j.properties file is below. # Root logger option log4j.rootLogger=INFO, file # Direct log messages to a log file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=C:\\myLogFile.log log4j.appender.file.MaxFileSize=1MB log4j.appender.file.MaxBackupIndex=1 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n and I am getting the following warning in console when i am running my java class SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/1018835/.m2/repository/ch/qos/logback/logback-classic/1.0.10/logback-classic-1.0.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/Users/1018835/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
has answer: http://stackoverflow.com/a/24240426

http://stackoverflow.com/comment/37265036
score: 0
has text: what are the things that should be in the NewAct onCreate?? I'm new to programming and I have no experience with such things
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24126523

http://stackoverflow.com/comment/37340713
score: 0
comment on: http://stackoverflow.com/q/24189082
type: Comment
type: QuestionComment
has text: Store the values in an ArrayList or HashMap in the parent class instead of as raw variables?

http://stackoverflow.com/comment/37235818
score: 0
comment on: http://stackoverflow.com/a/24132720
has text: InboxFragment is setup to extend ListFragment
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37318284
comment on: http://stackoverflow.com/a/24176862
score: 0
type: Comment
type: AnswerComment
has text: but i am not using any index in my JSON

http://stackoverflow.com/a/24272855
type: Answer
has comment: http://stackoverflow.com/comment/81040678
score: 12
answers question: http://stackoverflow.com/q/24235296
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24235296
upvote count: 12
has body: After quite a bit of scratching my head, I am settling with the following solution. First, put logback.xml outside classpath so that logback will not automatically load anything. Second, add the settings from the environment to system properties so that logback can look them up when parsing logback.xml. Third, programmatically configure logback in the application code. (The official logback documentation has one nice example of that. ) Done.

http://stackoverflow.com/q/24234332
upvote count: 1
has comment: http://stackoverflow.com/comment/37429311
favorite count: 0
has body: I recently refactored one of my classes to accept an iterable of generic objects in its constructor and am now unable to get JMockit to instantiate the @Tested field of the test class. Here's a stripped-down test case which exhibits the same problem: import java.util.Collections; import mockit.Injectable; import mockit.Tested; import org.junit.Test; public class FooTest { public static interface Generic&lt;T&gt; {} public static class Foo&lt;T&gt; implements Generic&lt;T&gt; { public Foo(Iterable&lt;Generic&lt;T&gt;&gt; iterable) {} } @Tested Foo&lt;Object&gt; tested; @Injectable Iterable&lt;Generic&lt;Object&gt;&gt; injectable = Collections.emptyList(); @Test public void testFoo() { // java.lang.IllegalArgumentException: No constructor in class FooTest$Foo that can be satisfied by available injectables } } I realize I could trivially work around this by created tested in a @Before method, but I want to understand why this is failing, first. :-) I'm using Java 1.7.0_51, JMockit 1.8, and JUnit 4.11.
type: Question
accepted answer: http://stackoverflow.com/a/24250505
tagged with: junit4
has answer: http://stackoverflow.com/a/24250505
tagged with: jmockit
has comment: http://stackoverflow.com/comment/37428041
type: AnsweredQuestion
has title: Why won't JMockit use this (apparently) valid Injectable?
score: 1
tagged with: java
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/37311318
score: 0
comment on: http://stackoverflow.com/a/24159208
type: Comment
type: AnswerComment
has text: What you could do is take the contents of the main method from the answer I linked to and then run it using Groovy via Ant. http://groovy.codehaus.org/The+groovy+Ant+Task

http://stackoverflow.com/comment/37326498
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24181485
has text: Thanks for the answer. I think, I will g with this. This is also a form of for loop, but this reduces the no. of lines.
type: Comment

http://stackoverflow.com/comment/37434797
score: 0
has text: i have many like ByteCode what should i do about them?
type: Comment
comment on: http://stackoverflow.com/a/24237720
type: AnswerComment

http://stackoverflow.com/a/24159370
score: 0
has body: First get all the existing data set to a list. now iterate your new list(which need to append) using a for loop and get a inner loop and check condition and add/skip. Pseudo code: List my_existing_list; List my_new_list; foreach(my_new_list){ foreach(my_existing_list){ if(equal to an existing item){ //skip }else{ //append to file } } }
answers question: http://stackoverflow.com/q/24159191
type: Answer

http://stackoverflow.com/comment/37481256
score: 2
comment on: http://stackoverflow.com/q/24262495
type: QuestionComment
has text: Another possible result would be `[a--, c]`. Is it always one character values separated by hyphens? We need some rule to avoid ambiguous results.
type: Comment

http://stackoverflow.com/comment/37279408
has text: Does interface have a usage here?
type: AnswerComment
comment on: http://stackoverflow.com/a/24156154
score: 0
type: Comment

http://stackoverflow.com/comment/37388049
type: AnswerComment
score: 0
has text: Try searching google for "some_language + how to write an api" and replace some_language with what language you want to use.
type: Comment
comment on: http://stackoverflow.com/a/24212321

http://stackoverflow.com/a/24189584
answers question: http://stackoverflow.com/q/24189485
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24189485
score: 3
has comment: http://stackoverflow.com/comment/37344591
has body: Use a SortedSet instead of a List to avoid duplicates and have an ordering. Use set.addAll (otherSet); to add another Set. All in all: TreeSet&lt;Integer&gt; set = new TreeSet&lt;&gt;(); set.addAll (Arrays.asList (1,2,3,4)); set.addAll (Arrays.asList (1,2,5)); Well, that's the elegant way. Since you have to use wrapper classes for int here, it is maybe not as efficient as you want.
upvote count: 3
has comment: http://stackoverflow.com/comment/37341717
downvote count: 0
has comment: http://stackoverflow.com/comment/37343250
has comment: http://stackoverflow.com/comment/37341822

http://stackoverflow.com/q/24138890
has title: microemulator porting for nokia x
score: 0
tagged with: java
answer count: 1
upvote count: 1
has body: I recently porting my games from J2me asha platform to Nokia X using microemulator project. it works fine . Now I want to know how to add I.A.P (in app purchasing)in my apk file for using in Nokia X . I could add the project into the Eclipse IDE and I already build the IAP for nokia X in Eclipse android project separately but when I try to run the IAP project in emulator it only shows screen with a button and text. and there is no activity by the button clicked. how to monetize it with any project?!! . Is that possible to use the xml file to add the Nokia IAP in my microemulator project or need more Java coding ? Are there any links or samples ,,,!!!appreciate your help.
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24139604
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37247297
tagged with: android
tagged with: in-app-purchase
has comment: http://stackoverflow.com/comment/37247909
tagged with: eclipse
tagged with: nokiax

http://stackoverflow.com/q/24124282
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37226337
favorite count: 0
type: Question
score: 3
tagged with: cassandra
type: UnansweredQuestion
has title: Check if a certain file exists in CFS from Java code
has comment: http://stackoverflow.com/comment/37220811
has answer: http://stackoverflow.com/a/24126584
has body: After some online example I tried the following: Configuration config = new Configuration(); config.set("fs.default.name","cfs://x.x.x.x:9000/"); // actual ip in here config.set("fs.cfs.impl","org.apache.cassandra.hadoop.fs.CassandraFileSystem"); FileSystem fs = FileSystem.get(config); System.out.println(fs.exists(new Path("cfs:///path/to/file"))); But I can't find the Jar containing CassandraFileSystem. I wonder if it's an old version or something. I do have the CQL driver in my classpath, i.e., the Gradle dependency com.datastax.cassandra:cassandra-driver-core:2.0.1, but the class CassandraFileSystem does not ship with this artifact. What's the idiom to check for file existence in CFS? Using Datastax Enterprise 4.0.1. EDIT: just to be clear, the problem here seems to be finding the class CassandraFileSystem. I can't find it anywhere in the DSE jar although its usage is documented. Was it deprecated? Is it in some other jar besides com.datastax.cassandra:cassandra-driver-core:2.0.1?
has comment: http://stackoverflow.com/comment/37224059
has answer: http://stackoverflow.com/a/24398927
tagged with: datastax-enterprise
has comment: http://stackoverflow.com/comment/37222295
upvote count: 3
answer count: 2

http://stackoverflow.com/q/24192046
has title: Primefaces datatable cell editing doesn't update
tagged with: jsf
tagged with: primefaces
has answer: http://stackoverflow.com/a/26743230
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37502937
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
tagged with: tablecelleditor
has body: I have a primefaces datatable with cell editing which is toggled on a boolean variable in the view. I have three issues: In edit mode, I change a value and I click the save button on the page it doesn't keep the new value, If I click anywhere else first on the page then click save it will keep the value. I need it to keep the value if you click save first. If I edit a cell which is an input text and I click out the field now is a output text until I click in there again. I want the field to look like a input text while in edit mode. When the save button is clicked the backing method sets the editable boolean to false, and the rest of the page obeys, and the dataTable looks like it obeyed but if you click a cell it will let you edit it. Here is the code: &lt;p:dataTable value="#{view.LineItems}" var="lineItem" rowKey="#{lineItem.lineItemId}" resizableColumns="false" editable="#{view.editable}" editMode="cell" editingRow="#{view.editable}" id="requestLineItemsTable"&gt; &lt;p:ajax event="cellEdit" listener="#{view.cellEdited}" immediate="true" update="@this" /&gt; &lt;p:column styleClass="centerColumnData" headerText="Item Name" style="width: 140px;"&gt; &lt;p:cellEditor&gt; &lt;f:facet name="output"&gt; &lt;h:outputText value="#{lineItem.title}"/&gt; &lt;/f:facet&gt; &lt;f:facet name="input"&gt; &lt;h:inputText value="#{lineItem.title}"/&gt; &lt;/f:facet&gt; &lt;/p:cellEditor&gt; &lt;/p:column&gt; ... and this is the back end (not doing anything with this yet) public void cellEdited(CellEditEvent event) { Object oldValue = event.getOldValue(); } and here is the save and edit buttons on the same .xhtml page as datatable &lt;p:commandLink process="@this" action="#{view.changeModeToEdit}" update="@form" rendered="#{!view.editMode"&gt; &lt;h:graphicImage library="images" name="edit20.png" title="#{__Common.edit}" style="height: 15px; width: 15px;"/&gt; &lt;/p:commandLink&gt; &lt;components:linkWithSpinner linkStyle="margin-right: 20px;" loadingImageStyle="margin-right: 2…
tagged with: datatable
score: 2

http://stackoverflow.com/q/24139798
type: UnansweredQuestion
tagged with: glassfish
score: 2
has title: Attach javaagent to an application on Glassfish v3.x
downvote count: 0
tagged with: java
has body: I want to attach javaagent to my web application written in java on Glassfish server. I have read here and did it via this piece of code: -javaagent:C:/Users/myname/desktop/myagent.jar but the problem is that the agent is set to glassfish server and not to the application. Is there any way to set javaagent to one application on glassfish server?
tagged with: agent
favorite count: 0
type: Question
upvote count: 2
answer count: 0

http://stackoverflow.com/comment/37524135
comment on: http://stackoverflow.com/q/24244824
score: 0
type: QuestionComment
has text: Thanks but the question is just about understanding how the add of the temporary variable can fix the problem, something i absolutely can't understand in the actual state of my knowledge
type: Comment

http://stackoverflow.com/a/24158695
has comment: http://stackoverflow.com/comment/37390926
has comment: http://stackoverflow.com/comment/37389725
has comment: http://stackoverflow.com/comment/37304134
has comment: http://stackoverflow.com/comment/37390746
has comment: http://stackoverflow.com/comment/37390639
has comment: http://stackoverflow.com/comment/37284163
has comment: http://stackoverflow.com/comment/37304708
type: Answer
has comment: http://stackoverflow.com/comment/37358485
has comment: http://stackoverflow.com/comment/37304500
has body: Yes, this is the documented behaviour: The byte array will be in big-endian byte-order: the most significant byte is in the zeroth element. The array will contain the minimum number of bytes required to represent this BigInteger, including at least one sign bit, which is (ceil((this.bitLength() + 1)/8)). bitLength() is documented as: Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. So in other words, two values with the same magnitude will always have the same bit length, regardless of sign. Think of a BigInteger as being an unsigned integer and a sign bit - and toByteArray() returns all the data from both parts, which is "the number of bits required for the unsigned integer, and one bit for the sign".
has comment: http://stackoverflow.com/comment/37389770
score: 13
upvote count: 13
has comment: http://stackoverflow.com/comment/37304082
downvote count: 0
answers question: http://stackoverflow.com/q/24158629
has comment: http://stackoverflow.com/comment/37354281
has comment: http://stackoverflow.com/comment/37284094

http://stackoverflow.com/q/24124996
has body: This is what you usually do when sending text data // Receiver code while (mRun &amp;&amp; (response = in.readLine()) != null &amp;&amp; socket.isConnected()) { // Do stuff } // Sender code printWriter.println(mMessage); printWriter.flush(); but when working with DataOutputStream#write(byte[]) to send byte[], how do you write a while loop to receive sent data. All I have found is this, but it doesn't loop, so I'm guessing this will just run on the first sent message: int length = in.readInt(); byte[] data = new byte[length]; in.readFully(data); How can I achieve this? PS: yep, I'm new to socket programming. EDIT: I'm sending a byte array each 3 to 5 seconds. This is what I've got so far. // In the client side, in order to send byte[]. This is executed each 3 seconds. if(out != null) { try { out.writeInt(encrypted.length); out.write(encrypted); out.writeInt(0); out.flush(); return true; } catch (IOException e) { e.printStackTrace(); return false; } } // In the serverside, in order to receive byte[] sent from client (also executed 3 to 5 seconds due to bytes being sent at said rate. "client" being the Socket instance. while(true &amp;&amp; client.isConnected()) { byte[] data = null; while(true) { int length = in.readInt(); if(length == 0) break; data = new byte[length]; in.readFully(data); } if(data != null) { String response = new String(data); if(listener != null) { listener.onMessageReceived(response); } } }
tagged with: sockets
has answer: http://stackoverflow.com/a/24125109
tagged with: java
has comment: http://stackoverflow.com/comment/37220983
answer count: 1
has comment: http://stackoverflow.com/comment/37220999
has comment: http://stackoverflow.com/comment/37220955
type: Question
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24125109
has title: Reading Socket InputStream in a loop when writing byte arrays

boolean
tags question: http://stackoverflow.com/q/24224345
tags question: http://stackoverflow.com/q/24242543
tags question: http://stackoverflow.com/q/24229161
tags question: http://stackoverflow.com/q/24191040
tag name: boolean
type: Tag

http://stackoverflow.com/comment/37401328
type: QuestionComment
has text: It is termin from book. without explanation.
comment on: http://stackoverflow.com/q/24220606
score: 0
type: Comment

http://stackoverflow.com/q/24208029
tagged with: mysql
has title: Connect to remote MySQL server using Java
has body: I'm writing a program to push stuff into a remote database. My database is stored on a redhat server, while my program is written on a windows machine. I dont want to give out my server addresses but lets say my Linux server is xx.xx.xx.xx8 MySQL Workbench in windows says that my mysql server host is 127.0.0.1:3306 I know there are a million similar questions but each one is pretty unique to the situation. I've been using http://www.vogella.com/tutorials/MySQLJava/article.html#javaconnection as a guide but this looks like a local connection. I have also been referencing this but it confuses me. Here's a mock up of some code i think may work: Connection connection = null; String dburl = "jdbc:mysql://127.0.0.1:3306/Db_Name"; String userName = "user"; String passWord = "password"; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(dburl, userName, passWord); Statement st = connection.createStatement(); String query = "INSERT INTO Example (`TestColumn`) VALUES('hello')"; int rsI = st.executeUpdate(query); System.out.println("Hi"); }catch (Exception e) { System.out.println(e); } finally { if (connection != null) { try { connection.close(); System.out.println("Database connection terminated"); } catch (Exception e) { /* ignore close errors */ } } } that is based on the link i provided. All i changed was the address. I have no idea where the server address xx.xx.xx.xx8 should go.
answer count: 4
has comment: http://stackoverflow.com/comment/37378190
tagged with: database
has answer: http://stackoverflow.com/a/24208370
has comment: http://stackoverflow.com/comment/37377143
has comment: http://stackoverflow.com/comment/37378038
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37377385
has answer: http://stackoverflow.com/a/42258157
has answer: http://stackoverflow.com/a/24208796
has answer: http://stackoverflow.com/a/24209377
type: Question
has comment: http://stackoverflow.com/comment/37381655
score: 0
tagged with: java

http://stackoverflow.com/q/24207548
has answer: http://stackoverflow.com/a/24207864
has title: Exclude a Pattern using Regex
tagged with: regex
has comment: http://stackoverflow.com/comment/37376701
has comment: http://stackoverflow.com/comment/37376967
type: AnsweredQuestion
answer count: 2
linked to: http://stackoverflow.com/q/513832
score: 1
accepted answer: http://stackoverflow.com/a/24207600
tagged with: java
has comment: http://stackoverflow.com/comment/37376368
downvote count: 0
has answer: http://stackoverflow.com/a/24207600
upvote count: 1
has comment: http://stackoverflow.com/comment/37376423
has comment: http://stackoverflow.com/comment/37376414
has comment: http://stackoverflow.com/comment/37376643
has body: I am having an issue understanding regular expressions. All I want to be able to collect are the capital letters toward the end of the strings. The strings listed are just an example of the numerous strings I have, so searching specifically for STWR, STW, or ST won't work. The way my regex works I keep getting II or III as a result. Is there a way to gather the information I want but exclude II or III? Will I be able to do it within my regex pattern, or do I need an if loop? Here is my code along with an if loop I have tried. Any help would be much appreciated. public class First { public static void main(String[] args) { String one = "Star Wars I - 00001 - STWR ep1"; String two = "Star Wars II - 00002 - STW ep2"; String three = "Star Wars III - 00003 - ST ep3"; Pattern p = Pattern.compile("([A-Z]{2,4})|[A-Z]{2}"); Matcher m = p.matcher(one); m.find(); String answer1 = m.group(); System.out.println("This is answer 1: " + answer1); Matcher n = p.matcher(two); n.find(); String answer2 = n.group(); System.out.println("This is answer 2: " + answer2); Matcher o = p.matcher(three); o.find(); String answer3 = o.group(); System.out.println("This is answer 3: " + answer3); if (answer2 == "II" | answer2 == "III") { p = Pattern.compile("([A-Z]{3,4})"); System.out.println(answer2); } } }
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24207864

http://stackoverflow.com/q/24224656
tagged with: java
accepted answer: http://stackoverflow.com/a/24224709
tagged with: objective-c
has answer: http://stackoverflow.com/a/24224709
type: Question
has answer: http://stackoverflow.com/a/24224717
answer count: 2
tagged with: arrays
has body: Im rewriting part of one algorithm from Objective C source code into my java program and dont know whether im doing it right (probably not). The problem is, there is an array thats being passed into other functions and its size and values may vary on the fly. Objective C main: double[] output = new double[1]; foo(output); and function: public void Run(out double[] output){ /* Dimensioning the array, i dont understand this part, why is it being allocated again? Is it to increase the size in case the number is bigger than outputs current dimension and does it keep values in the old part of the array? */ output = new double[number]; // Copy new values to the output array for(int i = 0; i &lt; number; i++){ output[i] = i+number; } //Now i should be able to access these new values in main } I replaced my array in java code with ArrayList&lt;Double&gt; output and had to make significant changes to other functions because of it. I know Java passes only by value but is there some trick or some other way to make changes to the output array so it behaves like in Objective C? I have never programmed in Objective C before. How does the allocation part above work in Objective C?
possible better answer: http://stackoverflow.com/a/24224717
type: AnsweredQuestion
has title: Objective C array = new double[ ]; behavior in Java
score: 0

http://stackoverflow.com/a/24224980
has comment: http://stackoverflow.com/comment/37409637
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24224666
has body: Let's take a closer look at what is happening under the hood. Assuming you are familiar with what a heap and a stack are, the variable position resides on the heap, as it is not local to your function RandStep. On the other hand, pos is local, so it resides on the stack. With every recursive call, a new stack frame is allocated (from frameA to frameC). I represent positions as single values for the sake of brevity. Let's say that you start from position 0, and then break the walls towards position 1. What happens is that a new frame is allocated for the new value of pos, but positionis overwritten. The same when you transition from position 1 to position 2. Let's say that from position 2 there's nowhere to go, so we need to trace back. Then frameC is deallocated. However, instead of using the value of pos in the top frame (which is frameB now), your call to RandStep was made on position, so the value that you use is the one on the heap, which remained unchanged despite the frame deallocation. "Stepping back" as suggested by Intredasting acutally means manually updating the heap, so that position follows the same evolution as pos. In my opinion, that defeats the purpose of recursion. Its beauty is that it takes care itself of the stepping back part by deallocation. In conclusion, what you need to do is avoid changing the heap at all in recursive functions. |STACK | |STACK | |STACK | | | | | | | | | | | |frameC: pos = 2|---&gt; got stuck, deallocate frame | | |frameB: pos=1 | |frameB: pos = 1| and backtrack |frameA: pos=0 | |frameA: pos=0 | |frameA: pos = 0| |---------------| |--------------| |---------------| |HEAP | |HEAP | |HEAP | |position = 0 | |position=1 | |position = 2 | | | | | | | | | | | | | ----------------- ---------------- -----------------
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37270386
type: QuestionComment
comment on: http://stackoverflow.com/q/24150326
score: 0
has text: Hi dhiller. Just did. Let me know if you need more details. thanks!
type: Comment

http://stackoverflow.com/comment/37263664
score: 0
has text: @Vulcan Go back and read my question
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24147372

http://stackoverflow.com/comment/37361517
comment on: http://stackoverflow.com/q/24199636
type: Comment
type: QuestionComment
has text: wow so its just me wtf maybe its eclipse
score: 0

http://stackoverflow.com/a/24249764
score: 0
has body: Well, I found the answer. It was the width and height that must be in pixel (200px and 630px). Hope it will help someone :)
type: Answer
answers question: http://stackoverflow.com/q/24215205

http://stackoverflow.com/q/24216680
has title: Optimizing my thread pool
tagged with: java
accepted answer: http://stackoverflow.com/a/24216770
has body: I have an application where I use Executors for creating a thread pool. Now, I know we can create a thread pool with n number of threads in it while creating. But in my case I don't want the pool size to be fixed. I want the application to create more threads in the pool if the users are more and automatically reduce the pool size if the users are less. Please tell me if I'm vague and you need more information on understanding this. Cheers!!
tagged with: executorservice
has answer: http://stackoverflow.com/a/24216770
has comment: http://stackoverflow.com/comment/37394211
answer count: 2
tagged with: multithreading
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/3286626
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24216796
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24216796
score: 1
tagged with: threadpool

http://stackoverflow.com/comment/37233592
score: 0
comment on: http://stackoverflow.com/q/24131465
has text: Put it in a continuous while loop that only gets broken with the right prompt.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24251500
has answer: http://stackoverflow.com/a/24251644
has body: I've been trying to use import javafx.embed.swing.SwingNode because I want to use SwingNode in my project, but the error "cannot be resolved" comes up. I have a JavaFX SDK in libraries, so I don't know where the problem is. Does anyone have any idea what it can be?
downvote count: 0
linked to: http://stackoverflow.com/q/15278215
tagged with: java
tagged with: javafx
answer count: 1
tagged with: classpath
favorite count: 0
type: Question
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/96262475
type: UnansweredQuestion
tagged with: swing
has title: The import javafx.embed.swing.SwingNode cannot be resolved
upvote count: 2
score: 2

http://stackoverflow.com/q/24158879
has answer: http://stackoverflow.com/a/24160094
has body: I reflect how is possible to call method or get property value using getter in ModelAndView through JSP page using extended class. For example: I would extends class ModelAndView to class View and implements there some methods to getting some data. import org.springframework.web.servlet.ModelAndView; public class View extends ModelAndView { private Map store = new HashMap<>() ; public Object getElement(String index) { return store.get(index); } public void setElement(String index,Object o) { store.put(index,o); } } Now controller which will handle approaching request. public class WelcomeController extends AbstractController { private String viewName; @Override protected ModelAndView handleRequestInternal( HttpServletRequest request, HttpServletResponse response) throws Exception { View v = new View("example.jsp"); v.setElement("test", "Hello im test!"); return v // I would not use here method addObject(); // how put reference to jsp page of View (ModelAndView) // code like this return StackOverflowError // v.addObject("reference_to_view",v); } } Nothing remains, except getting my string test from View in JSP page: example.jsp WELCOME // how can i here call method getElement of object View. ${this.getElement("test")} ${getElement("test")} How can i call method getElement(); of object View which was returned from WelcomeController
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37284556
has title: How to call ModelAndView method or getting reference to it in JSP page?
tagged with: spring-mvc
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24159800
tagged with: java
tagged with: jsp

http://stackoverflow.com/comment/37323313
comment on: http://stackoverflow.com/q/24179446
type: Comment
type: QuestionComment
has text: I want to encrypt my messages with combination of keys. Also on receiving client I will have public and private key. When I send message, I will encrypt it using my combination of keys, and decrypt on other client use their combination of keys. Like RSA
score: 0

http://stackoverflow.com/a/24224237
accepted answer of: http://stackoverflow.com/q/24222799
score: 1
answers question: http://stackoverflow.com/q/24222799
has body: There is no way to avoid it when using this map. I would suggest moving the map access into a separate method, so the code reads more cleanly. @SuppressWarnings("unchecked") private &lt;T extends IType&gt; IStrategy&lt;T&gt; getStrategy(T o) { return (IStrategy&lt;T&gt;) map.get(o.getClass()); } BTW, you can do it in scala. Edit: You can do it in Octarine, see blog on post Extractors. But maybe this is just a fancy way or moving the logic to it's own method, but bringing in a lot of complexity.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37409568
upvote count: 1

http://stackoverflow.com/comment/37206942
score: 0
type: Comment
type: AnswerComment
has text: i have used that in whole project so its cant be changed for single thing
comment on: http://stackoverflow.com/a/24117294

http://stackoverflow.com/comment/37478042
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24260863
has text: @user2175304 How `System.out.println("The location is at :" + Location);` can be correct if you wrote that X and Y always 0?
score: 0

http://stackoverflow.com/comment/37184806
type: Comment
type: AnswerComment
has text: Is it seriously that simple? Don't you have to use onActivityResult? If not, do you know why not?
score: 0
comment on: http://stackoverflow.com/a/24105591

http://stackoverflow.com/comment/37433294
type: QuestionComment
score: 0
has text: What if I want 50 of the same animation on one screen?
comment on: http://stackoverflow.com/q/24235022
type: Comment

http://stackoverflow.com/q/24163071
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24163580
has body: I want to display selected text with user selected text color.I had select some text and click on settextcolor it was applied to all the text present in JTextPane not selected text.I want apply the color to selected text only.Please help me.. Here is my code: public class SetTextColor extends javax.swing.JFrame { int i=0; JTextPane textPane; JScrollPane scrollPane; public SetTextColor() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tabbedPane = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); Create = new javax.swing.JMenuItem(); SetTextColor = 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); SetTextColor.setText("SetTextColor"); SetTextColor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SetTextColorActionPerformed(evt); } }); jMenu1.add(SetTextColor); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) ); pack(); }// &lt;/editor-fold&gt; private void CreateActionPerformed(java.awt.event.ActionEvent evt) { final JInternalFrame internalFrame = new JI…
score: 0
tagged with: java
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37298885
has title: Apply color for Selected Text using JTextPane
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24163580
has comment: http://stackoverflow.com/comment/37299501
tagged with: jtextpane
tagged with: swing
linked to: http://stackoverflow.com/q/24052862
tagged with: nimbus

http://stackoverflow.com/comment/37311100
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24168316
has text: Issue resolved. Its because I was not closing client once my processing is over.
score: 1

http://stackoverflow.com/q/24140877
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37251297
has comment: http://stackoverflow.com/comment/37251031
score: 0
has comment: http://stackoverflow.com/comment/37250569
tagged with: android
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37251650
answer count: 2
has body: The Android developer docs for string resources show an example string which is also a valid Java variable ("hello_world") which it explains is accessed via R.string.hello_world My question is whether the XML is permitted to contain string name attributes that are invalid as Java variables. For example, are the following string keys allowed as XML resource names, and if so, how would they be accessed via R.string.&lt;name&gt; in Java? &lt;string name="hello world" /&gt; &lt;string name="hello.world" /&gt; &lt;string name="42 hello world" /&gt; Note to down-voters: I am not attempting to actually do this. I am attempting to understand what the file format allows and how the resources are converted. Some context for what and why I'm asking: My software converts key/value pairs to XML resources and automatically converts all keys to valid Java variables, so "hello-world" is converted to "hello_world". However a user reported that they wanted to keep "hello.world" as the value of XML name attribute. They informed me that the Android builder would convert it to "hello_world". So I am asking this question to work out which cases I should automatically handle and which I should allow through.
has comment: http://stackoverflow.com/comment/37250943
type: UnansweredQuestion
tagged with: localization
has answer: http://stackoverflow.com/a/24140925
has title: Do string resource XML files allow invalid Java variables as name attributes?
has comment: http://stackoverflow.com/comment/37251424
upvote count: 1
has answer: http://stackoverflow.com/a/24160972
has comment: http://stackoverflow.com/comment/37251190

http://stackoverflow.com/comment/37344507
comment on: http://stackoverflow.com/q/24191040
type: Comment
score: 0
has text: Can you use regular expressions?
type: QuestionComment

web
tags question: http://stackoverflow.com/q/24221041
tags question: http://stackoverflow.com/q/24157734
tag name: web
tags question: http://stackoverflow.com/q/24112108
tags question: http://stackoverflow.com/q/24138120
tags question: http://stackoverflow.com/q/24229308
tags question: http://stackoverflow.com/q/24154954
type: Tag
tags question: http://stackoverflow.com/q/24211021
tags question: http://stackoverflow.com/q/24214725
tags question: http://stackoverflow.com/q/24147946

http://stackoverflow.com/comment/37242630
score: 0
has text: changed the solution accordingly
comment on: http://stackoverflow.com/a/24132873
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24146076
answers question: http://stackoverflow.com/q/24145876
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: Your FileTab has no LayoutManager assigned (default is FlowLayout). So the two components you add (Checkbox and Label) are centered by default. Maybe this helps: JList text alignment

http://stackoverflow.com/q/24176030
accepted answer: http://stackoverflow.com/a/24176047
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24176047
possible better answer: http://stackoverflow.com/a/24176050
has body: class Temp { public static void main(String[] args) { int x=10,y=20; while (x&lt;y) { System.out.println("Hello"); } System.out.println("Hi"); } } output it prints Hello infinity times but when i make local variable final int x=10,y=20; then it is showing Statement Unreachable
has answer: http://stackoverflow.com/a/24176054
tagged with: java
has answer: http://stackoverflow.com/a/24176123
has title: Why java final variable showing unreachable Statement
downvote count: 1
favorite count: 0
type: Question
upvote count: 4
tagged with: local
tagged with: final
has answer: http://stackoverflow.com/a/24176050
tagged with: variables
answer count: 4

http://stackoverflow.com/comment/37328625
type: QuestionComment
has text: @Eu.Dr. where have you answered man?
score: 0
comment on: http://stackoverflow.com/q/24182622
type: Comment

http://stackoverflow.com/a/24200096
has body: There is one call to input.read() method in the while loop and other call to get character from the stream, this in turn skips one character every time.. So to solve this you can either use int intInput = 0; while( (intInput = input.read()) &gt;=0 ){ Character aByte = (char)intInput; your code as it is .... }
type: Answer
answers question: http://stackoverflow.com/q/24199009
score: 0

comparator
tags question: http://stackoverflow.com/q/24141688
tags question: http://stackoverflow.com/q/24176765
tags question: http://stackoverflow.com/q/24249455
tag name: comparator
type: Tag
tags question: http://stackoverflow.com/q/24174767

http://stackoverflow.com/a/24161971
has comment: http://stackoverflow.com/comment/37294592
score: 0
has comment: http://stackoverflow.com/comment/37291001
has body: When you get a NoClassDefFoundError, there is a problem with your CLASSPATH. Either you didn't include the necessary BouncyCastle jars into your CLASSPATH. In that case, it's normal that your application can't find the org/bouncycastle/cert/X509CertificateHolder class: it's not there. Remedy: add the appropriate BouncyCastle jars to your CLASSPATH. Or you have more than one version of BouncyCastle in your CLASSPATH. In this case, you have an ambiguity: your application doesn't know which of the multiple X509CertificateHolder classes it should pick. Remedy: remove all versions of BouncyCastle from your CLASSPATH, except the one you need. Or you have the wrong version of BouncyCastle in your CLASSPATH. Maybe a version where X509CertificateHolder is absent or where it exists in another package. Remedy: replace that jar with the version of BouncyCastle you need. How do you know which version of BouncyCastle is needed? When you downloaded iText, you downloaded a specific version of iText. This version comes with a POM file. In this POM file, you can find the iText version number and all the dependencies. You'll find the BouncyCastle version number you need in that file.
has comment: http://stackoverflow.com/comment/37365138
has comment: http://stackoverflow.com/comment/37296677
has comment: http://stackoverflow.com/comment/37369786
answers question: http://stackoverflow.com/q/24161141
has comment: http://stackoverflow.com/comment/37451059
type: Answer
has comment: http://stackoverflow.com/comment/54288365
has comment: http://stackoverflow.com/comment/37322367

http://stackoverflow.com/comment/37274870
score: 0
has text: @user3727849 You could use a compound loop, but a better solution would be to load each employee into memory so it's more easily accessiable
type: Comment
comment on: http://stackoverflow.com/q/24153073
type: QuestionComment

http://stackoverflow.com/comment/37393859
score: 0
type: Comment
has text: thank you for your answer. in this method, how can i use OnClickListener method for manage selected item?
comment on: http://stackoverflow.com/a/24216461
type: AnswerComment

http://stackoverflow.com/comment/37453446
type: Comment
type: QuestionComment
has text: cant I convert it into some kind of String object and then store it
comment on: http://stackoverflow.com/q/24247675
score: 0

http://stackoverflow.com/comment/37442149
type: QuestionComment
comment on: http://stackoverflow.com/q/24241813
has text: my filter1 is on string, and filter2 is on int
score: 0
type: Comment

http://stackoverflow.com/a/24267915
score: 5
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/24266470
has body: Since all first-party and third-party code is optimized into one dex file, you're not going to be able to find a list of just the third party jars pretty easily. You can however, use the tool dexdump which exists in $SDK_DIR/build-tools/{VERSION}/ to view information about the combined dex file inside of the APK. This will print out a list of all classes in the file: ./dexdump {PATH_TO_APK} | grep "Class descriptor" | cut -d':' -f The output will look something like: 'Lcom/stackexchange/marvin/ui/inbox/AchievementsListFragment;' 'Lcom/stackexchange/marvin/ui/question/AnswerFragment;' 'Lcom/stackexchange/marvin/ui/site/AllSitesFragment;' 'Lcom/stackexchange/marvin/ui/site/SingleSiteQuestionsFragment;' 'Lcom/stackexchange/marvin/ui/site/SingleSiteTagsFragment;' 'Lcom/stackexchange/marvin/ui/site/SingleSiteUsersFragment;' ... Since it seems that you care about the packages, not the classes, you can also optimize this a bit by looking at just the unique rough guesses for package identifiers. If we assume every class that has a different first two labels is a different package, then you can trim down the classes to just the packages like so: ./dexdump ~/Downloads/StackExchangeMobile-release.apk | grep "Class descriptor" | cut -d':' -f2 | cut -c4- | cut -d'/' -f1-2 | uniq -u | sort The above will remove the 'L from the beginning of each line in the previous result, get just the first two folder names (namespace identifiers), then print out all the unique ones it finds. Using that on the Stack Exchange android application spits out: android/support com/actionbarsherlock com/google com/koushikdutta ... which shows what it's using. You can play with the number of folder names to keep since some packages require drilling down more than 2 identifiers to figure out what they use, by modifying the -f1-2 section of the last cut command to be -f1-{NUM}. I didn't since changing it to three in this case spits out a lot of junit packages.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/59922129
downvote count: 0
answers question: http://stackoverflow.com/q/24266470

http://stackoverflow.com/comment/37463031
score: 0
comment on: http://stackoverflow.com/a/24252591
type: Comment
has text: @SamN-a I did not know that. Indeed it is shorter and more convenient. Thanks ;)
type: AnswerComment

http://stackoverflow.com/comment/37401165
score: 0
comment on: http://stackoverflow.com/q/24220405
has text: Well inorder to avoid the null you can always assign an initial values to a variable... This would help you atleast eliminate the null condition
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24221618
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37406305
answers question: http://stackoverflow.com/q/24221552
type: Answer
has body: To answer your first question from a C# perspective just take a look at the documentation - MSDN. For the Random classes parameterless constructor it says: Initializes a new instance of the Random class, using a time-dependent default seed value So yes, if you don't supply a seed the runtime will use a default one. Again, looking at the documentation you can see you can't find the seed used if you don't supply it. As for wanting to be able to consistently produce random numbers, you could create an IRandomNumberGenerator interface and create 2 implementations. One would make calls to the Random class, the other could be used for testing purposes and would simply return whatever you wish. Then you could use dependency injection to control which implementation is used.
has comment: http://stackoverflow.com/comment/37403146

http://stackoverflow.com/q/24184746
score: 6
possible better answer: http://stackoverflow.com/a/37380033
accepted answer: http://stackoverflow.com/a/24307727
upvote count: 6
has answer: http://stackoverflow.com/a/24307727
has answer: http://stackoverflow.com/a/37380033
has title: How to read a file from s3 in EMR?
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/24201888
tagged with: amazon-s3
has body: I would like to read a file from S3 in my EMR Hadoop job. I am using the Custom JAR option. I have tried two solutions: org.apache.hadoop.fs.S3FileSystem: throws a NullPointerException. com.amazonaws.services.s3.AmazonS3Client: throws an exception, saying "Access denied". What I fail to grasp is that I am starting the job from the Console, so obviously I should have the necessary permissions. However, the AWS_*_KEY keys are missing from the environment variables (System.getenv()) that are available to the mapper. I am sure I do something wrong, just not sure what.
tagged with: java
downvote count: 0
tagged with: elastic-map-reduce
favorite count: 0
type: Question
tagged with: hadoop

http://stackoverflow.com/q/24217239
upvote count: 0
tagged with: java
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24409568
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: jar
has body: When I give the following command java -Xmx500m -jar bc.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 I am getting the following Exception Throwable Error: java.lang.NoClassDefFoundError: org/supercsv/prefs/CsvPreference Exception in thread "main" java.lang.Error: java.lang.NoClassDefFoundError: org/supercsv/prefs/CsvPreference at bc.c.Util.process(Util.java:135) at bc.m.TabularReader$CSVReader.&lt;init&gt;(TabularReader.java:68) at bc.m.TabularReader.&lt;init&gt;(TabularReader.java:37) at bc.c.Spread2db.main(Spread2db.java:244) Caused by: java.lang.NoClassDefFoundError: org/supercsv/prefs/CsvPreference at bc.m.TabularReader$CSVReader.&lt;init&gt;(TabularReader.java:64) ... 2 more Caused by: java.lang.ClassNotFoundException: org.supercsv.prefs.CsvPreference at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 3 more I guess that this is due to the improper inclusion of supercsv. Can anybody help me fixing this?
score: -1
has title: Cannot use supercsv while running a jar file in Java (windows)
tagged with: supercsv

http://stackoverflow.com/comment/37339166
type: AnswerComment
has text: OK let me try if possible.
comment on: http://stackoverflow.com/a/24188216
score: 0
type: Comment

http://stackoverflow.com/a/24126791
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24115945
score: 2
has body: Sender starts the handshake with server. Client starts handshake with server. Server generates a pair of Public and Private key using asymmetric encryption and re-encrypt the Public key alone using symmetric encryption. No. And passes the Public key to the sender. No. It sends its certificate to the client and they then start a secret-key negotiation. Sender encrypt the message using the Public key No. It uses a symmetric session key negotiated during the handshake. and sends the encrypted message to server. Yes. Server decrypt the message using symmetric encryption Yes. and then decrypt the message again using the Private key. No. Is this the right way how SSL encryption works? No.
answers question: http://stackoverflow.com/q/24115945
type: AcceptedAnswer

http://stackoverflow.com/comment/37457976
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24229704
type: Comment
has text: @injecteer Could you post the link to the ehacache.jar on maven central please?

http://stackoverflow.com/comment/37449286
comment on: http://stackoverflow.com/a/24242917
type: AnswerComment
has text: @DaveNewton: In case it wasn't clear enough for you from my previous comment, this conversation's over.
score: 0
type: Comment

sql
tags question: http://stackoverflow.com/q/24209345
tags question: http://stackoverflow.com/q/24157353
tags question: http://stackoverflow.com/q/24204841
tags question: http://stackoverflow.com/q/24181906
tags question: http://stackoverflow.com/q/24154615
tags question: http://stackoverflow.com/q/24142608
tags question: http://stackoverflow.com/q/24198200
tags question: http://stackoverflow.com/q/24248505
tags question: http://stackoverflow.com/q/24208118
tags question: http://stackoverflow.com/q/24209754
tags question: http://stackoverflow.com/q/24221476
tags question: http://stackoverflow.com/q/24225924
tags question: http://stackoverflow.com/q/24134080
tags question: http://stackoverflow.com/q/24146830
tags question: http://stackoverflow.com/q/24222826
tags question: http://stackoverflow.com/q/24171653
tags question: http://stackoverflow.com/q/24135363
tags question: http://stackoverflow.com/q/24106148
tags question: http://stackoverflow.com/q/24241736
tags question: http://stackoverflow.com/q/24200905
tags question: http://stackoverflow.com/q/24151026
tags question: http://stackoverflow.com/q/24176749
tags question: http://stackoverflow.com/q/24105179
tags question: http://stackoverflow.com/q/24256319
tags question: http://stackoverflow.com/q/24120998
tags question: http://stackoverflow.com/q/24261210
tags question: http://stackoverflow.com/q/24171508
tags question: http://stackoverflow.com/q/24265396
tags question: http://stackoverflow.com/q/24240295
tags question: http://stackoverflow.com/q/24167359
tags question: http://stackoverflow.com/q/24172489
tags question: http://stackoverflow.com/q/24145802
tags question: http://stackoverflow.com/q/24164666
tags question: http://stackoverflow.com/q/24260682
tags question: http://stackoverflow.com/q/24241501
tags question: http://stackoverflow.com/q/24214706
tags question: http://stackoverflow.com/q/24175853
tags question: http://stackoverflow.com/q/24197684
tags question: http://stackoverflow.com/q/24136899
tags question: http://stackoverflow.com/q/24111808
tags question: http://stackoverflow.com/q/24124351
tags question: http://stackoverflow.com/q/24142751
tags question: http://stackoverflow.com/q/24157194
tags question: http://stackoverflow.com/q/24192760
tags question: http://stackoverflow.com/q/24254306
tags question: http://stackoverflow.com/q/24266710
tags question: http://stackoverflow.com/q/24231993
tags question: http://stackoverflow.com/q/24114909
tags question: http://stackoverflow.com/q/24220844
tags question: http://stackoverflow.com/q/24219343
tags question: http://stackoverflow.com/q/24242898
tags question: http://stackoverflow.com/q/24201209
tags question: http://stackoverflow.com/q/24168217
tag name: sql
tags question: http://stackoverflow.com/q/24196627
type: Tag
tags question: http://stackoverflow.com/q/24211852
tags question: http://stackoverflow.com/q/24180611
tags question: http://stackoverflow.com/q/24219383
tags question: http://stackoverflow.com/q/24252213
tags question: http://stackoverflow.com/q/24164798
tags question: http://stackoverflow.com/q/24108378
tags question: http://stackoverflow.com/q/24143124
tags question: http://stackoverflow.com/q/24257339
tags question: http://stackoverflow.com/q/24188462
tags question: http://stackoverflow.com/q/24164478
tags question: http://stackoverflow.com/q/24168108
tags question: http://stackoverflow.com/q/24144418
tags question: http://stackoverflow.com/q/24208202
tags question: http://stackoverflow.com/q/24228066
tags question: http://stackoverflow.com/q/24118882
tags question: http://stackoverflow.com/q/24116476

http://stackoverflow.com/comment/37383572
type: Comment
score: 0
type: AnswerComment
has text: ok having the `setMyLocationEnabled(true)` makes sense...thanks a lot! the compass shows up now
comment on: http://stackoverflow.com/a/24211049

http://stackoverflow.com/a/24199112
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24198949
has body: Hussain, what you need here is a SSH API like J2ssh : http://www.sshtools.com/archives/category/j2ssh-maverick Or if you are ready to go that far you can use java sockets and the underneath connection protocol's raw commands to write commands to socket out stream and read response from in stream. j2ssh is licensed but deserves the cost, you can find similar free/opensource APIs as mentioned by MadProgrammer.
downvote count: 0

http://stackoverflow.com/a/24113853
downvote count: 0
upvote count: 1
has body: Yes, you can do it with weightsum and layout_weight in linearlayout and also you can create this type of view using RelativeLayout. 1) In LinearLayout just add weightsum="1" to your linearlayout and add layout_weight="0.2" to each of your header and footer and add layout_weight="0.6" to your listview. 2) In relativeLayout add alignParentTop to your header and alignParentBottom to your footer and set listview to layout_below="@+id/header" and layout_above="2+id/footer"
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24113652
has comment: http://stackoverflow.com/comment/37232798

http://stackoverflow.com/comment/37232741
score: 2
comment on: http://stackoverflow.com/q/24129926
has text: The actual pipeline use is OS and JVM specific. Swing uses a double buffering approach, so when using `paintComponent`, it's not likely that you are painting directly to the screen device. At some point after the call to your paint methods, the JVM will push the result to the graphics library in use (DirectX or OpenGL) and that will then interact with the hardware through what ever means it has available. I've renderer 10, 000 rotating images at 25fps through this process before, so unless you're doing silly things (loading images/resources), it should be okay
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37460003
score: 0
type: Comment
type: QuestionComment
has text: Oh, so for example Object is the father class, it contains methods to icons, images, names and coordinate variables, the children (which extend it) have methods that do certain specific tasks like dealing damage or healing, now the question is, can other classes extend also the children and still benefit from the main class object and previous ones? Object --> Equipment ---> Broadsword --> Iron Broadsword.
comment on: http://stackoverflow.com/q/24250994

http://stackoverflow.com/comment/37479482
has text: Sorry but how could this help me? I tried to make the GridLayout scrollable but it doesn't work (with and without scrollview). Do you have a running example?
comment on: http://stackoverflow.com/q/24259157
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37331560
type: Comment
comment on: http://stackoverflow.com/a/24183877
type: AnswerComment
has text: @Eran i edited my answer or i dont know that link is invalid.... but most of time link is provided by many...
score: 0

http://stackoverflow.com/a/49802995
type: Answer
has body: Select xml file and click on run as xsl transformation. then select file with .xsl and click ok. After that one file generated something.out.xml then change the extension of something.out.xml to something.out.html and run tht html file
score: 0
answers question: http://stackoverflow.com/q/24125596

dicom
tags question: http://stackoverflow.com/q/24250991
tag name: dicom
type: Tag

http://stackoverflow.com/a/24148827
type: Answer
answers question: http://stackoverflow.com/q/24148776
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37266172
accepted answer of: http://stackoverflow.com/q/24148776
has body: Your hint is this part right here: android.support.v4.app.Fragment You're casting a regular Fragment to a support Fragment. It's confusing because they are two classes with the same name, but located in different packages. Essentially, if you're working with the support libraries, you should stick to all support types. With that in mind, in your Tab1 class, make the following change in your import statements. //import android.app.Fragment; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup;
upvote count: 5

http://stackoverflow.com/comment/37339901
comment on: http://stackoverflow.com/q/24123773
score: 0
type: Comment
type: QuestionComment
has text: no I am not doing anything but creating messages and sending them to another actor. 15_000 is 15k in java. I am using the new support for underscores since java 7 http://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html

http://stackoverflow.com/q/24157468
tagged with: java
answer count: 1
has title: Add attachments to existing eml file
tagged with: eml
accepted answer: http://stackoverflow.com/a/24166939
has body: I have an existing eml file which contain among others body and attachments. I simply want to add attachments to this file, not erase existing onlt to add attachments. I have this code to create eml: public static void createMessage(String to, String from, String subject, String body, List&lt;File&gt; attachments) { try { Message message = new MimeMessage(Session.getInstance(System.getProperties())); message.setFrom(new InternetAddress(from)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to)); message.setSubject(subject); // create the message part MimeBodyPart content = new MimeBodyPart(); // fill message content.setText(body); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(content); // add attachments for(File file : attachments) { MimeBodyPart attachment = new MimeBodyPart(); DataSource source = new FileDataSource(file); attachment.setDataHandler(new DataHandler(source)); attachment.setFileName(file.getName()); multipart.addBodyPart(attachment); } // integration message.setContent(multipart); // store file message.writeTo(new FileOutputStream(new File("c:/mail.eml"))); } catch (MessagingException ex) { Logger.getLogger(Mailkit.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Mailkit.class.getName()).log(Level.SEVERE, null, ex); } } But how do i add to existing rather then create?
type: Question
has answer: http://stackoverflow.com/a/24166939
type: AnsweredQuestion
tagged with: jakarta-mail
score: 0

http://stackoverflow.com/comment/37291639
type: QuestionComment
comment on: http://stackoverflow.com/q/24162688
has text: Use the `onEndOfMedia` method. You can pass a runnable that will be executed once the media has reached the end playback, i.e. the `stopTime`.
score: 0
type: Comment

http://stackoverflow.com/comment/47274860
comment on: http://stackoverflow.com/a/24127841
type: AnswerComment
score: 0
type: Comment
has text: Sorry, I did some wrong editing and rolled it back, I had missed this was Java, that has no operator overloading :)

opengl
tags question: http://stackoverflow.com/q/24234362
tags question: http://stackoverflow.com/q/24168847
tags question: http://stackoverflow.com/q/24220363
tags question: http://stackoverflow.com/q/24216130
tags question: http://stackoverflow.com/q/24215500
tags question: http://stackoverflow.com/q/24249350
tags question: http://stackoverflow.com/q/24234916
tags question: http://stackoverflow.com/q/24262494
tags question: http://stackoverflow.com/q/24235050
tags question: http://stackoverflow.com/q/24192822
type: Tag
tag name: opengl
tags question: http://stackoverflow.com/q/24244405
tags question: http://stackoverflow.com/q/24188691

http://stackoverflow.com/q/24251657
tagged with: elastic-map-reduce
type: Question
has title: "Invalid option" error when passing arguments to EMR Bootstrap Action
type: UnansweredQuestion
has body: I'm programatically provisioning an EMR cluster using the Java SDK, and am trying to pass arguments to the setup-impala script. The code I have looks like this: ... List&lt;BootstrapActionConfig&gt; bootstrapActions = new ArrayList&lt;BootstrapActionConfig&gt;(); // --base-path, s3://elasticmapreduce, --impala-version, 1.2.1 BootstrapActionConfig bsInstallImpala = new BootstrapActionConfig(); bsInstallImpala.setName( "Install Impala" ); ScriptBootstrapActionConfig scriptActionInstallImpala = new ScriptBootstrapActionConfig(); scriptActionInstallImpala.setPath("s3://elasticmapreduce/libs/impala/setup-impala"); List&lt;String&gt; impalaArgs = new ArrayList&lt;String&gt;(); impalaArgs.add( "--base-path, s3://elasticmapreduce" ); impalaArgs.add( "--impala-version, 1.2.1" ); scriptActionInstallImpala.setArgs(impalaArgs); bsInstallImpala.setScriptBootstrapAction(scriptActionInstallImpala); bootstrapActions.add( bsInstallImpala ); ... RunJobFlowRequest request = new RunJobFlowRequest() .withName("OneButton Test") .withSteps(enabledebugging, installHive, installPig) .withLogUri("s3://somelogs/") .withAmiVersion("3.0.4") .withBootstrapActions(bootstrapActions) .withInstances(new JobFlowInstancesConfig() .withInstanceGroups(instanceGroups) .withEc2KeyName("redacted") .withHadoopVersion("2.2.0") .withKeepJobFlowAliveWhenNoSteps(true) .withTerminationProtected(true) ); But, when I send this request, the setup-impala script errors out as follows: /usr/lib/ruby/1.8/optparse.rb:1450:in `complete': invalid option: --base-path, s3://elasticmapreduce (OptionParser::InvalidOption) from /usr/lib/ruby/1.8/optparse.rb:1448:in `catch' from /usr/lib/ruby/1.8/optparse.rb:1448:in `complete' from /usr/lib/ruby/1.8/optparse.rb:1261:in `parse_in_order' from /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' from /usr/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order' from /usr/lib/ruby/1.8/optparse.rb:1248:in `order!' from /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!' from /usr/lib/ruby/1.8/optpar…
tagged with: ruby
tagged with: amazon-web-services
score: 0
has answer: http://stackoverflow.com/a/24251877
tagged with: java
answer count: 1

http://stackoverflow.com/comment/37210058
type: Comment
has text: Still this doesn't change the fact that ITree needs a Type of the same Interface. Which still generates the same warnings. "ITree is a raw type. References to generic type ITree<SELF> should be parameterized."
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24119209

http://stackoverflow.com/comment/37447643
has text: Thank you this really helped I eventually got it working using your answer
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24211679

http://stackoverflow.com/comment/37320966
has text: @JobSmith Can you use Spring Boot in your project? If so, what you are asking for can be implemented with a lot less configuration
score: 0
comment on: http://stackoverflow.com/q/24178127
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37435222
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24227899
has text: USE `for(int k=n; k >= i ;k--)`
score: 0

http://stackoverflow.com/q/24245478
has comment: http://stackoverflow.com/comment/37449586
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7253694
accepted answer: http://stackoverflow.com/a/24245556
has comment: http://stackoverflow.com/comment/37448672
possible better answer: http://stackoverflow.com/a/24245598
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37449554
has body: While trying to get sessionFactory.getCurrentSession() debugger shows that sessionFactory is null. I assume Spring 3 fails to inject sessionFactory into this class although all configuration seems to be in place. How to fix it? ServiceOrderDAO: @Transactional public class ServiceOrderDAO{ @Autowired static SessionFactory sessionFactory; public static List<ServiceOrderEntity> search(params...){ Session localSession = sessionFactory.getCurrentSession(); ... } } applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <context:annotation-config /> <mvc:annotation-driven/> <property name="prefix" value="" /> <property name="suffix" value=".jsp" /> <context:component-scan base-package="controller" /> <context:component-scan base-package="dao" /> <context:component-scan base-package="service" /> <context:property-placeholder location="classpath:dbConnection.properties" /> <tx:annotation-driven transaction-manager="transactionManager"/> <property name="dataSource" ref="dataSource" /> <property name="packagesToScan" value="model" /> <property name="sessionFactory" ref="sessionFactory" /> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <…
has answer: http://stackoverflow.com/a/24245598
type: AnsweredQuestion
has title: Cannot inject sessionFactory
has comment: http://stackoverflow.com/comment/37448869
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24245556
has comment: http://stackoverflow.com/comment/37449002
upvote count: 1
tagged with: spring

http://stackoverflow.com/a/24205184
has comment: http://stackoverflow.com/comment/37372017
has comment: http://stackoverflow.com/comment/37374601
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24205100
has comment: http://stackoverflow.com/comment/37374098
has body: Here this might help you out :) http://www.studytrails.com/R/RServe/RServe-Java-First-Program.jsp
accepted answer of: http://stackoverflow.com/q/24205100
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37371972
upvote count: 1
has comment: http://stackoverflow.com/comment/37371885

http://stackoverflow.com/a/24215023
downvote count: 0
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24214617
has body: Injection only occurs after the bean has been instantiated, which occurs after your constructor has been called, that's why in the first case you have a NPE. In the second case you instantiate yourself the bean b2 which implies that it will not be managed by the Java EE server (that means no injection) so ref. b3 will be null. In the third case, when your init method is called, all the constructors have been called and the beans have been injected.
answers question: http://stackoverflow.com/q/24214617
score: 7
has comment: http://stackoverflow.com/comment/37444137
type: Answer
has comment: http://stackoverflow.com/comment/37401135

http://stackoverflow.com/comment/37189122
comment on: http://stackoverflow.com/a/24107702
score: 0
type: AnswerComment
type: Comment
has text: [Here's](http://docs.oracle.com/javase/8/docs/api/java/util/Collection.html#removeAll-java.util.Collection-) the javadoc. Essentially, it removes all elements that the receiver object has in common with the passed argument, so after the method completes the two collections have no elements in common.

http://stackoverflow.com/comment/37190247
comment on: http://stackoverflow.com/q/24105622
has text: If your unit tests take that long to fun they are probably bad unit tests. You should consider simplifying your unit tests, and perhaps the design of your code, so the unit tests are quick to run.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24208984
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37379395
has comment: http://stackoverflow.com/comment/37380547
answers question: http://stackoverflow.com/q/24207684
has comment: http://stackoverflow.com/comment/37379598
type: Answer
has comment: http://stackoverflow.com/comment/37379771
downvote count: 0
has body: Simply use the @Named("myname") annotation. It is already defined in the standard.

http://stackoverflow.com/q/24152796
has body: I have an excel spreadsheet in which dates are written like this: 6/10/2012. Now, Grails is reading them in using the excel import plugin and when I ask it to print them its prints them as: 2012-06-10. The date is coming into my service in the form of a map like map: [name: name, date: date, price: price] I tried to do: Date date = Date(map.date) and of course I got an error. 2012-06-10 ERROR: Record could not be saved! org.grails.datastore.mapping.validation.ValidationErrors: 2 errors Field error in object 'com.twc.fatcaone.Record' on field 'date': rejected value [null]; codes [com.twc.fatcaone.Record.date.nullable.error.com.twc.fatcaone.Record.date,com.twc.fatcaone.Record.da I see that some of the java.util.Date constructors are deprecated so I was hesitant to use them but I was also wondering whats the cleanest way to parse into the map to grab the date and form a Date object from it?
has answer: http://stackoverflow.com/a/24165503
type: Question
has comment: http://stackoverflow.com/comment/37273870
answer count: 1
has comment: http://stackoverflow.com/comment/37274037
accepted answer: http://stackoverflow.com/a/24165503
has comment: http://stackoverflow.com/comment/37281212
tagged with: excel
tagged with: grails
type: AnsweredQuestion
score: 0
tagged with: java
has title: Grails Date constructor and parsing Dates
tagged with: date
has comment: http://stackoverflow.com/comment/37274398
has comment: http://stackoverflow.com/comment/37274560

http://stackoverflow.com/q/24183054
has answer: http://stackoverflow.com/a/24183081
score: 0
has comment: http://stackoverflow.com/comment/37329111
tagged with: java
has body: I wrote the following bit of code to determine if two same sized arrays are identical: retVal = true; for (int i = 0; i &lt; array1.size(); i++) { if (array1.get(i) != array2.get(i)){ retVal = false; break; } } In some unexplained cases the if statement returned true, though it wasn't (checked in debugger). In others it gave the right result. I fixed it by doing the following trivial fix: int val1, val2; retVal = true; for (int i = 0; i &lt; array1.size(); i++) { val1 = array1.get(i); val2 = array2.get(i); if (val1 != val2) { retVal = false; break; } } Any Idea what could be the reason?
has comment: http://stackoverflow.com/comment/37329203
has title: ArrayList.get(i) gives an unreliable result
type: Question
has comment: http://stackoverflow.com/comment/37329051
has answer: http://stackoverflow.com/a/24184012
has answer: http://stackoverflow.com/a/24183760
has comment: http://stackoverflow.com/comment/37329070
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37328971
has comment: http://stackoverflow.com/comment/37328938
answer count: 4
has answer: http://stackoverflow.com/a/24183131

http://stackoverflow.com/a/24164126
accepted answer of: http://stackoverflow.com/q/24164097
has body: Try this public String getFirstWords(String original){ String firstWord= ""; String[] split = original.split(" "); for(String value : split){ firstWord+= value.substring(0,1); } return firstWord; } And use this as String Result = getFirstWords("arwa othman"); Edit Using Regex String name = "arwa othman"; String firstWord= ""; for(String s : name.split("\\s+")){ firstWord += s.charAt(0); } String Result = firstWord;
downvote count: 0
has comment: http://stackoverflow.com/comment/37295087
answers question: http://stackoverflow.com/q/24164097
has comment: http://stackoverflow.com/comment/37294553
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37294972
has comment: http://stackoverflow.com/comment/37295461
has comment: http://stackoverflow.com/comment/37295321
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37295226
has comment: http://stackoverflow.com/comment/37295549
type: Answer
has comment: http://stackoverflow.com/comment/37295168

http://stackoverflow.com/comment/37356867
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24197291
has text: you have to set value of `EditText` like numAA.setText("0").

http://stackoverflow.com/q/24137769
has comment: http://stackoverflow.com/comment/37244850
type: UnansweredQuestion
has body: I want to display an icon on the action bar. But it always comes in the overflow list. Could you please help me up with a solution. This is my code. CreateScheduleActivity.java package com.mpeers.ui; 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.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; public class CreateScheduleActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.create_schedule); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.action_bar, 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); } } action_bar.xml in menu folder &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;!-- Search, should appear as action button --&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/plusicon" android:title="CS" android:showAsAction="ifRoom" /&gt; &lt;!-- Settings, should always be in the overflow --&gt; &lt;item android:id="@+id/action_settings" android:title="@string/action_settings" android:showAsAction="never" /&gt; &lt;/menu&gt;
tagged with: android
tagged with: android-actionbar
answer count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24138068
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24137858
has title: Android Action Button not shown in action bar
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37245234

http://stackoverflow.com/comment/37200420
type: QuestionComment
has text: data.get("foo") is an Object type.
comment on: http://stackoverflow.com/q/24113854
score: 0
type: Comment

http://stackoverflow.com/comment/37197454
comment on: http://stackoverflow.com/q/24112129
type: Comment
has text: Line 78 is a simple system.out.println
type: QuestionComment
score: 0

http://stackoverflow.com/a/24207811
has comment: http://stackoverflow.com/comment/37435803
has body: composite key never be null,but if you want composite key null then try this, try { Composite key = new Composite(); key.addComponent("key1", strSerializer); key.addComponent("null", strSerializer); compMutator.addInsertion(key, "columnfamily", HFactory.createColumn("column1", "col2 value",HFactory.createClock(), strSerializer,strSerializer)); compMutator.execute(); } catch (HectorException e) { e.printStackTrace(); } but it is a bad practice
answers question: http://stackoverflow.com/q/24201831
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37437706
has comment: http://stackoverflow.com/comment/37435749
accepted answer of: http://stackoverflow.com/q/24201831
type: Answer
score: 0

http://stackoverflow.com/comment/37209134
type: QuestionComment
comment on: http://stackoverflow.com/q/24116549
score: 0
type: Comment
has text: Please post some examples.

http://stackoverflow.com/q/24183561
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24287344
type: Question
tagged with: google-drive-api
has title: Uploading a document to Google Drive and setting its paper size
has body: I use the Java library to upload an HTML file and convert it to native Google document. Here is the code: String title = "Doc title"; byte[] data = &lt;doc data&gt;; ... File fileMetadata = new File(); fileMetadata.setTitle(title); fileMetadata.setMimeType("text/html"); InputStreamContent mediaContent = new InputStreamContent("text/html", new ByteArrayInputStream(data)); mediaContent.setLength(data.length); Drive.Files.Insert insert = service.files().insert(fileMetadata, mediaContent); insert.setConvert(true); MediaHttpUploader uploader = insert.getMediaHttpUploader(); uploader.setDirectUploadEnabled(true); insert.execute(); Works great with one exception - it creates a document with paper size set to Letter. For my account the default is A4 and I want the newly created document to be in this format. Does anyone know a way set the paper size of the uploaded document? Thanks in advance.
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24210228
tagged with: maven
favorite count: 0
type: Question
tagged with: gwt
score: 3
tagged with: google-app-engine
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25554983
has body: I'm looking for advice on how to set up a Google App Engine project that involves multiple modules where one module a GWT project. I've read through Google App Engine module documentation (https://developers.google.com/appengine/docs/java/modules/) and found some help on Stackoverflow such as this post GWT GAE app engine modules using appengine-skeleton-archetype. However, it this involves a lot of pieces so I'd love to get some advice. Platform considerations: Eclipse Google Plugin for Eclipse (https://developers.google.com/eclipse/) Web Tools Platform (https://developers.google.com/appengine/docs/java/webtoolsplatform) Mac Java Google App Engine Modules (https://developers.google.com/appengine/docs/java/modules/) Maven: I'll use it if I have to; I've gone through tutorials for the command-line version but not the Eclipse plugin. Design: Conceptually, I'd like a system that does computationally intensive work that can be scheduled by an end user with nice HTML interface. I really like GWT and the Google Plugin for Eclipse. I just can't figure out how to make it work with modules which allow for indefinite deadlines (as described at https://developers.google.com/appengine/docs/java/modules/#Java_Instance_scaling_and_class) Architecture: 1] GWT user interface: I'd like to use the Google Plugin for Eclipse to generate a basic GWT project because I'm very familiar with Google Plugin for Eclipse. 1.a] I assume it needs to be its own Eclipse project and then added to added to an EAR as described here https://developers.google.com/appengine/docs/java/webtoolsplatform#enterprise_application. 1.b] I assume it needs to be configured with instance scaling Automatic as described here https://developers.google.com/appengine/docs/java/modules/#Java_Instance_scaling_and_class. Do I have to specify Automatic or does it assume Automatic for a GWT module created with the Google Plugin for Eclipse? 2] Basic Scaling Module: I'd like a module that's capable of running for a long time. …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25554983
has title: App Engine Modules with GWT
upvote count: 3
answer count: 1
linked to: http://stackoverflow.com/q/23355325
downvote count: 0

http://stackoverflow.com/comment/37640939
has text: If you don't want this to be closed as a duplicate of another question, you have to explain in your question *why* your question is not a duplicate.
comment on: http://stackoverflow.com/q/24260528
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24141694
linked to: http://stackoverflow.com/q/17899086
accepted answer: http://stackoverflow.com/a/24143106
type: Question
has answer: http://stackoverflow.com/a/24141758
possible better answer: http://stackoverflow.com/a/24141758
answer count: 2
has comment: http://stackoverflow.com/comment/37251968
has comment: http://stackoverflow.com/comment/37255643
has comment: http://stackoverflow.com/comment/37253221
has comment: http://stackoverflow.com/comment/37254817
has comment: http://stackoverflow.com/comment/37255306
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37255253
score: 0
has comment: http://stackoverflow.com/comment/37254202
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/37251887
has title: calling fragment from activity throws null pointer exception- Android
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37255513
has body: I am trying to call a List fragment from fragment activity, I m getting null pointer exception.Here is my code, public class SampleEvents extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample_events); FragmentManager fm = getFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragment_content); if (fragment == null) { FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.fragment_content, new EventsList()); ft.commit(); } } Layout of fragment activity &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;FrameLayout android:id="@+id/fragment_content" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;/LinearLayout&gt; Layout of the fragment event_list &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/empty_TV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textColor="#0c2c0c" android:text="No Announcements Found" android:textStyle="bold" android:textSize="20sp" /&gt; &lt;ListView android:id="@+id/events_list" android:padding="10dip" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;/ListView&gt; &lt;/RelativeLayout&gt; Fragment class public class EventsList extends ListFragment implements android.widget.AdapterView.OnItemClickListener{ View rootView; static SharedPreferences sPrefs; private NetWorkConnection nc; private BaseAlerts alert; private ListView events_listview; private TextView …
has answer: http://stackoverflow.com/a/24143106

http://stackoverflow.com/a/24157642
type: Answer
accepted answer of: http://stackoverflow.com/q/24127176
answers question: http://stackoverflow.com/q/24127176
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has body: You need to: empy field "Unique key (for deletion)" add a field mapping between the primary key of your table with a field of your schema
has comment: http://stackoverflow.com/comment/37319961

http://stackoverflow.com/q/24243593
score: 0
has body: I am using serveResource to allow download files of document library through my portlet. I have also mentioned Content_Length parameter in code: res.addProperty(HttpHeaders.CONTENT_LENGTH, Long.toString(zipFileLength)); Here, res is ResourceResponse. However, it only shows the downloaded size but not the size to be downloaded. This code is working in Mozilla, mozilla is showing total file size and size of data downloaded , but not in Internet Explorer and Chrome.
tagged with: java
type: Question
tagged with: download
has title: Download not showing file size to be downloaded in Liferay portlet
type: UnansweredQuestion
tagged with: http-headers
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/37445952
answer count: 0
has comment: http://stackoverflow.com/comment/37445804

http://stackoverflow.com/q/24248853
has answer: http://stackoverflow.com/a/24249163
has comment: http://stackoverflow.com/comment/37455537
downvote count: 0
tagged with: maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/24342210
tagged with: github
tagged with: git
favorite count: 0
has answer: http://stackoverflow.com/a/24342210
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37455570
score: 1
tagged with: java
has title: Netbeans Maven project from cloned GitHub Java (with jni and C) repository
has body: I cloned the git repository here and I would like to add it as a Maven or NetBeans Java project in NetBeansso I can use it as dependency for other application and to also be able to contribute to the repository. The problem is that after cloning it NetBeans does not allow me to add it as a project. I'm guessing this is because it does not follow the structure of neither Maven, nor Netbeans projects. Is there any way I can add it as a project in NetBeans and still have it liked to the GitHub repository so I can commit and push changes? The project is using Java, jni with C and R (I think).
type: Question
possible better answer: http://stackoverflow.com/a/24249163
tagged with: netbeans
answer count: 2

http://stackoverflow.com/q/24189480
has title: How efficient is Arrays.sort(...) for a 2 Million elements arrays that is already sorted
has answer: http://stackoverflow.com/a/24190132
tagged with: performance
has answer: http://stackoverflow.com/a/24189684
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37341539
has comment: http://stackoverflow.com/comment/37341425
has body: I need to execute another sorting for an array of 2 Million elements using Arrays.sort(..) method. In order not to keep another dirty flag like, I was wondering how costly is this method call for an already sorted array. Any thoughts?
has answer: http://stackoverflow.com/a/24190136
answer count: 4
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: arrays
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24189546
tagged with: sorting
has comment: http://stackoverflow.com/comment/37341541
linked to: http://stackoverflow.com/q/21219777

http://stackoverflow.com/comment/37443853
has text: Yes, I need NESWNESWNESW etc. but now it's NESW only.
type: QuestionComment
comment on: http://stackoverflow.com/q/24241960
score: 0
type: Comment

http://stackoverflow.com/comment/37265516
score: 1
comment on: http://stackoverflow.com/q/24148667
type: Comment
type: QuestionComment
has text: FYI, "Indogo" and "Kepler" are just [different versions](http://en.wikipedia.org/wiki/Eclipse_%28software%29#Releases); "Kepler" is the more recent one.

http://stackoverflow.com/q/24266681
downvote count: 0
answer count: 1
upvote count: 1
favorite count: 0
type: Question
type: AnsweredQuestion
has body: I generated a 3D model with Poser to use it with openGL 1.0 in a Android Application. When I render the mesh I can see the 3D Model as generated in Poser 8, but unfortunately only half of the triangles are rendered - it look like I have to draw some kind of squares instead. Is there any method to mirror the existing triangles so I can draw the missing ones? My mesh is generated from a wavefront object. Therefor I use a class called Mesh public final class Mesh { public enum PrimitiveType { Points, Lines, Triangles, LineStrip, TriangleStrip, TriangleFan } // gl instance private GL10 gl; // vertex position buffer, array private float vertices[]; private int vertexHandle; private FloatBuffer vertexBuffer; // color buffer, array private float colors[]; private int colorHandle; private FloatBuffer colorBuffer; // texture coordinate buffer, array private float texCoords[]; private int texHandle; private FloatBuffer texBuffer; // normal (for illumination) buffer, array private float normals[]; private int normalHandle; private FloatBuffer normalBuffer; // index where next vertices will be inserted private int index = 0; // number vertices for mesh private int numVertices = 0; // renderer support vbos private boolean globalVBO = true; // is mesh dirty private boolean dirty = true; // last mesh private static Mesh lastMesh; // mesh count public static int numMeshes = 0; /** * after calling constructor first set attribute (color, texture, normal), then fix the vertex by calling vertex(...) * * @param gl GL10 * @param numVertices number vertices of mesh * @param hasColors using colors? * @param hasTextureCoordinates using textures coordinates * @param hasNormals using normals? */ public Mesh(GL10 gl, int numVertices, boolean hasColors, boolean hasTextureCoordinates, boolean hasNormals) { this.gl = gl; vertices = new float[numVertices * 3]; int[] buffer = new int[1]; if (!globalVBO) { vertexBuffer = allocateBuffer(numVertices * 3); } else { ((GL11) gl).glGenBuffers(1, buffer, 0…
score: 1
tagged with: android
tagged with: java
has title: Poser Mesh with openGL 1.0, 50 % of Triangles seem to miss
tagged with: opengl-es
accepted answer: http://stackoverflow.com/a/24449666
has answer: http://stackoverflow.com/a/24449666

http://stackoverflow.com/comment/37220514
has text: This doc covers the general idea of entity groups: https://developers.google.com/appengine/docs/java/datastore/structuring_for_strong_consistency. A single kind (in this case Product) is not an Entity Group because updates within an Entity Group are limited to 1 write per second. So if you were implementing a chat server with a "Message" kind, you don't want a limit of 1 message globally per second. Instead, you could have each Message be in an Entity Group for the user who wrote it so that each user is limited to sending 1 message per second.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24111137
type: QuestionComment

http://stackoverflow.com/comment/37203737
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24115822
has text: [FindJar](http://www.findjar.com) can be helpful at times.

http://stackoverflow.com/comment/37385940
type: AnswerComment
comment on: http://stackoverflow.com/a/24212286
score: 1
has text: This seems like a good start, but won't this return the same ordered list each time?
type: Comment

http://stackoverflow.com/a/24166917
type: Answer
has comment: http://stackoverflow.com/comment/37306227
has comment: http://stackoverflow.com/comment/37299523
answers question: http://stackoverflow.com/q/24166292
has comment: http://stackoverflow.com/comment/37300923
has comment: http://stackoverflow.com/comment/37309245
score: 0
has comment: http://stackoverflow.com/comment/37321888
has body: Consider to have unique field other than ID in User table and make a check before persist on that field. For instance it can be username or combination of a few fields.
has comment: http://stackoverflow.com/comment/37300431
has comment: http://stackoverflow.com/comment/37300023
has comment: http://stackoverflow.com/comment/37301160

http://stackoverflow.com/comment/37229919
comment on: http://stackoverflow.com/q/24129436
score: 0
type: QuestionComment
type: Comment
has text: A thought: I haven't been using an extension on the file name. Is one required? I'm on a Mac currently.

http://stackoverflow.com/comment/37279781
has text: Should anyone in the future be interested: I was able to get the functionality I need with `SSHJ's StatefulSFTPClient`, although it's a bit of a work as its documentation is a bit scarce.
comment on: http://stackoverflow.com/q/24155477
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37322367
comment on: http://stackoverflow.com/a/24161971
type: AnswerComment
score: 0
type: Comment
has text: iText 5.5.0 has a dependency on BouncyCastle 1.49. Have you tried that one?

http://stackoverflow.com/a/24198339
type: Answer
has body: Are you applying eclipse-wtp plugin to your Gradle projects using java and war plugin.
answers question: http://stackoverflow.com/q/24188341
score: 0

http://stackoverflow.com/q/24132273
downvote count: 0
has comment: http://stackoverflow.com/comment/37234928
upvote count: 1
has comment: http://stackoverflow.com/comment/37234931
favorite count: 0
type: Question
has body: I am pretty sure this is not doable, but I will go ahead and cross my fingers and ask. I am trying to add a method to a built in class. I want this method to be callable by all of the built in class's subclasses. Specifically: I have a JButton, a JTextPane, and other JComponents. I want to be able to pass in a JDom Element instead of a Rectangle to setBounds(). My current solution is to extend each JComponent subclass with the desired methods, but that is a LOT of duplicate code. Is there a way I can write the following method just one time, and have it callable on all JComponent objects? Or is it required that I extend each subclass individually, and copy and paste the method below? public void setBounds(Element element) { this.setBounds(Integer.parseInt(element.getAttribute( "x").toString()), Integer.parseInt(element .getAttribute("y").toString()), Integer .parseInt(element.getAttribute("width").toString()), Integer.parseInt(element.getAttribute("height") .toString())); }
has comment: http://stackoverflow.com/comment/37234966
tagged with: extends
has comment: http://stackoverflow.com/comment/37234913
tagged with: inheritance
has answer: http://stackoverflow.com/a/24132424
tagged with: code-reuse
has title: Add Method to Built In Class
type: UnansweredQuestion
score: 1
tagged with: java
answer count: 1

http://stackoverflow.com/comment/104202181
has text: @Holger Wow! That is a great example to demo how combiner makes sense in sequential streams. If I am not wrong `return reduce.apply(......)` is working as combiner, right? Also is there a name for this algorithm you are using?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24207431

http://stackoverflow.com/a/24228026
upvote count: 1
has comment: http://stackoverflow.com/comment/37416341
has comment: http://stackoverflow.com/comment/37417342
has comment: http://stackoverflow.com/comment/37417772
has comment: http://stackoverflow.com/comment/37415342
type: Answer
answers question: http://stackoverflow.com/q/24227971
has comment: http://stackoverflow.com/comment/37418299
has body: A format string (mostly) contains things like %d or %s and these items should correspond to expressions following the format string in the method call: these are the "referenced arguments". What error did you get for the Pattern/Matcher call?
has comment: http://stackoverflow.com/comment/37418474
score: 1
downvote count: 0

http://stackoverflow.com/a/24133738
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24133037
has comment: http://stackoverflow.com/comment/37267076
has body: Some thoughts on a little of most .. .. I believe some sort of worker pool or executor service could solve this problem (I have not learned the syntax for this yet). If all the threads take about the same time to process the same amount of data, then there really isn't that much of a "problem" here. However, one nice thing about a Thread Pool is it allows one to rather trivially adjust some basic parameters such as number of concurrent workers. Furthermore, using an executor service and Futures can provide an additional level of abstraction; in this case it could be especially handy if each thread returned a map as the result. The program will only work for a file that contains integers. That's a problem. I struggled with this a lot, as I didn't know how to iterate through the data without creating loads of unused variables (using a String or even StringBuilder had awful performance) .. This sounds like an implementation issue. While I would first try a StreamTokenizer (because it's already written), if doing it manually, I would check out the source - a good bit of that can be omitted when simplifying the notion of a "token". (It uses a temporary array to build the token.) I am using a global ConcurrentHashMap to story key value pairs. .. So is this the proper design? Would I gain in performance by giving each thread it's own hashmap, and then merging them all at the end? It would reduce locking and may increase performance to use a separate map per thread and merge strategy. Furthermore, the current implementation is broken as wordCountMap.put(intbuilder, wordCountMap.get(intbuilder) + 1) is not atomic and thus the operation might under count. I would use a separate map simply because reducing mutable shared state makes a threaded program much easier to reason about. Is there any other way of seeking through a file with an offset without using the class RandomAccessMemory? This class will only read into a byte array, which I then have to convert. I haven't timed t…
type: Answer
has comment: http://stackoverflow.com/comment/37260361
has comment: http://stackoverflow.com/comment/37260373
has comment: http://stackoverflow.com/comment/37267126
has comment: http://stackoverflow.com/comment/37267045
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24133037

http://stackoverflow.com/comment/37319610
comment on: http://stackoverflow.com/q/24177516
score: 2
type: Comment
type: QuestionComment
has text: If you're able to use Java 8, I'd advise you to use the `java.time` classes. Otherwise, I'd advise you to use Joda Time. Note that currently you're trying to find the next Monday (or today - your while loop won't iterate even once if it's already Monday) *in the system time zone*. Is that what you want?

http://stackoverflow.com/comment/37409892
has text: To improve the example add a `CountDownLatch` at the beginning of the run-method so that all tasks start running at more or less the same time. In the current example the first thread could finish before the last thread is starting (creating and starting threads takes time too).
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24223858

http://stackoverflow.com/q/24151021
type: UnansweredQuestion
tagged with: design-patterns
has answer: http://stackoverflow.com/a/24151415
score: 0
tagged with: oop
answer count: 3
tagged with: java
has body: Heirachy: LineEntityType SingleLineEntity BlockEntity Blocks can contain other blocks or single line entities. All entities can have a parent, which is always a BlockEntity I want to do something like this: BlockEntity rootBlock = new BlockEntity(...); block.assignChildren(new LineEntityType[] { new SingleLineEntity(...) new BlockEntity(...) new BlockEntity(...)}); so the parent block object (rootBlock) duplicates each child (defensive copies) and at the same time adds itself as the parent: BlockEntity(LineEntityType[] children) { for(LineEntityType[] children) { //Duplicate the array childEntitiesWithParentAssigned = Arrays.copyOf(children, children.length); //Duplicate each child, adding "this" as the parent for(int i = 0; i &lt; children.length; i++) { child = childEntitiesWithParentAssigned[i]; childEntitiesWithParentAssigned[i] = child.getCopyWithParentAssigned(this); } } } This is what I have so far, but it's unacceptable because the parent class, LineEntityType has multiple references to the child type, BlockEntity (circular dependency). public abstract class LineEntityType { private final BlockEntity parent; public LineEntityType(...) { this(..., null); //Root entity } public LineEntityType(..., BlockEntity parent) { this.parent = parent; } ... public abstract LineEntityType getCopyWithParentAssigned(BlockEntity parent); } The only other thing I've come up with is to explicitely assign the parent before assigning its children: //null: No parent BlockEntity rootBlock = new BlockEntity(..., null); LineEntityType children = new LineEntityType[] { new SingleLineEntity(..., rootBlock) new BlockEntity(..., rootBlock) new BlockEntity(..., rootBlock)}); rootBlock.setChildren(children); But this requires the children field to be mutable. Any ideas on how to rethink this, so the parent-field can be assigned by the parent, yet be immutable and avoid circular dependencies? Thanks.
has answer: http://stackoverflow.com/a/24152144
has answer: http://stackoverflow.com/a/24151250
has title: How to design entire hierarchy to have an *immutable* parent-field, when the parent-type is always a sub-class?
type: Question

http://stackoverflow.com/comment/37231306
type: Comment
has text: @JustKidding You should use ProcessBuilder and set the "directory" property to set the start location of the program
comment on: http://stackoverflow.com/a/24130194
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37253655
type: AnswerComment
score: 0
has text: Yes you can do with the same: ok can u show me ur current o/p and expected o/p?
comment on: http://stackoverflow.com/a/24139006
type: Comment

http://stackoverflow.com/a/24219114
answers question: http://stackoverflow.com/q/24219020
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37398396
has comment: http://stackoverflow.com/comment/37440325
has body: first you have to declare largeheap size in your manifest.and use the bitmap recycle according to your code. for manifest.xml android:largeHeap="true" if (bm != null) { bm.recycle(); bm = null; } hope it will work for you.
has comment: http://stackoverflow.com/comment/37398494

http://stackoverflow.com/q/24228650
tagged with: design-principles
tagged with: java
possible better answer: http://stackoverflow.com/a/24228667
favorite count: 0
has answer: http://stackoverflow.com/a/24228667
type: Question
has body: Let say I have 2 classes called class Cow ad class Pig. They both implements interface Animal. For the interface there are only 2 methods called public void eat() and public void speak(). All is fine. But while this seems good making use of interfaces, I thought that if I ever needed to add method(s) to this interface, implementation would break, namely I would need to go implement the new methods in these classes, which breaks the "close-open principle". So I thought of, in addition to interface, I would make use of abstract class as well, should it be needed that I needed to add new method(s) in the future. So, for example, public class Cow extends ... implements Animal. It sounds like a good plan (if it is not, please correct me). But the problem is, what if these classes extend already some other class? In such case, I could not extend 2 classes. So my question is: Is there a pattern where I could declare a common interface of related classes while withholding the ability to add new methods in the future that doesn't break the "closed-open principle" and doesn't break implementations?
answer count: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/24228674
downvote count: 0
has answer: http://stackoverflow.com/a/24228674
has title: Add methods to classes without breaking implementations
tagged with: design-patterns
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37416288

http://stackoverflow.com/q/24218532
downvote count: 0
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/37576507
has comment: http://stackoverflow.com/comment/37399416
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37397726
has comment: http://stackoverflow.com/comment/37399635
score: 1
tagged with: java
has body: I am developing a simple Remote Administration Tool using CORBA. This is my server code. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package simrat; import SimRATApp.SimRAT; import SimRATApp.SimRATHelper; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JDialog; import javax.swing.JOptionPane; import org.omg.CORBA.ORB; import org.omg.CORBA.ORBPackage.InvalidName; import org.omg.CosNaming.NameComponent; import org.omg.CosNaming.NamingContextExt; import org.omg.CosNaming.NamingContextExtHelper; import org.omg.CosNaming.NamingContextPackage.CannotProceed; import org.omg.CosNaming.NamingContextPackage.NotFound; import org.omg.PortableServer.POA; import org.omg.PortableServer.POAHelper; import org.omg.PortableServer.POAManagerPackage.AdapterInactive; import org.omg.PortableServer.POAPackage.ServantNotActive; import org.omg.PortableServer.POAPackage.WrongPolicy; /** * * @author Rumesh */ public class Server { public SimRATMain sim; public static void main(String[] args) { try { try { Runtime.getRuntime().exec("orbd -ORBInitialPort 1059 -port 1032 -ORBInitialHost localhost"); } catch (IOException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); } //String[] args = {}; ORB orb = ORB.init(args, null); POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootpoa.the_POAManager().activate(); SimRATImpl impl = new SimRATImpl(); impl.setORB(orb); org.omg.CORBA.Object ref = rootpoa.servant_to_reference(impl); SimRAT href = SimRATHelper.narrow(ref); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); NameComponent path[] = ncRef.to_name("SimRAT"); ncRef.rebind(path, href); System.out.println("Server Ready and waiting..."); JOptionPane.showMessageDialog(null, "Server created successfully", "SimRAT Server", 1); orb.run(); } catch (In…
has comment: http://stackoverflow.com/comment/37397859
has answer: http://stackoverflow.com/a/37576507
tagged with: corba
tagged with: distributed-computing
has title: Corba ORBD error
has comment: http://stackoverflow.com/comment/37399535
type: Question
has comment: http://stackoverflow.com/comment/37399737

http://stackoverflow.com/q/24210134
accepted answer: http://stackoverflow.com/a/24210208
upvote count: 1
has comment: http://stackoverflow.com/comment/37381598
tagged with: jprogressbar
answer count: 1
downvote count: 0
favorite count: 0
has title: NetBeans - Need assistance in updating jProgressBar from autogenerated code
type: Question
tagged with: netbeans-6.9
has answer: http://stackoverflow.com/a/24210208
score: 1
has body: (Ignore following sentence - I was being dumb). I have a feeling that I am calling the updates to my jProgressBar on the EDT (which I know is wrong). @Action public Task launchScenario() { return new LaunchScenarioTask(getApplication()); } private class LaunchScenarioTask extends org.jdesktop.application.Task&lt;Object, Void&gt; { LaunchScenarioTask(org.jdesktop.application.Application app) { super(app); launchTestCaseButton.setEnabled(false); progressBar.setIndeterminate(false); statusPanel.validate(); statusPanel.repaint(); totalTests = scenarioRepeat * selectedSSIDS.length; setProgress(0); } @Override protected Object doInBackground() { currentScenario = 1; progressBar.setMaximum(totalTests); progressBar.setMinimum(0); try { Thread.sleep((long) 500); } catch (InterruptedException ignore) { } int ssidsToTest = selectedSSIDS.length; //For every SSID, we iterate through and create an autoconnector object for (int counter = 0; counter &lt; ssidsToTest; counter++) { try { setMessage("Preparing " + selectedSSIDS[counter] + " test case..."); Thread.sleep((long) 2000); } catch (InterruptedException ignore) { } setMessage("Launching "); AutoConnector ac = new AutoConnector(selectedSSIDS[counter]); for (int i = 0; i &lt; scenarioRepeat; i++) { if (ac.connected()) { setMessage("Running test " + currentScenario + "/" + totalTests); currentScenario++; passedTests++; } else { currentScenario++; failedTests++; } System.out.println("setting progress"); setProgress((currentScenario / totalTests) * 100); progressBar.setString((currentScenario / totalTests) * 100 + "% complete"); } } try { Thread.sleep((long) 500); } catch (InterruptedException ignore) { } return null; // return your result } @Override protected void succeeded(Object result) { launchTestCaseButton.setEnabled(true); setMessage("Complete. " + passedTests + " tests passed and " + failedTests + " tests failed."); } } I know for a fact (and feel a bit bad) that I'm calling the updates (setProgress() and setMessage() in …
tagged with: java
has comment: http://stackoverflow.com/comment/37381527
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/comment/37492357
score: 0
type: AnswerComment
has text: Ok, but, is it possible to do what I asked for? could you please show me the code?
comment on: http://stackoverflow.com/a/24267539
type: Comment

http://stackoverflow.com/comment/37227332
score: 0
type: Comment
type: QuestionComment
has text: the `SELF extends ITree<SELF>` bound is useless. It should just be `SELF`.
comment on: http://stackoverflow.com/q/24119122

http://stackoverflow.com/comment/37190151
has text: @SLaks: Can I ask you a really quick question please? Apparently, I can override the hashCode () which I did not know... Do I use that method in my constructor? I mean, do I assign hash code in the constructor? Thanks
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24108391
score: 0

http://stackoverflow.com/comment/37441238
comment on: http://stackoverflow.com/a/24224485
score: 0
has text: You do not now have a list of 10 items, but a list of 9 items. Re-ordering on the index numbers will automatically close the gap, moving the old 8 to position 7 etc. and leaving a gap at 10.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37291888
type: AnswerComment
comment on: http://stackoverflow.com/a/24162963
has text: Look pls, there is .setItems(items, null); and there is no way to do this Html.fromHtml
type: Comment
score: 0

http://stackoverflow.com/comment/37296127
type: Comment
type: AnswerComment
score: 0
has text: I can not find a method that give me this information. Wich method is the right one?
comment on: http://stackoverflow.com/a/24164983

http://stackoverflow.com/comment/37352369
type: Comment
type: QuestionComment
score: 0
has text: By the way, I don't normally have `JAVA_HOME` set when I bring up a Command Prompt window, and the compiler still runs just fine. I think this environment variable is needed for other installations that depend on Java, though. But not for the Java compiler itself.
comment on: http://stackoverflow.com/q/24194822

http://stackoverflow.com/q/24135301
has body: I have a MessageBean which reads from a Queue we'll name MainQ. If the execution of the onMessage code throws a user-based Exception with a type we'll name UserException I want to catch this and put this message on a separate Queue named UserErrorQ. If the exception is not of this type, the Exception is thrown on to be handled by the DMQ. Here is my issue: in my catch block I attempt, through a ErrorQueueHandler, to put this new message on the UserErrorQ. This results in an error when I attempt to connect to the connectionFactory to send the message to the UserErrorQ. Apparently creating a new connection to a QueueConnectionFactory(javax.jms.ConnectionFactory) is causing problems Error: com.sun.messaging.jms.JMSException: MQRA:DCF:allocation failure:createConnection:Error in allocating a connection. Cause: javax.transaction.RollbackException at com.sun.messaging.jms.ra.DirectConnectionFactory._allocateConnection(DirectConnectionFactory.java:548) at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:265) at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:244)` MessageBean: @TransactionAttribute(TransactionAttributeType.REQUIRED) public void onMessage(Message message) { try{ . . }catch(Exception e){ if(isUserExceptionWrappedInException(e){ errorQueueHandler.sendToErrorQueue(message); } } } private boolean isUserExceptionWrappedInException(Throwable t) { if (t == null) return false; else if (t instanceof UserException) return true; else return isUserExceptionWrappedInException(t.getCause()); } ErrorQueueHandler: public void sendToErrorQueue(Message message) { try { createConnection(); send((TextMessage)message); } finally { closeConnection(); } } private void createConnection() throws Exception { try { connection = connectionfactory.createConnection(); connection.start(); } catch (JMSException e) { String msg = "Error while attempting to initialize connection to jms destination "…
has title: Problems with routing message to separate errorQueue
accepted answer: http://stackoverflow.com/a/24182398
has answer: http://stackoverflow.com/a/24182398
type: AnsweredQuestion
tagged with: java
score: 0
tagged with: jms
has comment: http://stackoverflow.com/comment/37240372
answer count: 1
has comment: http://stackoverflow.com/comment/37242031
type: Question
tagged with: openmq
tagged with: glassfish

http://stackoverflow.com/comment/37330739
has text: @user3654540 The moral of the story is: if the system tells you you have a syntax error, check the syntax. :)
score: 1
type: Comment
comment on: http://stackoverflow.com/a/24169747
type: AnswerComment

http://stackoverflow.com/a/24157433
type: Answer
accepted answer of: http://stackoverflow.com/q/24157345
has body: You are just closing the stream and not the connection, use the following structure: URL u = new URL(url); HttpURLConnection conn = (HttpURLConnection) u.openConnection(); conn.connect(); reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); and then: } finally { if (reader != null) try { reader.close(); } catch (IOException e) { Log.e(CLASS_NAME, "getPageText.IOException", e); } } try { if (conn != null) { conn.disconnect(); } } catch (Exception ex) {} }
answers question: http://stackoverflow.com/q/24157345
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37281940
has comment: http://stackoverflow.com/comment/37281722
has comment: http://stackoverflow.com/comment/37281992
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/37332989
has text: want to create it using JAXB - marshalling. I have the 'values' in place, want to write everything into the xml format.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24185025

http://stackoverflow.com/a/24186856
has comment: http://stackoverflow.com/comment/37353075
has body: Try Joda Time library for Java.
answers question: http://stackoverflow.com/q/24186801
upvote count: 3
score: 1
has comment: http://stackoverflow.com/comment/37336900
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37337190

http://stackoverflow.com/q/24174882
accepted answer: http://stackoverflow.com/a/24174954
tagged with: debugging
tagged with: android
has body: I have two Android projects, one is a library and the other one is the application. I wrote the library myself and I add this library into my application. The problem I have right now is when I debug , it keeps going into the library and it is slowing down my debug process tremendously. Is there a way to stop this from happening?
has title: How to stop Eclipse from debugging into our library code
has answer: http://stackoverflow.com/a/24174954
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
tagged with: eclipse
favorite count: 0
type: Question

decode
tag name: decode
tags question: http://stackoverflow.com/q/24254527
tags question: http://stackoverflow.com/q/24193648
type: Tag

http://stackoverflow.com/q/24130608
upvote count: 0
has comment: http://stackoverflow.com/comment/37232245
has answer: http://stackoverflow.com/a/24130648
type: UnansweredQuestion
has title: Example on how to write a bump method
score: -3
answer count: 1
has body: I have to write a command called bump with a parameter n. It should Move the nth person in the queue to the front of the queue. Bump should be a void method that accepts the parameter n. The implementation is cleanest if a stack is used to store the temporarily removed names so they can be placed back on the queue in the proper order. Alternatively, you can just adjust pointers as needed, but be careful. Here is what i have, but it keeps throwing a null pointer exception. Any help is greatly appreciated public void bump(int n) { LinearNode&lt;T&gt; current = head; int i = 1; while (i != n) { current = current.getNext(); } head.setElement(current.getElement()); }
tagged with: java
downvote count: 3
tagged with: queue
favorite count: 0
type: Question

build
tag name: build
tags question: http://stackoverflow.com/q/24254487
tags question: http://stackoverflow.com/q/24259160
tags question: http://stackoverflow.com/q/24132783
tags question: http://stackoverflow.com/q/24214102
type: Tag
tags question: http://stackoverflow.com/q/24123003
tags question: http://stackoverflow.com/q/24263941
tags question: http://stackoverflow.com/q/24231207
tags question: http://stackoverflow.com/q/24164929
tags question: http://stackoverflow.com/q/24206013

http://stackoverflow.com/q/24222905
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/37406008
tagged with: variadic-functions
has comment: http://stackoverflow.com/comment/37405956
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37405667
score: -2
has title: How are varargs interpreted in Java?
tagged with: java
has body: Say I have these methods: public void a(String string, Object ... objects) { //Code... } public void a(Object ... objects) { notNull("Some String", objects); } Will a call to the a method with only one parameter work? Or will the overloaded method with the string and the vararg take the array from the method with only a vararg as the first object in it's list(making it objects[0][...]) ? Thanks for your help!
has comment: http://stackoverflow.com/comment/37405883
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37405752
accepted answer: http://stackoverflow.com/a/24223175
upvote count: 0
has answer: http://stackoverflow.com/a/24223175
downvote count: 2

http://stackoverflow.com/comment/37286381
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24160190
has text: Thanks for answer. Just like to know, how can I throw an exception for this?

http://stackoverflow.com/comment/37484911
comment on: http://stackoverflow.com/q/24234938
has text: There should be some stacktrace logged. Anyhow, it is weird that you didn't implement an `create()` method in your screen. You should initialize stage etc. there instead of inside show().
score: 0
type: Comment
type: QuestionComment

while-loop
tags question: http://stackoverflow.com/q/24107571
type: Tag
tags question: http://stackoverflow.com/q/24112514
tags question: http://stackoverflow.com/q/24122862
tags question: http://stackoverflow.com/q/24201530
tags question: http://stackoverflow.com/q/24137160
tags question: http://stackoverflow.com/q/24258162
tags question: http://stackoverflow.com/q/24241960
tags question: http://stackoverflow.com/q/24112237
tags question: http://stackoverflow.com/q/24130399
tags question: http://stackoverflow.com/q/24173016
tag name: while-loop

http://stackoverflow.com/comment/37207206
type: Comment
has text: @Payeli I dont want to port the entire awt lib to android or anything. I just want to know how to set a `Matrix` to an `identity` matrix for example. In awt I can do `.setToIdentity()`. But Android doesn't have to method on a `Matrix` object. So there must be some other way to do it. Since settings matrices to an identity matrix isn't uncommon at all.
score: 0
comment on: http://stackoverflow.com/q/24117071
type: QuestionComment

http://stackoverflow.com/q/24151148
downvote count: 5
score: -1
has body: I am performing unit tests across a large system, made up of hundreds of different .java files, all forming the back-end. In my unit tests, should I pass the variables as they are from the other methods (calling the methods within my test method) or do I test using values that are created/declared in the test method? I'm thinking that I should come up with values specifically for the test method since these are unit tests and I am trying to test each method in isolation, but I'm not certain about this. Do I need to copy the functions exactly that fetch said data into the unit tests?
possible better answer: http://stackoverflow.com/a/24151389
upvote count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24151444
answer count: 2
has answer: http://stackoverflow.com/a/24151389
has answer: http://stackoverflow.com/a/24151444
tagged with: java
tagged with: junit
has title: What sources of data/parameters should I use when Unit testing?
tagged with: unit-testing
favorite count: 0
type: Question

http://stackoverflow.com/a/24199345
has body: As mentioned in the comments, I'm not convinced that ConcurrentHashMap behaviour is "well understood". The assertion made in your unattributed quote is not true for ConcurrentHashMap. The iterator for a ConcurrentHashMap is weakly consistent... the javadoc states: Iterators, Spliterators and Enumerations return elements reflecting the state of the hash table at some point at or since the creation of the iterator/enumeration. In light of this, The short answer to your question 1 is: no, it does not get its own copy of the map The short answer to your question 2 is: that it doesn't "behave consistently" Here are some other pertinent quotes from the javadocs that help explain the implementation: The basic strategy is to subdivide the table among Segments, each of which itself is a concurrently readable hash table... Segments maintain a table of entry lists that are always kept in a consistent state, so can be read (via volatile reads of segments and tables) without locking. This requires replicating nodes when necessary during table resizing, so the old lists can be traversed by readers still using old version of table. Node replication occurs for each Segment in its rehash method. The javadocs for the Segment.rehash() method explain the functionality: Reclassify nodes in each list to new table. Because we are using power-of-two expansion, the elements from each bin must either stay at same index, or move with a power of two offset. We eliminate unnecessary node creation by catching cases where old nodes can be reused because their next fields won't change. Statistically, at the default threshold, only about one-sixth of them need cloning when a table doubles. The nodes they replace will be garbage collectable as soon as they are no longer referenced by any reader thread that may be in the midst of concurrently traversing table. Entry accesses use plain array indexing because they are followed by volatile table write. Please see Richard Burnison's excellent article for…
type: Answer
answers question: http://stackoverflow.com/q/24197375
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24197375

http://stackoverflow.com/comment/46618765
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/29203696
has text: This also seemed to have solved my imports not showing as an auto-import option issue... odd
type: Comment

http://stackoverflow.com/comment/37232065
score: 0
comment on: http://stackoverflow.com/q/24119416
has text: You have to either define the JAR as an EAR library and the WARs as modules of the EAR application. Or you can define the JAR file as a Shared Library and then reference from any WAR/EAR file.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24134594
tagged with: opencv
upvote count: 0
answer count: 2
has body: I was writing a program to resize an image while preserving the aspect ratio. Basically, I'm trying to get the source image into a 20x20 box with the aspect ratio preserved. float ra= (float)20/image.width(); Size dsize = new Size((int)(image.height()*ra),20); // System.out.println(image.height() + " "+image.width()); //System.out.println((int)(image.height()*ra)+" " + 20); Imgproc.resize(image,output, dsize,ra,ra, Imgproc.INTER_LINEAR); The input, image is a Mat. image.height()=10, image.width()=28. The new size would be 7,20. However when i run the code I get a null pointer exception at Imgproc.resize(). I am unable to find the reason. I get the same error even if I run Imgproc.resize(image,output,dsize);
tagged with: java
downvote count: 1
linked to: http://stackoverflow.com/q/218384
favorite count: 0
has comment: http://stackoverflow.com/comment/37240752
type: Question
has answer: http://stackoverflow.com/a/24157452
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/24134678
has title: Null Pointer exception when using resize Open Cv Java
score: -1

http://stackoverflow.com/q/24190125
downvote count: 0
has comment: http://stackoverflow.com/comment/37350665
answer count: 0
tagged with: java
tagged with: hibernate
has body: TLDR : during a multithreaded massive database insertion, multiple thread are waiting for no evident reason. We need to create multiple rows in a database. To speed up insertion, we use multithreading so that multiple objects can be generated and inserted in parallel. We are using Hibernate, Spring batch and Spring scheduling (ThreadPoolTaskExecutor, Partitioner, ItemProcessor). We started from this example. We looked at thread states with JVisualVM and noticed that there are never more than 8 active threads at a time, whatever the hardware running the program. We tried "standard desktop" computers (dual core), but also two AIX : one with 8 active CPU, one with 60 active CPUs. Any idea why we can't have more than 8 working threads at a time? A list of things we already checked: All threads have a work to do (Partitioner and ThreadPoolTaskExecutor are configured so that each thread has the same amount of data to insert in DB). We tried various commit-interval : 1, P where P is the size of the partition, N where N is the sum of all P (it should not be the cause of the problem, but commiting data seems to be the long part of the job while data generation is fast). 8 is not a default value of any object's parameter we use.
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37349177
has comment: http://stackoverflow.com/comment/37350713
has comment: http://stackoverflow.com/comment/37344533
has title: Multiple threads waiting for nothing?
type: UnansweredQuestion
tagged with: multithreading
tagged with: spring
tagged with: spring-batch
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37370681

http://stackoverflow.com/comment/67345887
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/40023542
score: 2
has text: You can programatically add an Appender but if monitorInterval is set then the added appender will be lost if changes are made to the configuration file.

http://stackoverflow.com/a/24188179
has comment: http://stackoverflow.com/comment/37339138
upvote count: 1
has comment: http://stackoverflow.com/comment/37339125
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/37339874
has comment: http://stackoverflow.com/comment/37339178
downvote count: 2
has comment: http://stackoverflow.com/comment/37339214
has comment: http://stackoverflow.com/comment/37339038
answers question: http://stackoverflow.com/q/24188078
has comment: http://stackoverflow.com/comment/37344007
has body: ...why the equals method on the generic T is assuming it's a Long. The reason is simple: Assuming the matrix you're testing with is of type Matrix&lt;Long&gt;, then t1 is an instance of Long (the generic type just allows you to use Long here and has no relevance at runtime) and thus Long.equals() would be called. In the following case Integer.equals() should be called: Matrix&lt;Integer&gt; m1 = ...; Matrix&lt;Long&gt; m2 = ...; m1.equals( m2 ); Since members of m1 are of type Integer, the call t1.equals(t2) would have the signature Integer.equals(Long). So what could you do to be able to get two matrices of different types but with equal values to be equal? The general problem would be that you should use compareTo() to check for value equality (since in some cases like BigDecimal mathematically equal values like 2.0 and 2.00 would not result in equals() returing true. Unfortunately using T extends Number &amp; Comparable&lt;T&gt; would not be an option (see the comments for reference, as well as here: Why doesn&#39;t java.lang.Number implement Comparable?), because you would not be able to call Long.compareTo(Integer) that way. Thus you'd either have to fall back to primitive values and distinguish between integer and floating point values (thus calling t1.longValue() or t1.doubleValue()) or use a Comparator&lt;Number&gt; whose implementation of compareTo(Number lhs, Number rhs) would handle that. (There should be ready to use Comparators like this: http://www.jidesoft.com/javadoc/com/jidesoft/comparator/NumberComparator.html). If you want to support larger numbers like BigInteger and BigDecimal you could also consider using BigDecimal and create an instance for every value. This should result in some flexibility but would also incur some performance cost. (Disclaimer: this is just an untested idea so don't just take it as is, it is just meant to provide some input for your own thought process).
has comment: http://stackoverflow.com/comment/37338952
has comment: http://stackoverflow.com/comment/37339722
has comment: http://stackoverflow.com/comment/37341755

http://stackoverflow.com/a/24143902
type: Answer
accepted answer of: http://stackoverflow.com/q/24143765
has body: If you need to keep trace of your action instances (i.e. for logs), use the Factory Pattern: public class ActionFactory{ public Action createAction(String type){ if (type.equals("MOVE")) return new ActionMove(); if (type.equals("KILL")) return new ActionKill(); ... // so on for the other types return null; //if the type doesn't have any of the expected values } ... }
has comment: http://stackoverflow.com/comment/37256698
upvote count: 4
answers question: http://stackoverflow.com/q/24143765
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/37256474
has comment: http://stackoverflow.com/comment/37256331

http://stackoverflow.com/a/24130480
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24130077
answers question: http://stackoverflow.com/q/24130077
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: You need to include a SurfaceView in your layout, and use setPreviewDisplay() and startPreview(). This will draw the camera's input in your Activity. You should check the developer guides, and also take a look at Android - Camera Preview

http://stackoverflow.com/q/24135045
tagged with: camera
has title: Taking pictures at regular intervals (Android Camera API)
tagged with: android
has comment: http://stackoverflow.com/comment/37243212
score: 4
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37240284
downvote count: 0
accepted answer: http://stackoverflow.com/a/24136842
tagged with: java
answer count: 1
favorite count: 0
has body: So I'm trying to take multiple pictures at regular time intervals, however I get a "takePicture Failed" Exception after the first picture is previewed on the surfaceView. Here's my takePictures() method which is called when a button is pressed: public void takePictures() { if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { camera = Camera.open(); if (camera != null) { try { camera.setPreviewDisplay(surfaceView.getHolder()); camera.startPreview(); camera.takePicture(null, null, new CustomPictureCallbcak(this, cacheDir, imageView, 3, 5000)); } catch (Exception e) { e.printStackTrace(); } } } else { Toast.makeText(this, "No camera found.", Toast.LENGTH_SHORT).show(); } } And here's the onPictureTaken() method of CustomPictureCallback : @Override public void onPictureTaken(byte[] data, Camera camera) { //get date info for file name SimpleDateFormat sdf = new SimpleDateFormat("ddmmyyyyhhmmss"); String date = sdf.format(new Date()); String fileDir = createImageFileName(date); //write the image to cache writeImageToCache(fileDir, data); //display file name in a toast notification Toast.makeText(c, fileDir, Toast.LENGTH_SHORT).show(); //show picture on imageview imageView.setImageBitmap(BitmapFactory.decodeByteArray(data, 0, data.length)); //retake images this.camera = camera; while (numOfImagesAlreadyTaken &lt;= numOfImages) { Thread thread = new Thread() { @Override public void run() { // TODO Auto-generated method stub super.run(); try { numOfImagesAlreadyTaken++; CustomPictureCallbcak.this.camera.stopPreview(); sleep(delay); CustomPictureCallbcak.this.camera.takePicture(null, null, CustomPictureCallbcak.this); } catch (InterruptedException e) { e.printStackTrace(); } } }; thread.start(); } Toast.makeText(c, "Total images taken: " + numOfImagesAlreadyTaken, Toast.LENGTH_SHORT).show(); //release camera camera.release(); camera = null; }
type: Question
has comment: http://stackoverflow.com/comment/37240153
has comment: http://stackoverflow.com/comment/37241962
has answer: http://stackoverflow.com/a/24136842

http://stackoverflow.com/a/24238130
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37447288
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37447963
upvote count: 1
has body: Since the button is stateless (the renderer is used as a rubber stamp) it won't work quite that way. The trick is to listen to the action performed on the List then try to detect there if the button was pressed. If you use a GenericListCellRenderer (all renderers created via the GUI builder use that) you can just cast the renderer instance to GenericListCellRenderer then invoke extractLastClickedComponent() and assuming the button returned isn't null check if it matches the link button. If not you need to bind an action listener to the link button and toggle a flag (link pressed) then in the action listener of the list if that flag was set toggle it back and perform the appropriate logic. The reasoning is that you get the button event which is stateless, the list event is the part that matters. See http://www.codenameone.com/3/post/2013/12/deeper-in-the-renderer.html
answers question: http://stackoverflow.com/q/24233279
has comment: http://stackoverflow.com/comment/37456588
accepted answer of: http://stackoverflow.com/q/24233279

http://stackoverflow.com/a/24119213
score: 0
type: Answer
has body: You can achieve this using Pivot function if your Oracle version is 11g + Query : with Artifact (Environment_Name, Artifact_Name, Build_Id) as ( select 'UAT 2', 'aecacs.ear', '147634-CBOL-9.0.1-APP-Team-Build-243' from dual union all select 'UAT 2', 'gbcr.ear', '147634-CBOL-9.0.1-APP-Team-Build-244' from dual union all select 'UAT 2', 'esms.ear', '147634-CBOL-9.0.1-APP-Team-Build-23' from dual union all select 'UAT 2', 'framework.ear', '147634-CBOL-9.0.1-APP-Team-Build-156' from dual union all select 'SIT 2', 'ecr.ear', '147634-CBOL-9.0.1-APP-Team-Build-198' from dual union all select 'SIT 2', 'aecacs.ear', '147634-CBOL-9.0.1-APP-Team-Build-33' from dual union all select 'SIT 2', 'gbcr.ear', '147634-CBOL-9.0.1-APP-Team-Build-56' from dual union all select 'SIT 2', 'ci.ear', '147634-CBOL-9.0.1-APP-Team-Build-87' from dual union all select 'SIT 2', 'co.ear', '147634-CBOL-9.0.1-APP-Team-Build-22' from dual union all select 'DIT 2', 'aecacs.ear', '147634-CBOL-9.0.1-APP-Team-Build-158' from dual union all select 'DIT 2', 'esms.ear', '' from dual union all select 'DIT 2', 'build.ear', '' from dual) ------------ ----End of data preparation ------------ select artifact_name, coalesce(UAT2, 'Not Found') as UAT2, coalesce(SIT2, 'Not Found') as SIT2 from Artifact pivot (min(Build_Id) for environment_name in ('UAT 2' as UAT2, 'SIT 2' as SIT2)); Output | ARTIFACT_NAME | UAT2 | SIT2 | |---------------|--------------------------------------|--------------------------------------| | esms.ear | 147634-CBOL-9.0.1-APP-Team-Build-23 | Not Found | | aecacs.ear | 147634-CBOL-9.0.1-APP-Team-Build-243 | 147634-CBOL-9.0.1-APP-Team-Build-33 | | gbcr.ear | 147634-CBOL-9.0.1-APP-Team-Build-244 | 147634-CBOL-9.0.1-APP-Team-Build-56 | | framework.ear | 147634-CBOL-9.0.1-APP-Team-Build-156 | Not Found | | co.ear | Not Found | 147634-CBOL-9.0.1-APP-Team-Build-22 | | ecr.ear | Not Found | 147634-CBOL-9.0.1-APP-Team-Build-198 | | ci.ear | Not Found | 147634-CBOL-9.0.1-APP-Team-Build-87 | | build.ear…
answers question: http://stackoverflow.com/q/24118882
has comment: http://stackoverflow.com/comment/37209916

http://stackoverflow.com/q/24218485
score: 0
has answer: http://stackoverflow.com/a/24223416
type: UnansweredQuestion
tagged with: java
answer count: 1
type: Question
tagged with: gwt
has title: Custom Event in GWT widget is not working
tagged with: vaadin7
has body: I am working on application in Vaadin for my classes. I have to draw some map on the screen so I'm using gwt-graphics lib. I have also some servlet which is waiting for requests. When some specific request will come view of the map should be changed. It lead me to prepare custom event: // class NewModulePositionHandler package com.example.locator; import com.google.gwt.event.shared.EventHandler; public interface NewModulePositionHandler extends EventHandler { void onNewModulePosition(NewModulePositionEvent event); } Below implementation of my custom event: import com.google.gwt.event.shared.GwtEvent; public class NewModulePositionEvent extends GwtEvent&lt;NewModulePositionHandler&gt; { private static final Type&lt;NewModulePositionHandler&gt; TYPE = new Type&lt;NewModulePositionHandler&gt;(); private final String m_Color; public NewModulePositionEvent(String color) { m_Color = color; } public static Type&lt;NewModulePositionHandler&gt; getType() { return TYPE; } public String getColor() { return m_Color; } @Override public com.google.gwt.event.shared.GwtEvent.Type&lt;NewModulePositionHandler&gt; getAssociatedType() { // TODO Auto-generated method stub return TYPE; } @Override protected void dispatch(NewModulePositionHandler handler) { handler.onNewModulePosition(this); } } And it's time for implementation of my custom widget: a) MyComp.java import com.google.gwt.event.shared.GwtEvent; public class NewModulePositionEvent extends GwtEvent&lt;NewModulePositionHandler&gt; { private static final Type&lt;NewModulePositionHandler&gt; TYPE = new Type&lt;NewModulePositionHandler&gt;(); private final String m_Color; public NewModulePositionEvent(String color) { m_Color = color; } public static Type&lt;NewModulePositionHandler&gt; getType() { return TYPE; } public String getColor() { return m_Color; } @Override public com.google.gwt.event.shared.GwtEvent.Type&lt;NewModulePositionHandler&gt; getAssociatedType() { // TODO Auto-generated method stub return TYPE; } @Override prote…

http://stackoverflow.com/a/24228334
accepted answer of: http://stackoverflow.com/q/24228279
has comment: http://stackoverflow.com/comment/37421161
has body: Optional&lt;User&gt;.ifPresent() takes a Consumer&lt;? super User&gt; as argument. You're passing it an expression whose type is void. So that doesn't compile. A Consumer is intended to be implemented as a lambda expression: Optional&lt;User&gt; user = ... user.ifPresent(theUser -&gt; doSomethingWithUser(theUser)); Or even simpler, using a method reference: Optional&lt;User&gt; user = ... user.ifPresent(this::doSomethingWithUser); This is basically the same thing as Optional&lt;User&gt; user = ... user.ifPresent(new Consumer&lt;User&gt;() { @Override public void accept(User theUser) { doSomethingWithUser(theUser); } }); The idea is that the doSomethingWithUser() method call will only be executed if the user is present. Your code executes the method call directly, and tries to pass its void result to ifPresent().
score: 233
type: Answer
has comment: http://stackoverflow.com/comment/37417570
answers question: http://stackoverflow.com/q/24228279
has comment: http://stackoverflow.com/comment/37416003
has comment: http://stackoverflow.com/comment/37415974
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37416026
has comment: http://stackoverflow.com/comment/89561805
upvote count: 233
has comment: http://stackoverflow.com/comment/37423517
has comment: http://stackoverflow.com/comment/37416268

http://stackoverflow.com/comment/37345665
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24191329
type: Comment
has text: in regards to "classes but not really classes", I'm actually not entirely certain what they are other than each contains a toString() method that, from what I'm lead to believe, are appended to the end of a related class. Why they aren't part of those classes to start, you got me, I didn't develop the project. The hesitation I have of including these even in the resources is when this is made a jar, we don't really care about them, as they would have been appended to the aforementioned classes well before a binary is created via an Ant script (I think).

http://stackoverflow.com/q/24263904
has answer: http://stackoverflow.com/a/35599623
has answer: http://stackoverflow.com/a/24273269
type: AnsweredQuestion
upvote count: 68
score: 68
downvote count: 0
favorite count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Deserializing polymorphic types with Jackson based on the presence of a unique property
has answer: http://stackoverflow.com/a/65390038
accepted answer: http://stackoverflow.com/a/24265399
has body: If I have a class structure like so: public abstract class Parent { private Long id; ... } public class SubClassA extends Parent { private String stringA; private Integer intA; ... } public class SubClassB extends Parent { private String stringB; private Integer intB; ... } Is there an alternative way to deserialize different then @JsonTypeInfo? Using this annotation on my parent class: @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "objectType") I would rather not have to force clients of my API to include "objectType": "SubClassA" to deserialize a Parent subclass. Instead of using @JsonTypeInfo, does Jackson provide a way to annotate a subclass and distinguish it from other subclasses via a unique property? In my example above, this would be something like, "If a JSON object has "stringA": ... deserialize it as SubClassA, if it has "stringB": ... deserialize it as SubClassB".
tagged with: deserialization
has answer: http://stackoverflow.com/a/50013090
has answer: http://stackoverflow.com/a/76324346
has answer: http://stackoverflow.com/a/66167492
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/55333395
possible better answer: http://stackoverflow.com/a/50013090
has answer: http://stackoverflow.com/a/24265399
tagged with: jackson

http://stackoverflow.com/a/24216874
has body: I think you are looking for "protected" access for manufacturer. "private" does not allow subclasses to access the field.
type: Answer
has comment: http://stackoverflow.com/comment/37394639
score: 0
answers question: http://stackoverflow.com/q/24216818

http://stackoverflow.com/comment/37262980
score: 0
type: QuestionComment
has text: You can't overload by return type because it's not part of the function signature. Check this out: http://stackoverflow.com/questions/16149285/does-a-methods-signature-in-java-include-its-return-type
comment on: http://stackoverflow.com/q/24147372
type: Comment

http://stackoverflow.com/a/43880164
upvote count: 16
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24177516
score: 16
has body: tl;dr LocalDate.of( 2014 , Month.JUNE , 12 ) // Represent a date-only value, without time-of-day and without time zone. .with( // Move from one date to another by passing an implementation of the `TemporalAdjuster` interface. TemporalAdjusters.next( DayOfWeek.MONDAY ) // Use an existing implementation found on utility class `TemporalAdjusters` (plural versus singular). ) // Returns another fresh `LocalDate` object rather than altering the original, per immutable objects design. Using java.time You are using troublesome old date-time classes that are now legacy, supplanted by the java.time classes. The LocalDate class represents a date-only value without time-of-day and without time zone. LocalDate ld = LocalDate.of( 2014 , Month.JUNE , 12 ) ; To get the following Monday, use a TemporalAdjuster implementation found in TemporalAdjusters class. LocalDate nextMonday = ld.with( TemporalAdjusters.next( DayOfWeek.MONDAY ) ) ; If you want to go with the original date if it is itself a Monday, then use nextOrSame adjuster. LocalDate nextOrSameMonday = ld.with( TemporalAdjusters.nextOrSame( DayOfWeek.MONDAY ) ) ; About java.time The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, &amp; SimpleDateFormat. The Joda-Time project, now in maintenance mode, advises migration to the java.time classes. To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310. Where to obtain the java.time classes? Java SE 8, Java SE 9, and later Built-in. Part of the standard Java API with a bundled implementation. Java 9 adds some minor features and fixes. Java SE 6 and Java SE 7 Much of the java.time functionality is back-ported to Java 6 &amp; 7 in ThreeTen-Backport. Android The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) for Android specifically. See How to use ThreeTenABP…. The ThreeTen-Extra project exte…

http://stackoverflow.com/q/24241736
tagged with: jooq
type: AnsweredQuestion
tagged with: sql
score: 1
tagged with: java
answer count: 1
tagged with: orm
has title: WITH statement in JOOQ?
has body: I have query for MS-SQL and Oracle but I want to convert into Jooq .I also trying somthing like this DSL.connectByRoot(field) But I am unable to find this solution . The main issue is that in Oracle we use clause connect by prior but its not available in MS-SQL. MS-SQL QUERY: WITH tempTable(ppCode, pCode) AS ( SELECT DefaultProcessDependent.PriorProcessCode, ProcessCode FROM DefaultProcessDependent WHERE DefaultProcessDependent.ProcessCode = ? AND DefaultProcessDependent.FolderType = ? UNION ALL SELECT nplus1.PriorProcessCode, nplus1.ProcessCode FROM DefaultProcessDependent as nplus1, tempTable WHERE tempTable.ppCode = nplus1.ProcessCode ) SELECT ppCode FROM tempTable ORACLE QUERY: Select processCode from DefaultProcessDependent start with DefaultProcessDependent.ProcessCode = ? connect by prior processCode = priorProcessCode Anyone help me please................... Thanks
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24258618
downvote count: 0
tagged with: database
has answer: http://stackoverflow.com/a/24258618
upvote count: 1

http://stackoverflow.com/comment/37215349
has text: "*And this seems to hold only for RSAKEYS.. But i want to check for other keys as well..*" # What other types of keys?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24121801

http://stackoverflow.com/q/24116570
has title: A simple error i can't resolve
type: Question
linked to: http://stackoverflow.com/q/513832
tagged with: if-statement
tagged with: java
type: UnansweredQuestion
has body: public class Quiz { private static void homePage() { JFrame homePage = new JFrame("QUIZ"); Container c = homePage.getContentPane(); homePage.setVisible(true); homePage.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); homePage.setBounds(600,180,700,400); homePage.setResizable(false); homePage.setContentPane(c); JLabel benvenuto = new JLabel("Benvenuto!"); benvenuto.setFont(new Font("Serif", Font.BOLD, 30)); benvenuto.setBounds(265,0,180,120); benvenuto.setOpaque(true); JLabel label1 = new JLabel("Inserisci il tuo nome:"); label1.setBounds(215,100,120,100); label1.setOpaque(true); JTextArea areaNome = new JTextArea(); areaNome.setEditable(true); areaNome.setFont(new Font("Serif", Font.BOLD, 16)); areaNome.setBounds(345,142,120,20); javax.swing.border.Border borderP = BorderFactory.createLineBorder(Color.BLACK); areaNome.setBorder(borderP); JLabel labelStarting = new JLabel(); labelStarting.setBounds(230,230,280,120); labelStarting.setForeground(Color.RED); JButton startButton = new JButton("Inizia"); startButton.setBounds(280,200,120,50); startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String gt1 = areaNome.getText(); try { Thread.sleep(500); } catch (InterruptedException ex) { Logger.getLogger(Quiz.class.getName()).log(Level.SEVERE, null, ex); } labelStarting.setText("Preparati "+gt1+", il gioco sta per iniziare."); JFrame quizPage = new JFrame("QUIZ"); quizPage.setBounds(573,150,750,450); quizPage.setVisible(true); quizPage.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); quizPage.setResizable(false); Container c2 = quizPage.getContentPane(); quizPage.setContentPane(c2); JLabel domanda1 = new JLabel("1) Qual è la capitale d'Italia?"); domanda1.setBounds(0,0,280,120); JLabel domanda2 = new JLabel("2) Quanto fa 2^8?"); domanda2.setBounds(0,55,280,120); JLabel domanda3 = new JLabel("3) Quando è stata scoperta l'America da Colombo?"); domanda3.setBounds(0,110,380,120); JLabel domanda4 = new JLabel("4) Dove si trova l'Em…
has answer: http://stackoverflow.com/a/24117128
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24116712
has comment: http://stackoverflow.com/comment/37205061

http://stackoverflow.com/comment/37269754
comment on: http://stackoverflow.com/q/24150420
score: 0
type: Comment
has text: Nope no other message. Thats all I get.
type: QuestionComment

http://stackoverflow.com/q/24244301
type: Question
answer count: 1
has title: Few JDBC connections
upvote count: 1
has body: As I know connection is kind of very expensive operation. Which approach should I follow to handle few connections? I have seen a lots of examples where author talks about only one connection or uses connection pool(from JBoss or something). My code looks like this: 1) make new connection 2) do some logic 3) close connection DriverManager.registerDriver(new net.sourceforge.jtds.jdbc.Driver()); con = DriverManager.getConnection(URL, username, password); if(con!=null) System.out.println("Connection Successful !\n"); //logic if(con!=null) con.close(); But I've got few similar methods based on this approach. So do I really have to make new connection or should I use the only one? If I use one connection, do I need to close it after? PS. App is not a servlet.
has answer: http://stackoverflow.com/a/24244438
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37446427
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37446560
tagged with: java
linked to: http://stackoverflow.com/q/15588449
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37446488
accepted answer: http://stackoverflow.com/a/24244438

http://stackoverflow.com/comment/37430815
type: Comment
type: QuestionComment
has text: That's how I currently have it, just wondering if there is a more efficient method than hard coding that many `map.put("shorthand","full name")` calls
score: 0
comment on: http://stackoverflow.com/q/24235862

http://stackoverflow.com/comment/37412060
comment on: http://stackoverflow.com/q/24224217
type: Comment
type: QuestionComment
has text: i have tried....I have loaded their services in form of jar files in the class path..but the trouble is to find his/her class that implements Pool..one option is that i ask the user by an input dialog to also supply the fully qualified class name and then i save the name in a plain text file but i want a user friendly application and i want my application to automatically search that class. I dont want to use Service providers i am using URLClassLoader.
score: 0

http://stackoverflow.com/a/24601154
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24230447
has body: As LimbSoup and David himself have already said, this is just plain impossible in Scala. You will need to write the class in Java. So the bad news is, you will need some Java code. The good news is, the Scala compiler and most Scala tools have very good support for mixed Java/Scala codebases. Java and Scala classes can freely inherit from each other and the compiler will figure it out just fine. So you shouldn't find yourself in a situation where you're forced to write any substantial amount of code in Java.
type: Answer
accepted answer of: http://stackoverflow.com/q/24230447

http://stackoverflow.com/a/24253891
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: I don't know what initial values b, x, w and y got so I just initialized them somehow .. But I think you want something like this: public class HelloWorld{ public static void main(String []args){ int z = 26; int b = 0; int x = 1; int w = 2; int y = 1; for (int i = 1;i&lt;=z;i++) { b = b+(b*y)+x+w; if (i % 5 == 0) System.out.println("In " + i + " years, IRA value: " + b); } System.out.print(z); } } Output: In 5 years, IRA value: 93 In 10 years, IRA value: 3069 In 15 years, IRA value: 98301 In 20 years, IRA value: 3145725 In 25 years, IRA value: 100663293 26
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24253804
has comment: http://stackoverflow.com/comment/37465433
answers question: http://stackoverflow.com/q/24253804

http://stackoverflow.com/q/24211794
answer count: 1
has comment: http://stackoverflow.com/comment/37385018
has answer: http://stackoverflow.com/a/24211825
type: Question
type: UnansweredQuestion
tagged with: android
tagged with: runtime
linked to: http://stackoverflow.com/q/3040374
has title: Receiving RuntimeException from lack of ListView despite xml
tagged with: http://stackoverflow.com/tag/xml
score: 0
has comment: http://stackoverflow.com/comment/37385069
tagged with: java
has body: Hello I am in my Android Project and I'm getting the following error. I have checked nearly every similar question and I am trying to use some solutions in here RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' but they seem like they are inapplicable. FATAL EXCEPTION: main Process: com.spicycurryman.getdisciplined10.app, PID: 1309 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.spicycurryman.getdisciplined10.app/com.spicycurryman.getdisciplined10.app.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 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) Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' at android.app.ListActivity.onContentChanged(ListActivity.java:243) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:293) at android.app.Activity.setContentView(Activity.java:1929) at com.spicycurryman.getdisciplined10.app.MainActivity.onCreate(MainActivity.java:32) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity…

http://stackoverflow.com/comment/37196718
type: Comment
score: 0
type: AnswerComment
has text: @user2809564 You have to exclude the `.class` files found in `sampleproject/target/...` which are produced after compilation. And yes, the tests will still run.
comment on: http://stackoverflow.com/a/24111081

http://stackoverflow.com/comment/37454354
has text: You should be able to add lines to any chart. I use these percentile lines in Area Charts, but AFAIK, you can add Series Data to any chart type.
comment on: http://stackoverflow.com/a/24240924
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37378892
has text: to distinguish var from func from type etc... you need a symbol table.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24208450
type: QuestionComment

javascript
tags question: http://stackoverflow.com/q/24234137
tags question: http://stackoverflow.com/q/24139122
tags question: http://stackoverflow.com/q/24176854
tags question: http://stackoverflow.com/q/24182282
tags question: http://stackoverflow.com/q/24140400
tags question: http://stackoverflow.com/q/24163560
tags question: http://stackoverflow.com/q/24148429
tags question: http://stackoverflow.com/q/24113604
tags question: http://stackoverflow.com/q/24159023
tags question: http://stackoverflow.com/q/24217813
tags question: http://stackoverflow.com/q/24120550
tags question: http://stackoverflow.com/q/24107617
tags question: http://stackoverflow.com/q/24257197
tags question: http://stackoverflow.com/q/24141219
tags question: http://stackoverflow.com/q/24191522
tags question: http://stackoverflow.com/q/24246452
tags question: http://stackoverflow.com/q/24261242
tags question: http://stackoverflow.com/q/24148290
tags question: http://stackoverflow.com/q/24113330
tags question: http://stackoverflow.com/q/24132308
tags question: http://stackoverflow.com/q/24173725
tags question: http://stackoverflow.com/q/24232738
tags question: http://stackoverflow.com/q/24152350
tags question: http://stackoverflow.com/q/24177758
tags question: http://stackoverflow.com/q/24201326
tags question: http://stackoverflow.com/q/24226018
tags question: http://stackoverflow.com/q/24254182
tags question: http://stackoverflow.com/q/24155743
tags question: http://stackoverflow.com/q/24180575
tags question: http://stackoverflow.com/q/24205052
tags question: http://stackoverflow.com/q/24179859
tags question: http://stackoverflow.com/q/24109640
tags question: http://stackoverflow.com/q/24192842
tags question: http://stackoverflow.com/q/24200753
tags question: http://stackoverflow.com/q/24198789
tags question: http://stackoverflow.com/q/24215177
tag name: javascript
tags question: http://stackoverflow.com/q/24120704
tags question: http://stackoverflow.com/q/24184940
tags question: http://stackoverflow.com/q/24134633
tags question: http://stackoverflow.com/q/24193651
tags question: http://stackoverflow.com/q/24218731
tags question: http://stackoverflow.com/q/24203928
tags question: http://stackoverflow.com/q/24107409
tags question: http://stackoverflow.com/q/24201575
tags question: http://stackoverflow.com/q/24254567
tags question: http://stackoverflow.com/q/24237229
tags question: http://stackoverflow.com/q/24143750
tags question: http://stackoverflow.com/q/24219229
tags question: http://stackoverflow.com/q/24210839
tags question: http://stackoverflow.com/q/24260271
tags question: http://stackoverflow.com/q/24194810
tags question: http://stackoverflow.com/q/24159879
tags question: http://stackoverflow.com/q/24164379
tags question: http://stackoverflow.com/q/24165440
tags question: http://stackoverflow.com/q/24112035
tags question: http://stackoverflow.com/q/24175194
tags question: http://stackoverflow.com/q/24157885
tags question: http://stackoverflow.com/q/24114606
tags question: http://stackoverflow.com/q/24116293
tags question: http://stackoverflow.com/q/24152678
tags question: http://stackoverflow.com/q/24221938
tags question: http://stackoverflow.com/q/24200756
type: Tag
tags question: http://stackoverflow.com/q/24181186
tags question: http://stackoverflow.com/q/24136339
tags question: http://stackoverflow.com/q/24144021
tags question: http://stackoverflow.com/q/24155966
tags question: http://stackoverflow.com/q/24219222
tags question: http://stackoverflow.com/q/24223110
tags question: http://stackoverflow.com/q/24252739

http://stackoverflow.com/comment/37195859
type: QuestionComment
comment on: http://stackoverflow.com/q/24111433
score: 0
type: Comment
has text: @Mash The best case for concatenating two strings is O(n), not O(1), because you must at a minimum read each character of both strings and write them all to new memory locations.

http://stackoverflow.com/q/24190758
score: 0
has title: GWT listbox not getting populated
has comment: http://stackoverflow.com/comment/37345192
has body: I m using gwt 2.6.0. I have a listbox on my page which is popluated using the following code public void setOHIInfo(ArrayList&lt;OHIInfoTo&gt; result) { ohiListBox.setEnabled(true); // ohiListBox is instance of com.google.gwt.user.client.ui.ListBox for (OHIInfoTo ohiinfo : result) { ohiListBox.addItem(ohiinfo.getOhiName(), ohiinfo.getOhiName()); GWT.log(ohiinfo.getOhiName()); // 5 data items are printed; no spaces } GWT.log("OHI Count - " + ohiListBox.getItemCount()); // Prints OHI Count - 5 } The 2 GWT.log lines are getting printed when the page loads, but the listbox is blank. I have searched in the project, there is no other place which is overwriting the listbox. I have also inspected the listbox element in chrome, it is actually not having any Any other way to find what is going wrong here?
has comment: http://stackoverflow.com/comment/37344821
tagged with: java
has answer: http://stackoverflow.com/a/24193221
has comment: http://stackoverflow.com/comment/37345023
type: Question
has comment: http://stackoverflow.com/comment/37346357
answer count: 2
accepted answer: http://stackoverflow.com/a/24193221
tagged with: gwt2
has comment: http://stackoverflow.com/comment/37344131
possible better answer: http://stackoverflow.com/a/24190939
has answer: http://stackoverflow.com/a/24190939
has comment: http://stackoverflow.com/comment/37345064
has comment: http://stackoverflow.com/comment/37345558
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/a/24114612
has comment: http://stackoverflow.com/comment/37203958
has comment: http://stackoverflow.com/comment/112048190
has comment: http://stackoverflow.com/comment/73704169
score: 183
has body: Why don't you just right click on the main() method and choose "Debug As... Java Application"?
answers question: http://stackoverflow.com/q/24113939
has comment: http://stackoverflow.com/comment/62958831
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/48625700
accepted answer of: http://stackoverflow.com/q/24113939
downvote count: 7
has comment: http://stackoverflow.com/comment/62934248
has comment: http://stackoverflow.com/comment/120394662
has comment: http://stackoverflow.com/comment/69851000
has comment: http://stackoverflow.com/comment/120240910
type: Answer
upvote count: 190
has comment: http://stackoverflow.com/comment/133254352

http://stackoverflow.com/q/24233436
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37425992
score: 0
has answer: http://stackoverflow.com/a/24233451
answer count: 2
upvote count: 2
has title: Java, (Syntax error, insert "AssignmentOperator Expression" to complete)
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/37425545
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24233468
has body: I use Eclipse using Java, What'S Wrong With This Code ?? I get this error "Syntax error, insert "AssignmentOperator Expression" to complete " { public void onCreateContextMenu(ContextMenu paramAnonymous2ContextMenu, View paramAnonymous2View, ContextMenu.ContextMenuInfo paramAnonymous2ContextMenuInfo) { ((AdapterView.AdapterContextMenuInfo)paramAnonymous2ContextMenuInfo);//**Syntax error, insert "AssignmentOperator Expression" to complete** paramAnonymous2ContextMenu.add(0, 0, 0, "Delete"); } });
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/37289654
score: 0
has text: Not sure if this will meet the requirements of the OP, but you could also use `BorderFactory.createTitledBorder(new MatteBorder(1, 0, 0, 0, Color.BLACK), "Title")`
type: AnswerComment
comment on: http://stackoverflow.com/a/24160296
type: Comment

http://stackoverflow.com/comment/37551623
type: Comment
has text: can we use same notatin 'In Jsp' for getting input for List also
type: AnswerComment
comment on: http://stackoverflow.com/a/24191304
score: 0

http://stackoverflow.com/q/24182627
tagged with: utf-8
has comment: http://stackoverflow.com/comment/37328160
has body: I have an ejb 3 application and deployed it in Glassfish 3.1 server. I have ExamDtl entity with exmId &amp; qustion fields, when i persist entity in database i found value of qustion field become ????. I have set UTF8 collation in table and I can insert utf-8 characters just fine with sql using like "INSERT INTO..." I have also set following property in sun-resources.xml file &lt;property name="URL" value="jdbc:mysql://localhost:3306/exam_databse?useUnicode=yes&amp;amp;characterEncoding=UTF-8"/&gt; Is there any setting for utf 8 in ejb?
score: 0
answer count: 0
tagged with: mysql
has comment: http://stackoverflow.com/comment/37328436
has comment: http://stackoverflow.com/comment/37329065
type: Question
has title: EJB utf-8 characters not persisted
tagged with: ejb
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/37214498
comment on: http://stackoverflow.com/a/24114396
score: 0
type: AnswerComment
has text: @laaptu You can try deserializing the json into a Map or JsonObject and iterating over the keys.
type: Comment

stringbuilder
tags question: http://stackoverflow.com/q/24158590
tag name: stringbuilder
type: Tag

http://stackoverflow.com/comment/107059850
has text: You can replace multiple lines by channing. line.replace('{{app javascript library}}', "lib/someLib.js") .replace('{{anotherVar}}', "lib/anotherLib.js")
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29328168

http://stackoverflow.com/q/24213823
has title: Anyway to @Inject/@Autowire an inner class into an outer class?
type: Question
tagged with: dependency-injection
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24213978
tagged with: spring
favorite count: 0
has answer: http://stackoverflow.com/a/24213978
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37393170
has body: In Spring/JSR-330, is there a way to properly declare an inner class which requires dependency injection, such that I can inject it into the outer class? For example: @Component public class TestClass{ // How to declare this class? private class TestClassInner{ @Autowired private SomeBean somebean; public boolean doSomeWork(){ return somebean.doSomething(); } } // Inject the inner class here in the outer class such that the outer class can use an instance of it @Autowired TestClassInner innerClass; @PostConstruct public void init(){ ... } public void someMethod(){ innerClass.doSomeWork(); ... } } I've tried annotating the inner class with @Component, making it a public class, making it public static, etc, but it seems that every combination I've tried always ends up throwing one error or another. As a private inner class, Spring complains that it is missing a constructor, even if I define one. As an annotated @Component public static class, Spring complains that it find two beans - TestClass@TestClassInner and testClass.TestClassInner. And if I use a @Qualifier, it then complains that the bean cannot be found. I presume I am misunderstanding how these inner beans work/interact with Spring to properly understand if/how to declare them. Is this even possible? Edit So here are a few combinations I've tried (including tried implementing a new constructor based on @SotiriosDelimanolis response): // How to declare this class? @Component public class TestClassInner{ @Autowired private ProviderService providerService; public TestClassInner(){ super(); } public TestClassInner( TestClass t){ super(); } } Throws error (both public and private inner class throw the same error): Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ia.exception.TestClass$TestClassInner]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.ia.exception.TestClass$TestClassInner.&lt;init&gt;() at org.springframework…
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/37392860
upvote count: 10

http://stackoverflow.com/comment/37283426
score: 0
has text: you are using Windows 7 32bit or 64 bit?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24158129

http://stackoverflow.com/a/24140817
has body: Use method="post" in and store the email in session in validation success block. if valid user HttpSession session=request.getSession(); session.setAttribute("email", emailid); to get emailid in any page String email=(String)session.getAttribute("email");
answers question: http://stackoverflow.com/q/24140501
type: Answer
score: 0

http://stackoverflow.com/q/24165361
downvote count: 1
has comment: http://stackoverflow.com/comment/37297006
favorite count: 0
type: Question
has body: The case is that I made my first app in Android Studio, the app consist in adding a text(By a EditText) and being translated to TextView by pressing a button, and the problem is: I want the user to be able to edit the text and a new translation will come up by pressing the button again, which is not possible in my code, I don't know how to make the button clickable more than once. public void onButtonClick(View view){ EditText e=(EditText)findViewById(R.id.escribiraqui); TextView T=(TextView)findViewById(R.id.traduccion); Button TRAD=(Button) findViewById(R.id.traducir); // //HERE IS THE REST OF THE CODE THAT TRANSLATES THE TEXT //TO MORSE CODE // TRAD.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view){ } }); } I don't know what to add for the code to allow the bottom to be clicked more than once(That is the issue).
has title: How to reuse a button in Android Studio
type: UnansweredQuestion
tagged with: android
score: -1
tagged with: android-studio
upvote count: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24166002

http://stackoverflow.com/comment/37427408
has text: @AnubianNoob How did you test this? I support OP in using [JMH](http://openjdk.java.net/projects/code-tools/jmh/) - it often gives you realistic results.
comment on: http://stackoverflow.com/a/24233982
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24156084
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37279223
downvote count: 0
upvote count: 1
has body: I can't seem to force my calls to System.out to go in order if one of them takes input from a Scanner on System.in. I'm sure that there's a simple answer (I can feel the down votes coming already), but it's eluding me. public class RegexApp{ static Scanner s = new Scanner(System.in); static String read = ""; public static void main(String[] args) { while (true) { System.out.println("Please enter text."); RegexApp.GetLine mg = new RegexApp().new GetLine(); mg.start(); mg.join(); } } public class GetLine extends Thread{ public void run() { read=s.nextLine(); System.out.println(read); } } } Even though I've tried using thread.join() to force the app to complete the System.out.println(read); before the next iteration of the while loop and printout of another System.out.println("Please enter text.");, I can't seem to get these two things to happen in the right order. I'll often get another System.out.println("Please enter text.");, immediately followed by the result of System.out.println(read); from the last line of input (vs. the reverse order as expected.) It seems that the System.out call waiting for the input from System.in is just allowed to return whenever, and the app goes on with other System.out calls in the meantime. I'd like to ensure that the app actually waits for the result of one System.out call before looping to the next. (I have tried synchronized(System.out),(this) and (System.in), with wait() and notify(), all to no avail.) I get Please enter text. (I type HELLO and hit enter) Please enter text. HELLO (I type GOODBYE and hit enter) Please enter text. GOODBYE where I'd have expected Please enter text. (I type HELLO and hit enter) HELLO Please enter text. (I type GOODBYE and hit enter) GOODBYE Please enter text. Basically, the order is inverted, and I can't figure out why. I've seen a related question on the site in which the order of flushing of streams is mentioned, and the fix involving synchronized(System.out){} is given, but that did not solve this …
has comment: http://stackoverflow.com/comment/37279260
has title: Why is System.in not responding properly to synchronization attempts?
score: 1
tagged with: java
tagged with: io
has comment: http://stackoverflow.com/comment/37472572
favorite count: 0
tagged with: synchronization
type: Question

http://stackoverflow.com/comment/37203982
has text: Sorry it took too long.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24113453
type: QuestionComment

http://stackoverflow.com/comment/37381119
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24209606
has text: Maybe you can use `java.util.AbstractList<T>` and adapt the scala list and vice versa.

http://stackoverflow.com/q/24205888
score: -1
has title: java- output different random strings
has answer: http://stackoverflow.com/a/24205989
has body: I am new to java and I am struck with my progress. I have a method that generates a random string between 1-13 and the 'cdsh'.Combine those two together and it will determine the card type that I will received in my program. I will random it four times and if there is any results the same, the program will random again. e.g random output s1(spades of 1) h3(hearts of 3) s1(spades of 1) &lt;-- duplicated! it will random again and produce and different string. d1(diamond of 1) public static String randomizedCard() { int randomInt; String rank = null; String suits = null; String cardType; Random randomGenerator = new Random(); randomInt = randomGenerator.nextInt(13); if(randomInt == 0) { randomInt = randomGenerator.nextInt(13); } rank = Integer.toString(randomInt); char[] chars = "cdhs".toCharArray(); StringBuilder sb = new StringBuilder(); Random randomChar = new Random(); char c = chars[randomChar.nextInt(chars.length)]; sb.append(c); suits = sb.toString(); cardType = suits + rank; System.out.println(cardType); return cardType; } public static void main(String[] args) { String[] ic = new String[4]; for(int i = 0; i &lt; 4; i++) { /*from here onwards I get confused on how should I write the code such that if it randoms the same string, it will the random method (randomizedCard) till it produce all four different random numbers without duplicate and store it into the array.*/ //store the random string to an array ic[i] = randomizedCard(); // if it's the same random again if(ic[i] == randomsizedCard()) { randomsizedCard(); ic[i] = randomsizedCard(); } } } How should I write the code such that if it randoms the same string, it will the random method (randomizedCard) till it produce all four different random numbers without duplicate and store it into the array?
has answer: http://stackoverflow.com/a/54630323
type: AnsweredQuestion
tagged with: random
downvote count: 2
has answer: http://stackoverflow.com/a/24206100
possible better answer: http://stackoverflow.com/a/24206100
has answer: http://stackoverflow.com/a/24206042
upvote count: 1
tagged with: java
tagged with: string
accepted answer: http://stackoverflow.com/a/24205989
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37373464
has answer: http://stackoverflow.com/a/24206087
answer count: 5

http://stackoverflow.com/comment/37359122
comment on: http://stackoverflow.com/q/24197350
score: 0
type: QuestionComment
has text: I am running shimmer code which get data from sensor every second. Each second i also calling webservice. so i get a networking error because both components run on the same thread. How to run two thread in the same time. So calling webservice will not affect the shimmer graph displaying.
type: Comment

http://stackoverflow.com/comment/37493972
type: Comment
has text: I think you might be able to do it (haven't tried though), but you might need to change the Security Rules (on the left side of the dashboard).
comment on: http://stackoverflow.com/a/24252075
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37418782
comment on: http://stackoverflow.com/a/24213345
score: 0
has text: i think problem is not about recording!is about receiving calls
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37478169
type: AnswerComment
comment on: http://stackoverflow.com/a/24240315
type: Comment
has text: Cause of the confusion is that this is hidden in JVM specification. In case of Java Spec v1.6 this is a feature. But for Java Spec v1.7 this is bug. Because the specification has changed. There is a distinction between accessing object via simple name and qualified by `this`. For 1.8 will not compile. The origin of change is changes in specification. I think this solves your confusion.
score: 0

http://stackoverflow.com/a/72094839
type: Answer
score: 0
has body: import java.util.*; abstract class VIP implements Comparable<Member>{ abstract int getOrderIndex(); abstract String getName(); } class Member extends VIP { String name; int index; public Member(String s,int i){ this.name=s;this.index=i; } public int compareTo(Member m){ return this.getOrderIndex()-m.getOrderIndex(); } public String getName(){ return name; } public int getOrderIndex(){ return index; } } class Player extends Member { public Player(String s,int i){ super(s,i); } } class Coach extends Member{ public Coach(String s,int i){ super(s,i); } } class Refree extends Member{ public Refree(String s,int i){ super(s,i); } } class Main{ public static void main(String[] args) { List<Member> l=new ArrayList<Member>(); l.add(new Refree("refree",2)); l.add(new Player("player2",1)); l.add(new Player("player1",1)); l.add(new Coach("coach2",0)); l.add(new Coach("coach1",0)); l.sort((m1,m2)-> m1.compareTo(m2)); l.forEach(o-> System.out.println(o.getName())); } }
answers question: http://stackoverflow.com/q/24233554

http://stackoverflow.com/comment/37319716
score: 0
type: Comment
type: AnswerComment
has text: sorry it is a typo here. I actually used Examples. already edited that, thanks!
comment on: http://stackoverflow.com/a/24177614

http://stackoverflow.com/comment/37408980
type: QuestionComment
has text: Every opening brace needs a closing brace. Just count and you will see that there are two missing.
score: 0
comment on: http://stackoverflow.com/q/24224437
type: Comment

http://stackoverflow.com/q/24177138
has answer: http://stackoverflow.com/a/24177238
tagged with: jlist
tagged with: java
has comment: http://stackoverflow.com/comment/37318942
answer count: 1
has title: How to create a jlist with images
has comment: http://stackoverflow.com/comment/37318961
type: Question
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37318851
tagged with: jscrollpane
tagged with: jframe
score: 0
has body: I want to add some images to my jlist. following code works great public class MarioList { private final Map&lt;String, ImageIcon&gt; imageMap; public MarioList() { String[] nameList = {"Mario", "Luigi", "Bowser", "Koopa", "Princess"}; imageMap = createImageMap(nameList); JList list = new JList(nameList); list.setCellRenderer(new MarioListRenderer()); JScrollPane scroll = new JScrollPane(list); scroll.setPreferredSize(new Dimension(300, 400)); JFrame frame = new JFrame(); frame.add(scroll); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public class MarioListRenderer extends DefaultListCellRenderer { Font font = new Font("helvitica", Font.BOLD, 24); @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); label.setIcon(imageMap.get((String) value)); label.setHorizontalTextPosition(JLabel.RIGHT); label.setFont(font); return label; } } private Map&lt;String, ImageIcon&gt; createImageMap(String[] list) { Map&lt;String, ImageIcon&gt; map = new HashMap&lt;&gt;(); try { map.put("Mario", new ImageIcon(new URL("https://i.sstatic.net/NCsHu.png"))); map.put("Luigi", new ImageIcon(new URL("https://i.sstatic.net/UvHN4.png"))); map.put("Bowser", new ImageIcon(new URL("https://i.sstatic.net/s89ON.png"))); map.put("Koopa", new ImageIcon(new URL("https://i.sstatic.net/QEK2o.png"))); map.put("Princess", new ImageIcon(new URL("https://i.sstatic.net/f4T4l.png"))); } catch (Exception ex) { ex.printStackTrace(); } return map; } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new MarioList(); } }); } } above code creates a new frame and add a jscrollpane to it. Instead of that I tried to create the frame and jcrollpane mannually using Netbeans. So instead of this cod…
accepted answer: http://stackoverflow.com/a/24177238
type: AnsweredQuestion

http://stackoverflow.com/q/24212042
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24212688
has title: JavaFX-JFXpanel bug?
has answer: http://stackoverflow.com/a/24212688
tagged with: java
tagged with: javafx
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37386562
downvote count: 1
favorite count: 0
type: Question
has body: public class JavaApplication3 { /** * @param args the command line arguments */ public void initAndShowGUI() { // This method is invoked on the EDT thread JFrame frame = new JFrame("Swing and JavaFX"); final JFXPanel fxPanel = new JFXPanel(); frame.add(fxPanel); frame.setSize(300, 200); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Platform.runLater(new Runnable() { @Override public void run() { initFX(fxPanel); } }); } private void initFX(JFXPanel fxPanel) { // This method is invoked on the JavaFX thread Scene scene = createScene(); fxPanel.setScene(scene); } private Scene createScene() { Group root = new Group(); Scene scene = new Scene(root, Color.ALICEBLUE); WebView browser; browser = new WebView(); //browser.setContextMenuEnabled(false); browser.autosize(); WebEngine webEngine = browser.getEngine(); String Qlink = "https://www.google.ca"; webEngine.load(Qlink); root.getChildren().add(browser); return (scene); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { System.setProperty("http.proxyHost","10.10.6.61"); System.setProperty("http.proxyPort","6666"); System.setProperty("https.proxyHost","10.10.6.61"); System.setProperty("https.proxyPort","6666"); JavaApplication3 j = new JavaApplication3(); j.initAndShowGUI(); } }); } } Here is the program that is 90% as same as the oracle's sample code. Either I refresh the page twice or wait a bit-longer, JVM crashes itself. What am I doing wrong so that the outcome is such? Please point out. It is easy to reproduce. I am using java7u22, jfxrt is the jre default included. your help much appreciated! Edit: I will post the error showing on the IDE which is very long. I will also provide the core dump log file if you ask. Sorry for the grammar which probably make you hard to understand me. # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005c2728e3, pid…
has comment: http://stackoverflow.com/comment/37386103
has comment: http://stackoverflow.com/comment/37385290

http://stackoverflow.com/q/24208492
type: Question
answer count: 2
tagged with: swing
tagged with: line
has title: How to increase line width (Java Applet)
accepted answer: http://stackoverflow.com/a/24208552
has answer: http://stackoverflow.com/a/24208592
has answer: http://stackoverflow.com/a/24208552
type: AnsweredQuestion
score: 0
tagged with: java
has body: I've been trying to increase the width of line using the setStroke method in Java but the only output I seem to be getting is an error message saying "Cannot find method setStroke". public void paint(Graphics g){ g.setColor(Color.orange); g.setStroke(new BasicStroke(4)); g.drawLine(5, 5, 480, 5); } I've imported import java.applet.Applet; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.Graphics2D;
tagged with: applet
possible better answer: http://stackoverflow.com/a/24208592

http://stackoverflow.com/q/24232091
tagged with: servlets
has comment: http://stackoverflow.com/comment/37423240
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/37422947
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37423022
has comment: http://stackoverflow.com/comment/37423389
linked to: http://stackoverflow.com/q/22999830
has comment: http://stackoverflow.com/comment/37423059
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/37423540
has title: servlet page shows blank when accessed later
has comment: http://stackoverflow.com/comment/37423796
has comment: http://stackoverflow.com/comment/37422990
score: 0
has comment: http://stackoverflow.com/comment/37423399
has comment: http://stackoverflow.com/comment/37423085
has comment: http://stackoverflow.com/comment/37423569
has body: I have a strange issue with servlet page. I have simple web application which contains just a servlet.I deployed it in Tomcat 7. When user enters url, the servlet should get directly executed, get the data from the database and print the output. But it shows blank page after some time. When I undeploy and deploy, it shows data. After some time when I access the page, it shows blank page. Then again when I redeploy, it shows data. Can someone please let me know how to resolve this? I have no clue why it happens. Below is my code. I am using mysql database.mysql-connector-java-5.1.29-bin.jar added in lib folder and added to buildpath. public class Homeservlet extends HttpServlet { private static final long serialVersionUID = 1L; static final String mysqldblink = "************"; static final String mysqlUsername = "username"; static final String mysqlPassword = "pw"; Connection connection =null; Statement stmt = null; /** * @see HttpServlet#HttpServlet() */ public Homeservlet() { super(); // TODO Auto-generated constructor stub } public void init(ServletConfig config) throws ServletException { super.init(config); try{ Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(mysqldblink, mysqlUsername, mysqlPassword); stmt = connection.createStatement(); } catch(Exception E) { E.printStackTrace(); } } @Override public void service(ServletRequest request, ServletResponse response) { PrintWriter pw = null; try { String query = "querytogetdata"; pw = response.getWriter(); ResultSet rs = stmt.executeQuery(query); while(rs.next()) { pw.println(rs.getString(1)); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch(Exception e) { e.printStackTrace(); }finally{ try{ pw.close(); }catch(Exception e) { e.printStackTrace(); } } } @Override public void destroy( ) { // Close the connection try { if (connection != null) connection.close( ); if(stmt != null) stmt.close(); } catch (SQLException ignore) { } } }
tagged with: java
has comment: http://stackoverflow.com/comment/37423695
has comment: http://stackoverflow.com/comment/37423042
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37423653
has comment: http://stackoverflow.com/comment/37423110
has comment: http://stackoverflow.com/comment/37423011
tagged with: mysql
has comment: http://stackoverflow.com/comment/37423196
has comment: http://stackoverflow.com/comment/37423782

http://stackoverflow.com/comment/37482144
type: QuestionComment
has text: Just discovered this [question](http://stackoverflow.com/questions/17496100/open-to-close-bracket-quotation-mark-tag-selection-intellij?rq=1), which discusses the `Alt+Shift+up/down`, which is close to what I'm looking for. Though it is still inferior compared with eclipse.
type: Comment
comment on: http://stackoverflow.com/q/24261325
score: 1

http://stackoverflow.com/a/24163689
accepted answer of: http://stackoverflow.com/q/24157574
answers question: http://stackoverflow.com/q/24157574
has comment: http://stackoverflow.com/comment/37293736
type: Answer
has comment: http://stackoverflow.com/comment/37336700
upvote count: 6
has body: Short: don't. Long: the policy file will be overwritten on every install or upgrade. Create a java.pol file instead. Use LotusScript to deploy. Full instructions here: http://www.wissel.net/blog/d6plinks/SHWL-8JYAT5
type: AcceptedAnswer
downvote count: 0
score: 6

http://stackoverflow.com/comment/37340343
has text: You get 00:00 because you're not setting current time anywhere in your code. Also I don't know why you're substracting one day ¿?
comment on: http://stackoverflow.com/q/24188756
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37469533
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24256204
type: Comment
has text: What did you intend to do?

http://stackoverflow.com/comment/37400352
has text: I changed the 'i < 104' to 'i < 52' but still get the same error.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24220124

java.util.scanner
tags question: http://stackoverflow.com/q/24105121
tags question: http://stackoverflow.com/q/24175467
tags question: http://stackoverflow.com/q/24190289
tags question: http://stackoverflow.com/q/24264597
tags question: http://stackoverflow.com/q/24251727
tags question: http://stackoverflow.com/q/24182528
tags question: http://stackoverflow.com/q/24249917
tags question: http://stackoverflow.com/q/24112111
tags question: http://stackoverflow.com/q/24122862
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/24220967
tags question: http://stackoverflow.com/q/24266772
tags question: http://stackoverflow.com/q/24112869
tags question: http://stackoverflow.com/q/24129480
tags question: http://stackoverflow.com/q/24247459
tags question: http://stackoverflow.com/q/24137160
type: Tag
tags question: http://stackoverflow.com/q/24127681
tags question: http://stackoverflow.com/q/24128384

http://stackoverflow.com/q/24164461
type: AnsweredQuestion
tagged with: html-table
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24164934
accepted answer: http://stackoverflow.com/a/24164934
type: Question
has body: I have: Tim Robbins ... how can I get only the information inside the second td class? (td class= itemprop). I want to get "/name/nm0000209/?ref_=ttfc_fc_cl_t1" and "Tim Robbins". This is my code: Elements elms = doc.getElementsByClass("cast_list").first().getElementsByTag("table"); Elements tds = elms.select("td"); for(Element td : tds){ if(td.attr("class").contains("itemprop")){ Elements links = tds.select("a[href]"); for(Element link : links){ if(link.attr("href").contains("name/nm")) { String castname = link.text(); String castImdbId = link.attr("href"); System.out.println("CastName:" + castname + "\n"); System.out.println("CastImdbID:" + castImdbId + "\n"); } but it also returns the text of the link inside td class="primary_phptp" which is null, this is part of my output: CastName: CastImdbID:/name/nm0000209/?ref_=ttfc_fc_cl_i1 CastName:Tim Robbins CastImdbID:/name/nm0000209/?ref_=ttfc_fc_cl_t1 CastName: ...... Could someone please let me know where is my problem? I think the condition if(td.attr("class").contains("itemprop")) does not work at all. Thanks,
tagged with: href
has title: how to extract data inside a specific td in html table using java
tagged with: java
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/37236077
has text: I did have a v13 when everything else is v4! Nice catch. Now I am getting this error "The constructor FragmentPagerAdapter(FragmentManager) is undefined"
comment on: http://stackoverflow.com/a/24132706
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24218790
type: AnsweredQuestion
answer count: 2
has title: how to eliminate any number after the floating point?
has body: Is there any function returns only the real number without the floating point? For an example, func(1.xxx)-&gt;1 func(52.xx)-&gt;52 func(0.xx)-&gt;0 Is there any function does so?
has comment: http://stackoverflow.com/comment/37397857
downvote count: 3
has comment: http://stackoverflow.com/comment/37397923
tagged with: floating-point
upvote count: 1
tagged with: floating-accuracy
has answer: http://stackoverflow.com/a/24218892
tagged with: floating-point-precision
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2143476
has comment: http://stackoverflow.com/comment/37397869
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/24218827
possible better answer: http://stackoverflow.com/a/24218892
has comment: http://stackoverflow.com/comment/37397931
has comment: http://stackoverflow.com/comment/37397944
has comment: http://stackoverflow.com/comment/37397851
has answer: http://stackoverflow.com/a/24218827
duplicate of: http://stackoverflow.com/q/2143476

http://stackoverflow.com/a/24169043
has body: You need to do it like this public Square(double side) { this.side = side; } In your code, side = side just assigns side to itself. Since it is defaulted to equal zero, it just assigns zero to itself. In the constructor, side is created as a private variable. To access the "side" variable in the class, you have to use this.side. "this" refers to the instance of the class, so "this.side" is telling the code to change the variable side which is a variable of the Square.
downvote count: 0
answers question: http://stackoverflow.com/q/24169014
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/q/24105611
answer count: 1
tagged with: jvm
has answer: http://stackoverflow.com/a/24105764
score: 0
tagged with: path
tagged with: java
has title: .jar works only on my computer, classnotfoundexception on others
has body: I'm building a java project on my Lubuntu computer and while it's working on my computer, when I'm trying to run it on a different one (Windows/Lubuntu) I'm getting Exception in thread "main" java.lang.NoClassDefFoundError: geli/BasicApp ..... ... .... ............ .... Caused by: java.lang.ClassNotFoundException: geli.BasicApp Here's the file structure - At the beginning I've thought that it's because of the Linux and Windows path difference but testing it on my other Linux computer gave me the same error that I've got on my windows computer. I have no clue for the solution and I'd really appreciate any help. EDIT: jar file from inside has the libs Manefiest:
type: Question
has comment: http://stackoverflow.com/comment/37184874
has comment: http://stackoverflow.com/comment/37185307
tagged with: classnotfoundexception
type: UnansweredQuestion

http://stackoverflow.com/q/24152945
upvote count: 2
answer count: 2
has title: Set the fore ground of a swing component by using color code
tagged with: swing
accepted answer: http://stackoverflow.com/a/24152952
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24152952
tagged with: java
score: 1
has body: Is there any way to set the fore ground of for example a label directly by color code rather than the predefined colors that java provides. For instance : instead of: SomeLabel.setForeground(Color.Red); We do: SomeLabel.setForeground("240,240,240"); I'm asking this question because I'm setting label colors of the required fields to red when the user skips them, so when I wanna reset their color I can't find the color that I've defined within the predefined colors that java provides.
possible better answer: http://stackoverflow.com/a/24152960
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24152960

http://stackoverflow.com/comment/37426373
score: 0
type: QuestionComment
type: Comment
has text: What is `b`? Where is it defined?
comment on: http://stackoverflow.com/q/24233785

http://stackoverflow.com/comment/37227273
type: QuestionComment
has text: As you know Public key has modulus and exponent keys, i am trying to pass these values between java and objective c and later trying to generate public key using these keys. Once public keys are generated am trying to encrypt the sting using this public key in ios . This encrypted string is getting decrypted at java end, however here am facing problem and java is throwing RSA Block too large exception. And am stuck here. !!!
comment on: http://stackoverflow.com/q/24124273
score: 0
type: Comment

http://stackoverflow.com/comment/37255131
comment on: http://stackoverflow.com/a/24131775
score: 0
type: AnswerComment
has text: The addition of setLocalization to your prefs should occur outside of you loop and try using apply() instead of commit()
type: Comment

http://stackoverflow.com/q/24195800
has comment: http://stackoverflow.com/comment/37365284
score: 3
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37357541
type: AnsweredQuestion
has title: Get text from EditTextPreference and save it
linked to: http://stackoverflow.com/q/14386181
upvote count: 3
downvote count: 0
tagged with: sharedpreferences
answer count: 1
linked to: http://stackoverflow.com/q/3799038
tagged with: android-preferences
accepted answer: http://stackoverflow.com/a/24202606
has comment: http://stackoverflow.com/comment/37357114
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24202606
has body: I am trying to build a settings menu, but I'm having some troubles... I cant get the text from EditTextPreference I cant insert it on my sharedPreferences file Can I have some help? Prefs Class @Override protected void onResume() { super.onResume(); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); sharedPreferences.registerOnSharedPreferenceChangeListener(this); } @Override protected void onPause() { super.onPause(); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); sharedPreferences.unregisterOnSharedPreferenceChangeListener(this); } @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { SharedPreferences.Editor editor = sharedPreferences.edit(); contact1 = (EditTextPreference) findPreference("contact1"); editor.putString("contact1", String.valueOf(contact1)).commit(); } @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); } Prefs XML &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;EditTextPreference android:title="Contact 1" android:key="@+id/contact1" android:summary="Enter your contact"&gt; &lt;/EditTextPreference&gt; &lt;EditTextPreference android:title="Contact 2" android:key="@+id/contact2" android:summary="Enter your contact"&gt; &lt;/EditTextPreference&gt; Get data on main activity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); number1 = settings.getString("contact1", ""); number2 = settings.getString("contact2", ""); contact1 = "tel: " + number1; contact2 = "tel: " + number2;
has comment: http://stackoverflow.com/comment/37354434

http://stackoverflow.com/q/24130045
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24130384
has body: I am trying to create a mechanism that requires a user to enter what they have been doing for the last five years Date range must be covered (start date 01/08/2009 - end date 01/08/2014) Up to ten entries are allowed Overlapping is allowed No gaps are not allowed Currently I order the entries by start date, verify both ranges are covered. For the gaps between the entries i compare two dates at a time, entry i and i+1 and compare the start date of the later start date with the earlier start dates end date. I find it difficult to put it into words but i think this small diagram helps describe the problem START A x---------------------------------------y B x----------y C x--------y D x-----y E x----------y F x----------y End Here option E would fail because its start date is after D's end date, I use a while loop to add a day to the gap for everyday the start date is after the end date, this would trigger the validation, even though those dates have been covered by entry A.I am using Java to do this but even help in text and pseudo code would be great as it is more the logic im lost with , If anyone could help with the gaps between dates I would be very grateful.
upvote count: 2
has answer: http://stackoverflow.com/a/24130384
downvote count: 0
accepted answer: http://stackoverflow.com/a/24130355
tagged with: calendar
has comment: http://stackoverflow.com/comment/37231047
has answer: http://stackoverflow.com/a/24130355
favorite count: 0
type: Question
tagged with: logic
tagged with: c#
answer count: 3
has title: Workout Gaps between several date entries
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/24130520
score: 2

http://stackoverflow.com/comment/40200675
comment on: http://stackoverflow.com/a/24159603
score: 0
has text: And to enable the interceptor with JavaConfig, in your @Configuration which implements WebMvcConfigurer (usually by way of extending WebMvcConfigurerAdapter) , add \@Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new HttpLoggingInterceptor()); }
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24239633
has comment: http://stackoverflow.com/comment/37437846
has comment: http://stackoverflow.com/comment/37437660
accepted answer of: http://stackoverflow.com/q/24239573
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24239573
type: Answer
has comment: http://stackoverflow.com/comment/37437864
has body: But the absence of a (that is the occurance of b) is between the indices 1 and 2. So why is the match of the text "" between the index 1 and 1 (in other words, why are we getting a zero-length match here) The length of the match is the length of the input string that matched the pattern. Since there was no "a", only an empty string was matched. Again, the pattern does not match "a sequence of non-a characters", it matches a (possibly empty) sequence of "a"s up to a total length of one. In this case, that matched sequence was empty. But the absence of a (that is the occurance of b) The absence of a is not the occurance of b. The absence of a takes place before the occurance of b and ends at the occurance of b.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/24174829
tagged with: spring
has answer: http://stackoverflow.com/a/24222807
has comment: http://stackoverflow.com/comment/37319149
has comment: http://stackoverflow.com/comment/37314863
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37345451
tagged with: java
has comment: http://stackoverflow.com/comment/37397731
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/24222807
favorite count: 0
type: Question
tagged with: connection-pooling
has body: I am trying to work with spring, mybatis and mysql with jdbc. The only small problem I have after some queries, it throws an exception. The DB says: Too many connections. So what I am trying to do to prevent the too many connection issue is to set up a connection pool. I have tried dbcp and bonecp also but both have the same behaviour. When I reload my page it just keeps loading in the browser and after some debugging it seems it hangs after the 9th or 10th select. My scenario looks like this: 1: "select * from maincategory" This query returns around 15 categories. I map the resultset into a List containing MainCategory elements. Then what I do is I walk through the MainCategory List and get the IDs from each MainCategory and then I do an other select to get their sub categories: 2: "select * from subcategories where id = ${id_from_main_category_actual_row}" And it seems it hangs after the 9th or 10th subcategory selection. Here is my transaction manager and sqlsessionfactory configuration: <beans:bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <beans:property name="dataSource" ref="dataSource" /> </beans:bean> <tx:annotation-driven transaction-manager="transactionManager" /> <beans:bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <beans:property name="configLocation" value="WEB-INF/spring/myBatis/mybatis.xml" /> <beans:property name="mapperLocations" value="WEB-INF/spring/myBatis/mbmapper-*.xml" /> <beans:property name="dataSource" ref="dataSource" /> </beans:bean> And here is the configuration for a datasource with dbcp: <beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <beans:property name="driverClassName" value="com.mysql.jdbc.Driver" /> <beans:property name="url" value="jdbc:mysql://localhost:3306/testdb" /> <beans:property name="username" value="root"/> <beans:property name="password" value=""/> </beans:bean> And my other try w…
upvote count: 2
linked to: http://stackoverflow.com/q/97197
answer count: 1
downvote count: 0
tagged with: mybatis
has comment: http://stackoverflow.com/comment/37334038
has title: Too many connections with Spring + MyBatis + MySQL + JDBC

http://stackoverflow.com/q/24229442
tagged with: jdbc
has answer: http://stackoverflow.com/a/28165814
has answer: http://stackoverflow.com/a/24229901
has comment: http://stackoverflow.com/comment/98732252
has answer: http://stackoverflow.com/a/56045151
has answer: http://stackoverflow.com/a/24237702
downvote count: 4
has answer: http://stackoverflow.com/a/72255843
has answer: http://stackoverflow.com/a/67901273
type: UnansweredQuestion
has title: Print the data in ResultSet along with column names
tagged with: java
has answer: http://stackoverflow.com/a/24230530
tagged with: mysql
has answer: http://stackoverflow.com/a/75110284
favorite count: 0
type: Question
upvote count: 66
has answer: http://stackoverflow.com/a/24229638
answer count: 9
has body: I am retrieving columns names from a SQL database through Java. I know I can retrieve columns names from ResultSet too. So I have this sql query select column_name from information_schema.columns where table_name='suppliers' The problem is I don't know how can I get columns names from ResultSet and my code is public void getAllColumnNames() throws Exception{ String sql = "SELECT column_name from information_schema.columns where table_name='suppliers'"; PreparedStatement ps = connection.prepareStatement(sql); ResultSet rs = ps.executeQuery(sql); // extract values from rs }
score: 62
tagged with: scala

http://stackoverflow.com/comment/37279223
type: Comment
score: 1
type: QuestionComment
has text: I think its just a case of delay in displaying the msg on the console... the actually processing might be happening correctly...
comment on: http://stackoverflow.com/q/24156084

http://stackoverflow.com/a/24177019
answers question: http://stackoverflow.com/q/24176836
type: Answer
has body: You can force Document mode to "Quirks", by writing the host page as follows: &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/&gt; &lt;/head&gt; &lt;body&gt; .. Two of my Gwt webapps work perfectly with the solution above. And here are notes from the official for your reference.
upvote count: 1
has comment: http://stackoverflow.com/comment/37319066
downvote count: 0
score: 1

http://stackoverflow.com/q/24233825
has answer: http://stackoverflow.com/a/24236807
tagged with: java-native-interface
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37432083
has comment: http://stackoverflow.com/comment/37432350
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23044815
linked to: http://stackoverflow.com/q/9062237
has body: I am asking this question again because I have to. I am having this error while running a NDK based application. D dalvikvm: No JNI_OnLoad found in /data/app-lib/com.venky-1/libme.so 0xa5082228, skipping init W dalvikvm: No implementation found for native Lcom/venky/Home;.getPermission:(Landroid/app/Activity;)I I have been through No JNI_OnLoad found in ... skipping init No JNI_OnLoad found skipping init &gt; Application shutdown No JNI_Onload() found and VM shutting down JNI_OnLoad not found Their problem was either They were not using JNI_OnLoad because they used JNI specific naming convention (For example Java_com_venky_Home_start()). Hence this message has no significance as there is an alternative. They were using C++ and there was function name mangling. My case is entirely different. And the above two are invalid in my case. I am using C files. So no mangling. And I am not using JNI kind of function names. I am manually registering the functions using JNI_OnLoad. Hence my conclusion is that "No Implementation Found" is due to the fact that the application is somehow unable to find JNI_OnLoad. But why? It is present in the C file. Relevant sections of code are as follows. Please ask if you need more. jni/Android.mk include $(CLEAR_VARS) LOCAL_MODULE := me LOCAL_SRC_FILE := me.c include $(BUILD_SHARED_LIBRARY) com/venky/Home.java package com.venky; import android.app.Activity; import android.os.Bundle; public class Home extends Activity { static { System.loadLibrary("me"); } private native int getPermission(Activity activity); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home); getPermission(this); } } jni/me.c #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdarg.h&gt; #include &lt;string.h&gt; #include &lt;android/log.h&gt; #include &lt;jni.h&gt; #define LOG_TAG "com.venky.me" #define LOG_D(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) #define LO…
accepted answer: http://stackoverflow.com/a/24236807
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/11798054
has title: Android NDK : No JNI_OnLoad found in ... skipping init : But there is JNI_OnLoad
tagged with: android-ndk
favorite count: 0
has comment: http://stackoverflow.com/comment/37432111
type: Question
linked to: http://stackoverflow.com/q/4921222
has comment: http://stackoverflow.com/comment/37426836
linked to: http://stackoverflow.com/q/12626067
has comment: http://stackoverflow.com/comment/37432154
upvote count: 2

http://stackoverflow.com/a/24182598
answers question: http://stackoverflow.com/q/24182528
has body: use sc.hasNextDouble() / hasNextInt() to check whether the nxt number is a double / int and then use nextInt(), nextDouble() based on what hasNextXXX returns. EDIT : To read integer first , do : if(sc.hasNextInt()){ n=sc.nextInt(); }
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37328788

http://stackoverflow.com/a/24191244
has comment: http://stackoverflow.com/comment/37345721
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24191195
type: Answer
accepted answer of: http://stackoverflow.com/q/24191195
upvote count: 2
has comment: http://stackoverflow.com/comment/37346848
type: AcceptedAnswer
has body: Try: ((MonitorThread) threads.get("monitor")).SendAlert(); Instead. The . operator is higher in the order of operations than a cast. Also, as @MarcoAcierno indicated in comment below, you can get a ClassCastException if you're not careful, so you might: if(threads.get("monitor") instanceof MonitorThread) ((MonitorThread) threads.get("monitor")).SendAlert();
has comment: http://stackoverflow.com/comment/37345243

http://stackoverflow.com/comment/37313386
score: 0
comment on: http://stackoverflow.com/q/24173771
has text: Friendly point of procedure. It is best to add the error and stack trace to the actual question itself instead of in the comment section.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24235949
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37430787
has body: Load a Properties object from a file is probably your best option. Instead of hard coding them in your program you can put them in a properties file like so: uid=User ID bid=Billy ID ... THen load them using this API: http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html
accepted answer of: http://stackoverflow.com/q/24235862
type: Answer
answers question: http://stackoverflow.com/q/24235862
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24241755
has body: You can use an Abstract class with generics then extends it from you class. Something like this: public abstract class AbstractSomeclass&lt;E&gt;{ public void addObject(E... obj, List&lt;E&gt;){ //yourcode here } } Then in your class: public class MyClass extends AbstractSomeclass&lt;Airport&gt;{ public List&lt;Airport&gt; list; //..... public void someMethod(){ super.addObject( airportObject, list ); } } Maybe there is some minor errors (on this code), but hold on with the idea.
score: 0
answers question: http://stackoverflow.com/q/24241442
type: Answer

http://stackoverflow.com/q/24111962
type: Question
has answer: http://stackoverflow.com/a/24111987
has answer: http://stackoverflow.com/a/24111989
has body: I have an issue. When I click in a link the execution is passed to a servlet. Into this servlet there is the overridden init() that should be executed when the servlet starts. My question is how I can pass the element CountriesList to the jsp page signup.jsp ? If I were into the doGet() or doPost() functions, I could use forward() function but this is not the case. Any idea? @Override public void init() throws ServletException { this.getServletContext().setAttribute("CountriesList", signUpBean.getContriesList()); } EDIT problem solved protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("CountriesList", signUpBean.getContriesList()); String arg = "/signup.jsp"; RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(arg); dispatcher.forward(request, response); }
has title: Passing the result to the jsp page after the servlet has been executed
type: UnansweredQuestion
tagged with: java
tagged with: servlets
score: 0
answer count: 2
tagged with: jsp

http://stackoverflow.com/q/24198032
has title: Replicate mysql table to hive in Java Webapp
tagged with: hive
has body: I am having a table in mysql. I want to make a copy of it in hive. The programming language I am working upon is java. I have to perform this in a webapp. So I successfully made connection to both database via JDBC. Now the problem is how can I export-import the table? Manual Loading - Export MySQL Table as csv data and Import that csv data to Hive tables. Which is looking feasible to me right now somewhere for the implementation. But not the Ideal Solution. Sqoop: Cant able to find a feasible implementation of it so I can perform inside a webapp. Tungsten Replicator: I found and read about it. Looks good. But still searching for implementation via webapp.
score: 0
tagged with: java
answer count: 1
tagged with: jdbc
tagged with: mysql
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/24272077
type: UnansweredQuestion

http://stackoverflow.com/comment/37337513
comment on: http://stackoverflow.com/a/24186545
score: 0
type: AnswerComment
has text: Much better. It is so easily done. +1
type: Comment

http://stackoverflow.com/q/24186592
answer count: 5
has comment: http://stackoverflow.com/comment/54580013
has answer: http://stackoverflow.com/a/24186705
tagged with: java
has body: I'm new to Maven and I have downloaded the 3.0.5 version. I'm getting the following error: JAVA_HOME is set to an invalid directory. please set the java_home variable in your environment variable to match the location of your java installation Although, I see no error when I type javac or echo %M2_HOME% in the command prompt. I have the following path variables set - CLASSPATH - ;C:\Program Files (x86)\Java\jdk1.7.0_40\lib; JAVA_HOME - C:\Program Files (x86)\Java\jdk1.7.0_40\bin M2 - %M2_HOME%\bin M2_HOME - C:\Users\cbil\Documents\Maven\apache-maven-3.0.5-bin\apache-maven-3.0.5 MAVEN_OPTS - -Xms256m -Xmx512m PATH - C:\Program Files\Java\jdk1.7.0_45\bin;C:\Users\cbil\Documents\Maven\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin; Can someone please help me?
has answer: http://stackoverflow.com/a/24186685
has answer: http://stackoverflow.com/a/24186667
has answer: http://stackoverflow.com/a/24186626
score: 8
type: Question
type: UnansweredQuestion
tagged with: maven
downvote count: 1
duplicate of: http://stackoverflow.com/q/1184056
has answer: http://stackoverflow.com/a/24186651
favorite count: 0
linked to: http://stackoverflow.com/q/1184056
has title: Maven Installation under Windows: "JAVA_HOME is set to an invalid directory"
upvote count: 9

undo
type: Tag
tags question: http://stackoverflow.com/q/24238251
tag name: undo

http://stackoverflow.com/comment/37322978
type: QuestionComment
has text: Also, I do not see any log message on server console. it says HTTP JVM: com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript action expression.
score: 0
comment on: http://stackoverflow.com/q/24179266
type: Comment

http://stackoverflow.com/q/24187120
tagged with: eclipse
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24187383
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24187398
type: Question
has title: JDK for Eclipse(in windows platform)
possible better answer: http://stackoverflow.com/a/24187382
has answer: http://stackoverflow.com/a/24187398
has body: My qustion is really simple, all in the title. After some tests I found that by given a JRE/bin directory in the path(environment variable) , Eclipse can run normally with no problem. And Eclipse will never try to find the JRE by using JAVA_HOME variable. And in eclipse, I know that I can add installed JREs in the window preference and choose a JDK folder instead of a JRE folder. And for each project, we can change the compiler level. Since Eclipse can also compile the codes, when is JDK used? Debug? or what?
has answer: http://stackoverflow.com/a/24187382
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24187380

http://stackoverflow.com/comment/37422455
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24230302
type: AnswerComment
has text: Yet another idea I had: collect all of the commands first, and then execute the subprocesses, one after the other. It seems to me that you have one minute until the program has to do another pass through that relation.

http://stackoverflow.com/comment/37521734
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24257503
has text: Unfortunately, when i changed Ajax link component to plain Label, expanding node lasts still too long. Hovewer, browser doesn,t suspend totally, i don`t have to stop java script executing, but problem is that is too long. Have someone some another idea ? It is strange that problem performs only on IE. What can cause it ?
score: 0

http://stackoverflow.com/q/24198136
has title: Preserving numeric values in appengine endpoints json
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: google-app-engine
has body: so I have a User entity that is defined as follows: public class User { @Id @Setter @SerializedName (ID) @ApiResourceProperty (name = ID) protected String id; @Index @Setter @SerializedName (EMAIL) @ApiResourceProperty (name = EMAIL) protected String email; @Setter @SerializedName (DISPLAY_NAME) @ApiResourceProperty (name = DISPLAY_NAME) protected String displayName; @SerializedName (CREATED) @ApiResourceProperty (name = CREATED) protected long created; @Setter @SerializedName (MODIFIED) @ApiResourceProperty (name = MODIFIED) protected long modified; @ApiResourceProperty (name = ACCOUNT_STATE) @SerializedName (ACCOUNT_STATE) protected AccountState accountState; } When an instance of this User object is serialized, I get a JSON like below { "id" : "a1234", "em" : "bob@bobmail.com", "dn" : "Bob DeBuildeur", "ct" : "1402635502580", "mt" : "1402635502580", "as" : "UNVERIFIED" } The as value above is an enum that I'd like to serialize as -1, 0, or 1. The ct and mt values are timestamps and I'd like them as longs. So I'd like to see this JSON instead: { "id" : "a1234", "em" : "bob@bobmail.com", "dn" : "Bob DeBuildeur", "ct" : 1402635502580, "mt" : 1402635502580, "as" : -1 } Where/how do I take over the serialization of this object to properly serialize it to JSON?
has answer: http://stackoverflow.com/a/24210976
tagged with: google-cloud-endpoints
answer count: 2
upvote count: 2
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/24198441
downvote count: 0

http://stackoverflow.com/comment/37390431
has text: i add the table in here this.add(table); and my whole class extends JPanel...and also i have a gridlayout which is not null
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24214584

http://stackoverflow.com/a/24246876
upvote count: 3
downvote count: 0
type: AcceptedAnswer
has body: If NewApp is taking a long time, it should immediately return a 202 Accepted. The response should contain a Location header indicating where the user can go to look up the result when it's done, and an estimate of when the request will be done. OldApp should wait until the estimate time is reached, then submit a new GET call to the location. The response from that GET will either be the expected data, or an entity with a new estimated time. OldApp can then try again at the later time, repeating until the expected data is available. So The conversation might look like: POST /widgets response: 202 Accepted Location: "http://server/v1/widgets/12345" { "estimatedAvailableAt": "&lt;whenever&gt;" } . GET /widgets/12345 response: 200 OK Location: "http://server/v1/widgets/12345" { "estimatedAvailableAt": "&lt;wheneverElse&gt;" } . GET /widgets/12345 response: 200 OK Location: "http://server/v1/widgets/12345" { "myProperty": "myValue", ... }
score: 3
has comment: http://stackoverflow.com/comment/37463304
answers question: http://stackoverflow.com/q/24246544
has comment: http://stackoverflow.com/comment/37485983
type: Answer
accepted answer of: http://stackoverflow.com/q/24246544

http://stackoverflow.com/q/24160181
answer count: 3
tagged with: mainframe
has answer: http://stackoverflow.com/a/24190291
score: 0
has title: Convert from bytes[] to EBCDIC string
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24160478
has answer: http://stackoverflow.com/a/24168438
tagged with: string
has body: I am receiving bytes[] from mainframe MQ. This bytes[] I am trying to convert to EBCDIC string. I am using the following and the sytem just hangs. What could be the issue? new String(mqmdAccountingToken,"Cp1047"); mqmdAccountingToken is the byte array received from MQ. I feel that the Charset that I have provided is not correct. Is there a way to identify the correct charset to use and then convert?
has comment: http://stackoverflow.com/comment/37287605
tagged with: java
type: Question
tagged with: ibm-mq
has comment: http://stackoverflow.com/comment/37298736

http://stackoverflow.com/q/24239275
has answer: http://stackoverflow.com/a/24239382
duplicate of: http://stackoverflow.com/q/3948220
has body: When I went through numerous websites before posting this question on bit masking all i understood was it's used to toggle switch between 1's and 0's and usually used in pixel based graphic project. Now as a beginner really didn't understand why do we toggle the switch and how it is used in graphics.. Also why do we use bit masking to extract the bits??
type: Question
has title: Application of Unsigned right shift and bit masking
upvote count: 0
tagged with: bit-manipulation
answer count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3948220
has comment: http://stackoverflow.com/comment/37436959
tagged with: java
accepted answer: http://stackoverflow.com/a/24239382
score: -1

http://stackoverflow.com/comment/87189815
comment on: http://stackoverflow.com/a/24118148
type: Comment
score: 0
type: AnswerComment
has text: If you are not in a place to change the package, try marking the current package under sources. Check: https://stackoverflow.com/a/50087008/3604656

http://stackoverflow.com/q/24219087
has answer: http://stackoverflow.com/a/24235468
tagged with: java
has answer: http://stackoverflow.com/a/24219249
possible better answer: http://stackoverflow.com/a/24219249
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/30759385
has answer: http://stackoverflow.com/a/30771624
accepted answer: http://stackoverflow.com/a/24219262
has title: Why not chain java.util.stream.Stream#forEach
upvote count: 11
answer count: 6
score: 11
has body: In java 8,java.util.stream.Stream#forEach consider as a replacement for traditional for-loop. But why not this is not chain function.Says it return void instead of Stream&lt;T&gt; it self. Like this Arrays .stream(Girls.toArray()) .forEach(Girls::getUp) .forEach(Girls::dressUp) .filter(/* Top 10 Girls */) .forEach(Gay.getMe()::gotGirl) .endFilter()// Not an API, but it means remove last filter .filter(/* Worst 10 Girls */) .forEach(Gay.get(0)::gotGirl) girls = Arrays .stream(Girls.toArray()); girls.forEach(g-&gt;{g.getUp();g.dressUp()}); girls.filter(/* Top 10 Girls */) .forEach(Gay.getMe()::gotGirl); girls.filter(/* Worst 10 Girls */) .forEach(Gay.get(0)::gotGirl); The first is nice than second one.But the first one got worse performance. So, why forEach is not chainable ?
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47483063
downvote count: 0
has answer: http://stackoverflow.com/a/24219262

http://stackoverflow.com/comment/37302683
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24168300
score: 0
has text: oh whoops i didn't catch that typo.

http://stackoverflow.com/q/24246544
has answer: http://stackoverflow.com/a/24246701
tagged with: asynchronous
has answer: http://stackoverflow.com/a/24247066
has body: This might be a simple problem, but I can't seem to find a good solution right now. I've got: OldApp - a Java application started from the command line (no web front here) NewApp - a Java application with a REST api behind Apache I want OldApp to call NewApp through its REST api and when NewApp is done, OldApp should continue. My problem is that NewApp is doing a lot of stuff that might take a lot of time which in some cases causes a timeout in Apache, and then sends a 502 error to OldApp. The computations continue in NewApp, but OldApp does not know when NewApp is done. One solution I thought of is fork a thread in NewApp and store some kind of ID for the API request, and return it to OldApp. Then OldApp could poll NewApp to see if the thread is done, and if so - continue. Otherwise - keep polling. Are there any good design patterns for something like this? Am I complicating things? Any tips on how to think?
type: Question
tagged with: rest
possible better answer: http://stackoverflow.com/a/24246701
has comment: http://stackoverflow.com/comment/37451630
accepted answer: http://stackoverflow.com/a/24246876
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37451235
has answer: http://stackoverflow.com/a/24246876
answer count: 3
tagged with: java
has title: How to continue on client when heavy server computation is done

http://stackoverflow.com/q/24175307
answer count: 2
linked to: http://stackoverflow.com/q/884154
upvote count: 3
type: UnansweredQuestion
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/37315791
has comment: http://stackoverflow.com/comment/135561850
has comment: http://stackoverflow.com/comment/135570955
has answer: http://stackoverflow.com/a/24175366
favorite count: 0
has body: I would like to know if it is possible to programmatically provide a DataSource object to hibernate configuration? In our system we construct a datasource object (this is a Java SE application), and I would like to move from plain JDBC code to hibernate. If someone knows the answer with JPA this is also fine.
score: 3
has title: Programmatically provide datasource to hibernate
linked to: http://stackoverflow.com/q/4406935
tagged with: java
tagged with: hibernate
tagged with: datasource
has answer: http://stackoverflow.com/a/55203262
type: Question

http://stackoverflow.com/comment/37229940
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis No, it's not accepting input. The code simply ends. I'm trying to continiously accept user input via that while loop. Obviously my code is lacking...
comment on: http://stackoverflow.com/q/24129480
score: 0

http://stackoverflow.com/q/24162192
has comment: http://stackoverflow.com/comment/37290104
type: Question
linked to: http://stackoverflow.com/q/19452269
answer count: 3
upvote count: 0
type: UnansweredQuestion
has body: I have a EditText, where the user will input something, a String. And then after pressing the bottom, inverting the whole text and showing it to the user, but, I don't know how to place the String(The inverted text) into the TextView. CODE: final EditText e=(EditText)findViewById(R.id.escribiraqui); //INPUT final TextView T=(TextView)findViewById(R.id.traduccion); //OUTPUT Button TRAD=(Button) findViewById(R.id.traducir);//JUST THE BOTTOM Forget about inverting the text, now I just want to output the same Text(From the EditText to the TextView).
has comment: http://stackoverflow.com/comment/37290040
has answer: http://stackoverflow.com/a/24162468
tagged with: string
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24162296
has comment: http://stackoverflow.com/comment/37289940
has answer: http://stackoverflow.com/a/24162336
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37290289
has title: How to out put a message in Android Studio
score: -1
has comment: http://stackoverflow.com/comment/37290464

http://stackoverflow.com/comment/37335184
comment on: http://stackoverflow.com/q/24175558
score: 0
has text: You can use a primitive like `AtomicBoolean` to understand how mutual exclusion works, but I don't think you will learn much by using `wait` and `notify` to understand how wait and notify work. AtomicBoolean methods use special synchronization instructions that are provided by the CPU, but wait and notify rely on system calls that interact with the operating system scheduler. You can write programs that demonstrate what those methods _do_, but in order to show _how_ they do it, you will pretty much have to write a simulation of an operating system in Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37326851
score: 0
has text: possible duplicate of [Problem reading JPEG image using ImageIO.read(File file)](http://stackoverflow.com/questions/2408613/problem-reading-jpeg-image-using-imageio-readfile-file)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24178170

http://stackoverflow.com/q/24170564
type: Question
tagged with: anonymous-class
tagged with: actionlistener
type: AnsweredQuestion
score: 0
tagged with: java
has body: RadioGroup radioGroup = (RadioGroup) findViewById(R.id.orientation); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.horizontal: group.setOrientation(LinearLayout.HORIZONTAL); break; case R.id.vertical: group.setOrientation(LinearLayout.VERTICAL); break; } } }); What is radioGroup.setOnCheckedChangeListener eactly? Is it a method? What are it's arguments then?
tagged with: listener
has comment: http://stackoverflow.com/comment/37306592
answer count: 1
has answer: http://stackoverflow.com/a/24170806
has title: setOnCheckedChangeListener arguments
accepted answer: http://stackoverflow.com/a/24170806
has comment: http://stackoverflow.com/comment/37306760

http://stackoverflow.com/a/24190189
has comment: http://stackoverflow.com/comment/37381305
has comment: http://stackoverflow.com/comment/37361885
has body: It is quite simple: In Java 7, the context of a method call was not considered when inferring type arguments. The only thing that was considered where the arguments of a method call. In your case, int is boxed to Integer which yields List&lt;Integer&gt; as type for the inner call and then List&lt;List&lt;Integer&gt;&gt; as type for the outer call. Now you have a problem, since you want to assign the result to a variable of type List&lt;List&lt;? extends Number&gt;&gt; and this is just not possible since generics are invariant as long as there are no wildcards used, i.e., List&lt;X&gt; can never be converted to List&lt;Y&gt;. In your case X is List&lt;Integer&gt; and Y is List&lt;? extends Number&gt;. Even if List&lt;? extends Number&gt; contains a wildcard, it does not use a wildcard itself, i.e., it is not ? extends List&lt;? extends Number&gt;. This is why it does not compile in Java 7. I know understanding generics and variance and wildcards is not that easy. Maybe I can clarify it like this for you: Usually, A&lt;Y&gt; is never considered a subtype of any A&lt;Z&gt;. However, if Z inherits from Y, then A&lt;Z&gt; is a subtype of A&lt;? extends Y&gt;. Now to the nested generics: We do know, that the inner types (A&lt;Z&gt; and A&lt;? extends Y&gt; are related in a subtype relation. But if we wrap them in another generic type, like B&lt;A&lt;Z&gt;&gt; and B&lt;A&lt;? extends Y&gt;&gt; then rule 1. applies: Since there are no wildcards, the second B is not considered a subtype of the first one. If we again introduce a wildcard, then they are: B&lt;A&lt;Z&gt;&gt; is indeed a subtype of B&lt;? extends A&lt;? extends Y&gt;&gt;. But now note that the outher ? extends is missing in your example, so it does not compile in Java 7. Now to Java 8. Java 8 also takes the context of a call into account when inferring type arguments. Thus, Java 8 considers that you want to pass the result of the Arrays.asList calls to a variable of type List&lt;List&lt;? extends Number&gt;&gt;.…
has comment: http://stackoverflow.com/comment/37343832
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37362012
has comment: http://stackoverflow.com/comment/37343095
score: 3
answers question: http://stackoverflow.com/q/24188824
has comment: http://stackoverflow.com/comment/37361897
upvote count: 3

http://stackoverflow.com/a/24202631
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/88248713
answers question: http://stackoverflow.com/q/24200802
type: Answer
has body: Ok, I found the solution. It is described in Android Docs. I have to create additional folders named debug and release and whatever buildvariant I'd like and put the sourcefiles dependent on that variant there.
has comment: http://stackoverflow.com/comment/66745933

http://stackoverflow.com/comment/37370732
has text: How do you know that there are ever only 2 values added?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24204683
type: QuestionComment

http://stackoverflow.com/a/24234788
type: Answer
has comment: http://stackoverflow.com/comment/37434375
answers question: http://stackoverflow.com/q/24234195
score: 0
has comment: http://stackoverflow.com/comment/37436864
has comment: http://stackoverflow.com/comment/37478372
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24234195
has body: Date objects in Java simply represent an instant in time (specifically, the number of milliseconds before or after the epoch) - they don't store any information about how they should be displayed, nor should they. Formatting a date is purely for display purposes, and is the concern of the DateFormat hierarchy of classes and shouldn't be done until display time (unless you have a compelling reason to do it earlier than that, but I can't think of a good one). There's arguably nothing to stop you sending a DateFormat object alongside your Date, but you should never need to if you properly internationalise your code in the first place. One reason that you shouldn't do this is down to the difference in regional date formats. If you presented me with the date 03/07/2014, I'd see that as the 3rd of July 2014, because here in the UK we format our dates as DD/MM/YYYY. Present the same date to someone in the USA and they'll see it as March the 7th 2014, because US dates are typically MM/DD/YYYY. The database and the server don't need to know any locale information about the client, they should simply serve the requests for data where appropriate and let the client (which does know the locale information) format that data appropriately. TL;DR: You can't, because Java Date objects don't store display formatting rules. As you're using AChartEngine you should be able to achieve what you're after by using a TimeChart and passing in the date format mask via a call to the chart's setDateFormat(String) method.

http://stackoverflow.com/a/24245741
type: Answer
accepted answer of: http://stackoverflow.com/q/24245662
score: 2
has body: What about: try (BufferedReader br = new BufferedReader( new InputStreamReader(openFileInput(MainActivity.FILE_SERVERS)))) { String line = null; // start with null in case there is no line while ((line = br.readLine()) != null) { String[] tokens = line.split(","); MCServer server = new MCServer(tokens[0], tokens[1], tokens[2], tokens[3], Boolean.parseBoolean(tokens[4])); servers.add(server); } }
upvote count: 2
answers question: http://stackoverflow.com/q/24245662
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24257538
has title: How to create testcase for a class which contains enum references & parameterized constructors?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24257745
tagged with: java
has body: I have a class A which contains enum reference variables and parameterized constructors.Now i need to create a testcase for class A. how can i create objects for that enum reference variables of class A in class TestA? Example: class A{ private Enum1 enum1; private Enum2 enum2; private Enum3 enum3; private Enum4 enum4; private Enum5 enum5; public A(Enum1 enum1,Enum2 enum2){ } public A(Enum1 enum1,Enum2 enum2,Enum3 enum3){ ...... ...... }
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24257717
has comment: http://stackoverflow.com/comment/37472173

http://stackoverflow.com/q/24144722
tagged with: jscrollpane
answer count: 1
accepted answer: http://stackoverflow.com/a/24144887
has title: How do I make certain words in a scrollpane colored?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24144887
has body: So, I'm wondering how I would go about colouring certain words in my scrollpane. After doing some research I have found almost nothing helpful. What is there to help with colouring certain words? JScrollPane scrollPane = new JScrollPane(); contentPane.add(scrollPane, BorderLayout.CENTER); txtInfo = new JTextArea("Bot In Progress...\n"); txtInfo.setColumns(35); txtInfo.setEnabled(false); txtInfo.setDisabledTextColor(Color.black); scrollPane.setViewportView(txtInfo); So, here is my scrollpane. What I have it doing now is accepting outputs from part of my program and displaying them. Certain words that I want coloured are Win!(Green) and Loose(Red), and maybe some more later. The reason why a scrollpane works the best for me is because I need the log to update constantly and the user is supposed to be able to look back up at the log at any time. Is there a better way of storing that information or what?
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/37415264
comment on: http://stackoverflow.com/a/24227930
score: 0
type: Comment
type: AnswerComment
has text: I am trying this out @hans. Which permissions should I add in Menifest? I am currently using "android.permission.AUTHENTICATE_ACCOUNTS". Let me get back to you if this helps. Thanks a lot.

http://stackoverflow.com/q/24128006
answer count: 2
downvote count: 4
has body: I have a dictionary of about 40,000 words. In the past I have used it as a text file that I have read in and used it to check spelling of user words. However, I want to read it from a class, not a text file, so I don't have to ask for permission to do so. I would like, if possible, for all the words to be elements of an array (or list) in one java class. However, I get an exceeding limit error. What I don't understand is why I don't get that error if I read all the words from a file and store them in an array (as I have done in other java programs for desktop computers). It is the same set of words. I realise I am not publishing actual code, but just pasting thousands of words in the form of "ma", "macabre", "macaroni", "mace", "maced", "maces", "machete", etc. seems pretty pointless. I don't want to use someone else's word list because I am aiming at young children and my list has 'four letter words' removed, etc. Any ideas would be appreciated.
tagged with: java
accepted answer: http://stackoverflow.com/a/24128957
linked to: http://stackoverflow.com/q/6165887
has comment: http://stackoverflow.com/comment/37228540
has comment: http://stackoverflow.com/comment/37227014
has comment: http://stackoverflow.com/comment/37227702
has answer: http://stackoverflow.com/a/24128734
possible better answer: http://stackoverflow.com/a/24128734
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37227794
has title: Spelling checker in java for Android
has comment: http://stackoverflow.com/comment/37227115
tagged with: spelling
has comment: http://stackoverflow.com/comment/37228742
has comment: http://stackoverflow.com/comment/37241830
score: -2
has answer: http://stackoverflow.com/a/24128957
tagged with: android
has comment: http://stackoverflow.com/comment/37228911
has comment: http://stackoverflow.com/comment/37228581
has comment: http://stackoverflow.com/comment/37228163
has comment: http://stackoverflow.com/comment/37228198
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/a/24263353
has body: Don't move test resources, that's a bad idea. If you need to test a move, first copy your test resource somewhere else (consider using JUnit support for creating temporary files). Then test your move. Of course, if you're just moving a file then perhaps you don't need a test resource specifically to test that. You can just create a temporary file and move it.
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24263280
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24263280

http://stackoverflow.com/q/24203686
type: Question
has comment: http://stackoverflow.com/comment/37368949
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37369619
has title: java.lang.NullPointerException in spring datasource
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24204210
has comment: http://stackoverflow.com/comment/37369665
tagged with: mysql
has comment: http://stackoverflow.com/comment/37369386
has comment: http://stackoverflow.com/comment/37369657
has comment: http://stackoverflow.com/comment/37369074
has comment: http://stackoverflow.com/comment/37369536
has comment: http://stackoverflow.com/comment/37369580
has body: I done the database table in MySql . I want connection between spring application and database . For example , i am inserting value in edit-text it could be saved in Database(MySql) But i got the error . I am new for spring , please need help . Following is my error log. 16:05:44,784 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SpringSample].[mvc-dispatcher]] (http-localhost/127.0.0.1:8080-1) Servlet.service() for servlet mvc-dispatcher threw exception: java.lang.NullPointerException at com.rxoffice.test.controller.JDBCStudentDAO.findByStudentId(JDBCStudentDAO.java:65) [classes:] at com.rxoffice.test.controller.Home.hi(Home.java:33) [classes:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_32] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_32] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_32] at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_32] at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE] at or…
answer count: 2
downvote count: 0
upvote count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24204307
tagged with: maven
tagged with: spring
favorite count: 0

http://stackoverflow.com/q/24111441
has answer: http://stackoverflow.com/a/24111620
upvote count: 8
answer count: 6
has answer: http://stackoverflow.com/a/24121386
possible better answer: http://stackoverflow.com/a/24111508
has title: Java Wake Sleeping Thread
has answer: http://stackoverflow.com/a/24111504
score: 8
has answer: http://stackoverflow.com/a/24111502
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24111502
has body: I did some reading of other post but didn't find an exact answer to what I'm looking for, so I hope someone can give some some clarification. I have a program that will run for some time. I have some threads that run in the back ground that perform various tasks, to keep things simple let think of 3 threads. ThreadA performs a task every 10 seconds, where ThreadB does something every 30 seconds and ThreadC does something every 5 mintues. I don't use busy waiting, and put the threads to sleep for the designated times. My question is regarding a clean shut down. I have a variable that each of the threads have read access too, so they can see when the user initiates the exit of the program. The next time the threads are active, they exit their loops and join and all is good. But you can see that ThreadC only wakes up every 5 minutes. The question I have is can I signal the sleeping threads to wake up and exit before their sleep time is over? If this is not possible, do I need to rework the code to use wait() and notify() or is there a better way?
tagged with: thread-sleep
tagged with: java
tagged with: multithreading
downvote count: 0
has answer: http://stackoverflow.com/a/24111508
has answer: http://stackoverflow.com/a/75585328
favorite count: 0
type: Question

http://stackoverflow.com/a/24115012
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: These kind of applications are developed using XMPP protocol and here is the sample for developing the server app in Google App Engine Using Java Google App Engine and XMPP in Java http://xmppjingle.blogspot.in/2009/11/google-app-engine-xmpp-services-example.html http://googleappengine.blogspot.in/2009/10/interactive-xmpp-demos.html http://googlecloudplatform.blogspot.in/2013/07/multi-channel-chat-with-twilio-and.html
type: Answer
accepted answer of: http://stackoverflow.com/q/24114909
answers question: http://stackoverflow.com/q/24114909
score: 1

http://stackoverflow.com/comment/37350508
type: QuestionComment
has text: Just about anything is possible. But so far you've told us *nothing* about the format of the data, so there's little we can do to help you.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24193788

http://stackoverflow.com/q/24105944
has body: Warning: sharing your TOTP seed with third-parties breaks the very basic assumption of multi-factor authentication that the TOTP seed is secret. I generated a secret EBWFBWYCPPELHQS5 and I can add it manually to the Google Authenticator App. But if I generate a QR-Code from this secret via the google chart API, I can not scan the QR-Code, the app tells me the QR-code is not valid. This would be the QR-code for the secret above: https://chart.googleapis.com/chart?chs=200x200&amp;chld=M%7C0&amp;cht=qr&amp;chl=otpauth://totp/test@test&amp;secret=EBWFBWYCPPELHQS5 My code to generate the url looks like this: public static String getQRBarcodeURL(String user, String host, String secret) { return "https://chart.googleapis.com/chart?" + getQRBarcodeURLQuery(user, host, secret); } public static String getQRBarcodeURLQuery(String user, String host, String secret) { return "chs=200x200&amp;chld=M%7C0&amp;cht=qr&amp;chl=" + getQRBarcodeOtpAuthURL(user, host, secret); } public static String getQRBarcodeOtpAuthURL(String user, String host, String secret) { return String.format("otpauth://totp/%s@%s&amp;secret=%s", user, host, secret); } How can I get this working
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138116762
has title: QR-Code with google chart API - Invalid for google authenticator app
tagged with: qr-code
score: -1
accepted answer: http://stackoverflow.com/a/24109841
upvote count: 0
has answer: http://stackoverflow.com/a/24109841
tagged with: java
answer count: 1
tagged with: authentication
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/24155459
has comment: http://stackoverflow.com/comment/37278407
has title: converting char values in string to int for multiplication
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37278272
has comment: http://stackoverflow.com/comment/37278451
tagged with: type-conversion
tagged with: int
has comment: http://stackoverflow.com/comment/37278219
score: 0
tagged with: char
has body: Good evening everyone. I can't seem to figure this out. I have written a function to break down a simple ascii art txt file and convert it to a form of number representation where the number specifies how many times the proceeding character value were scanned in from a source file. IE: ### was converted to (3,#,nextVal,nextChar). As part of an assignment for class, I need to essentially reverse the previous operation back into an ascii art style. How should I go about converting the numbers within into int values that could be used to specify desired number of the following char? Here's what I've been trying thus far public static void numRepToImage(File input, File output) throws FileNotFoundException { PrintStream out=new PrintStream(input); Scanner in=new Scanner(output); while(in.hasNextLine()) { String s=in.nextLine(); for(int x=0; x&lt;s.length()-5; x+=4) { char[] ch = new char[s.charAt(x)]; for(int y=0; y&lt;=s.length()-1; y++) { int z = (int) (ch[x] - '0'); out.print(z*s.charAt(y)); } } out.println(); This code compiles, but I receive an array index out of bounds exception also. I apologize for my newness to java still.
tagged with: java
has comment: http://stackoverflow.com/comment/37278340
type: Question

http://stackoverflow.com/comment/37452091
has text: @Salman Looks like CertUtils.getCertificate() required certificate in DER format, not JKS keystore.
score: 0
comment on: http://stackoverflow.com/a/24221533
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24241045
has comment: http://stackoverflow.com/comment/37440830
downvote count: 0
has comment: http://stackoverflow.com/comment/37440847
has comment: http://stackoverflow.com/comment/37440626
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37440698
has body: I have a web application running under Tomcat 7 using Spring with c3po as the connection pool manager. I have also used dbcp and have the same result. I initiate a long running single threaded process which makes a large number of database calls using jdbcTemplate.update(), etc, in various dao's. As each of these updates is simple and independent, no transaction manager is being used. For some reason, I am running out of connections. What appears to be happening is that each dao is holding onto its own connection and not returning it to the pool. Is this normal behaviour? I had expected that the connection was tied to the jdbcTemplate.update() and released back as soon as this had finished. ... In the context file... &lt;bean id="enquiryDataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="driverClassName" value="${enquiry.drivername}"/&gt; &lt;property name="url" value="${enquiry.jdbc}"/&gt; &lt;property name="username" value="${enquiry.username}"/&gt; &lt;property name="password" value="${enquiry.password}"/&gt; &lt;property name="maxWait" value="30000"/&gt; &lt;property name="maxActive" value="50"/&gt; &lt;/bean&gt; In a typical dao constructor... @Autowired public XXXCountryDao(@Qualifier("enquiryDataSource") DataSource dataSource, @Qualifier("sqlUpdaterFactoryImpl") SqlUpdaterFactory sqlUpdaterFactory, @Qualifier("sqlFormatterFactoryImpl") SqlFormatterFactory sqlFormatterFactory) { super("Country", dataSource, sqlUpdaterFactory, sqlFormatterFactory); // ...other constructor stuff } All dao's inherit from... public abstract class AbstractFileProcessorDao&lt;ImportRecType, QueryRecType&gt; extends JdbcDaoSupport { // ... } In a typical dao method... protected boolean runUpdateToSqlDatabase(Map&lt;String, Object&gt; values, Map&lt;String, Object&gt; whereValues) { if (values.isEmpty()) return true; String sql = updateUpdaterServer.getSql(values, whereValues); if (logger.isDebugEnabled()) logger.debug("Server SQL …
has comment: http://stackoverflow.com/comment/37440666
has comment: http://stackoverflow.com/comment/37442370
has comment: http://stackoverflow.com/comment/37440916
has comment: http://stackoverflow.com/comment/37440281
has comment: http://stackoverflow.com/comment/37441830
has comment: http://stackoverflow.com/comment/37440806
has comment: http://stackoverflow.com/comment/37440929
type: Question
has comment: http://stackoverflow.com/comment/37441219
has comment: http://stackoverflow.com/comment/37440917
tagged with: connection-pooling
upvote count: 1
has comment: http://stackoverflow.com/comment/37440755
has title: C3PO connection pooling - connections not being released
has comment: http://stackoverflow.com/comment/37440472
answer count: 1
has comment: http://stackoverflow.com/comment/37442828
tagged with: spring
has answer: http://stackoverflow.com/a/24246671
accepted answer: http://stackoverflow.com/a/24246671
favorite count: 0
has comment: http://stackoverflow.com/comment/37448723
has comment: http://stackoverflow.com/comment/37441755
has comment: http://stackoverflow.com/comment/37442748
has comment: http://stackoverflow.com/comment/37440783
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37442419

http://stackoverflow.com/a/24163086
has body: Correct; at this time, only the sync client is supported. Feel free to open an improvement JIRA issue here and, of course contributions are always welcome - guidelines here. That said, it's not clear to me the benefit of using an async client in the inbound adapter as in your example; it is message-driven and arriving messages are delivered asynchronously on the client's thread. Obviously, the outbound adapter could gain some benefit from async operations. The outbound adapter is pretty simple and shouldn't be too hard to write one that uses the async client - it would probably need to send the delivery tokens to some channel - but we should abstract away from the IMqttDeliveryToken object so we don't leak Paho into the upper layers.
type: Answer
accepted answer of: http://stackoverflow.com/q/24141082
answers question: http://stackoverflow.com/q/24141082
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24168771
has answer: http://stackoverflow.com/a/25706595
type: Question
has answer: http://stackoverflow.com/a/24755670
answer count: 2
has comment: http://stackoverflow.com/comment/37303097
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37314514
has title: SSLSocket not found; Spring Roo 1.2.5, STS 3.6, SQLServer driver, cannot convert from Class<AnyClassPK> to Class<? extends Serializable>
has comment: http://stackoverflow.com/comment/37314462
tagged with: spring-tool-suite
tagged with: java-8
has comment: http://stackoverflow.com/comment/37314486
tagged with: sql-server
has body: I started working with Spring Tool Suite 6.0 M1, Spring Roo 1.2.5, JDK 8.0, Windows 7 Home; I created a Spring Roo project but I'm having troubles to complete the project configuration. Here the steps: The Roo project is created: File > New > Other > Spring > Spring Roo Project jpa setup is completed JTDS is being used by default as follow.. database.driverClassName=net.sourceforge.jtds.jdbc.Driver database.url=jdbc\:jtds\:sqlserver\://localhost\:1433/mydb osgi start --url file:///D:/RooThings/jtds-1.2.4.jar (it worked fine) database reverse engineering complete with success. There are warnings for a couple of classes within the project: @RooJpaEntity(identifierType = SeriePK.class, versionField = "", table = "Serie", schema = "dbo") public class Serie {} ** SeriePK.class : Type mismatch: cannot convert from Class&lt;'SeriePK> to Class&lt;'? extends Serializable> At SeriePK.class: @RooIdentifier(dbManaged = true) public final class SeriePK {} I extended it with Seriealizable, but the warning is still there. I tried to fix this changing the SQLServer driver as follow: I followed this support: Setup SqlServer Driver in Roo project database.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver database.url=jdbc\:sqlserver\://localhost\:1433;database=mydb osgi start --url file:///D:/RooThings/sqljdbc4-4.0.jar (it worked fine) roo> database introspect --schema dbo javax.net.ssl.SSLSocket not found by [84] so, I can't to continue working with Roo anymore.. Any help I'd really appreciate.
score: 0
tagged with: spring-roo
tagged with: java

http://stackoverflow.com/a/24243053
accepted answer of: http://stackoverflow.com/q/24242568
upvote count: 2
has comment: http://stackoverflow.com/comment/37444231
score: 2
downvote count: 0
has body: Firstly, register HomePage activity in manifest. And change public class HomePage extends MainActivity{ } to public class HomePage extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); } } Hope this helps.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37444150
has comment: http://stackoverflow.com/comment/37444373
answers question: http://stackoverflow.com/q/24242568
type: Answer

http://stackoverflow.com/q/24202859
tagged with: jar
tagged with: manifest
score: 0
tagged with: java
answer count: 1
tagged with: dependencies
has body: I have big project in java. Project packages have its on lib folder for certain dependency. Now Its size is grown. In some pkg's lib contain two jars those are almost identical. like abc/lib has commons-lang-2.5 jar. and xyz/lib has commons-lang-2.6 jar. Now I think its adding some redundency so what I do to have simple one jar only. so which one I remove? and how do I manage Manifest.inf eclipse file?
type: Question
has title: how to remove jar file from project?
has answer: http://stackoverflow.com/a/24203047
type: UnansweredQuestion

http://stackoverflow.com/comment/37316889
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24173889
has text: This question appears to be off-topic because it is about 3D geometry and not specifically about programming. Before you can write code you need to have the mathematical algorithm defined and it appears you do not have that yet.

http://stackoverflow.com/q/24133987
has body: I am writing a basic android app involving Spen SDK. My XML file is:- &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=".MainActivity"&gt; &lt;FrameLayout android:id="@+id/canvas_container" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;com.samsung.sdraw.CanvasView android:id="@+id/canvas_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/ic_launcher" /&gt; &lt;com.samsung.sdraw.SettingView android:id="@+id/setting_view" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/FrameLayout&gt; &lt;/RelativeLayout&gt; As soon as I write this XML, some error pops up in my Preview Panel. The screen-shot is attached below: The error is:- Rendering Problems: The following classes could not be instantiated: - com.samsung.sdraw.CanvasView (Open Class, Show Exception) - com.samsung.sdraw.SettingView (Open Class, Show Exception) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details (&lt;-----with regard to com.samsung.sdraw.CanvasView class) Write access not allowed during rendering (\mnt\sdcard\android\data\null\serial) at com.android.ide.common.rendering.RenderSecurityException.create(RenderSecurityException.java:52) at com.android.ide.common.rendering.RenderSecurityManager.checkWrite (RenderSecurityManager.java:544) at java.io.File.mkdir(File.java:1305) at java.io.File.mkdirs(File.java:1337) at com.samsung.sdraw.z.a(SourceFile:23) at com.samsung.sdraw.z.a(SourceFile:15) at com.samsung.sdraw.Setting.a(SourceFile…
has comment: http://stackoverflow.com/comment/37238465
type: Question
has title: Basic sample program of Spen SDK throws Run time exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37238439
tagged with: samsung-mobile-sdk
tagged with: android
tagged with: samsung-mobile
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/37238358
tagged with: java
has comment: http://stackoverflow.com/comment/37238865

http://stackoverflow.com/q/24198163
upvote count: 2
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24198210
has body: I am trying to validate the email id and password provided by user using imap java .I have written basic code which can connect to the account and download mails . but when the email id or password is incorrect it just give this error : avax.mail.AuthenticationFailedException: Invalid credentials wu2mb53991170pac at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:474) at javax.mail.Service.connect(Service.java:275) at javax.mail.Service.connect(Service.java:156) at mailchecker.main(mailchecker.java:19) but what I want is just to check whether credentials are correct or not . For eg. if the credentials are correct program should print ok otherwise sorry or something like that...I am new to this so any idea how can I do this? EDIT: This is my code: public static void main(String args[]) { Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); try { System.out.println("hi"); Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); store.connect("imap.gmail.com", "&lt;username&gt;", "password"); System.out.println(store); Folder inbox = store.getFolder("Inbox"); inbox.open(Folder.READ_ONLY); Message messages[] = inbox.getMessages(); for(Message message:messages) { System.out.println(message); } } catch (NoSuchProviderException e) { e.printStackTrace(); System.out.println("hi"); System.exit(1); } catch (MessagingException e) { e.printStackTrace(); System.exit(2); } catch (javax.mail.AuthenticationFailedException e) { e.printStackTrace(); System.out.println("hi"); System.exit(1); } } when I put this it gives error . error: exception AuthenticationFailedException has already been caught What should I do?
accepted answer: http://stackoverflow.com/a/24198210
downvote count: 0
tagged with: java
answer count: 1
tagged with: email
has comment: http://stackoverflow.com/comment/37358385
has comment: http://stackoverflow.com/comment/37358408
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37358611
has title: How to check whether email id and password provided by user is correct?
tagged with: imap

http://stackoverflow.com/a/24114145
has comment: http://stackoverflow.com/comment/37232782
answers question: http://stackoverflow.com/q/24113652
accepted answer of: http://stackoverflow.com/q/24113652
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37424042
score: 3
has body: use the below code. This will satisfy your requirement. I tried this and working for me. Relative layout with below,above attributes. Relativelayout is better than Linear layout with weight method. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/relative" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentTop="true" android:gravity="center_horizontal" android:text="ListView Heading" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" android:gravity="center_horizontal" android:text="ListView Footer" /&gt; &lt;ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/textView1" android:layout_above="@id/textView2" &gt;&lt;/ListView&gt; The UI will like this
has comment: http://stackoverflow.com/comment/37286836
type: Answer

http://stackoverflow.com/a/24156000
score: 1
has comment: http://stackoverflow.com/comment/37359186
downvote count: 0
has body: the stub class [is] not in the client-side jar. The stub class must be in the client JAR file, unless you're using the codebase feature. why does the Windows version work? If it's working on one platform and not others, the stub class is clearly in the CLASSPATH on the platforms where it works, and not in the platforms where it doesn't. Or, if you're using the codebase feature, which you haven't said anything about, the codebase URL isn't accessible from all the platforms.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24154240
has comment: http://stackoverflow.com/comment/37359488

http://stackoverflow.com/q/24214706
has title: sql server error "A result set was generated for update"
tagged with: sql-server-2008
type: UnansweredQuestion
score: 4
answer count: 0
tagged with: sql
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37390920
has body: How do I set "set nocount on" for a trigger? When I set it in the trigger and open the trigger code, I see it has disappeared! My requirement to set the statement comes from below: I am using Java third party API to make a SQL "UPDATE" statement. The table being updated has a trigger on it which is causing the following failure: "com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update." If I disable the trigger, the issue disappears. If the UPDATE statement is run by itself there are no errors. My questions is how can I set "SET NOCOUNT ON"?? If I modify the trigger and add this line, and open the trigger again, I notice that the "nocount on" statement has disappeared. I am unable to set it at "server" level as I do not have permission to do this. Thanks! Bruce
favorite count: 0
type: Question
upvote count: 4

http://stackoverflow.com/comment/37443909
type: Comment
has text: I see, I will try to fix it. Thanks :) How to make this right in this else- I mean this "notify" from another thread? I see this is my problem, cus in the loop I use 4 threads and tell them wait, but notify doesn't work from this.notify.
type: AnswerComment
comment on: http://stackoverflow.com/a/24242890
score: 0

http://stackoverflow.com/a/24250830
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24235452
downvote count: 0
upvote count: 1
has body: The test is complicating things unnecessarily. Try the following instead: @Test public void registerNewFoo_fooAddedToList() { Bar bar = new Bar(m_mockFooList); bar.registerNewFoo("test id"); new Verifications() {{ m_mockFooList.addNewFoo((Foo) withNotNull()); }}; } Note: m_mockFooList.getFoo(...) returns null by default if no expectations are recorded on it.
type: Answer
accepted answer of: http://stackoverflow.com/q/24235452

http://stackoverflow.com/comment/37213308
type: Comment
has text: @NiravPrajapati can you please desing a form example for me ? m not able to get it yet
type: QuestionComment
comment on: http://stackoverflow.com/q/24119973
score: 0

model-driven
tags question: http://stackoverflow.com/q/24181695
tag name: model-driven
type: Tag
tags question: http://stackoverflow.com/q/24196992

http://stackoverflow.com/comment/37373812
comment on: http://stackoverflow.com/a/24201654
type: Comment
type: AnswerComment
score: 0
has text: Could you help me add the numbers to the list please? Thank you for the explanation too.

http://stackoverflow.com/q/24206646
type: Question
tagged with: bitbucket
has body: I'm working on a videogame with a my friend. We are working with Eclipse and we are using maven. We use BitBucket to synchronize the project but now we have a problem. I'm doing the GUI but I don't know how to upload the images and an xml file in the project and synchronize this with bitbucket. Now I'm using the path of the file that is on my desktop. There is a way to load all the files and import these into the project? I'm searching a solution that is correct also when we must export the project in a jar file.
score: 0
type: UnansweredQuestion
answer count: 1
tagged with: maven
has answer: http://stackoverflow.com/a/24206839
tagged with: java
has title: How to upload images and xml file into a maven project in eclipse
tagged with: eclipse

http://stackoverflow.com/comment/37457847
type: Comment
type: QuestionComment
has text: @Dwill34 Laambi's answer is good but you should probably initiate SIZE outside of the if statement and then check if size was set before using it.
score: 0
comment on: http://stackoverflow.com/q/24249917

http://stackoverflow.com/comment/37307492
type: AnswerComment
score: 0
has text: Very nice, I was pretty close to this, the HashMap would be a nice touch for efficient indexOf(Object o) calls, but I think you might have the arguments the wrong way around... if that is what you're using the HashMap for?
type: Comment
comment on: http://stackoverflow.com/a/24157346

http://stackoverflow.com/comment/37406725
comment on: http://stackoverflow.com/q/24223339
type: Comment
has text: @HovercraftFullOfEels It's not in the part of code i pasted, i didn't want the post to be too big because there are atm 276 lines of code in it, i tried to localize the problem
type: QuestionComment
score: 0

http://stackoverflow.com/q/24228243
type: Question
has title: Java JTable - show rows only which matches the string
upvote count: 2
has body: I have a JTable populated with data from a database. I have added a search function that display the rows, if word matched to some rows when the data is typed into a JTextField. But at the minute as you type a string or word that do not matches any of the rows data, what I want to do is to hide all the rows, and the JTable will show just the column names. Just like when something matches IT, shows those rows only which has the string that user typed and hide others. Here is my code that I am using: if (text.length() == 0) { sorter.setRowFilter(null); } else { try { sorter.setRowFilter( RowFilter.regexFilter(text)); } catch (PatternSyntaxException pse) { System.err.println("Bad regex pattern"); } } }
score: 2
tagged with: jtable
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37419553
linked to: http://stackoverflow.com/q/14102223
accepted answer: http://stackoverflow.com/a/24228290
tagged with: java
has answer: http://stackoverflow.com/a/24228290
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/20325722
tagged with: swing
linked to: http://stackoverflow.com/q/24218546
tagged with: rowsorter
favorite count: 0

http://stackoverflow.com/comment/37586190
comment on: http://stackoverflow.com/q/24231873
score: 0
type: Comment
type: QuestionComment
has text: @Serge Ballesta Okay so heres the lowdown... I have managed to break the cycle of error.. lol if I choose to write to a txt file on the c drive it works fine correct output and all, however the application will not write to the txt file inside the application, I have checked the build file in the windows explorer as well as everywhere else still cant find the data... strange to me

http://stackoverflow.com/comment/37440417
comment on: http://stackoverflow.com/q/24241035
score: 0
type: Comment
type: QuestionComment
has text: Well, I want a way so that my code runs again, but I don't want to have to type it out again. Sorry for my noobiness.

http://stackoverflow.com/comment/37445845
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24243092
has text: Because the increase in performance (if any) is not worth the decrease in readability and maintainability. Also, with your version you'd have two branches that run duplicate code. Even though the duplicate code is right next to each other, someone updating the code in one branch may fail to update the code in the other. I've seen it more times than I'd like.
type: Comment

http://stackoverflow.com/comment/37498603
comment on: http://stackoverflow.com/a/24266432
score: 0
type: Comment
has text: @devnull: I must admit I was surprised by the fact that a regex could get this far. I suppose the main benefit of a parser is its potential to _recognize_ the number (e.g. map thirty-two to 32). If you don't need that, then it may be overkill. Anyway, google on `java parser generator` and you will get a lot of promising links. None in particular that I can recommend, sorry.
type: AnswerComment

http://stackoverflow.com/q/24133310
type: Question
has comment: http://stackoverflow.com/comment/37238795
has comment: http://stackoverflow.com/comment/37236947
has comment: http://stackoverflow.com/comment/37237283
has comment: http://stackoverflow.com/comment/37257376
type: AnsweredQuestion
score: 0
has body: Some of the most used methods in the Calendar object return void and are not chainable, such as add(). Even more so, the class appears to be mutable where if you add, for example, a day to a Calendar object, the original Calendar object will be modified with the new date. I have written this: Calendar currentTime = Calendar.getInstance(TimeZone.getTimeZone("UTC")); // report.time() returns a Calendar instance if(report.time().after(currentTime.getTime().add(Calendar.DATE, 1)) || currentTime.after( report.time().add(Calendar.MONTH, 5) )){ validTime=false; } This does not compile because the add() methods being used in the parameters of after() return void and after() is expecting a Calendar instance, not void. The only other solution I can think of is very ugly and bloated: Calendar currentTime = Calendar.getInstance(TimeZone.getTimeZone("UTC")) Calendar nextDay = Calendar.getInstance(TimeZone.getTimeZone("UTC")); nextDay.add(Calendar.DATE, 1)) Calendar nextMonths = Calendar.getInstance(TimeZone.getTimeZone("UTC")); nextMonths.add(Calendar.MONTH, 5)) if(report.time().after(nextDay) || currentTime.after(nextMonths )){ validTime=false; } Is there a more concise way to do this?
tagged with: java
has comment: http://stackoverflow.com/comment/37238461
answer count: 1
has answer: http://stackoverflow.com/a/24134640
accepted answer: http://stackoverflow.com/a/24134640
tagged with: calendar
has title: Concise way to handle the Calendar object in Java

http://stackoverflow.com/a/24259183
has body: Thanks to you, nilesh, I had an idea. I write for anyone who might encounter the same difficulty. My solution is made ​​very simple, I instantiate my driver and just before the get(url), I run my AWT.Robot is now a Thread. This allows me to not be bothered by the blocking property of driver.get(url); private boolean openBrowserOnPage() { try { driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); // run the robot which extends Thread RobotHabile robot = new RobotHabile(); robot.start(); // Open the browser driver.get(url); // Wait for robot action while(robot.isAlive()){ // not much, wait } return true; } catch (Exception e) { e.printStackTrace(); System.out.println("Erreur : Impossible de se connecter/acceder au service '" + url + "'"); } return false; } Hoping to help someone
has comment: http://stackoverflow.com/comment/37556126
has comment: http://stackoverflow.com/comment/37495642
has comment: http://stackoverflow.com/comment/37556105
answers question: http://stackoverflow.com/q/24245961
has comment: http://stackoverflow.com/comment/37556211
type: Answer
score: 0

http://stackoverflow.com/q/24220823
duplicate of: http://stackoverflow.com/q/2247998
accepted answer: http://stackoverflow.com/a/24221295
type: AnsweredQuestion
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/24221295
upvote count: 1
tagged with: eclipse
favorite count: 0
type: Question
has title: No Class Def Found Eclipse Android
tagged with: android
has body: I am trying to read wave file into a double array. The problem is that I have included JRE System library which contains the class definition for AudioSystem.class that I am using but I get the No Class Def Found Excepition and I have tried checking it in order and export tab and also changing the order of the src and gen folder and also kept JRE System Library in the top. Nothing Works. Any help will be appreciated.
linked to: http://stackoverflow.com/q/2247998
answer count: 1
score: -1

http://stackoverflow.com/comment/37330331
has text: Using pattern matching is way too complicated. String.contains("...") is the way to go.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24177053
type: Comment

http://stackoverflow.com/comment/37482745
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24262575
has text: sorry,i'm freshman,i'm just want to make it available.can you tell me more detail ablout it?
type: Comment

http://stackoverflow.com/q/24146519
has comment: http://stackoverflow.com/comment/37261469
tagged with: multimap
has comment: http://stackoverflow.com/comment/37261643
type: Question
has body: I can't seem to figure this out even after look at this: Adding values of two maps whenever there is a key match. I made a multi map that contains radius as keys and the amplitude as values. But there are duplicates of keys. So I want to traverse the whole map and if there are duplicate keys I want to add the values of those keys. I have tried adding it to a new map or a double sum but I can't seem to get it to work. What am I missing. Multimap&lt;String, String&gt; multimap = LinkedListMultimap.create(); for(......){ String newRad = String.valueOf(radius); String val = String.valueOf(num); multimap.put(newRad, val); } ........ double s=0.00; //java.util.Map multimap2; Multimap&lt;Double, Double&gt; multimap2 = LinkedListMultimap.create(); Iterator it = multimap.entries().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); double currentKey = Double.parseDouble((String) pairs.getKey()); String newRad = String.valueOf(1.83); if(multimap.containsKey(newRad)){ double values = Double.parseDouble((String) pairs.getValue()); s += values; System.out.println(s); } else{ s = 0.00; } System.out.println(pairs.getKey() + " = " + pairs.getValue()); //it.remove(); // avoids a ConcurrentModificationException } So basically it should be like this: the multimap contains: 1.36 = 59.0 1.36 = 65.0 1.35 = 56.0 1.35 = 71.0 1.34 = 64.0 1.34 = 75.0 1.33 = 59.0 Afterwards it should be like this (it should find any duplicate keys in the multimap and add the values): 1.36 = 124.0 1.35 = 127.0 1.34 = 139.0 1.33 = 59.0 UPDATE: So I am being able to add the values but I thinks its adding all the value in the map not just the ones with the duplicate. I tried it on 1.83 and it gives me values like 7337061.0 and it keeps increasing. What is wrong with my if statement?
accepted answer: http://stackoverflow.com/a/24146692
has answer: http://stackoverflow.com/a/24146692
linked to: http://stackoverflow.com/q/588004
has title: How to add values in a multi map
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37261519
score: 0
linked to: http://stackoverflow.com/q/15136508
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37261557

http://stackoverflow.com/comment/75820319
type: AnswerComment
has text: The lock is not necessary if the layout implementation is threadsafe (most if not all built-in Log4j2 layouts are thread safe).
type: Comment
comment on: http://stackoverflow.com/a/24220688
score: 0

http://stackoverflow.com/q/24125371
downvote count: 0
answer count: 1
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24125679
score: 1
has answer: http://stackoverflow.com/a/24125679
tagged with: java
has body: I know how to make Map&lt;String, Car&gt; but how to make Map&lt;String, List&lt;Car&gt;&gt; in lambdaj? This is code I want to write in LambdaJ: Map&lt;String, List&lt;Car&gt;&gt; driverCarsMap = new HashMap&lt;String, List&lt;Car&gt;&gt;(); for (Car car : cars) { String driver = car.getDriver(); if (!driverCarsMap.containsKey(driver)) driverCarsMap.put(driver, new ArrayList&lt;Car&gt;()); driverCarsMap.get(driver).add(car); } Unfortunately the code: Map&lt;String, List&lt;Car&gt;&gt; driverCarsMap = index(cars, on(Car.class).getDriver()); creates the Map, but value is not being extended but overwritten. So, de facto we do note have a List but single object.
has title: How to create Map in LambdaJ where value is Collection?
type: AnsweredQuestion
tagged with: lambdaj

http://stackoverflow.com/q/24200197
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/8352378
has answer: http://stackoverflow.com/a/24200519
has title: Why HashMap Takes capacity as capacity <<= 1;
score: 3
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
has body: I want to know why HashMap always takes a size which is multiple of 2 and why other collections do not? What is the reason behind that? Thanks
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/8352378
tagged with: hashmap

http://stackoverflow.com/q/24258242
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/37493947
score: 0
tagged with: liferay
answer count: 0
has body: I am using liferay 6.2 for migrating my existing web application to liferay.I have done below things: -->created my own theme extending the _styled theme -->customized the navigation to have fixed sidebar on the left and content area on the right. -->Added 3 web content display portlets dynamically and added the content into each of them. I have all the portlets residing on the same page,these are traversed by using navigation bar on the left side. Now I have new requirement to show content depending on the client. For e.g. I have 3 client's data right now mixed all together across all portlets ,I have requirement to segregate all the content.For e.g. If user logging in work for X client ,he/she should only see the relevant content . If there is some content which is common to all it should be displayed as it is. There should also be a way to add/remove client at runtime.Is liferay multi-site capability something I can make use of? How can I go ahead and achieve this? Any inputs will be highly appreciated.
has comment: http://stackoverflow.com/comment/37482208
has comment: http://stackoverflow.com/comment/37501964
has comment: http://stackoverflow.com/comment/37483113
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37482953
tagged with: java
tagged with: liferay-theme
has title: Managing content in liferay

http://stackoverflow.com/a/24198984
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24198968
downvote count: 0
has body: The local variable will always hide (shadow) the "global" one. In Java, you can access to an instance variable by using the keyword this. This is often used in constructors. For example: private String someVar; public ClassName(String someVar) { this.someVar = someVar; // this.someVar is the instance variable // someVar is the local variable }
has comment: http://stackoverflow.com/comment/71398257
answers question: http://stackoverflow.com/q/24198968
has comment: http://stackoverflow.com/comment/37360117
type: AcceptedAnswer
type: Answer
score: 3

http://stackoverflow.com/a/24264091
accepted answer of: http://stackoverflow.com/q/24264029
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24264029
type: AcceptedAnswer
downvote count: 0
has body: The difference is between whether you do the multiplication first or the division first - and what the types of those operations are. This: (x - 32) * 5 / 9 is equivalent to: ((x - 32) * 5) / 9 So if the type of x is double, then the type of x - 32 is double, so the 5 is promoted to double, the multiplication is done in double arithmetic, giving a double result, and then the division is also done in double arithmetic. Even if x is an integer type, you're doing the multiplication first, which will presumably give you a value bigger than 9 (in your test case), leaving you with a non-zero result. For example, if x is 45, then x-32 is 13, (x - 32) * 5 is 65, and the overall result is 7, then converted to 7.0 on assignment. That's not the same result you'll get if x is a double with the value 45.0, but it's still better than multiplying by 0...
has comment: http://stackoverflow.com/comment/37484615
type: Answer

http://stackoverflow.com/q/24121806
tagged with: swing
has comment: http://stackoverflow.com/comment/37215175
has title: Java GridBagLayout - disable vertical fill
has answer: http://stackoverflow.com/a/24121962
accepted answer: http://stackoverflow.com/a/24121962
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24122205
possible better answer: http://stackoverflow.com/a/24122205
answer count: 2
has comment: http://stackoverflow.com/comment/37215568
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37215218
has comment: http://stackoverflow.com/comment/37216117
favorite count: 0
type: Question
tagged with: gridbaglayout
has body: I'm having a problem with vertical filling in my GridBagLayout-GUI. Here is the Code: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; public class Spielklasse { public static void main(String[] args) { JPanel page = new JPanel(); page.setLayout(new GridBagLayout()); for (int i = 0; i &lt; 5; i++) { JPanel subPanel = new JPanel(new BorderLayout()); JLabel label = new JLabel(); label.setText("label " + i + ":"); JTextField textField = new JTextField(); textField.setPreferredSize(new Dimension(120,20)); subPanel.add(label, BorderLayout.WEST); subPanel.add(textField, BorderLayout.EAST); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 1; c.gridy = i; c.weightx = 1; c.weighty = 1; c.insets = new Insets(10, 20, 10, 20); c.fill = GridBagConstraints.HORIZONTAL; page.add(subPanel, c); } JScrollPane scrollPane = new JScrollPane(page); JFrame frame = new JFrame(); frame.setSize(300,500); frame.add(scrollPane); frame.setVisible(true); } } I want to have label+textfield directly under the previous ones without filling the vertical space between (like when you resize my example vertically till you can see the vertical scrollbar). How can I achieve that? With my code the whole panel is filled vertically, but I don't want this.
has comment: http://stackoverflow.com/comment/37216141

http://stackoverflow.com/comment/85734266
comment on: http://stackoverflow.com/a/24136435
score: 0
type: Comment
has text: What is the package of HasName class?
type: AnswerComment

http://stackoverflow.com/a/24181301
answers question: http://stackoverflow.com/q/24164929
has comment: http://stackoverflow.com/comment/37338248
type: Answer
score: 0
has body: Instead of setting the version of the parent manually you can use the set-goal like this: versions:set -DnewVersion=XXX -DgenerateBackupPoms=false install This updates the version of the parent and all childs and should execute the install afterwards. EDIT: To move parameters and execution to the pom, try sth like this (not tested): maven-versions-plugin set XXX false (If the version doesn't change the set goal should be ignored.)

http://stackoverflow.com/a/24188028
has comment: http://stackoverflow.com/comment/37356011
has comment: http://stackoverflow.com/comment/37359119
has comment: http://stackoverflow.com/comment/37360555
type: Answer
answers question: http://stackoverflow.com/q/24176057
has body: If you want to only display the images, you can add them as different frames in FrameLayout. In your xml, first declare the one you want to show as transparent pixels, then declare the one which will have transparent pixels.
score: 0

http://stackoverflow.com/comment/37321016
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24178197
has text: Hope it helps http://www.mkyong.com/maven/how-to-convert-java-web-project-to-maven-project/

http://stackoverflow.com/comment/37204013
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24115698
has text: Not really sure what you mean by stream is changing? Can you post your code in pastebin or somewhere.

http://stackoverflow.com/comment/37422556
type: Comment
comment on: http://stackoverflow.com/q/24231631
type: QuestionComment
score: 0
has text: @AlexR Yep, I went to the page and the jar was downloaded. I definitely have access to the jar.

http://stackoverflow.com/a/24106785
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24106672
has comment: http://stackoverflow.com/comment/37186907
has body: When trying to connect to network services using such protocol (Telnet, FTP ,SSH ..) which are session based protocol and require to keep your connection alive and be interactive with the service , it's recommended to use available Java API instead of reinventing the wheel (only if you are asked to do without a third party library), in your case you can use Apache Common Net wich provide a set of helpful features to connect to servers using many network protocols including Telnet .
has comment: http://stackoverflow.com/comment/37187041

http://stackoverflow.com/q/24260555
favorite count: 0
type: UnansweredQuestion
score: -1
has answer: http://stackoverflow.com/a/24669330
tagged with: runtime-error
has title: Runtime error on UVa Online Judge 10038 - Jolly Jumpers
upvote count: 0
has body: This code runs perfectly on my laptop but I don't know where is the problem that make it do runtime error ?!! Could anyone please help me find the problem ?? http://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;page=show_problem&amp;category=24&amp;problem=979 Here is my code: import java.util.Scanner; class Main { public static void main( String[] args ) /*throws IOException*/ { Main myWork = new Main(); myWork.begin(); } void begin() { Scanner input = new Scanner( System.in ); int inputArraySize; // size of array int[] inputNumberSequence; // input sequence of numbers saved in array while( true ) { // jollyJumpers = new JollyJumpers( inputArraySize ); inputArraySize = input.nextInt(); inputNumberSequence = new int[ inputArraySize ]; for( int iii = 0; iii &lt; inputArraySize; ++iii ) { inputNumberSequence[iii] = input.nextInt(); } if( jollyOrNotJolly( inputNumberSequence, inputArraySize ) ) System.out.println( "Jolly" ); else System.out.println( "Not jolly" ); } } boolean jollyOrNotJolly( int[] inputNumberSequence, int inputArraySize ) { int maxInteger = inputNumberSequence[0]; int minInteger = inputNumberSequence[0]; int summationOfInputNumberSequence = 0; int temporaryElementFromList; int summation_From_MinInteger_To_MaxInteger = 0; for( int iii = 0; iii &lt; inputArraySize; ++iii ) { temporaryElementFromList = inputNumberSequence[ iii ]; if( temporaryElementFromList &gt; maxInteger ) maxInteger = temporaryElementFromList; else if( temporaryElementFromList &lt; minInteger ) minInteger = temporaryElementFromList; summationOfInputNumberSequence += temporaryElementFromList; } for( int jjj = minInteger; jjj &lt;= maxInteger; ++jjj ) { summation_From_MinInteger_To_MaxInteger += jjj; } return summationOfInputNumberSequence == summation_From_MinInteger_To_MaxInteger; } }
tagged with: java
downvote count: 1
answer count: 1
type: Question

http://stackoverflow.com/q/24185716
answer count: 1
tagged with: android-intent
has body: It seems to me that there are a lot of posts on here about integrating with intent (particularly in reference to ZXing's barcode scanner), and how it's much simpler than directly integrating the app into your own (i.e. not having to download and install the other app). I'm currently wondering: 1) When you integrate with intent, which part of the code automatically closes the intent integrated app once you are done using it? For example, if I've created a barcode scanner, once I've scanned the barcode, I'm free to manipulate it, and the ZXing app has been automatically closed, which is useful (because it saves memory). 2) Is there a way to integrate the app such that it will continue to be updated when ZXing updates their own app, but doesn't require a separate download of the app? Thanks.
type: Question
has title: Integrating via Intent vs. Direct Integration in Android
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/24189095
has answer: http://stackoverflow.com/a/24189095
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/24219697
tagged with: substring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24220809
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24219862
type: Question
accepted answer: http://stackoverflow.com/a/24220809
has title: Finding the index of a character to match in a specific regex
tagged with: java
has answer: http://stackoverflow.com/a/24219794
possible better answer: http://stackoverflow.com/a/24219794
tagged with: regex
has body: I have a String that begins with a word and I want to make a substring which starts at index 0 and ends at the index of the next special character (space, ., !, ?, etc...). How would I go about doing that with a regex? Can I get the index of the first regex match? And how would the pattern look? Thanks in advance!

http://stackoverflow.com/q/24244227
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37447446
tagged with: java
tagged with: jung2
tagged with: graph-algorithm
has body: I am facing the problem of visualizing this string: "=IF(A2=1;0;IF(D2=D3;IF(C2=1;TRUE;FALSE);4))"; As you can see the general syntax is similar to an excel formula, so that I have IF(TEST; TRUE; FALSE) My problem is that I want to visulize this string in a binary search tree format with the libary JUNG2. Below you can see an example of how the tree should look like: Here is some code which visualizes the vertex at the moment. public class SimpleGraphView { Graph&lt;Integer, String&gt; g; Graph&lt;String, String&gt; n; /** Creates a new instance of SimpleGraphView */ String text = "=IF(A2=1;0;IF(D2=D3;IF(C2=1;TRUE;FALSE);4))"; public SimpleGraphView() { n = new SparseMultigraph&lt;String, String&gt;(); String str = text; String delim = ";"; StringTokenizer tok = new StringTokenizer(str, delim, true); text = text.replace("(", " "); String s = text.replace(")", " "); String[] r = s.split(";"); for (int i = 0; i &lt; r.length; i++) { //Vertex if(r.equals("=IF(")) { n.addVertex(r[i].toString()); } if(i % 2==0){ n.addVertex(r[i].toString()); } else { n.addVertex(r[i].toString()); } } } /** * @param args the command line arguments */ public static void main(String[] args) { SimpleGraphView sgv = new SimpleGraphView(); // Creates the graph... // Layout&lt;V, E&gt;, VisualizationViewer&lt;V,E&gt; Layout&lt;Integer, String&gt; layout = new CircleLayout(sgv.n); layout.setSize(new Dimension(300,300)); VisualizationViewer&lt;Integer,String&gt; vv = new VisualizationViewer&lt;Integer,String&gt;(layout); vv.setPreferredSize(new Dimension(350,350)); // Show vertex and edge labels vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller()); // Create our "custom" mouse here. We start with a PluggableGraphMouse // Then add the plugins you desire. PluggableGraphMouse gm = new PluggableGraphMouse(); gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON1_MASK)); gm.add(new ScalingGraphMousePlugin(new C…
favorite count: 0
type: Question
tagged with: graph
has answer: http://stackoverflow.com/a/24245285
tagged with: algorithm
has comment: http://stackoverflow.com/comment/37447346
has answer: http://stackoverflow.com/a/24246506
accepted answer: http://stackoverflow.com/a/24246506
has comment: http://stackoverflow.com/comment/37447705
possible better answer: http://stackoverflow.com/a/24245285
has title: Convert String into binary tree
has comment: http://stackoverflow.com/comment/37447539
type: AnsweredQuestion
upvote count: 3
score: 3

http://stackoverflow.com/a/24203655
score: 0
answers question: http://stackoverflow.com/q/24203574
has body: NO Java EE is an API, means that it does not have implementation, but only provides interfaces. Java EE consist of many parts, like EJB, Servlets, JTA, JPA, CDI etc. If you want to use some of these features, you have to choose corresponding implementation (usually this is web or application server, frameworks etc).
type: Answer

http://stackoverflow.com/q/24141374
upvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5052311
has title: Editing an xml file in a .jar
downvote count: 1
duplicate of: http://stackoverflow.com/q/5052311
tagged with: java
has body: So currently I can read and write to an xml file when I'm running the program in eclipse, but when I export it as a .jar the writing does not work any more. public void addHighscores(String naam, String score){ Document document = null; Element root = null; InputStream fis = getClass().getResourceAsStream("Highscores.xml"); SAXBuilder sb = new SAXBuilder(); document = sb.build(fis); root = document.getRootElement(); fis.close(); Element player = new Element("player"); player.addContent(new Element("name").setText(naam)); player.addContent(new Element("score").setText(score)); root.addContent(player); document.setContent(root); FileWriter writer = new FileWriter(path); XMLOutputter outputter = new XMLOutputter(); outputter.setFormat(Format.getPrettyFormat()); outputter.output(document, writer); outputter.output(document, System.out); writer.close();} That's the code for the writer. The xml file is saved in the same folder as the code, I don't understand why it can read but not write. Thanks in advance
score: -1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24141416
has answer: http://stackoverflow.com/a/24142102

inputstream
tags question: http://stackoverflow.com/q/24180203
type: Tag
tags question: http://stackoverflow.com/q/24179777
tags question: http://stackoverflow.com/q/24240155
tags question: http://stackoverflow.com/q/24223400
tags question: http://stackoverflow.com/q/24254778
tags question: http://stackoverflow.com/q/24216967
tags question: http://stackoverflow.com/q/24232022
tags question: http://stackoverflow.com/q/24106672
tag name: inputstream

http://stackoverflow.com/comment/37243350
type: QuestionComment
type: Comment
score: 0
has text: @Leushenko: Beyond the trivial case, what's the point? You end up throwing compile time at a problem which you inherently cannot solve in anything but the most trivial case.
comment on: http://stackoverflow.com/q/24130399

http://stackoverflow.com/a/24122661
answers question: http://stackoverflow.com/q/24122510
has body: You can use a TreeMap in this case where your key can be the lastname and value can be comma separated string of Firstname and ID or your value can be an ArrayList of string where you store the ID and Firstname as strings and later after retrieving convert them. The treeMap will automatically store the lastname in sorted order.
score: 0
type: Answer

http://stackoverflow.com/a/52064916
upvote count: 17
answers question: http://stackoverflow.com/q/24213491
type: Answer
has body: Use jattach, a tool created by JVM hacker Andrei Pangin. It's tiny (24KB), works with just JRE and supports Linux containers. jattach PID-OF-JAVA dumpheap &lt;path to heap dump file&gt;
has comment: http://stackoverflow.com/comment/124923588
downvote count: 0
score: 17

http://stackoverflow.com/comment/37488974
has text: Changing the UI property ComboBox.border worked perfectly. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/24263305
score: 0
type: AnswerComment

http://stackoverflow.com/q/24261224
has comment: http://stackoverflow.com/comment/37478805
has comment: http://stackoverflow.com/comment/37479064
has comment: http://stackoverflow.com/comment/37478792
downvote count: 0
has answer: http://stackoverflow.com/a/24261553
has body: How i can send people to my google play on click certain button ? i already did this in activity_menu.xml &lt;Button android:id="@+id/ratebutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/morebutton" android:layout_alignBottom="@+id/morebutton" android:layout_toLeftOf="@+id/morebutton" android:layout_toRightOf="@+id/aboutButton" android:background="@drawable/more" android:text="@string/rateBtn" android:textColor="@color/White" android:textColorHint="@color/White" android:textSize="18sp" /&gt; but in MenuActivity.java i couldn't know what should i do ? Any help? Thanks
type: AnsweredQuestion
tagged with: java
has title: Android open URL onclick certain button
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37478942
has answer: http://stackoverflow.com/a/56263968
favorite count: 0
answer count: 4
possible better answer: http://stackoverflow.com/a/24261610
type: Question
accepted answer: http://stackoverflow.com/a/24261419
has answer: http://stackoverflow.com/a/24261610
tagged with: android
has answer: http://stackoverflow.com/a/24261419
upvote count: 18
score: 18

playframework-2.0
tags question: http://stackoverflow.com/q/24232823
tags question: http://stackoverflow.com/q/24118007
type: Tag
tags question: http://stackoverflow.com/q/24118856
tags question: http://stackoverflow.com/q/24184485
tags question: http://stackoverflow.com/q/24151758
tags question: http://stackoverflow.com/q/24265825
tags question: http://stackoverflow.com/q/24233990
tag name: playframework-2.0
tags question: http://stackoverflow.com/q/24159244
tags question: http://stackoverflow.com/q/24140660
tags question: http://stackoverflow.com/q/24190214

http://stackoverflow.com/q/24217656
tagged with: mysql
has comment: http://stackoverflow.com/comment/37395888
type: Question
has body: I am developing a desktop application in Netbeans. I am trying to insert a record into database. The very strange problem I am having is that when I press the save button no error occurs, everything works perfect. But when I check my DB, there is no data in there. But when I try to insert data directly in phpmyadmin through query then it inserts the record after the ID (auto increment) that has been generated before when I try to save data through desktop app. I know It is difficult to explain. Let me give you all a bit more explanation For example my database is all clear and I am trying to save my first record Through desktop app I pressed the save button when I checked the database there is no record there Here above If data was saved successfully then the record ID has to be 1 But now I am inserting the record by going into phpmyadmin and manually typing the quering in sql tab now the id of the record should be 1 but the id is 2. So it means through desktop app data is saving but somewhere hidden which I can't see and also It is remembering the id. I hope you undertstand my question. If I pressed save button 3 times after then I insert some data in phpmyadmin the id of that record is 4. I don't know what the problem is? Here is my code : public class DBConnectionManager { private static String DRIVER_NAME = "com.mysql.jdbc.Driver"; private static String HOST_NAME = "localhost"; private static String PORT_NUMBER = "3306"; private static String DB_NAME = "sales"; private static String USER_NAME = "root"; private static String PASSWORD = ""; public static Connection openConnection() throws Exception { Class.forName(DRIVER_NAME); String jdbcURL = "jdbc:mysql://"+HOST_NAME+":"+PORT_NUMBER+"/"+DB_NAME; Connection connection = DriverManager.getConnection(jdbcURL,USER_NAME,PASSWORD); connection.setAutoCommit(false); return connection; } } public void addSupplierDetail() { String contact_name = txt_contactName.getText(); String shop_name = txt_shopName.getText(); String …
has title: Trouble inserting data into a MySQL database
has answer: http://stackoverflow.com/a/24217904
tagged with: phpmyadmin
accepted answer: http://stackoverflow.com/a/24217833
has answer: http://stackoverflow.com/a/24217833
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/24217904
answer count: 2
has comment: http://stackoverflow.com/comment/37396079
tagged with: java
has comment: http://stackoverflow.com/comment/37396165
tagged with: jdbc

http://stackoverflow.com/comment/37338481
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/24186707
has text: Thanks, should have check the tests out as well

http://stackoverflow.com/comment/37475393
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24258544
has text: You probably need to read the javadocs for all the methods you call. And assuming that the javadocs don't mention all the exceptions (safe assumption), you should probably read all the source code, too. You might save some time just by writing a thorough suite of tests and handling all the exceptions you encounter.

http://stackoverflow.com/a/24175783
has body: First of all make .war file of your project, check that all configuration okay or not. Stop Tomcat Service by going in bin directory of tomcat. Make war then tomcat directory -&gt; webapp then paste that war file to it and start the service. Now Check that your firewall allows port 8080 Inboubnd rules or not. In firewall advance setting In inbound rules create new rule then select port then add 8080 in this next next ok. Now from any other PC check by typing your PC 's IP like 192.168.1.10:8080/appname. If got problem post me.
answers question: http://stackoverflow.com/q/24175714
has comment: http://stackoverflow.com/comment/37316423
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37316657
score: 1
type: Answer

http://stackoverflow.com/comment/37215852
type: QuestionComment
comment on: http://stackoverflow.com/q/24122365
score: 0
type: Comment
has text: In second pattern why are you using hardcoded values?

http://stackoverflow.com/comment/37719416
type: Comment
comment on: http://stackoverflow.com/a/24224129
type: AnswerComment
has text: You will need to create a FormBean and make getter/setter methods for the form properties in it.
score: 0

http://stackoverflow.com/comment/37323772
type: Comment
score: 0
type: AnswerComment
has text: Ok. Can you explain please what first link(links are present above) wants to do in TeraSort ?
comment on: http://stackoverflow.com/a/24179913

http://stackoverflow.com/comment/37323565
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24179497
score: 0
has text: @rukibul a language to be "pure oo" everything should exists as objects, but int, float, char, .. etc are not objects in Java.

http://stackoverflow.com/a/24116712
upvote count: 3
downvote count: 0
has body: You can't compare String's by using ==, it will only compare the reference, which will always be false. Use sr1.equals("Roma") instead. Read more How do I compare Strings in Java
score: 3
type: Answer
answers question: http://stackoverflow.com/q/24116570

http://stackoverflow.com/a/24152047
has comment: http://stackoverflow.com/comment/37272310
answers question: http://stackoverflow.com/q/24151949
type: Answer
has body: If I understand you correctly. There is a method called String.contains(CharSequence s) which can find any subsequence in a string. Hope it helps.
score: 0

http://stackoverflow.com/comment/37386862
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/24212788
has text: use `containsKey()` that is better than checking value as `null`.

http://stackoverflow.com/a/24216560
type: Answer
has body: change apptheme to Theme.AppCompat in your manifest.xml &lt;application ... android:theme="@style/Theme.AppCompat"&gt; This worked initially but later on after making the theme back to AppTheme worked too
has comment: http://stackoverflow.com/comment/37396946
has comment: http://stackoverflow.com/comment/37394161
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24216465
score: 3
answers question: http://stackoverflow.com/q/24216465
has comment: http://stackoverflow.com/comment/37394105

http://stackoverflow.com/a/24223434
has comment: http://stackoverflow.com/comment/37406782
downvote count: 1
has comment: http://stackoverflow.com/comment/37406843
has comment: http://stackoverflow.com/comment/37407013
has comment: http://stackoverflow.com/comment/37406668
has comment: http://stackoverflow.com/comment/37406723
answers question: http://stackoverflow.com/q/24223400
type: Answer
has body: When you open a file and then write to it, it will overwrite its contents. instead use new FileOutputStream(DB,true) to append to the end of the file
has comment: http://stackoverflow.com/comment/37565556
has comment: http://stackoverflow.com/comment/37406908
upvote count: 2
score: 1

http://stackoverflow.com/comment/37474848
type: QuestionComment
score: 0
has text: your client is receiving binary data instead of the expected xml soap response. the binary data may be due to soap compression or encryption.
comment on: http://stackoverflow.com/q/24259009
type: Comment

http://stackoverflow.com/comment/37303760
has text: Is there any way to create one instance of the servlet at every call ?
type: Comment
comment on: http://stackoverflow.com/a/24167244
score: 0
type: AnswerComment

http://stackoverflow.com/a/24114111
has comment: http://stackoverflow.com/comment/37201060
type: Answer
has body: Split the into arrays and merge the path with split-ted string String path="C:\\Users\\me\\Desktop\\here"; String [] splt = yourPath.split("\\"); finalPath = path + "\\" + splt[3] + "\\" + splt[4] + "\\" + splt[5]; yourPath is the path refering to a file Changing the folder's path File afile =new File("C:\\Users\\me\\Desktop\\files\\1\\sample.txt"); afile.renameTo(new File(finalPath))
score: 0
answers question: http://stackoverflow.com/q/24114049
has comment: http://stackoverflow.com/comment/37200865

http://stackoverflow.com/comment/37190329
comment on: http://stackoverflow.com/q/24108492
type: Comment
type: QuestionComment
has text: @MartinKonecny i have edited code , i enclosed the code with try{} and so problem occur when it reach to that satement : final Object myInstance = classToLoad.newInstance();
score: 0

http://stackoverflow.com/comment/37343385
has text: I do need just a spoon, so no factory needs to be built : ). Pretty-printing shocked me though. It sounds as though those kind of programs completely discard the input source, extract what data is needed and then recreate it with that knowledge. I would have thought some sort of pointers would be allocated to each syntactic structure (methods, fields etc.) while building the tree in the (non-discarded) source, keeping all the whitespaces and whatnot intact. The more I know :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24188984
type: AnswerComment

http://stackoverflow.com/a/24241902
answers question: http://stackoverflow.com/q/24240743
upvote count: 2
type: AcceptedAnswer
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/37597683
has body: You can use $pull to remove an item from the array. collection.update(new BasicDBObject("username","abc"), new BasicDBObject("$pull", new BasicDBObject("comments", new BasicDBObject("type","home")))); This code will pull the element from the comments array that matches the criteria type = "home", from the item in the collection that matches the criteria username ="abc". Hope this helps.
type: Answer
accepted answer of: http://stackoverflow.com/q/24240743
has comment: http://stackoverflow.com/comment/37599513

http://stackoverflow.com/q/24117892
has title: Java syntax array
possible better answer: http://stackoverflow.com/a/24117944
answer count: 4
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24117940
has answer: http://stackoverflow.com/a/24117962
has answer: http://stackoverflow.com/a/24117941
score: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/24117940
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24117944
linked to: http://stackoverflow.com/q/1200621
tagged with: syntax
tagged with: java
has body: I can never find what that code perform: functionName(new float[]{factor}); is it array declaration? I mean: new float[]{factor} it is equal to float[] arrayName = new float[factor]; ?

http://stackoverflow.com/a/24158194
score: -1
has comment: http://stackoverflow.com/comment/37298920
has comment: http://stackoverflow.com/comment/37296781
has comment: http://stackoverflow.com/comment/37297669
downvote count: 1
has body: You cannot "inject" the HttpServletRequest the only way to use it as far as I know is to added as a method member. Like this: @Controller public class DataController { // .. some code here @RequestMapping(value = "process", method = RequestMethod.GET) public @ResponseBody DataResponse processTask(@RequestParam("workflow") final String workflow,HttpServletRequest request) { String ipAddress = request.getRemoteAddr(); System.out.println(ipAddress); } look also at Spring MVC @AutoWired response not working
answers question: http://stackoverflow.com/q/24152397
upvote count: 0
type: Answer

http://stackoverflow.com/q/24147177
has answer: http://stackoverflow.com/a/24147273
answer count: 7
tagged with: string
has comment: http://stackoverflow.com/comment/37262490
has answer: http://stackoverflow.com/a/24147203
has answer: http://stackoverflow.com/a/24147401
has title: How to split a string in Java when there is a space?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37262476
has body: All I want to do is split a string when there is a space. for example, if the input is: 5 10 the array should be ["5", "10"] I tried this: Scanner scn = new Scanner(System.in); String[] inputs = input.split("\\p{Space}"); System.out.println(inputs[0]); System.out.println(inputs[1]); However only the 5 turns up and then there is an array out of bounds error. Edit: sorry, I was an idiot. I used: scn.next() instead of scn.nextLine()
possible better answer: http://stackoverflow.com/a/24147197
score: -2
has answer: http://stackoverflow.com/a/24147219
tagged with: regex
has answer: http://stackoverflow.com/a/24147225
has comment: http://stackoverflow.com/comment/37262739
has comment: http://stackoverflow.com/comment/37262475
type: AnsweredQuestion
downvote count: 3
has answer: http://stackoverflow.com/a/24147197
has answer: http://stackoverflow.com/a/24147246
accepted answer: http://stackoverflow.com/a/24147246
upvote count: 1
tagged with: java

http://stackoverflow.com/a/24259126
downvote count: 0
upvote count: 4
answers question: http://stackoverflow.com/q/24228748
type: Answer
has comment: http://stackoverflow.com/comment/37482843
score: 4
has body: If I understood correctly you want to do this: Stage stage1 = new Stage(); stage1.getViewport().update(width, height); rather than this: Stage stage1 = new Stage (new StretchViewport(width, height)); // It doesn't have to be StretchViewport In the first case (what you are trying to do) a ScalingViewport will be costructed automatically for you with dimensions of the Gdx.graphics and an orthographic camera and acts like a StretchViewport. Why not using the second case directly where you pass the viewport you want. You can always alter your viewport whenever you want by calling stage1.getViewport().update(width, height); or by calling stage1.setViewport(width, height, false); in older Libgdx versions. Viewport has changed recently so if you can extend Viewport class to Override the update method maybe you can achieve what you want: public class ViewportExtendClass extends StretchViewport{ public ViewportExtendClass(float worldWidth, float worldHeight) { super(worldWidth, worldHeight); } @Override public void update (int screenWidth, int screenHeight, boolean centerCamera) { super.update(screenWidth, screenHeight, centerCamera); // DO YOUR INITIALIZATION HERE } } From your main class you create new stage : Stage stage1 = new Stage (new ViewportExtendClass (width, height)); and then you call : stage1.getViewport().update(width, height); Like this you can alter stage viewport and re initialize your assets.

replication
tags question: http://stackoverflow.com/q/24257068
type: Tag
tag name: replication
tags question: http://stackoverflow.com/q/24137158

http://stackoverflow.com/q/24151573
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: solr
answer count: 1
has body: I am trying to send http post request to Solr for adding 50000 documents (all individual request one after another in while loop). I am using DefaultHttpClient in java to connect to Solr and when I use execute method on my HttpPost Solr takes 3 to 4 ms to response. I have commit=false, autoCommit=false, autoSoftCommit=false. My question is why it takes that much time to response and why cycle it follows to add new document. Basically I want to send add request but do not want to commit to see how many request can Solr handle without doing any kind of commits(without having to do any disk access). My guess is with above parameter tuned off I should be hitting Solr about 10000 times every second, but my result is 300 times a second. I am generating random data to add in my code.
has title: Solr adding document cycle & wait on response issue
type: Question
accepted answer: http://stackoverflow.com/a/24157547
tagged with: apache-httpclient-4.x
has answer: http://stackoverflow.com/a/24157547

http://stackoverflow.com/comment/37402846
comment on: http://stackoverflow.com/a/24221240
type: Comment
score: 0
type: AnswerComment
has text: its the natural order. Might not make sense in all business case. But will in a lot. For example if they are product names and prices they will line up by name of product, description etc

http://stackoverflow.com/q/24158629
linked to: http://stackoverflow.com/q/15045472
favorite count: 0
score: 8
type: Question
has body: I'm transforming bigints into binary, radix16 and radix64 encoding and seeing mysterious msb zero paddings. Is this a biginteger problem that I can workaround by stripping zero padding or perhaps doing something else? My test code: String s; System.out.printf( "%s length %d\n", s = "123456789A", (new BigInteger( s, 16 )).toByteArray().length ); System.out.printf( "%s length %d\n", s = "F23456789A", (new BigInteger( s, 16 )).toByteArray().length ); Produces output: 123456789A length 5 F23456789A length 6 Of which the longer array has zero padding at the front. Upon inspection of BigInteger.toByteArray() I see: public byte[] toByteArray() { int byteLen = bitLength()/8 + 1; byte[] byteArray = new byte[byteLen]; Now, I can find private int bitLength;, but I can't quite find where bitLength() is defined to figure out exactly why this class does this - connected to sign extension perhaps?
possible better answer: http://stackoverflow.com/a/24158695
has title: BigInteger.toByteArray() returns purposeful leading zeros?
upvote count: 8
accepted answer: http://stackoverflow.com/a/39790979
type: AnsweredQuestion
answer count: 2
tagged with: biginteger
has answer: http://stackoverflow.com/a/39790979
has answer: http://stackoverflow.com/a/24158695
tagged with: java
downvote count: 0

http://stackoverflow.com/q/24234260
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37650444
tagged with: cookies
score: 1
tagged with: android
tagged with: java
has body: I'm doing a mobile app for a website and they use Socket.io and Websocket to comunicate. I'm using socket.io-java-client on Android to connect to the Socket.io server, the problem is, i don't know how to set custom headers / cookies with it. here is how the code looks like: public void runIO(){ try { SocketIO socket = new SocketIO("http://192.168.1.60:1337"); socket.connect(new IOCallback() { @Override public void onMessage(JSONObject json, IOAcknowledge ack) { try { System.out.println("Server said:" + json.toString(2)); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onMessage(String data, IOAcknowledge ack) { System.out.println("Server said: " + data); } @Override public void onError(SocketIOException socketIOException) { System.out.println("an Error occured"); socketIOException.printStackTrace(); } @Override public void onDisconnect() { System.out.println("Connection terminated."); } @Override public void onConnect() { System.out.println("Connection established"); } @Override public void on(String event, IOAcknowledge ack, Object... args) { System.out.println("Server triggered event '" + event + "'"); } }); // This line is cached until the connection is establisched. socket.send("Hello Server!"); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/24371891
accepted answer: http://stackoverflow.com/a/24371891
upvote count: 1
has title: socket.io-java-client cookies / custom headers
answer count: 1
downvote count: 0
tagged with: socket.io
favorite count: 0

http://stackoverflow.com/a/24259097
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37512069
has body: The way that you are comparing Strings is wrong if(strClashInd == "Y") whether this java code is in jsp or a POJO use String.equals or even better in jsp use &lt;c:if ....&gt;
has comment: http://stackoverflow.com/comment/37507471
answers question: http://stackoverflow.com/q/24259021
has comment: http://stackoverflow.com/comment/38160023
has comment: http://stackoverflow.com/comment/37512039
type: Answer
upvote count: 2

http://stackoverflow.com/comment/37254802
has text: No, I will dont use Joda!
comment on: http://stackoverflow.com/q/24143124
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37197809
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24112279
has text: No problem, just keep in mind the hazard of using ".equals" for this: if there's an extra space somewhere or anything, it won't return that line. ".contains" will be much safer, especially if you're looking for a word or a couple of words.

http://stackoverflow.com/comment/37248243
type: QuestionComment
comment on: http://stackoverflow.com/q/24139537
score: 0
has text: There's nothing to disagree with, downvoters **are not obliged to comment**. [It has been](http://meta.stackoverflow.com/questions/260007/please-associate-downvotes-with-reasons) [discussed to death](http://meta.stackoverflow.com/questions/250177/require-an-explanation-reason-for-the-first-downvote-on-a-question) [on meta](http://meta.stackoverflow.com/questions/253531/enable-optional-anonymous-reasons-for-downvotes-on-questions).
type: Comment

http://stackoverflow.com/comment/37349183
type: Comment
type: QuestionComment
score: 5
has text: You are immediately returning if you find a suitable line. If you want all correct lines, you should collect them in an array or in a `List` and return that as a result outside of the loop.
comment on: http://stackoverflow.com/q/24193313

http://stackoverflow.com/comment/37340811
type: AnswerComment
comment on: http://stackoverflow.com/a/24188548
score: 0
type: Comment
has text: i cant understand your answer

http://stackoverflow.com/q/24218369
has comment: http://stackoverflow.com/comment/37823863
has answer: http://stackoverflow.com/a/24441345
score: 0
tagged with: java
answer count: 1
tagged with: full-text-search
type: Question
has body: In my app I have an entity called Product that holds the details of the product listings to be shown on the site. Since the name (title) and description of the product need to be full-text searchable, I am putting them in a separate Document (as defined by Google's App Engine Search API). All other properties remain in the Product entity, which is stored as per usual in the Google Datastore using Objectify. A slug created from the name property of the Product is the doc_id of the Document. This same slug is the (String) ID of an entity (let's call it ProductLookup) that I will use to get the Key to the corresponding/matching Product. NOTE: The Product has an auto-generated Long id as the name property (and therefore the slug used to lookup a Product) can change even after the creation of the Product &mdash; this way I just create a new ProductLookup entity when name changes. Since I am splitting the information that would normally be in a single entity into two different objects (the Product and the Document, not to mention the extra ProductLookup entity), are there any special cases I should be watching out for? Any suggestions? If I have a reference to a Product, I can use the slug to get the correspoding Document. If I have a slug, I can use ProductLookup to get a Product and use the slug as the doc_id of the Document. If I find a set of Documents via Search API, I can use their doc_ids to get the ProductLookup, then the Product.
tagged with: objectify
type: UnansweredQuestion
tagged with: google-app-engine
has title: Some properties of an Entity need full-text search, others don't
linked to: http://stackoverflow.com/q/22362192

http://stackoverflow.com/a/24147858
has comment: http://stackoverflow.com/comment/37513318
has body: You can use Guava MultiMap to achieve what you need. Multimap&lt;String, String&gt; myMultimap = ArrayListMultimap.create(); // Adding some key/value myMultimap.put("Fruits", "Bannana"); myMultimap.put("Fruits", "Apple"); myMultimap.put("Fruits", "Pear"); myMultimap.put("Vegetables", "Carrot"); // Getting values Collection&lt;string&gt; fruits = myMultimap.get("Fruits"); System.out.println(fruits); // [Bannana, Apple, Pear] On the other hand, you can also use LambdaJ groups to generate exactly that too. Group&lt;Person&gt; groupPeopleByAge = group(persons, by(on(Person.class).getAge()));
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24147557
answers question: http://stackoverflow.com/q/24147557
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/37480005
type: Comment
comment on: http://stackoverflow.com/q/24261623
type: QuestionComment
score: 1
has text: Not sure about date, but SVN revision number is covered here: http://maven.apache.org/plugin-developers/cookbook/add-svn-revision-to-manifest.html. Also closely related: [How to display SVN version in Maven usng the build-number plugin](http://stackoverflow.com/questions/4874813/how-to-display-svn-version-in-maven-usng-the-build-number-plugin)

http://stackoverflow.com/q/24149394
has answer: http://stackoverflow.com/a/24149586
has body: This code prints IS STRING which means that that map value is a String. if(mymap.get("name") instanceof String ) { System.out.print("IS STRING"); } So why does String newName = mymap.get("name"); throw the error Type mismatch: cannot convert from Object to String. This is what I used to initialize the map where textName.getText() is a string entered in a java swing GUI: Map&lt;String,String&gt; mymap = new HashMap&lt;String,String&gt;(10); mymap.put("name", textName.getText()); This is the relevant code: public void actionPerformed(ActionEvent evt){ Map&lt;String,String&gt; mymap = new HashMap&lt;String,String&gt;(10); mymap.put("name", textName.getText()); makeDocx(mymap); } public static void makeDocx(Map mymap) { String newName = mymap.get("name"); textReplace(oSelection, "[Name]", newName, oWord); }
has comment: http://stackoverflow.com/comment/37266982
upvote count: 1
tagged with: dictionary
has comment: http://stackoverflow.com/comment/37267109
has comment: http://stackoverflow.com/comment/37266946
has comment: http://stackoverflow.com/comment/37267217
has comment: http://stackoverflow.com/comment/37267319
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37267120
has comment: http://stackoverflow.com/comment/37267069
has comment: http://stackoverflow.com/comment/37267046
tagged with: java
answer count: 1
downvote count: 1
has title: Why is HashMap#get Returning an Object Rather than a String?
accepted answer: http://stackoverflow.com/a/24149586
has comment: http://stackoverflow.com/comment/37267022
favorite count: 0
has comment: http://stackoverflow.com/comment/37267295
type: Question

http://stackoverflow.com/a/24127182
has body: You should annotate as follows: @XmlElementWrapper(name="FirstClass") @XmlElement(name="Row") private List&lt;FirstJavaClass&gt; fc; @XmlElementWrapper(name="SecondClass") @XmlElement(name="Row") private List&lt;SecondJavaClass&gt; sc; The annotations mean: The @XmlElementWrapper corresponds to the element you want to nest your collection data withing. Each instance of FirstJavaClass is going to correspond to a Row element nested within the FirstClass element. Debugging Trick When your JAXB object model does not unmarshal correct, try: populating it and marshalling it to XML. then compare this XML to what you are trying to unmarshal to see what the differences are. adjusting the annotations until the marshalled XML matches what you are trying to unmarshal unmarshal the XML.
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24127116
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24127116

http://stackoverflow.com/comment/37237181
type: QuestionComment
has text: @Jules oki for the time being leave this function my point is that my pointer is not pointing first index of collection after Iterator<Object> iterator = jsonObject.keys(); this
score: 0
comment on: http://stackoverflow.com/q/24133324
type: Comment

http://stackoverflow.com/a/24243520
answers question: http://stackoverflow.com/q/24242923
upvote count: 3
score: 3
has body: You should re-write your unit tests to follow the rules of well-formed XML if they are testing XML. According to the XML spec, attribute order is not important, and your parser does not need to enforce it. This &lt;element one="1" two="2" /&gt; is the same thing as &lt;element two="2" one="1" /&gt; You should also be aware of other differences which are considered equivalent in well-formed XML documents, such as empty elements. According to the XML specification: &lt;element&gt;&lt;/element&gt; is the same thing as &lt;element/&gt; Your parser may choose to use one or the other, and that should not fail your tests if they are testing for valid XML.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37350375
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24193660
type: Comment
has text: ok, let us know the result after the refresh.

http://stackoverflow.com/q/24185314
has answer: http://stackoverflow.com/a/24185411
has comment: http://stackoverflow.com/comment/37333490
has title: Determine variable value using an optimised if else expression
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24185393
has answer: http://stackoverflow.com/a/24185426
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/24185393
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37333179
has body: i want to implement this: if code1.equals("01") ==> return mt1 else if code1.equals("02") ==> return mt2 else if code1.equals("03") ==> return mt3 How to do it using using a similar expression : String ammount = code1.equals("01") ? mt1 : other expressions ... Many thanks in advance
has answer: http://stackoverflow.com/a/24185665
accepted answer: http://stackoverflow.com/a/24185411
answer count: 5
has answer: http://stackoverflow.com/a/24185414
upvote count: 0

http://stackoverflow.com/q/24215446
has title: Trouble defining context outside of server.xml
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37392157
accepted answer: http://stackoverflow.com/a/24217532
has body: Trying to get a Tomcat 7 application off the ground and know a couple of things: In earlier versions of Tomcat the content of a Context Descriptor configuration was often stored within Tomcat's primary configuration file server.xml but this is now discouraged (although it currently still works). The locations for Context Descriptors are: $CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml $CATALINA_BASE/webapps/[webappname]/META-INF/context.xml So here is the way our apps are laid out (non-negotiable): Tomcat + WAR: /some/dir/MyApp/* some/dir/MyApp/webapps LOGS: /some/other/dir/logs/MyApp/ After the app starts with no errors I make requests for: http://foo/static/index.html When I define the context in $CATALINA_HOME/conf/server.xml everything is beautiful: <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/some/other/dir/logs/MyApp" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> Now to avoid putting the context in server.xml here are a couple of things i tried. I removed the context from server.xml then created a $CATALINA_HOME/conf/Catalina/localhost/MyApp.xml file. <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="localhost_access_log." suffix=".txt" pattern="common"/> -->FAIL: 13/Jun/2014:17:03:53 -0700] "GET /static/index.html HTTP/1.1" 404 - -->MyApp.log: A docBase /some/dir/MyApp/webapps/MyApp.war inside the host appBase has been specified, and will be ignored Next I tried removing the context from server.xml, deleting $CATALINA_HOME/conf/Catalina/localhost/MyApp.xml, but creating $CATALINA_HOME/conf/context.xml: path = "" docBase=“MyApp.war" WEB-INF/web.xml —>FAIL: 13/Jun/2014:17:03:53 -0700] "GET /static/index.html HTTP/1.1" 404 - I tried the above context.xml with and without the path, and docBase defined with both producing the same 404. What am I missing?
has answer: http://stackoverflow.com/a/24217532
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: spring
tagged with: tomcat
answer count: 1
favorite count: 0

http://stackoverflow.com/a/24263568
has body: I dont understand why you would not use a for loop to iterate List, Even if efficiency is a consideration, it would not matter at all practically. But even then if you have something against for, use the iterator for list ListIterator&lt;MyObj&gt; it=myList.listIterator(); int count = 0; while(it.hasNext()){ if( it.next().getParameter1().equals( "Somet_Text") ) { count++; } } Also looking at the source for ListIterator.next() , it does not use for loop too, just if it makes any difference public E More ...next() { checkForComodification(); int i = cursor; if (i &gt;= size) throw new NoSuchElementException(); Object[] elementData = ArrayList.this.elementData; if (i &gt;= elementData.length) throw new ConcurrentModificationException(); cursor = i + 1; return (E) elementData[lastRet = i]; } But note that it uses if statement and increments cursor to traverse the list, which again would be something like a for loop.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24263231

http://stackoverflow.com/comment/37284561
has text: I had commented that.. but Error 06-11 05:23:02.169: E/AndroidRuntime(1457): java.lang.RuntimeException: An error occured while executing doInBackground() occured
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24158232

http://stackoverflow.com/comment/37322517
comment on: http://stackoverflow.com/q/24178900
score: 2
type: Comment
has text: This question appears to be off-topic and is a better fit for http://codereview.stackexchange.com
type: QuestionComment

http://stackoverflow.com/a/54203386
score: 0
has body: Probably somebody stuck with wrong data returned in onContextItemSelected. In my case I used ViewPager based on one fragment and context menu inside. If this is your case, see Wrong fragment in ViewPager receives onContextItemSelected call. For instance, override fun onContextItemSelected(item: MenuItem?): Boolean { return if (userVisibleHint) { // Handle menu events and return true true } else false // Pass the event to the next fragment }
answers question: http://stackoverflow.com/q/24253961
type: Answer

http://stackoverflow.com/comment/37450632
comment on: http://stackoverflow.com/q/24246087
has text: So that's the rendered HTML. Please provide the exact piece of JSP you use.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37473091
score: 0
type: Comment
type: QuestionComment
has text: @Sarz Fair enough. Uncensored the link. I doubt that I care about the code being stolen as it only works if a server is present anyway.
comment on: http://stackoverflow.com/q/24258168

http://stackoverflow.com/q/24212232
type: Question
has answer: http://stackoverflow.com/a/24212435
tagged with: java
type: AnsweredQuestion
score: 0
tagged with: applet
upvote count: 1
has body: I'm trying to test a java applet that I'm working on, which is running on my VM. When I try to run it from any of my browsers in windows, I get the message "The Java security settings have prevented this application from running". In the Java control panel, I've added the domain and the specific page to the list of site exceptions. I've imported the self-signed certificate and added it to the list of Trusted Authorities. I've also set the security level to Medium. In the applet's manifest.mf file, I've got the codebase set to "*" (I initially had it set more specifically but made it lenient just to make sure that wasn't the issue). I'm not sure what else to try in order to get this applet to run
has comment: http://stackoverflow.com/comment/37385884
answer count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24212435
has title: Can't get Java to allow an applet to run

http://stackoverflow.com/comment/37323643
score: 0
type: Comment
has text: I am creating session Object before login, It's working fine. Whenever load increase to 200-300 at the same time, 5-10 user is not able to get the session attribute value that is set at the time of login.
type: QuestionComment
comment on: http://stackoverflow.com/q/24179141

http://stackoverflow.com/a/24223877
answers question: http://stackoverflow.com/q/24223216
has comment: http://stackoverflow.com/comment/37408521
type: Answer
has comment: http://stackoverflow.com/comment/37407849
has comment: http://stackoverflow.com/comment/37407983
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37408274
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37408426
has body: You need to have the clojure jar in your dependencies (they are shown in Project Tab -> External Libraries).
accepted answer of: http://stackoverflow.com/q/24223216
has comment: http://stackoverflow.com/comment/37408182

http://stackoverflow.com/q/24141904
has answer: http://stackoverflow.com/a/24142028
accepted answer: http://stackoverflow.com/a/24142028
tagged with: java
answer count: 1
tagged with: file
tagged with: jar
linked to: http://stackoverflow.com/q/5305744
tagged with: javabeans
has body: I am using an application that allows me to insert business logic via a JavaBean, in the form of a JAR file. The problem is, I want to be able to set breakpoints in my code, to troubleshoot it. But it has been deployed to the 3rd party app, as a JAR file. At runtime of the 3rd party app, is it possible to make my app look and behave as a JAR file, with the ability to debug it? I hope that is a clear enough explanation. Thanks in advance, Paul
type: Question
tagged with: debugging
has title: Debugging a library I wrote (deployed as JAR file) that is used by 3rd party client
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37254061

http://stackoverflow.com/comment/37326585
comment on: http://stackoverflow.com/a/24173494
type: Comment
score: 52
type: AnswerComment
has text: This answer isn't even complete (it doesn't even _mention_ that the value will _not_ be `0` on the first few iterations, but speed of output is obscuring that fact from the OP). Why is it accepted?

http://stackoverflow.com/comment/37430070
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24235251
has text: Seriously, you expect us to debug server and client code which suffers from an intermittent bug by just looking at pages and pages of text? You don't even know which end the problem is, or even if there is a problem with the code at all - it may be network-related. The only sane way to debug this is with the same environment as you, with compiled code and debugging/logging. There is only one with such resources - that would be you.
type: Comment

http://stackoverflow.com/q/24137067
answer count: 1
duplicate of: http://stackoverflow.com/q/20816701
type: Question
score: 0
has title: Getting wrong datetime field value while retrieving date from DB using HIbernate
has comment: http://stackoverflow.com/comment/37244024
tagged with: java
tagged with: hibernate
tagged with: datetime
has comment: http://stackoverflow.com/comment/37244497
tagged with: mysql
has comment: http://stackoverflow.com/comment/37244175
has comment: http://stackoverflow.com/comment/37246249
has body: I am using Hibernate 4.3.2. I want to store all my dates in UTC in database. I am able to store date in UTC. Now I am retrieving date from database using below method. public void getLastActiveTimeAndCheckForIt(int pageId) { Criteria criteria = getCurrentSession().createCriteria(MyTable.class, "myTable"); criteria.add(Restrictions.eq("myTable.id", 1)); MyTable row = (MyTable) criteria.uniqueResult(); System.out.println(row.getUpdatedDateTime()); //output : 2014-06-10 03:05:35.0 and actual date in database : 2014-06-10 08:35:35 } As I mentioned I am getting different date in output which is stored in database. I am not getting reason why? Some steps I did to configure UTC timezone. 1. TimeZone.setDefault(TimeZone.getTimeZone("UTC")); 2. System.setProperty("user.timezone", "UTC"); 3. I also set my database timezone in UTC.
tagged with: timezone
linked to: http://stackoverflow.com/q/20816701
has answer: http://stackoverflow.com/a/24137611
type: UnansweredQuestion

http://stackoverflow.com/q/24163594
linked to: http://stackoverflow.com/q/11602533
has comment: http://stackoverflow.com/comment/37292698
tagged with: semantics
has body: When compiling the following code, I get no error message from the first if statement, but I get errors from the second one. Only difference is that the second if statement has curly braces. public class Test{ public static void main(String args[]){ if(Math.random()&lt;1.0d){ int a=5;} if(Math.random()&lt;1.0d) int a=5; } } First if statement: no errors Second if statement: Test.java:10: error: '.class' expected int a=5; ^ Test.java:10: error: not a statement int a=5; ^ Test.java:10: error: illegal start of expression int a=5; ^ Test.java:10: error: ';' expected int a=5; Am I missing something here?
has comment: http://stackoverflow.com/comment/37292768
duplicate of: http://stackoverflow.com/q/11602533
has comment: http://stackoverflow.com/comment/37293569
tagged with: syntax
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24163727
tagged with: java
has title: Semantically and syntactically redundant curly braces change compiler error message
downvote count: 0
has answer: http://stackoverflow.com/a/24163727
score: 1
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37293369
type: Question

http://stackoverflow.com/comment/37226812
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24127066
type: QuestionComment
has text: Change action="servlets/CreateUser.java" to action="/createUser".

http://stackoverflow.com/a/24223595
has body: In the second example both threads are referencing the same list with no synchronization, which is not thread-safe. In fact, running this example on my old laptop (using JDK1.6 on Windows 7 with Intel Core 2 Duo CPU) does not show the same result. Sometimes it shows the final size of the list as 2000, but other times 1999, or even 1992 in one case. I also tried to let the second thread remove from the list (in case it is not empty) instead of adding and it also gives inconsistent results. private void processData2(){ for(int i=0;i&lt;1000;i++){ try { Thread.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } if(!list.isEmpty()) { list.remove(0); } } } ... Thread t1 = new Thread(new Runnable(){ public void run() { processData(); } }); Thread t2 = new Thread(new Runnable(){ public void run() { processData2(); } }); t1.start(); t2.start(); This clearly shows it is not thread-safe. To further confirm, I switched to a synchronized list: private List&lt;Integer&gt; list=Collections.synchronizedList(new ArrayList&lt;Integer&gt;()); and this time running the example always yields a size of 2000. On the other hand, running the first example always gives a result of 1000 for the size of the list. Each executor task references its own object and its field members.
score: 0
answers question: http://stackoverflow.com/q/24223352
type: Answer
has comment: http://stackoverflow.com/comment/37406910
has comment: http://stackoverflow.com/comment/37407568
has comment: http://stackoverflow.com/comment/37407008

http://stackoverflow.com/comment/37467500
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24254553
has text: Then I created the adder class which should work for both agents so I made it generic by parameterizing it over the interface Located. Thus the class LocateAdder has to be generic over the type Locate. So that's why I think your suggestion wont work in my case. Not sure if there is another way to do the same thing. Any other suggestion? thanks a lot for the help
type: Comment

http://stackoverflow.com/comment/37469995
has text: @Jens: Arvind's method works, only using slash gives me error.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24256387
score: 0

http://stackoverflow.com/comment/37320098
has text: Thanks for answer,but i want to do same on client side(browser).based on user action.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24177854
type: Comment

http://stackoverflow.com/comment/37334045
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24185781
has text: Show the part of the code you have tried, and specify what exact problem you are facing in code.
score: 2

http://stackoverflow.com/q/24176894
has comment: http://stackoverflow.com/comment/37318328
downvote count: 0
tagged with: eclipse
favorite count: 0
has title: Grails - adding Maven dependency to Eclipse classpath
type: Question
accepted answer: http://stackoverflow.com/a/24177084
has answer: http://stackoverflow.com/a/24177084
answer count: 1
tagged with: maven
has body: I've added a Maven dependency into my Grails project, and I'm trying to get that reflected on my Eclipse setup. I've already run grails compile --refresh-dependencies and grails refresh-dependencies (I don't know the difference) but neither got the job done. There are no errors, and I can see that the dependency is correctly reported in grails dependency-report.
upvote count: 1
tagged with: grails
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37318315
score: 1
tagged with: java

http://stackoverflow.com/a/24210585
has body: You can use something like this: public class Main { public static void main(String[] args) { new Main().runMe(); } public void runMe() { new Test(this.getClass()); } } class Test { public Test(Class clazz) { System.out.println("I was invoked from '" + clazz.getCanonicalName() + "' class."); } } Prints: I was invoked from 'Main' class.
upvote count: 2
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37382745
has comment: http://stackoverflow.com/comment/37382423
downvote count: 0
has comment: http://stackoverflow.com/comment/37382531
accepted answer of: http://stackoverflow.com/q/24210373
has comment: http://stackoverflow.com/comment/37382492
type: Answer
answers question: http://stackoverflow.com/q/24210373

http://stackoverflow.com/q/24142087
tagged with: matlab
score: 0
has body: I am trying to use org.apache from Matlab by doing this: javaaddpath('~/.m2/repository/org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar'); import org.apache.commons.math3.stat.correlation.* c = org.apache.commons.math3.stat.correlation.KendallsCorrelation(); I get the following error: Undefined variable "org" or class "org.apache.commons.math3.stat.correlation.KendallsCorrelation" How do I fix it?
type: UnansweredQuestion
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37253441
has comment: http://stackoverflow.com/comment/37252761
has answer: http://stackoverflow.com/a/24142619
has title: Using org.apache in Matlab
type: Question
tagged with: apache-commons

http://stackoverflow.com/comment/37189299
type: Comment
has text: @user3580294 ok, `removeAll()` removes all, how it differs from the method above?
type: AnswerComment
comment on: http://stackoverflow.com/a/24107702
score: 0

http://stackoverflow.com/comment/37208218
type: QuestionComment
has text: @EJP Yes, I agree but my point was about this "Signals that a timeout has occurred on a socket read or accept." but this is not the situtaion in my case." And I was trying to convey If you are trying to connect than you fall in one category. In this case not read but accept.
score: 1
comment on: http://stackoverflow.com/q/24116625
type: Comment

http://stackoverflow.com/a/24214852
type: Answer
has comment: http://stackoverflow.com/comment/37390830
score: 2
has comment: http://stackoverflow.com/comment/37390900
downvote count: 3
has comment: http://stackoverflow.com/comment/37391219
has comment: http://stackoverflow.com/comment/37404649
has comment: http://stackoverflow.com/comment/37390822
answers question: http://stackoverflow.com/q/24214764
has body: It's a bit of a hack, but this compiles at my machine: class A { public class B { public class Α { } } } Try it. Literally: copy-past this thing ;) SPOILER: The name of the inner class is a capital letter alpha of the Greek alphabet. It's a Unicode character.
upvote count: 5

http://stackoverflow.com/a/24127841
has body: Here's a way, not claiming its the best way. Mat m = ... // your smaller mat Mat submat= matOrig.submat(new Rect(x,y, m.cols(), m.rows()) ); m.copyTo(submat); That should work assuming m doesn't go out of bounds inside matOrig. When you get a submat, it is still linked to its source Mat.
has comment: http://stackoverflow.com/comment/37286889
score: 7
downvote count: 0
has comment: http://stackoverflow.com/comment/37303376
upvote count: 7
answers question: http://stackoverflow.com/q/24127138
has comment: http://stackoverflow.com/comment/47274860
has comment: http://stackoverflow.com/comment/37453115
has comment: http://stackoverflow.com/comment/61498198
has comment: http://stackoverflow.com/comment/37359183
type: Answer

http://stackoverflow.com/a/24106092
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24106037
type: Answer
has body: Right click your web project -> Properties -> Java build path -> Libraries -> Add Jars. Now add all the XStream related dependencies, which are present in your Java project, in your web project as well.
score: 1

http://stackoverflow.com/q/24132032
upvote count: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37246746
accepted answer: http://stackoverflow.com/a/24347844
tagged with: collections
downvote count: 1
favorite count: 0
type: Question
has title: Producer Consumer : Java out of Memory : garbage collector overhead limit reached
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/37638556
tagged with: garbage-collection
has body: I have producer consumer application. Basically its HP Vertica's UDTF where I am getting data from Database. Then I am passing it to Dispatcher for next functionality. But while passing data, it needs to be copied to make list of final collection to be passed in queue. pseudo Code snippet: do { //Model T from row list.add(t) if(size of batch matched){ // copy list into new final arraylist final batch = new Arralylist(list); dispatcher.submit( new BatchProcessor() { public list getBatch() { return batch; }}) } } while(till have data, few million records) In above snippet, race condition gets created and I get exception : Java out of Memory : garbage collector overhead limit reached. Solutions tried: I tried to increase JVM size; with increased size I can increase 'size of batch'. If size of data is less; i.e. loop count is less, then also application can be executed successfully; but with increased size memory greed increases and race condition occurs Can you please suggest me solution for it? Thanks! EDIT Some more info regarding env: Multi node and multi processor Java 7 I do not have any custom settings for JVM. But I guess I need to do some. I am not getting which should I try. Main issue I feel is copying of data while sending to inner class. can we avoid it? if yes, how can we?
has comment: http://stackoverflow.com/comment/37643592
score: -1
tagged with: producer-consumer
has comment: http://stackoverflow.com/comment/37234665
has answer: http://stackoverflow.com/a/24347844
type: AnsweredQuestion

http://stackoverflow.com/a/24207699
has comment: http://stackoverflow.com/comment/37377155
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: You'll want to use Locks to synchronize access to the sections of your code that you need to have only one thread executing at once. There are plenty of resources on SO and in the Oracle Java docs that show how to use locks in more detail, but something like this should do the trick. The idea is that you want to maintain a copy of the most-recently generated set of results, and you always return that copy until you have a new set of data available. import java.util.concurrent.locks.ReentrantLock; public class MyClass { private volatile MyObject completedResults; private final ReentrantLock resultsLock; private final ReentrantLock refreshLock; public MyClass() { // This must be a singleton class (such as a servlet) for this to work, since every // thread needs to be accessing the same lock. resultsLock = new ReentrantLock(); refreshLock = new ReentrantLock(); } public MyObject myMethodToRequestResults(boolean refresh) { MyObject resultsToReturn; // Serialize access to get the most-recently completed set of results; if none exists, // we need to generate it and all requesting threads need to wait. resultsLock.lock(); try { if (completedResults == null) { completedResults = generateResults(); refresh = false; // we just generated it, so no point in redoing it below } resultsToReturn = completedResults; } finally { resultsLock.unlock(); } if (refresh) { // If someone else is regenerating, we just return the old data and tell the caller that. if (!refreshLock.tryLock()) { // create a copy of the results to return, since we're about to modify it on the next line // and we don't want to change the (shared) original! resultsToReturn = new MyObject(resultsToReturn); resultsToReturn.setSomeoneElseIsRegeneratingTheStuffRightNow(true); } else { try { completedResults = generateResults(); resultsToReturn = completedResults; } finally { refreshLock.unlock(); } } } return resultsToReturn; } }
type: Answer
has comment: http://stackoverflow.com/comment/37378116
accepted answer of: http://stackoverflow.com/q/24194267
answers question: http://stackoverflow.com/q/24194267
has comment: http://stackoverflow.com/comment/37377274
score: 1

awt
tags question: http://stackoverflow.com/q/24117071
tags question: http://stackoverflow.com/q/24111375
tags question: http://stackoverflow.com/q/24172298
tags question: http://stackoverflow.com/q/24127677
tags question: http://stackoverflow.com/q/24144188
tags question: http://stackoverflow.com/q/24180839
tags question: http://stackoverflow.com/q/24138485
tags question: http://stackoverflow.com/q/24175378
tags question: http://stackoverflow.com/q/24138201
tags question: http://stackoverflow.com/q/24235697
tags question: http://stackoverflow.com/q/24233542
tags question: http://stackoverflow.com/q/24194462
tag name: awt
tags question: http://stackoverflow.com/q/24239642
tags question: http://stackoverflow.com/q/24169253
tags question: http://stackoverflow.com/q/24161248
type: Tag
tags question: http://stackoverflow.com/q/24235456
tags question: http://stackoverflow.com/q/24232438
tags question: http://stackoverflow.com/q/24250094
tags question: http://stackoverflow.com/q/24215053
tags question: http://stackoverflow.com/q/24240553
tags question: http://stackoverflow.com/q/24135414
tags question: http://stackoverflow.com/q/24261680
tags question: http://stackoverflow.com/q/24266346
tags question: http://stackoverflow.com/q/24214213
tags question: http://stackoverflow.com/q/24110034

http://stackoverflow.com/comment/37269136
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24150438
has text: We are going to need to see the stacktrace and which line the exception in thrown on.
score: 0

http://stackoverflow.com/comment/37418394
score: 1
type: Comment
has text: Actually, it seems you're closing the href before adding the id[i]. Shouldn't be after it?
type: QuestionComment
comment on: http://stackoverflow.com/q/24229768

http://stackoverflow.com/comment/37374125
has text: Actually in the end I defined a new interface for my purpose. I wanted something like callable, but without a checked exception. I'm not a checked exception fan.
comment on: http://stackoverflow.com/a/24204901
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24164036
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24161094
type: Answer
has body: Use the org.eclipse.ui.installationPages extension point to add a tab to the Installation Details tabs. Your class must extends org.eclipse.ui.about.InstallationPage For more details see the help
accepted answer of: http://stackoverflow.com/q/24161094
downvote count: 0

http://stackoverflow.com/comment/37410364
type: AnswerComment
has text: Ok...That sounds unnecessarily complicated. I used a FileOutoutStream and it works (,I haven't buffered it yet). I guess because it accepts raw byte lists.
score: 0
comment on: http://stackoverflow.com/a/24210313
type: Comment

http://stackoverflow.com/comment/37330142
type: Comment
type: QuestionComment
has text: The value `1024 * 1024 * 1024 * 7` overflows.
score: 0
comment on: http://stackoverflow.com/q/24183526

http://stackoverflow.com/a/24252069
type: Answer
has comment: http://stackoverflow.com/comment/37462088
has comment: http://stackoverflow.com/comment/37462059
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/24252034
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24252034
has body: An Exception's (Throwable really) stack trace is created at initialization. Your exception, a Bizarre instance, is created at line 12.
downvote count: 0

http://stackoverflow.com/comment/37280967
score: 0
type: Comment
type: AnswerComment
has text: Got the idea Ashish. Are there any JavaBean api which can make this easier?
comment on: http://stackoverflow.com/a/24156949

http://stackoverflow.com/q/24262222
has body: I'm using Intellij IDEA 13.1 on Windows. And one day I found my code in errors. Something like this: It says "Cannot resolve symbol" My Project Structure: Can someone help me?
has comment: http://stackoverflow.com/comment/37480423
has comment: http://stackoverflow.com/comment/37480502
linked to: http://stackoverflow.com/q/17262823
has comment: http://stackoverflow.com/comment/37480741
has comment: http://stackoverflow.com/comment/37480540
type: UnansweredQuestion
has title: Cannot resolve symbol in onCreate method
has comment: http://stackoverflow.com/comment/37480594
has comment: http://stackoverflow.com/comment/37480836
has answer: http://stackoverflow.com/a/24262310
has comment: http://stackoverflow.com/comment/37480382
has comment: http://stackoverflow.com/comment/37480463
tagged with: java
has comment: http://stackoverflow.com/comment/37480691
tagged with: intellij-idea
score: 0
has comment: http://stackoverflow.com/comment/37480531
has comment: http://stackoverflow.com/comment/37480445
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/38652492
answers question: http://stackoverflow.com/q/24177516
type: Answer
has body: Just a suggestion - Instead of looping, you could just use the switch statement along with the Calendar.add() like this: int weekdayNum = c.get(Calendar.DAY_OF_WEEK); switch (weekdayNum) { case 1: { c.add(Calendar.DAY_OF_MONTH, 1); break; } case 3: { c.add(Calendar.DAY_OF_MONTH, 6); break; } case 4: { c.add(Calendar.DAY_OF_MONTH, 5); break; } case 5: { c.add(Calendar.DAY_OF_MONTH, 4); break; } case 6: { c.add(Calendar.DAY_OF_MONTH, 3); break; } case 7: { c.add(Calendar.DAY_OF_MONTH, 2); break; } default: break; }
score: 0

http://stackoverflow.com/comment/37295810
type: QuestionComment
comment on: http://stackoverflow.com/q/24164862
type: Comment
has text: Wouldn't simply disable logging for `org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver` solve that?
score: 1

http://stackoverflow.com/q/24197423
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24197440
score: 0
tagged with: java
tagged with: regex
accepted answer: http://stackoverflow.com/a/24197440
type: Question
answer count: 2
tagged with: regex-lookarounds
has title: Replace a comma that is not in parentheses using regex
linked to: http://stackoverflow.com/q/23589174
possible better answer: http://stackoverflow.com/a/24197676
has body: I have this string: john(man,24,engineer),smith(man,23),lucy(female) How do I replace a comma which not in the parentheses with @? The result should be: john(man,24,engineer)@smith(man,23)@lucy(female) My code: String str = "john(man,24,engineer),smith(man,23),lucy(female)"; Pattern p = Pattern.compile(".*?(?:\\(.*?\\)).+?"); Matcher m = p.matcher(str); System.out.println(m.matches()+" "+m.find()); Why is m.matches() true and m.find() false? How can I achieve this?
has answer: http://stackoverflow.com/a/24197676

http://stackoverflow.com/comment/37475088
score: 0
has text: change `if( c.moveToFirst())` to `if( size > 0)` and put ` c.moveToFirst()` top of that `if` statement and test again
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24259219

http://stackoverflow.com/q/24233544
tagged with: popupmenu
tagged with: listview
tagged with: custom-adapter
tagged with: java
answer count: 1
linked to: http://stackoverflow.com/q/24213890
type: Question
type: UnansweredQuestion
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24234709
has title: Removing elements in ListView w/ Popup Menu
has body: Basically, I have a slight problem with interprating a remove feature. The user clicks on a button that is in the ListView, a PopupMenu is then promted and displays "Unfriend", "Unfollow", "Messgae" and "Cancel". When the user clicks on "Unfriend", the Friend that the user wants to unfreind is then removed. I have a problem with three things; Searching and Removing(to a slight degree): 1 When the User uses the search feature, the Unfriend option becomes non-usable. If the user clicks unfriend. It does nothing... 2 When the User attempts to search for a user than they have previously removed as a friend. It actually displays that user in the search results. 3 When a User removes a friend, and then searches for another friend to remove. It adds all of the previously removed friend back into the list. There must be something I am doing wrong? Maybe I'm storing data and then re-using it to a certain degree somewhere else down the line? I DO NOT get any exceptions from this code. It actually runs with minor faults. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); res = getResources(); searchField = (EditText) findViewById(R.id.EditText01); list = (ListView) findViewById(android.R.id.list); //button = (Button)findViewById(R.id.btnFriendList); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); //button.setFocusable(false); friendList = new ArrayList&lt;Friend&gt;(); nameBlock = res.getStringArray(R.array.names); descBlock = res.getStringArray(R.array.descriptions); names = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; nameBlock.length; i++) { names.add((String)nameBlock[i]); } descr = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; descBlock.length; i++) { descr.add((String)descBlock[i]); } images = new ArrayList&lt;Integer&gt;(); for(int i = 0; i &lt; imageBlock.length; i++) { images.add((Integer)imageBlock[i]); } //imageBlock = res.getIntArray(R.array.images); int size = nameBlock.leng…
has comment: http://stackoverflow.com/comment/37425838

http://stackoverflow.com/q/24256733
type: Question
has answer: http://stackoverflow.com/a/24256777
possible better answer: http://stackoverflow.com/a/24256795
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24256795
accepted answer: http://stackoverflow.com/a/24256777
has body: I'm working through the android developer tutorial and we're now creating a method to match to the method name we gave to android:onClick="sendMessage". Here's the method: /** Called when the user clicks the Send button */ public void sendMessage(View view) { // Do something in response to button } The text says this about the method: In order for the system to match this method to the method name given to android:onClick, the signature must be exactly as shown. Specifically, the method must: Be public Have a void return value Have a View as the only parameter (this will be the View that was clicked) I understand why it must be public and why the return value is void, but why does the method take (View view) instead of just (view)? I'm coming from a Ruby background so the syntax is confusing me. Why do we pass parameters like this?
has title: Java, Android passing params to method
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37470695
has comment: http://stackoverflow.com/comment/37470558
has comment: http://stackoverflow.com/comment/37470670
has comment: http://stackoverflow.com/comment/37470746
has comment: http://stackoverflow.com/comment/37470644
has comment: http://stackoverflow.com/comment/37470638

http://stackoverflow.com/a/24166028
has comment: http://stackoverflow.com/comment/128609647
answers question: http://stackoverflow.com/q/24165260
has body: Channel types are described here. The default channel type is Direct (the endpoint runs on the caller's thread); QueueChannel and ExcecutorChannel provide for asynch operations. context.getBeansOfType(MessageChannel.class)
score: 7
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24165260
upvote count: 7
type: Answer

persistence
tags question: http://stackoverflow.com/q/24222131
tag name: persistence
tags question: http://stackoverflow.com/q/24164090
type: Tag
tags question: http://stackoverflow.com/q/24245215
tags question: http://stackoverflow.com/q/24208182

http://stackoverflow.com/comment/37393069
score: 0
type: AnswerComment
has text: Is it because I have no setter for that in each employee type?
comment on: http://stackoverflow.com/a/24215717
type: Comment

jna
type: Tag
tags question: http://stackoverflow.com/q/24140160
tags question: http://stackoverflow.com/q/24140439
tags question: http://stackoverflow.com/q/24145385
tag name: jna
tags question: http://stackoverflow.com/q/24150297
tags question: http://stackoverflow.com/q/24210989

http://stackoverflow.com/a/24156154
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37305017
type: Answer
has comment: http://stackoverflow.com/comment/37279408
score: 0
answers question: http://stackoverflow.com/q/24156125
has body: a B class IS an instance of AA; however, an AA class IS NOT and instance of B the Javac compiler has no way of knowing that there exists a class B that extends AA when you declare new AA(); if you're asking behind the theory of this, the suppose you also have another class that derives AA, such as: public class C extends AA { @Override void run() { System.out.println("i do something different");} } now, when you call new AA(), how do you know what AA can be casted to? what is called when you call run() ? is it the run that belongs to B ? or C ? if it were to work polymorphically, you would need to have instantiated both a B and a C class. but wouldn't this be a total waste of space, for every children of AA ?
accepted answer of: http://stackoverflow.com/q/24156125

http://stackoverflow.com/q/24157571
tagged with: java
tagged with: hibernate
has body: Hibernate version 4.3.5: I experience some strange behaviour when I try to eagerly fetch two relations that I defined as lists. It works perfectly fine to load the entity with a normal query, but as soon as I try to use an entity graph, I get an exception: MultipleBagFetchException: cannot simultaneously fetch multiple bags So, my question is: why does this happen and how can I fix it? My entity looks like this: @Entity @NamedEntityGraph(name = "Person.loadAll", attributeNodes = { @NamedAttributeNode(value = "managedPersons", subgraph = "personName"), @NamedAttributeNode(value = "incidents", subgraph = "incidentNumber")}, subgraphs = { @NamedSubgraph(name = "personName", attributeNodes = { @NamedAttributeNode("name") }), @NamedSubgraph(name = "incidentNumber", attributeNodes = { @NamedAttributeNode("number") }) }) public class Person { private long id; @ManyToOne @JoinColumn(name = "managerid") private Person manager; @OneToMany(mappedBy = "manager", fetch = FetchType.EAGER) @OrderBy("name ASC") private List&lt;Person&gt; managedPersons; @OneToMany(mappedBy = "caller", fetch = FetchType.EAGER) @OrderBy("number ASC") private List&lt;Incident&gt; incidents; //some more stuff... }
type: Question
answer count: 0
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/51633061
downvote count: 0
has comment: http://stackoverflow.com/comment/41957229
linked to: http://stackoverflow.com/q/10769656
favorite count: 0
has comment: http://stackoverflow.com/comment/116263279
score: 3
has title: Hibernate: MultipleBagFetchException when using entity graph

http://stackoverflow.com/comment/37361947
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24198789
score: 2
has text: What is your __specific__ problem? Questioners here are expected to _at least some_ research on their own.

http://stackoverflow.com/comment/37393964
type: AnswerComment
has text: Ok well I can accept that if I can't do it then I can't do it.
type: Comment
comment on: http://stackoverflow.com/a/24216549
score: 0

http://stackoverflow.com/comment/37447300
score: 0
comment on: http://stackoverflow.com/q/24105622
type: QuestionComment
type: Comment
has text: I finally solved the problem using a Java Dependency Resolver [https://code.google.com/p/java-dependency-resolver/]. As first step I found all dependencies and then as soon as a class is changed I knew which test cases are related and need to be run.More information also can be found in [http://stackoverflow.com/questions/3734825/find-out-which-classes-of-a-given-api-are-used].

http://stackoverflow.com/comment/37468688
comment on: http://stackoverflow.com/q/24255584
has text: You should use `onPostExecute()`. Below answer is right.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37255145
has text: @programmer your folders hi_webapps,bye_webapps and hello_webapps should be in the same folder as the default webapps.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24139946
type: Comment

http://stackoverflow.com/comment/37350360
type: Comment
comment on: http://stackoverflow.com/q/24183224
score: 0
type: QuestionComment
has text: I did note, during my testing, that the field seems to become visible when the cursor is first painted, hence the second (or so) delay

http://stackoverflow.com/q/24239263
tagged with: spring-mvc
score: 1
upvote count: 1
tagged with: java
favorite count: 0
type: Question
answer count: 2
type: UnansweredQuestion
downvote count: 0
has title: Spring static resources mapping : controller vs addResourceHandler
has answer: http://stackoverflow.com/a/24240244
tagged with: spring
has answer: http://stackoverflow.com/a/24240083
has body: I am trying to map a particular set of resources(audio) to a controller. But resources/** maps to all resources. How can I isolate a particular resource request so that it doesnt go through the Spring static resources mapping, but to my controller? Is moving the audio resources to a different folder other than resources the only solution? For example: Folder structure: /resources/js /resources/css /resources/audio Resources Mapping using Spring Web Config: @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**") .addResourceLocations("/resources/") ... } Resources Controller: public class ResourceController { @RequestMapping(value = "/resources/audio", method = RequestMethod.GET, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @ResponseBody public Resource getAudio(...) { } .... }

http://stackoverflow.com/comment/37319852
comment on: http://stackoverflow.com/a/24177760
type: Comment
has text: Thanks, but what about the persistence.xml
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37256695
has text: Yeah, from 2 different jars, and I have no permission to change any of them.
comment on: http://stackoverflow.com/q/24143966
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37372996
comment on: http://stackoverflow.com/q/24205631
has text: @RahulMittal, the fact that you are fetching the employee names from a different database is ***by far the most important part*** of your question. Please edit your question to explain your situation more clearly.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/127638099
type: Comment
has text: the major benefit of using ifPresent is not at all that - it just intended to operate with another argument, Consumer, which is not applicable in all cases
type: AnswerComment
comment on: http://stackoverflow.com/a/53760824
score: 0

http://stackoverflow.com/comment/37311709
has text: It's defined with a wildcard generic for the two parameters meaning they can both be different types. If it were defined like the `addAll` method with a common type then it would result in a compile error.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24173043
type: QuestionComment

http://stackoverflow.com/comment/37376305
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24183146
score: 0
has text: @SergeBallesta see here exception is not the issue, the thing is say we are having some exception during a transaction since i am using `@Transactional` there is no need of defining Transaction explicitly. so when exception occurs it throws out and shows that exception to the user, rather how can i tell user that some thing has went wrong

http://stackoverflow.com/comment/37264905
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24116463
has text: Here is how your use case can be handled with EclipseLink JAXB (MOXy): http://blog.bdoughan.com/2013/03/moxys-object-graphs-inputoutput-partial.html

http://stackoverflow.com/q/24116463
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
score: 1
downvote count: 0
upvote count: 1
has body: Hi I have a Java class which contains 15 fields that need to be transformed into xml. The standard JAXB work well, and if we want to skip a field then that field can be marked as @XmlTransient. However in my situation Users are able to filter the fields that need to be transformed into xml. so I am looking for a solution where fields can be marked @XmlTransient at runtime. @XmlRootElement(name="cpu_specs") @XmlAccessorType(XmlAccessType.FIELD) public class CpuSpecs { private String spec1; private String spec2; private String spec3; ... private String spec15; } I have an object of CpuSpecs ready to be transformed into xml. I have a list of fields that need to be skipped as List&lt;String&gt; toSkip. Note: Please I would prefer a solution without MOXY.
favorite count: 0
type: Question
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/37264905
has title: JAXB Annotated class skip fields on Runtime

http://stackoverflow.com/comment/37290892
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24116692
has text: You have right. But that is specified by mapping. If you use `java.sql.Date` will be used DATE, from other hand when you use `java.sql.Timestamp` will be used `TIMESTAP` but In case when you use setTimestamp on `DATE` column. JDBC creates on instance of `oracle.sql.Timestap` and pass it. Because the `TIMESTAMP` is 4 bytes wider (for nanoseconds). During preparation of execution plan engine can not find an index for type `TIMESTAP` therefor it will not use it. This mean that the decision is on db level not jdbc.
type: Comment

http://stackoverflow.com/q/24159407
upvote count: 2
has answer: http://stackoverflow.com/a/24160531
has body: please, help me! I've got the trouble. I've next SQL query SET @sql = ''; SELECT GROUP_CONCAT(DISTINCT CONCAT( 'getInterviewsNumber(\'', name, '\', vtable.position)', ' AS \'', name, '\'' ) separator ',' ) INTO @sql FROM interview_portal.departments; SET @sql = CONCAT('SELECT distinct vtable.position, ',@sql, ' FROM inter_count as vtable'); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; It works well in MySQL workbench. But how can i execute this query and get ResultSet using Spring JdbcDaoSupport? I've tried a lot of variants, but i got MySQLSyntaxErrorException. Thanks for your help! Here is my Exception SEVERE: Servlet.service() for servlet [generalDispatcher] in context with path [/InterviewPortal] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SET @sql = ''; SELECT GROUP_CONCAT( DISTINCT CONCAT ( 'getInterviewsNumber(\'', name, '\', vtable.position)',' AS \'', name, '\'') separator ',') INTO @sql FROM interview_portal.departments; SET @sql = CONCAT('SELECT distinct vtable.position, ', @sql, ' FROM inter_count as vtable'); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;]; nested exception is 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 'SELECT GROUP_CONCAT( DISTINCT CONCAT ( 'getInterviewsNumber(\'', name, '\', vtab' at line 1] with root cause 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 'SELECT GROUP_CONCAT( DISTINCT CONCAT ( 'getInterviewsNumber(\'', name, '\', vtab' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:…
downvote count: 0
tagged with: spring
has title: Spring JdbcDaoSupport
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24159636
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24159636
has comment: http://stackoverflow.com/comment/37284964
has comment: http://stackoverflow.com/comment/37287542
tagged with: java
tagged with: mysql
score: 2
possible better answer: http://stackoverflow.com/a/24160531
answer count: 2

http://stackoverflow.com/a/24154829
upvote count: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24154743
answers question: http://stackoverflow.com/q/24154743
score: 3
type: Answer
has body: I think you could eliminate all your problems by rolling the info method into the enum instead of making a wrapper class: public class Enums{ public enum Sex { MALE, FEMALE; public void info(){ System.out.printf("I'm a %s.%n", this.toString().toLowerCase()); } } public static void main(String[] argv){ Sex a = Sex.MALE; Sex b = Sex.FEMALE; a.info(); b.info(); } } Java enums are classes too, so you can add methods, fields, etc.

http://stackoverflow.com/comment/37226797
type: Comment
score: 0
type: AnswerComment
has text: Do you need the intent filter for newact activity? Maybe try without it
comment on: http://stackoverflow.com/a/24126320

http://stackoverflow.com/comment/37447853
comment on: http://stackoverflow.com/q/24245043
has text: `velocity.set(targetX - position.x,targetY - position.y);` Isn't this why it goes faster the farther you click? Rather: how are you defining your targets?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37475004
has text: I edited my first answer, works good at my place. Maybe you will give it a try.
comment on: http://stackoverflow.com/a/24258343
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37362136
type: AnswerComment
has text: Thanks for your advice! Also I've found an useful post talking about [RPC over AMQP](http://www.hydrogen18.com/blog/rpc-over-amqp.html), I'm trying to implement mechanism like that now.
comment on: http://stackoverflow.com/a/24172581
score: 0
type: Comment

http://stackoverflow.com/q/24189475
has answer: http://stackoverflow.com/a/56900907
has title: Retrieving a Document from a QueryResult with OpenCMIS
type: AnsweredQuestion
tagged with: opencmis
score: 0
tagged with: java
has body: I'm using the Apache Chemistry OpenCMIS java library. Given a QueryResult (e.g. I found a document or a bunch of documents by searching on metadata properties), is this a reasonable way to retrieve the Document object itself? Or is there a more efficient way? ItemIterable&lt;QueryResult&gt; results = session.query("SELECT * FROM cmis:document WHERE cmis:name LIKE 'test%'", false); for(QueryResult hit: results) { Document document = (Document) session.getObject(session.createObjectId((String) hit.getPropertyValueById("cmis:objectId"))); }
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24189865
possible better answer: http://stackoverflow.com/a/56900907
has answer: http://stackoverflow.com/a/24189865

http://stackoverflow.com/comment/37228815
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24128879
score: 0
has text: Friend but I already have declared file with get and set. public StreamedContent getFile() { return file; } public void setFile(StreamedContent file) { this.file = file; }

http://stackoverflow.com/q/24158642
score: 1
answer count: 1
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/7229226
has title: How to add multiple JPanels to JFrame with different sizes
linked to: http://stackoverflow.com/q/5621338
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24160630
tagged with: jframe
tagged with: layout
has body: I tried to do this from stackoverflow: adding multiple jPanels to jFrame But that didn't seem to work out like in the example, could anyone tell me what im doing wrong? Im trying to add multiple JPanels with each their own sizes to the JFrame. I was also hoping it was possible to give each JPanel specific sizes and ability to put them on the exact spot i want. Picture of what i try to make: This is my code so far: public ReserveringenGUI(ReserveringController controller) { this.controller = new ReserveringController(); makeFrame(); } public void makeFrame() { JFrame frame1 = new JFrame(); frame1.setTitle("Reserveringen"); frame1.setSize(800, 500); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS)); JPanel willekeurigPanel = new JPanel(); willekeurigPanel.setSize(400, 500); willekeurigPanel.setBackground(Color.YELLOW); willekeurigPanel.setVisible(true); JPanel overzichtPanel = new JPanel(); overzichtPanel.setSize(400, 500); overzichtPanel.setBackground(Color.red); overzichtPanel.setVisible(true); DateFormat format = new SimpleDateFormat("dd-MM-yyyy"); DateFormatter df = new DateFormatter(format); JFormattedTextField dateBeginField = new JFormattedTextField(df); dateBeginField.setPreferredSize(new Dimension(250, 20)); dateBeginField.setValue(new Date()); JFormattedTextField dateEndField = new JFormattedTextField(df); dateEndField.setPreferredSize(new Dimension(250, 20)); dateEndField.setValue(new Date()); JTextField klantnummer = new JTextField(); klantnummer.setPreferredSize(new Dimension(250, 20)); JTextField artikelnummer = new JTextField(); artikelnummer.setPreferredSize(new Dimension(250, 20)); JLabel dateBeginLabel = new JLabel("Begin Datum "); JLabel dateEndLabel = new JLabel("Eind datum: "); JLabel klantID = new JLabel("Klant nummer: "); JLabel artikelID = new JLabel("Artikel nummer: "); JButton voegReserveringToe = new JButton("Voeg toe"); voegReserveringToe.a…
tagged with: swing
has comment: http://stackoverflow.com/comment/37285333
linked to: http://stackoverflow.com/q/8492065
linked to: http://stackoverflow.com/q/6325384
has answer: http://stackoverflow.com/a/24160630
has comment: http://stackoverflow.com/comment/37285697
type: AnsweredQuestion
tagged with: java
tagged with: jpanel

http://stackoverflow.com/comment/37369657
score: 1
type: Comment
has text: @AndersR.Bystrup I know, hence the reason I asked to confirm the line.
type: QuestionComment
comment on: http://stackoverflow.com/q/24203686

http://stackoverflow.com/a/24131024
accepted answer of: http://stackoverflow.com/q/24130966
has comment: http://stackoverflow.com/comment/37232996
downvote count: 0
has comment: http://stackoverflow.com/comment/37238306
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24130966
has comment: http://stackoverflow.com/comment/37242769
type: Answer
has body: Use pipe | to select more nodes: //tr/td[@class='name']/a | //tr/td[@class='name']/span[@class='complete'] See XPath or operator for different nodes
upvote count: 2
score: 2

http://stackoverflow.com/comment/37377932
comment on: http://stackoverflow.com/q/24207039
has text: I did nothing, it's not my blog ;) Anyway, I don't know how you can do it differently
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24145494
score: 3
answers question: http://stackoverflow.com/q/24145039
type: Answer
accepted answer of: http://stackoverflow.com/q/24145039
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: Convert byte[] to String when you send Signature in http header byte[] signatures = ... String signatureAsString = BaseEncoding.base64().encode ( signatures ); // Add signatureAsString as a HTTP header X-SIGN To get signature in Http Header in Servlet Filter // ServletRequest request HttpServletRequest req = (HttpServletRequest)request; String signature = req.getHeader("X-SIGN"); byte[] bytes = BaseEncoding.base64().decode ( signature ); I used Google Guava BaseEncoding for encoding/decoding. You can use any Base64, Base16 encoding API.

http://stackoverflow.com/a/24212788
downvote count: 0
has comment: http://stackoverflow.com/comment/37387122
has comment: http://stackoverflow.com/comment/37386850
type: AcceptedAnswer
has body: I believe you're looking for something like this, List&lt;Object&gt; al = map.get(key); if (al == null) { al = new ArrayList&lt;Object&gt;(); map.put(key, al); } al.add(value); Please note that the above uses raw Object Lists. You should (if possible) pick a proper type, and use it. Edit Some prefer the (slightly shorter) form, if (!map.containsKey(key)) { map.put(key, new ArrayList&lt;Object&gt;()); } map.get(key).add(value);
has comment: http://stackoverflow.com/comment/39551554
answers question: http://stackoverflow.com/q/24212717
type: Answer
has comment: http://stackoverflow.com/comment/37386862
has comment: http://stackoverflow.com/comment/37386947
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24212717
has comment: http://stackoverflow.com/comment/37386936

http://stackoverflow.com/comment/37441135
has text: @kklys Yes. I'm not 100% sure that's the correct pattern
comment on: http://stackoverflow.com/a/24241342
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37323012
has text: Are there any exeptions in your logile?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24179409
score: 0

http://stackoverflow.com/comment/37519275
type: Comment
comment on: http://stackoverflow.com/q/24266917
score: 0
has text: @Durandal It may be a bit ambigous at times, but it's more readable, and IntelliJ knows which one is the right one, when I press `[Crtl]+[B]` or `[Crtl]+[Q]` :)
type: QuestionComment

http://stackoverflow.com/q/24221358
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/8203251
favorite count: 0
has answer: http://stackoverflow.com/a/24234533
type: Question
tagged with: jakarta-ee
tagged with: ejb
tagged with: jndi
linked to: http://stackoverflow.com/q/3402317
tagged with: glassfish
has title: JavaEE 7: EJB jndi-name without interface
has body: I use GF4 server and in its log I have: Portable JNDI names for EJB com.test.cms.svr.web.Service2: [java:global/com.test.cms.svr.web_1.0.0/com.test.cms.svr.web.Service2, java:global/com.test.cms.svr.web_1.0.0/com.test.cms.svr.web.Service2!com.test.fw.svr.web.bundle.ComponentService]]] My questions: Why are there two jndi names - with interface and without interface? Why can I get bean only using jndi-name with interface even when EJB is only local?
accepted answer: http://stackoverflow.com/a/24234533
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/a/24114168
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: You get null pointer exception because you didn't allocate spaces for your array. Try: String[] letters = new String[9]; When you run with this revision, you will see Array index out of bounds: 9, because your for-loop should only iterate up to 8, having started from 0. In order to check if someone has won, first find out which square corresponds to which array position. Then, you can see if one of the symbols has taken one of the eight possible winning positions in the array. For example, X taking a diagonal line wins. This can be done with: if (possibility1 || possibility2 || possibility3... || possibility8) [code to run on winning result] This check occurs every time a player enters his X or O into the board. In your case, it the place where you wrote "//would like to use to check wins". Also, I'm not sure if you know this already, but there's only one error in that console output, not many. It shows a sequence of calls leading up the error (top) with the bottommost calling another, which calls another, upwards.
answers question: http://stackoverflow.com/q/24113299

http://stackoverflow.com/comment/37232870
has text: I don't think that's how it works, doesn't `World` receive key information?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24131118

http://stackoverflow.com/comment/37244198
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24127561
score: 0
has text: How to use this on the code of Jeff Gohlke? Because his code works on my ArrayList and your code is not the same that I need, so I have to adapt your code to mine. But how? Should I take only the third part about Collection?

http://stackoverflow.com/comment/37347843
type: AnswerComment
comment on: http://stackoverflow.com/a/24192698
score: 1
type: Comment
has text: Minor quibble -- the diamond operator was introduced in Java 7

http://stackoverflow.com/a/24205609
score: 0
accepted answer of: http://stackoverflow.com/q/24204841
type: AcceptedAnswer
has body: Thanks @Serge Ballesta, I ended up just running this as a SQL query instead of a HQL query, and it worked fine.
answers question: http://stackoverflow.com/q/24204841
type: Answer

http://stackoverflow.com/a/24224738
answers question: http://stackoverflow.com/q/24219787
score: 0
has body: According to your explanation this is what I understood :- Method1() is for IE Method2() is for FF Method3() is for chrome Why are you ending the code with new WebDriver instantiation? Instead it makes more sense when you create a a structure like below. Class { WebDriver driver; Method1() { driver = new InternetExplorerDriver(); //code for IE goes here driver.quit(); } Method2() { driver = new FirefoxDriver(); //code for FF goes here driver.quit(); } Method3() { driver = new ChromeDriver(); //code for chrome goes here driver.quit(); } } Your requirement seems out of ordinary. If you want to test some code in different browsers, its better to use a framework such as TestNG/JUnit or specify different test for different browsers. Hope this helps you.
has comment: http://stackoverflow.com/comment/37433111
type: Answer

http://stackoverflow.com/comment/127395237
type: Comment
type: AnswerComment
score: 9
has text: In Jackson 2.10.0 they deprecated `configure(MapperFeature f, boolean state` and the preferred pattern looks like this: `ObjectMapper mapper = JsonMapper.builder().configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true).build()`
comment on: http://stackoverflow.com/a/44217670

http://stackoverflow.com/q/24174973
has comment: http://stackoverflow.com/comment/37742458
favorite count: 0
type: Question
has body: I am trying to build a small multi-client/server turn-based card game. I am utilising the Command Pattern to update my 'GameInstance' objects which hold the entire game state (game deck, discard pile, all players [which in-turn hold their own hands], etc.) My base command looks like such: public interface IGameCommand extends Serializable { public abstract boolean isValid(); public abstract void execute(); } So, when the client (which has a reference to 'GameInstance') creates a concrete command, say, "DrawCardCommand" it looks like such: public class DrawCardCommand extends GameCommand { private static final long serialVersionUID = 4815250478595425060L; private static Logger log = Logger.getLogger(DrawCardCommand.class); /*** * opponent = player making command, GameInstance = game to apply changes to */ public DrawCardCommand(Opponent opponent, GameInstance instance){ super(opponent, instance); } @Override public boolean isValid() { // the super (abstract) class will verify that the // player making the command, actually has control of // game play and that the game status is 'in-play' if(!super.isValid()){ return false; } // game must be 'WAITING_FOR_DRAW' status if(this.instance.getStatus().compareTo(GameStatus.WAITING_FOR_DRAW) != 0){ return false; } // are there cards in the deck to draw from? if(this.instance.getDeck().getCardCount() &lt; 1){ return false; } return true; } @Override public void execute() { // draw the top card from the deck ICard drawnCard = this.instance.getDeck().drawFromTop(); // get the drawn card and give it to the current player IPlayerConfig player = this.instance.getPlayerConfig(this.currentPlayer); if(null == player){ log.error(String.format("Failed during execute. PlayerConfig not found for player %s in game %d", this.currentPlayer.toString(), this.instance.getInstanceId())); return; } // place the drawn card in the players hand player.getHand().placeOnBottom(drawnCard); // update the status of the game (waiting for player // to nego…
tagged with: client-server
answer count: 0
has comment: http://stackoverflow.com/comment/37742512
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/37740740
has comment: http://stackoverflow.com/comment/47729604
tagged with: command-pattern
has comment: http://stackoverflow.com/comment/37315120
score: 1
tagged with: java
has title: Command Pattern in turn-based card game
has comment: http://stackoverflow.com/comment/37740522

entitymanager
tags question: http://stackoverflow.com/q/24244621
tag name: entitymanager
tags question: http://stackoverflow.com/q/24150493
type: Tag
tags question: http://stackoverflow.com/q/24133101

http://stackoverflow.com/comment/37478991
comment on: http://stackoverflow.com/a/24243351
type: AnswerComment
score: 0
has text: Your reputation descrased due a lack of comprehension of what you were implementing, the bad structure of the qüestion (the problem you described is not the one you have, you needed several edits to clarify), and the overflow of text in your qüestion (more text does not mean more useful data). the community may understand if you are not a guru, but some accurate definition of the problem is needed always. Also, the solution you "found" is in my last comment.
type: Comment

http://stackoverflow.com/a/24208370
has comment: http://stackoverflow.com/comment/37379262
has body: You can see what documentation says: The method DriverManager.getConnection establishes a database connection. This method requires a database URL, which varies depending on your DBMS. The following are some examples of database URLs: MySQL: jdbc:mysql://localhost:3306/, where localhost is the name of the server hosting your database, and 3306 is the port number So, for MySQL Connector/J Database URL The following is the database connection URL syntax for MySQL Connector/J: jdbc:mysql://[host][,failoverhost...] [:port]/[database] [?propertyName1][=propertyValue1] [&amp;propertyName2][=propertyValue2]... Where: host:port is the host name and port number of the computer hosting your database. If not specified, the default values of host and port are 127.0.0.1 and 3306, respectively. So, every operation you do will be applied on this post database is the name of the database to connect to. If not specified, a connection is made with no default database. failover is the name of a standby database (MySQL Connector/J supports failover). propertyName=propertyValue represents an optional, ampersand-separated list of properties. These attributes enable you to instruct MySQL Connector/J to perform various tasks. Update: if you have a remote databases (your remote server) that you want to access to, you should have for example: String dburl = "jdbc:mysql://&lt;REMOTE_HOST&gt;:3306/Db_Name"; //replace with your remote host ... // here all the code related to your remote host Note: if you remote server has in its configuration "localhost" you have to figure out its public ip address by executing ifconfig. Then use its ip address on your string. As important note your remote server must be configured to allow remote connections.
type: Answer
answers question: http://stackoverflow.com/q/24208029
has comment: http://stackoverflow.com/comment/37377803
score: 0
has comment: http://stackoverflow.com/comment/37377854
has comment: http://stackoverflow.com/comment/37377746
has comment: http://stackoverflow.com/comment/37378177
has comment: http://stackoverflow.com/comment/37378035

scene2d
tags question: http://stackoverflow.com/q/24250791
tags question: http://stackoverflow.com/q/24108042
tag name: scene2d
tags question: http://stackoverflow.com/q/24111047
tags question: http://stackoverflow.com/q/24234938
type: Tag

http://stackoverflow.com/a/25921366
type: AcceptedAnswer
has body: For the given API, it either; 1-does not contain the tag you are looking for 2-the file itself might not have that tag filled 3-you might want to recreate your own using a more general tag command when calling exiftool.exe Look in the source code and find the enum containing all the tags available to the API, that'll show you what you're restricted to. But yeah, you might want to consider making your own class similar to the one you're using. I'm in the midst of doing the same. That way you can store the tags in perhaps a set or HashMap instead of an enum and therefore be much less limited in tag choice. Then, all you have to do is write the commands for the tags you want to the process's OutputStream and then read the results from the InputStream.
type: Answer
accepted answer of: http://stackoverflow.com/q/24177062
score: 0
answers question: http://stackoverflow.com/q/24177062

http://stackoverflow.com/a/24147203
answers question: http://stackoverflow.com/q/24147177
has comment: http://stackoverflow.com/comment/37264765
has comment: http://stackoverflow.com/comment/37262523
score: 0
has comment: http://stackoverflow.com/comment/37263428
has comment: http://stackoverflow.com/comment/37262651
upvote count: 1
type: Answer
downvote count: 1
has body: use this: input.split("\\s+"); This will split not only "5 10" to "5" and "10", but will split by any number of whitespaces. For example, if you have 4 whitespaces between 5 and 10 the output will be the same. or you can use simply " " to ignore tabs and line breaks.

http://stackoverflow.com/a/24118924
type: Answer
score: 0
has body: Where is your LinearLayout t1, inside activity_search_result.xml or fragment_search_result? That could be mistake...
has comment: http://stackoverflow.com/comment/37209237
answers question: http://stackoverflow.com/q/24118819

http://stackoverflow.com/q/24116173
answer count: 2
has title: Error while configuring log4j using xml configuration
tagged with: apache
has comment: http://stackoverflow.com/comment/37204374
linked to: http://stackoverflow.com/q/5117758
has body: I am trying to configure log4j using xml. I am using log4j1.2.13.jar and apache-log4j-extras-1.2.17.jar. below is the xml. <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <priority value ="DEBUG"/> <appender-ref ref="R"/> </log4j:configuration> But its not generating logs for the project. Below are the errors :: log4j:WARN Continuable parsing error 15 and column 78 log4j:WARN Element type "rollingPolicy" must be declared. log4j:WARN Continuable parsing error 18 and column 79 log4j:WARN Element type "triggeringPolicy" must be declared. log4j:WARN Continuable parsing error 21 and column 15 log4j:WARN The content of element type "appender" must match "(errorHandler?,param*,layout?,filter*,appender-ref*)". log4j:WARN Please set a rolling policy for the RollingFileAppender named 'R' level::: 7 log4j:ERROR No output stream or file set for the appender named [R]. Please help me to solve the issue.
has answer: http://stackoverflow.com/a/24116261
type: Question
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/31572354
tagged with: log4j
has comment: http://stackoverflow.com/comment/37204441
score: 0

http://stackoverflow.com/comment/37378785
has text: Can you show us how you create and use your `RestTemplate`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24208828
type: QuestionComment

microbenchmark
tag name: microbenchmark
tags question: http://stackoverflow.com/q/24233716
tags question: http://stackoverflow.com/q/24196176
type: Tag

http://stackoverflow.com/comment/40448184
score: 0
comment on: http://stackoverflow.com/q/24151221
type: QuestionComment
type: Comment
has text: @KrzysztofMiksa Sorry for the delay here is a sample app https://github.com/charlires/rest-api-template

http://stackoverflow.com/comment/37467032
has text: If it worked for you, you can answer your own question to help future visitors to this site.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24254679

http://stackoverflow.com/comment/37313987
type: AnswerComment
comment on: http://stackoverflow.com/a/24147958
has text: @ike_love I wasn't going to add unnecessary complexity to a brand new programmer. Don't think it warrants a downvote in these circumstances, but to each their own I suppose.
score: 0
type: Comment

spring-mvc
tags question: http://stackoverflow.com/q/24114279
tags question: http://stackoverflow.com/q/24229219
tags question: http://stackoverflow.com/q/24106726
type: Tag
tags question: http://stackoverflow.com/q/24210992
tags question: http://stackoverflow.com/q/24136173
tags question: http://stackoverflow.com/q/24256766
tags question: http://stackoverflow.com/q/24159524
tags question: http://stackoverflow.com/q/24168522
tags question: http://stackoverflow.com/q/24179777
tags question: http://stackoverflow.com/q/24180337
tags question: http://stackoverflow.com/q/24195586
tags question: http://stackoverflow.com/q/24153379
tags question: http://stackoverflow.com/q/24230349
tags question: http://stackoverflow.com/q/24244781
tags question: http://stackoverflow.com/q/24202779
tags question: http://stackoverflow.com/q/24170393
tags question: http://stackoverflow.com/q/24108424
tags question: http://stackoverflow.com/q/24148345
tags question: http://stackoverflow.com/q/24194724
tags question: http://stackoverflow.com/q/24197141
tags question: http://stackoverflow.com/q/24178112
tags question: http://stackoverflow.com/q/24167590
tags question: http://stackoverflow.com/q/24182080
tags question: http://stackoverflow.com/q/24179277
tags question: http://stackoverflow.com/q/24253556
tags question: http://stackoverflow.com/q/24133587
tags question: http://stackoverflow.com/q/24166101
tags question: http://stackoverflow.com/q/24179101
tags question: http://stackoverflow.com/q/24229260
tags question: http://stackoverflow.com/q/24146018
tags question: http://stackoverflow.com/q/24265689
tags question: http://stackoverflow.com/q/24183146
tags question: http://stackoverflow.com/q/24156490
tags question: http://stackoverflow.com/q/24157414
tags question: http://stackoverflow.com/q/24158879
tags question: http://stackoverflow.com/q/24212625
tags question: http://stackoverflow.com/q/24237276
tags question: http://stackoverflow.com/q/24192526
tags question: http://stackoverflow.com/q/24195162
tags question: http://stackoverflow.com/q/24156097
tags question: http://stackoverflow.com/q/24229337
tags question: http://stackoverflow.com/q/24183744
tags question: http://stackoverflow.com/q/24119973
tags question: http://stackoverflow.com/q/24185032
tags question: http://stackoverflow.com/q/24121786
tags question: http://stackoverflow.com/q/24182516
tags question: http://stackoverflow.com/q/24190997
tags question: http://stackoverflow.com/q/24132781
tags question: http://stackoverflow.com/q/24107409
tags question: http://stackoverflow.com/q/24171876
tags question: http://stackoverflow.com/q/24127682
tags question: http://stackoverflow.com/q/24226063
tags question: http://stackoverflow.com/q/24116521
tags question: http://stackoverflow.com/q/24185306
tags question: http://stackoverflow.com/q/24187082
tags question: http://stackoverflow.com/q/24130651
tags question: http://stackoverflow.com/q/24239263
tags question: http://stackoverflow.com/q/24206668
tags question: http://stackoverflow.com/q/24233904
tags question: http://stackoverflow.com/q/24265573
tags question: http://stackoverflow.com/q/24230289
tag name: spring-mvc
tags question: http://stackoverflow.com/q/24166167
tags question: http://stackoverflow.com/q/24239394
tags question: http://stackoverflow.com/q/24204177
tags question: http://stackoverflow.com/q/24188199
tags question: http://stackoverflow.com/q/24105083
tags question: http://stackoverflow.com/q/24164862
tags question: http://stackoverflow.com/q/24144336
tags question: http://stackoverflow.com/q/24159136
tags question: http://stackoverflow.com/q/24144706
tags question: http://stackoverflow.com/q/24117653
tags question: http://stackoverflow.com/q/24176478
tags question: http://stackoverflow.com/q/24212031
tags question: http://stackoverflow.com/q/24152397
tags question: http://stackoverflow.com/q/24239987
tags question: http://stackoverflow.com/q/24203686
tags question: http://stackoverflow.com/q/24189105
tags question: http://stackoverflow.com/q/24164014

http://stackoverflow.com/q/24249824
tagged with: android
tagged with: java
has title: Android Compatibility with multiple devices
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: Ok, so I know that if I want to make images and text and buttons not get too squished in tiny devices and not be absolutely tiny in giant tablets I can create resource files that are distinct for each device and each orientation. Is there a more concise way to do this? I.e. is there a way to have a single folder with all my resources multiplied by like a "screen scaling factor" so that every time I want to edit I don't have to go back and change 30 different resources and then check to make sure they all fit? Thanks
answer count: 2
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/24250494
downvote count: 0
has answer: http://stackoverflow.com/a/24250494
accepted answer: http://stackoverflow.com/a/24249918
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24249918
has comment: http://stackoverflow.com/comment/37457423

http://stackoverflow.com/a/24178672
type: Answer
has comment: http://stackoverflow.com/comment/37336060
score: 9
has comment: http://stackoverflow.com/comment/37333841
has comment: http://stackoverflow.com/comment/37344182
downvote count: 0
has comment: http://stackoverflow.com/comment/37339960
answers question: http://stackoverflow.com/q/24172770
has comment: http://stackoverflow.com/comment/37352697
upvote count: 9
has body: &lt;%@ include file="/WEB-INF/pages/table.jsp" %&gt; is a static import, so it includes contents of the table.jsp file into your parent jsp before the parent is compiled. After parent is compiled, changes to the table.jsp will not be visible, as parent source/class will not change. You have to update timestamp (e.g. use touch command or open and save) on the parent to make container be aware that changes have been done in the included files.

http://stackoverflow.com/q/24175145
tagged with: string
tagged with: collections
accepted answer: http://stackoverflow.com/a/24175710
has comment: http://stackoverflow.com/comment/37316166
has answer: http://stackoverflow.com/a/24176148
favorite count: 0
has comment: http://stackoverflow.com/comment/37315189
type: Question
has answer: http://stackoverflow.com/a/24175710
has body: The user is allowed to play with an array of strings. They can add strings to the array, remove strings from the array, search for strings in the array, and eventually they will be able to sort the array. The sorting is what is messing me up. I've tried a few different approaches. The first approach was to convert the array into an ArrayList and use Collections to sort the ArrayList, which would be converted back into the static class array. It doesn't work. The second approach I tried was to iterate through the array and try to sort only the strings added by the user instead of everything in the array (since there are some null values in the array). Perhaps I should iterate through the array and then store the non-null values into a new array that I can then sort? But what if I want to add more strings after sorting the new array? That's why I stopped with the second solution. The third attempt was to use Arrays.sort() on my array but for some reason it does not work. Here is the exception: Exception in thread "main" java.lang.NullPointerException at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290) at java.util.ComparableTimSort.sort(ComparableTimSort.java:157) at java.util.ComparableTimSort.sort(ComparableTimSort.java:146) at java.util.Arrays.sort(Arrays.java:472) at java.util.Collections.sort(Collections.java:155) at testingSearch.sortArray(testingSearch.java:93) at testingSearch.main(testingSearch.java:42) Here is my code: import java.util.Scanner; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class testingSearch { static String[] strArray; static { strArray = new String[5]; } public static void main(String[] args) { Scanner input = new Scanner(System.in); while(true){ System.out.println("1. Add string to the string array."); System.out.println("2. Remove string from the string array."); System.out.println("3. Display strings in string array."); System.out.println(…
upvote count: 2
has comment: http://stackoverflow.com/comment/37315283
has comment: http://stackoverflow.com/comment/37316112
tagged with: arrays
has comment: http://stackoverflow.com/comment/37315809
has comment: http://stackoverflow.com/comment/37315198
score: -1
tagged with: sorting
has comment: http://stackoverflow.com/comment/37315894
has comment: http://stackoverflow.com/comment/37315252
has comment: http://stackoverflow.com/comment/37316069
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14863433
answer count: 3
has comment: http://stackoverflow.com/comment/37315917
has comment: http://stackoverflow.com/comment/37315858
has answer: http://stackoverflow.com/a/24338094
has comment: http://stackoverflow.com/comment/37316034
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37315222
has title: Sorting an array of strings in Java
has comment: http://stackoverflow.com/comment/37315210
has comment: http://stackoverflow.com/comment/37315297
possible better answer: http://stackoverflow.com/a/24176148

http://stackoverflow.com/q/24149361
tagged with: java
has body: I am having an issue with trying to set some from fields using Apache PDFBOX(1.8.5). I have a few different Static PDFs that I am using for testing. Using the following code, I can set the values of form fields, and save the resulting PDF. I can then open this PDF in Adobe Reader and see the results: PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog(); pdfTemplate.setAllSecurityToBeRemoved(true); PDAcroForm acroForm = docCatalog.getAcroForm(); List fields = acroForm.getFields(); Iterator fieldsIter = fields.iterator(); while( fieldsIter.hasNext()) { PDField field = (PDField)fieldsIter.next(); if(field instanceof PDTextbox){ ((PDTextbox)field).setValue("STATIC PDFBOX EDIT"); } } And then I eventually save the form. For Static PDFs of: PDF Version: 1.6 (Acrobat 7.x) PDF Version: 1.7 (Acrobat 8.x) This works just fine. I can open the Documents in Adobe Reader XI and see the correct values in the form. For Static PDFs of: PDF Version: 1.7 Adobe Extension Level 3(Acrobat 9.x) PDF Version: 1.7 Adobe Extension Level 8(Acrobat X) PDF Version: 1.7 Adobe Extension Level 11(Acrobat XI) This appears to not be working. When I open the resulting forms in Adobe Reader XI, the fields do not appear to be populated. But If I open the PDF in my Firefox or Chrome browser's PDF viewer, the fields show as populated there. How can I set these fields so the values will appear when viewed in Adobe Reader XI? EDIT: Sample PDFs can be found here: https://github.com/bamundson/PDFExample
downvote count: 0
has answer: http://stackoverflow.com/a/32346322
possible better answer: http://stackoverflow.com/a/32346322
has comment: http://stackoverflow.com/comment/37277992
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37332670
tagged with: adobe-reader
has comment: http://stackoverflow.com/comment/37293305
score: 11
upvote count: 11
tagged with: pdfbox
has title: Form field values set with PDFBOX not visible in Adobe Reader
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24187719
accepted answer: http://stackoverflow.com/a/24187719
answer count: 2

http://stackoverflow.com/comment/37217423
type: Comment
type: QuestionComment
has text: @Jyro117 please see the new edit thanks!
comment on: http://stackoverflow.com/q/24122075
score: 0

http://stackoverflow.com/comment/37274411
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24132126
type: Comment
has text: Are you extending GridPanel or JPanel?

http://stackoverflow.com/a/24210879
score: 4
type: Answer
upvote count: 4
has body: I don’t think that there is a rule forbidding this pattern. It’s rather likely you found a compiler bug. It’s easy to show that this pattern does not result in unsound code by just writing down the equivalent inner class code of g(() -&gt; 1);: g(new CheckedCallable2&lt;Integer, RuntimeException&gt;() { public Integer call() { return 1; } }); This compiles and runs without any problems, even under Java 6 (I assume it would even run on Java 5 but I had no JDK to test it) and there is no reason why it shouldn’t work when doing the same with a lambda. Writing down this code in Netbeans results even in the recommendation to convert it to a lambda. There is also no runtime restriction which would forbid such a construct. Besides the fact that under the hood there are no exception rules enforced and everything relies on the compile-time checks, we can even prove that it would work if the compiler accepted our code by creating the code manually that the compiler would create: CheckedCallable2&lt;Integer,RuntimeException&gt; c; try { MethodHandles.Lookup l = MethodHandles.lookup(); c=(CheckedCallable2) LambdaMetafactory.metafactory(l, "call", MethodType.methodType(CheckedCallable2.class), MethodType.methodType(Object.class), l.findStatic(Generics.class, "lambda$1", MethodType.methodType(int.class)), MethodType.methodType(Integer.class)).getTarget().invokeExact(); } catch(Throwable t) { throw new AssertionError(t); } int i=g(c); System.out.println(i); // verify that the inheritance is sound: Callable&lt;Integer&gt; x=c; try { System.out.println(x.call()); }// throws Exception catch(Exception ex) { throw new AssertionError(ex); } … static int lambda$1() { return 1; }// the synthetic method for ()-&gt;1 This code runs and produces 1 as expected, regardless of which interface we use to call(). Only the exceptions we have to catch differ. But as said, that’s a compile-time artifact.
accepted answer of: http://stackoverflow.com/q/24199148
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24199148
has comment: http://stackoverflow.com/comment/37387291

http://stackoverflow.com/comment/37480176
type: QuestionComment
comment on: http://stackoverflow.com/q/24261623
has text: You mean the last-but-one SVN revision number and date? I suspect that would be very hard to get - why do you need it?
type: Comment
score: 1

paint
tags question: http://stackoverflow.com/q/24186733
tag name: paint
tags question: http://stackoverflow.com/q/24253358
tags question: http://stackoverflow.com/q/24218760
tags question: http://stackoverflow.com/q/24152414
tags question: http://stackoverflow.com/q/24227137
tags question: http://stackoverflow.com/q/24212589
type: Tag
tags question: http://stackoverflow.com/q/24255929
tags question: http://stackoverflow.com/q/24260863
tags question: http://stackoverflow.com/q/24206085

http://stackoverflow.com/comment/37408579
type: Comment
type: AnswerComment
has text: Thanks for your reply. I have applied your hints to my code(I updated main post), but the widget is still not working. (It compiles successfully without my event). Did I understand something wrong? Do you need more details to solve my problem?
score: 0
comment on: http://stackoverflow.com/a/24223416

http://stackoverflow.com/comment/37395877
type: Comment
has text: Isn't that notation for inner classes?
type: AnswerComment
comment on: http://stackoverflow.com/a/24217675
score: 1

http://stackoverflow.com/q/24154923
type: Question
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37277277
has comment: http://stackoverflow.com/comment/37277612
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37279113
downvote count: 0
upvote count: 1
tagged with: swing
has body: I have almost completed my Java application designed in Netbeans using JFrame. The mistake I have made is that I have put all my components directly on the frame rather than a JPanel. Now I want to make the frame scrollable, but I don't know how I can transfer all my components to a scroll pane from the frame. Any other way of making the frame scrollable?
has comment: http://stackoverflow.com/comment/37277288
has answer: http://stackoverflow.com/a/26929109
has comment: http://stackoverflow.com/comment/37277324
has title: How to move Swing components from JFrame to JScrollPane?
tagged with: jscrollpane
score: 1
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37279058
has comment: http://stackoverflow.com/comment/37278056
favorite count: 0

http://stackoverflow.com/a/24482325
score: 1
downvote count: 0
has body: Do a refactor to your code, to be more readable Your code uses the update method String deptName = (String)jdbcTemplate.update(new PreparedStatementCreator() { and you are doing a query SELECT_DEPT, update and select? It has no sense. JdbcTemplate has the query method and it supports or is able to work with a ResultSetExtractor
type: Answer
answers question: http://stackoverflow.com/q/24225512
upvote count: 1

http://stackoverflow.com/comment/37391512
type: AnswerComment
comment on: http://stackoverflow.com/a/24215220
score: 0
has text: Can you add a demo link it seems not to work on the example given
type: Comment

http://stackoverflow.com/q/24134020
tagged with: regex
has answer: http://stackoverflow.com/a/24134193
has body: I'm trying to split a text like "name:jack,berk,john;teacher:smith,jan;course:math;" And I hope the result contains 3 sub-strings (or less, depends on the appearance of 'name' 'teacher' 'course'), which is: "name:jack,berk,john;" "teacher:smith,jan;" "course:math;" But the appearance order of identifiers 'teacher,name,course' is not fixed, it can be 'course ,name, teacher' and it also can lack one or two, just like only has 'name' identifiers. Also the delimiter between identifiers is not fixed, in the example is ';',but also can be '、\\s,'. I have tried many times but it not works. String str = "name:jack,berk,john;teacher:smith,jan;course:math; str = str.replaceAll("(.*)(.)(name|teacher|course)(.*)(.)(name|teacher|course)(.*)", "$1--$3$4--$6$7"); System.out.println(str); Any suggestions would be appreciated.
has answer: http://stackoverflow.com/a/24134283
has comment: http://stackoverflow.com/comment/37238234
answer count: 4
has comment: http://stackoverflow.com/comment/37238420
possible better answer: http://stackoverflow.com/a/24134228
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/24134193
downvote count: 0
has answer: http://stackoverflow.com/a/24134426
favorite count: 0
has comment: http://stackoverflow.com/comment/37238046
has title: Java regex split text (both the delimiter and the order may be unknown)
has comment: http://stackoverflow.com/comment/37238111
has comment: http://stackoverflow.com/comment/37238244
type: Question
score: 3
has answer: http://stackoverflow.com/a/24134228
tagged with: java
has comment: http://stackoverflow.com/comment/37238360
has comment: http://stackoverflow.com/comment/37238166
has comment: http://stackoverflow.com/comment/37238297

http://stackoverflow.com/a/24452428
has comment: http://stackoverflow.com/comment/37985036
downvote count: 0
has comment: http://stackoverflow.com/comment/37881142
upvote count: 1
has comment: http://stackoverflow.com/comment/37857818
has comment: http://stackoverflow.com/comment/37853737
has comment: http://stackoverflow.com/comment/37841976
has comment: http://stackoverflow.com/comment/37854071
has comment: http://stackoverflow.com/comment/37985160
has body: These are the necessary steps to make KryoNet work: Server server = new Server(); Kryo kryo = server.getKryo(); kryo.register(float[].class); server.start(); server.bind(2300, 2301); server.addListener(new Listener() { public void received(Connection connection, Object object) { if(object instanceof float[]) { float[] array = (float[])object; } } }); Client client = new Client(); Kryo kryo = client.getKryo(); kryo.register(float[].class); client.addListener(new Listener() { public void connected(Connection connection) { connection.sendTCP(new float[] {5.0f, 6.0f, 7.0f, 8.0f}); } }); client.start(); client.connect(5000, "127.0.0.1”, 2300, 2301); Of course, you can use client.sendTCP() once you've connected to the server. Replace the float[] with Packet, and it should work. You don't need to mess with making threads yourself, KryoNet is already asynchronous, except for the discoverHost() method call if you use it. EDIT: I whipped up an example project that works. Packet.java: public class Packet { private String message; public Packet() { } public Packet(String message) { this.message = message; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } KryoClient.java: public class KryoClient { private Client client; public KryoClient() throws IOException { client = new Client(); Kryo kryo = client.getKryo(); kryo.register(float[].class); kryo.register(Packet.class); //kryo.register(String.class); client.addListener(new Listener() { public void connected(Connection connection) { //connection.sendTCP(new float[] {5.0f, 6.0f, 7.0f, 8.0f}); connection.sendTCP(new Packet("Hello, Server! You're sexy, rawr :3")); } @Override public void received(Connection connection, Object object) { if (object instanceof float[]) { float[] array = (float[]) object; for(float a : array) { System.out.println(a); } } else if(object instanceof Packet) { Packet packet = (Packet) object; System.out.println("Message: " + packet.getMessa…
answers question: http://stackoverflow.com/q/24134655
score: 1
has comment: http://stackoverflow.com/comment/37853281
has comment: http://stackoverflow.com/comment/37886863
type: Answer
has comment: http://stackoverflow.com/comment/37852179
has comment: http://stackoverflow.com/comment/37852598
has comment: http://stackoverflow.com/comment/37856484
has comment: http://stackoverflow.com/comment/37852618

http://stackoverflow.com/a/24194971
type: Answer
has body: There are some cases in documentation to File.renameTo() when file cannot be moved: * Many aspects of the behavior of this method are inherently * platform-dependent: The rename operation might not be able to move a * file from one filesystem to another, it might not be atomic, and it * might not succeed if a file with the destination abstract pathname * already exists. The return value should always be checked to make sure * that the rename operation was successful.
score: 0
answers question: http://stackoverflow.com/q/24194869

http://stackoverflow.com/q/24220397
has body: This is my Class public class EventDetail { private String MemberId; private String Category; private Date Cdate; public EventDetail(String MemberId, String Category, Date Cdate) { this.MemberId = MemberId; this.Category = Category; this.Cdate = Cdate; } public Date getDate() { return this.Cdate; } public void setDate(Date Cdate) { this.Cdate = Cdate; } when i call the method with the object event <% for (EventDetail event : events) { %> <%=event.getDate() %> <%=event.Category() %> I got this error.How to solve this error where i think my class EventDetail does not show any error. The method getDate() is undefined for the type EventDetail %> <%= count %> <%=event.getDate() %> <%=event.Place() %> <%=event.Title() %> <%=event.Category() %>
tagged with: jakarta-ee
type: Question
tagged with: google-app-engine
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37404459
has title: How to solve this error (method is undefined for the type)?
has comment: http://stackoverflow.com/comment/37403809
has comment: http://stackoverflow.com/comment/37412832
has comment: http://stackoverflow.com/comment/37402534
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37403738

http://stackoverflow.com/q/24180099
favorite count: 0
has comment: http://stackoverflow.com/comment/37323917
type: Question
tagged with: jtabbedpane
has answer: http://stackoverflow.com/a/24180166
accepted answer: http://stackoverflow.com/a/24180166
tagged with: java
has body: I'm developing a Image Editor in java, i inserted a JPanel inside a JTabbedPane, to create a JTabbedPane with tabs that rapresent the Image Filter i want to apply to the image, i don't know how to obtain a The inner JPanel of a TabbedPane to decide witch filter is selected, because when i do " jTabbedPane1.getSelectedComponent(); " i can obtain only a component not a JComponent.. anyone knows something, sorry for my english thank's a lot.. This is a part of my code: package javaapplication22; import javax.swing.JPanel; /** * * @author iDoc */ public abstract class FilterTab extends JPanel { public FilterTab() { } protected void ApplyFilter() { } protected void ResetFilter() { } } public class InvertFilterTab extends FilterTab { private InvertFilter filter; public InvertFilterTab () { filter = new InvertFilter(); } /** * * @param originalImage * @param modifiedImage */ public void ApplyFilter(BufferedImage originalImage, BufferedImage modifiedImage) { modifiedImage = filter.filter(originalImage, modifiedImage); } @Override public void ResetFilter() { } } private void button1ActionPerformed(java.awt.event.ActionEvent evt) { BufferedImage originalImage = jOriginalPanel.getImage(); // BufferedImage modifiedImage = new BufferedImage( // originalImage.getWidth(), originalImage.getHeight(), // BufferedImage.TYPE_INT_ARGB); //modifiedImage = FilterTab ft = jTabbedPane1.getSelectedComponent(); &lt;--- the problem is here filter.filter(originalImage, modifiedImage); jModifiedPanel.changeImage(modifiedImage); jModifiedPanel.repaint();
tagged with: jpanel
upvote count: 2
type: AnsweredQuestion
score: 1
has title: how can i get a jPanel that is inside a JtabbedPane
has comment: http://stackoverflow.com/comment/37332306
answer count: 1
downvote count: 1
tagged with: swing

http://stackoverflow.com/q/24229886
has answer: http://stackoverflow.com/a/24230219
has body: private Piece[][] board; public cboard(){ this.board = new Piece[8][8]; } public boolean isEmpty(int x, int y){ boolean empty= true; if (board[x][y] != null){ empty= false; } return empty; } public void placePiece(Piece, int x, int y){ if(isEmpty(x, y)){ board[x][y] = piece; } } } Will this create an array for the pieces? The function has to check wether or not the place is empty
type: Question
tagged with: bluej
answer count: 2
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
tagged with: declare
tagged with: arrays
has answer: http://stackoverflow.com/a/24242760
favorite count: 0
has title: How do I declare an array in bluej?
tagged with: java

http://stackoverflow.com/q/24106199
type: Question
has answer: http://stackoverflow.com/a/24106671
linked to: http://stackoverflow.com/q/4787736
has comment: http://stackoverflow.com/comment/37186346
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37186610
tagged with: android
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37186717
score: 0
has title: Android/Java EditableTextView Line Count
has comment: http://stackoverflow.com/comment/37185997
tagged with: java
answer count: 1
tagged with: textview
has body: I am trying to teach myself Android Java programming and I have started by attempting to create a simple text editor. I wanted to have a line count down the left hand side like standard IDEs, and I couldn't really find anywhere on StackExchange or the internet on the definitive "best practice" way to do something like this. So I created my own logic based on what I read, but I wanted to just check that this was the best and most efficient way to do it -- and also if this happens to help anyone out looking to do the same thing. // START onCreate // @mEditText = Main AutoCompleteTextView // @mLineCount = Line Count TextView mEditText.addTextChangedListener(new TextWatcher() { // Set current line variable private int currentLine; // Text Watcher public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Before new text is inserted, get the current line count currentLine = mEditText.getLineCount(); } public void onTextChanged(CharSequence s, int start, int before, int count) { // Do nothing } @Override public void afterTextChanged(Editable e) { // Update Line Count // @mEditText: AutoCompleteTextView Input // @mLineCount: TextView Output // @currentLine: Integer updateLineCount(mEditText, mLineCount, currentLine); } }); // END onCreate public void updateLineCount(AutoCompleteTextView editText, TextView lineText, int currentLine){ // Get updated Line Count int lineCount = editText.getLineCount(); // If that Line Count exists and IS NOT the "before" Line Count (to stop repeating) if(lineCount &gt; 0 &amp;&amp; lineCount != currentLine){ // If "before" Line Count is smaller, push Line Count up if(currentLine &lt; lineCount){ lineText.append(Integer.toString(lineCount) + "\n"); } // Else if "before" Line Count is greater (ie. you have deleted a line), push Line Count down else { // Get Text of current lineText TextView, replace with a substring of // the current lineText TextView - the length of the deleted line // (ie. Line 9 = 1 Character + 1 for …

http://stackoverflow.com/q/24107907
accepted answer: http://stackoverflow.com/a/24109021
has comment: http://stackoverflow.com/comment/37189153
type: AnsweredQuestion
has body: Let's say you have a bank account. You have two synchronized methods public synchronized void withdraw ( int amount, String name ) { while ( account_balance &lt; amount ) { try { wait(); } catch (InterruptedException e) { } } public synchronized void deposit ( int amount, String name ) { while ( account_balance &gt; 3*amount ) { try { wait(); } catch (InterruptedException e) { } } } Threads that wait in withdraw monitor are waiting for another thread to deposit some money so they can withdraw and vice versa. So it makes no sense notifying all threads in withdraw monitor if one thread withdraws money, it makes sense to notify threads that are waiting in deposit monitor cause account balance is "full" and vice versa. Since you can't specify which thread wakes up with notify() and notifyAll() notifies threads waiting in the current monitor how does one notify threads that are waiting on some other monitor?
possible better answer: http://stackoverflow.com/a/24109607
has comment: http://stackoverflow.com/comment/37188954
answer count: 2
has answer: http://stackoverflow.com/a/24109021
has title: How do I notify all threads waiting on other monitor?
tagged with: java
downvote count: 2
tagged with: monitor
has comment: http://stackoverflow.com/comment/37188847
tagged with: concurrency
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24109607
tagged with: multithreading
upvote count: 1
score: -1

http://stackoverflow.com/q/24158698
score: 1
upvote count: 1
tagged with: java
has body: Is there any way to inherit a session into webdriver? I did lot of search and know it that selenium does not support connecting to already opened browser. It would be better if i could. But now I have thought about some work around. Actually my application starts with a shortcut file which launch firefox, hit the application URL, made the log in, go to the dashboard and leave for the user to use it. In that case i do not need to work on that opened browser, if i can get that active session only and set it while opening the webdriver with selenium then my purpose is solved. Even its possible manually also. As selenium always open incognito webdriver window, i am unable to get that session there. Can any one tell me how to get that session from already opened browser and use it in webdriver? Any help or suggestion would be highly appreciated.
tagged with: session-cookies
answer count: 1
tagged with: selenium
has comment: http://stackoverflow.com/comment/37361388
has title: How to use already opened browser active session in webdriver
favorite count: 0
has comment: http://stackoverflow.com/comment/37288514
type: Question
tagged with: browser-cache
has comment: http://stackoverflow.com/comment/37284133
has answer: http://stackoverflow.com/a/31331121
linked to: http://stackoverflow.com/q/10340373
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37326017
has comment: http://stackoverflow.com/comment/37321622
has comment: http://stackoverflow.com/comment/37284393
has comment: http://stackoverflow.com/comment/37316690
tagged with: selenium-webdriver
downvote count: 0

http://stackoverflow.com/comment/37315292
type: Comment
has text: Hi, thanks for the suggestion. I know how to get this done by writing the required code. I am just interested in finding out if any of the mapping libraries can do this. Sorry about my question not being clear. I will edit it to add the information.
comment on: http://stackoverflow.com/a/24174914
type: AnswerComment
score: 0

http://stackoverflow.com/a/24201654
upvote count: 2
score: 2
downvote count: 0
has body: The line: String in = input.nextLine(); is capturing your first number entered and it is never added to the list al. So, if you enter: 45 40 67 0 the output is: [40, 67] (using System.out.println(al)) or: 4067 (using your for loop). Note, the loop is broken by entering 0, not non-numeric characters as the first output text line would suggest. Read lines, please enter some other character to stop should really read Read lines, please enter 0 to stop [EDIT] To add/display numbers to the list correctly: 1) Remove the line: String in = input.nextLine(); 2) Remove the for loop at the end and replace it with: System.out.println(al);
has comment: http://stackoverflow.com/comment/37373812
type: Answer
answers question: http://stackoverflow.com/q/24201369

http://stackoverflow.com/comment/37277992
type: QuestionComment
comment on: http://stackoverflow.com/q/24149361
score: 1
type: Comment
has text: Based on my experience with iText, I can think of two reasons: (1) a different setting of the NeedAppearances value; (2) wrong DA entries in the fields. What happens if you fill out the forms with iText?

http://stackoverflow.com/q/24132819
has comment: http://stackoverflow.com/comment/37235888
has comment: http://stackoverflow.com/comment/37235930
has title: Find the Variable with biggest int value
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37236297
downvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/37235962
upvote count: 0
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/37235936
favorite count: 0
possible better answer: http://stackoverflow.com/a/24132873
type: Question
has answer: http://stackoverflow.com/a/24133109
has answer: http://stackoverflow.com/a/24132873
accepted answer: http://stackoverflow.com/a/24134533
has body: I am developing a Java application. I have five int variables. They may contain different int values. I want to check which variable is the biggest. Depending on that variable, I have to execute different method. int intHx; int intEx; int intRx; int intMx; int intIx; How can I find the variable with the highest value? PS: To Clarify I want to pick the variable with highest value, not the value that variable contain. This is not related to sorting values, but executing different method.
has comment: http://stackoverflow.com/comment/37236027
has answer: http://stackoverflow.com/a/24134533

http://stackoverflow.com/q/24255535
tagged with: garbage-collection
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24256113
type: AnsweredQuestion
has body: I'm using bitmaps in my android application and open GLES 2.0 to render them. The app crashes with the log GC_FOR_ALLOC freed &lt;1K, 4% free 12240K/12640K.My objective is to render bitmaps from the gallery folder of my phone/tablet. All that works fine. I collect all the texture (image) details (the place on my screen where it has to be rendered and the name of the image from textures = MyApplication.getTextures(); textures is a continuously GROWING arraylist. Hence, in my onDrawFrame, I'm drawing all the textures in each frame. Note that the bitmaps are coming from the gallery and not the resource folder. This is the code: package com.example.hmi_abp; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer;` import java.nio.ShortBuffer; import java.util.ArrayList; import javax.microedition.khronos.egl.EGLConfig;` import javax.microedition.khronos.opengles.GL10; import com.example.rendering.TextureHelper; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.opengl.GLES20; import android.opengl.GLSurfaceView.Renderer; import android.opengl.GLUtils; import android.opengl.Matrix; public class GLRenderer implements Renderer { // Our matrices private final float[] mtrxProjection = new float[16]; private final float[] mtrxView = new float[16]; private final float[] mtrxProjectionAndView = new float[16]; // Geometric variables public static float vertices[][]; public static short indices[][]; public FloatBuffer vertexBuffer[]; public ShortBuffer drawListBuffer[]; public static float uvs[][]; public FloatBuffer uvBuffer[]; private final Context mActivityContext; // Our screenresolution float mScreenWidth = 1280; float mScreenHeight = 768; // Misc Context mContext; int mProgram; int number; private ArrayList&lt;TextureProperties&gt; textures; private int[] mTextureDataHandle; public GLRenderer(Context c) { mActivityContext = c; } public void onPause() { /* Do stuff to pause the rende…
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37468886
has title: My application crashes because according to the garbage collector, only 4% heap memory is remaining... How do I prevent this?
score: 1
has comment: http://stackoverflow.com/comment/37469540
tagged with: opengl-es
has comment: http://stackoverflow.com/comment/37468544
favorite count: 0
accepted answer: http://stackoverflow.com/a/24256113
has comment: http://stackoverflow.com/comment/37468871
type: Question
tagged with: android

http://stackoverflow.com/a/24115757
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24115720
score: 4
has body: If you look at the docs for Collection#add, it becomes clear: true if this collection changed as a result of the call Since the queue always changes as a result of the call, Queue#add always has to return true. (And it has to have a return value, in order to implement the interface correctly.) Compare with Set, which also implements Collection, which will only add the element if it's not already in the set, and so might return false from add.
type: Answer
accepted answer of: http://stackoverflow.com/q/24115720
upvote count: 4

http://stackoverflow.com/comment/37215546
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24122038
has text: as I said, i tried wrapping that code in the try block but it couldn't return fileName as the fileName was in the try{}.

http://stackoverflow.com/q/24121580
favorite count: 0
type: Question
has title: Can PieChart from JavaFX be displayed as a doughnut?
has body: I'm using javafx.scene.chart.PieChart in my Java app which is built using Java7. Is there a way of making the PieChart hollow - turning it into a doughnut?
score: 4
has answer: http://stackoverflow.com/a/24134992
upvote count: 4
type: AnsweredQuestion
tagged with: java
tagged with: javafx
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24134992

http://stackoverflow.com/q/24186948
favorite count: 0
has comment: http://stackoverflow.com/comment/37336771
has comment: http://stackoverflow.com/comment/37337320
score: 1
has body: I've made some changes to the standalone.xml file so that our EJB file that worked fine under JBoss 6 will maybe work on 7. I've checked the log file and I see failed processes but nothing that relates to my EAR file, I think. I see in the log file that my file is found and a message that a dodeploy file should be created. Does this mean that the ear file was successfully started or not? I don't see any error or fail message after that.
tagged with: ear
tagged with: java
has title: How do I know if my EJB bean is started/running on JBOSS AS 7
tagged with: jboss
has comment: http://stackoverflow.com/comment/37336665
type: Question
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/37336830

http://stackoverflow.com/comment/37427713
type: Comment
comment on: http://stackoverflow.com/a/24234209
has text: var href = $(this).find('td').eq(2).text();
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37279751
has text: You really should be able to think about this one by yourself.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24156468

http://stackoverflow.com/comment/37191800
type: AnswerComment
comment on: http://stackoverflow.com/a/24109252
type: Comment
has text: Nope I dont see anything in the logcat tab and it stop here for the console [2014-06-09 02:23:17 - test1] ActivityManager: Warning: Activity not started, its current task has been brought to the front this message is in red and maybe I am putting the log at the wrong place ?
score: 0

http://stackoverflow.com/comment/37307780
comment on: http://stackoverflow.com/a/24169267
type: Comment
has text: which package should be imported for this "Arrays.copyOfRange(arr, 2, arr.length)" function?
type: AnswerComment
score: 0

http://stackoverflow.com/a/24264530
type: Answer
has body: Add this to the Employee class definition : CUSTOM(){} . Alternately, you could try giving a more explicit example with complete code , and that could eventually generate the error you are getting. You make several references to naam and name and interchange them in the Employee class def, which is really confusing
score: 0
answers question: http://stackoverflow.com/q/24264317

http://stackoverflow.com/a/24177643
has body: is this what you are looking for? import javax.swing.*; import java.awt.event.*; public class ExportMenuItem extends JMenuItem{ public ExportMenuItem(){ super("menu item"); addMouseListener(new MouseListener(){ @Override public void mouseClicked(MouseEvent mouseEvent){ if (!isEnabled()) { JOptionPane.showMessageDialog(null, "Upgrade me!"); }//end of if }//end of mouseClicked public void mouseExited(MouseEvent mouseEvent){} public void mouseEntered(MouseEvent mouseEvent){} public void mouseReleased(MouseEvent mouseEvent){} public void mousePressed(MouseEvent mouseEvent){} // And the remaining methods to implement... });//end of anonymous class }//end of constructor public static void main(String[] a){ JFrame f = new JFrame(); JMenu menu = new JMenu("menu"); JMenuBar menuBar = new JMenuBar(); f.setJMenuBar(menuBar); f.setSize(300, 300); f.setVisible(true); menuBar.add(menu); JMenuItem item = new ExportMenuItem(); menu.add(item); item.setEnabled(false); }//end of main }//end of class
type: Answer
answers question: http://stackoverflow.com/q/24177171
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/37193735
has text: Yes activity_home_page.xml
comment on: http://stackoverflow.com/q/24110231
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24132868
has body: Using some kind of List is a better choice, as it basically does what you want (can grow and shrink), in fact, ArrayList is just that, a dynamic array. You can hand roll your own if you can't use a List using System.arraycopy For example, this will grow or shrink an array to match the size you provide... public String[] updateArray(String[] src, int size) { String[] dest = new String[size]; if (size &gt; src.length) { System.arraycopy(src, 0, dest, 0, src.length); } else { System.arraycopy(src, 0, dest, 0, size); } return dest; } Again... List is easier...
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24132719
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24132719

http://stackoverflow.com/q/24153422
has body: I used to program with html and to make a alert all I had to do was make an alert("Hello World"); but with java it is much more advanced. I need help to make a button that when someone clicks it, it has an alert message on the screen. This is my code right now: MyOnClickListener onClickListener = new MyOnClickListener() { @Override public void onClick(View v) { Intent returnIntent = new Intent(); returnIntent.putExtra("deleteAtIndex",idx); setResult(RESULT_OK, returnIntent); finish(); } }; for (int i =0;i&lt;buttonList.size();i++) { buttonList.get(i).setText("Remove"); buttonList.get(i).setOnClickListener(onClickListener); }
answer count: 1
has answer: http://stackoverflow.com/a/24154142
favorite count: 0
has title: How do I make a OnClickListener in Java
type: Question
downvote count: 4
upvote count: 0
type: UnansweredQuestion
score: -4
tagged with: java

http://stackoverflow.com/comment/37248240
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24136871
type: AnswerComment
has text: Non need for apologies, you are welcome. You can take a look at my update.

http://stackoverflow.com/q/24161311
linked to: http://stackoverflow.com/q/14705858
favorite count: 0
type: Question
tagged with: hadoop
linked to: http://stackoverflow.com/q/11659976
has answer: http://stackoverflow.com/a/24182155
upvote count: 0
type: UnansweredQuestion
downvote count: 2
score: -2
tagged with: hive
linked to: http://stackoverflow.com/q/14607507
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
has title: Select query in json serde returns Null value
tagged with: mysql
has body: My log file contains a part of log in input_to_log.txt as below: {"agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36", "context":{"course_id":"edx/AN101/2014_T1","module":{"display_name":"Multiple Choice Questions"},"org_id":"edx","user_id":9999999}} My query in hive shell: ADD JAR /usr/lib/hive/apache-hive-0.13.0-bin/lib/hive-serde-0.13.0.jar; CREATE EXTERNAL TABLE edx_lg ( agent STRING,context STRUCT&lt;course_id:STRING,module:STRUCT&lt;display_name:STRING&gt;,org_id:STRING,user_id:INT&gt;)ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.JsonSerde' WITH SERDEPROPERTIES("agent"="$.agent","context"="$.context.course_id,$.context.module.display_name,$.context.org_id,$.context.user_id"); load data local inpath '/home/hduser/input_to_log.txt' into table edx_lg; select agent,context.course_id,context.module.display_name,context.org_id,context.user_id from edx_lg; My output: Total jobs = 1 Launching Job 1 out of 1 Number of reduce tasks is set to 0 since there's no reduce operator Starting Job = job_201406102148_0019, Tracking URL = http://x.x.x.x:50030/jobdetails.jsp?jobid=job_201406102148_0019 Kill Command = /usr/local/hadoop/libexec/../bin/hadoop job -kill job_201406102148_0019 Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0 2014-06-12 03:00:42,300 Stage-1 map = 0%, reduce = 0% 2014-06-12 03:00:44,311 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.72 sec 2014-06-12 03:00:46,324 Stage-1 map = 100%, reduce = 100%, Cumulative CPU 0.72 sec MapReduce Total cumulative CPU time: 720 msec Ended Job = job_201406102148_0019 MapReduce Jobs Launched: Job 0: Map: 1 Cumulative CPU: 0.72 sec HDFS Read: 467 HDFS Write: 30 SUCCESS Total MapReduce CPU Time Spent: 720 msec OK NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Time taken: 11.278 seconds, Fetched: 2 row(s) Select statement is returning Null values.What should i do to get the data in my table?

http://stackoverflow.com/comment/37423365
type: Comment
type: QuestionComment
has text: So the class is `Session`, I presume. Let me think on it...
comment on: http://stackoverflow.com/q/24224703
score: 0

http://stackoverflow.com/q/24110920
has comment: http://stackoverflow.com/comment/37195591
tagged with: java
tagged with: jpanel
score: -1
type: Question
linked to: http://stackoverflow.com/q/11712180
has answer: http://stackoverflow.com/a/74176771
accepted answer: http://stackoverflow.com/a/24129387
downvote count: 2
has answer: http://stackoverflow.com/a/24129387
linked to: http://stackoverflow.com/q/11337679
tagged with: jcomponent
upvote count: 1
tagged with: swing
has title: JComponent - cannot set Background/Border
favorite count: 0
possible better answer: http://stackoverflow.com/a/24111421
has body: I want to add a JComponent in my basic JFrame. My problem is that I cannot set background color or border for my component. JFrame JPanel drawPanel = new JPanel(new GridBagLayout()); drawPanel.add(new DrawingBoard()); JScrollPane scrollPane = new JScrollPane(drawPanel); this.add(scrollPane, BorderLayout.CENTER); this.setVisible(true); JComponent private class DrawingBoard extends JComponent { ... public DrawingBoard() { this.setPreferredSize(new Dimension(500, 500)); this.setBackground(Color.WHITE); //doesn't work this.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); //doesn't work this.setOpaque(true); ...
type: AnsweredQuestion
tagged with: colors
answer count: 3
has answer: http://stackoverflow.com/a/24111421

http://stackoverflow.com/a/24192098
has body: You break at the first occurance of 1 in whole array, which is probably not the expected result. Explanation of how your code works: loop until counter i is less than length of array (number of rows in array) loop until counter j is less than length of i-th row (number of columns or elements in array) check if element on i-th row and j-th column is 1, if true, increase variable count by one if count is greater than 1 (this means it has to be 2 or greater) set break2 and check to true, break if break2 is true (which is as count is > 2 and first loop breaks), break this loop too: this happens in 1st row of your example table end of loops, return check (which is true because 1st row contains 2 ones) The problem in your code is that you break when you find your first row that satisfies your condition, but you do not (necessarily) check all the rows in given array. I have corrected the code for you, hopefully it works (untested) public static boolean isVert(int[][] x) { //checks for more than one 1 in columns int count = 0; for (int i = 0; i &lt; x.length; i++) { int rowCount = 0; for (int j = 0; j &lt; x[i].length; j++) { if (x[i][j] == 1) { rowCount++; } if(rowCount &gt; 1) { count++; break; } } } // returns true if count of lines containing 1 equals length of array, // if not, returns false return count == x.length; }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37370209
has comment: http://stackoverflow.com/comment/37347447
accepted answer of: http://stackoverflow.com/q/24191959
score: 0
answers question: http://stackoverflow.com/q/24191959
has comment: http://stackoverflow.com/comment/37348158
type: Answer
has comment: http://stackoverflow.com/comment/37350406
has comment: http://stackoverflow.com/comment/37347071
has comment: http://stackoverflow.com/comment/37352176
has comment: http://stackoverflow.com/comment/37346724

http://stackoverflow.com/a/24151806
downvote count: 0
answers question: http://stackoverflow.com/q/24151732
upvote count: 1
has body: Variables in Java are never "references". static Enemies Slime = null; static Enemies Rat = null; static Enemies Goblin = null; // This evaluation of the variables (e.g. Slime) happens RIGHT NOW. static Enemies[] Enemies = {Slime, Rat, Goblin}; // Such that it is equivalent to the following // (Which cause an NPE on Enemies.monsters[i].Name in the loop) static Enemies[] Enemies = {null, null, null}; Either create the enemy objects before creating the enemies array, e.g. static Enemies createSlime (){ Enemies slime = new Enemies(); // .. return slime; } // i.e. static Enemies Slime = createSlime(); static Enemies[] Enemies = {Slime, ..}; // or even static Enemies[] Enemies = {createSlime(), ..}; Or only add the enemies to the array once they are created (using a List/ArrayList would be much better here), e.g. static Enemies[] Enemies = new Enemies[3]; static void setstats(){ //slime Enemies slime = new Enemies(); Enemies[0] = slime; // .. } There are many more quibbles that can be fixed, but this should be enough to move onto the next issue - have fun!
accepted answer of: http://stackoverflow.com/q/24151732
has comment: http://stackoverflow.com/comment/37271857
type: Answer
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/37668487
has text: @Raedwald ... I found no correct answers thats the reason. Havent I mentioned that in nthe last sentence
type: QuestionComment
comment on: http://stackoverflow.com/q/24260528
score: 0
type: Comment

date
tags question: http://stackoverflow.com/q/24263187
tags question: http://stackoverflow.com/q/24189290
type: Tag
tags question: http://stackoverflow.com/q/24152796
tags question: http://stackoverflow.com/q/24213324
tags question: http://stackoverflow.com/q/24233093
tags question: http://stackoverflow.com/q/24114155
tags question: http://stackoverflow.com/q/24236212
tags question: http://stackoverflow.com/q/24224696
tag name: date
tags question: http://stackoverflow.com/q/24259890
tags question: http://stackoverflow.com/q/24252213
tags question: http://stackoverflow.com/q/24266813
tags question: http://stackoverflow.com/q/24192299
tags question: http://stackoverflow.com/q/24234195
tags question: http://stackoverflow.com/q/24177111
tags question: http://stackoverflow.com/q/24177516
tags question: http://stackoverflow.com/q/24106852
tags question: http://stackoverflow.com/q/24130045
tags question: http://stackoverflow.com/q/24188756
tags question: http://stackoverflow.com/q/24243889
tags question: http://stackoverflow.com/q/24255793
tags question: http://stackoverflow.com/q/24136262
tags question: http://stackoverflow.com/q/24228903
tags question: http://stackoverflow.com/q/24177522
tags question: http://stackoverflow.com/q/24249346
tags question: http://stackoverflow.com/q/24240896
tags question: http://stackoverflow.com/q/24258060
tags question: http://stackoverflow.com/q/24167136
tags question: http://stackoverflow.com/q/24198153
tags question: http://stackoverflow.com/q/24143126
tags question: http://stackoverflow.com/q/24148429
tags question: http://stackoverflow.com/q/24132823
tags question: http://stackoverflow.com/q/24224272

http://stackoverflow.com/q/24194188
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37351447
has answer: http://stackoverflow.com/a/24195181
has comment: http://stackoverflow.com/comment/37350942
has answer: http://stackoverflow.com/a/24194865
has title: Java Interface\abstract class constriction
has answer: http://stackoverflow.com/a/24194525
type: Question
has body: Today, our team has the problem. There is a class AClass that implements the interface AInterface. To date, we need to introduce a new entity(BClass) that would use only part of the interface A. The first thing about which we think - split interface AInterface into 2 components (composition) The problem is that the logic AClass-&gt;AInterface - is a model prom pattern MVC. And we extremely do not want to cut it into several interfaces. We know that Java provides a mechanism for inheritance to extend a class or interface. But is there any way to constrict the implementation? Or maybe exist another way? Note : we doesn't want use UnsupportedMethodException. Our goal - clean API. Update : Next solution - not for us. GOAL :
tagged with: interface
has comment: http://stackoverflow.com/comment/37350925
tagged with: android
has comment: http://stackoverflow.com/comment/37350896
accepted answer: http://stackoverflow.com/a/24194220
answer count: 5
has answer: http://stackoverflow.com/a/24194220
possible better answer: http://stackoverflow.com/a/24194525
has comment: http://stackoverflow.com/comment/37350890
has answer: http://stackoverflow.com/a/24194644
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/37350796

timer
tag name: timer
tags question: http://stackoverflow.com/q/24250717
tags question: http://stackoverflow.com/q/24198216
tags question: http://stackoverflow.com/q/24237030
tags question: http://stackoverflow.com/q/24194638
tags question: http://stackoverflow.com/q/24110884
tags question: http://stackoverflow.com/q/24158678
tags question: http://stackoverflow.com/q/24156315
tags question: http://stackoverflow.com/q/24224366
tags question: http://stackoverflow.com/q/24107690
type: Tag
tags question: http://stackoverflow.com/q/24226661

http://stackoverflow.com/q/24142608
has answer: http://stackoverflow.com/a/24142914
downvote count: 2
has comment: http://stackoverflow.com/comment/37254086
upvote count: 1
has answer: http://stackoverflow.com/a/24143086
has answer: http://stackoverflow.com/a/24142841
has title: Write records into text file from database using java
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37254149
tagged with: sql-server
tagged with: resultset
has answer: http://stackoverflow.com/a/24142721
linked to: http://stackoverflow.com/q/2770321
tagged with: java
has comment: http://stackoverflow.com/comment/37253727
has comment: http://stackoverflow.com/comment/37253907
tagged with: mysql
answer count: 4
has body: I want to store database records to text file. for that I used the ResultSet, I have selected the whole table using sql select query and store the data in the ArrayList. But this code doesn't work properly. my database name is test and table is employee. what should I do? this is what I have tried. import java.io.*; import java.sql.*; import java.util.*; public class ResultSetWriteInToTextFile { public static void main(String[] args) { List data = new ArrayList(); try { Connection con = null; Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("Select * from employee"); while (rs.next()) { String id = rs.getString("emp_id"); String name = rs.getString("emp_name"); String address = rs.getString("emp_address"); String contactNo = rs.getString("contactNo"); data.add(id + " " + name + " " + address + " " + contactNo); } writeToFile(data, "Employee.txt"); rs.close(); st.close(); } catch (Exception e) { System.out.println(e); } } private static void writeToFile(java.util.List list, String path) { BufferedWriter out = null; try { File file = new File(path); out = new BufferedWriter(new FileWriter(file, true)); for (String s : list) { out.write(s); out.newLine(); } out.close(); } catch (IOException e) { } } }
score: -1
possible better answer: http://stackoverflow.com/a/24142721
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37253801
accepted answer: http://stackoverflow.com/a/24142914
tagged with: sql

http://stackoverflow.com/a/24227384
has body: Try to set totalSalary in SalesPeople constructor. So the code would be: public class SalesPeople { String personName; double annualSalary; double salesAmount; double percentComission; double totalSalary; public SalesPeople(String xPersonName, double xAnnualSalary, double xSalesAmount, double xPercentComission) { personName = xPersonName; annualSalary = xAnnualSalary; salesAmount = xSalesAmount; percentComission = xPercentComission; totalSalary = annualSalary + (salesAmount * percentComission); } ... } Before SalesPeople class initialization, the default value for annualSalary, salesAmount and percentComission are 0 (or null as undefined).If you define totalSalary outside constructor, totalSalary will always be 0. The alternative solution would be: define a setTotalSalary() method in your SalesPeople class, and call it after you create a SalsePeople instance. public void setTotalSalary(){ totalSalary = this.annualSalary + (this.salesAmount * this,percentComission); } And call setTotalSalary() you define a SalesPeople instance. SalesPeople salesPerson1 = new SalesPeople ("Bob", 30000, 5000, .09); salesPerson1.setTotalSalary();
type: Answer
answers question: http://stackoverflow.com/q/24226868
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/37231736
has text: "Because it is an unsolvable problem, the compiler doesn't try very hard to solve it". Well, it could try a little bit harder if computation cost was the only concern. But its hands are bound by the language spec. At most, it could issue some warnings (but not errors).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24130491
score: 4

fileinputstream
tags question: http://stackoverflow.com/q/24210435
tag name: fileinputstream
type: Tag

http://stackoverflow.com/comment/37505695
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24240083
has text: Before posting this, I was under the impression there would be a conflict between the Controller and the resource handlers, since both of them have the same request mapping resources/<something>. After testing I see there is no conflict. But generally what is the principle here, should it be moved outside the resource handler mapping, since its being handled by the controllers.

http://stackoverflow.com/comment/37209497
type: QuestionComment
has text: Sorry again, first day in this site
score: 0
comment on: http://stackoverflow.com/q/24118370
type: Comment

http://stackoverflow.com/comment/37214277
type: QuestionComment
comment on: http://stackoverflow.com/q/24118613
score: 0
has text: Try these: http://stackoverflow.com/questions/7688828/dex-loader-unable-to-execute-multiple-dex-files-define
type: Comment

http://stackoverflow.com/q/24176553
tagged with: java
has comment: http://stackoverflow.com/comment/37317838
tagged with: regex
type: Question
accepted answer: http://stackoverflow.com/a/24178373
has body: I have a regex to allow only numbers, numbers with dot and comma, if user inputs character that breaks the regex it should not be typed in: valueTextBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { String input = valueTextBox.getText(); if (!input.matches("\\d+(?:[.,]\\d+)?")) { } } }); For example, I typed 123 initially, then type a dot that should be ok, and I type a number to complete it like 123.123 should be ok, if I type a comma now that should not be ok.
has answer: http://stackoverflow.com/a/24178373
linked to: http://stackoverflow.com/q/1162240
answer count: 1
has title: Prevent characters to be typed in base on regex
tagged with: gwt
type: AnsweredQuestion
score: 0

game-development
type: Tag
tags question: http://stackoverflow.com/q/24176325
tag name: game-development

http://stackoverflow.com/comment/37336158
has text: Wow, thanks for all the help. Specifically it needs to check if items in an array list meet these scenarios (they all do) and then print just the capital letters that match the scenario. Is that more clear or confusing?
comment on: http://stackoverflow.com/q/24186561
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37362869
has text: If you're using the Eclipse Spring support, the Spring Beans editor will already do that for you.
score: 3
comment on: http://stackoverflow.com/q/24200346
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24181405
answers question: http://stackoverflow.com/q/24181194
has comment: http://stackoverflow.com/comment/37326000
type: Answer
has comment: http://stackoverflow.com/comment/37325958
has comment: http://stackoverflow.com/comment/37326216
has body: B, check it by code below int[][] a = new int[][]{{1,1,1,1,1},{2,2,2,2,2},{3,3,3,3,3},{4,4,4,4,4}}; for(int i=0;i&lt;4;i++){ for(int j=0;j&lt;5;j++){ System.out.println(a[i][j]); } }
score: 0

http://stackoverflow.com/comment/37395434
type: Comment
type: QuestionComment
has text: Sorry, I was being impatient. Just realized "mm" is minutes and "MM" is month
comment on: http://stackoverflow.com/q/24217408
score: 0

http://stackoverflow.com/comment/37290727
comment on: http://stackoverflow.com/a/24161519
score: 0
type: Comment
has text: Thanks but what if I had multiple elements? for example I have username and password and userbutton. I should write something like: if(!driver.findElements(password).isEmpty()) then driver.findElement(By.id("password")).sendKeys("123"); ? and the same for username ?
type: AnswerComment

http://stackoverflow.com/q/24228520
has body: I am using the JarSplice tool to create a runnable jar file. However, as soon as I add lwjgl.jar to my required jar files, it immediately fails to create the jar, saying "Duplicate entry". Here is a screenshot of the error: http://gyazo.com/2aac58aa15ba19ff7c61aeda548f43c2 If I remove lwjgl.jar it obviously builds the jar file, but cannot run because I require LWJGL.jar And here is a screenshot of the added jar files: http://gyazo.com/78a88443336bfb530ed71bd6418e9be1 So, how can I fix this "Duplicate entry" issue so I can create my fat jar file? Thanks!
answer count: 0
score: 1
upvote count: 1
tagged with: java
linked to: http://stackoverflow.com/q/4378074
favorite count: 0
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47669910
downvote count: 0
tagged with: jar
has title: JarSplice not working ("Duplicate entry")

http://stackoverflow.com/comment/37268081
type: Comment
comment on: http://stackoverflow.com/q/24149957
has text: The whole point of polymorphism is that you **don't** need to know which subclass you have. You use method overrides to provide the distinguishing behaviour.
type: QuestionComment
score: 8

http://stackoverflow.com/a/30292832
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24210963
answers question: http://stackoverflow.com/q/24210963
type: Answer
score: 4
upvote count: 4
has body: Here is my final solution (in PHP), creates a bin for every square 100m : function get_static_pointer_table_id($lat, $lng) { $earth_circumference = 40000; // km $lat_bin = round($lat / 0.0009); $lng_length = $earth_circumference * cos(deg2rad($lat)); $number_of_bins_on_lng = $lng_length * 10; $lng_bin = round($number_of_bins_on_lng * $lng / 360); //the 'bin' unique identifier return $lat_bin . "_" . $lng_bin; }
downvote count: 0

http://stackoverflow.com/comment/37222939
type: Comment
type: QuestionComment
has text: You should use Object pool check this http://en.wikipedia.org/wiki/Object_pool_pattern
comment on: http://stackoverflow.com/q/24125894
score: 2

http://stackoverflow.com/comment/37411189
type: QuestionComment
has text: *"like in a real battleship game."* Like [this one](http://media-cache-ec0.pinimg.com/originals/2d/e4/b6/2de4b64221525a001a8daf905a58f99b.jpg) (rows A-H down left, columns 1-8 across the bottom) or [this one](http://d33y93cfm0wb4z.cloudfront.net/ACTIVITIES_JO/Images%20resized/battleship-game-main.jpg) (rows A-J down left, rows 1-10 across top)? We've pegged it down to a 10x10 'battle zone' but where and in what order are the rows (top/bottom) and column labels? You really should be able to make a good start from the tips I've offered. The Chess GUI does pretty much the same thing.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24225504

http://stackoverflow.com/a/24194936
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24194618
downvote count: 0
upvote count: 2
has body: You have a String in Java. You convert that to a Date in Java. So far, presumably, so good. Your procedure, however, accepts a varchar2. So at some point the Date that you constructed is being explicitly or implicitly cast to a varchar2. You don't say where that is happening (in Java or in PL/SQL) or whether it is being done explicitly or implicitly. If the conversion is being done implicitly in PL/SQL, then that would use your session's NLS_DATE_FORMAT which may be different for different sessions in the same database. In a default US-based install of the database and of the client, that would be DD-MON-RR. Within your procedure, you then call to_date on the string that was passed in using an explicit format mask. If the string that is passed in is not in the format mm/dd/yyyy hh:mi am you'll either get an error or, worse, you'll get an incorrect result (this is the old question of whether the string 01/02/03 represents January 2, 2003 or February 1, 2003 or February 3, 1901). If we guess that the Date in Java is being implicitly cast to a varchar2 using your session's default NLS_DATE_FORMAT of DD-MON-YYYY, then we can see why your to_date conversion would fail. If you have a Date of May 30, 2014, for example, that would be implicitly cast to the string "30-MAY-14". If you then try to cast that back to a date using to_date and a format mask of mm/dd/yyyy hh:mi am, Oracle would try to convert the 30 from your string to a month and raise an error since there is no 30th month. Realistically, you should be using the proper data type throughout and you should be avoiding implicit casts like the plague. If you declare your procedure to take a date parameter, then you can pass a Date from your Java code and omit the to_date call in your procedure. The Date will be passed from Java to PL/SQL without needing to be converted to a varchar2 and then converted back to a date and you won't have to worry about making sure that all your format masks align throughout your code bas…

http://stackoverflow.com/q/24106486
has title: Why does the Java compiler add visibility bridge methods for public methods defined in package-private super types?
tagged with: javac
tagged with: java-bridge-method
has answer: http://stackoverflow.com/a/24106550
accepted answer: http://stackoverflow.com/a/24106550
type: AnsweredQuestion
downvote count: 0
has body: I am wondering why the Java compiler would add a bridge method for the foo method here: public class Outer { class SuperClass { public void foo() { } } public class SubClass extends SuperClass { } } The foo method is compiled to be public in the SuperClass type. Nevertheless, the SubClass method redefines the method as a bridge to the very same method. I wonder why this bridge is necessary.
tagged with: java
answer count: 1
favorite count: 0
type: Question
score: 5
upvote count: 5

http://stackoverflow.com/comment/37342415
comment on: http://stackoverflow.com/a/24189364
score: 0
type: Comment
has text: but i can't change `AnchorPane.setLeftAnchor(content1, 0.0);` to ` AnchorPane.setLeftAnchor(content1, 157.0);`
type: AnswerComment

http://stackoverflow.com/a/24267156
has body: In your JanusUI add a method setOs(String OS) after initialize a new instance of your JanusUI, call the setter method e.g. public void setOs(String OS) { this.jLabel4.setText(OS); } put this into your Janus constructor public Janus(){ JanusUI gui = new JanusUI(); gui.setOs(OS); gui.setVisible(true); detectOS(); } this should work.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24266770
downvote count: 0

http://stackoverflow.com/a/24174105
has body: You need to randomize a flip each time you call flip(), not when CoinToss is constructed: public class CoinToss { private enum Coin{Heads, Tails}; Random randomNum = new Random(); private int result; private int heads = 0; private int tails = 1; Coin coinFlip; public void flip(){ result = randomNum.nextInt(2) if(result == 0){ coinFlip = Coin.Heads; System.out.println("You flipped Heads!"); }else{ coinFlip = Coin.Tails; System.out.println("You flipped Tails!"); } }
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24174078
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37314045

http://stackoverflow.com/q/24125336
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24125538
has body: I'm trying to understand how to implement collision detection between multiple object. My project detects the collision between the objects but it crashes immediately after. This is my main class with the JFrame and Main Loop: public class Window { public static void main(String[] args){ GamePanel gamepanel = new GamePanel(); JFrame f = new JFrame("Multiple Collision Detection"); f.setSize(400, 400); f.add(gamepanel); f.setVisible(true); f.setResizable(false); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLocationRelativeTo(null); while(true){ gamepanel.repaint(); gamepanel.update(); try{ Thread.sleep(10); }catch(Exception e){ System.out.println("Main Loop Error"); } } } } Then i have two classes, one for the player and one for the enemy: PLAYER: public class Player { int x = 175, y = 175, w = 50, h = 50, dx = 0, dy = 0; Rectangle rect; public void paint(Graphics g) { rect = new Rectangle(x, y, w, h); g.setColor(Color.black); g.fillRect(rect.x, rect.y, rect.width, rect.height); g.setColor(Color.CYAN); g.drawRect(x, y, w, h); } public void setDx(int dx) { this.dx = dx; } public void setDy(int dy) { this.dy = dy; } public void move() { x += dx; y += dy; } public void update() { move(); } } ENEMY: public class Enemy { int x, y, w = 35, h = 35; Rectangle rect; public Enemy(int x, int y) { this.x = x; this.y = y; } public void paint(Graphics g) { rect = new Rectangle(x, y, w, h); g.setColor(Color.red); g.fillRect(rect.x, rect.y, rect.width, rect.height); } public void update() { } } I've the EnemyManager class that draws more than one enemy (in this case 3) through a List: public class EnemyManager { Player player = new Player(); Rectangle playerrect; Rectangle enemyrect; List&lt;Enemy&gt; enemies = new ArrayList&lt;Enemy&gt;(); public void paint(Graphics g) { enemies.add(new Enemy(20, 20)); enemies.add(new Enemy(320, 20)); enemies.add(new Enemy(20, 320)); for (Enemy e : enemies) { e.paint(g); } } public void update() { } } Finally i've the GamePanel class that …
upvote count: 0
tagged with: multithreading
tagged with: swing
has title: Game collision detection between many objects?
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/24126549
accepted answer: http://stackoverflow.com/a/24126621
tagged with: java
has answer: http://stackoverflow.com/a/24126621
score: -1
tagged with: collision-detection
possible better answer: http://stackoverflow.com/a/24125538
downvote count: 1

http://stackoverflow.com/q/24146177
tagged with: java
tagged with: thrift
type: Question
answer count: 0
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37262738
upvote count: 1
favorite count: 0
has title: Java Thrift AsyncIface / NonBlocking Server Questions
tagged with: nonblocking
has body: I am prototyping a thrift server and am having trouble getting a non-blocking server using the AsyncIface to work. Here are my questions: It seems TNonblockingServer only works when the client uses the TFramedTransport - are there any workarounds for this? I can't make any assumptions about the client, so this might be a deal breaker. Since you need to give a TNonblockingServer a TNonblockingServerSocket, is there any way to integrate this with SSL (TSSLTransportFactory doesn't return one of these)? Is it possible to integrate TNonblockingServer with TSaslTransportFactory? Initial tests seem unpromising. Finally, is it possible to the AsyncIface without using TNonblockingServer? Thanks in advance. Happy to provide more details or context for any of the questions.
has comment: http://stackoverflow.com/comment/37271321
score: 1

http://stackoverflow.com/q/24239198
tagged with: java
has answer: http://stackoverflow.com/a/24239481
favorite count: 0
possible better answer: http://stackoverflow.com/a/24239444
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24239444
has answer: http://stackoverflow.com/a/24239321
accepted answer: http://stackoverflow.com/a/24239321
tagged with: design-patterns
type: AnsweredQuestion
has title: Pattern to implement different storage strategies
has body: I am going to implement Data Mapper pattern to store data in different storages/databases. What is the best OOP pattern to implement this concept? For example, I have User model class public class User { private int id; private String name; private String surname; /* getters, setters and model-level business logic */ } and appropriate Data Mapper class public class UserMapper { public User findById(int id) { // perform query to MySQL, Redis or another DB } /* other methods */ } Is it a good idea to use Strategy pattern by creating multiple storage strategy classes and then inject them into DataMapper class? public class UserMySQLStorageStrategy extends UserStorageStrategy { public User findById(int id) { // perform query to MySQL } } public class UserRedisStorageStrategy extends UserStorageStrategy { public User findById(int id) { // perform query to Redis } } public class UserMapper { protected UserStorageStrategy _storageStrategy; public UserMapper(UserStorageStrategy storageStrategy) { this._storageStrategy = storageStrategy; } public User findById(int id) { return this._storageStrategy.findById(id); } /* other methods */ }
answer count: 3
has comment: http://stackoverflow.com/comment/37436743
has comment: http://stackoverflow.com/comment/37436843
upvote count: 1
score: 1

http://stackoverflow.com/comment/37202461
type: AnswerComment
score: 1
type: Comment
has text: It might be worth explaining to op why they're facing the issue.
comment on: http://stackoverflow.com/a/24114904

http://stackoverflow.com/comment/37259654
comment on: http://stackoverflow.com/q/24145544
score: 0
has text: Much easier: Use Xmingw and PuTTY.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24126267
answers question: http://stackoverflow.com/q/24126126
score: 0
type: Answer
has body: There is no empty constructor in Person class, so you have to create that and it should work perfectly. Don't forget that super() is called by default unless explicitly called.

http://stackoverflow.com/a/24180652
score: 0
has body: In that case I'd consider having your getUserById(String id) return null, rather than an EntityNotException if no user can be found - Exceptions are to be used for exceptional circumstances, such as a failure beyond your control (Network connections vanished, no more memory is available, etc.). Your code could look something like the following: public Principal getPrincipal(String id) { Principal principal = getUserById(id); if (principal == null) { //Try by group ID instead principal = getGroup(id); } return principal; } Make sure you're certain of the return types of your methods - from their names it doesn't sound like getUserById(String id) and getGroup(String id) definitely return a Principal object - the first sounds like it could return any type of User and the second a Group, whatever that is. Alternatively, given the caller of this method presumably knows whether they have a userId or a groupId, have you considered separate methods getPrincipalByUserId(String userId) and getPrincipalByGroupId(String groupId)?
type: Answer
answers question: http://stackoverflow.com/q/24180475

http://stackoverflow.com/comment/37358292
score: 0
has text: Well the problem is getting the attribute from the context. And no i'm not using Kerberos, afaik it's a homegrown SSO implementation.
comment on: http://stackoverflow.com/q/24182992
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24126126
answer count: 2
tagged with: testing
has comment: http://stackoverflow.com/comment/37223387
tagged with: constructor
has body: Question: Implement a super class Person. Make two classes, Student and Instructor that inherit from Person. A person has a name and a year of birth. A student has major and the instructor has a salary. Write the class declarations, the constructors, and the methods to String for all classes. Write a test program that tests these classes and methods. This may not be a complicated one but i'm a beginner in java. Please help me. I'm getting the following error at the both the constructors 'student()' and 'instructor()'. "constructor Person in class Person cannot be applied to given types; required: String,int found: no arguments reason: actual and formal argument lists differ in length." Here's my code: package One; class Person{ String name; int yob; Person(String s, int d){ name = s; yob = d; } @Override public String toString(){ return "Name: "+name+"\n Year of Birth: "+yob; } } class Student extends Person{ String major; Student(String s){ major = s; } @Override public String toString(){ return "The student did his majors in "+major; } } class Instructor extends Person{ int salary; Instructor(int a){ salary = a; } @Override public String toString(){ return String.format("The salary is ",salary); } } public class Test { public static void main(String[] args) { Person p = new Person("Stephen", 1991); System.out.println(p); } } Thanks in advance.
has title: Class Declarations, Constructors and toString methods for all the classes
tagged with: class
tagged with: tostring
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24126271
possible better answer: http://stackoverflow.com/a/24126267
has answer: http://stackoverflow.com/a/24126271
tagged with: java
has answer: http://stackoverflow.com/a/24126267
type: Question

http://stackoverflow.com/a/24160208
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37289426
has body: Do you intend to let the device go to sleep or not? You can acquire a wakelock that wakes the screen on. PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "myTAG"); wl.acquire(LOCK_SCREEN_TIME_MINUTES * 60 * 1000); That doesn't work for you? After that you can show the notification, but I'm not sure of the effect, will it hold the vibrations. Above one works on GalaxyTab 2 with android 4.2.2 and HTC Hero with android 2.3.4.
has comment: http://stackoverflow.com/comment/37377956
upvote count: 1
answers question: http://stackoverflow.com/q/24159327
downvote count: 0

http://stackoverflow.com/comment/37481606
score: 0
has text: The Spring version used by Spring data Mongo [seems to be](http://repo.spring.io/milestone/org/springframework/data/spring-data-document-parent/1.0.0.M4/spring-data-document-parent-1.0.0.M4.pom) 3.0.6. Can you post the complete stack trace?
type: Comment
comment on: http://stackoverflow.com/q/24262575
type: QuestionComment

http://stackoverflow.com/a/24242374
answers question: http://stackoverflow.com/q/24241439
has comment: http://stackoverflow.com/comment/37449138
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24241439
has body: Following is a pseudo code to do count of triple Hashmap&lt;string,int&gt; colors int max; string max_color; for(int i=0;i&lt;height;i++) { for(int j=0;j&lt;width;j++) { int count = 0; string red = pixel[i][j].red.to_string; string green = pixel[i][j].green.to_string; string blue = pixel[i][j].blue.to_string; string key = red + "," + green + "," + blue; if(hashmap contains pixel[i][j]) { count = hashmap.get(key) count++; hashmap.write(key,count); } else { count = 1; hashmap.insert(key,count); } if(count &gt; max) { max = count; max_color = key; } } } res = max_color.split(',')

http://stackoverflow.com/comment/37366735
type: Comment
comment on: http://stackoverflow.com/a/24200563
score: 2
has text: This makes sense, the query method should reflect what it will do with the scope.
type: AnswerComment

http://stackoverflow.com/q/24265474
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24279420
upvote count: 1
tagged with: java
tagged with: swing
tagged with: eclipse
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24265976
possible better answer: http://stackoverflow.com/a/24265976
accepted answer: http://stackoverflow.com/a/24279420
has body: I'm using Mac for the first time and I'm assuming this is a OS specific error, because the same code worked well on Ubuntu. I'm trying to compile this code and Eclipse is showing me a lot of errors like this one: Access restriction: The method invokeLater(Runnable) from the type SwingUtilities is not accessible due to restriction on required library /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/rt.jar This is the first time I facing something like this and I don't know how to continue. I'm using Java 8.
has comment: http://stackoverflow.com/comment/37492047
type: AnsweredQuestion
answer count: 2
tagged with: compiler-errors
has title: Getting "Access restriction error" when using Swing utilities in Eclipse

http://stackoverflow.com/q/24110034
tagged with: keylistener
tagged with: applet
downvote count: 1
favorite count: 0
type: Question
has title: Trying to move object with KeyListener in simple game
answer count: 2
has comment: http://stackoverflow.com/comment/37194358
accepted answer: http://stackoverflow.com/a/24110940
possible better answer: http://stackoverflow.com/a/24110896
upvote count: 1
has body: I am trying to create a simple game similar to brick-breaker. I was able to figure out some of the basic concepts of the game (moving the ball, collision detection, etc) I am trying to move the platform object in an x-direction by using the left and right arrow keys. The if conditions for the keyPressed method work, after testing with some println statements but I am unable to move the platform object using keyListener. Is is something to do with the moveLeft , moveRight methods in the Platform class, because I tried d to changing the values of the dx, so I could maybe see some movement in the platform. Here are the 3 classes. import java.applet.*; import java.awt.*; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; public class tennisGame extends Applet implements Runnable, KeyListener{ Ball b; Platform p; public void init() { setSize(640, 480); addKeyListener(this); } public void start () { b= new Ball(); p= new Platform(); Thread thread = new Thread (this); thread.start (); } public void paint(Graphics g) { b.paint(g); p.paint(g); } public void run(){ while (true){ b.update(this); p.update(this,b); repaint(); try { Thread.sleep(20); } catch (InterruptedException e){ //e.printStackTrace(); } } } @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == e.VK_RIGHT){ System.out.println("Pressed RIGHT"); p.moveRight(); } if(e.getKeyCode() == e.VK_LEFT){ System.out.println("Pressed LEFT"); p.moveLeft(); } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } } import java.awt.*; public class Ball{ private int x=0; private int y=0; private double dx=10; private double dy=10; private int width=20; private int height=20; private int radius=10; public Ball() { } public void update(tennisGame tg){ if ( x + dx &gt; tg.getWidth()-radius-1){ x = tg.getWidth()-radius-1; dx= -dx; } else if ( x + dx &lt; 0 + radius ){ x= 0 + radius; dx= -dx; } else{ x+=dx; } if ( y + dy&gt; tg.getHeight()-radius-1){ y = tg.g…
tagged with: awt
has answer: http://stackoverflow.com/a/24110940
has comment: http://stackoverflow.com/comment/37194144
has answer: http://stackoverflow.com/a/24110896
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37194426

http://stackoverflow.com/a/24232379
has comment: http://stackoverflow.com/comment/37423573
has comment: http://stackoverflow.com/comment/37423864
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37423981
has body: Just use import within the root context definiton (dispatcherContext.xml in yr case) file : <import resource="classpath:securityConfig.xml"/> But you can supply mutiple by putting a space btween the file names : contextConfigLocation dispatcherContext.xml securityConfig.xml
has comment: http://stackoverflow.com/comment/37430413
accepted answer of: http://stackoverflow.com/q/24232298
has comment: http://stackoverflow.com/comment/37423689
has comment: http://stackoverflow.com/comment/37423704
type: Answer
has comment: http://stackoverflow.com/comment/37424299
answers question: http://stackoverflow.com/q/24232298
has comment: http://stackoverflow.com/comment/37423751
has comment: http://stackoverflow.com/comment/37423674
score: 1

http://stackoverflow.com/a/24260821
score: 1
upvote count: 1
downvote count: 0
has body: Use uniqueResult() which returns object. And if there is multiple row matches the sql query then it throws NonUniqueResultException. There is no option for uniqueResult()[0] or uniqueResult().get(0). If your query returns multiple query you can use list() If you are not sure how many rows are returned by the query but want a single value from one of them. Use list().get(0) or list()[0] see here
type: Answer
answers question: http://stackoverflow.com/q/24254061

rss
type: Tag
tags question: http://stackoverflow.com/q/24175415
tags question: http://stackoverflow.com/q/24202262
tag name: rss

http://stackoverflow.com/q/24157817
score: 169
has answer: http://stackoverflow.com/a/53092208
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24166163
has comment: http://stackoverflow.com/comment/37282431
tagged with: serialization
has answer: http://stackoverflow.com/a/24173645
tagged with: enums
has answer: http://stackoverflow.com/a/24166163
has answer: http://stackoverflow.com/a/61737600
has comment: http://stackoverflow.com/comment/37283544
has answer: http://stackoverflow.com/a/29515266
has answer: http://stackoverflow.com/a/57793147
tagged with: jackson
has answer: http://stackoverflow.com/a/78651197
has title: Jackson databind enum case insensitive
upvote count: 169
type: AnsweredQuestion
answer count: 14
has answer: http://stackoverflow.com/a/32802851
accepted answer: http://stackoverflow.com/a/44217670
has comment: http://stackoverflow.com/comment/37282809
has answer: http://stackoverflow.com/a/60251159
has answer: http://stackoverflow.com/a/26036465
has answer: http://stackoverflow.com/a/44217670
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: How can I deserialize JSON string that contains enum values that are case insensitive? (using Jackson Databind) The JSON string: [{"url": "foo", "type": "json"}] and my Java POJO: public static class Endpoint { public enum DataType { JSON, HTML } public String url; public DataType type; public Endpoint() { } } in this case,deserializing the JSON with "type":"json" would fail where as "type":"JSON" would work. But I want "json" to work as well for naming convention reasons. Serializing the POJO also results in upper case "type":"JSON" I thought of using @JsonCreator and @JsonGetter: @JsonCreator private Endpoint(@JsonProperty("name") String url, @JsonProperty("type") String type) { this.url = url; this.type = DataType.valueOf(type.toUpperCase()); } //.... @JsonGetter private String getType() { return type.name().toLowerCase(); } And it worked. But I was wondering whether there's a better solutuon because this looks like a hack to me. I can also write a custom deserializer but I got many different POJOs that use enums and it would be hard to maintain. Can anyone suggest a better way to serialize and deserialize enums with proper naming convention? I don't want my enums in java to be lowercase! Here is some test code that I used: String data = "[{\"url\":\"foo\", \"type\":\"json\"}]"; Endpoint[] arr = new ObjectMapper().readValue(data, Endpoint[].class); System.out.println("POJO[]-&gt;" + Arrays.toString(arr)); System.out.println("JSON -&gt;" + new ObjectMapper().writeValueAsString(arr));
has answer: http://stackoverflow.com/a/36862870
downvote count: 0
has answer: http://stackoverflow.com/a/54692478
has answer: http://stackoverflow.com/a/37667341

http://stackoverflow.com/q/24173889
has title: Closest Point on a Sphere to Another Point
type: AnsweredQuestion
score: 2
tagged with: geometry
upvote count: 2
accepted answer: http://stackoverflow.com/a/24174080
has comment: http://stackoverflow.com/comment/37316889
tagged with: implementation
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24174080
has body: Given a sphere S(c,r), c being the center point (x,y,z) and r being the radius, there is a point p(x', y', z') which is either inside or outside S. I want to find the point q such that q is on S and |pq| is minimum. Where |pq| denotes the Euclidean distance between p and q. I tried to create a ray that starts from c and passes through p and find the intersection of the ray with the sphere. However, since I'm implementing a Java code for this problem, I could not get over it with step by step. Could you please help me?
favorite count: 0
type: Question
tagged with: java

http://stackoverflow.com/comment/37281171
type: Comment
comment on: http://stackoverflow.com/q/24152856
type: QuestionComment
has text: Spring MVC is extremely powerful, but there is absolutely no way that you will get things done correctly without checking out multiple tutorial **before** starting experimenting around
score: 0

http://stackoverflow.com/q/24159136
tagged with: spring-mvc
score: 2
has comment: http://stackoverflow.com/comment/37290536
has body: Just started a default Spring MVC project, and I'm not able to get the POST requests handler to work. This is my controller: package com.myapp.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.myapp.domain.Response; @Controller public class MyAppController { @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseBody public Response query() { return new Response(); } } Response is a simple POJO like this: package com.myapp.domain; public class Response { private String text; private String ref; public Response() {} public String getText() { return text; } public void setText(String text) { this.text = text; } public String getRef() { return ref; } public void setRef(String ref) { this.ref = ref; } } servlet-context.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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"&gt; &lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt; &lt;!-- Enables the Spring MVC @Controller programming model --&gt; &lt;annotation-driven /&gt; &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --&gt; &lt;resources mapping="/resources/**" location="/resources/" /&gt; &lt;!-- Resolves vie…
upvote count: 2
has answer: http://stackoverflow.com/a/24666591
has comment: http://stackoverflow.com/comment/37284624
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37293070
downvote count: 0
has comment: http://stackoverflow.com/comment/37284492
has comment: http://stackoverflow.com/comment/37285659
tagged with: tomcat
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37284532
has comment: http://stackoverflow.com/comment/37284829
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37284817
has comment: http://stackoverflow.com/comment/37285009
has comment: http://stackoverflow.com/comment/37288032
tagged with: maven
tagged with: spring
has title: Spring MVC: HTTP 405 - Request method 'GET' not supported when making POST request

http://stackoverflow.com/comment/37265965
comment on: http://stackoverflow.com/a/24142028
score: 0
type: Comment
type: AnswerComment
has text: Hi @user3726164 if this or any answer has solved your question please consider [accepting it](http://meta.stackexchange.com/q/5234/179419) by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this.

http://stackoverflow.com/q/24158385
has comment: http://stackoverflow.com/comment/37285037
has comment: http://stackoverflow.com/comment/37285981
has answer: http://stackoverflow.com/a/24158671
has comment: http://stackoverflow.com/comment/37285893
has body: I want to import all property files, ending on .properties that are contained in the src/main/resource locations of ALL jar-dependencies my project has. I wrote a JUnit test, where my context.xml is located in the src/test/resources folder. I specified the property-placeholder using wildcards, but it doesn't work. &lt;context:property-placeholder location="classpath*:*.properties"/&gt; May be I am to stupid, but I could not find a solution to my problem on the net. Does anyone here know what is the correct syntax? EDIT: The root project, has maven dependencies, that are resolved from my workspace: And i want to import the module.properties files of the dependent projects:
score: 6
has comment: http://stackoverflow.com/comment/37285133
has comment: http://stackoverflow.com/comment/37283639
tagged with: spring
has comment: http://stackoverflow.com/comment/37283572
has title: Importing Spring properties files from jar file on classpath
upvote count: 6
accepted answer: http://stackoverflow.com/a/24165565
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37283315
has answer: http://stackoverflow.com/a/24165565
answer count: 3
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37285352
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24158671
has answer: http://stackoverflow.com/a/24158567

http://stackoverflow.com/comment/37413462
comment on: http://stackoverflow.com/a/24221533
has text: @Salman Perhaps your certificate is corrupt, see http://stackoverflow.com/questions/7399154/pkcs12-derinputstream-getlength-exception. Or it is not of format JKS, see http://stackoverflow.com/questions/23126282/java-apns-certificate-error-with-derinputstream-getlength-lengthtag-109-too. Or you can't use strong encryption due to american export regulations in encryption technologies, see http://stackoverflow.com/questions/132498/webservices-client-and-ssl. Or something else...
score: 0
type: AnswerComment
type: Comment

system-calls
type: Tag
tag name: system-calls
tags question: http://stackoverflow.com/q/24135354

http://stackoverflow.com/comment/37512735
comment on: http://stackoverflow.com/a/24273382
score: 0
has text: I dont see any EJB in the above example. I am using the new JEE7 style with CDI and @Transactional annotation.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37468140
type: AnswerComment
comment on: http://stackoverflow.com/a/24255359
type: Comment
has text: XMLRoutine xmlr = XMLRoutine.getInstance(); it'll create a singleton object for you. Then try xmlr.signXml(.....) with args you can go ahead with your code
score: 0

http://stackoverflow.com/q/24179400
tagged with: adapter
has body: I'm having an issue with following error: E/AndroidRuntime(658): FATAL EXCEPTION: main E/AndroidRuntime(658): java.lang.NullPointerException E/AndroidRuntime(658): at android.view.LayoutInflater.from(LayoutInflater.java:210) E/AndroidRuntime(658): at com.gauss.sportsapp.messages.RecievedRequestsAdapter.(RecievedRequestsAdapter.java:26) E/AndroidRuntime(658): at com.gauss.sportsapp.messages.MessagesList.setRecievedRequests(MessagesList.java:157) E/AndroidRuntime(658): at com.gauss.sportsapp.messages.MessagesList.onEventsAvailable(MessagesList.java:181) E/AndroidRuntime(658): at com.gauss.sportsapp.eventrequests.GetEventRequestsTask.onPostExecute(GetEventRequestsTask.java:74) E/AndroidRuntime(658): at com.gauss.sportsapp.eventrequests.GetEventRequestsTask.onPostExecute(GetEventRequestsTask.java:1) E/AndroidRuntime(658): at android.os.AsyncTask.finish(AsyncTask.java:602) E/AndroidRuntime(658): at android.os.AsyncTask.access$600(AsyncTask.java:156) E/AndroidRuntime(658): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615) E/AndroidRuntime(658): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(658): at android.os.Looper.loop(Looper.java:154) E/AndroidRuntime(658): at android.app.ActivityThread.main(ActivityThread.java:4945) E/AndroidRuntime(658): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(658): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(658): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) E/AndroidRuntime(658): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) E/AndroidRuntime(658): at dalvik.system.NativeStart.main(Native Method) The error only occurs after I exit my application via home button and let it sit in the background for a while. If I just exit the app and instantly start it again, there's no error. Sometimes it even works after I let it sit for a while, but more often than not, it returns a null pointer for con…
type: Question
has answer: http://stackoverflow.com/a/24179743
tagged with: android-asynctask
tagged with: android-context
tagged with: android
has title: Context null after resuming application
score: 0
type: UnansweredQuestion
tagged with: java
answer count: 1

http://stackoverflow.com/comment/37367472
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24201979
has text: @kkmishra, thanks! Do you have an example inserting data in batch?

http://stackoverflow.com/comment/37415298
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24227784
has text: i know the answer is no, but , in this case, what about we define a buffer which uses the max possibility space for buffering, instead of small 1KB buffer?

http://stackoverflow.com/a/24182261
upvote count: 2
has body: “java.lang.OutOfMemoryError: Java heap space” error is be triggered when you try to add more data into the heap space area in memory, but the size of this data is larger than the JVM can accommodate in the Java heap space. Java applications are allowed to use only limited amount of memory. This limit is specified during the application startup. To make things more complex, the Java memory is separated to two different regions. These regions are called heap space and permgen Size of those regions is set during the JVM launch by specifying JVM parameters such as -Xmx and -XX:MaxPermSize. If you do not explicitly set the sizes, platform-specific defaults will be used. In many cases, the easiest way to get rid of the java.lang.OutOfMemoryError: Java heap space error if you just increase the heap space, specified in the -Xmx parameter, similar to the following java -Xmx1024m com.yourcompany.YourClass
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24152533

http://stackoverflow.com/comment/70209495
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24234998
has text: Like this answer, and want to add, that if you would need to have structure interface, like an abstract class, than you can use the same principle as @ANisus wrote, but add getters methods. So that you can call for structure params like ```Model.getName``` where ```Model``` wouldbean exact structure that resolves some interface you have created.

http://stackoverflow.com/comment/37329005
comment on: http://stackoverflow.com/q/24182150
has text: Replace `echo $voornaam;` into `print_r($voornaam);`. Update the result with your question.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24164735
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: Why is XmlJavaTypeAdapter ignored in parent class
has body: I have class: public class FooImpl extends Foo { @XmlJavaTypeAdapter(ListXmlAdapter.class) @Override public Map&lt;String, List&lt;String&gt;&gt; getList() { return super.getList(); } } when I want to marshal this class then this annotation is ignored propably because in parent this method doesnt contain this annotation (due to maven dependencies). Foo is just basic class with this method. How should I fix thix problem ?
answer count: 1
tagged with: jaxb
favorite count: 0
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/24165053

http://stackoverflow.com/comment/37418947
type: Comment
comment on: http://stackoverflow.com/q/24228675
has text: Erm, What do you mean by "Path parameter"? You don't "pass objects" through the URL. You pass them through the message body. So when you do a POST/PUT The Object that you create/object is in the message body. When you do a GET/DELETE the object that was retrieved and/or deleted can be returned in the same fashion.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37423674
comment on: http://stackoverflow.com/a/24232379
type: Comment
has text: but got exception --> `org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/securityConfig.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/securityConfig.xml]`
score: 0
type: AnswerComment

http://stackoverflow.com/q/24154194
accepted answer: http://stackoverflow.com/a/24154264
tagged with: int
type: AnsweredQuestion
tagged with: netbeans
score: 0
linked to: http://stackoverflow.com/q/51632152
has comment: http://stackoverflow.com/comment/37276111
tagged with: java
answer count: 1
duplicate of: http://stackoverflow.com/q/51632152
type: Question
has body: This happened when I decompiled some classes from a jar file. These are the only errors I cannot get past. All of these errors are 'Possible lossy conversion from int to byte'. this.onDemandFetcher.method563(1, 2, i2); this.worldController.method291(i1, j, i, -119); this.method563(2, 3, this.mapIndices3[k]); this.method563(2, 3, this.mapIndices2[k]); and public boolean method286(final int j, final int k, final Animable class30_sub2_sub4, final int l, final int i1, final int j1, final int k1, final int l1, final int i2, final int j2, final int k2) { return class30_sub2_sub4 == null || this.method287(j, l1, k2, i2 - l1 + 1, i1 - k2 + 1, j1, k, k1, class30_sub2_sub4, l, true, j2, 0); } and return this.method287(i, l2, i2, j2 - l2 + 1, k2 - i2 + 1, k1, i1, k, class30_sub2_sub4, j, true, l, 0); All of these errors are classified as the same thing. What exactly am I doing wrong? Could you please fix the code for me and show me the difference?
has answer: http://stackoverflow.com/a/24154264
tagged with: byte
has title: Java Possible lossy conversion from int to byte errors

http://stackoverflow.com/comment/37370181
has text: I am using ubuntu..I used to java_home to jdk 1.7..but it does not worked
comment on: http://stackoverflow.com/a/24204379
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37251865
score: 0
has text: Try replacing whole action_bar.xml code with above code.
comment on: http://stackoverflow.com/a/24137858
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37284077
score: 0
type: QuestionComment
type: Comment
has text: why this error caused by onCreate(). Null pointer exception. What is missing??
comment on: http://stackoverflow.com/q/24158232

http://stackoverflow.com/comment/37479986
score: 1
type: Comment
type: QuestionComment
has text: CXF sounds like the way to go, since the `cxfrs` component allows you to specify endpoints easily. I have used csf WS and I am betting it's very similar.
comment on: http://stackoverflow.com/q/24260777

http://stackoverflow.com/q/24129016
type: UnansweredQuestion
tagged with: jpa
has answer: http://stackoverflow.com/a/24129394
type: Question
has answer: http://stackoverflow.com/a/24131504
score: 0
has comment: http://stackoverflow.com/comment/37228984
tagged with: java
tagged with: hibernate
has title: Field not populating from database
linked to: http://stackoverflow.com/q/1154833
has body: database table CREATE TABLE WIES.DEPARTMENT ( DEPT_ID integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( START WITH 100, INCREMENT BY 1), DEPT_NME varchar(20) , SEQUENCE_NO integer , ACTIVE_IND char(1) DEFAULT 'Y' ); entity class @Entity @Table(name = "DEPARTMENT", schema = "WIES") public class Department implements JpaObjectWithName, Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "DEPT_ID", unique = true, nullable = false) private Integer departmentId; @Column(name = "SEQUENCE_NO") private int sequence; @Column(name = "DEPT_NME") @Size(max = 20, message = "error.department.name.length") private String name; @Transient private boolean active; public Integer getDepartmentId() { return departmentId; } public void setDepartmentId(Integer departmentId) { this.departmentId = departmentId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getSequence() { return sequence; } public void setSequence(int sequence) { this.sequence = sequence; } public boolean isActive() { return active; } public void setActive(boolean active) { this.active = active; } @Column(name = "ACTIVE_IND") public String getActiveString() { return BooleanUtils.toString(active, "Y", "N"); } public void setActiveString(String activeString) { this.active = BooleanUtils.toBoolean(activeString); } @Override public String toString() { return (this.name != null) ? this.name : super.toString(); } } DAO @SuppressWarnings("unchecked") public List&lt;Department&gt; getDepartments() { String jql = "select a from Department a"; Query query = entityManager.createQuery(jql + " order by a.sequence, a.name"); return (List&lt;Department&gt;) query.getResultList(); } The generated sql statement from the console 2014-06-09 16:31:34,282 DEBUG [org.hibernate.SQL] - &lt;select department0_.DEPT_ID as DEPT_ID1_9_, department0_.DEPT_NME as DEPT_NME2_9_, department0_.SEQUENCE_NO as SE…
answer count: 2
has comment: http://stackoverflow.com/comment/37229077

http://stackoverflow.com/comment/37231049
score: 1
type: Comment
has text: To be sure , I have putted a `Log.d("Test","onCreate method was called to restore state");` inside the onCreate method But Logcat show that message the first time then it has never shown me that again . what that means ?
type: AnswerComment
comment on: http://stackoverflow.com/a/24129857

http://stackoverflow.com/comment/37195854
has text: I guess `Event.getSource()` should be `event.getSource()`. The code in your original post (before the edit) didn't even compile because of incorrect usage of capitalization.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24111375
type: Comment

http://stackoverflow.com/a/24142377
has comment: http://stackoverflow.com/comment/37324403
score: 0
has comment: http://stackoverflow.com/comment/37254217
has body: You can used GSON Library for de-serialize your Json into your class object. There is function gson.fromJson(JSON String) which convert json string to class object. Here is Sample code : Gson json = new Gson(); Site site = json.fromJson(jsonStr, Site.class); But in your code you have replace List&lt;Instance&gt; instances = Lists.newArrayList(); this line in class Site with List&lt;CloudInstance&gt; instances = new ArrayList&lt;CloudInstance&gt;(); Because your CloudInstance class extend Instance it means CloudInstance class include member of Instance class. As per json you need to do this to cast directly into class object. May this will help you.
type: Answer
answers question: http://stackoverflow.com/q/24138667
has comment: http://stackoverflow.com/comment/37279541

http://stackoverflow.com/comment/37431777
type: AnswerComment
type: Comment
has text: can you explain me this piece of code: t3.setText(NumberFormat.getNumberInstance().format(total)); though it throws an error regarding"NumberFormat"
comment on: http://stackoverflow.com/a/24236504
score: 0

http://stackoverflow.com/comment/37707120
comment on: http://stackoverflow.com/q/24207529
has text: I found my mistake. I was writing "var = value" instead of "var value".
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/24226933
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/24470261
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24331284
has answer: http://stackoverflow.com/a/24470261
has title: High frequency Android UI Thread updating from a separate thread?
has comment: http://stackoverflow.com/comment/37871807
possible better answer: http://stackoverflow.com/a/24228403
tagged with: android
has comment: http://stackoverflow.com/comment/37611755
has answer: http://stackoverflow.com/a/24228403
answer count: 4
has answer: http://stackoverflow.com/a/24331397
has body: I'm trying to update an EditText at a high rate of speed so the numbers flow more smoothly. But I've tried different combinations of techniques and objects, such as AsyncTask, Thread->Runnable with a handler, Timer->TimerTask with a handler, and no matter how long I set the timing for, it doesn't seem to get any better than approximately 1 second. I'm thinking that it may be that fact that it is having to travel through the message pump, but I can't be sure. Does anyone have any idea how I could get an update frequency of at least 250 to 500 milliseconds? Higher frequency would be preferable, but that would do. Update 2: I commented out everything but the count++; and I update one of the edit texts with this value and it is indeed updating very fast. So something that is happening in updateUi() is slowing it down. I just don't know what. Update 1: I switched real-time usage of SharedPreferences which I was using to test with primitives just in case that was part of the problem. The performance appears to be the same. The only think that happens on a regular basis is an updateUi() function which runs on a timer. The code is below, and this is what I'm expecting to update quickly, but doesn't: private void updateUi() { lastDate = cal; cal = Calendar.getInstance(); synchronized(cal) { //if the current date is greater than the last stored date if(compareDates(cal, lastDate) &gt; 0 &amp;&amp; count == 0) { //disable timer calorieTimer.cancel(); //dereference timer...probably not necessary calorieTimer = null; double bankBmr = currentBmr.getBMR() * activityLevelMultipliers[activityLevelSpinner.getSelectedItemPosition()]; metrics.calorieBank += (int)bankBmr - metrics.caloriesEaten; prefsEditor.putInt("CALORIE_BANK", metrics.calorieBank); prefsEditor.putInt("CALORIES_EATEN", 0); prefsEditor.commit(); metrics.caloriesEaten = 0; //update lastDate to prevent multiple calorie banking lastDate = cal; count++; Log.e("updateUi()", "count #" + count); //set up timer again setupCalo…
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: multithreading

http://stackoverflow.com/comment/37350552
comment on: http://stackoverflow.com/q/24194064
type: QuestionComment
has text: What you are asking for is impossible. There are workarounds.
type: Comment
score: 2

http://stackoverflow.com/comment/37248670
type: Comment
type: QuestionComment
has text: Also make sure that the data you store (how is it stored?) is correctly stored.
comment on: http://stackoverflow.com/q/24139466
score: 0

http://stackoverflow.com/a/24210824
has comment: http://stackoverflow.com/comment/37387370
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24210564
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24210564
has body: I think for now you have to manually add Java 8 support since the latest offical version of eclipse doesn't yet support Java 8. Instructions are here: http://www.eclipse.org/downloads/java8/

http://stackoverflow.com/comment/37328366
has text: Scott's guide mentions that the URI must be accessible network-wise, which for me (by opening in Chrome, for example), only works without the localhost part: file:///Users/arthurhsieh/Documents/NetBeansProjects/AES/logs/POS2.log Unfortunately this did not solve the problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24181470
score: 0

http://stackoverflow.com/a/24227153
answers question: http://stackoverflow.com/q/24227120
has body: After you call matcher.find(); you must call matcher.group(); to return the result of the previous match. e.g. public static void main(String[] args) { Pattern pattern = Pattern.compile("\\bAccountability", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(" Accountability: Execute"); while (matcher.find()) { System.out.println(matcher.group()); }
type: Answer
score: 0

http://stackoverflow.com/comment/37278947
has text: No, it doesn't 'create the stub class', or the stub object either. The server creates the stub object when it is exported, and binds it to the Registry. All that lookup() does is get it from the Registry. 'Listing of the JSR files' means a list of what's inside them. What they're called is of no conceivable interest.
comment on: http://stackoverflow.com/q/24154240
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24227177
accepted answer of: http://stackoverflow.com/q/24227149
downvote count: 0
answers question: http://stackoverflow.com/q/24227149
has body: The difference is semantic. Verify is used to ensure that invariants don't change, that Code which has been engineered to do a certain thing is actually doing that thing. In spirit: int x = divide(10, 5); Verify.verify(x == 2, "X should be 2"); Preconditions, on the other hand, are expected to fail when bad input is passed to a certain portion of the program, usually either from the user to the code, or from client code to code within another library. In spirit: public int divide(int x, int y) { Preconditions.checkArgument(y != 0, "Can't divide by 0!"); return x / y; } As to whether you should use a @Beta class, that entirely depends on the scope and foreseeable lifetime of the application you are building, and, asked alone, would probably be flagged as a "Primarily Opinion-Based" question.
has comment: http://stackoverflow.com/comment/37453777
type: AcceptedAnswer
score: 11
type: Answer
upvote count: 11

orm
tags question: http://stackoverflow.com/q/24150199
tags question: http://stackoverflow.com/q/24241736
type: Tag
tags question: http://stackoverflow.com/q/24186767
tags question: http://stackoverflow.com/q/24217409
tag name: orm
tags question: http://stackoverflow.com/q/24232811

http://stackoverflow.com/comment/37481683
comment on: http://stackoverflow.com/q/24262882
has text: using "/" you can access root folder. Show us your project structure.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37185928
comment on: http://stackoverflow.com/q/24106181
type: Comment
type: QuestionComment
score: 2
has text: But what does this code do? You are converting a Date object to String and back to Date object. So finally you are having the same object.

http://stackoverflow.com/a/24133751
answers question: http://stackoverflow.com/q/24115156
type: Answer
has comment: http://stackoverflow.com/comment/69216918
score: 0
has body: I create KeyManagerFactory kmf = csm.getKeyManagerFactory(); TrustManagerFactory tmf = csm.getTrustManagerFactory(); SSLContext sslcontext = SSLContexts.custom().useProtocol("SSL").build(); sslcontext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom()); And then i setDefaultSSLSocketFactory HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory());

http://stackoverflow.com/q/24181463
has comment: http://stackoverflow.com/comment/37361498
has body: I have DAO code that looks like this: public abstract class GenericDAO &lt;T, I&gt; { public I upsert(T entity){ //implementation } } public class MyEntityDAO extends GenericDAO &lt;MyEntity, Integer&gt; { public List&lt;MyEntity&gt; searchMyEntity(SearchParameters params){ //domain specific entity search } } public class MyEntityService{ private MyEntityDAO myEntityDAO; public Integer saveMyEntity(MyEntityVO vo){ //transform vo to entity with business logic return myEntityDAO.upsert(myEntityInstance); } } I want to test the saveMyEntity() method using Mockito but mockito is showing me an error message - "the method when(t) in the type mockito is not applicable for the arguments (void)". This is the code: Mockito.when(myEntityDAO.upsert(Matchers.any(MyEntity.class))) .thenReturn(1); This is the code that works: Mockito.when(myEntityDAO.searchMyEntity(testSearchParams)) .thenReturn(mockedListOfMyEntities); It seems that because upsert() is in the superclass of MyEntityDAO and not in MyEntityDAO itself this issue is coming up. Is there any way I can achieve this? Is there any workaround or a different framework that supports this?
has answer: http://stackoverflow.com/a/24232031
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37333989
tagged with: java
has comment: http://stackoverflow.com/comment/37331456
has comment: http://stackoverflow.com/comment/37330121
has title: Mockito - stub super (abstract) class method
has comment: http://stackoverflow.com/comment/37361272
accepted answer: http://stackoverflow.com/a/24232031
linked to: http://stackoverflow.com/q/19915270
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37343793
tagged with: mocking
has comment: http://stackoverflow.com/comment/37327122
tagged with: mockito
answer count: 1
tagged with: junit

http://stackoverflow.com/q/24133933
has title: Mysql access over LAN
has comment: http://stackoverflow.com/comment/37238061
has comment: http://stackoverflow.com/comment/37238718
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24134128
type: UnansweredQuestion
tagged with: remote-access
linked to: http://stackoverflow.com/q/14779104
has body: I have created a java application which connects to a mysql database using the JDBC driver. I have the mysql server running on the same machine as my java application. When I connect to the database on localhost the application is working fine. My system in connected to other systems via LAN. Now i want to run my application on these systems connecting to the database on the mysql server i have on my system. What changes do i need to make in my mysql workbench or the java application to deploy this. I have mysql 6.1 workbench installed. I am getting the following error: run: Communications link failure Last packet sent to the server was 0 ms ago. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at help.helpdesk.Ready(helpdesk.java:97) at help.helpdesk.&lt;init&gt;(helpdesk.java:89) at help.helpdesk$6.run(helpdesk.java:428) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) BUILD SUCCESSFUL (total time: 22 seconds) when I try to connect to the database on my local server by using the ip address of my system.
has answer: http://stackoverflow.com/a/24170757
score: 0
has comment: http://stackoverflow.com/comment/37237995
has comment: http://stackoverflow.com/comment/37238127
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/37237944
has comment: http://stackoverflow.com/comment/37238172
has comment: http://stackoverflow.com/comment/37237914
tagged with: mysql

http://stackoverflow.com/q/24184643
upvote count: 15
tagged with: mockito
type: UnansweredQuestion
downvote count: 0
has title: Serializing a mock throws exception
has answer: http://stackoverflow.com/a/24191600
score: 15
has answer: http://stackoverflow.com/a/50619679
answer count: 2
tagged with: java
has body: I am trying to test my controller using mockMvc and mockito. The actual controller body is as following : Message createXYZ(@RequestBody XYZ inst){ //creates XYZ } Now for pushing the values via request body, I am creating a JSON using GsonBuilder by serializing XYZ. Here is the structure for class XYZ : class XYZ{ List&lt;Y&gt; listofYs; //some other properties as well } I am creating and setting a mock for List listofYs and when Gson is trying to serialize an instance of XYZ that has a mocked listofYs its generating NPE. Is there a way around or is it that I am doing it completely wrong?
tagged with: gson
tagged with: unit-testing
favorite count: 0
type: Question

http://stackoverflow.com/comment/37199920
comment on: http://stackoverflow.com/a/24113409
type: Comment
has text: Please check the updated image that I am getting after the changes you mentioned..
score: 0
type: AnswerComment

http://stackoverflow.com/q/24113593
score: -2
possible better answer: http://stackoverflow.com/a/24113634
accepted answer: http://stackoverflow.com/a/24113632
has answer: http://stackoverflow.com/a/24113634
has body: I have a similar problem to this question, and I tried the answer that the question accepted: File folder = new File("/path/to/files"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { File file = listOfFiles[i]; if (file.isFile() &amp;&amp; file.getName().endsWith(".txt")) { String content = FileUtils.readFileToString(file); /* do somthing with content */ } } Only when I tried compiling, it couldn't find the variable FileUtils. Is there a java package that I have to import at the beginning of my program to use class File methods? I've never used File objects before, so I'm trying to learn to be able to work with and manipulate them. Thanks.
has answer: http://stackoverflow.com/a/24113632
linked to: http://stackoverflow.com/q/5924237
type: AnsweredQuestion
answer count: 2
tagged with: java
has title: Accessing .txt files from inside a folder (java)
tagged with: file
downvote count: 3
upvote count: 1
tagged with: fileutils
favorite count: 0
has comment: http://stackoverflow.com/comment/37199895
type: Question

http://stackoverflow.com/comment/37286445
type: Comment
has text: I'm having troubles understanding the difference between association and aggregation in terms of coding and theory.
comment on: http://stackoverflow.com/a/24156748
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37419327
has text: As an exercice, ofc ^^
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24230250
type: AnswerComment

http://stackoverflow.com/q/24207569
type: Question
possible better answer: http://stackoverflow.com/a/46261274
has title: hadoop, java.lang.RuntimeException: java.lang.ClassNotFoundException error
has answer: http://stackoverflow.com/a/46261274
tagged with: mapreduce
tagged with: hadoop
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24220263
accepted answer: http://stackoverflow.com/a/24220263
has body: i am following the book(definitive guide hadoop). and while trying to execute an example in the book with localhost, i have faced the error, 14/06/13 22:24:57 WARN mapred.JobClient: No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String). ****hdfs://localhost/usr/kim/input/ncdc 14/06/13 22:24:57 INFO input.FileInputFormat: Total input paths to process : 3 14/06/13 22:24:57 WARN snappy.LoadSnappy: Snappy native library is available 14/06/13 22:24:57 INFO util.NativeCodeLoader: Loaded the native-hadoop library 14/06/13 22:24:57 INFO snappy.LoadSnappy: Snappy native library loaded 14/06/13 22:24:57 INFO mapred.JobClient: Running job: job_201406132100_0011 14/06/13 22:24:58 INFO mapred.JobClient: map 0% reduce 0% 14/06/13 22:25:11 INFO mapred.JobClient: Task Id : attempt_201406132100_0011_m_000000_0, Status : FAILED java.lang.RuntimeException: java.lang.ClassNotFoundException: mapred.MaxTemperatureMapper_v1 at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:867) at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:199) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:719) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370) at org.apache.hadoop.mapred.Child$4.run(Child.java:255) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1093) at org.apache.hadoop.mapred.Child.main(Child.java:249) Caused by: java.lang.ClassNotFoundException: mapred.MaxTemperatureMapper_v1 at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.…

http://stackoverflow.com/comment/37350889
type: QuestionComment
comment on: http://stackoverflow.com/q/24193788
has text: "int" here is used losely
score: 0
type: Comment

http://stackoverflow.com/a/24265525
downvote count: 0
has body: I would try a dsl that parses the syntax you specified (Color Equals Blue) AND (Name Contains Smith) into java code. Make sure you understand the grammar for this syntax very well though before you start translating it into your parser grammar. A language specification link would help a lot. In the past I used ANTLR and it was really easy to generate JAVA code once i had the syntax tree from the output string.
answers question: http://stackoverflow.com/q/24265433
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/37278362
comment on: http://stackoverflow.com/a/24149697
score: 0
type: AnswerComment
has text: hi mate, sorry didn't see your reply until now. We did tried that but still didn't work :( my code is now look like this `private void getCitiesService(final String userName) { APICalls obj= new APICalls(CitiesActivity.this,APIParameters.ACTION_CITIES + "&user="+ userName, null, CitiesActivity.this); String params = "Get"; obj.execute(params); }` As you mentioned.
type: Comment

http://stackoverflow.com/a/24173196
has body: Your solution depends on what kinds of annotation you want to use in your project. You can add @ResponseBody to your getSchema method in Controller Or, maybe adding produces attribute in your @RequestMapping can solve it too. @RequestMapping(value="/schema", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE} ) Final choice, add headers to your ResponseEntity (which is one of the main objective of using this class) //... HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/json; charset=utf-8"); return new ResponseEntity&lt;MyObject&gt;(new MyObject(), headers, HttpStatus.OK); Edit : I've just seen you want Json AND Xml Data, so the better choice would be the produces attribute: @RequestMapping(value="/schema", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE} )
has comment: http://stackoverflow.com/comment/66554223
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/120576993
upvote count: 11
has comment: http://stackoverflow.com/comment/65832137
has comment: http://stackoverflow.com/comment/37338323
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24166167
answers question: http://stackoverflow.com/q/24166167
has comment: http://stackoverflow.com/comment/66138533
has comment: http://stackoverflow.com/comment/75101797
has comment: http://stackoverflow.com/comment/66591576

file-io
tags question: http://stackoverflow.com/q/24136441
tags question: http://stackoverflow.com/q/24214952
tags question: http://stackoverflow.com/q/24117181
tags question: http://stackoverflow.com/q/24171551
tags question: http://stackoverflow.com/q/24191246
tags question: http://stackoverflow.com/q/24201398
tags question: http://stackoverflow.com/q/24218077
tags question: http://stackoverflow.com/q/24195072
tags question: http://stackoverflow.com/q/24211078
tags question: http://stackoverflow.com/q/24120470
type: Tag
tag name: file-io
tags question: http://stackoverflow.com/q/24118639
tags question: http://stackoverflow.com/q/24105371
tags question: http://stackoverflow.com/q/24179314
tags question: http://stackoverflow.com/q/24216920

http://stackoverflow.com/a/24165213
score: 0
has body: It all depends on how you have configured your security which you have not posted in the question. If you don't verify your logged in user through java ee web.xml security settings or by checking through a filter than your pages are not secured and when the user will hit the next URL the session will be recreated . If you are not using container security or java ee security then you can have some kind of filter that checks all your pages except login @WebFilter("/*") public class LoginFilter implements Filter { private ServletContext context; public void init(FilterConfig fConfig) throws ServletException { this.context = fConfig.getServletContext(); } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String requestURL = ((HttpServletRequest)request).getRequestURL().toString(); HttpSession session = req.getSession(false); if(session == null &amp;&amp; !(requestURL.endsWith("login.xhtml"))){ ((HttpServletResponse)response).sendRedirect("login.xhtml"); }else{ chain.doFilter(request, response); } } }
answers question: http://stackoverflow.com/q/24151464
type: Answer

http://stackoverflow.com/a/27801625
has body: Old question, I know, but as I've just had cause to do this: \d{4}\\\d{2}\\\d{2} Looks a lot neater to my eyes than the other suggestions, and works outside of the 20th/21st century (unclear if OP required this or not). However, my implementation will match for dates such as 9999/99/99 (clearly invalid) - but as a commenter suggested, SimpleDateFormat is the tool for that kind of validation, in my opinion. If OP were able to use SimpleDateFormat as well as regex, then this would suffice: public static final boolean isDateValid(String date) { if (!date.matches("\d{4}\\\d{2}\\\d{2}")) return false; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); try { sdf.parse(date); return true; } catch (ParseExceptione) { return false; } } NB. Usual caveats about SimpleDateFormat not being thread safe etc.
answers question: http://stackoverflow.com/q/24139038
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/37378237
comment on: http://stackoverflow.com/a/24208641
type: Comment
score: 0
type: AnswerComment
has text: @arshajii sadly, Java doesn't provide another compilable way to **initialize** the array. Note that the elements in the array cannot be initialized as `ClassThatImplementsFoo<Integer>` or another object.

http://stackoverflow.com/comment/37417008
has text: @Unheilig no, that wouldn't work. The recommendation in this case is to create a new interface extending the old one with new declarations, which would only become available to newer code.
comment on: http://stackoverflow.com/a/24228674
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/31872166
score: 0
has body: From JavaJEE.com: JIT Compiler versions There are 3 versions of the JIT compiler, and they are: A 32-bit client version (-client) A 32-bit server version (-server) A 64-bit server version (-d64) To some extent, you can choose the compiler you want to use by supplying an argument to java (-client, -server or –d64). However different Java binaries (32 bit for Linux, 64 bit for Windows etc.) contain different compilers and may also different behavior for these flags. For instance, If you have a 64-bit Windows, 64-bit Linux or Mac OS X JVM and specify -client, -server or –d64, the application will use the 64-bit server compiler in all cases. o Solaris 64-bit is an exception where -client will give 32 bit client, -server will give 32 bit server and –d64 will give 64 bit server, as expected. If you have a 32-bit Linux, 32-bit Solaris or 32-bit Windows JVM and if you specify –client you get 32-bit client, if you specify –server you will get 32-bit server, and if you specify -d64, you will get an error that the given instance does not support a 64-bit JVM. Now we will see differences between client and server, and then 32-bit and 64-bit.
has comment: http://stackoverflow.com/comment/51664308
answers question: http://stackoverflow.com/q/24133611
type: Answer

http://stackoverflow.com/comment/74798267
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/43879025
has text: @Yunnosch [`Calendar.MONDAY`](https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#MONDAY) is indeed [documented as being a constant of type `int` with a value of `2`](https://docs.oracle.com/javase/8/docs/api/constant-values.html#java.util.Calendar.MONDAY). This numbering is peculiar to North America and other regions that commonly consider Sunday as first day of the week. The ISO 8601 standard defines Monday as first day. One of many reasons to avoid this troublesome old legacy class and instead use the modern java.time classes like `DayOfWeek` enum which follows the standard.
score: 0

http://stackoverflow.com/q/24190507
tagged with: okhttp
upvote count: 16
has answer: http://stackoverflow.com/a/27268171
answer count: 3
has comment: http://stackoverflow.com/comment/37357780
tagged with: java
downvote count: 0
score: 16
has title: What causes "java.io.IOException: stream was reset: CANCEL" with okhttp and spdy?
favorite count: 0
type: Question
tagged with: spdy
tagged with: network-programming
has comment: http://stackoverflow.com/comment/37454065
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37357684
linked to: http://stackoverflow.com/q/22926538
has body: I'm experimenting with OKHttp (version 2.0.0-RC2) and SPDY and seeing IOException: stream was reset: CANCEL quite a lot, maybe 10% or more of all requests in some preliminary testing. When using Apache HttpClient and regular https we were not seeing any equivalent issue as far as I'm aware. I'm pretty sure we also don't see anything equivalent with OkHttp when SPDY is disabled (client.setProtocols(ImmutableList.of(Protocol.HTTP_1_1))) but I haven't done enough testing to be 100% confident. This previous question sees these exceptions among others and the advice there is to ignore them, but this seems crazy: we get an exception while reading data from the server, so we abort the data processing code (which using Jackson). We need to do something in such cases. We could retry the request, of course, but sometimes it's a POST request which is not retry-able, and if we've already started receiving data from the server then it's a good bet that the server as already taken the requested action. Ideally there is some configuration of the client and/or the server that we can do in order to reduce the incidence of these exceptions, but I don't understand SPDY well enough to know even where to start looking or to advise our server-admin team to start looking. Stack trace, in case it's helpful: java.io.IOException: stream was reset: CANCEL at com.squareup.okhttp.internal.spdy.SpdyStream$SpdyDataSource.checkNotClosed(SpdyStream.java:442) at com.squareup.okhttp.internal.spdy.SpdyStream$SpdyDataSource.read(SpdyStream.java:344) at com.squareup.okhttp.internal.http.SpdyTransport$SpdySource.read(SpdyTransport.java:273) at okio.RealBufferedSource.exhausted(RealBufferedSource.java:60) at okio.InflaterSource.refill(InflaterSource.java:96) at okio.InflaterSource.read(InflaterSource.java:62) at okio.GzipSource.read(GzipSource.java:80) at okio.RealBufferedSource$1.read(RealBufferedSource.java:227) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.loadMore(UTF8StreamJsonParser.java:1…
has answer: http://stackoverflow.com/a/59609374
has answer: http://stackoverflow.com/a/24197886

http://stackoverflow.com/comment/37305045
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24169468
type: AnswerComment
has text: in case of mConnectedThread, in write method, is attribute of BluetoothChatService which is accessed by multiple threads so you only needed to synchronize the code that accesses mConnectedThread, "r" is a local variable here and will be created every time this method is called so doesn't need synchronization.

http://stackoverflow.com/comment/37442249
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24241342
has text: yep. I tried to use `z`-`zzzz` and `Z`-`ZZZZ` patterns for time zone but no luck here with `CEST`. date is from external DB, so I have deal with data as it is. any ideas how to work this out?
score: 0

http://stackoverflow.com/a/24173773
upvote count: 3
answers question: http://stackoverflow.com/q/24173667
has body: I'd re-organize the code a little. In the main game, you can have a collection of 'Ball' types. I'll leave the collection option up to you. But you'll want to add 'new' Balls to the collection and then remove them once they are caught.
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/a/24140560
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24140187
upvote count: 1
answers question: http://stackoverflow.com/q/24140187
score: 1
type: Answer
has body: I am not quite sure what type of server environment in question. But I assume yours might be some application server or web server. In that case Scheduled jobs can be creating batch job and schedule it through cron Tab on Linux/Unix (assuming your application is running on Unix/Linux box).

http://stackoverflow.com/a/24223448
downvote count: 0
has comment: http://stackoverflow.com/comment/37406688
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/37410638
type: Answer
has comment: http://stackoverflow.com/comment/37410547
has comment: http://stackoverflow.com/comment/37406670
answers question: http://stackoverflow.com/q/24223440
has comment: http://stackoverflow.com/comment/37406683
has body: This line here: (50*x*x*x-150*x*x+400*x)/3 Is using integers, which can overflow. If an integer hits the max (2^31-1), it will overflow to -2^31. You need to use BigIntegers here, something like this: Biginteger bx = new BigInteger(x); BigInteger new BigInteger(50).multiply(bx.pow(3)).multiply(new BigInteger(-150)) .multiply(bx.pow(2)).multiply(new BigInteger(400)).multiply(bx).divide(3);

http://stackoverflow.com/q/24180575
tagged with: tomcat
type: AnsweredQuestion
score: 3
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/37324742
downvote count: 0
has title: How do you redeploy javascript in Idea when using a Tomcat configuration
has comment: http://stackoverflow.com/comment/37324704
tagged with: java
favorite count: 0
type: Question
has body: I'm working on a java/javascript webapp that runs on tomcat. We're working with IDEA and I've managed to get debugging set up for both the client and server code at the same time, which is great. I did have hot redeployment of the javascript set up when running Tomcat manually, however I find when running Tomcat through IDEA this doesnt work as it's setting stuff up somewhere in my users folder. I was going to just set up a deployment configuration to go to that folder but I can't see any of the javascript files in there. Is it possible to get the best of both worlds and have debugging and automatic deployment working together? Update Here's my config: I'm using maven to build a specific profile rather than using 'build war exploded'. I suspect the latter wont work to build as quite a lot of custom properties need supplying by maven at compile time. I also now have war exploded set in start up in deployment.
has answer: http://stackoverflow.com/a/24243656
possible better answer: http://stackoverflow.com/a/24180781
accepted answer: http://stackoverflow.com/a/24243656
tagged with: intellij-idea
linked to: http://stackoverflow.com/q/19596779
tagged with: javascript
has answer: http://stackoverflow.com/a/24180781

http://stackoverflow.com/q/24145876
type: AnsweredQuestion
tagged with: jlist
linked to: http://stackoverflow.com/q/9250470
score: 1
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/24146076
type: Question
answer count: 2
downvote count: 0
upvote count: 1
has body: I`m having problems figuring out how to align my JPanels in my JList to the left side. I´m using a custom ListCellRenderer, so the JPanels render at all. public class FileTab extends JPanel implements ListCellRenderer&lt;FileProperties&gt; { public FileTab(int w, int h) { setSize(w, h); } private void initComponents(FileProperties prop, boolean selected) { removeAll(); JCheckBox checkBoxSelection = new JCheckBox(); checkBoxSelection.setBounds(10, 10, 10, 10); add(checkBoxSelection); checkBoxSelection.setSelected(selected); System.out.println("Draw: " + prop.getFileName()); JLabel labelFileName = new JLabel(prop.getFileName()); labelFileName.setBounds(5, 70, getWidth() - 85, 20); labelFileName.setFont(new Font("Consolas", Font.ITALIC, 20)); add(labelFileName); } @Override public Component getListCellRendererComponent(JList&lt;? extends FileProperties&gt; list, FileProperties prop, int index, boolean isSelected, boolean cellHasFocus) { initComponents(prop, isSelected); return this; } } And thats how I create the List: JScrollPane scroll = new JScrollPane(); scroll.setBounds(5, 5, getWidth() - 10, getHeight() - 110); list = new DefaultListModel&lt;&gt;(); fileList = new JList&lt;&gt;(list); fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); fileList.setCellRenderer(new FileTab(getWidth() - 30, 30)); scroll.setViewportView(fileList); add(scroll); This results in this, where the JPanels are aligned in the center rather than on the left side. And the updating of the list: list.clear(); for (FileProperties props : files) { list.addElement(props); } fileList.setCellRenderer(new FileTab(getWidth() - 30, 30));
possible better answer: http://stackoverflow.com/a/24146076
tagged with: alignment
tagged with: swing
has title: Align JList items (JPanels) on the left
has answer: http://stackoverflow.com/a/24146217
accepted answer: http://stackoverflow.com/a/24146217
favorite count: 0

http://stackoverflow.com/q/24107657
has body: Lately I've found out that this works, although I'd expect it not to: class Outer { Button b; void foo() {} void bar() { b = new Button(); b.setOnClickListener(new OnClickListener(){ @Override public void OnClick() { foo(); } }); } } I'd expect Outer.this.foo() to be required, but seems that simply foo() also works. Could someone tell me when exactly this was added to the language? Please help me understand exact name resolution rules here. Thanks! The questions: 1) Why is this working? 2) If this works, why do we need the "Outer.this" syntax?
has comment: http://stackoverflow.com/comment/37188504
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37188676
has comment: http://stackoverflow.com/comment/37188499
downvote count: 3
has title: Java: Why anonymous inner classes can access methods of outer class?
upvote count: 1
has comment: http://stackoverflow.com/comment/37188493
answer count: 1
favorite count: 0
tagged with: anonymous-class
type: Question
has comment: http://stackoverflow.com/comment/37188513
tagged with: java
accepted answer: http://stackoverflow.com/a/24107809
score: -2
has answer: http://stackoverflow.com/a/24107809
has comment: http://stackoverflow.com/comment/37188479
has comment: http://stackoverflow.com/comment/37188564

http://stackoverflow.com/comment/37408962
score: 0
comment on: http://stackoverflow.com/q/24223783
type: Comment
type: QuestionComment
has text: You have do do like tx.setTypeface(Typefaces.get(this, "fonts/watermelon.ttf"));

http://stackoverflow.com/q/24235600
has answer: http://stackoverflow.com/a/24243205
answer count: 2
type: UnansweredQuestion
tagged with: httpsurlconnection
tagged with: authenticator
type: Question
linked to: http://stackoverflow.com/q/2642777
tagged with: android
tagged with: java
duplicate of: http://stackoverflow.com/q/2642777
has title: Android HttpURLConnection- easiest way to trust all hosts?
linked to: http://stackoverflow.com/q/7808301
has body: I'm trying to hit an https site through an Android client: URL url = new URL(myurl); Log.d("Connection", myurl); HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.addRequestProperty("Content-Type", "application/json"); conn.setRequestMethod("POST"); conn.setDoInput(true); // Starts the query Log.d("Connection", "Connecting..."); conn.connect(); The connect call is throwing an exception: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. EDIT: I'm told the site is using a self-signed certificate, and since this is only a prototype I just need to trust all hosts so it will work. Can someone point me toward a simple example of doing this? The code I've seen online gets quite complicated, I just want to do a hacky bypass of any verification.
tagged with: httpurlconnection
has answer: http://stackoverflow.com/a/24255897
score: 0
linked to: http://stackoverflow.com/q/6825226

http://stackoverflow.com/a/24242669
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24242395
answers question: http://stackoverflow.com/q/24242395
has body: Here is the situation (check the comments for descriptions of what will happen): outer: for (int i = 2; i&lt;=n;i++) { for(int j = 2; j&lt;i;j++) { if(i%j==0) { continue outer; // skip the rest of outers loop and go to its start } } System.out.println("Prime Number " + i); //this will not get run //when the continue statement is hit } With break: outer: for (int i = 2; i&lt;=n;i++) { for(int j = 2; j&lt;i;j++) { if(i%j==0) { break; // stop running the inner loop } } System.out.println("Prime Number " + i); //this still gets run regardless of break }
type: Answer

http://stackoverflow.com/comment/37364081
score: 0
has text: If you are referring to the xml-tag in the appengine-web.xml, then yes.
type: Comment
comment on: http://stackoverflow.com/a/24195917
type: AnswerComment

http://stackoverflow.com/comment/37242199
score: 0
type: AnswerComment
type: Comment
has text: But i want remove only few elements from list and editor.remove() remove whole list. For example, i have MyList in my preferences and it is: 1. cat, 2. dog, 3.lion, 4 crown. I want remove from my list only lion and dog.
comment on: http://stackoverflow.com/a/24131775

http://stackoverflow.com/q/24214758
has title: Java How do I get all map values within specific keys?
has answer: http://stackoverflow.com/a/24214771
tagged with: double
tagged with: dictionary
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has body: right now I have a Map like this: Map&lt;Double, MyObject&gt; map = new HashMap&lt;Double, MyObject&gt;(); I want to get all values of keys that are between 2.0 and 7.0. I have thousands of different values in my Map, so looping through every key-value set will be heavy for performance. Is there any way to solve this? (Or is there some sort of special map, that is used to have number keys?) Thanks for helping ;)
tagged with: key
type: Question
accepted answer: http://stackoverflow.com/a/24214771
has comment: http://stackoverflow.com/comment/37390658
tagged with: hashmap

http://stackoverflow.com/comment/37476830
type: Comment
type: AnswerComment
has text: Btw on that question I have no idea if the answer was right for you. Just nice to hear some feedback. :) Give me a moment.
comment on: http://stackoverflow.com/a/24259425
score: 0

http://stackoverflow.com/comment/48606516
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24147057
type: Comment
has text: Is this question answered? Is the problem solved?

http://stackoverflow.com/comment/37534237
type: Comment
comment on: http://stackoverflow.com/a/24200348
type: AnswerComment
has text: Sorry I took so long. This is not quite what I was hoping for, but it looks like a feasible way to work around what I'm now certain is a major bug in Nimbus. Thank you for your effort!
score: 0

http://stackoverflow.com/a/24198089
score: 2
has body: Use the \u escape character, which stands for unicode: String tamil = "This is Tamil: \u0b9a\u0bcd\u0b99\u0bcd" + "\u0b95\u0baa\u0bcd......" Now, note; I converted your values to hexadecimal, as this is required instead of base-10.
answers question: http://stackoverflow.com/q/24198004
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37358762
has comment: http://stackoverflow.com/comment/37359004
has comment: http://stackoverflow.com/comment/37359285
type: Answer

http://stackoverflow.com/comment/37442170
has text: Yes, you cannot tell. I should be RARing all the files out-of-workspace. I don't understand why ADT has to make non related files to 0bytes. Very sad.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24241360
score: 0

http://stackoverflow.com/comment/37486852
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24265383
has text: I recommend to read "Installation instructions" section on this page: http://maven.apache.org/download.cgi It helps you to setup maven properly on your machine!
type: Comment

http://stackoverflow.com/comment/37749656
score: 0
has text: @kriegaex Ok bounty hunter, added a new one.
comment on: http://stackoverflow.com/q/24206634
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24170857
score: 4
has comment: http://stackoverflow.com/comment/68829288
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24170595
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37307429
has body: I am not sure that you understand how a CountDownLatch works. The countDown() method and the await() method are generally called in separate threads. From the Java8 JavaDoc for CountDownLatch: A CountDownLatch is initialized with a given count. The await methods block until the current count reaches zero due to invocations of the countDown() method, after which all waiting threads are released and any subsequent invocations of await return immediately. This is a one-shot phenomenon -- the count cannot be reset. If you need a version that resets the count, consider using a CyclicBarrier. In your current code, you have a countdown of 1 for your latch (from the first line of your example new CountDownLatch(1);). In both locations that you are calling await(), you are immediately prior calling countDown(), which is causing the countdown of your latch to reach 0 (or even less). Thus, any calls to await() will not even block, since the countdown has already been reached. It is not immediately clear to me what you are trying to accomplish, but if you give more details, I may be able to provide further advice.
has comment: http://stackoverflow.com/comment/37307809
has comment: http://stackoverflow.com/comment/37307756
type: Answer
answers question: http://stackoverflow.com/q/24170595

http://stackoverflow.com/a/24161037
has body: Method b() shouldn't commit at all, the commit() should only be allowed after everything is done. You should modify your scenario to: function a(){ create savepoint s1 insert x1 insert x2 b() insert x4 if we get an error rollback to s1 else commit. } function b(){ create savepoint s2 insert x3 if we get an error rollback to s2 } The only difference is the remove of the commit branch in b(). The Connection will maintain savepoint s2 until the rollback to s1 or the commit. Be aware that if function a() itself is also part of a larger transaction, the else commit there should be removed as well. If a() is the start of the transaction, then you should just rollback (not rollback to s1). Response to comment If you want these to be independently callable, or composable, then I'd suggest you use some form of a transaction manager that you pass into the method call. Say something along the lines of interface TransactionManager() { void commit(); void rollback(); TransactionManager subTransaction(); } class RootTransactionManager() implements TransactionManager { private final Connection connection; RootTransactionManager(Connection connection) { this.connection = connection; } public void commit() { connection.commit(); } public void rollback() { connection.rollback(); } public TransactionManager subTransaction() { return new SubTransactionManager(this); } Connection getConnection() { return connection; } } class SubTransactionManager implements TransactionManager() { private final RootTransactionManager manager; private final SavePoint savePoint; SubTransactionManager (RootTransactionManager manager) { this.manager = manager; savePoint = manager.getConnection().setSavePoint(); } public void commit() { // do nothing (semantics of Connection.releaseSavePoint not useful for nesting) } public void rollback() { connection.rollback(savePoint); } public TransactionManager subTransaction() { return new SubTransactionManager(manager); } } You can use this to implement your methods …
upvote count: 1
score: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37288265
answers question: http://stackoverflow.com/q/24160748

http://stackoverflow.com/comment/37347253
score: 0
has text: *I know about the list hierarchy, interfaces and inheritance, but I am not sure how it applies in this situation.* It doesn't apply in this case because your not using any of that. It's about raw/parameterised type. The type-safety is off in the 1st and on in the 2nd.
type: QuestionComment
comment on: http://stackoverflow.com/q/24192297
type: Comment

http://stackoverflow.com/q/24254210
has comment: http://stackoverflow.com/comment/37466167
upvote count: 9
tagged with: javac
has comment: http://stackoverflow.com/comment/37466158
tagged with: java
has title: Strange generics behaviour. Being erased early?
accepted answer: http://stackoverflow.com/a/24255174
tagged with: type-erasure
has body: I ran into some strange behaviour of Java generics today. The following code compiles fine and works as you would expect: import java.util.*; public class TestGeneric { public static void main(String[] args) { GenericClass&lt;Integer&gt; generic = new GenericClass&lt;Integer&gt;(7); String stringFromList = generic.getStringList().get(0); } static class GenericClass&lt;A&gt; { private A objA; private List&lt;String&gt; stringList; GenericClass(A objA) { this.objA = objA; stringList = new ArrayList&lt;String&gt;(); stringList.add("A string"); stringList.add("Another string"); } A getObjA() { return objA; } List&lt;String&gt; getStringList() { return stringList; } } } but if you change the type of the variable generic to GenericClass (note no type parameters) compilation fails with the message "incompatible types: java.lang.Object cannot be converted to java.lang.String". This issue seems to happen with any generic class that contains a generic object with a concrete type parameter. A few Google searches haven't turned up anything and the JLS mentions nothing about this scenario? Am I doing something wrong or is this a bug in javac?
tagged with: generics
has comment: http://stackoverflow.com/comment/37466105
has answer: http://stackoverflow.com/a/24255174
possible better answer: http://stackoverflow.com/a/24255762
score: 9
type: Question
has comment: http://stackoverflow.com/comment/37467801
has answer: http://stackoverflow.com/a/24255762
answer count: 2
has comment: http://stackoverflow.com/comment/37466605
downvote count: 0
has comment: http://stackoverflow.com/comment/37976982
has comment: http://stackoverflow.com/comment/37466257
favorite count: 0
has comment: http://stackoverflow.com/comment/37466095
type: AnsweredQuestion

http://stackoverflow.com/comment/37435113
type: Comment
comment on: http://stackoverflow.com/q/24238240
type: QuestionComment
has text: You are asking for 4 digits, then up to nine digits, and another 4 digits - and thats what you have in the "failing" case. Therefore, the middle 5 digits are replaced. Do you need to have 8 digits to be masked?
score: 0

http://stackoverflow.com/a/24155678
has body: You could use the regexp Pattern.compile("query_name_[0-9]+.*?\{.*?\}",Pattern.DOTALL); This combines greedy matching and the fact that this way the . will match new characters also
type: Answer
answers question: http://stackoverflow.com/q/24155520
score: 0

http://stackoverflow.com/comment/37294467
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24164014
has text: I don't think Spring Boot does that (not in any of the samples I tried anyway). Maybe you can share a minimal project that has these headers in the responses?
type: Comment

http://stackoverflow.com/comment/37352213
type: QuestionComment
comment on: http://stackoverflow.com/q/24194794
has text: override `paintComponent()` instead of `paint()` and don't forget to call `super.paintComponent()` in the overridden method.
score: 1
type: Comment

http://stackoverflow.com/comment/37330771
type: QuestionComment
has text: @Ranjith I still have the problem but i don't get the anymore, i now get a empty line
score: 0
comment on: http://stackoverflow.com/q/24182150
type: Comment

http://stackoverflow.com/comment/37273511
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24135173
has text: Every user is different ;)

http://stackoverflow.com/comment/37409509
type: QuestionComment
has text: `for /d %A in (c:\users\*) do del "%A\AppData\Local\Microsoft\Windows\Temporary Internet Files" /s /q`
comment on: http://stackoverflow.com/q/24211206
score: 0
type: Comment

kill-process
tags question: http://stackoverflow.com/q/24152843
type: Tag
tag name: kill-process

http://stackoverflow.com/a/24107872
has comment: http://stackoverflow.com/comment/37194735
accepted answer of: http://stackoverflow.com/q/24107581
has comment: http://stackoverflow.com/comment/37200012
has comment: http://stackoverflow.com/comment/37194728
has body: Better you should stick to the method which you have adopted. You should traverse the entire String using the for-loop. I think the code must be like this :- public class EmailValid { public static void main (String[] args) { System.out.print("Please Enter Your Email To Validate: "); Scanner input = new Scanner (System.in); String email = input.nextLine(); boolean flag=false; int countr=0,countd=0; loop:for (int i=0; i &lt; email.length();i++) { //Better to iterate loop till end of the String "email" if(email.charAt(i)=='@'){ countr++; if(countr&gt;1){ flag=false; break loop; } if(i&gt;=1) flag=true; else{ flag=false; break loop; } } if(email.charAt(i)=='.'){ countd++; if(countd&gt;1){ flag=false; break loop;} if(i&gt;=3) flag=true; else{ flag=false; break loop;} if(email.length()&gt;=i+3) flag=true; else{ flag=false; break loop;} } if((email.indexOf(".")-email.indexOf("@"))&gt;=2) { flag=true;} else { flag=false; break loop;} if(((int)email.charAt(i))&gt;=65 &amp;&amp; ((int)email.charAt(i))&lt;=90) flag=true; else if(((int)email.charAt(i))&gt;=97 &amp;&amp; ((int)email.charAt(i))&lt;=122) flag=true; else if(((int)email.charAt(i))&gt;=48 &amp;&amp; ((int)email.charAt(i))&lt;=57) flag=true; else if(((int)email.charAt(i))==64 || ((int)email.charAt(i))==46) flag=true; else flag=false; //@ must at least have a char before itself and also there must be a character between '@' and '.'--So mininmum index of '@' &gt;=1 and for '.' &gt;=3. if(flag==false) break loop; } if(flag==true &amp;&amp; email.length()&gt;=5) // The minimum length of the String must be equal to minimum index of '.' +2, i.e., &gt;=5. System.out.println("Validated"); else System.out.println("Invalid Email"); } }
type: Answer
has comment: http://stackoverflow.com/comment/37188843
has comment: http://stackoverflow.com/comment/37200213
has comment: http://stackoverflow.com/comment/37198967
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/37189117
answers question: http://stackoverflow.com/q/24107581
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37190003
has comment: http://stackoverflow.com/comment/37195163

http://stackoverflow.com/a/24216719
type: AcceptedAnswer
has body: Alright I have figured out a better way to do it, which involves some linear interpolation. The following still remains the same: //ship heading (already calculated) Vector3f heading /* = ... */; heading.normalize(); //direction of enemy ship relative to ours Vector3d direction = new Vector3f(enemy.x - ship.x, enemy.y - ship.y, enemy.z - ship.z); direction.normalize(); //angle between vectors float angle = heading.angle(direction); Now I calculate the percent of heading vector to be interpolated to the direction vector: //calculate angle to rotate float deltaRotation = rotationVelocity * deltaTime; //calcuate percent of rotation float percent = Math.min(deltaRotation / angle, 1.0f); //create interpolated vector representing the new forward direction Vector3f inter = new Vector3f(heading.x + percent * (direction.x - heading.x), heading.y + percent * (direction.y - heading.y), heading.z + percent * (direction.z - heading.z)); inter.normalize(); Now we can create the new rotation matrix: //the object's default forward size without any transformations Vector3f forward = new Vector3f(0.0f, 0.0f, 1.0f); //rotation axis Vector3f axis = new Vector3f(); axis.cross(forward, inter); axis.normalize(); //New rotation matrix to be applied Matrix4f rotationMatrix = new Matrix4f(); rotationMatrix.setIdentity(); rotationMatrix.setRotation(new AxisAngle4f(axis, forward.angle(inter))); Now my ship always faces the correct direction! :)
type: Answer
answers question: http://stackoverflow.com/q/24175128
score: 0
accepted answer of: http://stackoverflow.com/q/24175128

http://stackoverflow.com/q/24193487
tagged with: scheduled-tasks
has answer: http://stackoverflow.com/a/24202647
has answer: http://stackoverflow.com/a/24199450
type: Question
has title: J2EE sending scheduled emails using JMS queue
tagged with: jakarta-ee
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37350246
has answer: http://stackoverflow.com/a/24205576
has comment: http://stackoverflow.com/comment/37372207
score: 0
has body: I need to create J2EE application, that uses JMS queue to asynchronously send emails, that can be scheduled to be sent later. I already created bean, that sends message with email data and MessageDriven bean, which listens for those messages and sends email, onMessage. Right now, I have no idea how to implement scheduling. I was thinking of some TimerTasks like I did in Java before, but I'm not sure if I can do that in J2EE. Any advices how to do this?
answer count: 3
tagged with: java
tagged with: email
tagged with: jms

http://stackoverflow.com/a/24264329
has body: You can use volatile sharing resource like a int variable and let first thread start writing, once done change the int resource to 2 so that 2nd thread can start writing. once done, change the volatile variable value to 3. So third thread can start. Each thread should have a while() loop, continuously trying to write until a specific value is set in shared volatile variable.
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24264167

http://stackoverflow.com/comment/37399131
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24218671
has text: OKay, Cheers.. Keep Smiling.. :)

http://stackoverflow.com/q/24231990
has title: Jersey servlet returns zip file that contains more bytes than response sent
type: UnansweredQuestion
tagged with: servlets
tagged with: http://stackoverflow.com/tag/zip
score: 0
tagged with: servlet-container
tagged with: java
has answer: http://stackoverflow.com/a/24233109
answer count: 1
has body: I'm trying to implement a simple servlet that returns a zip file that is bundled inside the application (simple resource) So I've implemented the following method in the server side: @GET @Path("{path}/{zipfile}") @Produces("application/zip") public Response getZipFile( @PathParam("path") String pathFolder, @PathParam("zipfile") String zipFile) IOException { String fullPath= String.format("/WEB-INF/repository/%s/%s", pathFolder, zipFile); String realPath = ServletContextHolder.INSTANCE.getServletContext() .getRealPath(fullPath); File file = new File(realPath ); ResponseBuilder response = Response.ok((Object) file); return response.build(); } When I call this method from the borwser, the zip file is downloaded and its size is the same number of bytes as the original zip in the server. However, when I call this using a simple XMLHttpRequest from my client side code: var oXHR = new XMLHttpRequest(); var sUrl = "http://localhost:8080/path/file.zip" oXHR.open('GET', sUrl); oXHR.responseType = 'application/zip'; oXHR.send(); I can see in the Network tab of the Developer tools in chrome that the content size is bigger, and I'm unable to process this zip file (for instance JSzip doesn't recognize it). It seems like somewhere between my response and the final response from org.glassfish.jersey.servlet.ServletContainer, some extra bytes are written/ some encoding is done on the file. Can you please assist? Best Regards, Maxim
type: Question
tagged with: jersey

http://stackoverflow.com/comment/37386037
type: Comment
has text: Do you have teamview? Im sure its really easy but its gonna take a lot longer to explain over stack overflow :S
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24192157

http://stackoverflow.com/comment/37392212
score: 1
has text: To be honest, even if you used a connected line primitive like `GL_LINE_STRIP`, you could still probably collapse this into a single draw call. It would just require a little bit more sophistication in the order you draw the lines.
comment on: http://stackoverflow.com/q/24215500
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24240353
accepted answer of: http://stackoverflow.com/q/24238651
score: 1
answers question: http://stackoverflow.com/q/24238651
type: Answer
has body: You can always query couchdb for a dataset that is small enough for your java program, so there should be no reason to replicate subsets to smaller databases. See this stackoverflow answer for a way to get paged results from couchdb. You might even employ couchdb itself for the processing with map/reduce, but that depends on your problem.
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/24233274
has comment: http://stackoverflow.com/comment/37495139
has comment: http://stackoverflow.com/comment/37425475
has comment: http://stackoverflow.com/comment/37425396
tagged with: character
has body: I am using Jsoup to parse html documents in a project i created in Netbeans. The html pages i parse are in Greek, UTF-8, and i have to identify some elements that contain specific Greek strings. This works well when i test the program in Netbeans: Element element = record.select("td:containsOwn(διαθέσιμο)").first(); However, when I build a jar file and run it from the windows 7 command prompt, the program fails to find the element with the greek characters! Netbeans encoding is set to UTF-8. I am using JRE 1.7.0 when i run from the cmd. Netbeans is using JDK 1.7
tagged with: netbeans
tagged with: jsoup
answer count: 0
has comment: http://stackoverflow.com/comment/37425465
type: UnansweredQuestion
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37425578
downvote count: 1
has title: Java international characters not recognized when compiled
favorite count: 0
has comment: http://stackoverflow.com/comment/37494275
has comment: http://stackoverflow.com/comment/37425334
type: Question
linked to: http://stackoverflow.com/q/23904391
linked to: http://stackoverflow.com/q/23902098

http://stackoverflow.com/comment/37257918
score: 0
comment on: http://stackoverflow.com/q/24144706
type: QuestionComment
type: Comment
has text: try queryForList which will return you a Map object

http://stackoverflow.com/a/24149948
score: 11
has comment: http://stackoverflow.com/comment/37313128
answers question: http://stackoverflow.com/q/24149834
type: Answer
has comment: http://stackoverflow.com/comment/37341600
has body: In practice, it can be difficult to find the optimal number of threads and even that number will likely vary each time you run the program. So, theoretically, the optimal number of threads will be the number of cores you have on your machine. If your cores are "hyper threaded" (as Intel calls it) it can run 2 threads on each core. Then, in that case, the optimal number of threads is double the number of cores on your machine. Also, what causes the logic that the more threads allocated, i.e. more being able to be done at once, to be incorrect? The reason that as more threads are allocated leads to more work being done concurrently is false because only 1 (or 2 threads if the cores are "hyper threaded") can run at a single time on each core. So assume I have a quad core machine that is not hyper threaded. In that case, i can run up to 4 threads concurrently. So, my maximum throughput should be achieved with 4 threads. Say if I try to run 8 threads on the same setup. In this case, the kernel would schedule these threads back and forth (by way of a context switch), and would block one thread in order to let another thread run. So, at most, the work of 4 threads can be run at a single time. For more information on this, it would be extremely helpful to look up "context switch" with a Linux kernel. That will provide you with all the information you ever wanted on this subject. Also, note that there is a difference between threads called "user level threads" and "kernel level threads". This is an important distinction if you research this topic further, but it is outside the scope of this question.
has comment: http://stackoverflow.com/comment/37309996
has comment: http://stackoverflow.com/comment/37313382
upvote count: 11
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37310043
downvote count: 0
has comment: http://stackoverflow.com/comment/37313312
accepted answer of: http://stackoverflow.com/q/24149834
has comment: http://stackoverflow.com/comment/37307620

http://stackoverflow.com/comment/37208499
type: Comment
comment on: http://stackoverflow.com/q/24116813
type: QuestionComment
score: 0
has text: There are specialized versions of `Arrays.sort()` that work on different kinds of arrays of primitive types, including one that works on `int[]`. No need to use an `Integer[]`.

http://stackoverflow.com/comment/37481276
has text: Usually this is done with a logging library. Each such library provides the functionality to define several appenders and write log info to all of them. So your log entries are written to the file _and_ the console. You really should use such a logging library.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24262556
score: 0

rabbitmq
tags question: http://stackoverflow.com/q/24132416
tags question: http://stackoverflow.com/q/24137598
tag name: rabbitmq
tags question: http://stackoverflow.com/q/24266495
type: Tag

http://stackoverflow.com/comment/37406635
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24223440
has text: You are multiplying and dividing by integers which will overflow at some point.
score: 3

http://stackoverflow.com/q/24128353
has answer: http://stackoverflow.com/a/24128879
tagged with: jsf
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37228008
has comment: http://stackoverflow.com/comment/37228339
tagged with: itext
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24130148
has comment: http://stackoverflow.com/comment/37230632
type: Question
has body: I have a problem downloading a pdf file, I get it from Database (Sql Server 2008 R2), the data is of type image in BD, but I capture in a blob and then turn it into byte array. But to transform it into a StreamedContent to download the pdf file goes corrupted and I can not open it. Code Java DaoImpl: @Transactional(readOnly=true) @Override public DetalleSolicitudBean obtenerDocumentoImg(DetalleSolicitudBean detalle) throws Exception { StringBuilder sql = new StringBuilder(); sql.append("SELECT iCorImagen, siCodMun, iCodDocumento, "); sql.append("vNomArcDig, imgImagen "); sql.append("FROM GAImgDocumento "); sql.append("WHERE iCodDocumento = ? AND siCodMun = ? "); List&lt;DetalleSolicitudBean&gt; lista = jdbcTemplateImgDoc.query(sql.toString(), new Object[] { detalle.getIcodDocumento(), detalle.getSiCodMun() }, new RowMapper&lt;DetalleSolicitudBean&gt;() { public DetalleSolicitudBean mapRow(ResultSet rs, int rowNum) throws SQLException { DetalleSolicitudBean det = new DetalleSolicitudBean(); det.setIcodImagen(rs.getShort("iCorImagen")); det.setSiCodMun(rs.getShort("siCodMun")); det.setIcodDocumento(rs.getInt("iCodDocumento")); det.setVnomArcDig(rs.getString("vNomArcDig")); Blob blob = rs.getBlob("imgImagen"); byte[] imagen = blob.getBytes(1L, (int) blob.length()); det.setImgImagen(imagen); return det; } }); } Code Java Controller: private StreamedContent file; --------------------------------------- DetalleSolicitudBean detalle = new DetalleSolicitudBean(); detalle.setIcodDocumento(Integer.valueOf(codigoDocumento)); detalle.setSiCodMun(Constantes.CODIGO_MUNICIPALIDAD); DetalleSolicitudBean imagenDocSolicitud = iSolicitudService.obtenerDocumentoImg(detalle); if(imagenDocSolicitud == null){ addWarnMessage(null, getMessage("solicitudes.form.valAdjDocAsociado")); }else{ InputStream stream = null; try { String nameFile = imagenDocSolicitud.getVnomArcDig(); stream = new ByteArrayInputStream(imagenDocSolicitud.getImgImagen()); file = new DefaultStreamedContent(stream, "appli…
has comment: http://stackoverflow.com/comment/37227878
tagged with: primefaces
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has title: Pdf corrupted when downloading from BD in Primefaces?

http://stackoverflow.com/q/24189408
answer count: 4
has title: java - making sure only one thread initializes object
type: Question
has comment: http://stackoverflow.com/comment/37341667
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37341285
accepted answer: http://stackoverflow.com/a/24189749
has answer: http://stackoverflow.com/a/24189745
has answer: http://stackoverflow.com/a/24189749
has answer: http://stackoverflow.com/a/24191109
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37341355
score: 0
has comment: http://stackoverflow.com/comment/37341381
has body: I have a small issue with making sure initialization of the object is done by one thread and only once i.e. given below code snippet: AtomicBoolean initialize = new AtomicBoolean(); CountDownLoatch latch = new CountDownLatch(1); void init(){ if(initialize.compareAndSwap(false,true)) { someMethod() // this can throw some exception latch.countDown(); } else{ latch.await(); } } I could wrap the countdown in finally block as now the thread mnight get stuck if exception happens. However, even with finally block, the thread will get released and the system will be in an uninitiatlized state. Is there a pattern to follow to get this right?
has answer: http://stackoverflow.com/a/24190323
tagged with: java
possible better answer: http://stackoverflow.com/a/24189745
has comment: http://stackoverflow.com/comment/37341684

http://stackoverflow.com/comment/37349738
type: QuestionComment
comment on: http://stackoverflow.com/q/24193354
has text: It's not strictly necessary to include the 'override' keyword when the trait doesn't provide an default implementation of the value or function in its contract.
type: Comment
score: 1

http://stackoverflow.com/comment/37289428
score: 0
comment on: http://stackoverflow.com/a/24161841
has text: @ MadProgrammer +1 just for showing the animation! It looks exactly like what I want to do. I will try out your example code and see if it works in my program.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37393351
has text: stop the forEach loop, execute the following code
comment on: http://stackoverflow.com/q/24216205
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/84122403
score: 0
comment on: http://stackoverflow.com/q/24219229
type: Comment
type: QuestionComment
has text: @kevinsa5 and what if the server is a Java server, would it run then?

http://stackoverflow.com/q/24223675
answer count: 1
downvote count: 0
tagged with: web-applications
has answer: http://stackoverflow.com/a/24224051
has body: I'm looking for some help about Dart Language. I'm not a professional developer, so I don't know all the resources of many languages, except for Java, with which I'm developing a small "World Cup TOP 5" web application where the user can select five teams and then publish the selection on its Facebook timeline. Right now, in Java code, the application is doing its job. It's loading the default image background and using Graphics2D.drawImage to add the teams' PNGs over it. Then, it saves the finished file in a temporary directory and publishes it on Facebook. However, I read some articles saying that Dart can do all the job for me, not just the frontend. So, my question is: how can I do that in Dart?
type: Question
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24224051
tagged with: dart
tagged with: java
favorite count: 0
has title: Image manipulation and storing in Dart
upvote count: 2

http://stackoverflow.com/a/24146460
upvote count: 1
has comment: http://stackoverflow.com/comment/37261342
answers question: http://stackoverflow.com/q/24146305
type: Answer
has comment: http://stackoverflow.com/comment/37261763
accepted answer of: http://stackoverflow.com/q/24146305
has comment: http://stackoverflow.com/comment/37261836
has comment: http://stackoverflow.com/comment/37263451
score: 1
type: AcceptedAnswer
has body: I agree with rcook's answer, but if you REALLY want to stick with FileUtils, here's an alternative: get all the files, then remove the ones that match the extensions. List&lt;File&gt; all = (List&lt;File&gt;) FileUtils.listFiles(folder, null, true); List&lt;File&gt; unwanted = (List&lt;File&gt;) FileUtils.listFiles(folder, extensions, true); all.removeAll(unwanted); return all; Note this is a bit wasteful, involving two recursions through the filesystem.
downvote count: 0

http://stackoverflow.com/a/24122357
answers question: http://stackoverflow.com/q/24107507
type: Answer
score: 0
has body: You can find this checkbox by CSS using: [id*='onlineCheckbox3']. As Richard stated, you must click the category to show the element first. Find this by: [id=dimensions]&gt;ul&gt;li:nth-child(9) a. Sometimes clicking an a doesn't work (depending on the html structure), and you must click an element inside the anchor, swap that out for span and it should work. I prefer all CSS selectors when locating elements, but you can use whichever method you prefer.

http://stackoverflow.com/q/24118426
has body: i have problem with session close what impact during running this application and what if this goes in production. i faceting two problem in my production server its consume lots off memory during application usage around 800MB to just start up. after some time its give an outofmemory error and server crashes i am using tomcat server for deploy my application my code is this @Transactional public Collection list(String queryString, Object[] value) throws Exception { Session session = this.sessionFactory.getCurrentSession(); Query query = session.createQuery(queryString); return query.list(); } @Transactional public Collection list(String queryString, Object[] value) throws Exception { Session session = this.sessionFactory.openSession(); Query query = session.createQuery(queryString); return query.list(); } if i do close the session then lazy initialization gives an error for session is already closed. please help me to come out this problem. How we can take care about open session in hibernate with spring configuration i am using hibernate 3.6.1 and spring 3.0.6.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24118494
has comment: http://stackoverflow.com/comment/37209072
has answer: http://stackoverflow.com/a/24118494
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37208918
has comment: http://stackoverflow.com/comment/37209011
has comment: http://stackoverflow.com/comment/37209357
has title: how to managing hibernate session in spring
downvote count: 0
answer count: 1
upvote count: 1
tagged with: hibernate-session
tagged with: spring
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/37208851
type: Question

http://stackoverflow.com/comment/37353603
type: Comment
score: 0
type: AnswerComment
has text: Is values-v14 required or can I have an ordinary folder called values?
comment on: http://stackoverflow.com/a/24194313

http://stackoverflow.com/q/24243055
score: 4
has comment: http://stackoverflow.com/comment/37448703
possible better answer: http://stackoverflow.com/a/24245777
has comment: http://stackoverflow.com/comment/37450312
type: AnsweredQuestion
has body: Problem Statement: Say I have a expression (a + b + c), and I want to calculate its value and assign to some variable. Later I want use that variable value in some other logic. This is all done through MVEL. Issue is if anyone out of (a,b,c) is null, MVEL evaluates in a string format. So to avoid this, I created my own function to pass each object and if it is null, make it zero. Sample code below public class MvelTest { public static void main(String[] args) { Map map = new HashMap(); VariableResolverFactory functionFactory = new MapVariableResolverFactory(map); MVEL.eval("checkNullValue = def (x) { x == null ? 0 : x };", functionFactory); map.put("a", null); map.put("b", 1); map.put("c", 1); Serializable str = MVEL.compileExpression("( ( checkNullValue(a) + checkNullValue(b) + checkNullValue(c) ) &gt; 2 ) ? d=2 : d=3"); MVEL.executeExpression(str, map, functionFactory); System.out.println(map); System.out.println(map.get("d")); } } Output {checkNullValue=function_prototype:null, b=1, c=1, a=null} null I am not able to get value of "d" here, and if I remove factory and null check function it behaves and I am able to get the value of "d". But I have to make it null safe for arithmetic operation, Since MVEL cannot handle this. Also (null * 23), MVEL returns as false.
tagged with: java
accepted answer: http://stackoverflow.com/a/24256506
has answer: http://stackoverflow.com/a/24256506
favorite count: 0
upvote count: 4
has comment: http://stackoverflow.com/comment/37444109
type: Question
tagged with: drools
has answer: http://stackoverflow.com/a/24245777
answer count: 2
downvote count: 0
tagged with: mvel
has title: Mvel evaluation

http://stackoverflow.com/q/24216470
has title: Where is the response supposed to appear for this HTML post?
score: 0
tagged with: html-post
has answer: http://stackoverflow.com/a/24217820
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: So im practicing with this code from here and i was wondering where the result returns to? For example, i purposely change the url to make it invalid, and i don't see a response with Did not work! anywhere. I looked at the console, logcat, and no sign of any indicator of if the post was successful or not. How can i find this out? Thanks! public class MainActivity extends Activity implements OnClickListener { TextView tvIsConnected; EditText etName,etCountry,etTwitter; Button btnPost; Person person; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get reference to the views tvIsConnected = (TextView) findViewById(R.id.tvIsConnected); etName = (EditText) findViewById(R.id.etName); etCountry = (EditText) findViewById(R.id.etCountry); etTwitter = (EditText) findViewById(R.id.etTwitter); btnPost = (Button) findViewById(R.id.btnPost); // check if you are connected or not if(isConnected()){ tvIsConnected.setBackgroundColor(0xFF00CC00); tvIsConnected.setText("You are conncted"); } else{ tvIsConnected.setText("You are NOT conncted"); } // add click listener to Button "POST" btnPost.setOnClickListener(this); } public static String POST(String url, Person person){ InputStream inputStream = null; String result = ""; try { // 1. create HttpClient HttpClient httpclient = new DefaultHttpClient(); // 2. make POST request to the given URL HttpPost httpPost = new HttpPost(url); String json = ""; // 3. build jsonObject JSONObject jsonObject = new JSONObject(); jsonObject.accumulate("name", person.getName()); jsonObject.accumulate("country", person.getCountry()); jsonObject.accumulate("twitter", person.getTwitter()); // 4. convert JSONObject to JSON to String json = jsonObject.toString(); // ** Alternative way to convert Person object to JSON string usin Jackson Lib // ObjectMapper mapper = new ObjectMapper(); // json = mapper.writeValueAsString(person); // 5. set json to StringEntity StringEnt…
tagged with: post
type: Question
has comment: http://stackoverflow.com/comment/37394292
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/comment/37323028
comment on: http://stackoverflow.com/q/24179497
score: 5
has text: @RakibulHasan Java is not pure-OOP my friend...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24116521
tagged with: spring-mvc
answer count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37208230
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/24122000
possible better answer: http://stackoverflow.com/a/24118276
favorite count: 0
has answer: http://stackoverflow.com/a/24122000
type: Question
has body: I'm working on refactoring an old web application. In this new version I'm using Spring 3.x and I'd like to rethink the whole part of application settings. In the old application I used a custom approach using a DB table and a dedicated DAO. I need to change system settings at runtime, so I think properties files are not the right choiche. I'm also considering java.util.prefs API. Can you suggest a common approach to this issue? Is there some utility in Spring to address this problem?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37207648
has title: Handling application settings in Spring MVC project
tagged with: spring
tagged with: settings
has answer: http://stackoverflow.com/a/24118276

http://stackoverflow.com/comment/37290571
comment on: http://stackoverflow.com/a/24161993
type: Comment
has text: OK, thanks, I've done so, but now I get a new error message which says: "Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: variable salary location: class classvariables.ClassVariables at classvariables.ClassVariables.main(ClassVariables.java:54) Java Result: 1". The point of this exercise (which comes from Tutorial Point) is to learn how to use class/static variables...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37214955
score: 0
has text: their `replace()` uses their `replaceAll()`. What is wrong there? Why duplicating the code for replacement?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24121793

http://stackoverflow.com/comment/37291275
type: Comment
comment on: http://stackoverflow.com/a/24160666
score: 0
has text: Are u sure? Did u try this code on practice? Cause I implement right the same. And the outputstream comes from server and the inputstream comes to client. And one device is always client and another is server... anyway if u have links of working code I would be grateful!
type: AnswerComment

actionscript
tag name: actionscript
type: Tag
tags question: http://stackoverflow.com/q/24251208

http://stackoverflow.com/q/24209003
has comment: http://stackoverflow.com/comment/37380039
tagged with: java
tagged with: lucene
tagged with: eclipse
tagged with: filepath
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/24211394
accepted answer: http://stackoverflow.com/a/24211394
downvote count: 0
has body: I have a problem I´m working with PDFTextStream and Lucene to index pdf files. The problem is a build a text with the methods of PDFTextStream but I can't get the filepath of the documents stored in the directory where I am indexing the files, I have tried with: setFieldName(file.getPath(),"path"); but I can´t get the file path. Any suggestions? This is my code: public class PDFDocument { //Constructor vacío IndexWriter writer; File directorio; public PDFDocument(){ directorio= new File("C:/indexpdf"); } /*Metódo estático para agregar un documento PDF a un IndexWriter de Lucene * pasando como parámetros IndexWriter, y el archivo PDF */ public void agregarPDFaIndex() throws IOException{ writer= new IndexWriter(new File("C:/indexpdfsalida"), new StandardAnalyzer(), true); //Se crea e inicializa una nueva instancia de DocumentFactoryCofig DocumentFactoryConfig config= new DocumentFactoryConfig();; config.setCopyAllPDFAttrs(false); //los datos del documento PDF se almacenan, se tokenizan y se indexan config.setPDFAttrSettings(true, true, true); /*Se configuran los nombre explicitos que deben ser usados en los Fields * que crean una nueva instancia de un Document de Lucene * */ File[] files= directorio.listFiles(); for(File file: files){ if(file.canRead() &amp;&amp; !file.isDirectory() &amp;&amp; file.getName().endsWith(".pdf")){ System.out.println("Indexando el archivo: "+file.getAbsolutePath()); config.setMainTextFieldName("content"); Document doc= new Document(); config.setTextSettings(false, true, true); config.setFieldName(PDFTextStream.ATTR_AUTHOR, "autor"); config.setFieldName(PDFTextStream.ATTR_CREATION_DATE, "fecha_creacion"); config.setFieldName(PDFTextStream.ATTR_MOD_DATE,"ultimo_mod"); config.setFieldName(PDFTextStream.ATTR_TITLE,"titulo"); config.setFieldName(DocumentFactoryConfig.DEFAULT_MAIN_TEXT_FIELD_NAME, "content"); config.setFieldName(PDFTextStream.ATTR_CREATOR,"creador"); config.setFieldName(PDFTextStream.ATTR_PRODUCER, "productor"); config.setFieldN…
answer count: 1
has title: How the get the filepath of a document in setFieldName of PDFTextStream?
favorite count: 0
type: Question
tagged with: indexing
score: 3

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/24181388
tags question: http://stackoverflow.com/q/24219929
tags question: http://stackoverflow.com/q/24135287
tag name: android-actionbar
tags question: http://stackoverflow.com/q/24209202
tags question: http://stackoverflow.com/q/24152038
tags question: http://stackoverflow.com/q/24137769

jspinner
tags question: http://stackoverflow.com/q/24226027
type: Tag
tag name: jspinner
tags question: http://stackoverflow.com/q/24199636

http://stackoverflow.com/a/24131229
answers question: http://stackoverflow.com/q/24130912
type: Answer
has body: Have a look here. Move the cursor (rs.next) before doing this: String passwd = rs.getString("password"); And please close your result sets!
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/37350681
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24192416
has text: Please show with wich values you call this function.
score: 0

http://stackoverflow.com/comment/37483556
has text: I'm curious... Why do you want to do this?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24263779
type: QuestionComment

http://stackoverflow.com/q/24203911
downvote count: 1
type: Question
score: 3
tagged with: resultset
tagged with: java
tagged with: jdbc
has body: What does executeQuery(String sql) return when there are no entries in the table? And I want to know that executeQuery method return type is ResultSet. Then after execution of query, what executeQuery return to ResultSet reference variable. Will it return null or something else?
favorite count: 0
has answer: http://stackoverflow.com/a/24203958
upvote count: 4
has answer: http://stackoverflow.com/a/24474586
has comment: http://stackoverflow.com/comment/37369290
answer count: 2
type: UnansweredQuestion
has title: What does Statement.executeQuery() return for a SELECT statement

http://stackoverflow.com/comment/37419092
comment on: http://stackoverflow.com/q/24228467
type: Comment
score: 0
type: QuestionComment
has text: And, say you kill off java.exe Then, When you run Eclipse, does it create an instance of java.exe? Same question with ApacheDS. When you kill off java.exe then run ApacheDS, does it launch java.exe ?

http://stackoverflow.com/comment/37486469
score: 0
has text: @Kabulan0lak yeah, I was saving that as a last resort, but yeah I might do that in the end, Thx
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24265110

http://stackoverflow.com/comment/37765354
type: Comment
type: QuestionComment
has text: I printed out SQL by batching 1 vs batching 8 - there is no difference in the insert statements - yet the batching 8 fails. And I take the same inserts and insert manually and no problem.
comment on: http://stackoverflow.com/q/24195035
score: 0

http://stackoverflow.com/a/24224700
accepted answer of: http://stackoverflow.com/q/24224666
has comment: http://stackoverflow.com/comment/37409235
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24224666
has body: Quite simply, it's because you don't step back! position.setLocation(pos.x + directions[i].x, pos.y + directions[i].y); RandStep(position); Should be something like: position.setLocation(pos.x + directions[i].x, pos.y + directions[i].y); RandStep(position); position.setLocation(pos.x - directions[i].x, pos.y - directions[i].y); As a bit of intuition, think about what happens in the base case of recursion. all tiles around you are visited, and you are at a dead end. That situation looks like: _ | | |x| (x = "you are here") Then, position.setLocation(pos.x + directions[i].x, pos.y + directions[i].y); puts you here: _ |x| | | Then, RandStep(position); does nothing since all locations around you are explored. So the next thing you want to do is step backwards, which is accomplished by something like: position.setLocation(pos.x - directions[i].x, pos.y - directions[i].y);.
has comment: http://stackoverflow.com/comment/37409171
has comment: http://stackoverflow.com/comment/37409072
has comment: http://stackoverflow.com/comment/37409301
has comment: http://stackoverflow.com/comment/37409139
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/37409396

http://stackoverflow.com/a/24255382
has body: Your code is throwing java.lang.ArrayIndexOutOfBoundsException. You may not be realizing that as your catch block does nothing. Try printing e in the catch block. Because of the exception, your code is not getting executed beyond the for loop
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24255211

http://stackoverflow.com/q/24199393
has comment: http://stackoverflow.com/comment/37361229
has answer: http://stackoverflow.com/a/40402255
downvote count: 0
answer count: 5
tagged with: mockito
has answer: http://stackoverflow.com/a/24200479
has answer: http://stackoverflow.com/a/24200590
has answer: http://stackoverflow.com/a/24199931
accepted answer: http://stackoverflow.com/a/24200590
has comment: http://stackoverflow.com/comment/37361273
tagged with: unit-testing
has body: I want to send a mock object in the controller via MockMvc with content type JSON. But when I am trying to serialize the mock the error is: java.lang.UnsupportedOperationException: Expecting parameterized type, got interface org.mockito.internal.MockitoInvocationHandler. Are you missing the use of TypeToken idiom? My code is as following: @Test public void testSomething(){ String xyz = ""; Integer i = 10; SomeClass inst = mock(SomeClass.class, withSettings().serializable()); when(inst.getProperty1()).then(xyz); when(inst.getProperty2()).then(i); Gson gson = new Gson(); String json = gson.toJson(inst); // this is creating error this.mockmvc.perform(put("/someUrl/").contentType(MediaType.JSON).content(json)).andExpect(status().isOk()); } Can someone tell me what I'm missing?
has title: How to send a mock object as JSON in mockmvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24199931
score: 26
upvote count: 26
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/31540081
favorite count: 0
type: Question

http://stackoverflow.com/comment/37414724
type: Comment
type: AnswerComment
has text: Well this makes sense. In my original code I had some random events and dice and things and had thought it might be a concurrency issue, but a buffer bug explains it much better. I'll wait a day or two to see if anyone can come up with the exact workings, otherwise I'll mark this as accepted.
comment on: http://stackoverflow.com/a/24223943
score: 0

dictionary
tags question: http://stackoverflow.com/q/24239769
tags question: http://stackoverflow.com/q/24140804
tags question: http://stackoverflow.com/q/24136070
tags question: http://stackoverflow.com/q/24207264
tags question: http://stackoverflow.com/q/24149035
tags question: http://stackoverflow.com/q/24138694
tags question: http://stackoverflow.com/q/24140033
tags question: http://stackoverflow.com/q/24241344
tags question: http://stackoverflow.com/q/24149394
tags question: http://stackoverflow.com/q/24265566
tags question: http://stackoverflow.com/q/24181305
tags question: http://stackoverflow.com/q/24232814
tags question: http://stackoverflow.com/q/24214758
type: Tag
tags question: http://stackoverflow.com/q/24210963
tags question: http://stackoverflow.com/q/24156378
tags question: http://stackoverflow.com/q/24204683
tag name: dictionary
tags question: http://stackoverflow.com/q/24244824
tags question: http://stackoverflow.com/q/24145688
tags question: http://stackoverflow.com/q/24199009
tags question: http://stackoverflow.com/q/24235862
tags question: http://stackoverflow.com/q/24161127
tags question: http://stackoverflow.com/q/24204907
tags question: http://stackoverflow.com/q/24116097

http://stackoverflow.com/comment/37262497
type: AnswerComment
has text: No you don't need a SwingWorker, when you click a button the code will execute on the Event DispatchThread. All you need is a simple ActionListener which translates the text in the text area and invokes the setText(...) method on the other text area with the translated text. Again the SSCCE should just be a simple frame with two text areas and a button. Start by just taking the text from the first text area and copy it to the second text area. Once you have that simple step working then you add the translation. Do one step at a time.
type: Comment
comment on: http://stackoverflow.com/a/24128026
score: 0

http://stackoverflow.com/a/24227500
type: Answer
score: 0
has body: Why do you want to add it from frame class. You can do it in panel class only. But then also if you want from frame class then keep this in mind that Your exitbtn in BottomPanel class is package private so you can access it only if the frame class is in same package. Next just where you are adding action listener write bp.extBtn.addActionListener(this)
has comment: http://stackoverflow.com/comment/37415024
answers question: http://stackoverflow.com/q/24227394

http://stackoverflow.com/q/24160748
has body: Suppose think of a scenario: function a(){ create savepoint s1 insert x1 insert x2 b() insert x4 if we get an error rollback to s1 else commit. } function b(){ create savepoint s2 insert x3 if we get an error rollback to s2 else commit } My question is suppose my b() passes with no error and and there is a problem while inserting x4 so i fired rollback. So my question whether it will also revert the things which are inserted as part of the b() i.e. x3.
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24160784
has answer: http://stackoverflow.com/a/24161037
has title: nested transaction in JDBC
score: 0
tagged with: transactions
tagged with: java
tagged with: jdbc

http://stackoverflow.com/q/24231939
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37422816
has title: what is solution for this servlet error?
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37422627
has body: HTTP Status 500 - type Exception report message description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.NullPointerException java.util.StringTokenizer.&lt;init&gt;(StringTokenizer.java:199) java.util.StringTokenizer.&lt;init&gt;(StringTokenizer.java:221) com.FileListServletkeyn.doPost(FileListServletkeyn.java:93) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.41 logs. Apache Tomcat/7.0.41
has comment: http://stackoverflow.com/comment/37422764
has answer: http://stackoverflow.com/a/24232024
has comment: http://stackoverflow.com/comment/37422791
downvote count: 4
has comment: http://stackoverflow.com/comment/37422669
has comment: http://stackoverflow.com/comment/37422815
tagged with: java
score: -4
answer count: 1

http://stackoverflow.com/q/24166536
answer count: 0
tagged with: java
tagged with: elasticsearch
has title: Get Elasticsearch Config File Correctly Encoded
favorite count: 0
type: Question
type: UnansweredQuestion
has body: How can I use the Elasticsearch Java API to get an index's configuration in json format, correctly encoded? I have tried querying the admin.indices client with a GetMappingRequest. However the format of the mapping always has weird characters - I have tried ISO8559, ASCII, UTF-8, UTF-16: val bs = new ByteArrayOutputStream() client.admin.indices.getMappings(new GetMappingsRequest()).get.writeTo(new OutputStreamStreamOutput(bs)) val mapping = new String(bs.toByteArray, CharSet.UTF8) println(mapping) Response: {"_all@enabled":false},"_tt�tru�ype@1 index":"no" . properties@valu`$�,"string",�4}}}dateOptionalTimeoffers42c9e293decoratedOfferd
downvote count: 0
score: 4
upvote count: 4

http://stackoverflow.com/q/24211952
tagged with: indexing
tagged with: groovy
tagged with: java
answer count: 1
favorite count: 0
type: Question
has body: I am getting an illegalargumentexception when I try to call the index. It keeps saying the index is out of range when it is set to 0. sheetIndex = 0 sampleStartIndex = (37) def MIDCellIndex = CellReference.convertColStringToIndex("I") HSSFCell cell,containerCell, wellCell = null HSSFWorkbook workbook = new HSSFWorkbook(); HSSFCellStyle cellStyle = workbook.createCellStyle(); HSSFSheet worksheet = workbook.getSheetAt(sheetIndex) Caught: java.lang.IllegalArgumentException: Sheet index (0) is out of range (0..-1) java.lang.IllegalArgumentException: Sheet index (0) is out of range (0..-1) at org.apache.poi.hssf.usermodel.HSSFWorkbook.validateSheetIndex(HSSFWorkbook.java:429) at org.apache.poi.hssf.usermodel.HSSFWorkbook.getSheetAt(HSSFWorkbook.java:825) at org.apache.poi.hssf.usermodel.HSSFWorkbook.getSheetAt(HSSFWorkbook.java:73) at org.apache.poi.ss.usermodel.Workbook$getSheetAt$0.call(Unknown Source) at com.genologics.client.bartender.midscript.main(CSVandManifestGenerator.groovy:50)
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
has answer: http://stackoverflow.com/a/24212217
has title: IllegalArgumentexception index out of range groovy

http://stackoverflow.com/a/24263558
has body: Maybe it would be best to first copy the file to a temporary folder, then move from one temporary folder to a second temporary folder. This way the original file stays in place and you can re-run the test easily.
type: Answer
score: -1
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/24263280

http://stackoverflow.com/q/24259213
tagged with: keyboard
favorite count: 0
has title: Translate keyboard key to keyboard combination
type: Question
type: UnansweredQuestion
has body: Is there any way to achieve this? I have a character, say "/" and I want to get the keyboard combination for this. For the German layout, "/" would be Shift+7.
has answer: http://stackoverflow.com/a/24260036
tagged with: java
downvote count: 0
upvote count: 7
score: 7
answer count: 1
linked to: http://stackoverflow.com/q/15260282

http://stackoverflow.com/a/24260730
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24259648
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24259648
has body: You're on the right track by looking at the javax.xml.transform APIs. A Transformer takes its input from an object that implements Source and sends its output to an object that implements Result, and there are JAXBSource and JAXBResult classes that will support the use case you're after MySourceJaxbClass sourceObject = // ... Transformer transformer = transformerFactory.newTransformer(xsltSource); JAXBContext context = // however you need to create your context Source src = new JAXBSource(context, sourceObject); JAXBResult res = new JAXBResult(context); transformer.transform(src, res); MyTargetJaxbClass resultObject = (MyTargetJaxbClass)res.getResult(); Of course you don't necessarily have to use the same JAXBContext for both the source and the result - if they're unrelated class hierarchies it might make more sense to use a separate context for each.
type: Answer

http://stackoverflow.com/comment/37428926
comment on: http://stackoverflow.com/a/24232360
type: Comment
score: 0
type: AnswerComment
has text: Yes the Rect parameters are in that order. I'm using the width to calculate the left side such that the rectangle is centered. The order in which I declared those variables is irrelevant to the values that are used to create the rectangle.

http://stackoverflow.com/comment/37328785
type: QuestionComment
type: Comment
has text: How about recursive traversing if you are already able to remove one key-value-pair?
comment on: http://stackoverflow.com/q/24182902
score: 1

textbox
tags question: http://stackoverflow.com/q/24199047
tag name: textbox
type: Tag

http://stackoverflow.com/q/24105208
has answer: http://stackoverflow.com/a/24105223
has comment: http://stackoverflow.com/comment/37184046
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/24105223
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37184053
possible better answer: http://stackoverflow.com/a/24105254
has body: I am trying to add some existing JRadioButtons to an array of this type for later use. I have this: public static javax.swing.JRadioButton jRadioButton1; public static javax.swing.JRadioButton jRadioButton2; public static javax.swing.JRadioButton jRadioButton3; public static javax.swing.JRadioButton jRadioButton4; public static javax.swing.JRadioButton jRadioButton5; public static javax.swing.JRadioButton jRadioButton6; public static javax.swing.JRadioButton jRadioButton7; public static javax.swing.JRadioButton jRadioButton8; These are my buttons. Then I declare this: public static JRadioButton[] seq = new JRadioButton[8]; And then I try to assign each button from array like this: seq[0] = jRadioButton1; But when I try to access it like this: seq[0].setSelected(true); I get a null pointer exception. I am new to Java and this is my first logic of doing this things. Any suggestions?
type: Question
has answer: http://stackoverflow.com/a/24105254
answer count: 2
upvote count: 0
has title: Add existing objects to an array in java
tagged with: arrays

http://stackoverflow.com/comment/37445867
score: 0
comment on: http://stackoverflow.com/q/24243854
type: QuestionComment
has text: The lack of understanding was literally from a lack of adherence to a reasonable coding style, and not using even the auto-formatter to properly indent things. This is kinda the reason why people think that for some people, it's better to make them learn programming in Python first. I don't really like Python because it's a debug hell, but at least it forces you to indent properly - otherwise nothing will work.
type: Comment

http://stackoverflow.com/q/24126497
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37359746
tagged with: ws-security
has title: Service provider Spring WS verifying SAML assertion from WSO2
has comment: http://stackoverflow.com/comment/42712501
tagged with: wso2-identity-server
type: Question
answer count: 0
type: UnansweredQuestion
has body: How web service provider say, 3rd party Service provider like Spring WS authenticate or validate the SAML Assertion received from client in case of WSO2 as identity provider. Please suggest any examples for such custom implementation Thanks
tagged with: cxf
tagged with: spring-ws

http://stackoverflow.com/comment/37378506
score: 0
has text: @JRowan Read the question carefully I'm trying to make only some text in the ListView formatted, your link is about making the whole ListView formatted. Read before you comment.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24196764

http://stackoverflow.com/comment/37407797
score: 0
type: AnswerComment
has text: This is not correct; it is averaging the alpha and should instead use the top image alpha to blend the top image over the bottom image.
comment on: http://stackoverflow.com/a/24185812
type: Comment

http://stackoverflow.com/a/24131597
upvote count: 1
has body: Put it in a while loop with some sort of break command, in this example "quit" InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); boolean run = true; while(run){ System.out.println("What would you like to shift?"); String input = br.readLine(); if(input.equals("quit")) break; else{ int pos = Integer.parseInt(input); int temp = data[pos]; for(int i = pos; i&lt;data.length-1; i++) { data[i] = data[i+1]; } } } Of course you will need to do error checking on your input to make sure it is a valid position in the array. I am, however, posting this from a droid and coding on a phone is a pain. This code also does a bit more than you are asking, but it gives an idea behind the logic of the while loop. Also, I just read your edit and I'm not sure I understand what exactly is going on, but again hope this may help. Would have put it as a comment but obviously it's a bit lengthy for that.
answers question: http://stackoverflow.com/q/24131465
score: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37482832
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24262513
has text: Hey at least we're all on the same page, that adds so much value to this answer!
score: 1

http://stackoverflow.com/a/24134682
has body: Start by taking a look at How to Use Buttons, Check Boxes, and Radio Buttons and How to Write an Action Listener Buttons provide notification via ActionListeners. You need to register an instance of ActionListener with your button and perform your required actions within it On a slightly more advance topic, but a worth while read How to Use Actions which provides a self contained ActionListener which also carries the configuration information which can be used by buttons, including menu items, and key bindings This... JLabel texte = new JLabel("car was selected"); JButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { texte.setVisible(true); } }); Isn't going to work for two reasons; JButton does not provide a static method addActionListener, so this won't compile... texte hasn't been added to anything, so trying to make it visible won't work... Personally, I would initialise this in along with the rest of UI... JLabel texte = new JLabel("car was selected"); JButton btn = new JButton("OK"); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { texte.setVisible(true); } }); c.add(btn); c.add(texte); Now, you could use your itemStateChanged method to enabled/disable the button, but you would need to make btn an instance variable... public class SelectWindow extends JFrame implements ItemListener { //... private JButton okBtn; //... public SelectWindow() { //... okBtn = new JButton("OK"); okBtn.addActionListener(new ActionListener() { //... }); c.add(okBtn); //... This would allow you to change the state of the button in the itemStateChanged public void itemStateChanged(ItemEvent e) { //... okBtn.setEnabled(...); For example... ...Side notes and comments... Generally, it's discouraged to extend from top level containers, like JFrame and instead use a more common level container like JPanel. This increases the re-usability of you UI, as you're not locking yourself into a single top level co…
score: 4
has comment: http://stackoverflow.com/comment/37239553
downvote count: 0
answers question: http://stackoverflow.com/q/24134581
upvote count: 4
has comment: http://stackoverflow.com/comment/37239532
type: Answer

http://stackoverflow.com/comment/37426818
type: Comment
type: QuestionComment
has text: What type of error you get, compile or runtime error. One advice try to simplify the value of the format, put it in a template method if you can.
comment on: http://stackoverflow.com/q/24233990
score: 0

http://stackoverflow.com/comment/37484458
type: AnswerComment
has text: It depends on what you want to do with the data. If you just need to extract data from certain nodes it might be simpler with XPath. You can also use a less *bureaucratic* DOM API such as JDOM or DOM4J, or DOM methods which return elements (and not other nodes) such as `getElementsByTagName()`, for example.
type: Comment
comment on: http://stackoverflow.com/a/24263874
score: 0

http://stackoverflow.com/q/24144505
linked to: http://stackoverflow.com/q/124671
has answer: http://stackoverflow.com/a/24144948
has answer: http://stackoverflow.com/a/24144690
possible better answer: http://stackoverflow.com/a/24144690
downvote count: 1
has title: Pick non-repeating random number from progressive list
favorite count: 0
accepted answer: http://stackoverflow.com/a/24144914
type: Question
has answer: http://stackoverflow.com/a/24145247
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37257738
has body: Here is my example - pick random number from 1-20, then from 2-21, 3-22 and so on, while excluding previous picks. I am new to Java, and doing something wrong. import java.util.Random; import java.util.ArrayList; import java.util.List; public class RandomGenerator { static int temp; public static void main(String[] args) { List&lt;Integer&gt; randomNumberArray = new ArrayList&lt;Integer&gt;(); Random RandomNumber = new Random(); for (int i = 0; i&lt;=20; i++) { temp = RandomNumber.nextInt(i+20) +1+i; if (!randomNumberArray.contains(temp)) { { randomNumberArray.add(temp); } } System.out.println(randomNumberArray); }
answer count: 4
has comment: http://stackoverflow.com/comment/37257458
has answer: http://stackoverflow.com/a/24144914
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/37431965
type: Comment
comment on: http://stackoverflow.com/q/24236273
type: QuestionComment
has text: And you can try it on a small scale with just three classes, the ones you have here. It'd probably take about as much time and effort as it would to create the UML diagram and poet this question.
score: 0

http://stackoverflow.com/q/24263517
possible better answer: http://stackoverflow.com/a/24263660
has body: I get an error that says that the size variable might not have been initialized even though i have initialized it in the constructor. why doesn't this work ?= public class Ore { protected static final float size; protected String name; protected int itemID; protected ArrayList&lt;Mineral&gt; minerals; public Ore(float size, String name, int itemID){ this.size = size; this.name = name; this.itemID = itemID; } public String getPrizeData(int itemNumber){ String data = null; return data; } public float getPrice(){ float price = 0; return price; } }
has answer: http://stackoverflow.com/a/24263660
answer count: 4
type: AnsweredQuestion
score: 2
has title: Java Final Variable Initialization
accepted answer: http://stackoverflow.com/a/24263555
upvote count: 2
has answer: http://stackoverflow.com/a/24263555
tagged with: java
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24263753
has answer: http://stackoverflow.com/a/24263595

http://stackoverflow.com/q/24111433
tagged with: big-o
type: Question
upvote count: 2
has title: Time complexity of simple string concatenation
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37195817
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/37196218
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37195859
has comment: http://stackoverflow.com/comment/37195840
has comment: http://stackoverflow.com/comment/102982571
linked to: http://stackoverflow.com/q/11032015
score: 0
has answer: http://stackoverflow.com/a/24111546
has comment: http://stackoverflow.com/comment/37195907
has body: What is the cost of the following method. How do you calculate it? public String joinWords(String[] words) { String sentence = ""; for (String w : words) { sentence = sentence + word; } return sentence; }
tagged with: time-complexity
tagged with: java

http://stackoverflow.com/q/24258162
has comment: http://stackoverflow.com/comment/37473175
has comment: http://stackoverflow.com/comment/37473099
has answer: http://stackoverflow.com/a/24258603
has answer: http://stackoverflow.com/a/24258420
accepted answer: http://stackoverflow.com/a/24258414
favorite count: 0
possible better answer: http://stackoverflow.com/a/24258420
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37473393
tagged with: while-loop
downvote count: 0
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37473374
tagged with: shell
tagged with: loops
has body: I have a while loop where in it constructs a JAVA String by appending the output from a shell script. System.out.println("Here is the standard output of the command:\n"); while ((s = stdInput.readLine()) != null) { refreshString = refreshString + s; System.out.println(s); } This shell script takes 2hrs to execute. Is there a way by which I can grab the string every 10 seconds(Snapshot of the current string)? I am developing a JAVA application where in I need to display that string on the browser every 10 seconds.(I am doing that by using Auto Page Refresh Library. The page automatically refreshes.) public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... PrintWriter out = response.getWriter(); ... out.println(refreshString); Now my page has to display current "refreshString" every time the page refreshes. Just let me know if my question isn't clear.
has answer: http://stackoverflow.com/a/24258414
has title: How to show the values in the LOOP for every 10 second in java
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/37473235
upvote count: 2

http://stackoverflow.com/comment/37195290
type: Comment
comment on: http://stackoverflow.com/q/24111114
type: QuestionComment
score: 0
has text: Try cursor.getString(2)

http://stackoverflow.com/comment/40313802
type: AnswerComment
comment on: http://stackoverflow.com/a/24128294
score: 1
has text: @wwpieeater -- It's an **ARRAY**, so you parse it with **JSONArray**. Go to json.org and learn the JSON syntax. It only takes 5-10 minutes to learn.
type: Comment

http://stackoverflow.com/a/24135961
type: AcceptedAnswer
has body: You need to check your Accept and Content-Types headers and it has to be application/json. Because your service consumes only json. 'Accept': 'application/json', 'Content-Type': 'application/json'
type: Answer
accepted answer of: http://stackoverflow.com/q/24135865
answers question: http://stackoverflow.com/q/24135865
score: 0

http://stackoverflow.com/comment/37188079
comment on: http://stackoverflow.com/a/24107356
score: 0
type: AnswerComment
has text: @Jain because it's not a real answer. It only throws in a `hint` and doesn't explain much or show some example.
type: Comment

http://stackoverflow.com/q/24110247
tagged with: multithreading
downvote count: 0
has comment: http://stackoverflow.com/comment/115885839
has body: I’m starting to work on a music/metronome application in Java and I’m running into some problems with the timing and speed. For testing purposes I’m trying to play two sine wave tones at the same time at regular intervals, but instead they play in sync for a few beats and then slightly out of sync for a few beats and then back in sync again for a few beats. From researching good metronome programming, I found that Thread.sleep() is horrible for timing, so I completely avoided that and went with checking System.nanoTime() to determine when the sounds should play. I’m using AudioSystem’s SourceDataLine for my audio player and I’m using a thread for each tone that constantly polls System.nanoTime() in order to determine when the sound should play. I create a new SourceDataLine and delete the previous one each time a sound plays, because the volume fluctuates if I leave the line open and keep playing sounds on the same line. I create the player before polling nanoTime() so that the player is already created and all it has to do is play the sound when it is time. In theory this seemed like a good method for getting each sound to play on time, but it’s not working correctly. I’m not sure if the timing problems are from running different threads or if it has to do with deleting and recreating the SourceDataLine or if it’s in playing sounds or what exactly... At the moment this is just a simple test in Java, but my goal is to create my app on mobile devices (Android, iOS, Windows Phone, etc)...however my current method isn’t even keeping perfect time on a PC, so I’m worried that certain mobile devices with limited resources will have even more timing problems. I will also be adding more sounds to it to create more complex rhythms, so it needs to be able to handle multiple sounds going simultaneously without sounds lagging. Another problem I’m having is that the max tempo is controlled by the length of the tone since the tones don’t overlap each other. I tried adding additio…
has answer: http://stackoverflow.com/a/24110569
has comment: http://stackoverflow.com/comment/115877633
favorite count: 0
score: 2
tagged with: audio
tagged with: java
answer count: 1
type: Question
upvote count: 2
has title: Java Audio Metronome | Timing and Speed Problems
type: UnansweredQuestion

http://stackoverflow.com/a/24149143
type: Answer
answers question: http://stackoverflow.com/q/24149075
has body: From the Javadocs: So just replace System.out.println(T3JsonObj); with System.out.println(T3JsonObj.toString(4));
score: 0
has comment: http://stackoverflow.com/comment/37266688
has comment: http://stackoverflow.com/comment/37266490
has comment: http://stackoverflow.com/comment/37267789

http://stackoverflow.com/comment/37483840
has text: doesn't work: ArrayStoreException is thrown. Also see my edit in main post.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24263810
type: Comment

http://stackoverflow.com/q/24136664
has comment: http://stackoverflow.com/comment/37243075
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: mouseevent
has title: Java swing - button's note when the mouse touches it
type: Question
has comment: http://stackoverflow.com/comment/37242908
has body: I am trying to add a kind of label when the mouse touches a button, I used Jlabel but i failed to create it. Can you help me?
downvote count: 2
answer count: 1
tagged with: button
tagged with: tooltip
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/24136691
favorite count: 0
has answer: http://stackoverflow.com/a/24136691

http://stackoverflow.com/comment/37404415
type: Comment
type: QuestionComment
score: 0
has text: I have the server runtime environments setup to point to the glassfish directory, so I assumed ${sunappserver.rootdirectory} will point to that location.. do I need to define this value explicitly elsewhere?
comment on: http://stackoverflow.com/q/24222186

interface
tags question: http://stackoverflow.com/q/24119122
tags question: http://stackoverflow.com/q/24134126
tags question: http://stackoverflow.com/q/24238975
tag name: interface
tags question: http://stackoverflow.com/q/24160416
tags question: http://stackoverflow.com/q/24210368
tags question: http://stackoverflow.com/q/24180587
tags question: http://stackoverflow.com/q/24231432
tags question: http://stackoverflow.com/q/24218402
tags question: http://stackoverflow.com/q/24139214
tags question: http://stackoverflow.com/q/24205052
tags question: http://stackoverflow.com/q/24193027
tags question: http://stackoverflow.com/q/24150567
tags question: http://stackoverflow.com/q/24194188
tags question: http://stackoverflow.com/q/24245367
tags question: http://stackoverflow.com/q/24138538
tags question: http://stackoverflow.com/q/24182074
tags question: http://stackoverflow.com/q/24232513
tags question: http://stackoverflow.com/q/24211113
type: Tag
tags question: http://stackoverflow.com/q/24145100
tags question: http://stackoverflow.com/q/24241442
tags question: http://stackoverflow.com/q/24254545

http://stackoverflow.com/comment/37263303
has text: Huh. It's almost like you didn't try anything and just expect us to do your work for you. I usually charge for my services.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24147557
score: 1

http://stackoverflow.com/comment/37231639
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24130251
has text: Are you talking about a specific brand of JVM at all? They do differ in their memory handling implementations.
type: Comment

http://stackoverflow.com/a/24150038
answers question: http://stackoverflow.com/q/24149470
type: Answer
has comment: http://stackoverflow.com/comment/37292447
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24149470
has body: Yes, it is possible. You use the exact same code you are already using, but you replace SuikodenVFragment with the name of the Fragment class you want to use instead. Say your project structure looks like this: /com/example/myapp MainActivity.java SecondFragment.java Then you can swap in an instance of SecondFragment by calling: fragmentManager.beginTransaction().replace(R.id.container, SecondFragment.newInstance() // or new SecondFragment(), as appropriate ).commit(); The only "catch" is that you need to make sure that you import SecondFragment at the top of MainActivity.java with the rest of your imports. However, most IDEs will take care of this for you. If you are new to Java and haven't used an import statement or packages before, I recommend starting with the Using Package Members guide from Oracle's Java tutorials.

http://stackoverflow.com/comment/37326528
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24177217
has text: All "fast" app use native code. Java is not magically fast on Android. Easier maybe, but not faster.

http://stackoverflow.com/a/24188131
type: Answer
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/37339033
downvote count: 1
has body: Look up javax.lang.model and the annotation processing API, javax.annotation.processing. This lets you write plugins to the javac compiler in a standardized way, all compilers supports it. You can find tutorials and talks that highlight this online. There are a couple of limitations, for example I don't think you can rewrite the source of a file, but you can generate a new file (or class) with the annotation present. Also you can't model code inside method bodies.
answers question: http://stackoverflow.com/q/24185601

guava
tags question: http://stackoverflow.com/q/24227182
tags question: http://stackoverflow.com/q/24153793
tags question: http://stackoverflow.com/q/24263479
tags question: http://stackoverflow.com/q/24190887
tags question: http://stackoverflow.com/q/24239394
tags question: http://stackoverflow.com/q/24263673
tag name: guava
tags question: http://stackoverflow.com/q/24227149
type: Tag
tags question: http://stackoverflow.com/q/24148193
tags question: http://stackoverflow.com/q/24156714
tags question: http://stackoverflow.com/q/24171643

http://stackoverflow.com/q/24105371
answer count: 1
has title: Don't create a new CSV file each time
has body: So I am trying to make something for my work but each time I use this method (Which I found on the Internet) It creates a new CSV file, but I want to add the data each time, without removing what was previously there. public static void generateCsvFile(String sFileName) { try { NummerS = Nummer.getText(); LocatiesS = Locatie.getText(); LoginS = Login.getText(); Nummer5S = Nummer5.getText(); Nummer1S = Nummer1.getText(); DatumS = Datum.getText(); FileWriter writer = new FileWriter(sFileName); writer.append(NummerS); writer.append(';'); writer.append(LocatiesS); writer.append(';'); writer.append(LoginS); writer.append(';'); writer.append(DatumS); writer.append(';'); writer.append(Nummer1S); writer.append(';'); writer.append(Nummer5S); writer.append(';'); if(listt.getSelectedValue() != null) { writer.append(listt.getSelectedValue().toString()); } Workbook workbook = null; try { workbook = Workbook.getWorkbook(new File("F:\\test.xls")); } catch (BiffException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } writer.append(';'); Sheet sheet = workbook.getSheet(0); for(Cell c : sheet.getColumn(1)){ if(listt.getSelectedValue() != null) { if(c.getContents().contains(listt.getSelectedValue().toString())){ System.out.println(c.getColumn() + " , " + c.getRow()); writer.append(sheet.getCell(c.getColumn()+1,c.getRow()).getContents()); } else { } } } // generate whatever data you want writer.append("\n"); writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); } } and this is where I call the method. if(e.getSource().equals(save)){ generateCsvFile("f:\\testss.csv"); JOptionPane.showMessageDialog(null, "Saved!"); }
type: Question
has comment: http://stackoverflow.com/comment/37186744
tagged with: http://stackoverflow.com/tag/csv
accepted answer: http://stackoverflow.com/a/24105514
has comment: http://stackoverflow.com/comment/37184605
has answer: http://stackoverflow.com/a/24105514
tagged with: file-io
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1225146
score: 0
tagged with: java
tagged with: file

http://stackoverflow.com/comment/37214596
score: 0
comment on: http://stackoverflow.com/q/24121589
has text: I would think using a database to store the words would probably be a better idea
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37494528
comment on: http://stackoverflow.com/q/24258449
type: Comment
type: QuestionComment
has text: By the way, the code `t.kind != kind && t!=null` does not look right as the second conjunct can never evaluate to false.
score: 0

http://stackoverflow.com/comment/37337164
comment on: http://stackoverflow.com/a/24186671
has text: Thanks for the response Mena! Your answer is very appreciated!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37486620
type: AnswerComment
has text: @DmitryGinzburg: Done, with various alternatives.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/24265043

http://stackoverflow.com/q/24155982
score: 1
tagged with: java
answer count: 1
tagged with: wikipedia
has title: Lucene Wikipedia Dump
tagged with: wikimedia-dumps
favorite count: 0
type: Question
has body: I am currently indexing the Wikipedia dump (actually one from 2012, but the format is the same regardless) and would like to find out about performance costs (size and processing time). I am using Lucene for Java v4.x and store all the dump fields inside the index. I work on a machine with an i5 processor and 8 GB of RAM. I just finished indexing 5000 articles that created an index with a size of 5GB that took about 10 minutes. This means for 3.5 Million articles, it would be a 3.5 TB index and it would take me about 5 days, if the indexing time is linear (which it is not). I wonder if that is normal given that the raw Wikipedia dump file is just 35 GB...
type: UnansweredQuestion
tagged with: lucene
has answer: http://stackoverflow.com/a/24156573
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37304309
comment on: http://stackoverflow.com/q/24169355
type: Comment
type: QuestionComment
score: 0
has text: http://developer.android.com/reference/android/app/Activity.html#getWindow()

http://stackoverflow.com/comment/37189443
has text: I'm not suggesting using 0 and 1 characters, but actual binary data, as in, raw bytes
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24108111
score: 1

http://stackoverflow.com/q/24163389
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37293884
has title: Making int array in parallel to java string array
duplicate of: http://stackoverflow.com/q/513832
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24163417
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/24163417
linked to: http://stackoverflow.com/q/22718744
tagged with: arrays
has body: The following code creates a string array 'one' as [c, a, t, a, n, d, d, o, g]. Now I want to create an int array 'two' in which place of every 'a' is 3 and all other places are filled by 5 forming int two= {5, 3, 5, 3, 5, 5, 5, 5, 5} but the code is giving every element equal to 5, so it prints as 5 5 5 5 5 5 5 5 5 : The code I used starts here: import com.google.common.collect.ObjectArrays; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang3.ArrayUtils; public class StringInt { public static void main(String[] args) { String str= "cat and dog"; String[] word = str.split("\\s"); String[] one = new String[0]; for(int i=0; i&lt;word.length; i++){ one = ArrayUtils.addAll(one, word[i].split("(?!^)")); } System.out.println("One : " + Arrays.toString(one)); int[] b = new int[one.length]; for(int j=0; j&lt;one.length; j++){ if(one[j]=="a"){ b[j]=3; } else { b[j]=5; } System.out.print(b[j]+" "); } } } Being new to programming and java I need help to rectify this code to get the required output: 5 3 5 3 5 5 5 5 5
downvote count: 1
possible better answer: http://stackoverflow.com/a/24163589
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24163589
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/37496559
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24253889
has text: I meant by having the client generate a certificate.

http://stackoverflow.com/q/24163118
tagged with: canvas
upvote count: 0
downvote count: 2
answer count: 1
favorite count: 0
type: Question
has title: Forcing precedence in arithmetic operations in Android/Java
has body: I'm trying to position a shape of size 10 pixels in relation to a square bitmap of width 72 pixels. In the following code: fShapeLocation refers to the final position of the shape fBitmapWidth refers to the X width of the bitmap cTopLeft.getX() is the top left corner of the bitmap The object I'm adding should appear exactly 2/3+1/6th across the top X of the bitmap (just above the very center of the last third of the shape). Something like this (^^^ is where I want it, and [] relates to the four corners of the bitmap square): ^^^ [ ] [ ] fShapeLocation=this.cTopLeft.getX()+((this.fBitmapWidth/3)*2); fShapeLocation+=(fBitmapWidth/6)-5; Notice how many brackets I tried to put in in order to force arithmetic precedence. In practice, the shape appears about in the middle of the bitmap. I have a nasty suspicion that this is caused by the order in which java is evaluating the arithmetic expressions. I would rather shorten my code to just one line and have it place the shape in the right position - can anyone help me out? (My apologies that I was never very good at math)
score: -2
tagged with: math
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37291889
accepted answer: http://stackoverflow.com/a/24163334
has comment: http://stackoverflow.com/comment/37291778
has comment: http://stackoverflow.com/comment/37292055
has answer: http://stackoverflow.com/a/24163334
tagged with: operator-precedence
type: AnsweredQuestion

http://stackoverflow.com/q/24260274
has answer: http://stackoverflow.com/a/24279004
favorite count: 0
tagged with: richfaces
type: Question
has comment: http://stackoverflow.com/comment/37479614
has body: here i added my codes https://gist.github.com/priyankahdp/be578a92f55d29702928 no error is shown in my console. but no page redirect after session time out. but its called SessionTimeoutFilter class doFilter() method when any form activity invokes but page view as earlier no redirection pleaes help me to sort out this issue thanks
has comment: http://stackoverflow.com/comment/37512698
tagged with: java
has title: Spring security + jsf app; when session time-out redirect to login page issue
tagged with: spring
score: -1
type: AnsweredQuestion
tagged with: jsf
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24279004
downvote count: 1
tagged with: spring-security

list
type: Tag
tags question: http://stackoverflow.com/q/24215173
tags question: http://stackoverflow.com/q/24212472
tags question: http://stackoverflow.com/q/24189193
tags question: http://stackoverflow.com/q/24224633
tags question: http://stackoverflow.com/q/24202528
tags question: http://stackoverflow.com/q/24128375
tags question: http://stackoverflow.com/q/24135937
tags question: http://stackoverflow.com/q/24208182
tags question: http://stackoverflow.com/q/24110872
tags question: http://stackoverflow.com/q/24124001
tags question: http://stackoverflow.com/q/24104998
tags question: http://stackoverflow.com/q/24259902
tags question: http://stackoverflow.com/q/24239334
tags question: http://stackoverflow.com/q/24155519
tags question: http://stackoverflow.com/q/24241442
tags question: http://stackoverflow.com/q/24239305
tags question: http://stackoverflow.com/q/24232496
tags question: http://stackoverflow.com/q/24184256
tag name: list
tags question: http://stackoverflow.com/q/24156378
tags question: http://stackoverflow.com/q/24258683
tags question: http://stackoverflow.com/q/24266206
tags question: http://stackoverflow.com/q/24256485
tags question: http://stackoverflow.com/q/24161127
tags question: http://stackoverflow.com/q/24263231
tags question: http://stackoverflow.com/q/24238023
tags question: http://stackoverflow.com/q/24264692
tags question: http://stackoverflow.com/q/24255964
tags question: http://stackoverflow.com/q/24123822
tags question: http://stackoverflow.com/q/24245071

http://stackoverflow.com/q/24254684
tagged with: java
has body: I am working on a Battleship program, and I have encountered a slight mishap. I want to label the two grids (user and computer) and so I am using the GridBagLayout to control the size of the components. Now, when I go to center the text to put it in the middle of the label it's in, it does not do anything, it stays in the same place. Here is my code: package buttongrid; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.image.BufferedImage; import java.net.MalformedURLException; import java.net.URL; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.Border; public class ButtonGrid { JFrame frame=new JFrame(); //creates frame JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); JPanel panel3 = new JPanel(); JPanel panel4 = new JPanel(); JPanel panel5 = new JPanel(); JPanel panel6 = new JPanel(); JLabel label1 = new JLabel(); JLabel label2 = new JLabel(); JLabel[][] grid; //names the grid of buttons JLabel[][] enemyGrid; String COLS = "ABCDEFGHIJK"; GridBagConstraints c = new GridBagConstraints(); Border border = BorderFactory.createLineBorder(Color.BLACK, 1); public ButtonGrid() throws MalformedURLException{ //constructor URL urlPic = new URL("http://i47.tinypic.com/14wswi9.gif"); ImageIcon waterPic = new ImageIcon(urlPic); frame.setLayout(new GridBagLayout()); //set layout frame.setResizable(false); //ADDING TOP LEFT PANEL label1.setText("Your Grid"); label1.setHorizontalTextPosition(SwingConstants.CENTER); label1.setVerticalTextPosition(SwingConstants.CENTER); panel4.add(label1); panel4.setBorder(border); c.gridx = 0; c.gridy = 0; c.ipady = 10; frame.add(panel4, c); //ADDING TOP MIDDLE PANEL panel5.setBorder(border); c.gridx = 1; c.gridy = 0; c.ipady = 10; frame.add(panel5, c); //ADDING TOP MIDDLE PA…
has answer: http://stackoverflow.com/a/24254727
downvote count: 0
tagged with: layout-manager
score: 1
upvote count: 1
tagged with: swing
favorite count: 0
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24255072
tagged with: alignment
has title: GUI Text Alignment
has answer: http://stackoverflow.com/a/24255072
accepted answer: http://stackoverflow.com/a/24254727
type: AnsweredQuestion

http://stackoverflow.com/q/24247357
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/37453056
has comment: http://stackoverflow.com/comment/37452342
favorite count: 0
type: Question
tagged with: apache-commons-beanutils
has answer: http://stackoverflow.com/a/78187046
possible better answer: http://stackoverflow.com/a/78187046
has title: I want to sort using commons-collections4-4.0 ComparatorChain
has answer: http://stackoverflow.com/a/24420430
accepted answer: http://stackoverflow.com/a/24420430
tagged with: apache-commons-collection
has body: When we use the latest commons-collections4-4.0jar, we get an error message as shown below regarding making a sort option with a usage of the ComparatorChain and the BeanComparator. Do you have any idea what's wrong with this? We use commons-bean utile-1.9.2.jar for beanutils. ■success code (commons-collections-3.2.1.jar) @SuppressWarnings("unchecked") private void testCommonsChain() { ComparatorChain comparator = new ComparatorChain(); List&lt;TestDataBean&gt; testDataBeanList = this.createTestDataBeanList(); comparator.addComparator(new BeanComparator&lt;TestDataBean&gt;("name"), true); comparator.addComparator(new BeanComparator&lt;TestDataBean&gt;("kngk")); Collections.sort(testDataBeanList, comparator); this.printData(testDataBeanList); } ■failure code (commons-collections4-4.0.jar) private void testCommonsChain() { ComparatorChain&lt;TestDataBean&gt; comparator = new ComparatorChain&lt;TestDataBean&gt;(); List&lt;TestDataBean&gt; testDataBeanList = this.createTestDataBeanList(); comparator.addComparator(new BeanComparator&lt;TestDataBean&gt;("name"), true); comparator.addComparator(new BeanComparator&lt;TestDataBean&gt;("kngk")); Collections.sort(testDataBeanList, comparator); this.printData(testDataBeanList); } error log Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/comparators/ComparableComparator at org.apache.commons.beanutils.BeanComparator.&lt;init&gt;(BeanComparator.java:87) at logic.TestComparator.testCommonsChain(TestComparator.java:36) at logic.TestComparator.executeComparator(TestComparator.java:19) at myTestOrange.TestMain.main(TestMain.java:10) Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.comparators.ComparableComparator at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launch…
type: AnsweredQuestion
score: 0
tagged with: apache-commons
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/37334639
comment on: http://stackoverflow.com/a/24185806
has text: So, keyCodes for a character are not unique across the OS?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24128987
type: AnsweredQuestion
score: 0
tagged with: ant
tagged with: android
has answer: http://stackoverflow.com/a/24159313
tagged with: java
accepted answer: http://stackoverflow.com/a/24159313
has body: I'm attempting to integrate Espresso into my project without using the standalone jar (using that created issues with dexing). However, I'm running int a problem in that the LICENSE.txt of hamcrest-library-1.1.jar and hamcrest-core-1.1.jar is identical, causing Ant to give me the error message "Duplicate files at the same path inside the APK". The Espresso website provides a workaround for this if you're using Gradle, but we're building using Ant, so that's of no help. Are there any similar workaround for Ant?
type: Question
answer count: 1
tagged with: android-espresso
has title: Duplicate files at the same path inside the APK when integrating Espresso and Ant

http://stackoverflow.com/comment/37301833
comment on: http://stackoverflow.com/q/24167805
type: Comment
type: QuestionComment
score: 1
has text: Good. As you can see, camickr and myself can only give you very general guidance, information you should have been able to glean for yourself by simply looking at the JButton tutorial, the CardLayout tutorial, and trying to put things together. You'll get much better and more specific help if you ask a much more specific question showing **your** code, and describing **your** problems.

http://stackoverflow.com/q/24152351
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24152595
has body: I'm learning Java and I'm getting this error. I know this has been asked a few (a lot of) times but none of the answers seems to answer my question. The body of the code is: String[] number = {"too small", "one", "two", "three", "four", "too large"}; int i; if(num&lt;1){ i=0; } if(num==1){ i=1; } if(num==2){ i=2; } if(num==3){ i=3; } if(num==4){ i=4; } if(num&gt;4){ i=5; } return number[i]; where the variable 'num' is declared, initialized and given previously. The error I get is: "Variable 'i' might not have been initialized" and pointing to the last line (return number[i];). The thing is, if I declare 'i' and immediately assign a value (int i=0;) the code runs fine. But if I don't assign a value I get the error EVEN if a possible value is assigned after each 'if'. I don't get this kind of error with C, for example. Thanks
downvote count: 2
score: 6
has comment: http://stackoverflow.com/comment/37272682
has comment: http://stackoverflow.com/comment/37273053
favorite count: 0
type: Question
upvote count: 8
has comment: http://stackoverflow.com/comment/37272825
has answer: http://stackoverflow.com/a/78253175
tagged with: java
has comment: http://stackoverflow.com/comment/37272908
has comment: http://stackoverflow.com/comment/37272843
has comment: http://stackoverflow.com/comment/37272836
has title: Java: Error: variable might not have been initialized
has answer: http://stackoverflow.com/a/24152369

http://stackoverflow.com/comment/37466291
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24244889
has text: I followed this question http://stackoverflow.com/questions/23806625/can-not-unmarshall-the-soap-response and tried to create the DOMSource but to no avail.

http://stackoverflow.com/q/24240155
tagged with: inputstream
tagged with: google-bigquery
has answer: http://stackoverflow.com/a/24255399
has comment: http://stackoverflow.com/comment/37438843
type: UnansweredQuestion
downvote count: 0
answer count: 1
upvote count: 1
favorite count: 0
has title: Could not load file Could not load client_secrets.json
type: Question
score: 1
tagged with: java
has body: I am new dev in BigQuery. I'm trying to access Big query from my application. I just follow sample code available at BigQuery API Quickstart My application throws nullpointerexception when application try to load "google client secrets" from JSON file. I have placed the JSON file at root folder of the application. However the result when running is "Could not load file load client_secrets.json Please tell me the way to do it...

http://stackoverflow.com/a/53026663
answers question: http://stackoverflow.com/q/24163370
type: Answer
score: 0
has body: I'd like to add some improvements to this solution. The texts with the same style can be caught by getParagraphElement(int pos) instead of each single character. The first element starts at pos 0, followed by the next at: element.getEndOffset() + 1. But we have to traverse down the tree of sub elements to get all the character attributes. package demo; import java.awt.*; import javax.swing.*; import javax.swing.text.*; public class TextPaneDemo { private JTextPane textPane1; private JTextPane textPane2; private StyledDocument doc1; private StyledDocument doc2; Private JFrame frame1; private JFrame frame2; public TextPaneDemo () { MutableAttributeSet black = new SimpleAttributeSet(); StyleConstants.setForeground(black, Color.black); MutableAttributeSet red = new SimpleAttributeSet(); StyleConstants.setForeground(red, Color.red); MutableAttributeSet blue = new SimpleAttributeSet(); StyleConstants.setForeground(blue, Color.blue); StyleConstants.setBold(blue, true); textPane1 = new JTextPane(); textPane1.setEditorKit(new StyledEditorKit()); doc1 = textPane1.getStyledDocument(); textPane2 = new JTextPane(); textPane2.setEditorKit(new StyledEditorKit()); doc2 = textPane2.getStyledDocument(); createFrames(); append(doc1, black, "This is a Test!\n"); append(doc1, red, "Hello world! Hello Stackoverflow\n"); append(doc1, blue, "Hello "); append(doc1, red, "Stackoverflow\n"); append(doc1, black, "the text is black again\n"); copyDoc (doc1, doc1.getParagraphElement(0), doc2); } private static void append(StyledDocument doc, AttributeSet style, String text) { try { doc.insertString(doc.getLength(), text, style); } catch (BadLocationException ex) { ex.printStackTrace(); } } private static int copyDoc(StyledDocument doc1, Element elem, StyledDocument doc2) { int pos = elem.getStartOffset(); while( pos &lt; doc1.getLength()) { Element element = doc1.getParagraphElement(pos); pos = copyElem(doc1, element, doc2); } return pos; } private static int copyElem(StyledDocument doc1, Elemen…

http://stackoverflow.com/comment/100450740
type: AnswerComment
has text: why it has been up voted by people. I can't see it working?
comment on: http://stackoverflow.com/a/43204174
score: 1
type: Comment

http://stackoverflow.com/comment/37426897
comment on: http://stackoverflow.com/q/24233884
score: 0
has text: I'v added it to the original post.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24155264
accepted answer: http://stackoverflow.com/a/24155439
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/32913264
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24155408
has body: I am using Hibernate 4.3. I am trying to get the SessionFactory object from a HibernateUtil class. I am trying to get only one SessionFactory object for entire application, i.e. Singleton object for application. Below is my current code, I want to make it Singleton class. HibernateUtil.java public class HibernateUtil { private static SessionFactory sessionFactory; private static StandardServiceRegistry serviceRegistry; public static SessionFactory getSessionFactory() { Configuration configuration = new Configuration(); configuration.configure(); serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory; } } Please suggest or provide sample code for this. Thanks.
has comment: http://stackoverflow.com/comment/37277887
has title: Return SessionFactory Singleton object for Hibernate 4.3
tagged with: sessionfactory
type: AnsweredQuestion
upvote count: 3
score: 3
has answer: http://stackoverflow.com/a/24155408
answer count: 3
has answer: http://stackoverflow.com/a/24155439
downvote count: 0

http://stackoverflow.com/q/24233785
type: Question
linked to: http://stackoverflow.com/q/5621338
score: 0
has comment: http://stackoverflow.com/comment/37426350
answer count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/24233813
has body: I used Java graphics to create a 500 x 500 Checkers board within a JPanel, which was placed within a JFrame. To make the pieces, I wrote a series of for loops to create JButtons across the board. The following for loops correctly set up the pieces for one side of the board: for(int x = 355; x&gt;=55;x-=100) { Piece p = new Piece(); p.addActionListener(new ButtonListener()); p.setBounds(x,5,40,40); b.add(p); } for(int x = 5;x&lt;=355; x+=100) { Piece p = new Piece(); p.addActionListener(new ButtonListener()); p.setBounds(x,55,40,40); b.add(p); } for(int x = 355; x&gt;=55;x-=100) { Piece p = new Piece(); p.addActionListener(new ButtonListener()); p.setBounds(x,105,40,40); b.add(p); } However, I just started setting up the pieces for the other side of the board with this for loop, and none of the buttons are being displayed: for(int x = 5; x&gt;=355;x+=100) { Piece p = new Piece(); p.addActionListener(new ButtonListener()); p.setBounds(x,255,40,40); b.add(p); } Why is this happening?
has comment: http://stackoverflow.com/comment/37426373
has comment: http://stackoverflow.com/comment/37429974
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
accepted answer: http://stackoverflow.com/a/24233813
tagged with: java
has title: Why is it that these JButtons aren't being created?

http://stackoverflow.com/comment/37425923
has text: How do you want to compare two coaches?
comment on: http://stackoverflow.com/q/24233554
score: 1
type: Comment
type: QuestionComment

unit-testing
tags question: http://stackoverflow.com/q/24124356
tags question: http://stackoverflow.com/q/24149755
tags question: http://stackoverflow.com/q/24261169
type: Tag
tags question: http://stackoverflow.com/q/24258076
tags question: http://stackoverflow.com/q/24171551
tags question: http://stackoverflow.com/q/24240295
tag name: unit-testing
tags question: http://stackoverflow.com/q/24151148
tags question: http://stackoverflow.com/q/24235452
tags question: http://stackoverflow.com/q/24164057
tags question: http://stackoverflow.com/q/24142530
tags question: http://stackoverflow.com/q/24174181
tags question: http://stackoverflow.com/q/24191493
tags question: http://stackoverflow.com/q/24113807
tags question: http://stackoverflow.com/q/24112799
tags question: http://stackoverflow.com/q/24259577
tags question: http://stackoverflow.com/q/24258377
tags question: http://stackoverflow.com/q/24201984
tags question: http://stackoverflow.com/q/24261970
tags question: http://stackoverflow.com/q/24150017
tags question: http://stackoverflow.com/q/24145758
tags question: http://stackoverflow.com/q/24199393
tags question: http://stackoverflow.com/q/24113794
tags question: http://stackoverflow.com/q/24162460
tags question: http://stackoverflow.com/q/24254320
tags question: http://stackoverflow.com/q/24262666
tags question: http://stackoverflow.com/q/24155856
tags question: http://stackoverflow.com/q/24131327
tags question: http://stackoverflow.com/q/24123683
tags question: http://stackoverflow.com/q/24175344
tags question: http://stackoverflow.com/q/24184643
tags question: http://stackoverflow.com/q/24213618
tags question: http://stackoverflow.com/q/24149519
tags question: http://stackoverflow.com/q/24260498
tags question: http://stackoverflow.com/q/24158975

http://stackoverflow.com/comment/37191151
has text: Please clarify where your images are saved. Are they added to the jar file?
type: QuestionComment
comment on: http://stackoverflow.com/q/24108844
score: 0
type: Comment

http://stackoverflow.com/comment/132106822
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24388412
type: AnswerComment
has text: This didn't work for me. It might only work for corrupted jars.

http://stackoverflow.com/comment/37262893
comment on: http://stackoverflow.com/a/24147273
has text: Actually Sotirios [answered](http://stackoverflow.com/a/24147246/1393766) your question correctly explaining also possible problem with `next` so probably his answer should be accepted with comment that `next` was indeed the problem, and this answer should be deleted.
score: 2
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37283625
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24158640
score: 0
has text: increse size of heap memory by adding VM arguments to your server

ssl
tags question: http://stackoverflow.com/q/24197201
tags question: http://stackoverflow.com/q/24137805
tags question: http://stackoverflow.com/q/24198072
tags question: http://stackoverflow.com/q/24218980
tags question: http://stackoverflow.com/q/24137463
tags question: http://stackoverflow.com/q/24121801
tags question: http://stackoverflow.com/q/24118757
tags question: http://stackoverflow.com/q/24260797
type: Tag
tags question: http://stackoverflow.com/q/24144741
tags question: http://stackoverflow.com/q/24253889
tags question: http://stackoverflow.com/q/24162481
tags question: http://stackoverflow.com/q/24176491
tags question: http://stackoverflow.com/q/24180979
tags question: http://stackoverflow.com/q/24156838
tags question: http://stackoverflow.com/q/24237339
tags question: http://stackoverflow.com/q/24115945
tag name: ssl
tags question: http://stackoverflow.com/q/24117040

http://stackoverflow.com/q/24105807
tagged with: ejb
type: UnansweredQuestion
downvote count: 2
tagged with: stateful
has body: I would like to know, what are the principal differences between : javax.enterprise.context.SessionScoped and javax.ejb.Stateful javax.enterprise.context.ApplicationScoped and javax.ejb.Singleton I know that a @SessionScoped and a @Stateful allows to create a new instance for each client. I also know that for the @ApplicationScoped and @Singleton / @Stateless they are shared between the clients. => But when should I consider it's better to choose an EJB, or the other?
tagged with: stateless
has title: Differences : @SessionScoped vs @Stateful and @ApplicationScoped vs @Singleton
tagged with: singleton
tagged with: java
answer count: 1
score: 13
favorite count: 0
type: Question
upvote count: 15
has answer: http://stackoverflow.com/a/24119852

http://stackoverflow.com/comment/37376141
comment on: http://stackoverflow.com/a/24171341
type: Comment
type: AnswerComment
has text: We are using Xercus in Class path as this jar is one of the Maven Dependent . I know this problem arises when we have Xercus jar in ClassPath. Idealy , we should not use this jar in ClassPath as this Jar comes with JDK. My Question now is, How can we avoid this ?
score: 0

http://stackoverflow.com/comment/37456351
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24249412
has text: Yes. It is. What have you tried/researched to achieve this?

http://stackoverflow.com/a/24116563
score: 1
type: AcceptedAnswer
downvote count: 1
type: Answer
has body: Something like that: @Autowired @Bean(name = "repositoryService" RepositoryService createRepositoryService(ProcessEngine processEngine) { return processEngine.getRepositoryService(); } See also documentation: http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/beans.html#beans-factory-class-instance-factory-method
accepted answer of: http://stackoverflow.com/q/24116496
upvote count: 2
answers question: http://stackoverflow.com/q/24116496

jcomponent
type: Tag
tags question: http://stackoverflow.com/q/24111830
tag name: jcomponent
tags question: http://stackoverflow.com/q/24110920
tags question: http://stackoverflow.com/q/24263674

http://stackoverflow.com/q/24172449
answer count: 1
has comment: http://stackoverflow.com/comment/37310689
has comment: http://stackoverflow.com/comment/37310566
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37310667
has answer: http://stackoverflow.com/a/24172798
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37310876
tagged with: java
has title: My simple java HTTPS server only works for localhost
has comment: http://stackoverflow.com/comment/37311717
has body: I have a simple HTTPS test server implemented in Java, as shown below. It accepts client connections and sends back a piece of text about the socket. The problem is that it works locally on a browser using https://localhost:8888, but it does not work with remote browsers, when I use the real IP of my machine (129.46.xx.xx:8888). Where is the problem coming from? When testing, don't forget to generate a sample certificate and provide the info below. EDIT: Interestingly, when I run it on Ubuntu 12.04, I can connect to it. But not when running on windows! import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.security.KeyStore; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.SSLSocket; public class HttpsEchoer { public static void main(String[] args) { String ksName = "myks.jks"; char ksPass[] = "mypass".toCharArray(); char ctPass[] = "mypass".toCharArray(); try { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(ksName), ksPass); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, ctPass); SSLContext sc = SSLContext.getInstance("TLS"); sc.init(kmf.getKeyManagers(), null, null); SSLServerSocketFactory ssf = sc.getServerSocketFactory(); SSLServerSocket s = (SSLServerSocket) ssf.createServerSocket(8888); System.out.println("Server started:"); printServerSocketInfo(s); // Listening to the port int count = 0; while (true) { SSLSocket c = (SSLSocket) s.accept(); // Someone is calling this server count++; System.out.println("Connection #: "+count); printSocketInfo(c); BufferedWriter w = new BufferedWriter( new OutputStreamWriter(c.getOutputStream())); BufferedReader r = new BufferedReader( new InputStreamReader(c.getInputStream())); String m = r.readLine(); // System.out.println(m); …
tagged with: servlets
downvote count: 0
has comment: http://stackoverflow.com/comment/37312270
type: UnansweredQuestion

http://stackoverflow.com/q/24184960
answer count: 1
has answer: http://stackoverflow.com/a/24187025
linked to: http://stackoverflow.com/q/23105433
accepted answer: http://stackoverflow.com/a/24187025
has comment: http://stackoverflow.com/comment/37334159
type: Question
has title: javafx how to make a panel public static
duplicate of: http://stackoverflow.com/q/23105433
has comment: http://stackoverflow.com/comment/37334764
has comment: http://stackoverflow.com/comment/37333969
tagged with: java
has comment: http://stackoverflow.com/comment/37334666
has body: while i am trying to make a panel public static it don't show any error in compiling but during run time it gives an error like: Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305) 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 sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) at java.lang.Thread.run(Thread.java:745) Caused by: javafx.fxml.LoadException: unknown path at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2595) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425) at schoolmanagement2.SchoolManagement2.start(SchoolManagement2.java:32) at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837) at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298) at java.security.AccessCon…
tagged with: javafx-2
type: AnsweredQuestion
score: 0
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/37337468
has comment: http://stackoverflow.com/comment/37334422
tagged with: javafx

http://stackoverflow.com/q/24149963
has comment: http://stackoverflow.com/comment/37270047
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37269648
has comment: http://stackoverflow.com/comment/37269485
has comment: http://stackoverflow.com/comment/37269229
has comment: http://stackoverflow.com/comment/37269462
has comment: http://stackoverflow.com/comment/37269107
has comment: http://stackoverflow.com/comment/37269535
has comment: http://stackoverflow.com/comment/37269330
has body: I was trying with the following program package com; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.Map; import java.util.StringTokenizer; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class Test { public static void main(String[] args) throws JSONException { } I was successful until here Which is producing jsom until leaf , from there on i am completely lost .
has answer: http://stackoverflow.com/a/24151000
accepted answer: http://stackoverflow.com/a/24151000
has title: Unable to create JSON correctly
has comment: http://stackoverflow.com/comment/37268842
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37268748
tagged with: http://stackoverflow.com/tag/json
answer count: 1

http://stackoverflow.com/comment/37490349
comment on: http://stackoverflow.com/a/24265401
type: Comment
has text: See your exception is due to accessing the numeric data in text column so do changes in switch cases according to data types, I don't have your code how can i figure out the cause of exception
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37330753
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24183081
has text: using intValue is same as what you are doing in second case. Instead of finding ways for unboxing its better to call equals();
type: AnswerComment

http://stackoverflow.com/comment/37231975
type: Comment
score: 2
type: AnswerComment
has text: @Qix The question `So, why do the compiler just throws me the error at Test 1, if void b() (Test 2) and System.out.println("end"); (Test 3) isn't reachable?` The links and quotes explain the _why_. The before-last paragraph explains how it applies to the `while` in Test 1, and the last paragraph explains how it applies to the Tests 2 and 3. Is there something I missed? What is irrelevant?
comment on: http://stackoverflow.com/a/24130489

http://stackoverflow.com/a/24139022
score: 2
downvote count: 0
has body: The tree label provider needs to be DecoratingLabelProvider to pick up the decorators: treeViewer.setLabelProvider( new DecoratingLabelProvider(your label provider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); you pass your label provider as a parameter to DecoratingLabelProvider.
answers question: http://stackoverflow.com/q/24133364
type: Answer
upvote count: 2

http://stackoverflow.com/a/24248815
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24248714
type: Answer
score: 0
has body: The previous value is overwritten because you always adding new list instance into adapter. So make list instance only once,i.e. globally in your activity.i.e. add this line List list = new ArrayList(); below to public class MainActivity extends ActionBarActivity { Spinner spinner1,spinner2,spinner3; Button add; EditText subject; And use below code in your onClick function. as String content; content = subject.getText().toString(); list.add(content); ArrayAdapter dataAdapter = new ArrayAdapter(MainActivity.this,android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(dataAdapter);
answers question: http://stackoverflow.com/q/24248714

http://stackoverflow.com/a/24147598
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24147554
score: 1
has body: Constructor doesn't have a return type. Your constructor should be: public NameParser(String nameTable, String tokenTable) { } The one you tried to define is, in fact, a static method (class method), because of the static modifier and the return type void (which means that it doesn't return anything). Also, the error you are getting is because in the line NameParser nameParser = new NameParser(args[0], args[1]); you are calling a constructor with the parameters (String, String) which doesn't exist.

http://stackoverflow.com/comment/37340032
type: AnswerComment
comment on: http://stackoverflow.com/a/24188751
type: Comment
has text: More about it is here http://stackoverflow.com/questions/2882337/junit-assertsame
score: 0

http://stackoverflow.com/comment/37403809
comment on: http://stackoverflow.com/q/24220397
type: Comment
type: QuestionComment
has text: error message is The method getDate() is undefined for the type EventDetail
score: 0

http://stackoverflow.com/comment/37454869
has text: i mean get and set operation on map will be thread safe or not.
score: 0
comment on: http://stackoverflow.com/q/24248357
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37482052
comment on: http://stackoverflow.com/q/24263078
type: Comment
type: QuestionComment
has text: please explain a bit more?
score: 3

http://stackoverflow.com/a/24221008
score: 0
answers question: http://stackoverflow.com/q/24220844
has body: SELECT * FROM RATINGS ORDER BY SCORE DESC LIMIT 10 You need the ORDER BY to sort, then you need DESC to sort it in a descending order and finally LIMIT 10 is for having only 10 results.
type: Answer

http://stackoverflow.com/q/24248420
has title: How do I remove elements and their children from Xml using Java and Stax
type: AnsweredQuestion
score: 3
has body: I have a large file containing data like this ...... ...... I want to produce and output file the same as the input file but with all the companies elements and their children removed.I'm trying to use Stax, I thought that it iterated down through the elements and then if I got a match I could just not write that element and the section would be removed. i.e if I throw away element that causes elements within it and to be removed but it seems that it just removes the element itself and nothing else, is that right ? i.e ...... ...... This is the code I currently have: XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); InputStream in = new FileInputStream(source); XMLEventReader reader = inputFactory.createXMLEventReader(in); OutputStream out = new FileOutputStream(target); XMLEventWriter writer = outputFactory.createXMLEventWriter(out); XMLEvent event; while(reader.hasNext()){ event = reader.nextEvent(); writer.add(event); if(event.getEventType() == XMLStreamConstants.START_ELEMENT) { if(event.asStartElement().getName().toString().equalsIgnoreCase("companies")) { System.out.println("Deleting:"+event); continue; } else { writer.add(event); } } else { writer.add(event); } }
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24248933
answer count: 1
has answer: http://stackoverflow.com/a/24248933
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: stax
downvote count: 0

http://stackoverflow.com/q/24246789
tagged with: android-fragments
score: 1
tagged with: java
has body: Im trying to implement actionbar tabs that are fragments using this tutorial, but I keep getting this error: LogCat: 06-16 17:00:46.778: E/AndroidRuntime(25789): FATAL EXCEPTION: main 06-16 17:00:46.778: E/AndroidRuntime(25789): java.lang.NullPointerException 06-16 17:00:46.778: E/AndroidRuntime(25789): at com.myapp.Main.initWidgets(Main.java:115) 06-16 17:00:46.778: E/AndroidRuntime(25789): at com.myapp.Main.onCreateView(Main.java:52) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:478) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.view.ViewPager.populate(ViewPager.java:1068) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.view.ViewPager.populate(ViewPager.java:914) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.support.v4.view.ViewPager$3.run(ViewPager.java:244) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.os.Handler.handleCallback(Handler.java:605) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.os.Handler.dispatchMessage(Handler.java:92) 06-16 17:00:46.778: E/AndroidRuntime(25789): at android.os.Looper.loop(Looper.java:137) 06-16 17:00:46.778: E/AndroidR…
answer count: 1
downvote count: 0
has title: ActionBar Tabs -null pointer exception
tagged with: android-tabs
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24246885
tagged with: android
accepted answer: http://stackoverflow.com/a/24246885
tagged with: android-fragmentactivity
type: AnsweredQuestion

http://stackoverflow.com/q/24207723
has comment: http://stackoverflow.com/comment/37377196
score: 0
tagged with: rmi
tagged with: java
answer count: 1
type: Question
has title: data sending server to different client data
accepted answer: http://stackoverflow.com/a/24208031
has body: I am doing a project of Restaurant ordering system in that I gave order by using different client and process that order and that order can send different system, e.g: kitchen1 Kitechn2, and kitchen3 First I can create different client by using rmi threading concept an and they can send (means all client) data to my server i want to sent that data into different client How can I do that? I do create different client and send data to the server suggest how can I do that?
has answer: http://stackoverflow.com/a/24208031
type: AnsweredQuestion

http://stackoverflow.com/comment/37443036
comment on: http://stackoverflow.com/a/24242048
score: 0
type: AnswerComment
has text: The write_imageui-function needs an int4 as the 3. parameter. Thx for the information about the luminosity method.
type: Comment

http://stackoverflow.com/comment/37466483
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24254431
type: QuestionComment
has text: ya, but the question is how you gonna handle the exception? I do not see anywhere in your code that you have used Scanner ?

http://stackoverflow.com/comment/37245244
has text: I don't have experience with databases yet in Android so maybe the next question is a dumb question: From where do I populate the database?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24137948
score: 0

http://stackoverflow.com/q/24264947
tagged with: java
has comment: http://stackoverflow.com/comment/37486938
downvote count: 0
answer count: 1
upvote count: 1
tagged with: distributed-computing
has title: RMI connection with wifi and dialup internet
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24266460
has body: I have created a simple database application using rmi. It works fine with my local wireless network. But now i want to connect my client to the server through the internet. I know that, this can be achieved with setting up port forwarding in the router. But i want it to work in any computer which is connected to the internet using wifi connections, dialup connections etc. How to do that? what to write here? Naming.lookup ("rmi://?????????????"); As I am quite new to java, Please give me a detailed answer with a simple code example. Thanks in advance
linked to: http://stackoverflow.com/q/3071376
has answer: http://stackoverflow.com/a/24266460
has comment: http://stackoverflow.com/comment/37486024
type: AnsweredQuestion
score: 1
tagged with: rmi

for-loop
tags question: http://stackoverflow.com/q/24253804
tags question: http://stackoverflow.com/q/24253175
tags question: http://stackoverflow.com/q/24128937
tags question: http://stackoverflow.com/q/24227278
tags question: http://stackoverflow.com/q/24191040
tags question: http://stackoverflow.com/q/24114880
type: Tag
tags question: http://stackoverflow.com/q/24141227
tags question: http://stackoverflow.com/q/24202528
tags question: http://stackoverflow.com/q/24137928
tag name: for-loop
tags question: http://stackoverflow.com/q/24137160
tags question: http://stackoverflow.com/q/24179253
tags question: http://stackoverflow.com/q/24156468
tags question: http://stackoverflow.com/q/24248499
tags question: http://stackoverflow.com/q/24264597

http://stackoverflow.com/a/24191600
downvote count: 0
score: 21
upvote count: 21
has comment: http://stackoverflow.com/comment/37365442
type: Answer
has body: According to the Mockito documentation, you can make a mock serializable: List serializableMock = mock(List.class, withSettings().serializable());
answers question: http://stackoverflow.com/q/24184643
has comment: http://stackoverflow.com/comment/37366098
has comment: http://stackoverflow.com/comment/37360185

http://stackoverflow.com/q/24211099
type: UnansweredQuestion
tagged with: program-entry-point
has comment: http://stackoverflow.com/comment/37383821
answer count: 1
favorite count: 0
tagged with: exception
tagged with: java
downvote count: 1
score: -1
has title: What's the point of throwing an Exception from the main method of Java program?
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24211203
has body: What's the point of throwing an Exception from the main method of Java program, because it can't ever get caught and handled by any calling method? the following doesn't really make sense right? public static void main(String[] args) throws ReconToolException { parseCmdArgs(args); try { CSVSingleton.tryToReadBothFiles(FILE1_PATH, FILE2_PATH); } catch (Exception e) { e.printStackTrace(); System.exit(0); } run(); } it would be better as: public static void main(String[] args) { parseCmdArgs(args); try { CSVSingleton.tryToReadBothFiles(FILE1_PATH, FILE2_PATH); } catch (Exception e) { e.printStackTrace(); System.exit(0); } try { run(); } catch (ReconToolException e) { // TODO Auto-generated catch block e.printStackTrace(); } } should Java prevent us from doing the former? Or maybe in more complex frameworks the main method has the ability to throw an Exception further up the chain?
has comment: http://stackoverflow.com/comment/37388845
has comment: http://stackoverflow.com/comment/37383529

http://stackoverflow.com/comment/37375465
comment on: http://stackoverflow.com/a/24196517
type: Comment
has text: @ThomasDarimont I have come across a few. My Bedtime right now. Bu if there is a place to submit a JIRA issue or whatever bug tracking then let me know. I'll dig up a case and test, against trunk if required.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24220948
has body: Error: Could not find or load main class com.badlogic.jglfw.generators.ALGenerator I started a new LibGDX project and got this error. I thought that maybe it was just because I was trying to avoid gradle. So I made a new project using gdx-setup.jar. Then I went to run the desktop version and got the same error as above. So I was like, ok. Is it just because I am using LibGDX 1.1.0 now? So I ran a previous LibGDX project which was just working. I got this error again. Well, time to try something different. I delete all the code in the desktop class and went from this: package com.gdx.main.desktop; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.gdx.main.GdxGame; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); new LwjglApplication(new GdxGame(), config); } } To this: package com.gdx.main.desktop; public class DesktopLauncher { public static void main (String[] arg) { System.out.println("Hello World!"); } } I still got the same error. So I assume it is something to do with Eclipse now, but not sure. I googled the error, but couldn't find anything. My search results were always less than 10. So I guess no one else is getting this error. Any ideas on where to start or have you encountered something similar? EDIT Did not change anything. Same error for new project, but now the old project is working fine. Weird... Deleted project, re-created though gdx-setup.jar... same error.
has title: Error: Could not find or load ALGenerator
tagged with: java
answer count: 1
type: Question
tagged with: libgdx
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/24221630
score: 0

http://stackoverflow.com/q/24213252
linked to: http://stackoverflow.com/q/22107380
favorite count: 0
tagged with: loopj
type: Question
has title: What is the most optimal way to upload large data to server from an Android App?
has body: I have an Android App that needs to upload, download data files between 10-12MB relatively often. Given that my app is more popular in countries like India which may not have good internet connectivity I am working under following constraints User may not be connected to internet 24x7 User's interaction does not depend on whether the download/upload succeeds. This is a poems app where we download new poems to users phone and upload user's poems to our server whenever we are connected to internet. I understand that using "com.loopj.android.http.AsyncHttpClient;" for the communication but I was wondering if there are any better alternatives which can do the following: Should I start a service which provides interfaces for upload/download ? Is it possible to do this stuff in background, even when user is not using the app?
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/37389453
has answer: http://stackoverflow.com/a/24214001
has comment: http://stackoverflow.com/comment/37389369
has comment: http://stackoverflow.com/comment/37397854
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24214001
score: 2
tagged with: java
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37386710
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24212184
has text: I appreciate your help here very much, but that far exceeds the scope of what I'm wanting to do as well as the simplicity I desire. I'd like to figure out why my code is not working in the context of a .bat file. Thanks again.

http://stackoverflow.com/a/24209001
has body: When you see a blobkey, the file is already uploaded to GCS. You can resave it with different options, if you want, but you don't have to upload it again - it's already in your bucket.
type: Answer
has comment: http://stackoverflow.com/comment/41056467
score: 0
has comment: http://stackoverflow.com/comment/40968573
has comment: http://stackoverflow.com/comment/41040132
answers question: http://stackoverflow.com/q/24205046
has comment: http://stackoverflow.com/comment/40982028

http://stackoverflow.com/a/24105737
has comment: http://stackoverflow.com/comment/46627706
has comment: http://stackoverflow.com/comment/46743730
has comment: http://stackoverflow.com/comment/46748147
has comment: http://stackoverflow.com/comment/46627267
has comment: http://stackoverflow.com/comment/37207770
has body: You should use filename = "/org/cyberneko/html/res/HTMLlat1.properties" instead of filename = "/org.cyberneko.html/res/HTMLlat1.properties" or use relative paths. This could be explained in this way: jar (jar is an example, maybe you're running your code from *.class in some directory) is just some kind of file system with it's root ("/") and all the files in the packages are in some subdirectories and you should specify the paths for them.
has comment: http://stackoverflow.com/comment/46662045
answers question: http://stackoverflow.com/q/24105713
score: 1
has comment: http://stackoverflow.com/comment/37185329
has comment: http://stackoverflow.com/comment/46700906
type: Answer
has comment: http://stackoverflow.com/comment/37185044
has comment: http://stackoverflow.com/comment/46662496
has comment: http://stackoverflow.com/comment/46625529
has comment: http://stackoverflow.com/comment/46633126
has comment: http://stackoverflow.com/comment/46703472
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/46661317
has comment: http://stackoverflow.com/comment/37209335
has comment: http://stackoverflow.com/comment/46700916
has comment: http://stackoverflow.com/comment/37185099

http://stackoverflow.com/comment/54288365
score: 0
comment on: http://stackoverflow.com/a/24161971
type: AnswerComment
has text: Having the exact same issue here.
type: Comment

http://stackoverflow.com/comment/58278733
type: AnswerComment
comment on: http://stackoverflow.com/a/24116353
has text: This was my problem. I changed my format to the following and now my screenshots are correctly named in my Windows directory: java.text.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'_'HHmmss'_'");
type: Comment
score: 2

java.util.concurrent
tags question: http://stackoverflow.com/q/24154382
tags question: http://stackoverflow.com/q/24129183
tag name: java.util.concurrent
tags question: http://stackoverflow.com/q/24241335
type: Tag
tags question: http://stackoverflow.com/q/24200750

http://stackoverflow.com/comment/37457449
type: AnswerComment
score: 0
has text: But those mav.put or model.put are not even defined in the Model and ModelandView object types.
type: Comment
comment on: http://stackoverflow.com/a/24238229

http://stackoverflow.com/q/24106852
tagged with: date
has answer: http://stackoverflow.com/a/24107303
type: AnsweredQuestion
tagged with: jsf-2
score: 1
has title: Primefaces Schedule add an event on every week of a given time period
tagged with: java
downvote count: 0
answer count: 1
tagged with: schedule
upvote count: 1
favorite count: 0
type: Question
has body: I'm building an online schedule for the Laboratory office of my school.I have access to my school database which stores the day an time period of a given class (ie : Chemestry 101-MONDAY-10:00 to 13:00). So I need to load the event that contains the name,day,and hours of a class (Chemestry 101-MONDAY-10:00 to 13:00) on every week of the current academic period and then show it on the Schedule .The only way I can think of doing it is by calculating the Date of the first monday of the current academic period , adding that event to the schedule component , then calculate the date of the next monday and add that event to the schedule component until the academic period ends , But it seems cumbersome and unnecesary.So here is my question Is there anyway I can tell primefaces to load a class (ie."Chemestry 1010-MONDAY-10:00 to 13:00") on the same day of every week during a certain period of Time (the academic period) WITHOUT creating a loop on my managedBean that calculates the individual date of each class??? Im using Primefaces 3.5 and STS (spring tool suite 3.4.0)
tagged with: primefaces
accepted answer: http://stackoverflow.com/a/24107303

rad
type: Tag
tags question: http://stackoverflow.com/q/24264405
tag name: rad
tags question: http://stackoverflow.com/q/24140475

http://stackoverflow.com/comment/37237871
has text: So you want to sort them by date, or do you also want to modify the content as well (change the order)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24133773

http://stackoverflow.com/q/24146349
has answer: http://stackoverflow.com/a/24146410
has comment: http://stackoverflow.com/comment/37260877
favorite count: 0
linked to: http://stackoverflow.com/q/4457352
has title: Java class constructor
type: Question
has comment: http://stackoverflow.com/comment/37261017
tagged with: constructor
linked to: http://stackoverflow.com/q/218384
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37260896
has body: I am new to Java and I want to make an audio sequencer. So I've started with a class for sounds and I have this: public class Sb { public static AudioInputStream audioInputStream; public static File file; public static Clip clip; Sb(String a){ try { file = new File(a); audioInputStream = AudioSystem.getAudioInputStream(file); } catch (UnsupportedAudioFileException u) { } catch(IOException i) { } catch(NullPointerException n) { } } public static void play(){ clip.start(); } } I declare an instance like: public static Sb hats = new Sb("file path"); And when I run hats.play() I get: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException Any ideas how I can make this class work? Thanks! Edit: Modified Constructor: Sb(String a) throws UnsupportedAudioFileException, IOException, LineUnavailableException { file = new File(a); audioInputStream = AudioSystem.getAudioInputStream(file); clip = AudioSystem.getClip(); } But when I declare it now I get an error on this line: public static Sb hats = new Sb("file path"); Error: "unreported exception UnsuportedAudioFileException must be caught or declared to be thrown
score: -2
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/37261129
has comment: http://stackoverflow.com/comment/37261273
tagged with: audio
has comment: http://stackoverflow.com/comment/37260862
has comment: http://stackoverflow.com/comment/37260893
duplicate of: http://stackoverflow.com/q/4457352
upvote count: 0
has comment: http://stackoverflow.com/comment/37260913
tagged with: java
downvote count: 2
answer count: 1

http://stackoverflow.com/q/24167848
favorite count: 0
type: Question
has body: I am hoping to use the MVP pattern in Android that I roughly came up with the following packages and classes: Here are 3 packages: com.myview mainActivity //public com.ipresenter IPresenter //public com.PresenterImpl Presenter //protected Presenter implements IPresenter. What I intend to do is to make Presenter protected and can be instantiated only in mainActivity. Other words, I would like to limit its visibility and creation of this class can only be made possible through mainActivity class. Since its constructor is implicitly declared as protected, I cannot instantiate Presenter within class mainActivity. How could I do this without having to make Presenter public? How can I limit the visibility of a (or some) class within a package and allow its creation only through another class that lies within another package? I thought about the classLoader Iterator method, but is this an overkill or it is not necessary because there are other ways / patterns? Many books seem to suggest to limit the visibility of classes as much as we can, so I am taking this opportunity to learn and utilize good practice. Addendum: In addition to the aforementioned, my ultimate goal is to be able to declare the presenter within the mainActivity using the interface type. So, if in the future I had more than one presenters, they would all still be of the interface type IPresenter.
answer count: 0
has comment: http://stackoverflow.com/comment/37301502
type: UnansweredQuestion
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/37301383
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37301931
score: 1
tagged with: android
tagged with: java
has title: Class visibilities and instantiation in MVP

http://stackoverflow.com/q/24181033
favorite count: 0
type: Question
tagged with: hadoop
has title: Apache Flume /var/log/flume-ng/flume.log (Permission denied)
has answer: http://stackoverflow.com/a/24181265
accepted answer: http://stackoverflow.com/a/24181265
tagged with: flume
tagged with: flume-ng
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1
has body: I am trying to read a log file from /home/cloudera/Documents/flume/ and write it to hdfs using apache flume . I used the following command to create flumeLogTest folder in hdfs : sudo -u hdfs hadoop fs -mkdir flumeLogTest sudo -u hdfs hadoop fs -chown flume:flume flumeLogTest My config file is : agent.sources = src agent.channels = ch agent.sinks = snk agent.sources.src.type = exec agent.sources.src.command = tail -f Documents/flume/vmware-0.log agent.sources.src.channels = ch agent.sinks.snk.channel = ch agent.sinks.snk.type = hdfs agent.sinks.snk.hdfs.path = hdfs://localhost.localdomain:8020/user/hdfs/flumeLogTest agent.sinks.snk.hdfs.fileType = DataStream agent.sinks.snk.hdfs.writeFormat = Text agent.channels.ch.type = memory agent.channels.ch.capacity = 100 And I started the flume-agent by the following command : /usr/bin/flume-ng agent --conf Documents/flume --conf-file Documents/flume/Example1.conf --name agent where Documents/flume is a folder in /home/cloudera/ this folder contains the following file flume-conf.properties.template log4j.properties flume-env.sh.template flume-env.sh Example1.conf and I'm getting the following error: log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /var/log/flume-ng/flume.log (Permission denied) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:192) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:116) at org.apache.log4j.FileAppender.setFile(FileAppender.java:294) at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.j…

http://stackoverflow.com/comment/37396348
comment on: http://stackoverflow.com/a/24217911
type: Comment
has text: Funny, I thought `fruit` was a purposeful distraction.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24208612
has comment: http://stackoverflow.com/comment/37378485
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/37378142
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/24209105
has body: Can null be casted to any type? i.e. will the following code work public &lt;T&gt; T foo(Object object){ return (T) object; } Duck duck = foo(new Duck()); // this works Duck duck2 = foo(null); // should this work? Cat cat = foo(null); // should this work? // if they are both null, should this be true? boolean equality = duck2.equals(cat); My question is, is null 'castable to anything'?
has comment: http://stackoverflow.com/comment/37378201
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24209105
linked to: http://stackoverflow.com/q/2707322
possible better answer: http://stackoverflow.com/a/24208726
tagged with: casting
tagged with: null
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/24208726
has title: Casting null to any type

http://stackoverflow.com/q/24234985
has comment: http://stackoverflow.com/comment/37436541
has comment: http://stackoverflow.com/comment/37429002
score: 0
tagged with: java
tagged with: sqlite
has title: SQLite - Update after certain row
answer count: 0
type: Question
tagged with: android
type: UnansweredQuestion
has body: I want to update rows after a certain id, but am unsure how. I got the id by taking a value from the last position of an arraylist, and then I passed that to my database helper. private void addNewerOlderHashtags(List&lt;Status&gt; timeline) { // get the last id of the arraylist int lastId = Integer.parseInt(timeline_arg.get(timeline_arg.size() -1).get("sql_id")); for (int i=0; i &lt; timeline.size(); i++){ long tweetId = Long.parseLong(timeline_arg.get(i).get("tweet_id")); try { Status status = mTwitter.showStatus(tweetId); HashtagEntity[] entity = status.getHashtagEntities(); List&lt;String&gt; hashlist = new ArrayList&lt;String&gt;(); for (HashtagEntity hashtag : entity){ String text = hashtag.getText(); hashlist.add(text); dbHelper.addNewerOlderHashtags(lastId, hashlist.toString()); } } catch (TwitterException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Database Helper: public void addNewerOlderHashtags(int id, String hashtags) { try { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(COL_HASHTAG_ENTITIES, hashtags); String[] whereArgs = {Integer.toString(id)}; db.update(TABLE_TWEETS, values, Tweets.COL_ROW_ID + "&gt;?", whereArgs); db.close(); } catch (Exception ex) { System.out.println(ex); } }

http://stackoverflow.com/q/24173771
has answer: http://stackoverflow.com/a/24174978
has answer: http://stackoverflow.com/a/24175122
has comment: http://stackoverflow.com/comment/37312854
type: Question
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has body: I am reading csv file by using java program (done successfully) I want to extract all the data in 2D array (partially done successfully) Issue I am facing is , when some words having space (eg. "Los Angeles", "New Delhi") then its showing error - My employee.CSV file is like- Name,Age,City,Country,Salary John,25,Los Angeles,US,30000 David,28,Paris,France,45000 Lee-Anne,23,Tokyo,Japan,20000 Hemal,24,New Delhi,India,40000 If there is no space eg. LosAngeles , NewDelhi , then its working fine for me, but i need data with space only.(i wanna use filled array in selenium) Code i have written is below - package java2package; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Datadriven { public static void main(String[] args) { String[][] myArray = new String[4][5]; String[] tempArray=new String[5]; int Rowc=0; String fileName="employee.csv"; File file=new File(fileName); try { Scanner content=new Scanner(file); content.next(); while(content.hasNext()) { String data=content.next(); tempArray=data.split(","); for(int i=0;i&lt;5;i++) { myArray[Rowc][i]=tempArray[i]; } Rowc++; } content.close(); for(int i=0;i&lt;4;i++){ for(int j=0;j&lt;5;j++){ System.out.print(myArray[i][j]+" "); } System.out.print("\n"); } } catch (FileNotFoundException e) { System.out.println(e); } } } I am using Eclipse, error i am getting is - Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at java2package.Datadriven.main(Datadriven.java:31)
has comment: http://stackoverflow.com/comment/37313056
has comment: http://stackoverflow.com/comment/37313386
tagged with: java
linked to: http://stackoverflow.com/q/14274259
has comment: http://stackoverflow.com/comment/37314717
answer count: 4
has comment: http://stackoverflow.com/comment/37317846
score: 0
has answer: http://stackoverflow.com/a/24175791
has answer: http://stackoverflow.com/a/24174058
has title: read csv data with space and fetching it into array by using java
has comment: http://stackoverflow.com/comment/37317803
tagged with: arrays
has comment: http://stackoverflow.com/comment/37313100

http://stackoverflow.com/q/24223783
has comment: http://stackoverflow.com/comment/37408873
upvote count: 1
linked to: http://stackoverflow.com/q/12766930
has comment: http://stackoverflow.com/comment/37407394
has comment: http://stackoverflow.com/comment/37407825
favorite count: 0
has comment: http://stackoverflow.com/comment/37409086
answer count: 3
has comment: http://stackoverflow.com/comment/37407921
has answer: http://stackoverflow.com/a/50111383
has comment: http://stackoverflow.com/comment/37407817
has body: I'm trying to put a custom font in my app, but I'm having a lot of mistakes! Someone please help me? I am a student and do not have much sense. This is the code I'm trying to put inside MainActivity.java: TextView tx = (TextView)findViewById(R.id.textView1); Typeface custom_font = Typeface.createFromAsset(this.getAssets(), "fonts/watermelon.ttf"); tx.setTypeface(custom_font); This is the code of MainActivity: package com.akzonobel.malote; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.text.method.ScrollingMovementMethod; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.os.Build; import android.view.View.OnClickListener; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.widget.Button; import android.widget.TextView; @SuppressWarnings("unused") public class MainActivity extends ActionBarActivity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Typefaces.get(getApplication(), "fonts/watermelon.ttf"); TextView tx = (TextView)findViewById(R.id.textView1); Typeface custom_font = Typeface.createFromAsset(this.getAssets(), "fonts/watermelon.ttf"); tx.setTypeface(custom_font); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit();} } public void opensecondactivity(View view) { Intent intent = new Intent(this , SecondActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_in, R.anim.slide_out); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenu…
score: 1
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/3424165
has comment: http://stackoverflow.com/comment/37408962
has answer: http://stackoverflow.com/a/24223830
has comment: http://stackoverflow.com/comment/37408389
tagged with: android-activity
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37408120
has comment: http://stackoverflow.com/comment/37409240
has title: How to put a custom font in my android application?
type: Question
has comment: http://stackoverflow.com/comment/37408263
has comment: http://stackoverflow.com/comment/37407850
has comment: http://stackoverflow.com/comment/37409253
tagged with: fonts
has comment: http://stackoverflow.com/comment/37407497
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37407765
downvote count: 0
has answer: http://stackoverflow.com/a/50111453

http://stackoverflow.com/comment/37229910
type: QuestionComment
has text: Do you *want* to delete the ObjectFactory each time? If you don't care about that, just skip deleting that class by using this: http://maven.apache.org/plugins/maven-clean-plugin/clean-mojo.html#filesets Let me know if that's a solution for you and I'll post it as an answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24117309

http://stackoverflow.com/a/24641001
score: 2
upvote count: 2
downvote count: 0
has body: There is no support for what you want to do automatically.
answers question: http://stackoverflow.com/q/24119743
type: Answer

http://stackoverflow.com/a/24130355
type: Answer
accepted answer of: http://stackoverflow.com/q/24130045
type: AcceptedAnswer
has body: The logic of this is simple, but you're looking at it backwards. For every day in the requested time period, is that day covered by one of the date entries? If you find a day that isn't covered, then there's a gap and you can stop checking and send the error back to the user - don't keep checking days unless you want to notify the user of specifics of all the gaps you identify, just "fail early" as soon as you find a day that isn't covered. So, in pseudo-code... foreach (Day d in DateRange) { foreach (UserDateRange u in UserDateRanges) { //check if the date range (u) covers the day in question (d) if (d &gt; u.Start &amp;&amp; d &lt; u.End) { //we're done checking this day because it's covered by at least one range covered = true; } } if (!covered) return false; } return true; //because if we got this far, every day is "covered" So... it loops through the days, and for each day, it checks all the date ranges. If one is found that covers the day, then you can go to the next day. There's lots of room for optimization here. For example, when you find a date range that covers one day, you can skip to the end of that date range, you don't need to check the rest of the days in that range. FOR loops with complex conditions would work here. You know you can put whatever condition you want in there, right? for (int x = 0; covered == false; x++ ) //perfectly valid
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24130045
has comment: http://stackoverflow.com/comment/37325141

http://stackoverflow.com/comment/37404797
has text: @Makoto So an exception with the data would have been...? Could you give an example?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24222276

http://stackoverflow.com/a/24138792
answers question: http://stackoverflow.com/q/24138538
has comment: http://stackoverflow.com/comment/38067647
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/38068486
downvote count: 0
has body: If your intentions is to call static method of an implementing class using Interface reference, the answer is No. static members belong to class only, so you will always need a Class type reference (actually it should be the class name) to access them. With interfaces you can only point to what you have declared in it.
has comment: http://stackoverflow.com/comment/38068252
type: Answer

http://stackoverflow.com/comment/37206342
comment on: http://stackoverflow.com/q/24116097
score: 0
type: Comment
type: QuestionComment
has text: I didn't decide to use static method and variables, it has been eclipse that "suggested" me to use that. Then I discovered that it isn't a correct way to code, and now I'm trying to fix it. I haven't decided anything. To answer your questions, it is acceptable because I will work with only one ManagementService at a time, but now I also know that it is not a good implementation if one day I decide to work with more than one ManagementServiceHandler...

http://stackoverflow.com/comment/37667217
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24257503
type: Comment
has text: I tried also profile in IE profiler. According profiler the longest duration is durning function jquery - callback execution. For request that expand node with 190 children, in response i have script consist of 41078 signs

http://stackoverflow.com/comment/37299607
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24166979
has text: No, regions are not aware of users, unfortunately. It's only user <- user_region -> region

http://stackoverflow.com/a/24173579
upvote count: 1
has body: If you're using Guava: URL url = Resources.getResource(ExternalHTMLThumbnail.class, "wkhtmltoimage"); byte[] bytes = Resources.toByteArray(url); Files.write(bytes, new File("/my/path/myFile")); You could of course just chain that all into one line; I declared the variables to make it more readable.
has comment: http://stackoverflow.com/comment/37336415
type: Answer
has comment: http://stackoverflow.com/comment/37345510
answers question: http://stackoverflow.com/q/24173337
score: 1
has comment: http://stackoverflow.com/comment/37347677
downvote count: 0

http://stackoverflow.com/a/25774985
score: 0
has body: I had this same problem. What I ended up doing was using a negative margin on the top of the ImageView like so: android:layout_marginTop="-4dp" You may have to play around to find the optimal number of dp for you. Hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/24235981

http://stackoverflow.com/a/24267669
accepted answer of: http://stackoverflow.com/q/24259058
upvote count: 2
has comment: http://stackoverflow.com/comment/37788654
type: AcceptedAnswer
downvote count: 0
has body: No, MQMD is never stripped off. You have to set identity context on the destination before sending a message. Otherwise queue manager will ignore the Accounting token. Please see the sample code: import javax.jms.Connection; import javax.jms.Destination; import javax.jms.Message; import javax.jms.MessageProducer; import javax.jms.Session; import com.ibm.msg.client.jms.JmsConnectionFactory; import com.ibm.msg.client.jms.JmsFactoryFactory; import com.ibm.msg.client.jms.JmsDestination; import com.ibm.msg.client.wmq.WMQConstants; import com.ibm.msg.client.jms.JmsConstants; import com.ibm.mq.jms.MQDestination; public class AccountingTokenDemo { public static void main(String[]args) { // TODO Auto-generated method stub AccountingTokenDemo demo = new AccountingTokenDemo(); demo.putMessageWithAccountingToken(); } public void putMessageWithAccountingToken() { JmsConnectionFactory cf = null; Connection connection = null; Session session = null; Destination reqQ = null; MessageProducer producer = null; try { // Create a connection factory JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER); cf = ff.createConnectionFactory(); // Set the properties cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_BINDINGS); cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, "QM2"); // Create JMS objects connection = cf.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // Create a 32 byte accounting toke byte [] accountingToken = new byte[32]; byte b = 'a'; for(int i=0; i &lt; 32;i++) accountingToken[i] = b++; // Create destination to send requests reqQ = session.createQueue("queue:///REQUESTQ"); ((MQDestination) reqQ).setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ); ((JmsDestination) reqQ).setBooleanProperty(WMQConstants.WMQ_MQMD_READ_ENABLED, true); ((JmsDestination) reqQ).setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true); ((MQDestination) reqQ).setMQMDMessageContext(WMQConstants.WMQ_MDCTX…
score: 2
answers question: http://stackoverflow.com/q/24259058
has comment: http://stackoverflow.com/comment/37804522
type: Answer
has comment: http://stackoverflow.com/comment/37828340

http://stackoverflow.com/a/24260653
score: 2
upvote count: 2
downvote count: 0
has body: If you could get the browser to (reliably) notify the server that the user had closed the window, then the server could call session.invalidate() as per the original Answer provided by ejay_francisco. The difficulty is getting the notification to happen reliably. There are various ways to detect the window close; e.g. as covered by these Questions (and similar): Trying to detect browser close event javascript to check when the browser window is close javascript detect browser close tab/close browser You could then write the (javascript) close event handler to send a specific request to the server. However, I don't think any scheme is going to be able to deal with cases where the user's browser dies, the user's machine is shut down, and similar scenarios. So if you need the session to be cleared 100% of the time, then you are probably out of luck. I don't think it can be done.
type: Answer
answers question: http://stackoverflow.com/q/24260271

http://stackoverflow.com/q/24120294
has body: The question is in this mouse movement Integer yCoords = evt.getY(); Consider the mouse as a pendulum on y Axis it goes up and down. I need to auto increment a value to yAxis from i.e stop point of the mouse to 100, but when the mouse moves back to 50, the final result should increment up to 150, and when it gets back to 100 it should be 200(auto increment with 50 again) yCoords += yCoords; doesn't do that trick
score: -1
tagged with: mouse
has title: java Mouse Event add to yAxis
answer count: 2
has answer: http://stackoverflow.com/a/24120343
tagged with: java
downvote count: 2
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24143072
linked to: http://stackoverflow.com/q/4231458
type: UnansweredQuestion

http://stackoverflow.com/a/24238945
answers question: http://stackoverflow.com/q/24238770
score: 0
type: Answer
has body: That's a subjective question. There's no "correct" answer. For me though; enums are best suited for use cases where a value is passed as a parameter, and you wish to ensure that it is one of a set of well known values at compile time. A Map is better used when the values represent data that your application acts on. If your application doesn't need to do that sought of if x = enum then do this kind of logic, then use a Map. If it uses different code to computes different options, use an enum. If I was simply wanting to map a credit card abbreviation to a more descriptive name, I'd use a properties file (which of course implements Map).

http://stackoverflow.com/q/24251024
type: UnansweredQuestion
answer count: 1
has title: How to enforce client code to use the APIs as expected/published
has comment: http://stackoverflow.com/comment/37460153
tagged with: loops
tagged with: design-patterns
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/37467623
has comment: http://stackoverflow.com/comment/37466090
tagged with: java
has comment: http://stackoverflow.com/comment/37468619
has body: I wanted to develop an API which will be consumed by third party - where we don't have much control over how third party will use the API. Communicating the correct way to use the API via public documentation doesn't guarantee the correct API usage. Is there any technique or design pattern to force the API consumers to use the API method as expected? Here are two usage examples of an API which has a method to tweet the statuses: Usage #1 consumer can tweet multiple statuses in a single call by passing an array of string to the method. This is the intended use by API designer. Usage #2 consumer still tweet multiple statuses but one status at a time, ending up calling tweet method ten times. That is not the intended use and can cause performance issue. I am looking a solution to enforce/prevent this API usage. API Packaged/Delivered as a jar: package com.api; public class API { public API() { // TODO Auto-generated constructor stub } public void tweet(String [] statuses) { // TODO - very expensive db call to store statuses // open db connection // insert/update // close db connection } } Client calling API: package com; import com.api.API; public class Example { public Example() { // TODO Auto-generated constructor stub } private static void client() { API api = new API(); // API Usage #1 - WAS Expected String [] statuses1 = new String[10]; for (int i = 0; i &lt; 10; i++) { statuses1[i] = new String("[" + i + "] - statuses1"); } // one call to process all 10 statuses -- RIGHT api.tweet(statuses1); // API Usage #2 - NOT Recommended String [] statuses2 = new String[1]; for (int i = 0; i &lt; 10; i++) { statuses2[i] = new String("[" + i + "] - statuses2"); // ten calls to process all 10 statuses -- WRONG api.tweet(statuses2); } } }
has answer: http://stackoverflow.com/a/24255632
score: 0
tagged with: api

http://stackoverflow.com/a/24166900
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24165623
has comment: http://stackoverflow.com/comment/37301461
has body: Two things: Try using a different package--I know the gdata package's read.xls function has support for URLs Try loading in a publicly-available xls file to make sure it's not an issue with the particular website. For instance, you can try: library("gdata") site &lt;- "http://www.econ.yale.edu/~shiller/data/chapt26.xls" data &lt;- read.xls(site, header=FALSE, skip=8) head(data)
has comment: http://stackoverflow.com/comment/37300734
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37300528

http://stackoverflow.com/comment/37377854
comment on: http://stackoverflow.com/a/24208370
has text: Yeah i understand that. But the MySQL server is installed on a remote RedHat server. Using localhost:3306 is useless if it doesnt know the host server. Does that make sense? I'm not sure if i'm explaining this correctly.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24260611
upvote count: 11
answers question: http://stackoverflow.com/q/24260215
downvote count: 0
score: 11
has body: If you want to avoid these messages you can provide logging for the case when these method return false. Something like this private static Logger LOG = Logger.getLogger("myClassName"); // some code if (!output.delete()) { LOG.info("Cannot delete file: " + output); }
has comment: http://stackoverflow.com/comment/37478050
type: Answer

http://stackoverflow.com/comment/37315038
type: AnswerComment
has text: BINGO! Works 100%. Can you please explain furhter into why this solved this? I would love to learn, thanks.
score: 0
comment on: http://stackoverflow.com/a/24171182
type: Comment

http://stackoverflow.com/a/24190057
answers question: http://stackoverflow.com/q/24188824
score: 10
type: Answer
has comment: http://stackoverflow.com/comment/37343778
upvote count: 10
has body: I believe this has to do with invocation contexts and widening reference conversion. Basically, in that invocation context, the type of the argument 0 in Arrays.asList(0) can be boxed to Integer and then widened to Number. When that happens, Arrays.asList(0) has a return type of List&lt;Number&gt;. Through the same process, that List&lt;Number&gt; can be converted to List&lt;? extends Number&gt; before being used as an argument to the outer Arrays.asList(..). This is equivalent to using explicit type arguments in Java 7 List&lt;List&lt;? extends Number&gt;&gt; xs = Arrays.&lt;List&lt;? extends Number&gt;&gt;asList(Arrays.&lt;Number&gt;asList(0)); In Java 7, the type of an expression is the same regardless of where it is used, whether it's a standalone expression or used in assignment expression. Java 8 introduced poly-expressions in which the type of the expression could be influenced by the target type of the expression. For example, in the following assignment expression List&lt;Number&gt; numbers = Arrays.asList(1); The type of the expression Arrays.asList(1) is the return type of the method being invoked which depends entirely on the generic type parameter. In this case, that type argument will be inferred as Integer because the value 1 can be converted to Integer through boxing conversion (primitives can't be used with generics). So the type of the expression is List&lt;Integer&gt;. In Java 7, this assignment expression would not compile because List&lt;Integer&gt; cannot be assigned to List&lt;Number&gt;. This could be fixed by providing an explicit type argument when invoking asList List&lt;Number&gt; numbers = Arrays.&lt;Number&gt;asList(1); in which case, the method invocation expects a Number argument for its first parameter and the value 1 satisfies that. In Java 8, the assignment expression is a poly expression A method invocation expression is a poly expression if all of the following are true: The invocation appears in an assignment context or an invoc…
has comment: http://stackoverflow.com/comment/37342579
has comment: http://stackoverflow.com/comment/37358224
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37344047
downvote count: 0
has comment: http://stackoverflow.com/comment/37342518
accepted answer of: http://stackoverflow.com/q/24188824
has comment: http://stackoverflow.com/comment/37344088

http://stackoverflow.com/q/24229660
has answer: http://stackoverflow.com/a/37295308
has answer: http://stackoverflow.com/a/54261353
has answer: http://stackoverflow.com/a/24229695
has title: MalformedURLException although I have already replaced spaces with %20
has answer: http://stackoverflow.com/a/24229687
linked to: http://stackoverflow.com/q/4737841
downvote count: 2
upvote count: 21
has answer: http://stackoverflow.com/a/44446208
type: UnansweredQuestion
tagged with: url
score: 19
favorite count: 0
type: Question
has body: String url = "http://maps.googleapis.com/maps/api/distancematrix/xml?origins="+origin+"&amp;destinations="+destination+"&amp;mode=driving&amp;sensor=false&amp;language=en-EN&amp;units=imperial"; url = url.replaceAll(" ", "%20"); Output : http://maps.googleapis.com/maps/api/distancematrix/xml?origins=150%20Sutter%20St%20San%20Francisco,%20CA,%20United%20States&amp;destinations=1%20Palmer%20Sq%20E Princeton,%20NJ%2008542&amp;mode=driving&amp;sensor=false&amp;language=en-EN&amp;units=imperial But I am getting an error saying : java.net.MalformedURLException: Illegal character in URL Can some one help me out ..
has comment: http://stackoverflow.com/comment/89676857
has comment: http://stackoverflow.com/comment/98592487
linked to: http://stackoverflow.com/q/724043
answer count: 5
tagged with: java

http://stackoverflow.com/comment/37567328
has text: JSESSIONID Cookies represent java sessions, but in general a HTTP Cookie header need not represent a server-side session. You'll only use this header to make sure the browser adds the header to the redirected request.
type: AnswerComment
comment on: http://stackoverflow.com/a/24296270
score: 0
type: Comment

http://stackoverflow.com/comment/37564063
has text: Correct indeed, here's [the new question](http://stackoverflow.com/questions/24306216/couchbase-getting-view-undefined-after-accessing-a-newly-created-production)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24260746

http://stackoverflow.com/q/24158613
score: 0
tagged with: reflection
tagged with: java
type: Question
tagged with: jakarta-ee
answer count: 2
has answer: http://stackoverflow.com/a/24160848
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24161075
has body: There are several classpath for a application (some of them are added during runtime). I want to read a file which present in two different locations. Depending upon the situation I have to load a particular file. So, I am thinking of giving preference to the classpaths. But, I don't know how it can be achieved ?
has title: Giving preferences to classpaths in java

http://stackoverflow.com/a/68140551
answers question: http://stackoverflow.com/q/24164014
downvote count: 0
type: Answer
score: 5
upvote count: 5
has body: The CacheControl class is a fluent builder, which makes it easy for us to create different types of caching: @GetMapping("/users/{name}") public ResponseEntity<UserDto> getUser(@PathVariable String name) { return ResponseEntity.ok() .cacheControl(CacheControl.maxAge(60, TimeUnit.SECONDS)) .body(new UserDto(name)); } Let's hit this endpoint in our test, and assert that we have changed the headers: given() .when() .get(getBaseUrl() + "/users/Michael") .then() .header("Cache-Control", "max-age=60");

http://stackoverflow.com/q/24116510
tagged with: string
has answer: http://stackoverflow.com/a/24116572
answer count: 4
has answer: http://stackoverflow.com/a/24116568
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24116552
score: 0
downvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37204966
has comment: http://stackoverflow.com/comment/37204936
has body: I need the program to return a message if the user input a string with blank spaces. for example "this is my house" is not allowed, "thisismyhouse" is allowed. right now I use this code to check for blank spaces for(int i = 0; i &lt; blabla.length(); i++) { if (blabla.charAt(i) == ' ') flag++; } } if (flag != 0) { System.out.println("input must not contain spaces"); } I wonder if there's a built in function like 'blabla.equals' etc for this purpose? or a better way to write this?
possible better answer: http://stackoverflow.com/a/24116552
has answer: http://stackoverflow.com/a/24116700
has title: asking for user String input without spaces in java
accepted answer: http://stackoverflow.com/a/24116572
favorite count: 0
type: Question

http://stackoverflow.com/q/24117040
has comment: http://stackoverflow.com/comment/37208821
has title: JavaEE - EJB over SSL works only if client and server are at the same host
tagged with: glassfish
has comment: http://stackoverflow.com/comment/37209426
has body: Please help me. I can do nothing with it. I have gf 4.0.1 and swing client. I want to get EJB over SSL. I've set all certificates. However, I can get it work only when client and server are at the same host. What I see in tcpdump when they are at the same host: ........ 10.0.17.2.48524 &gt; 10.0.17.2.3820: Flags [P.], cksum 0x378f (incorrect -&gt; 0xf2b6), seq 399:756, ack 1085, win 273, options [nop,nop,TS val 347297976 ecr 347297966], length 357 13:01:26.334898 IP (tos 0x0, ttl 64, id 51559, offset 0, flags [DF], proto TCP (6), length 665) 10.0.17.2.3820 &gt; 10.0.17.2.48524: Flags [P.], cksum 0x388f (incorrect -&gt; 0x626d), seq 1085:1698, ack 756, win 273, options [nop,nop,TS val 347297977 ecr 347297976], length 613 13:01:26.374075 IP (tos 0x0, ttl 64, id 39617, offset 0, flags [DF], proto TCP (6), length 52) 10.0.17.2.48524 &gt; 10.0.17.2.3820: Flags [.], cksum 0x9282 (correct), seq 756, ack 1698, win 289, options [nop,nop,TS val 347298017 ecr 347297977], length 0 13:01:26.375662 IP (tos 0x0, ttl 64, id 15848, offset 0, flags [DF], proto TCP (6), length 60) 127.0.0.1.42403 &gt; 127.0.0.1.3820: Flags [S], cksum 0x7255 (correct), seq 2517132554, win 32792, options [mss 16396,sackOK,TS val 347298018 ecr 0,nop,wscale 7], length 0 13:01:26.375678 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60) 127.0.0.1.3820 &gt; 127.0.0.1.42403: Flags [S.], cksum 0x21e9 (correct), seq 2013817557, ack 2517132555, win 32768, options [mss 16396,sackOK,TS val 347298018 ecr 347298018,nop,wscale 7], length 0 ........ That is it starts working from one ip and port but at some places it changes ip to 127.0.0.1 and a new connection is established: 10.0.17.2.3820 > 10.0.17.2.48524 (client port 48524) and then 127.0.0.1.3820 > 127.0.0.1.42403 (client port 42403). When client and server at different host I don't get any exception but the client hangs. On server in log I have: [2014-06-09T13:09:07.367+0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=139 _ThreadName=…
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37210298
has comment: http://stackoverflow.com/comment/37209340
has comment: http://stackoverflow.com/comment/37209970
answer count: 1
favorite count: 0
tagged with: jakarta-ee
type: Question
has comment: http://stackoverflow.com/comment/37217242
has comment: http://stackoverflow.com/comment/37209708
has answer: http://stackoverflow.com/a/24123117
tagged with: java
tagged with: rsa
tagged with: ssl
type: UnansweredQuestion

http://stackoverflow.com/q/24176008
has comment: http://stackoverflow.com/comment/37316908
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/11959758
has comment: http://stackoverflow.com/comment/37316801
linked to: http://stackoverflow.com/q/14115950
has body: I am new to making GUIs so I decided to try the the windows builder for eclipse, and while great I do have some doubts. I have been searching but I cannot seen to find a good way to add a background image to my "menu". For example I tried this: public Menu() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(50, 50, 300, 250); //Dimensiones contentPane = new JPanel() { //Imagen de Fondo public void paintComponent(Graphics g) { Image img = Toolkit.getDefaultToolkit().getImage( Menu.class.getResource("/imgs/rotom.jpg")); g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this); } }; And adding the following classes: import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; But to no avail the window remains with its dull grey color, so far my code is just the standard one WindowsBuilder cooks for you plus 4 buttons but I doubt they're of importance here. Shouldn't the code I added override the paintComponent() method of the jPanel and draw the image in it? The class for the menu is in a package within my project and the image is within a imgs package is within the same project as well. Thanks a lot in advance.
has comment: http://stackoverflow.com/comment/37316853
tagged with: java
linked to: http://stackoverflow.com/q/19648833
has comment: http://stackoverflow.com/comment/37316872
answer count: 1
upvote count: 1
tagged with: swing
has title: Background image for a jPanel not working
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37316843
has comment: http://stackoverflow.com/comment/37316973
has comment: http://stackoverflow.com/comment/37316834
accepted answer: http://stackoverflow.com/a/24176183
has comment: http://stackoverflow.com/comment/37316822
has answer: http://stackoverflow.com/a/24176183
tagged with: embedded-resource
tagged with: jpanel
has comment: http://stackoverflow.com/comment/37316827
linked to: http://stackoverflow.com/q/9864267
tagged with: image

http://stackoverflow.com/comment/139099192
score: 0
type: AnswerComment
type: Comment
has text: We have been stuck on MySQL 5.7 until recently, and I wasn't aware that 8.0.19 added support for offsets to be sent to the server. I understand your comment now, sorry for the confusion.
comment on: http://stackoverflow.com/a/78894315

http://stackoverflow.com/comment/37452110
comment on: http://stackoverflow.com/q/24246928
type: Comment
type: QuestionComment
has text: I'm confused - how far have you got with this? You say you are proceeding with logic found in another question - does that logic work for you?
score: 0

http://stackoverflow.com/q/24256256
has answer: http://stackoverflow.com/a/24256443
has body: I need to add new String object to Array of custom type object, ServiceOrderEntity in this case. I know that this kind of breaks ServiceOrderEntity integrity but I have to access this field from jsp. What is the best way to do it? DAO class: ... SQLQuery localSQLQuery = localSession.createSQLQuery(query).addEntity(ServiceOrderEntity.class); localList = localSQLQuery.list(); Iterator itr = localList.iterator(); while (itr.hasNext()){ String field = "some value"; itr.next().append( field ); // something like that maybe.... } return to Service class ... Service class ... List list = perform DAO request model.addAttribute("serviceOrderList", localList); .... UPDATE I have all models generated by Hibernate and I don't want to touch them. I need to add to custom object, in this case ServiceOrderEntity or find workaround. I think I can make copy of it and append new field to it (using Dozer)? New fields is result of other complex subqueries. List of ServiceOrderEntity objects at runtime: -list --[0]model.ServiceOrderEntity@d826d3c7 ---createdBy = {....} ---serviceRequestFK{java.Lang.Integer} // &lt;&lt; this one --[1] .... etc I need to get name using serviceRequestFK in ServiceOrderEntity. As long as java doesn't allow hot fix (to add custom filed to already created object) I need to find a way to pass to JSP the name field as well. What is the right way? I really don't want to include DAO mathod requests from jsp... Create separate list of names?...
favorite count: 0
type: Question
has title: How to add java custom or string object to DAO model object at runtime?
answer count: 1
downvote count: 0
upvote count: 1
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24256443
score: 1
tagged with: java

http://stackoverflow.com/comment/37402655
comment on: http://stackoverflow.com/q/24220844
type: Comment
score: 0
has text: Is there any way for me to prevent repeated results from the same user name? Does anyone know?
type: QuestionComment

http://stackoverflow.com/comment/37386319
type: QuestionComment
has text: @CanadianDavid that would be overkill, I am just trying to set a label here.
score: 0
comment on: http://stackoverflow.com/q/24212445
type: Comment

http://stackoverflow.com/a/24255101
has body: The transient keyword means "don't serialize", so the simple answer to make your Dog class Serializable is to simply "remove the transient keyword". The full answer is to make will nested classes Serializable too: public class Dog implements Serializable { private String name; private Collar collar; // rest of class omitted } public class Collar implements Serializable { private String name; private Cobbar cobbar; // rest of class omitted } public class Cobbar implements Serializable { private String name; // rest of class omitted } Most classes from the JDK are Serializable, so your String fields etc will be fine.
answers question: http://stackoverflow.com/q/24255066
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24255066

http://stackoverflow.com/comment/37429230
score: 0
has text: Why not just use the `setBackground()` method on the `JFrame's` content pane itself instead of constructing your own?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24235246

netty
tags question: http://stackoverflow.com/q/24195651
tags question: http://stackoverflow.com/q/24113288
tags question: http://stackoverflow.com/q/24197114
tags question: http://stackoverflow.com/q/24209438
tags question: http://stackoverflow.com/q/24228605
tag name: netty
tags question: http://stackoverflow.com/q/24227179
tags question: http://stackoverflow.com/q/24209291
tags question: http://stackoverflow.com/q/24237142
tags question: http://stackoverflow.com/q/24144741
type: Tag
tags question: http://stackoverflow.com/q/24161939

http://stackoverflow.com/a/24261239
has comment: http://stackoverflow.com/comment/37478717
has body: Surely, it's just: Iterator&lt;String&gt; itr = commonKeys.iterator(); while(itr.hasNext()){ String key = itr.next(); System.out.println("common key ::" + key); System.out.println("list1 value ::" + propertiesMapList1.get(key)); System.out.println("list2 value ::" + propertiesMapList2.get(key)); }
has comment: http://stackoverflow.com/comment/37478871
has comment: http://stackoverflow.com/comment/37478969
score: 0
answers question: http://stackoverflow.com/q/24261149
type: Answer
has comment: http://stackoverflow.com/comment/37478815
has comment: http://stackoverflow.com/comment/37479099
has comment: http://stackoverflow.com/comment/37480800

http://stackoverflow.com/comment/37339647
type: QuestionComment
comment on: http://stackoverflow.com/q/24188472
score: 0
has text: Isn't the jar automatically included by default since it's in the same directory?
type: Comment

http://stackoverflow.com/comment/37475780
type: QuestionComment
comment on: http://stackoverflow.com/q/24259508
score: 0
has text: @TheLostMind do you mean did I improted all Spring's jars ?
type: Comment

http://stackoverflow.com/a/24222528
type: Answer
has comment: http://stackoverflow.com/comment/37405028
has body: You need to delete the item from the underlying data i.e. array, cursor, whatever it is and then update the ListView to reflect the change.
downvote count: 0
answers question: http://stackoverflow.com/q/24222514
score: 1
upvote count: 1

http://stackoverflow.com/comment/38062814
score: 1
type: Comment
comment on: http://stackoverflow.com/a/24187375
has text: At last, I was able to close the connection pool in the ServletContextListener: ConnectionProvider conn = (SessionFactoryImpl)sessionFactory.getConnectionProvider(); ((C3P0ConnectionProvider)conn).close(); Thanks!
type: AnswerComment

http://stackoverflow.com/q/24172990
type: AnsweredQuestion
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24173017
has body: My doubt is why in the following code the output is 2 and 1 respectively? Is this really OK? For my perception, the method 'm' should receive the value 1 since it's used the postfix operator on variable 'i' instead of the prefix operator. public class PostfixDoubt { public static void main(String[] args) { int i = 1; // why does m receive 2 as argument and not 1? i = i++ + m(i); System.out.println(i); } public static int m(int i) { System.out.println(i); return 0; } } Bellow is the bytecode decompiled with javap: public class PostfixDoubt { public PostfixDoubt(); Code: 0: aload_0 1: invokespecial #8 // Method java/lang/Object."&lt;init&gt;":()V 4: return public static void main(java.lang.String[]); Code: 0: iconst_1 1: istore_1 2: iload_1 3: iinc 1, 1 6: iload_1 7: invokestatic #16 // Method m:(I)I 10: iadd 11: istore_1 12: getstatic #20 // Field java/lang/System.out:Ljava/io/PrintStream; 15: iload_1 16: invokevirtual #26 // Method java/io/PrintStream.println:(I)V 19: return public static int m(int); Code: 0: getstatic #20 // Field java/lang/System.out:Ljava/io/PrintStream; 3: iload_0 4: invokevirtual #26 // Method java/io/PrintStream.println:(I)V 7: iconst_0 8: ireturn }
type: Question
has answer: http://stackoverflow.com/a/24173017
has title: Java postfix operator precedence in expressions with method calls
tagged with: operator-keyword
tagged with: java
tagged with: operator-precedence

http://stackoverflow.com/comment/37378431
type: Comment
comment on: http://stackoverflow.com/a/24205188
type: AnswerComment
score: 0
has text: You need to replace the old Cell reference with the reference to the new Cell. For instance `myCell = new Cell(myCell);`

http://stackoverflow.com/comment/37398993
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24219383
type: Comment
has text: "neither seems to work" is a very poor description of your problem. Post the exact and complete error message/stacktrace you got.

http://stackoverflow.com/comment/37211339
score: 0
has text: It feels like a detour to me. But then again, so does a lot of other things in Android. I look into it. Do you think it would be a good idea to have a separate html document and parse or show that instead of making strings?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24118479

http://stackoverflow.com/q/24177516
has answer: http://stackoverflow.com/a/38652492
answer count: 5
linked to: http://stackoverflow.com/q/9307884
linked to: http://stackoverflow.com/q/7565356
linked to: http://stackoverflow.com/q/38922754
has comment: http://stackoverflow.com/comment/37319453
has comment: http://stackoverflow.com/comment/37319460
upvote count: 23
has comment: http://stackoverflow.com/comment/37319610
tagged with: calendar
has comment: http://stackoverflow.com/comment/37319775
favorite count: 0
has comment: http://stackoverflow.com/comment/37319491
has comment: http://stackoverflow.com/comment/37319903
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24177599
has comment: http://stackoverflow.com/comment/37358706
downvote count: 0
has comment: http://stackoverflow.com/comment/47583814
has title: Get first next Monday after certain date?
tagged with: java
has comment: http://stackoverflow.com/comment/37319440
linked to: http://stackoverflow.com/q/42619409
has comment: http://stackoverflow.com/comment/47584405
has answer: http://stackoverflow.com/a/43880164
possible better answer: http://stackoverflow.com/a/43880164
has answer: http://stackoverflow.com/a/24177555
accepted answer: http://stackoverflow.com/a/24177555
score: 23
tagged with: date
has comment: http://stackoverflow.com/comment/37319702
has comment: http://stackoverflow.com/comment/37362383
has answer: http://stackoverflow.com/a/43879025
has comment: http://stackoverflow.com/comment/37319879
type: Question
has body: I know there is the same question here, but I have tried the answer provided and it returned an output that I don't understand. I am confused by the answer and I don't think the output is correct. I need help, thank you :) GregorianCalendar date1 = new GregorianCalendar( 2014, 05, 12 ); //05 is june as month start from 0 -11 while( date1.get( Calendar.DAY_OF_WEEK ) != Calendar.MONDAY ) date1.add( Calendar.DATE, 1 ); System.out.println(date1); Here is the output: java.util.GregorianCalendar[time=1405267200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Singapore",offset=28800000,dstSavings=0,useDaylight=false,transitions=9,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2014,MONTH=6,WEEK_OF_YEAR=29,WEEK_OF_MONTH=3,DAY_OF_MONTH=14,DAY_OF_YEAR=195,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=28800000,DST_OFFSET=0] Where on the output should I extract to retrieve Monday's date?
has comment: http://stackoverflow.com/comment/37319573

http://stackoverflow.com/comment/37347011
comment on: http://stackoverflow.com/a/24190939
score: 0
type: Comment
type: AnswerComment
has text: I don't know mvp4g and I don't think the problem is with gin as your listBox is visible aftermodule load and your project seems to compile and execute without injection or binding errors. Be sure your listBox is well populated before you call, as you use mvp pattern it is possible it's not if you do some thing in the view and some others in the presenter.

http://stackoverflow.com/comment/37383505
score: 1
type: Comment
type: QuestionComment
has text: _"Can I use seek() to get to a specific position and then use readfully() from that position?"_ Why don't you try it? And why use `readFully` instead of proper streaming given that you do not want to read the whole file at once?
comment on: http://stackoverflow.com/q/24211078

http://stackoverflow.com/a/24256921
type: Answer
score: 1
has body: Here is the example import java.util.ArrayList; import java.util.Arrays; /** * Created by Prasad on 6/17/2014. */ public class stack { public static void main(String[] args) { String s="Tamilnadu;chennai-madurai-salem::Kerala;cochin-tiruvandrum-calicut"; ArrayList&lt;String&gt; x1=new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; x2=new ArrayList&lt;String&gt;(); String string[]=s.split("::"); for(String y:string){ try{ String[] temp=y.split(";"); x1.add(temp[0]); x2.add(temp[1]); }catch(Exception e){} } System.out.println(x1.toString()); System.out.println(x2.toString()); } }
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24256199

http://stackoverflow.com/comment/63941321
type: AnswerComment
comment on: http://stackoverflow.com/a/24211825
score: 0
type: Comment
has text: @Kushan i guess you meant to comment on someother post

http://stackoverflow.com/q/24228465
tagged with: annotations
answer count: 1
type: Question
has title: Restlet with @RequestMapping annotation does not work
accepted answer: http://stackoverflow.com/a/24322898
tagged with: restlet
tagged with: spring
has body: I have some ServerResources in my application which are identified by the @Service(name) annotation. The methods are annotated with the @Get and @Post restlet annotations. Everything worked fine until recently I wanted to add another ServerResource which has to serve a URL pattern with different parameters and request methods, thus I tried to use @RequestMapping annotation on the methods like: @Service public class MyResource extends ServerResource { @RequestMapping(value="/pathToMyResource/{parameter1}", method=RequestMethod.GET) public Representation getResponseForGetRequest(Representation entity) { ... } //and for the other method: @RequestMapping(value="/pathToMyResource/{parameter1}/{parameter2}", method=RequestMethod.POST) public Representation getResponseForPostRequest(Representation entity) { ... } ... } However my resource is not properly registered with org.restlet.ext.spring.SpringBeanRouter as it is not found when this URL is requested. The only way I figured out multiple paths working for one resource is via XML configuration: &lt;bean name="/pathToMyResource/{parameter1}" id="myGetResource" class="com.mycompany.resource.MyResource" autowire="byName" scope="prototype"&gt; &lt;/bean&gt; &lt;bean name="/pathToMyResource/{parameter1}/{parameter2}" id="myPostResource" class="com.mycompany.resource.MyResource" autowire="byName" scope="prototype"&gt; &lt;/bean&gt; and using Restlet annotation for methods: public class MyResource extends ServerResource { @Get public Representation getResponseForGetRequest(Representation entity) { ... } //and for the other method: @Post public Representation getResponseForPostRequest(Representation entity) { ... } ... } Do you know how the @RequestMapping annotation works with Restlet? I would like to avoid XML configuration completely and trying to find a way to get it working with annotations... As I mentioned I have no problem with resources mapped only to one path like: @Service("/pathToMyResource/{parameter1}") public clas…
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24322898
tagged with: java

http://stackoverflow.com/comment/37442094
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/24228061
has text: No, I feature request wont hurt. I will be making the request once I know from the product owner whether the email notification was necessary or a nice-to-have. I've looked into the REST API and have considered a short term solution. Should be easy enough given the license search call.

http://stackoverflow.com/comment/37414723
score: 0
has text: @Jules, that solution does not prevent the browser from performing line breaking on the text. That was the goal - do not prevent line breaking and it works for me.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24224825

http://stackoverflow.com/a/24227999
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24227792
score: 0
has body: That's expected. Here's an example: private String hello() { System.out.println("hello"); return "world"; } System.out.println(hello()); So what happens when executing this line? You're asking the code to print the expression hello(), of type String. So it first evaluates the expression by executing hello(), and then prints the result of the evaluation to System.out. So hello() is first executed. The first thing hello() does is to print "hello" to System.out. So that's what happens. Then hello() returns "world", and this returned value is printed to System.out. So the end result is hello world being printed. It's not magic, and what a method does doesn't change whether it's called "inside a print statement" or not. If a method is executed and writes to System.out, then it writes to System.out, whatever the way it's called.
answers question: http://stackoverflow.com/q/24227792

http://stackoverflow.com/q/24245662
possible better answer: http://stackoverflow.com/a/24245863
has title: Would there be a cleaner/better way to write this
has answer: http://stackoverflow.com/a/24245741
type: Question
has comment: http://stackoverflow.com/comment/37449178
tagged with: java
has body: The code is suppose to read information from a file, create a object using that information, and then adding it to an ArrayList called servers. try { BufferedReader br = new BufferedReader(new InputStreamReader(openFileInput(MainActivity.FILE_SERVERS))); String line = ""; while ((line = br.readLine()) != null) { String name = ""; String ip = ""; String port = ""; String checkFrequency = ""; int counter = 1; boolean alert = true; for (String value : line.split(",")){ if (counter == 1){ name = value; }else if (counter == 2){ ip = value; }else if (counter == 3){ port = value; }else if (counter == 4){ checkFrequency = value; }else if (counter == 5){ alert = Boolean.parseBoolean(value); } counter++; } MCServer server = new MCServer(name, ip, port, checkFrequency, alert); servers.add(server); } br.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Example line of what is stored in file: Name,199.99.99.99,80,60,true Would there be a better way to retrieve that information to be able to store it in the correct variable without using a loop with a counter the way shown above?
answer count: 4
has answer: http://stackoverflow.com/a/24246050
has answer: http://stackoverflow.com/a/24245863
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: styles
has comment: http://stackoverflow.com/comment/37449098
accepted answer: http://stackoverflow.com/a/24245741
favorite count: 0
has answer: http://stackoverflow.com/a/24245732

http://stackoverflow.com/a/43530334
type: Answer
has body: lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // Intent i1 = new Intent(getApplicationContext(), Plaeeng.class); // List&lt;ScanResult&gt; wifiList; // i1.putExtra("cuor", ); // startActivity(i1); Toast.makeText(ListCours.this, "=&gt;"+parent.getAdapter().getItem(position), 5000).show(); } });
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/74114282
score: 1
has comment: http://stackoverflow.com/comment/74145378
answers question: http://stackoverflow.com/q/24250280

http://stackoverflow.com/comment/37397906
type: Comment
score: 0
type: AnswerComment
has text: Then you should have sake for more ;) Take close look at the paint method...and the fact that the OP doesn't understand how basic painting is done ;)
comment on: http://stackoverflow.com/a/24218776

http://stackoverflow.com/q/24153504
has title: Java: How to resume motion of a moving object after pausing it once in java applet using keyboard events?
tagged with: multithreading
tagged with: applet
score: -1
has comment: http://stackoverflow.com/comment/37274770
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24153512
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question
upvote count: 0
has body: This is my code to move a circle along x axis in applet window. Its working fine. I used threads. When I press 's' it starts and 'p' it pauses, that's fine. Problem is, when I again press 's' after it pausing it once, it throws an Illegal thread state exception which I can't figure out how to correct. import java.awt.*; import java.awt.event.*; import java.applet.*; public class MovingCircle extends Applet implements KeyListener, Runnable { Thread t; //thread to control motion boolean flag; //variable to control pausing of circle int x=50; int y=50; char c; public void init(){ setBackground(Color.cyan); addKeyListener(this); } public void start(){ t = new Thread(this); } //starting point for thread public void run() { for(;;){ try{ Thread.sleep(1000); x = x+10; repaint(); if(flag){ break; } } catch(Exception e){ } } } public void paint(Graphics g){ g.fillOval(x,y,50,50); } public void keyPressed(KeyEvent k) { c = k.getKeyChar(); if(c=='s') t.start(); if(c=='p') flag = true; } public void keyReleased(KeyEvent k) {} public void keyTyped(KeyEvent k) {} }
accepted answer: http://stackoverflow.com/a/24153512

http://stackoverflow.com/comment/37291747
comment on: http://stackoverflow.com/q/24160776
type: Comment
has text: I have overloaded the run method in Reducer's class and I get all the keys and values and store them in a HashMap<Text,HashSet<Text>>. Then I process them and after all I want to pass these to the reducer function. The process I am doing is about merging some keys and as a result putting together its values.
type: QuestionComment
score: 1

http://stackoverflow.com/comment/37352693
has text: @ajb hmmm... for some reason, the string are very wierd. I am updating the question
comment on: http://stackoverflow.com/q/24194896
type: Comment
score: 0
type: QuestionComment

ruby
tags question: http://stackoverflow.com/q/24129131
tag name: ruby
tags question: http://stackoverflow.com/q/24141051
tags question: http://stackoverflow.com/q/24144160
tags question: http://stackoverflow.com/q/24231335
tags question: http://stackoverflow.com/q/24251657
tags question: http://stackoverflow.com/q/24119055
type: Tag

http://stackoverflow.com/q/24160089
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/37289699
upvote count: 2
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37314815
tagged with: excel
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/28426483
has title: Compatibility mode in excel file when created by Apache POI
has body: I am using POI to create excel file (using HSSFWorkbook) and save with xls file. But when i used higher office (2007+), i got a warning in title bar : Filename.xls [Compatibility Mode]. Workbook wb = new HSSFWorkbook(); Sheet sheet = wb.createSheet("new sheet"); Row row = sheet.createRow((short) 0); Cell cell = row.createCell(0); cell.setCellValue(1); FileOutputStream fileOut = new FileOutputStream("D:/testExcel/workbook.xls"); wb.write(fileOut); fileOut.close(); How can i configure in in POI to not open file in this mode?
score: 2

http://stackoverflow.com/a/24204931
has comment: http://stackoverflow.com/comment/37395197
answers question: http://stackoverflow.com/q/24204628
has comment: http://stackoverflow.com/comment/37395239
has body: following code returning the string value. "status_code": "200", "message": "User successfully registered.", "response_for": "register" and you are getting it with integer, i think you have to write like this, JSONObject root = new JSONObject(json); JSONObject response = root.getJSONObject("response"); int status = Integer.parseInt(response.getString("status_code")); please try this, may be it will work.
type: Answer
score: -1
upvote count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/37395240
has comment: http://stackoverflow.com/comment/37395279
has comment: http://stackoverflow.com/comment/37395172

http://stackoverflow.com/comment/37198732
comment on: http://stackoverflow.com/q/24112872
has text: Sometimes, threads are run to do one process and die. Sometimes, there's a where loop in the run method, and the tread lives as long as the application. Both are valid uses of threads.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/24213229
has body: We can Supply parameter in different way after some search I found some useful &lt;plugin&gt; &lt;artifactId&gt;${release.artifactId}&lt;/artifactId&gt; &lt;version&gt;${release.version}-${release.svm.version}&lt;/version&gt;... ... Actually in my application I need to save and supply SVN Version as parameter so i have implemented as above . While Running build we need supply value for those parameter as follows. RestProj_Bizs&gt;mvn clean install package -Drelease.artifactId=RestAPIBiz -Drelease.version=10.6 -Drelease.svm.version=74 Here I am supplying release.artifactId=RestAPIBiz release.version=10.6 release.svm.version=74 It worked for me. Thanks
has comment: http://stackoverflow.com/comment/101801794
type: Answer
upvote count: 31
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24206013
downvote count: 1
score: 30
answers question: http://stackoverflow.com/q/24206013

http://stackoverflow.com/q/24145070
tagged with: java
has title: Use of start method in ClassPathXmlApplicationContext
has body: I have following code in one my team projects: this.context = new ClassPathXmlApplicationContext("test_spring.xml"); this.task = ((Task)this.context.getBean("task")); this.context.registerShutdownHook(); this.context.start(); I have never before seen "start" method being called and i dont understand whats the need of start method? Spring Documentation says: Start this component. Should not throw an exception if the component is already running. In the case of a container, this will propagate the start signal to all components that apply. But i dont understand what does it imply. Can someone explain what can go wrong if start method is not called or how does it helps?
type: Question
type: UnansweredQuestion
answer count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/24145394
score: 0

http://stackoverflow.com/comment/37481405
type: Comment
has text: @MarkRotteveel: Good point, although I suspect it can be argued both ways. I'll flag it up above, though, because again it's a good point.
score: 0
comment on: http://stackoverflow.com/a/24262513
type: AnswerComment

jmonkeyengine
tags question: http://stackoverflow.com/q/24222385
type: Tag
tag name: jmonkeyengine
tags question: http://stackoverflow.com/q/24214102
tags question: http://stackoverflow.com/q/24262494

http://stackoverflow.com/q/24191380
has comment: http://stackoverflow.com/comment/37345427
score: -1
has comment: http://stackoverflow.com/comment/37345309
has comment: http://stackoverflow.com/comment/37346043
has comment: http://stackoverflow.com/comment/37346779
type: AnsweredQuestion
upvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37346577
has comment: http://stackoverflow.com/comment/37345578
has comment: http://stackoverflow.com/comment/37346646
answer count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24192921
has comment: http://stackoverflow.com/comment/37346195
has comment: http://stackoverflow.com/comment/37345228
has answer: http://stackoverflow.com/a/24192921
has comment: http://stackoverflow.com/comment/37345502
type: Question
tagged with: sockets
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37345761
has title: Android - Can't create handler inside thread that has not called Looper.prepare() - Socket.IO
has comment: http://stackoverflow.com/comment/37345819
has body: I am attempting to connect to a SocketIO Web Socket using the socket.io-java-client. This is supposed to support Android yet for an unknown reason I keep getting the following error: Can't create handler inside thread that has not called Looper.prepare() If you are familiar with the SocketIO Java client then this error is thrown in the onConnect method on IOConnection. If you are not familiar then here is the code: try { if (firstSocket != null &amp;&amp; "".equals(message.getEndpoint())) { setState(STATE_READY); if (firstSocket.getNamespace().equals("")) { firstSocket.getCallback().onConnect(); } else { IOMessage connect = new IOMessage( IOMessage.TYPE_CONNECT, firstSocket.getNamespace(), ""); sendPlain(connect.toString()); } // should flush after connecting to namespace flushBuffer(); } else { findCallback(message).onConnect(); } firstSocket = null; } catch (Exception e) { error(new SocketIOException( "Exception was thrown in onConnect()", e)); }

http://stackoverflow.com/comment/72325301
type: Comment
comment on: http://stackoverflow.com/a/41299093
type: AnswerComment
has text: this is for static resources only.
score: 5

http://stackoverflow.com/comment/37391458
has text: That's what i did in the first place but my case is kind of specific, as it's not just simple String.split() function.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24215173
score: 0

http://stackoverflow.com/comment/37299185
type: QuestionComment
has text: @Makoto if image is `null`, the exception would not be thrown inside `getWidth()`
comment on: http://stackoverflow.com/q/24124165
score: 0
type: Comment

http://stackoverflow.com/q/24218863
accepted answer: http://stackoverflow.com/a/24218934
downvote count: 0
has title: Java regex on a long string(String buffer)
answer count: 1
has comment: http://stackoverflow.com/comment/37398058
favorite count: 0
type: Question
has body: I have 2 questions actually. 1st theoretical- If I have a long text in a StringBuffer and I want to find a regular expression inside of it- do I have to worry that the StringBuffer will take chunks of the StringBuffer look for the regex inside of each chunk, and if it doesn't find such regex inside of any chunk it will appear as if the regular expression inside of the text doesn't exist? What if part of the regex is at the border of one chunk, and rest of the regex at the border of the neighbouring chunk? 2nd: String patternString1 = "(\\[\\[Category.*\\]\\])"; Pattern pattern1 = Pattern.compile(patternString1); Matcher matcher1 = pattern1.matcher(text); while (matcher1.find()){ System.out.println(matcher1.group(1)); } I want to extract from the string all expression that looks like this but if the whole text, for example, looks like this: LaserJet I want to assure that the "]]" is the end of my regular expression. In other words- if I find [[ .* ]] inside of my expression I don't want the ending of the inner [[.*]] to be treated as the ending of my whole expression.
has answer: http://stackoverflow.com/a/24218934
score: 3
has comment: http://stackoverflow.com/comment/37400159
tagged with: java
tagged with: stringbuffer
has comment: http://stackoverflow.com/comment/37397998
has comment: http://stackoverflow.com/comment/37398036
tagged with: regex
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/comment/37268748
type: QuestionComment
has text: You seem to be producing valid JSON. What do you mean by "completely lost?"
comment on: http://stackoverflow.com/q/24149963
score: 0
type: Comment

http://stackoverflow.com/comment/37393538
type: AnswerComment
score: 0
has text: Alright, that is working, but i can't see my model yet, probably a camera thing. Will try to get it working tomorrow. Thanks for the help!
comment on: http://stackoverflow.com/a/24216172
type: Comment

http://stackoverflow.com/comment/37397040
has text: I saw the utility application you posted. Though it doesn't help me, it could be useful for me in the future. Thank you. And thanks for the explanation.
type: AnswerComment
comment on: http://stackoverflow.com/a/24218320
score: 0
type: Comment

http://stackoverflow.com/comment/37326224
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24181115
has text: @VikasVerma But lets say that it is quite hard to implement runtime polymorphism à la Java without dynamic allocation, because you don't know the size of the objects you will be instantiating until runtime.
type: Comment

http://stackoverflow.com/q/24175853
type: AnsweredQuestion
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/24175894
has answer: http://stackoverflow.com/a/24175877
type: Question
has answer: http://stackoverflow.com/a/24175894
answer count: 2
has comment: http://stackoverflow.com/comment/37316570
upvote count: 0
tagged with: sql
has body: Basically I have a List of Players: final List&lt;String&gt; members = getClanMembers(clan); Each of the Player has a number of KILLS. I want to sum that up and get the TOTAL KILLS of all players. This is what I am doing now: Integer kills = 0; for (final String plr : members) { try { final PreparedStatement sel = conn.prepareStatement("SELECT kills FROM Stats WHERE player=?"); sel.setString(1, plr); final ResultSet rs = sel.executeQuery(); kills += rs.getRow() != 0 ? rs.getInt("kills") : 0; } catch (final SQLException e) { e.printStackTrace(); } } However, I think this code is not efficient and I know that you can create variables in MySQL to do that better. (Bad stuff: try catch inside a for-loop, doing too many queries at once) Could someone give me some tips? Thanks in advance. EDIT: I forgot to mention that I ONLY want to sum up the Kills of the Players in the ArrayList, not all Players in the Table.
tagged with: mysql
possible better answer: http://stackoverflow.com/a/24175877
has title: Sum up Kills of Player List
downvote count: 1
has comment: http://stackoverflow.com/comment/37316499
favorite count: 0

http://stackoverflow.com/comment/39420308
score: 0
has text: How did you solve this? Facing a similar problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24220710

http://stackoverflow.com/q/24170096
answer count: 0
type: UnansweredQuestion
tagged with: swing
has body: I have build code clone application, that using JCCD API that impelemnted ANTLR. To show the code clone, I am using a jtable. This is my screenshot Application : https://docs.google.com/file/d/0B_Rg--NnjJccMERpaTNidzR3cFE/edit?usp=sharing Okey, from the following screenshot above, I was success to compare one file to another one file. The problem is when I am compare a file to two or more files. The tables just give me the last suspect of code clone. But, in my netbeans output console, I was success that showed in this link : https://drive.google.com/file/d/0B_Rg--NnjJccWWdVTjdZc1R1bWc/edit?usp=sharing How can I showed the right output console one to more files to my jTable ? This is My code : public static void printSimilarityGroups(final SimilarityGroupManager groupContainer) { SimilarityGroup[] simGroups = groupContainer.getSimilarityGroups(); // output similarity groups DefaultTableModel model = (DefaultTableModel) Main_Menu.jTable1.getModel(); model.setRowCount(0); List&lt;final_tugas_akhir.Report&gt; theListData = new ArrayList&lt;Report&gt;(); if (null == simGroups) { simGroups = new SimilarityGroup[0]; } if ((null != simGroups) &amp;&amp; (0 &lt; simGroups.length)) { for (int i = 0; i &lt; simGroups.length; i++) { final ASourceUnit[] nodes = simGroups[i].getNodes(); System.out.println(""); System.out.println("Similarity Group " + simGroups[i].getGroupId()); for (int j = 0; j &lt; nodes.length; j++) { final SourceUnitPosistion minPos = getFirstNodePosition((ANode) nodes[j]); final SourceUnitPosistion maxPos = getLastNodePosition((ANode) nodes[j]); ANode fileNode = (ANode) nodes[j]; while (fileNode.getTipe() != TipeNode.FILE.getTipe()) { fileNode = fileNode.getParent(); } final_tugas_akhir.Report theResult = new final_tugas_akhir.Report(); //final_tugas_akhir.Report() is a class that contain getter and setter //Mixing the Line StringBuilder sb = new StringBuilder(); StringBuilder append = sb.append(minPos.getBaris()).append("."); // get the row sb.append(minPo…
tagged with: jtable
linked to: http://stackoverflow.com/q/9132987
has comment: http://stackoverflow.com/comment/37327716
score: 0
has comment: http://stackoverflow.com/comment/37325233
has comment: http://stackoverflow.com/comment/37313396
has comment: http://stackoverflow.com/comment/37308386
tagged with: java
has comment: http://stackoverflow.com/comment/37322006
type: Question
has title: Failed to looping in a jtable in JCCD API

http://stackoverflow.com/q/24255828
has comment: http://stackoverflow.com/comment/37470348
has comment: http://stackoverflow.com/comment/37468924
has comment: http://stackoverflow.com/comment/37469728
has comment: http://stackoverflow.com/comment/37469711
has title: mvn clean install causes ArchiverException
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/46426090
has answer: http://stackoverflow.com/a/24255900
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37469623
tagged with: maven
has body: I did an mvn clean install and it gives me an "ArchiverException" with the following error messages and build failure. [INFO] Unpacking /home/dev237/.m2/repository/org/neo4j/spatial/osm-test- data/20100819/osm-test-data-20100819.jar to /home/dev237/Projects/spatial/target with includes null and excludes:null org.codehaus.plexus.archiver.ArchiverException: Error while expanding /home/dev237/.m2/repository/org/neo4j/spatial/osm-test-data/20100819/osm-test-data-20100819.jar at org.codehaus.plexus.archiver.zip.AbstractZipUnArchiver.execute(AbstractZipUnArchiver.java:132) at org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:108) at org.apache.maven.plugin.dependency.AbstractDependencyMojo.unpack(AbstractDependencyMojo.java:260) at org.apache.maven.plugin.dependency.UnpackDependenciesMojo.execute(UnpackDependenciesMojo.java:90) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.re…
has comment: http://stackoverflow.com/comment/37468992
has comment: http://stackoverflow.com/comment/37469662
has comment: http://stackoverflow.com/comment/37473579
has comment: http://stackoverflow.com/comment/37469218
answer count: 2
score: 1
tagged with: java

http://stackoverflow.com/comment/37184522
comment on: http://stackoverflow.com/q/24105408
type: QuestionComment
score: 0
has text: Your problem is in the onStop method. icam.Travelr.Core.RunActivity.onStop(RunActivity.java:372)
type: Comment

http://stackoverflow.com/a/24255862
type: Answer
has body: Delete 'this' from all 3 'editText = (EditText )this.findViewById(R.id.editTextName);' and leave it like 'editText = (EditText ) findViewById(R.id.editTextName);' give that a try And something i noticed now, Remove View from new View.OnClickListener().
has comment: http://stackoverflow.com/comment/37469163
answers question: http://stackoverflow.com/q/24253296
has comment: http://stackoverflow.com/comment/37469243
score: 0

http://stackoverflow.com/a/24190175
has body: It can be easily done in a couple of lines: SharedPreferences preferences = getSharedPreferences(APP_NAME, MODE_PRIVATE); preferences.edit().putInt(SELECTED_POSITION, position).commit(); Where APP_NAME is a String, SELECTED_POSITION is another String and position an int, which I want to store. And to get it: SharedPreferences preferences = getSharedPreferences(APP_NAME, MODE_PRIVATE); preferences.getInt(SELECTED_POSITION, 0);
has comment: http://stackoverflow.com/comment/37343083
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37343763
answers question: http://stackoverflow.com/q/24189968
has comment: http://stackoverflow.com/comment/37343896
accepted answer of: http://stackoverflow.com/q/24189968
has comment: http://stackoverflow.com/comment/37343236
type: Answer

selenium-webdriver
tags question: http://stackoverflow.com/q/24164504
tags question: http://stackoverflow.com/q/24113648
tags question: http://stackoverflow.com/q/24186575
tags question: http://stackoverflow.com/q/24198898
tags question: http://stackoverflow.com/q/24184225
tags question: http://stackoverflow.com/q/24207806
tags question: http://stackoverflow.com/q/24180902
tags question: http://stackoverflow.com/q/24118901
tags question: http://stackoverflow.com/q/24188566
tags question: http://stackoverflow.com/q/24137375
type: Tag
tags question: http://stackoverflow.com/q/24224678
tags question: http://stackoverflow.com/q/24180345
tags question: http://stackoverflow.com/q/24130006
tags question: http://stackoverflow.com/q/24138398
tags question: http://stackoverflow.com/q/24158698
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/24182052
tags question: http://stackoverflow.com/q/24237789
tags question: http://stackoverflow.com/q/24205871

http://stackoverflow.com/q/24199999
favorite count: 0
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/887248
tagged with: eclipse-rcp
answer count: 2
has title: Eclipse Rcp - How to get custom PopUp Menu in text editor on ctrl + space on text
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24200307
has answer: http://stackoverflow.com/a/24200229
upvote count: 1
has body: We have seen that in eclipse Java Editor, when we perform (ctrl + space) key on the objectname, a popup menu appears showing list of methods and variables of that class. In my case, it is not a java editor. But I want to achieve similar functionality as mentioned above. I have 30 fix objects, when that object appears in the text editor and I do (ctrl + space) key at the end of object name, I need to show popup menu with its member variables. Could you please guide me how this can be achieved. Thanks in advance.

http://stackoverflow.com/comment/37376678
has text: (a bit late) Resources "src/main/resources" and `MyClass.class.getResourceAsStream("/grafo.xml")` where MyClass is in the same jar.
comment on: http://stackoverflow.com/a/24206839
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24232497
has answer: http://stackoverflow.com/a/24232542
has title: Eclipse shortcut to accept type proposal with appended same-name lowercase starting variable
type: AnsweredQuestion
has body: Is there a way, to create a attribute/method parameter/local variable by type, with same name as type starting with lowercase letter? Example: Redi [ctrl+space], and "RedirectAttributes" type is proposed [magic shortcut] IDE inserts: RedirectAttributes redirectAttributes If not, where should I start to implement such code completion plugin?
score: 0
answer count: 1
tagged with: ide
type: Question
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/37423824
has comment: http://stackoverflow.com/comment/37423800
tagged with: java
tagged with: code-completion
accepted answer: http://stackoverflow.com/a/24232542
tagged with: eclipse

http://stackoverflow.com/comment/37313037
score: 0
comment on: http://stackoverflow.com/q/24173730
has text: Map.put () checks the hashcode() , I tried doing that by overriding hashcode() and putting a print statement inside it.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37470576
score: 0
comment on: http://stackoverflow.com/q/24250659
has text: http://stackoverflow.com/questions/22681622/how-to-remove-views-from-windows-show-view-list
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24164417
has comment: http://stackoverflow.com/comment/37295171
answers question: http://stackoverflow.com/q/24164185
score: 2
type: AcceptedAnswer
downvote count: 0
has body: why not using regex? "(?<==)\\s*(\\S.*)" would give you those non-empty strings in group(1). or you can do with replaceAll: String part=line.replaceAll(".*=\\s*",""); here check part ,it would be either empty or the value you need. NOTE, you should fix the mistake in your code: I just saw that, in your code: String removeSpaces=strNew.replace("\\s+",""); string.replace(target, repl) won't think target as regex!! it do literal replacement. You should fix it if you used this method in the same way in your project. Update, in case you just need to check if a line needs to be removed: then just check the line with this regex: "=.*\\S.*$" this won't extract values for you, but it will tell you if there is = sign in line and if there value (non-empty strings) after the =.
upvote count: 2
has comment: http://stackoverflow.com/comment/37294981
has comment: http://stackoverflow.com/comment/37294745
type: Answer
has comment: http://stackoverflow.com/comment/37294834
accepted answer of: http://stackoverflow.com/q/24164185
has comment: http://stackoverflow.com/comment/37295184
has comment: http://stackoverflow.com/comment/37294635

http://stackoverflow.com/a/24208726
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24208612
has body: Yes those both should work but the key is you need to make sure you don't try to reference those fields or methods later. (at least until you have assigned those variables to something else) All objects inherit Object but since you assigned to null it won't actually have the methods or fields you would expect an Object to have. So you will get an error here when you try to call equals() because null does not have the methods you would normally inherit from object. You can assign a variable you declare to null which can be very useful to prevent compiler errors if its actual value is defined in an if statement.
type: Answer
upvote count: 1

http://stackoverflow.com/a/54393544
answers question: http://stackoverflow.com/q/24241820
upvote count: 7
type: Answer
has body: Just checked, on Java 8.111 and Windows 7 Corporate it can be found at c:\Users\%username%\AppData\LocalLow\Sun\Java\Deployment\security\exception.sites But I suppose that this file (as well as the whole directory chain) is not created by default. So may be you should first add it by hand, then search for the exact file location.
score: 7
downvote count: 0

http://stackoverflow.com/comment/37462733
type: QuestionComment
comment on: http://stackoverflow.com/q/24252120
has text: @user3746363 Get the other stuff working first. Gotta build the house before the city :)
score: 1
type: Comment

http://stackoverflow.com/a/24265401
has comment: http://stackoverflow.com/comment/37488956
answers question: http://stackoverflow.com/q/24263249
has body: // Get first sheet from the workbook XSSFSheet sheet = wb.getSheetAt(0); double pre=0.0,next=0.0; String valueStr = " "; for(Row row : sheet){ if(row.getRowNum()==0){ for (Cell cell : row) { int i = cell.getColumnIndex(); switch (i) { // column 0 case 0: pre = cell.getNumericCellValue(); break; // column 1 case 1: valueStr = cell.getStringCellValue(); System.out.print(pre+" "+valueStr+","); break; } } }else{ for (Cell cell : row) { int i = cell.getColumnIndex(); switch (i) { // column 0 case 0: next = cell.getNumericCellValue(); break; // column 1 case 1: valueStr = cell.getStringCellValue(); if(pre == next) System.out.print(next+" "+valueStr+" "); else System.out.println(); System.out.print(next+" "+valueStr+","); pre = next; break; } } } }
has comment: http://stackoverflow.com/comment/37487907
has comment: http://stackoverflow.com/comment/37489040
has comment: http://stackoverflow.com/comment/37490349
type: Answer
has comment: http://stackoverflow.com/comment/37488395
score: 0
has comment: http://stackoverflow.com/comment/37488138

http://stackoverflow.com/comment/40007428
type: Comment
type: QuestionComment
score: 0
has text: I just realized that the link I posted above, is from a very old Android version. Apparently removed Google this package entirely in newer version of Android
comment on: http://stackoverflow.com/q/24117071

http://stackoverflow.com/q/24203900
has answer: http://stackoverflow.com/a/24203963
has title: The method findViewById(int) is undefined for the type PostDetail (Fragment)
has body: I have code in ArticleActivity (Activity) Trying implement to PostDetail (Fragment) findViewById(R.id.like).setOnClickListener( new ResultLikeListener( this,(TextView)findViewById(R.id.like), res )); Please can you help me. public class PostDetail extends Fragment{ private int mId; TextView mTitle; WebView mWebView; // TextView mBody; private Tracker tracker; @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); } } ............. }
upvote count: 2
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37369235
answer count: 3
downvote count: 0
tagged with: android-fragments
tagged with: java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24203961
possible better answer: http://stackoverflow.com/a/24203961
has answer: http://stackoverflow.com/a/24204433
accepted answer: http://stackoverflow.com/a/24204433
tagged with: android

http://stackoverflow.com/a/33799646
answers question: http://stackoverflow.com/q/24207567
score: 0
type: Answer
has body: try this code RaceCar::RaceCar( b2World* world ) { b2Vec2 race_car_pos( 13.0f, 13.0f ); / Create race car chassis { // Physics Body Shape b2Vec2 verticies[8]; verticies[0].Set( 1.5f, 0.0f ); verticies[1].Set( 3.0f, 2.5f ); verticies[2].Set( 2.8f, 5.5f ); verticies[3].Set( 1.0f, 10.0f ); verticies[4].Set( -1.0f, 10.0f ); verticies[5].Set( -2.8f, 5.5f ); verticies[6].Set( -3.0f, 2.5f ); verticies[7].Set( -1.5f, 0.0f ); b2PolygonShape body_shape; body_shape.Set( verticies, 8 ); // Physics body definition b2BodyDef body_def; body_def.type = b2_dynamicBody; // body_def.position =b2Vec2(3,3); // Physics Body Fixture b2FixtureDef body_fixture; body_fixture.shape = &amp;body_shape; body_fixture.density = 0.1f; m_chassisPhysicsBody = world-&gt;CreateBody( &amp;body_def ); m_chassisPhysicsBody-&gt;CreateFixture( &amp;body_fixture ); m_chassisPhysicsBody-&gt;SetUserData( this ); m_chassisPhysicsBody-&gt;SetTransform( race_car_pos, 0.0f ); } // Tires { b2Vec2 pos = m_chassisPhysicsBody-&gt;GetPosition(); // Top left tire { RCTire* tire_top_left = new RCTire( world ); tire_top_left-&gt;setPosition( race_car_pos ); m_tires.push_back( tire_top_left ); b2RevoluteJointDef joint_def; joint_def.enableLimit = true; joint_def.lowerAngle = 0.0f; joint_def.upperAngle = 0.0f; joint_def.bodyA = m_chassisPhysicsBody; joint_def.localAnchorB.SetZero(); joint_def.bodyB = tire_top_left-&gt;getPhysicsBody(); joint_def.localAnchorA.Set( -3.0f, 8.5f ); b2RevoluteJoint* joint = static_cast&lt;b2RevoluteJoint*&gt;( world-&gt;CreateJoint( &amp;joint_def ) ); tire_top_left-&gt;setJointToChassis( joint ); } // Top right tire { RCTire* tire_top_right = new RCTire( world ); tire_top_right-&gt;setPosition( race_car_pos ); m_tires.push_back( tire_top_right ); b2RevoluteJointDef joint_def; joint_def.enableLimit = true; joint_def.lowerAngle = 0.0f; joint_def.upperAngle = 0.0f; joint_def.bodyA = m_chassisPhysicsBody; joint_def.localAnchorB.SetZero(); joint_def.bodyB = tire_top_right-&gt;getPhysicsBody(); joint…

http://stackoverflow.com/a/24230250
score: 1
has comment: http://stackoverflow.com/comment/37419315
type: Answer
answers question: http://stackoverflow.com/q/24230040
downvote count: 0
has body: Take a look at IzPack, I think is what you are looking for ... If you don't like it as it is, you can take a look at the source code at the official git repo.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37419337
has comment: http://stackoverflow.com/comment/37419299
accepted answer of: http://stackoverflow.com/q/24230040
has comment: http://stackoverflow.com/comment/37419327

opencsv
tag name: opencsv
type: Tag
tags question: http://stackoverflow.com/q/24213608

http://stackoverflow.com/q/24171649
answer count: 1
downvote count: 0
tagged with: deserialization
tagged with: jackson
has title: Custom JSON serialization/deserialization using Jackson
favorite count: 0
type: Question
tagged with: serialization
linked to: http://stackoverflow.com/q/24184296
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a class hierarchy that looks as follows: interface MyEntity { ... } class MyEntityRef { String id; ... } class MyEntityImpl { String id; String name; ... } I would like to serialize instances of MyEntityRef as a plain string: "someEntityId" and instances of MyEntityImpl as a regular object: { id: "someEntityId", name: "someName" } And then the other way around: When deserializing a MyEntity I'd like it to be deserialized into a MyEntityRef if the json is a plain string, and into a MyEntityImpl if it's a regular json object. In my actual code I have many types of entities (i.e. multiple X/XRef/XImpl triples). In an attempt to avoid listing all of these, I've annotated the interfaces as follows: @MyEntityAnnotation(ref=MyEntityRef.class, impl=MyEntityImpl.class) interface MyEntity { ... } Extra points to whomever figures out a way to solve the serialization/deserialization described above for all entities based this annotation information. What I've tried: Everything I can think of (SimpleDeserializers/SimpleSerializers, BeanDeserializerModifier/BeanSerializerModifier, TypeSerializer/TypeDeserializer)
accepted answer: http://stackoverflow.com/a/24195117
has comment: http://stackoverflow.com/comment/37333691
has comment: http://stackoverflow.com/comment/37332898
has answer: http://stackoverflow.com/a/24195117
score: 2
has comment: http://stackoverflow.com/comment/37332739
upvote count: 2

http://stackoverflow.com/comment/37455204
score: 0
type: QuestionComment
has text: The right-click event itself couldn't possibly be dispatched anywhere other than the event dispatch thread. The question is are you on the EDT when you create and show the JFileChooser? Use `EventQueue.isDispatchThread()` to check.
type: Comment
comment on: http://stackoverflow.com/q/24214154

http://stackoverflow.com/q/24242920
tagged with: selenium
accepted answer: http://stackoverflow.com/a/24262510
has comment: http://stackoverflow.com/comment/37475644
type: Question
has answer: http://stackoverflow.com/a/24243502
has title: WebDriver Not returning inner text if input tag is not closed
answer count: 2
has comment: http://stackoverflow.com/comment/37444691
possible better answer: http://stackoverflow.com/a/24243502
has body: I am using Selenium Web Driver with java. I am not able to get inner text of an input tag which is not closed. My HTML Code is like this: Male Female Now I want to fetch the inner text of input tag like Male or Female. As per my knowledge we can get inner text of any tag by using getText() if the tag is closed properly. but in my scenario it is not closed so how can I fetch the text. If any body know the solution for this scenario, please Provide the answer.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24262510
score: 0
tagged with: java

http://stackoverflow.com/a/24246050
answers question: http://stackoverflow.com/q/24245662
has body: I've revised your code a bit: try { BufferedReader br = new BufferedReader(new InputStreamReader(openFileInput(MainActivity.FILE_SERVERS))); String line; while ((line = br.readLine()) != null) { String[] lineSplitted = line.split(","); String name = lineSplitted[0]; String ip = lineSplitted[1]; String port = lineSplitted[2]; String checkFrequency = lineSplitted[3]; boolean alert = Boolean.parseBoolean(lineSplitted[4]); MCServer server = new MCServer(name, ip, port, checkFrequency, alert); servers.add(server); } br.close(); } catch (IOException e) { e.printStackTrace(); } Changes: initialising the variables and then setting them is redundant, you never access them without setting them beforehand, so if you have your line splitted in the the first place you can initialise them with the values right away for cycle is unnecessary if you're working with a single array each time, just access the correct elements of the array catch blocks can be collapsed; IOException covers FileNotFoundException
score: 0
type: Answer

http://stackoverflow.com/comment/37473947
has text: @Duncan Really? I thought that there was at least some list of "common sense" exceptions to know about, at least to decide whether to catch them or not. Actually, if I didn't put that port number I never knew that code could throw that exception.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24258544

playframework
tags question: http://stackoverflow.com/q/24118639
tags question: http://stackoverflow.com/q/24179874
tags question: http://stackoverflow.com/q/24118856
tags question: http://stackoverflow.com/q/24186221
tags question: http://stackoverflow.com/q/24114883
tags question: http://stackoverflow.com/q/24220475
tags question: http://stackoverflow.com/q/24241014
tags question: http://stackoverflow.com/q/24133860
tags question: http://stackoverflow.com/q/24106148
tags question: http://stackoverflow.com/q/24157926
tags question: http://stackoverflow.com/q/24177562
tags question: http://stackoverflow.com/q/24216272
tags question: http://stackoverflow.com/q/24159244
tags question: http://stackoverflow.com/q/24167780
tags question: http://stackoverflow.com/q/24140660
tags question: http://stackoverflow.com/q/24118733
tags question: http://stackoverflow.com/q/24162630
tags question: http://stackoverflow.com/q/24204907
tags question: http://stackoverflow.com/q/24218945
tags question: http://stackoverflow.com/q/24261109
tags question: http://stackoverflow.com/q/24184059
type: Tag
tags question: http://stackoverflow.com/q/24190091
tags question: http://stackoverflow.com/q/24130325
tags question: http://stackoverflow.com/q/24114990
tags question: http://stackoverflow.com/q/24162460
tag name: playframework
tags question: http://stackoverflow.com/q/24105454

http://stackoverflow.com/a/24202574
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24201717
has body: What you want to do basically not only requires your objects to be serialized, transmitted and deserialized on the remote system, but also that a Java VM is present and started on the host and has the classes for your transmitted instances in its class path. I doubt you will find an out-of-the-box solution for that. You could use something like RMI to communicate with a running JVM on the remote host, though.

http://stackoverflow.com/a/24245285
has body: As you're looping through the String, you need to keep track of which node is the parent and which is the child. When you enter the "IF=" condition, that is a parent node. The others are children of it until until you encounter the next "IF=" condition (that node is also a child of the previous parent, but a parent to all subsequent nodes). So add the child and parent to a Pair and add that to the SimpleMultiGraph with EdgeType.DIRECTED. The docs are sort of unclear on how directed edges interact with the Pair but I assume that the first Vertex you add to the Pair is outgoing and the second is incoming. Just a guess since the docs are unclear.
score: 0
answers question: http://stackoverflow.com/q/24244227
type: Answer
has comment: http://stackoverflow.com/comment/37448397

http://stackoverflow.com/a/24199450
upvote count: 1
downvote count: 0
score: 1
has body: Have you looked into the @Schedules and @Schedule annotations? You can use it to set up cron-like schedules. http://docs.oracle.com/javaee/6/api/javax/ejb/Schedule.html
type: Answer
answers question: http://stackoverflow.com/q/24193487

http://stackoverflow.com/a/24158593
has comment: http://stackoverflow.com/comment/37283547
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24158432
has comment: http://stackoverflow.com/comment/37284037
type: Answer
has body: Yes you can get it from DatabaseMetaData: For Example: java.sql.DatabaseMetaData metaData = con.getMetaData(); ResultSet rs = metaData.getColumns(schema, null, "TABLE_NAME", "COLUMN_NAME"); if (rs.next()) { int colSize = rs.getInt("COLUMN_SIZE"); } If your read the doc for getColumns method, you'll see that the COLUMN_SIZE is one of meta columns that its retrieve. doc: COLUMN_SIZE int => column size. Read the full documentation from here.
has comment: http://stackoverflow.com/comment/37283973

deployment
tags question: http://stackoverflow.com/q/24183325
tags question: http://stackoverflow.com/q/24194211
tags question: http://stackoverflow.com/q/24199330
tags question: http://stackoverflow.com/q/24124472
tag name: deployment
tags question: http://stackoverflow.com/q/24114669
tags question: http://stackoverflow.com/q/24202480
type: Tag
tags question: http://stackoverflow.com/q/24143966
tags question: http://stackoverflow.com/q/24175703
tags question: http://stackoverflow.com/q/24182376

http://stackoverflow.com/comment/37235522
has text: means the third argument will be 0??
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24132535
type: Comment

http://stackoverflow.com/comment/37597170
type: AnswerComment
comment on: http://stackoverflow.com/a/24119764
type: Comment
has text: thanks for the reply. I did try this option but it did not work and edited my question as well. Thanks for the help
score: 0

http://stackoverflow.com/q/24182782
has body: I try to run the mimetex.cgi on a jetty 9.1.2. I never use a .cgi file and haven't any knowledge on this topic. Now just mv mimetex.cgi to your cgi-bin/ directory, set permissions as necessary, and you're all done. (John Forkosh) I don't know where I can't find the cgi-bin/ directory in the jetty folder structure. But I found the hint to modify the jetty.xml like this: /cgi-bin/* /home/jules/www/cgi-bin TRUE Common Gateway Interface / com.mortbay.Servlet.CGI /usr/local/bin:/usr/ucb:/bin:/usr/bin But I don't know which values I should set in Path and ResourceBase exactly. Sorry for my cluelessness, maybe anyone can help with a simple example. Regards, Phil
tagged with: jetty
tagged with: jetty-9
has title: Put mimetex.cgi on jetty 9
score: 0
answer count: 0
tagged with: java
tagged with: cgi
type: Question
tagged with: latex
has comment: http://stackoverflow.com/comment/41230581
linked to: http://stackoverflow.com/q/8763762
has comment: http://stackoverflow.com/comment/41033705
type: UnansweredQuestion

http://stackoverflow.com/comment/37229744
has text: Do you have two step verification enabled for your Gmail account? It won't work if you do
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24129303
type: AnswerComment

http://stackoverflow.com/q/24167468
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37334508
tagged with: jackson
has answer: http://stackoverflow.com/a/24186186
has body: exmaple.file I want to map the following json to object. I have tried with custom object by using Jackson. [ { "widgetTitle":"Bannerfgfg", "widgetCode" : "PRTIMG001", "widgetType":"dssdsd", "widGetSpanNumber":"2", "jqimagePath":"images/slider/", "jqimageCount":"4", "jqimageHeight":"300" }, { "widgetTitle" : "Favourites", "widgetCode" : "Favourites", "widgetType" : "sdsdsd", "widgetAttributes":{ {"key":"loadTemplate","value":[{"url" : "favourites"}] }, {"key":"loadCntId","value": "tobeloaded"} } }, { "widgetTitle" : "Exchange Rates", "widgetCode" : "sdsdsd", "widgetType" : "sdsdsdsdsd", "widgetAttributes": { {"key":"datatype","value": "json"}, {"key":"appCode","value": "mst"}, {"key":"url","value":"exchangeMaster/getCurrencyExchangeDetail?"}, {"key":"colNames" ,"value":["Form CCY","To CCY","Ex RT","Prd FRM","Prd TO"]}, {"key":"colModel","value":[ {"name" : "fromCurrencyCode","index" : "fromCurrencyCode","align":"center"}, {"name" : "toCurrencyCode","index" : "toCurrencyCode","align":"center"}, {"name" : "exchangeRate", "index" : "exchangeRate","align":"right"}, {"name" : "periodFrom","index" : "periodFrom"}, {"name" : "periodTo","index" : "periodTo"} ]}, {"key":"width","value": "440"}, {"key":"sortable","value": true}, {"key": "filterToolbar","value":{ "stringResult": "false", "searchOnEnter": "true", "enableClear": "false" }}, {"key":"jsonReader","value":{ "root":"currencyExchangeSOs" }}, {"key":"sortname","value": "fromCurrencyCode"} } } ] I am using the following code to map json with the object ObjectMapper mapper = new ObjectMapper(); InputStream src = resource.getInputStream(); try { PortalModal[] portalModal = mapper.readValue(src, PortalModal[].class); portalDataList = Arrays.asList(portalModal); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } PortalModal.java public class PortalModal { private String widgetCode; private String widgetTitle; private S…
score: 0
has answer: http://stackoverflow.com/a/24168791
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Map JSON to OBJECT by usong JackSon
has comment: http://stackoverflow.com/comment/37300563
type: Question
answer count: 2

http://stackoverflow.com/q/24135504
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/24140322
tagged with: twitter4j
tagged with: twitter
has body: Here I'm able to get all friends ids. But for the same I need to get name of corresponding id. How can I get it? For getting friends ids I'm using Twitter4j lib and my code is: String friendsIds = twitter.getFriendsIDs(MyId, cursor).toString(); For this output is: friendsIds:IDsJSONImpl{ids=[43347766, 2369925598, 238933377, 243381784, 946613156, 541261639], previousCursor=0, nextCursor=0} How can I get names for those ids?
accepted answer: http://stackoverflow.com/a/24140322
type: AnsweredQuestion
has title: How to convert friend id's to corresponding name in twitter using twitter4j?
linked to: http://stackoverflow.com/q/2784514
score: 0
tagged with: java

http://stackoverflow.com/q/24132416
tagged with: java
has comment: http://stackoverflow.com/comment/37235306
tagged with: rabbitmq
type: AnsweredQuestion
score: 0
tagged with: activemq-classic
accepted answer: http://stackoverflow.com/a/24172581
has comment: http://stackoverflow.com/comment/37258865
answer count: 1
has answer: http://stackoverflow.com/a/24172581
linked to: http://stackoverflow.com/q/731233
has title: Java: Better client/server message exchange approach?
has comment: http://stackoverflow.com/comment/37291244
has comment: http://stackoverflow.com/comment/37235206
type: Question
has body: I have a Java application which consists two kind of long running processes, let's say Server and Client, and usually the number of Clients is greater than 10. Some of the application behavior are: Server asks Client to perform some tasks by sending command to it Server pulls the task status/result from Client Client sends some heartbeat messages to Server Server querys some process status from Client Now I implement this just by transporting serialized object over TCP/IP socket. But I soon discovered that's too much details (e.g. reliability, workload monitoring) I have to deal with. So I'm looking for the various options to implement something like this. I'm currently considering message brokers like ActiveMQ, RabbitMQ or even ZeroMQ. Any advice and suggestions will be greatly appreciated. ps. Speed is not a concern for me
tagged with: zeromq

http://stackoverflow.com/comment/37250216
has text: as @mike_m pointed out, the code throwing exception is not available. So please post the entire code.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24138467
type: QuestionComment

http://stackoverflow.com/a/24181922
has body: It depends on what is your goal. You can replace echo with System.out.println. For calling external commands you can use ProcessBuilder: ProcessBuilder processBuilder = new ProcessBuilder("command", "param1","param2"); Process process = processBuilder.start(); From the process you can obtain InputStream giving access to console output produced by the process: InputStream processOutput = process.getInputStream();
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24181516
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24181516

http://stackoverflow.com/q/24220675
has comment: http://stackoverflow.com/comment/37402034
answer count: 2
accepted answer: http://stackoverflow.com/a/24221409
has comment: http://stackoverflow.com/comment/37401774
has answer: http://stackoverflow.com/a/24222092
has answer: http://stackoverflow.com/a/24221409
downvote count: 0
has comment: http://stackoverflow.com/comment/37402261
has body: I have a webview and i want it to load a url as soon as the app starts. If I call loadURL() on the press of a button it works perfectly but when I try to load the url inside onCreate() the app crashes. WebView myWebView; 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(); } } public void loadURL(View view) { myWebView = (WebView) findViewById(R.id.WebView); myWebView.setWebViewClient(new WebViewClient()); myWebView.loadUrl("http://www.google.com"); } The app crashes when I use this: WebView myWebView; 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(); } myWebView = (WebView) findViewById(R.id.WebView); myWebView.setWebViewClient(new WebViewClient()); myWebView.loadUrl("http://www.google.com"); } EDIT** This is what i am getting in my console. [2014-06-14 19:33:58 - ddms] Can't bind to local 8700 for debugger [2014-06-14 19:34:11 - ddms] null java.nio.BufferOverflowException at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:200) at com.android.ddmlib.JdwpPacket.movePacket(JdwpPacket.java:235) at com.android.ddmlib.Debugger.sendAndConsume(Debugger.java:347) at com.android.ddmlib.Client.forwardPacketToDebugger(Client.java:665) at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:344) at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263) [2014-06-14 19:34:12 - ddms] null java.nio.BufferOverflowException at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:200) at com.android.ddmlib.JdwpPacket.movePacket(JdwpPacket.java:235) at com.android.ddmlib.Debugger.sendAndConsume(Debugger.java:347) at com.android.ddmlib.Client.forwardPac…
upvote count: 1
tagged with: webview
has title: App crashes when webview.loadUrl is used in onCreate
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24222092
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/37401526
has comment: http://stackoverflow.com/comment/37401410
has comment: http://stackoverflow.com/comment/37401417
has comment: http://stackoverflow.com/comment/37401578
has comment: http://stackoverflow.com/comment/37401554
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/23353173

http://stackoverflow.com/q/24144157
type: Question
has title: How to generate private/public key pair for client-side REST authentication?
type: UnansweredQuestion
tagged with: restlet
has answer: http://stackoverflow.com/a/24151600
has body: I'm using Restlet framework to provide some RESTful resource URIs. I need authentication for every action, but I don't want to maintain server-side states. Restlet supports using Client-Side cookies for authentication, and I've personally verified this by deploying a cookie with a static string in it, and then trying to find that cookie during another request, and verifying authentication by matching the string inside the cookie. But instead of just writing any string, I now want to write something which can be used for actual authentication. So how do I generate a private public key pair in Java, such that the private key is kept in code and is always the same (even after stopping/starting the Web Application), and different public keys are generating using the private key, which I can then put into the cookies ?
score: 0
tagged with: rest
tagged with: cookies
tagged with: java
answer count: 1
tagged with: authentication

http://stackoverflow.com/q/24135363
accepted answer: http://stackoverflow.com/a/24135617
upvote count: 2
type: AnsweredQuestion
tagged with: sql
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/37240394
tagged with: mysql
score: 1
downvote count: 1
favorite count: 0
has body: I have problem when using UNION problem: I have 2 tables TOPIK and SUBTOPIK which I do left join and right join then make union of them using the following statement: mySqlStmt = "SELECT * FROM TOPIK LEFT OUTER JOIN SUBTOPIK ON TOPIK.IDTOPIK=SUBTOPIK.IDTOPIK WHERE (TOPIK.TARGETNPMHS LIKE '%0000312100006%' OR ((TOPIK.TARGETOBJECTNICKNAME LIKE '%OPERATOR KEPALA BAA%' OR TOPIK.TARGETOBJECTNICKNAME LIKE '%OPERATOR BAA%' ) AND TOPIK.TARGETNPMHS IS NULL)) UNION SELECT * FROM TOPIK RIGHT OUTER JOIN SUBTOPIK ON TOPIK.IDTOPIK=SUBTOPIK.IDTOPIK WHERE (SUBTOPIK.NPMHSRECEIVER LIKE '%0000312100006%' OR ((SUBTOPIK.OBJNICKNAMERECEIVER LIKE '%OPERATOR KEPALA BAA%' OR SUBTOPIK.OBJNICKNAMERECEIVER LIKE '%OPERATOR BAA%' ) AND SUBTOPIK.NPMHSRECEIVER IS NULL))" The code above works on mysql workbench, but when i use it in java, get connection...bla..bla; stmt = con.prepareStatement("mySqlStmt"); rs = stmt.executeQuery(); while(rs.next()) { String topik_idTopik = ""+rs.getLong("TOPIK.IDTOPIK"); } i got java.sql.SQLException: Column 'TOPIK.IDTOPIK' not found. but both TOPIK and SUBTOPIK have this column.
tagged with: union
type: Question
has answer: http://stackoverflow.com/a/24135617
possible better answer: http://stackoverflow.com/a/24135834
tagged with: jdbc
has title: UNION in MySQL using JDBC
has answer: http://stackoverflow.com/a/24135834

http://stackoverflow.com/comment/37429268
score: 2
type: Comment
type: QuestionComment
has text: Unless you have a specific question your post is out of scope for this site.
comment on: http://stackoverflow.com/q/24235251

http://stackoverflow.com/comment/37338418
score: 1
type: QuestionComment
has text: When I want to know if a subrule/terminal node is being visited at some Context, I usually just check if this subrule/terminal is null (not being visited) or not null (is being visited). But I also find this rather hacky, than a nice and clean way to get what you want...
type: Comment
comment on: http://stackoverflow.com/q/24185887

http://stackoverflow.com/comment/37184682
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24105537
type: Comment
has text: What error do you get? Are you sure you have the ids - `b1` and `b2` in the layout `activity_main`?

http://stackoverflow.com/a/24122443
has comment: http://stackoverflow.com/comment/37216549
has comment: http://stackoverflow.com/comment/37219480
answers question: http://stackoverflow.com/q/24120893
has comment: http://stackoverflow.com/comment/37216740
has comment: http://stackoverflow.com/comment/37217835
has comment: http://stackoverflow.com/comment/37216625
has comment: http://stackoverflow.com/comment/37217124
has comment: http://stackoverflow.com/comment/37217285
has comment: http://stackoverflow.com/comment/37223412
has comment: http://stackoverflow.com/comment/37222700
has comment: http://stackoverflow.com/comment/37222590
has comment: http://stackoverflow.com/comment/37216780
has comment: http://stackoverflow.com/comment/37222875
has comment: http://stackoverflow.com/comment/37221253
has body: I don't believe you are creating your file correctly: File file = new File("test.txt"); file.createNewFile(); if(file.exists()) { OutputStream fo = new FileOutputStream(file); fo.write("Hello World"); fo.close(); System.out.println("file created: "+file); url = upload.upload(file); } And to read this file: try { // open the file for reading InputStream instream = openFileInput("test.txt"); // if file the available for reading if (instream) { // prepare the file for reading InputStreamReader inputreader = new InputStreamReader(instream); BufferedReader buffreader = new BufferedReader(inputreader); String line; // read every line of the file into the line-variable, on line at the time while (( line = buffreader.readLine())) { // do something with the settings from the file } } // close the file again instream.close(); } catch (java.io.FileNotFoundException e) { // do something if the myfilename.txt does not exits } And don't forget to encapsulate code with a try-catch block to catch an IOException which is thrown from these objects. EDIT Add this to your manifest file: &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; or... File filesDir = getFilesDir(); Scanner input = new Scanner(new File(filesDir, filename)); Hope that helps! :)
has comment: http://stackoverflow.com/comment/37222117
has comment: http://stackoverflow.com/comment/37218960
accepted answer of: http://stackoverflow.com/q/24120893
type: Answer
has comment: http://stackoverflow.com/comment/37217032
has comment: http://stackoverflow.com/comment/37222996
has comment: http://stackoverflow.com/comment/37219618
score: 0
has comment: http://stackoverflow.com/comment/37219004
has comment: http://stackoverflow.com/comment/37219207
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37218983

http://stackoverflow.com/q/24203928
tagged with: java
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
has title: Form validation in jsp page using JavaScript
has answer: http://stackoverflow.com/a/24204050
answer count: 1
tagged with: jsp
tagged with: javascript
downvote count: 1
has body: i am using jsp for registration form. I use servlet for verification of existing username. how can i write client side validation code in javasript. My registration form is Name : Place : Gender : Male Female UserName : Password : Confirm sword : thank you..
score: 1

http://stackoverflow.com/q/24226205
has body: I am implementing a game where there are falling objects. They are stored in an ArrayList and when they hit the ground, I want to remove them from the arraylist. I am doing this like so: for (int i = 0; i &lt; fo_ArrayList.size(); i++) { if (fo_ArrayList.get(i).hasHitGround()) { fo_ArrayList.remove(i); } } I have another thread that is accessing this arraylist and using its size. The problem is, sometimes my game crashes, and sometimes it doesnt. Why is it not consistent? And what is the best way to solve this problem?
upvote count: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/24226245
has comment: http://stackoverflow.com/comment/37412006
has comment: http://stackoverflow.com/comment/37412049
has comment: http://stackoverflow.com/comment/37411975
has comment: http://stackoverflow.com/comment/37411959
has answer: http://stackoverflow.com/a/24226245
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37412051
type: Question
type: AnsweredQuestion
score: -1
has comment: http://stackoverflow.com/comment/37411967
has comment: http://stackoverflow.com/comment/37412117
tagged with: arraylist
has title: Removing element from arraylist not showing consistent behavior
has comment: http://stackoverflow.com/comment/37412011

http://stackoverflow.com/comment/37217267
comment on: http://stackoverflow.com/q/24122894
has text: Iterable is not extended from Collection - it's the other way around.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/37351173
has text: @user3580294 i show you our goal. Give me a 2 minutes.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24194220
score: 0

http://stackoverflow.com/comment/37410770
has text: Everytime I try to change the image in a certain cell, it doesn't do anything, the grid remains the same. Is it because it's a gif and the gif keeps redrawing itself over the changes I've made?
comment on: http://stackoverflow.com/a/24225552
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37475647
score: 0
comment on: http://stackoverflow.com/a/24258175
type: Comment
type: AnswerComment
has text: I whant that after unmarshal field Object sourceAgentUuid was initialize as object of my Agent class whith initialized field Uuid from xml.

http://stackoverflow.com/a/24137817
has body: Check if the xml files in myapp.core are at the classpath when you run your application via eclipse. Most likely they aren't. You can check by using something like if (getClass().getResource("my context-xml file") ! = null) { System.out.println("No context file on the classpath, won't work"); } Problem could be that Eclipse is configured no to copy the xml files to the bin directory.
has comment: http://stackoverflow.com/comment/37251325
type: Answer
answers question: http://stackoverflow.com/q/24136743
score: 0

http://stackoverflow.com/q/24147575
has comment: http://stackoverflow.com/comment/37263979
has comment: http://stackoverflow.com/comment/37263934
type: UnansweredQuestion
has body: I am facing following exception while testing my exit handler for my Eclipse 4 RCP Application. !ENTRY org.eclipse.e4.ui.workbench 2 0 2014-06-10 14:09:22.607 !MESSAGE Could not run processor !STACK 0 org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:220) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:107) at org.eclipse.e4.ui.internal.workbench.ModelAssembler.runProcessor(ModelAssembler.java:231) at org.eclipse.e4.ui.internal.workbench.ModelAssembler.processModel(ModelAssembler.java:88) at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadMostRecentModel(ResourceHandler.java:220) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:395) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:238) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:144) at org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equin…
has answer: http://stackoverflow.com/a/24148609
has comment: http://stackoverflow.com/comment/37264306
score: 0
has comment: http://stackoverflow.com/comment/37263837
tagged with: swtbot
tagged with: java
answer count: 1
tagged with: junit
has title: Issue running Junit test case for eclipse RCP application
tagged with: eclipse
type: Question

http://stackoverflow.com/a/24204655
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24202703
type: Answer
has comment: http://stackoverflow.com/comment/37379695
has comment: http://stackoverflow.com/comment/37371293
has body: The problem is that you are leaking resources and not cleaning up after yourself You start a transaction with your ds.begin(ReadWrite.READ) call but you don't ever close the transaction with a ds.end() call which is why subsequent calls fail with the error you see. You also fail to ever close your QueryExecution You should use a try { } catch { } finally { } to ensure that you clean up relevant resources
score: 1

http://stackoverflow.com/q/24202528
tagged with: list
has answer: http://stackoverflow.com/a/24202894
tagged with: for-loop
has comment: http://stackoverflow.com/comment/37366885
has answer: http://stackoverflow.com/a/24202660
has comment: http://stackoverflow.com/comment/37370113
tagged with: java
downvote count: 0
has title: Java Best Practices in "for" loop. How define the collection?
tagged with: loops
has answer: http://stackoverflow.com/a/24203080
has answer: http://stackoverflow.com/a/24202682
favorite count: 0
has answer: http://stackoverflow.com/a/24202685
type: Question
has body: Defining a "for-each loop", it is better use this convention: Case 1 for (String s : xxx.getList()) or this: Case 2 List&lt;String&gt; list = xxx.getList(); for (String s : list) In Case 1, how many times the method getList() is invoked? One time every loop or only one time at the beginnning? Thanks
score: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37366656
linked to: http://stackoverflow.com/q/6093537
has comment: http://stackoverflow.com/comment/37366742
answer count: 6
has answer: http://stackoverflow.com/a/24203196
duplicate of: http://stackoverflow.com/q/6093537
upvote count: 3

mallet
tags question: http://stackoverflow.com/q/24201226
type: Tag
tag name: mallet

http://stackoverflow.com/a/24158574
has body: Having the same property names is not a problem for MyBatis as long as you are able to map definite columns (or column aliases) to these properties. When you give an alias to the resulting columns, you should give the same column name to the paymentTypeResultMap too. It should work then. &lt;resultMap id="payTransactionPaymentTypeResultMap" type="com.XXX.payplatform.model.to.impl.TOPayTransaction" &gt; &lt;id column="id" property="id" javaType="long"/&gt; &lt;result column="payment_state" property="payment_state" javaType="string"/&gt; &lt;result column="creation_date" property="creation_date" javaType="date"/&gt; &lt;result column="update_date" property="update_date" javaType="date"/&gt; &lt;result column="payment_id" property="payment_id" javaType="long"/&gt; &lt;association column="payment_type" property="paymentType" javaType="com.XXX.payplatform.model.to.impl.TOPaymentType" resultMap="com.XXX.payplatform.model.dao.interfaces.IDAOPaymentType.paymentTypeResultMap"/&gt; &lt;/resultMap&gt; ... &lt;resultMap id="paymentTypeResultMap" type="com.XXX.payplatform.model.to.impl.TOPaymentType" &gt; &lt;id column="paymenttype_id" property="id" javaType="long"/&gt; &lt;result column="description" property="description" javaType="string"/&gt; &lt;/resultMap&gt; ... &lt;sql id="joinPayTransactionPaymentType"&gt; select paytransaction.id, paytransaction.payment_state as payment_state, paytransaction.creation_date as creation_date,paytransaction.update_date as update_date, paytransaction.payment_id as payment_id, paymenttype.id AS paymenttype_id, paymenttype.description as description from paytransaction INNER JOIN paymenttype ON paymenttype.id = paytransaction.payment_type &lt;/sql&gt;
has comment: http://stackoverflow.com/comment/37283974
has comment: http://stackoverflow.com/comment/37439601
has comment: http://stackoverflow.com/comment/37295335
score: 0
answers question: http://stackoverflow.com/q/24157353
has comment: http://stackoverflow.com/comment/37360721
type: Answer
has comment: http://stackoverflow.com/comment/37284323
has comment: http://stackoverflow.com/comment/37288439
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24157353

http://stackoverflow.com/a/24158973
type: AcceptedAnswer
score: 10
has comment: http://stackoverflow.com/comment/37286291
accepted answer of: http://stackoverflow.com/q/24158650
type: Answer
answers question: http://stackoverflow.com/q/24158650
has comment: http://stackoverflow.com/comment/37303620
downvote count: 0
has body: The rules for what casts are compile-time legal only take into account the static types. When the Java compiler analyzes the expression (I) new B(), it sees that the static type of the expression new B() is B. We can tell that new B() can't possibly be an instance of I, but the compile-time analysis rules can't tell that the object isn't actually an instance of a subclass of B that implements I. Thus, the compiler has to let it through. Depending on how sophisticated the compiler is, it might detect the oddity and issue some sort of warning, but in the same way 1/0 isn't a compile-time error, this can't be a compile-time error.
upvote count: 10

http://stackoverflow.com/comment/37526142
score: 0
has text: OK. Is the problem always reproducible when you are not using the temporary variable?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24244824

http://stackoverflow.com/a/33680874
downvote count: 0
score: 3
type: Answer
has body: Thank to the above code , here is my code : Notice : Export excel with ireport, ireport 6.0 , java 7 Map&lt;String, Object&gt; parametro = new HashMap&lt;String, Object&gt;(); parametro.put("USUARIO", UConstante.NAME_MINISTERIO_USER); parametro.put("RUTA_LOGO", PuenteFile.getRutaFiles(FacesContext.getCurrentInstance(), PuenteFile.RUTA_IMG_LOGO)); parametro.put("PATH_SYSTEM", rutaFileSystemHD); parametro.put("WHERE_DATA", WHERE_REGISTRO); parametro.put("WHERE_PROYECTO_USUARIO", WHERE_PROYECTO_USUARIO); parametro.put("WHERE_ZONA", WHERE_ZONA); parametro.put("NAME_APP", RutaFile.NAME_APP); parametro.put("ID_USUARIO", getUsuario().getId()); parametro.put("ID_PROYECTO", beanProyecto.getId()); parametro.put("SUBREPORT_DIR", SUBREPORT_DIR); System.out.println("&gt;&gt;&gt;&gt;&gt;&gt; PARAMETROS :" + parametro.toString()); try { JasperPrint jasperPrint = JasperFillManager.fillReport(path, parametro, PgConnector.getConexion()); JRXlsExporter xlsExporter = new JRXlsExporter(); xlsExporter.setExporterInput(new SimpleExporterInput(jasperPrint)); xlsExporter.setExporterOutput(new SimpleOutputStreamExporterOutput(PuenteFile.getRutaFiles(FacesContext.getCurrentInstance(), PuenteFile.RUTA_REPORT_FILE) + nameExcel)); SimpleXlsReportConfiguration xlsReportConfiguration = new SimpleXlsReportConfiguration(); SimpleXlsExporterConfiguration xlsExporterConfiguration = new SimpleXlsExporterConfiguration(); xlsReportConfiguration.setOnePagePerSheet(true); xlsReportConfiguration.setRemoveEmptySpaceBetweenRows(false); xlsReportConfiguration.setDetectCellType(true); xlsReportConfiguration.setWhitePageBackground(false); xlsExporter.setConfiguration(xlsReportConfiguration); xlsExporter.exportReport(); } catch (Exception ex) { ex.printStackTrace(); }
answers question: http://stackoverflow.com/q/24117878
upvote count: 3

http://stackoverflow.com/comment/37261812
comment on: http://stackoverflow.com/q/24146800
type: Comment
type: QuestionComment
has text: for better help please post a [MCVE](http://stackoverflow.com/help/mcve) that demonstrates the issue.
score: 1

http://stackoverflow.com/comment/37228008
comment on: http://stackoverflow.com/q/24128353
type: Comment
type: QuestionComment
score: 0
has text: I have declared a global variable as StreamedContent type.

http://stackoverflow.com/comment/37366181
type: Comment
score: 0
type: QuestionComment
has text: C:\Java\jdk1.7.0_55\lib\endorsed\jaxb-api-2.2.jar C:\Java\jdk1.7.0_55\lib\endorsed\jaxb-impl-2.2.7.jar C:\Java\jdk1.7.0_55\lib\endorsed\jaxb-xjc-2.2.7.jar C:\AnypointStudio\plugins\org.mule.tooling.server.3.5.0_3.5.0.201405141856\mule\lib\endorsed
comment on: http://stackoverflow.com/q/24201825

http://stackoverflow.com/a/24109308
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37197497
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24108965
has comment: http://stackoverflow.com/comment/37197651
has body: Use requests and Beautifulsoup import requests from bs4 import BeautifulSoup r=requests.get("http://docs.oasis-open.org/cmis/CMIS/v1.1/os/CMIS-v1.1-os.html") # get page using requests soup=BeautifulSoup(r.content) s = soup.find_all(text=re.compile('\.pdf'))# find all .pdf's print s [u'http://docs.oasis-open.org/cmis/CMIS/v1.1/os/CMIS-v1.1-os.pdf', u'http://docs.oasis-open.org/cmis/CMIS/v1.1/csprd01/CMIS-v1.1-csprd01.pdf', u'http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.pdf']

http://stackoverflow.com/a/50794357
answers question: http://stackoverflow.com/q/24232513
upvote count: 2
type: Answer
downvote count: 1
score: 1
has body: Go gets its object oriented concepts from Small Talk, not Simula like C++ and not from Java which gets its OO concepts from C++. Remember this and Go will suddenly become clear and obvious. Thus, there is no concept of class in Go. Just objects, sending and receiving messages. Go's interfaces can be conceptually explained as collection of messages. Go types do not “implement” interfaces, they just implement messages that are part of some interface. Repeat: there is no class, no abstract base class and thus there is no “class based design” in Go (as in Small Talk). No wonder trying to implement ABC in Go is a mess, as we see here clearly.

http://stackoverflow.com/comment/37280289
comment on: http://stackoverflow.com/a/24156573
score: 0
has text: If your version is `4.2`, then i think you already have the size enhancements, which means that `3.5 TB` an enhanced size.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37479112
type: AnswerComment
comment on: http://stackoverflow.com/a/24200140
score: 1
has text: @RyanS there are a lot of tutorials and lectures available for parallel programming. You need to just use search engine for that I am sharing one with basic details [link](https://computing.llnl.gov/tutorials/mpi/) that may be suitable for you but you should not limit yourself to it. For development in parallel computing you should know about Single Program Multiple Data (SPMD) model and why message passing is required. It would be good if you can share basic idea of what you want to develop else this discussion would go endless.
type: Comment

http://stackoverflow.com/comment/46798369
type: QuestionComment
type: Comment
has text: @DanielMarín Sorry, no! I've done a workaround, where, if I have a failed service call, i Will delete the stored pass, so a new auth flow will start
comment on: http://stackoverflow.com/q/24239332
score: 0

http://stackoverflow.com/a/24185590
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24184305
has body: For your problem, there are two main solutions. The first one is to take the three pairs of numbers that you give and put them into a Map. A map associates a key with a value, so you would put each pair into your map HashMap&lt;Integer, Integer&gt; myMap = new HashMap(); myMap.put(myKey, myValue); To get myValue from the map, you would access it through myMap.get(myKey) The other way to do this is to note that the numbers that you give follow a function. 2x-1. You can create a function in the code to mimic this behavior int myFunction(int value) { return 2*value-1; } Just call this function and you will get the correct output. For example myFunction(3) will return 5.

http://stackoverflow.com/a/24165691
has comment: http://stackoverflow.com/comment/37297331
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24165529
has body: Usually this kind of applications do it with a Connection Pool, in this way every Thread can use one connection exclusively, and if you have more Threads than connection at the same time, the Threads that doesn't have a connection assigned must wait. If you want a framework for implement Connection Pool you can check these: Apache Commons DBCP http://commons.apache.org/proper/commons-dbcp/ C3PO http://sourceforge.net/projects/c3p0/ Apache jdbc-pool http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html (thanks to MRalwasser) In the other hand maybe you want delegate all the Thread and connection management to an EJB container, basically you can implement the same with EJBs and Connection Pool managed by some container, you can check the following containers: Apache TomEE http://tomee.apache.org/ Oracle Glassfish https://glassfish.java.net/ Apache OpenEJB if you want only the EJB container without the full Java EE platform
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37297230
accepted answer of: http://stackoverflow.com/q/24165529
downvote count: 0
has comment: http://stackoverflow.com/comment/37297060

http://stackoverflow.com/comment/37291485
score: 0
has text: There's no TextView?!
type: AnswerComment
comment on: http://stackoverflow.com/a/24162874
type: Comment

http://stackoverflow.com/q/24177068
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jdi
has body: I am using the JDI to debug another running java application. What I do that works: Run two applications using Eclipse. The debugger is launched with the following VM Options: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000 The other application connects to the socket at port 4000, and follows normal procedures (break points, etc.) to get a value of a Local Variable. Works properly and gives me that value. What I want to do now: Instead of using Eclipse to launch two processes, I launch one in Eclipse, and that Process uses a ProcessBuilder to launch another one with the following arguments: String[] args1 = {getJavaDir(),"-cp",classpath,"-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000", "processII.Main2"}; ProcessBuilder builder = new ProcessBuilder(args1); builder.directory(directory); Process process = builder.start(); The process starts successfully. However, when I try to access it through the first process, I get the following Error: com.sun.jdi.connect.IllegalConnectorArgumentsException: Argument invalid Looked this up online, and there is little information about what the Exception is. I would appreciate any help figuring out what the problem is!
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/56734698
type: Question
accepted answer: http://stackoverflow.com/a/24177640
answer count: 2
has answer: http://stackoverflow.com/a/56734698
has title: JDI - IllegalConnectorArgumentsException: Argument invalid
has answer: http://stackoverflow.com/a/24177640
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/37206894
score: 0
comment on: http://stackoverflow.com/a/24117650
type: Comment
type: AnswerComment
has text: no my question is clear, i want the start position and end position that's all.

http://stackoverflow.com/comment/37378376
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24208531
has text: @JamesBlack if you try `new Foo<Integer>[8]` you'll still get a compile error
score: 1

http://stackoverflow.com/comment/37193874
type: AnswerComment
comment on: http://stackoverflow.com/a/24110110
type: Comment
has text: Looks like you are messing up with the TextView in your layout file. I've put the modified TextView. Please use it in your XML file and check with the final run. Once success, I can clarify if any doubts...
score: 0

http://stackoverflow.com/comment/37300834
has text: Take a look at this answer http://stackoverflow.com/questions/24150017/how-can-i-test-if-this-object-returns-the-correct-string/24150270#24150270
comment on: http://stackoverflow.com/q/24167590
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37217259
score: 0
type: Comment
has text: I meant "doSomethingWeird", and not "doMethingWeird". But I hope it helps.
type: AnswerComment
comment on: http://stackoverflow.com/a/24123116

http://stackoverflow.com/comment/37512696
score: 0
type: Comment
type: AnswerComment
has text: @Minimul : Please have a look at the link below as i had wrote my method code on this link : http://stackoverflow.com/questions/24278935/com-intuit-ipp-exception-fmsexception-in-quickbooks-part-2
comment on: http://stackoverflow.com/a/24265744

http://stackoverflow.com/a/24266822
accepted answer of: http://stackoverflow.com/q/24266526
type: AcceptedAnswer
downvote count: 0
has body: I have this folder structure: - home - org - test + Foo.java + Foo.class And the code in Foo.java is a simple hello world application: //Note the usage of the package statement here. package org.test; public class Foo { public static void main(String[] args) { System.out.println("Hello world"); } } Then, in command line, in order to execute Foo.class, I should provide the complete name of the class (I'm in "/home" folder in cmd): $ java -cp "org/test;." Foo Exception in thread "main" java.lang.NoClassDefFoundError: Foo (wrong name: org/test/Foo) $ java -cp "org/test;." org.test.Foo Hello world Now, I edit the class above and remove the package sentence: //no package specified public class Foo { public static void main(String[] args) { System.out.println("Hello world"); } } After recompiling the class and executing the same command lines: $ java -cp "org/test;." Foo Hello world $ java -cp "org/test;." org.test.Foo Exception in thread "main" java.lang.NoClassDefFoundError: org/test/Foo (wrong name: Foo) TL;DR Make sure to always specify the full name of the class. Check if your class belongs to a package. Specifying the path of the class to execute is the same as writing the full name of the class, java program will replace / by ..
score: 3
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24266526

http://stackoverflow.com/a/24266644
has body: Use Rectangle class. There's a method called Intersect or Intersection or something like that. Say you have one object moving. Make a Rectangle to match the object in position(basically an invisible cover for the object). Do the same things with another object. When both are to collide, use the intersection method to check on the collision by using the rectangles. These might help http://docs.oracle.com/javase/7/docs/api/java/awt/Rectangle.html Java method to find the rectangle that is the intersection of two rectangles using only left bottom point, width and height? java.awt.Rectangle. intersection()
accepted answer of: http://stackoverflow.com/q/24266346
answers question: http://stackoverflow.com/q/24266346
score: 0
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/q/24222081
has title: error: Multiple annotations found at this line:
type: Question
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/24222502
score: 0
has body: I am implementing searchview in my app, for which I copied this options_menu.xml from a separate working project of searchview. I get this error in res/menu/options_menu.xml Multiple annotations found at this line: - error: No resource identifier found for attribute 'actionViewClass' in package 'com.example.indianconstitution' - error: No resource identifier found for attribute 'showAsAction' in package 'com.example.indianconstitution' Code: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto"&gt; &lt;item android:id="@+id/action_search" // error in this line android:icon="@drawable/ic_launcher" android:title="@string/action_search" yourapp:actionViewClass="android.support.v7.widget.SearchView" yourapp:showAsAction="always" /&gt; &lt;/menu&gt; Can anyone figure out this problem? Thanks in advance...
tagged with: android
tagged with: java

http://stackoverflow.com/comment/37440553
comment on: http://stackoverflow.com/q/24206634
has text: I would compile everything with the normal java compiler and only add the aspects compiler to the core project instead of to every project.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37288166
has text: JAXB is quite extended, so in its present form the only way to answer your question would be to describe the entire process and write most of the code. Therefore may I suggest you start by studying a good JAXB tutorial (like [this one](https://jaxb.java.net/tutorial/), or [the official EE tutorial](http://docs.oracle.com/javaee/5/tutorial/doc/bnazf.html)). Most IDEs have extended tooling for JAXB on board that will automate a large part of the work, so also look up what tools exist in or for your IDE.
comment on: http://stackoverflow.com/q/24161121
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24246489
accepted answer of: http://stackoverflow.com/q/24246418
answers question: http://stackoverflow.com/q/24246418
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37450934
has body: According to the documentation for getKeyStroke(char): Returns a shared instance of a KeyStroke that represents a KEY_TYPED event for the specified character. KeyStroke.getKeyStroke('&lt;'); KeyStroke.getKeyStroke('&gt;'); Before, you were using a String. Looking and the docs for getKeyStroke(java.lang.String): Parses a string and returns a KeyStroke. The string must have the following syntax: This method has a complicated syntax to follow. A single letter worked, but a special character doesn't follow the syntax. The getKeyStroke(char) is a lot simpler. You should use it instead.
upvote count: 5
type: Answer

http://stackoverflow.com/comment/37365383
type: Comment
score: 1
has text: Please post your Log4j configuration.
type: QuestionComment
comment on: http://stackoverflow.com/q/24201699

http://stackoverflow.com/comment/37473141
comment on: http://stackoverflow.com/a/24258131
score: 0
type: Comment
type: AnswerComment
has text: In case I have a service that goes to work on the mocked list that I just returned using when().thenReturn(), I might want to verify the interactions on the list.

http://stackoverflow.com/comment/37199993
has text: The method getText() from the type JPasswordField is deprecated. use getPassword().
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24113614
type: Comment

http://stackoverflow.com/q/24215110
has body: Short of copying the character to the clipboard and pasting it inside my string, is there a way to draw a greek letter (or for that matter, any unicode character)? I know the code for the character I am trying to draw is U+03F4 according to here. I have tried the following: g.drawString("U+03F4", 100, 100); // works as a string literal as it should g.drawString("\U+03F4", 100, 100); // error: Illegal escape character g.drawString("\\U+03F4", 100, 100); // thought I could trick it. Just draws "\U+03F4" I saw in this question that the 'u' was lowercase but that didn't make any difference. Why would this not be working?
has title: How to draw a unicode character in java?
has answer: http://stackoverflow.com/a/24215130
downvote count: 0
tagged with: unicode
has answer: http://stackoverflow.com/a/24215140
accepted answer: http://stackoverflow.com/a/24215134
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24215134
answer count: 3
linked to: http://stackoverflow.com/q/7652244
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37391421
favorite count: 0
linked to: http://stackoverflow.com/q/21522770
type: Question
possible better answer: http://stackoverflow.com/a/24215130

http://stackoverflow.com/comment/37184053
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24105208
score: 0
has text: At any point, do you state `jRadioButton1 = new JRadioButton()`?

http://stackoverflow.com/comment/37489206
type: Comment
has text: If you have a small amount of places where you instantiate this class why not just put a counter variable there to count every time you make and instance and dump it out to console or a text file? It's not pretty or the most efficient way to go about it but its and easy to implement solution
type: QuestionComment
comment on: http://stackoverflow.com/q/24266608
score: 1

http://stackoverflow.com/q/24108116
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/24108508
has comment: http://stackoverflow.com/comment/37189301
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24108461
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24108508
has comment: http://stackoverflow.com/comment/37189758
has body: In my project, I need to add an image to sqlite database. I add data to the data base just after create the database in onCreate method. To get the image as the bitmap in android, need to use an Activity. Here is my code. public class MySqlHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 15; private static final String DATABASE_NAME = "BirdDB"; private static final String TABLE_BIRDS = "birds"; private static final String KEY_ID = "id"; private static final String KEY_NAME = "name"; private static final String KEY_SINHALA_NAME = "sinhala_name"; private static final String KEY_SCIENTIFIC_NAME = "scientific_name"; private static final String KEY_DESCRIPTION = "description"; private static final String KEY_IMAGE = "image"; private static final String[] COLUMNS = {KEY_ID,KEY_NAME,KEY_SINHALA_NAME,KEY_SCIENTIFIC_NAME,KEY_DESCRIPTION,KEY_IMAGE}; public MySqlHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub String CREATE_TABLE = "CREATE TABLE "+TABLE_BIRDS+" ( " + ""+KEY_ID+" INTEGER PRIMARY KEY AUTOINCREMENT, " + ""+KEY_NAME+" TEXT, "+ ""+KEY_SINHALA_NAME+" TEXT, "+ ""+KEY_SCIENTIFIC_NAME+" TEXT, "+ ""+KEY_DESCRIPTION+" TEXT, "+ ""+KEY_IMAGE+" BLOB )"; db.execSQL(CREATE_TABLE); String name1 = "Sri Lanka Junglefowl"; String name2 = "Indian Prefowl"; String sinhalaName1 = "j,s l=l=,d"; String sinhalaName2 = "fudKrd"; String sceintficName1 = "Gallus lafayttii"; String sceintficName2 = "Pavo cristatus"; String des1 = "Male like a domestic rooster. Female:bare faced,spotted and streaked below,heavily barred on wing. Endemic."; String des2 = "Crest of bare-shafted feathers. Male has distinctive train."; BirdData bird1 = new BirdData(name1,sinhalaName1,sceintficName1,des1,imageHandler.getImage1()); BirdData bird2 = new BirdData(name2,sinhalaName2,sceintficName2,des2,imageHandler.getImage2()); …
type: AnsweredQuestion
has title: Call Activity in SQLiteOpenHelper class
downvote count: 0
has answer: http://stackoverflow.com/a/24108461
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/q/24126222
favorite count: 0
duplicate of: http://stackoverflow.com/q/8198797
linked to: http://stackoverflow.com/q/21022117
type: Question
has body: I'm trying to tell the ComponentScan annotation in Spring to import just a single class following this example: using ComponentScan or context:component-scan with only one class @ComponentScan( basePackages = {"com.example.controllers"}, useDefaultFilters = false, includeFilters = { @ComponentScan.Filter(type = ASSIGNABLE_TYPE, value = ExampleController.class) }) class MyControllerTestConfig { } I believe this is ported to Scala as follows: @Configuration @ComponentScan( basePackages = Array("com.example.controllers"), useDefaultFilters = false, includeFilters = Array( new ComponentScan.Filter(type = ASSIGNABLE_TYPE, // fails value = Array(classOf[ExampleController])) )) class MyControllerTestConfig { } However, Scala doesn't let me use the word "type" as a parameter as it is a keyword in scala :-( Is there a way to supply "type" as an annotation parameter in scala?
tagged with: scala
tagged with: spring
score: -1
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/24126296
has title: Possible to use the "type" as an annotation parameter in Scala?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8198797
upvote count: 0
tagged with: java
tagged with: annotations
accepted answer: http://stackoverflow.com/a/24126296
answer count: 1
downvote count: 1

http://stackoverflow.com/q/24239645
has comment: http://stackoverflow.com/comment/37437764
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24239860
has title: Instantiate subclass from superclass Java
has comment: http://stackoverflow.com/comment/37437586
score: 1
has answer: http://stackoverflow.com/a/24239860
tagged with: java
has body: I want to try and instantiate a Child object that extends Parent with the properties of a previously instantiated parent object. So something like this: class Parent { ClassName property1; // Setters and getters } class Child extends Parent { public Child(Parent parent) { this.property1 = parent.getProperty1(); // + other properties } } Parent parent = new Parent(); parent.setProperty1(prop); Child object = (Child)parent; // Casting exception Child object2 = new Child(parent); // This is not ideal Is there any other way to achieve this?
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37437546
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37437525
has comment: http://stackoverflow.com/comment/37437858
has comment: http://stackoverflow.com/comment/37437808
has comment: http://stackoverflow.com/comment/37438228
type: Question
has comment: http://stackoverflow.com/comment/37437711
has comment: http://stackoverflow.com/comment/37437694
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37437918
has comment: http://stackoverflow.com/comment/37437629
has comment: http://stackoverflow.com/comment/37437726

http://stackoverflow.com/q/24116476
has title: java.sql.date , java.sql.timestamp predicate -> Oracle partition data type
possible better answer: http://stackoverflow.com/a/24153544
favorite count: 0
type: Question
tagged with: database-partitioning
tagged with: oracle-database
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24116692
accepted answer: http://stackoverflow.com/a/24116692
tagged with: jdbc
has answer: http://stackoverflow.com/a/24153544
has body: Hi we had big Oracle column object and we had partitioned it with a Data Type of DATE One of the partitions looks like this : GCP_P1 TO_DATE(' 2011-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN') 83 M_DATA01 DISABLED 348132 15214 146 08.06.2014 02:20:40 1078 0 Each partition is one week long. We run our sql's through thin client with jdbc. No ORM just pure jdbc. When our predicate item for the partitioned column is java.sql.timestamp we realized that the query does not benefit from partition. However when it is of type java.sql.date the execution plan shows a successful partition access. So for example our sql looks like this : SELECT COUNT(1) FROM ATABLE WHERE PARTITIONED_COLUMN &gt; ? When our java statement is : preparedStatement.setDate(...); // it benefits from partition But when it is like this : preparedStatement.setTimestamp(...); //it does not benefits from partition I am looking them from Toad. I have experienced that when it is java.sql.date, It is interpreted as DATE on oracle, when it is java.sql.timestamp it is interpreted as TIMESTAMP I am following the captured jdbc date type with the following sql statement SELECT * FROM V$SQL_BIND_CAPTURE WHERE WAS_CAPTURED = 'YES' AND LAST_CAPTURED BETWEEN SYSDATE-1/50 AND SYSDATE ORDER BY LAST_CAPTURED DESC; My question is have you experienced such an issue? If so would you direct me to some documents.
type: AnsweredQuestion
answer count: 2
downvote count: 0
tagged with: sql
upvote count: 1

http://stackoverflow.com/a/24273497
accepted answer of: http://stackoverflow.com/q/24120074
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/24120074
has body: your socket is getting closed from Otherside
type: Answer
score: -1
upvote count: 0

http://stackoverflow.com/q/24237283
has answer: http://stackoverflow.com/a/24237324
has title: java performing array calculation
has comment: http://stackoverflow.com/comment/37433355
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37433425
answer count: 3
has answer: http://stackoverflow.com/a/24237321
accepted answer: http://stackoverflow.com/a/24237321
type: Question
has body: The code below will print two square matrices and I need them to perform multiplication between the two matrices but i cant seem to get that part working. I put a comment right before that block of code where the problem is. But for now all it prints is zeros. Iv been looking online at a lot of sites but cant seem to get mine to work. import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { //create the grid final int rowWidth = 9; final int colHeight = 9; Random rand = new Random(); int [][] board = new int [rowWidth][colHeight]; //fill the grid for (int row = 0; row &lt; board.length; row++) { for (int col = 0; col &lt; board[row].length; col++) { board[row][col] = rand.nextInt(10); } } //display output for(int i = 0; i &lt; board.length; i++) { for(int j = 0; j &lt; board[i].length; j++) { System.out.print(board[i][j] + " "); //System.out.println(); } System.out.println(); } System.out.println(); int [][] board2 = new int [rowWidth][colHeight]; //fill the grid for (int row2 = 0; row2 &lt; board2.length; row2++) { for (int col2 = 0; col2 &lt; board[row2].length; col2++) { board[row2][col2] = rand.nextInt(10); } } //display output for(int m = 0; m &lt; board2.length; m++) { for(int n = 0; n &lt; board[m].length; n++) { System.out.print(board[m][n] + " "); } System.out.println(); } //error is somewhere here int[][] calculationMultiplication = new int[rowWidth][colHeight]; for (int l = 0; l &lt; rowWidth; l++) { for (int t = 0; t &lt; colHeight; t++) { for (int z = 0; z &lt; rowWidth; z++) { calculationMultiplication[l][t] = calculationMultiplication[l][t] + board[l][z] * board2[z][t]; } } } //display output System.out.println("\nProduct of the 2 matrices is "); for (int i = 0; i &lt; calculationMultiplication.length; i++) { for (int j = 0; j &lt; calculationMultiplication[0].length; j++) { System.out.print(calculationMultiplication[i][j] + " "); } System.out.println(); } } //end of main } //end of class Main
tagged with: java
possible better answer: http://stackoverflow.com/a/24237324
has comment: http://stackoverflow.com/comment/37433328
has comment: http://stackoverflow.com/comment/37433381
has comment: http://stackoverflow.com/comment/37433364
has answer: http://stackoverflow.com/a/24237492

http://stackoverflow.com/comment/37217526
type: AnswerComment
has text: I'll try again. You get a blank page, whereas before you got a 404 ? You need to get your logging sorted. You can't build anythgn without logging problems.
comment on: http://stackoverflow.com/a/24122134
type: Comment
score: 0

http://stackoverflow.com/q/24245682
has body: Firstly, I'm an absolute beginner in Android. I'm trying to create a ListView that shows items from an Array of Strings and allow the user to edit these items by just clicking in which one he wants to modify. These changes must be saved in the array of strings too. Here's my code (important pieces) and classes: MainActivity.java (send through Intent the array saved statically (preSetDevices)) String preSetDevices [] = {"D4:92:9D:F5:1C:1A","E5:05:65:5E:C4:E7","ED:3E:77:06:9E:46"}; ... btsetDevices = (Button) findViewById(R.id.setDevices); btsetDevices.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(MainActivity.this, SetDevices.class); myIntent.putExtra("array_set_devices", preSetDevices); startActivity(myIntent); } }); SetDevices.Java (receive the intent, show the item in the ListView (here's where I want to modify the item and save these changes on array of strings) public class SetDevices extends Activity{ ListView lvResult; Intent intent; String[] array_devices_received; ArrayAdapter&lt;String&gt; adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.set_devices); registerClickCallBack(); intent = getIntent(); array_devices_received = intent.getStringArrayExtra("array_set_devices"); lvResult = (ListView) findViewById(R.id.lvResult); adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, array_devices_received); lvResult.setAdapter(adapter); } private void registerClickCallBack() { lvResult.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View viewClicked,int position, long id) { //What do I have to put here to edit items of the listview and save changes in this array of string, (I will return this array modified to MainActivity.java through Intent again later) } }); } }
tagged with: listview
type: AnsweredQuestion
score: 0
tagged with: android-listview
tagged with: java
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/24246086
type: Question
tagged with: android
has title: Edit ListView Items and save changes
accepted answer: http://stackoverflow.com/a/24246086

adt
tags question: http://stackoverflow.com/q/24170319
tags question: http://stackoverflow.com/q/24178057
tags question: http://stackoverflow.com/q/24235715
tags question: http://stackoverflow.com/q/24260680
tags question: http://stackoverflow.com/q/24217206
type: Tag
tag name: adt

http://stackoverflow.com/q/24219883
has answer: http://stackoverflow.com/a/24219942
type: Question
tagged with: network-programming
tagged with: sockets
tagged with: port
has body: in every Java socket program we have a Serversocket and Client Socket with port numbers I am confused with communication mechanism we have a Fixed port number for Server and its obvious for server to take connections one one port number however we have different port from clients , i mean every time it give me different port number when I print System.out.println("caught a client : "+ client.getInetAddress() +" : "+ client.getPort()); I want to know the reason why clients port number is different every time thanks
type: AnsweredQuestion
score: 0
tagged with: serversocket
tagged with: java
accepted answer: http://stackoverflow.com/a/24219942
has title: java serverSocket use same port whereas client uses different
answer count: 1

http://stackoverflow.com/comment/37463367
comment on: http://stackoverflow.com/q/24252640
type: Comment
type: QuestionComment
score: 0
has text: This should just work. What is the MVN command used ? Maybe this config is specified in pluginManagement section, or in a specific profile.

http://stackoverflow.com/a/24177212
has comment: http://stackoverflow.com/comment/37318999
has comment: http://stackoverflow.com/comment/37319030
type: Answer
has comment: http://stackoverflow.com/comment/37319041
answers question: http://stackoverflow.com/q/24177134
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24177134
has body: ohhh.. In this case control is not reaching to servlet so how would you expect to run redirect!! In action part of your html you have written action="http://localhost:8080/Spedt/LogIn" you should use action for your servlet which you have define in web.xml file see your xml file is LogIn mypkg.LogIn if your write action=LogIn then you will go to mypkg.LogIn servlet
has comment: http://stackoverflow.com/comment/37318985

http://stackoverflow.com/comment/37444268
type: Comment
comment on: http://stackoverflow.com/a/24240873
type: AnswerComment
has text: As I said in my answer, you cannot. You have to use `<form:checkbox/>` to ask spring to give you a list of all checkboxes either true or false
score: 0

http://stackoverflow.com/a/24221231
score: 0
has body: A char is a two-bytes unsigned integer in Java. 'c' is a more readable way (when dealing with characters) of saying 99, because the Unicode value of the character 'c' is 99. So if your c variable is the character 'c', its value is 99. The value of 'a' being 97, 'c' - 'a' is equal to 2.
type: Answer
answers question: http://stackoverflow.com/q/24221208

http-post
tags question: http://stackoverflow.com/q/24255679
type: Tag
tags question: http://stackoverflow.com/q/24232745
tag name: http-post

http://stackoverflow.com/q/24120050
tagged with: java
answer count: 1
has body: Using the following code to convert Flow_Rate from a 'double' to a byte array I received the output: [B@6a2b8b42 How do I check that the output is correct? private double Flow_Rate= 8; OFVendor of_vendor = new OFVendor(); byte [] rate = ByteBuffer.allocate(8).putDouble(Flow_Rate).array(); of_vendor.setData(rate); Logger.stderr("ZB----&gt;&gt; ClientChannelWatcher::handleConnectedEvent OFVendor setData() : "+rate);
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2905556
accepted answer: http://stackoverflow.com/a/24154822
has title: How to convert data of double in to array of byte, also how to check its output that the data is converted properly
duplicate of: http://stackoverflow.com/q/2905556
tagged with: arrays
tagged with: openflow
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24154822
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/a/24190873
type: Answer
has comment: http://stackoverflow.com/comment/37344456
has comment: http://stackoverflow.com/comment/37344335
answers question: http://stackoverflow.com/q/24190625
has body: Can't tell without at least knowing what the error is, but my guess is that instead of Intent i = new Intent(this, FotoActivity.class); you should use either: Intent i = new Intent(getApplicationContext(), FotoActivity.class); or Intent i = new Intent(MyActivity.this, FotoActivity.class); where "MyActivity" is the name of the Activity that you're creating the intent in.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/24190625

http://stackoverflow.com/comment/37292605
has text: Your code is not the answer. Though you touch my question answer in your comments.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24160296
type: AnswerComment

http://stackoverflow.com/comment/37409273
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24224780
score: 1
has text: this is fired when users change the date through the settings http://stackoverflow.com/questions/10831789/date-changed-broadcast-is-not-being-fired

http://stackoverflow.com/a/24258641
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24256485
type: Answer
answers question: http://stackoverflow.com/q/24256485
has body: Below newItem.setText("Delete"); line add the code below(Its adds selection listener to item). Also mark variable selected as final. newItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { list.remove(selected); } });

http://stackoverflow.com/comment/37331295
comment on: http://stackoverflow.com/q/24182305
score: 0
type: Comment
has text: You won't get SNAPSHOT's from Maven Central. Why are you trying to get SNAPSHOT's of jbehave ?
type: QuestionComment

http://stackoverflow.com/comment/37390532
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24214015
has text: Sorry, the post is in the initialization of the class, and WalkAnim is true if touchDown
score: 0

http://stackoverflow.com/comment/37480746
type: AnswerComment
has text: Nope: `org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myPath' defined in class path resource [spring.xml]: No matching factory method found: factory bean 'pathFactory'; factory method 'get()'`.
comment on: http://stackoverflow.com/a/24262363
type: Comment
score: 0

point
type: Tag
tag name: point
tags question: http://stackoverflow.com/q/24231458

aes
tag name: aes
tags question: http://stackoverflow.com/q/24119055
tags question: http://stackoverflow.com/q/24250105
tags question: http://stackoverflow.com/q/24227043
tags question: http://stackoverflow.com/q/24147057
tags question: http://stackoverflow.com/q/24124273
type: Tag
tags question: http://stackoverflow.com/q/24129441
tags question: http://stackoverflow.com/q/24130154
tags question: http://stackoverflow.com/q/24121346
tags question: http://stackoverflow.com/q/24138402

http://stackoverflow.com/a/24218827
has comment: http://stackoverflow.com/comment/37398117
score: 3
has comment: http://stackoverflow.com/comment/37398054
type: Answer
has comment: http://stackoverflow.com/comment/37399058
answers question: http://stackoverflow.com/q/24218790
has body: Simply casting to int would truncate everything past the decimal point. float f1 = 10.345; int i1 = (int) f1; // Gives 10 float f2 = 10.897; int i2 = (int) f2; // Also gives 10
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24218790
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24231072
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24202714
has body: How do I deserialize this array of Resources from the JSON into my List of the ResourceDescription? You have to create additional root class which contains resourcedescriptions property. For example: class Root { private List&lt;ResourceDescription&gt; resourcedescriptions; public List&lt;ResourceDescription&gt; getResourcedescriptions() { return resourcedescriptions; } public void setResourcedescriptions(List&lt;ResourceDescription&gt; resourcedescriptions) { this.resourcedescriptions = resourcedescriptions; } @Override public String toString() { return String.valueOf(resourcedescriptions); } } The JSON properties prefixed with "tag_" need to be transformed into the Tag class, whereas the the property name represents the namespace and the value (single or array) represent the name. You can handle this case using @JsonAnySetter annotation. You have to add new method to ResourceDescription class which could look like this: @JsonAnySetter public void setAnyValues(String propertyName, Object value) { if (propertyName.startsWith("tag_")) { if (value instanceof String) { tags.add(new Tag(propertyName, value.toString())); } else if (value instanceof List) { List&lt;?&gt; values = (List&lt;?&gt;) value; for (Object v : values) { tags.add(new Tag(propertyName, v.toString())); } } // throw exception? } else { // handle another unknown properties } } Third the "lastmodified" should be transformed into DateTime from Joda-Time. You can handle JodaTime types by adding jackson-datatype-joda library. When you add it you can register JodaModule module. mapper.registerModule(new JodaModule()); Additional problem that your JSON contain properties written using lowercase, but your POJO properties are written using camel-case. You can change JSON or POJO or use @JsonProperty("property-name-from-JSON") annotation or implement your own naming strategy. For example: mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.PropertyNamingStrategyBase() { @Override public String translate…
has comment: http://stackoverflow.com/comment/37435495
type: Answer
answers question: http://stackoverflow.com/q/24202714
score: 2
upvote count: 2

http://stackoverflow.com/q/24224522
has title: Importing anything from "net" in eclipse
has comment: http://stackoverflow.com/comment/37408739
type: UnansweredQuestion
tagged with: package
has body: I am relatively new to java as a disclaimer. I see all kinds of code examples where people "import net...." yet anytime that I try to import anything from this directory, I get an error that the compiler cannot resolve the import net. What have these other programmers done that allows them to use this import? I have seen other people having this problem but I have not seen a straight-forward answer to this question. For instance: import net.sourceforge.binge.Xbox360Controller;
linked to: http://stackoverflow.com/q/4962559
has answer: http://stackoverflow.com/a/24224548
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1
tagged with: import
linked to: http://stackoverflow.com/q/8486403
favorite count: 0
type: Question

http://stackoverflow.com/a/24106819
type: Answer
score: 0
has body: You should do this : if (saveLogin == true) { name1 = loginPreferences.getString("username", ""); pass1 = loginPreferences.getString("password", ""); new myAsyncTask().execute(); } So when you have data in shared preferences you should login user by executing your AsyncTask
answers question: http://stackoverflow.com/q/24106739

http://stackoverflow.com/comment/68937738
has text: It does, but forgot the dynamic part.
type: Comment
comment on: http://stackoverflow.com/a/29214118
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37402886
score: 0
type: AnswerComment
has text: @Chala Yes, but you need to create another question about it.
type: Comment
comment on: http://stackoverflow.com/a/24221401

http://stackoverflow.com/comment/37521924
type: AnswerComment
score: 0
has text: I know that generics are a bit complicated. The best advice I can give is to look at the wildcard `?` as being a _subtype_ mechanism.
type: Comment
comment on: http://stackoverflow.com/a/24263591

http://stackoverflow.com/comment/95117082
type: AnswerComment
has text: Actually, turns out there is a direct API method; see https://stackoverflow.com/a/54141029/1965404
comment on: http://stackoverflow.com/a/24265205
score: 0
type: Comment

http://stackoverflow.com/comment/37442063
score: 0
has text: this works fine for me. It doesn't hang on my computer
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24241281

http://stackoverflow.com/q/24137865
has title: download box file in java
has body: when I download the file it always throw this Exception: org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 210846; received: 0 my code: String fileid=attachment.getBoxfileid(); String sha1=attachment.getSha1(); String filename=attachment.getFilename(); final String clientid=ToolsUtils.getBOXcomConfig().get(ToolsUtils.CLIENTID); final String clientsecret=ToolsUtils.getBOXcomConfig().get(ToolsUtils.CLIENTSECRET); BoxOAuthToken authToken=this.boxuploadService.getTokenByClientId(clientid); BoxClient boxClient=new BoxClient(clientid,clientsecret,null,null,new BoxConfigBuilder().build()); boxClient.authenticate(authToken); boxClient.addOAuthRefreshListener(new OAuthRefreshListener() { @Override public void onRefresh(IAuthData authData) { boxuploadService.updateBoxAccessToken(clientid,authData.getAccessToken(),authData.getRefreshToken()); } }); BoxDefaultRequestObject obj = new BoxDefaultRequestObject(); obj.getRequestExtras().setIfMatch(sha1); DownloadFileRequest downloadFileRequest=new DownloadFileRequest(new BoxConfigBuilder().build(), new BoxJSONParser(new BoxResourceHub()), fileid, obj); out = response.getOutputStream(); InputStream inputStream=boxClient.getFilesManager().downloadFile(fileid, obj); byte[] buffer = new byte[1024]; response.setContentType("application/octet-stream" ); response.setHeader( "Content-Disposition", "attachment; filename=\"" + filename + "\"" ); while((readCount = inputStream.read(buffer)) &gt; 0) { out.write(buffer, 0, readCount); } out.flush();
score: 2
tagged with: java
answer count: 1
tagged with: box-api
has answer: http://stackoverflow.com/a/27179419
favorite count: 0
type: Question
tagged with: download
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37278665
downvote count: 0

http://stackoverflow.com/q/24113350
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37230730
has comment: http://stackoverflow.com/comment/37201620
type: Question
has comment: http://stackoverflow.com/comment/37215693
has title: Deployed a JAXWS application shows up as blank page in tomcat
tagged with: java
tagged with: jax-ws
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37199433
has body: Deployed a JAXWS application in tomcat , but the service shows a blank page with no errors in tomcat. http://{localhost}:8080/SFOD-WS/storesurveytemplate // when i check for my service deployed , no erros with blank page. What could be the issue ? why is my deployed service not showing showing up??
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/37265733

http://stackoverflow.com/a/24185296
score: 0
has body: You could implement a dedicated method which will be able to handle this exception, e.g.: public enum TagEnum { EDIT_ACCESS("feature.edit") { @Override protected Boolean initFeatureStatus() { try { return GlobalAccess.getEditStatus(); } catch (Exception e) { // handle it there return null; } } }; private String key; private Boolean featureStatus; private TagEnum(String key) { this.key = key; this.featureStatus = initFeatureStatus(); } protected abstract Boolean initFeatureStatus(); }
type: Answer
answers question: http://stackoverflow.com/q/24185072

http://stackoverflow.com/comment/37427987
type: Comment
comment on: http://stackoverflow.com/a/24234209
score: 0
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/55676/discussion-between-javadg-and-mazzy).

http://stackoverflow.com/a/24198347
has comment: http://stackoverflow.com/comment/37359026
accepted answer of: http://stackoverflow.com/q/24198216
answers question: http://stackoverflow.com/q/24198216
type: Answer
has body: This might be a workaround. But it works! In your scheduler, have a default thread running every 1 minute (Or interval of your choice) that pings a file or DB for any changes. The scheduler should be refreshed if the scheduler finds an entry in the DB. From your JSP, on click of a button, create a relevant entry in the DB. While pinging the DB, if the scheduler finds an entry, then it will do the necessary action. Code snippet // Default constructor. public Scheduler()throws SchedulerException, Exception { try { SchedulerFactory sf = new StdSchedulerFactory(); sche = sf.getScheduler(); sche.start(); if(sche.isShutdown()) { SendAlerts.sendMsgToGroup("Scheduler Failed To Start at "+sdtf3.format(new Date())+" hrs.",defaultMsgGroup); logger.fatal("Scheduler Failed To Start At = " + sdtf1.format(new Date()) ); } else { SendAlerts.sendMsgToGroup("Scheduler started at "+sdtf3.format(new Date())+" hrs.",SchStartAlertGroup); logger.fatal("Scheduler Started At = " + sdtf1.format(new Date()) ); } sysdate = new Date(); readFromDBAndConfigureSchedules(); while (true) { if(sche.isShutdown()) { SendAlerts.sendMsgToGroup("Scheduler Failed To Start at "+sdtf3.format(new Date())+" hrs.",defaultMsgGroup); logger.fatal("Scheduler Failed To Start At = " + sdtf1.format(new Date()) ); } else { logger.info("Scheduler is Running. Table Last Pinged at : "+sdtf1.format(sysdate)); } /* ----------------- IN THE CHECK DB TABLE METHOD, HANDLE REQUESTS FOR STOP, PAUSE, RE-SCHEDULE ETC ------------------ */ SchRunJob.checkDBTable(); // Loop will repeat every 1 hour = 60 minutes * 60 seconds = 3600 seconds Thread.sleep (3600 * 1000); } // End of while Start Flag is Y } // End of try block catch (Exception e) { SendAlerts.sendMsgToGroup( "Fatal Exception Caught.Scheduler Shut Down at " + sdtf1.format(new Date()),defaultMsgGroup); logger.fatal("Fatal Exception Caught.Scheduler Shut Down at " + sdtf1.format(new Date())); e.printStackTrace(); System.exit(0); } } // End of default constructor**
has comment: http://stackoverflow.com/comment/37359195
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24117419
has body: You can use ant ant task instead which acts as if it is imporing supplied build file. Refer to : https://ant.apache.org/manual/Tasks/ant.html for more details. With ant you can provide default target to run as well. With this approach it will conditional evaluate and import file inside your 'build' target. &lt;if&gt; &lt;isset property="myresult"/&gt; &lt;then&gt; &lt;ant antfile="postgreswebtest.xml" /&gt; &lt;/then&gt; &lt;else&gt; &lt;ant antfile="mysqlwebtest.xml" /&gt; &lt;/else&gt; &lt;/if&gt;
answers question: http://stackoverflow.com/q/24114790
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/24260686
answers question: http://stackoverflow.com/q/24259358
has body: An answer which I think works for all cases.. public static void main(String[] args) { String s = "String String1"; System.out.println(s.matches("(?!((String|double)\\s+(String|double|\\d+|$)$))(.*)")); } O/P : String s = "String String1"; answer : true String s = "String String"; answer : false String s = "String 123"; answer : false String s = "String "; answer : false
type: Answer
score: 0

http://stackoverflow.com/comment/37259767
score: 0
comment on: http://stackoverflow.com/a/24145347
type: Comment
type: AnswerComment
has text: Some explanation should be welcomed for the questionner.

http://stackoverflow.com/a/24241113
answers question: http://stackoverflow.com/q/24241059
downvote count: 2
upvote count: 1
has body: You can add a line break to the string "\n" String locat = "london BLANCHE CAFE \nET COCKTAIL BAR"
type: Answer
score: -1

http://stackoverflow.com/a/24227198
has comment: http://stackoverflow.com/comment/37414019
downvote count: 0
has body: You can use the split method of the String class to separate your string using the delimiter which is a comma. example: String s = "stuff,things,this,that"; String [] s2 = s.split(","); System.out.println("1 list" + s2[0]); //result stuff System.out.println("2 list" + s2[1]); //result things System.out.println("3 list" + s2[2]); //result this System.out.println("4 list" + s2[3]); //result that getting the view reference in onCreate() TextView t = (TextView)findViewById(R.id.LocationFixed); //will get the textview from the layout t.setText("set The text"); //set the textview text
accepted answer of: http://stackoverflow.com/q/24227184
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37413915
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24227184
has comment: http://stackoverflow.com/comment/37413964
has comment: http://stackoverflow.com/comment/37413976
type: Answer

http://stackoverflow.com/q/24243747
type: AnsweredQuestion
upvote count: 19
answer count: 2
has comment: http://stackoverflow.com/comment/37445362
tagged with: java
has body: In this implementation of Quick Find algorithm, Constructor takes N steps so does union(). The instructor said that union is too expensive as it takes N^2 to process sequence of N union commands on N objects, How can union be quadratic when it accesses array elements one at a time? public class QuickFind { private int[] id; public QuickFind(int N) { id = new int[N]; for (int i=0; i&lt;N; i++) { id[i] = i; } } public boolean connected(int p, int q) { return id[p] == id[q]; } public void union(int p, int q) { int pid = id[p]; int qid = id[q]; for (int i=0; i&lt;id.length; i++) if (id[i] == pid) id[i] = qid; } }
has comment: http://stackoverflow.com/comment/106567066
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/24248758
type: Question
tagged with: algorithm
has title: How is union find quadratic algorithm?
score: 18
has answer: http://stackoverflow.com/a/24244212
accepted answer: http://stackoverflow.com/a/24244212
has answer: http://stackoverflow.com/a/24248758

http://stackoverflow.com/comment/37309823
has text: What does the [JavaMail debug output](http://www.oracle.com/technetwork/java/javamail/faq/index.html#debug) show? What you have above is mostly a correct MIME message, although I don't know where the first 4 lines came from; perhaps an editing error in your post?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24161769
type: QuestionComment

http://stackoverflow.com/q/24261430
answer count: 1
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/24261462
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24261462
has comment: http://stackoverflow.com/comment/37479153
tagged with: android
linked to: http://stackoverflow.com/q/409784
has title: How to use Array-list in String array?
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37479125
has comment: http://stackoverflow.com/comment/37478961
has body: I am creating an image-view from JSON URL where I am pushing the URL in a array-list. Here is the code. private class JSONParse extends AsyncTask&lt;String, String, JSONObject&gt; { private ProgressDialog pDialog; @Override protected void onPreExecute() { super.onPreExecute(); ver = (TextView) findViewById(R.id.vers); name = (TextView) findViewById(R.id.name); api = (TextView) findViewById(R.id.api); pDialog = new ProgressDialog(AnotherActivity.this); pDialog.setMessage("Getting Data ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected JSONObject doInBackground(String... args) { JSONParser jParser = new JSONParser(); // Getting JSON from URL JSONObject json = jParser.getJSONFromUrl(url); try { // Getting JSON Array from URL android = json.getJSONArray(TAG_OS); for (int i = 0; i &lt; android.length(); i++) { map = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); JSONObject c = android.getJSONObject(i); // Storing each json item in variable String flag = c.getString("flag"); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("url",flag); arraylist.add(i,"\"" + map.toString().substring(5).replace("}", "\"")); } final String[] imageUrl= arraylist.toArray(new String[arraylist.size()]); Log.v("url", "Creating view..." + imageUrl); } catch (JSONException e) { e.printStackTrace(); } return null; } } Now I want to use this array-list in a string array. String[] IMAGES = new String[]{ }; How can I do that?? When I tried something like this String[] imageUrl= arraylist.toArray(new String[arraylist.size()]); I got the the log as Creating view...[Ljava.lang.String;@41450ea0
tagged with: java

http://stackoverflow.com/q/24192785
type: Question
has answer: http://stackoverflow.com/a/24195625
tagged with: architecture
accepted answer: http://stackoverflow.com/a/24195625
has comment: http://stackoverflow.com/comment/37360557
has comment: http://stackoverflow.com/comment/37359852
has body: We're a defining an architecture for our company applications, so that architecture has to take care of integration with other applications/systems. The first thing that came our mind was to centralize all integration in an ESB (Mule), which would run in standalone mode. However new requirements appeared and the thing is that every application has to manage its own integration's (which are not defined yet, but they shouldn't be very complex). Now we´re evaluating using either Apache Camel or Mule but in an embedded scenario. Disusing about it with some mates, it isn't very clear to us which is the best (or more suitable) way to set up this architecture. At my opinion, as its responsibility of each application, I would integrate Camel directly in my application (as a library); but they say it´s a better option to deploy Camel in a separate project. These are the scenarios, as I see them: My application with Camel embedded. If my application has to invoke a web service, for example, I just code it and send it (From(...).to(...) etc) My application and another application with Camel embedded. If my application has to invoke a web service, and I want to manage all integration through Camel, I think I have to call the camel project (by JMS, or calling an interface it exposes), define a route in that project which says: when I read from X (the interface im calling) call this WS. I mean, it adds more complexity when I think it´s not needed. Probably I misunderstanding how Camel really works so I´ll be glad to hear what I´m wrong about ;)
type: AnsweredQuestion
tagged with: eai
downvote count: 0
upvote count: 1
score: 1
tagged with: java
has title: Best suitable architecture using Camel
answer count: 1
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/37355361
favorite count: 0

http://stackoverflow.com/comment/37247048
type: AnswerComment
comment on: http://stackoverflow.com/a/24137614
score: 0
type: Comment
has text: i need to access data as key value,but if i save data as map,data updating become difficult because i have to get map completely and update it,but for sub socument i can update value of subdocument field directly.

http://stackoverflow.com/comment/37185684
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24106024
type: QuestionComment
has text: I have this settings.json file inside the assets folder. Or where do you mean exactly? The thing is that I have the same code in another place in my code and there it works...

http://stackoverflow.com/comment/37262475
has text: Where do you assign `input`? Are you sure it's what you think it is?
comment on: http://stackoverflow.com/q/24147177
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/43284787
has text: But how do you get another RedirectUri where the user can re-authorize the app?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27126227
type: AnswerComment

http://stackoverflow.com/comment/37824530
comment on: http://stackoverflow.com/a/24266432
score: 0
type: Comment
type: AnswerComment
has text: @Ruud Ohk, I will wait for your reply.

http://stackoverflow.com/q/24131928
has answer: http://stackoverflow.com/a/24132261
tagged with: transactions
score: 0
tagged with: java
answer count: 1
has body: I'm using Spring 3.2.4 with JavaFX and wanted to implement a method, where the operations will be performed in a transaction. My code in the controller looks like this: @Transactional(rollbackFor = { ServiceException.class, ValidationException.class }) public void registerVolunteer(User user, Volunteer volunteer) throws ServiceException, ValidationException { User ret = userService.create(user); volunteer.setUser(ret); volunteerService.untransactedCreate(volunteer); } And my application-context: &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/&gt; &lt;!-- Transaction Manager --&gt; &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; Trying to run this, I get this error message: Controller method "onBackClicked" not found. /home/workspace/project/NewProject/target/classes/fxml/RegisterVolunteer.fxml:69 at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:497) at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:594) at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2472) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2177) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2069) at org.impactvolunteers.management.FXMLSpringLoader.load(FXMLSpringLoader.java:97) at org.impactvolunteers.management.FXMLSpringLoader.load(FXMLSpringLoader.java:81) at org.impactvolunteers.management.gui.Screen.init(Screen.java:50) at org.impactvolunteers.management.gui.ScreensController.init(ScreensController.java:43) 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) ... The method exists. With either removing the annotation, or changing the …
type: Question
has title: Spring transaction annotation not working
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37234590
has comment: http://stackoverflow.com/comment/37234426
tagged with: spring
tagged with: spring-transactions

http://stackoverflow.com/q/24175159
upvote count: 2
has comment: http://stackoverflow.com/comment/37315465
has comment: http://stackoverflow.com/comment/37315410
has comment: http://stackoverflow.com/comment/37315730
answer count: 1
has comment: http://stackoverflow.com/comment/37315722
has comment: http://stackoverflow.com/comment/37315545
has comment: http://stackoverflow.com/comment/37315721
has comment: http://stackoverflow.com/comment/37315621
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37315264
score: 1
has comment: http://stackoverflow.com/comment/37315601
tagged with: java
accepted answer: http://stackoverflow.com/a/24175543
has comment: http://stackoverflow.com/comment/37315491
has body: I am working on building a simplified version of this game. The problem states that you can have a computer that is smart or stupid but i have decided that to exclude that feature for now and decided to only go with a computer that picks a random amount of objects. I posted a question earlier and worked on it. (https://softwareengineering.stackexchange.com/questions/244680/object-oriented-design-of-a-small-java-game/244683#244683) So initially i only had designed one class. But now i have designed 3 classes as stated by the problem. I have a pile class , a player class and a game class (also my main class). I have so far coded the Pile and Player class. I started coding the Game class aswell however i am stuck now as i dont know how to make the game class interact with the Player and Pile class. I basically determine who's turn it is first and then rotate turns till the pile of objects is complete and declare a winner...I don't know how to make the different classes interact with each other . SO i would highly appreciate if someone can guide me further and help me finish this simple game. I sincerely apologize if i have asked a bad question. This is my first such program i am doing in java dealing with multiple classes so it is a little confusing. I do not want anyone write code but even mentioning or telling me i should make so and so methods etc will be great ! HERE IS THE CODE I HAVE SO FAR. PILE CLASS package Nim; import java.util.Random; public class Pile { private int initialSize; public Pile() { } Random rand = new Random(); public void setPile() { initialSize = (rand.nextInt(100 - 10) + 10); } public void reducePile(int x) { initialSize = initialSize - x; } public int getPile() { return initialSize; } public boolean hasStick() { if (initialSize &gt; 0) { return true; } else { return false; } } } PLAYER CLASS package Nim; import java.util.Scanner; import java.util.Random; public class Player { public static final int HUMAN = 0; public static final int COMPUTE…
has answer: http://stackoverflow.com/a/24175543
downvote count: 1
favorite count: 0
has title: Object Oriented Approach for a simple game
type: Question
has comment: http://stackoverflow.com/comment/37315255

http://stackoverflow.com/comment/37393229
comment on: http://stackoverflow.com/a/24212080
score: 0
type: AnswerComment
has text: yea and i dont know how to do it so i posted this...
type: Comment

http://stackoverflow.com/a/24231305
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24231223
type: Answer
score: 23
answers question: http://stackoverflow.com/q/24231223
has body: use jackson library //create ObjectMapper instance ObjectMapper objectMapper = new ObjectMapper(); //convert json string to object Employee emp = objectMapper.readValue(jsonData, Employee.class);
type: AcceptedAnswer
upvote count: 23
has comment: http://stackoverflow.com/comment/65780430
has comment: http://stackoverflow.com/comment/108675125

http://stackoverflow.com/q/24106058
score: 1
has answer: http://stackoverflow.com/a/24106094
upvote count: 1
has comment: http://stackoverflow.com/comment/37185649
has comment: http://stackoverflow.com/comment/37185758
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24106094
answer count: 2
tagged with: regex
has title: Splitting suit from card
accepted answer: http://stackoverflow.com/a/24106093
has body: So basically I have to split the card from the suit, my code is almost working, but always the last suit doesn't split from the card. My code so far: String userInput = input.nextLine(); String[] allCards = userInput.split("[SHDC](\\s+|$)"); So lets say the input is: 2H 3D 5C KS KH The output is: 2 3 5 K KH I'm stuck, please help.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24106093
downvote count: 0

http://stackoverflow.com/comment/37406261
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24223172
has text: From posters who think you shouldn't answer the question because it was too simple to ask. Ignore it and move on.
score: 1

http://stackoverflow.com/comment/37343379
comment on: http://stackoverflow.com/a/24188679
score: 0
type: Comment
has text: i tried this code!! still the same problem occurs!! The problem might nt be in the code! i tried installing the JDK again! doesnt seem to work
type: AnswerComment

http://stackoverflow.com/a/32136289
downvote count: 1
has body: Open command prompt go inside the maven folder and execute mvn -version, it will show you maven vesrion al
score: 0
answers question: http://stackoverflow.com/q/24221361
type: Answer
upvote count: 1

http://stackoverflow.com/a/24231972
answers question: http://stackoverflow.com/q/24231198
has comment: http://stackoverflow.com/comment/37423208
has comment: http://stackoverflow.com/comment/37423112
accepted answer of: http://stackoverflow.com/q/24231198
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37423219
has comment: http://stackoverflow.com/comment/37423094
has comment: http://stackoverflow.com/comment/37423300
has body: Change public class Game1 extends ApplicationAdapter { to public class Game1 extends Game { Create an instance of OptionScreen in Game: public OptionScreen game_screen; public void create() { FarmerAsset.load(); game_screen = new OptionScreen(this); setScreen(game_screen); } And it should be good to go.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37423687
downvote count: 0
has comment: http://stackoverflow.com/comment/37423060
has comment: http://stackoverflow.com/comment/37423779
upvote count: 1
has comment: http://stackoverflow.com/comment/37423271

http://stackoverflow.com/a/24173496
answers question: http://stackoverflow.com/q/24173463
has comment: http://stackoverflow.com/comment/37319211
type: Answer
has comment: http://stackoverflow.com/comment/37333815
upvote count: 47
has comment: http://stackoverflow.com/comment/37374614
has comment: http://stackoverflow.com/comment/37325566
downvote count: 1
score: 46
has comment: http://stackoverflow.com/comment/37326675
has body: No, it does not print only zeros. Change it to this and you will see what happens. int k = 50; while (true){ i = i + i; System.out.println(i); k--; if (k&lt;0) break; } What happens is called overflow.

http://stackoverflow.com/a/24200586
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37365094
has body: I think you are referring to ClassPath, as classes are present in ClassPath(even jars are the part of classpath). Moreover I am not really sure about the question, if the classes are not there in your classpath, spring will give exception while trying to resolve those dependencies. However if you want to know the location where this class is defined that too in eclipse, just press control and click on the class. It should tell you from where eclipse is picking up this class file. I hope that my understanding of the question is right and hence the answer is pretty close to what you were looking for.
has comment: http://stackoverflow.com/comment/37366070
type: Answer
answers question: http://stackoverflow.com/q/24200346
score: 1

http://stackoverflow.com/comment/39540661
type: AnswerComment
has text: I don't remember exactly, but there might be something in the examples package. The documentation was also very useful.
comment on: http://stackoverflow.com/a/24187086
type: Comment
score: 0

plugins
tags question: http://stackoverflow.com/q/24205890
tags question: http://stackoverflow.com/q/24217780
tag name: plugins
tags question: http://stackoverflow.com/q/24171272
tags question: http://stackoverflow.com/q/24195142
tags question: http://stackoverflow.com/q/24170257
tags question: http://stackoverflow.com/q/24106508
type: Tag

http://stackoverflow.com/q/24135842
has answer: http://stackoverflow.com/a/24136149
has title: Creating Android Library Project
tagged with: android
possible better answer: http://stackoverflow.com/a/24135907
upvote count: 1
has answer: http://stackoverflow.com/a/24135907
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24135955
answer count: 3
has body: I am following a tutorial here I can't get how to do the "use Vitamio as Android library project" . How can I use it as an Android library project?
score: 0
tagged with: java
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24135955
type: Question

http://stackoverflow.com/comment/37450797
comment on: http://stackoverflow.com/q/24246391
score: 0
has text: Did you try to write a single dot at and of message like you would have done if using mailx directly ?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24261848
has comment: http://stackoverflow.com/comment/37483099
answers question: http://stackoverflow.com/q/24261719
score: 0
has comment: http://stackoverflow.com/comment/37482254
has body: Put Bicycle class and MountainBike class in the same package, mountainbike package maybe. Or import the package of Bicycle class on the file that defines the MountainBike class. package mountainbike; import bicycle.*; //or import bicycle.Bicycle; public class MountainBike extends Bicycle { public static void main(String[] args) { // TODO code application logic here } } Check also the folder structure. Bicycle class should be in 'bicycle' folder, that corresponds to the bicycle package and MountainBike class should be in 'mountainbike' folder, that corresponds to the 'mountainbike' package. Your project structure should be the similar.
type: Answer
has comment: http://stackoverflow.com/comment/37483685
has comment: http://stackoverflow.com/comment/37485861
has comment: http://stackoverflow.com/comment/37480709
has comment: http://stackoverflow.com/comment/37480336
has comment: http://stackoverflow.com/comment/37483183

http://stackoverflow.com/comment/37307532
has text: Yep, this is a real-world example or I wouldn't be trying to solve for it. The problem is carelessly truncated text fields coming from a vendor (e.g. a 45 character field truncated to 40 characters, chopping off the closing double quote without replacing it).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24170875

http://stackoverflow.com/comment/37487376
score: 0
has text: Did you override the source directory property or is it a standard Maven tree? (Like src/main/java/...)
type: Comment
comment on: http://stackoverflow.com/q/24265427
type: QuestionComment

http://stackoverflow.com/a/24106491
score: 15
upvote count: 15
has body: Please check that the tools.jar used by Ant is from JDK8 and not JDK7. Window -> Preferences: In the left pane, go to Ant -> Runtime. In the Classpath tab, check the Global Entries.
answers question: http://stackoverflow.com/q/24106371
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24106371

http://stackoverflow.com/a/24194644
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/24194188
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/37352029
has body: You can do this if you compile AClass and BClass separately. I.e. compile AClass with the full version of the interface, then modify the interface (remove the methods) and compile BClass with this modified version of the interface. P.S. By no means this is a painless approach.

http://stackoverflow.com/q/24225391
type: AnsweredQuestion
has title: How to design regex pattern for number?
has comment: http://stackoverflow.com/comment/37410493
answer count: 2
has body: I am working on regex pattern to validate input, but I am not sure how to include () and - symbols. Description: The input string doesn't have to be filled out. If its filled out it needs to have exactly 5 numbers and input can't start with 26. Also, input needs to accept parenthesis and dash and they can be placed in any part of the input. I accept max 10 characters Tried: (^(?!26)((\d){5}))? Works only for: - empty input - exactly ten digit number for example 0123456789 - also it rejects if you have 26 at the beginning, for example 2651234567 Also, tried to include - and () but this pattern doesn't work at all (^(?!26)(\-\(\))((\d){5}))? Valid inputs: (12345)-- ---12)567) 12333 -1-2--3-45 (()))12345 ((12345 (-)65768- (4)1-2-35 Invalid inputs: 26123--- (26)897--- -26333---- 26 26(((()) 26------ 26--345 26)88-76 267-9 I found discussion A comprehensive regex for phone number validation and it helped but I still can't match exactly my entry.
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/123559
downvote count: 0
accepted answer: http://stackoverflow.com/a/24225540
has answer: http://stackoverflow.com/a/24225806
has answer: http://stackoverflow.com/a/24225540
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37410513
has comment: http://stackoverflow.com/comment/37410949
has comment: http://stackoverflow.com/comment/37411214
possible better answer: http://stackoverflow.com/a/24225806
has comment: http://stackoverflow.com/comment/37411095
has comment: http://stackoverflow.com/comment/37410445
upvote count: 1
tagged with: regex

http://stackoverflow.com/q/24154808
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24155047
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24154839
has answer: http://stackoverflow.com/a/24155152
type: Question
has body: I have been trying to change the position of my JButton in the action listener. However, when I compiled my code Local variable is accessed from within inner class: needs to be declared final error was displayed. Therefore, I declared my location variable as final. The problem is that I need to change the value of my location variable and that is not possible as long as its final. How do I solve this? Code: final int location =100; JFrame f = new JFrame(); final JButton b1 = new JButton("character"); f.setVisible(true); f.setSize(500,500); f.setDefaultCloseOperation(EXIT_ON_CLOSE); f.setLocationRelativeTo(null); f.setLayout( new FlowLayout()); f.add(b1); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { b1.setLocation(location,100); location += 10; // cannot assign a value to final variable location } });
tagged with: actionlistener
possible better answer: http://stackoverflow.com/a/24154839
answer count: 5
has answer: http://stackoverflow.com/a/24155057
tagged with: final
has comment: http://stackoverflow.com/comment/37277087
has answer: http://stackoverflow.com/a/24155106
accepted answer: http://stackoverflow.com/a/24155152
tagged with: swing
has title: Change value of a local variable that needs to be declared final
tagged with: jbutton

http://stackoverflow.com/comment/37209577
comment on: http://stackoverflow.com/a/24114495
score: 0
type: Comment
type: AnswerComment
has text: ViewGroup = (ViewGroup)findViewById(R.id.equiptypetext); ViewGroup group2 = (ViewGroup)findViewById(R.id.equipidtext); clearText(group1); clearText(group2); }

option-type
tags question: http://stackoverflow.com/q/24228279
tags question: http://stackoverflow.com/q/24254209
tag name: option-type
type: Tag

http://stackoverflow.com/a/24127451
has body: A. Where is the Error? The problem is not -*. The problem is that in a [character class], the hyphen - has special meaning. For instance, in [a-z], it means all characters ranging from a to z. Therefore, when you have +-* in your character class, we are looking for characters ranging from + (ASCII 43) to * (ASCII 42). Not valid, hence the error. Technically, as @Pshemo writes in a comment, Java doesn't use indexes of characters based on ASCII but based on Unicode Table. But since the 128 first ASCII character points are the same in Unicode, the result is the same. You need to either escape the hyphen like so \- or, as you have observed, throw the - at the front (or back) of your class, where it does not indicate a character range: [-+*/] Therefore, in a split (using the "at the back" version for variety): String[] result = your_original_string.split("[+*/-]"); B. But [*-+] would be valid!!! (ASCII 42 to 43) If you reverse the + and the *, you have a valid ASCII range (42 to 43). Of course there's no point doing so, since (i) there are no characters in the middle and (ii) that would confuse my dog. C. Does -* have special meaning? It does, but not in a character class. Outside a character class, that means match a hyphen, zero or more times.
has comment: http://stackoverflow.com/comment/37226284
has comment: http://stackoverflow.com/comment/37227981
has comment: http://stackoverflow.com/comment/37229298
accepted answer of: http://stackoverflow.com/q/24127405
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37229338
upvote count: 17
answers question: http://stackoverflow.com/q/24127405
has comment: http://stackoverflow.com/comment/37226264
type: Answer
has comment: http://stackoverflow.com/comment/37226172
has comment: http://stackoverflow.com/comment/37226154
has comment: http://stackoverflow.com/comment/37225950
has comment: http://stackoverflow.com/comment/37227475
score: 17

http://stackoverflow.com/comment/37205678
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24116813
has text: @jesper I wanted to use the sort function. Since I can use descending sort only with objects, I tend to use Integer even when I don't require descending sort
score: 0

netbeans
tags question: http://stackoverflow.com/q/24154194
tags question: http://stackoverflow.com/q/24263479
tags question: http://stackoverflow.com/q/24184026
tags question: http://stackoverflow.com/q/24231925
tags question: http://stackoverflow.com/q/24218077
tags question: http://stackoverflow.com/q/24223780
tags question: http://stackoverflow.com/q/24248853
tags question: http://stackoverflow.com/q/24235289
tags question: http://stackoverflow.com/q/24198011
tags question: http://stackoverflow.com/q/24159456
tags question: http://stackoverflow.com/q/24264490
tags question: http://stackoverflow.com/q/24194221
tags question: http://stackoverflow.com/q/24154505
tags question: http://stackoverflow.com/q/24249093
tags question: http://stackoverflow.com/q/24265004
tags question: http://stackoverflow.com/q/24128965
tags question: http://stackoverflow.com/q/24108844
tags question: http://stackoverflow.com/q/24210134
tags question: http://stackoverflow.com/q/24233274
tags question: http://stackoverflow.com/q/24222589
tags question: http://stackoverflow.com/q/24261429
tags question: http://stackoverflow.com/q/24240340
tags question: http://stackoverflow.com/q/24259160
tags question: http://stackoverflow.com/q/24217136
tags question: http://stackoverflow.com/q/24263941
tags question: http://stackoverflow.com/q/24123764
tags question: http://stackoverflow.com/q/24206506
tags question: http://stackoverflow.com/q/24152120
tags question: http://stackoverflow.com/q/24154923
tags question: http://stackoverflow.com/q/24214102
type: Tag
tag name: netbeans
tags question: http://stackoverflow.com/q/24174219
tags question: http://stackoverflow.com/q/24160582
tags question: http://stackoverflow.com/q/24203277
tags question: http://stackoverflow.com/q/24206413
tags question: http://stackoverflow.com/q/24178037
tags question: http://stackoverflow.com/q/24109183
tags question: http://stackoverflow.com/q/24205858
tags question: http://stackoverflow.com/q/24125956
tags question: http://stackoverflow.com/q/24113321
tags question: http://stackoverflow.com/q/24182550
tags question: http://stackoverflow.com/q/24232462
tags question: http://stackoverflow.com/q/24246857
tags question: http://stackoverflow.com/q/24106319
tags question: http://stackoverflow.com/q/24126177
tags question: http://stackoverflow.com/q/24123617
tags question: http://stackoverflow.com/q/24243381
tags question: http://stackoverflow.com/q/24177138

http://stackoverflow.com/q/24145374
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24146301
has answer: http://stackoverflow.com/a/24146301
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37259085
score: 0
tagged with: java
tagged with: authentication
type: Question
has title: Getting session variable in JSP page using Login Form Authentication provided by Jave EE
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37259957
has body: I'm following this guide Securing web application in order to create login form authentication in my web app. Unfortunately something don't satisfy me. I'm looking for a variable that I could use in a jsp page that say the user is logged on or not. for istance &lt;c:if test=${userIsLogged}&gt; &lt;/c:if Does exist a way to get a variable linked to the session?
tagged with: session
answer count: 1

http://stackoverflow.com/q/24215501
has comment: http://stackoverflow.com/comment/37393481
has comment: http://stackoverflow.com/comment/37392363
tagged with: java
has comment: http://stackoverflow.com/comment/37392063
has comment: http://stackoverflow.com/comment/37392004
has title: Abstract test method error when printing arraylist
has answer: http://stackoverflow.com/a/24215717
has answer: http://stackoverflow.com/a/24215532
downvote count: 1
score: -1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37392128
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37392228
has comment: http://stackoverflow.com/comment/37392055
has body: I have created an Employee class used to figure by weekly pay as an abstract. I have then created 2 subclasses for Salary and Hourly employees. The issue I have is in my test class not printing out the array list and then retrieving the correct bi weekly pay. Was hopping another set of eyes could help. /** Employee class with abstract method*/ public abstract class Employee { public String fullName; /** construct a default employee object*/ public Employee() { } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } /** abstract method getBIWeeklyPay */ public abstract double getBiWeeklyPay(); public void printgetBiWeeklPay() { System.out.println("Employee "+this.fullName+ "'s"+ "Bi-weekly pay is:"); } } /**Salary Class*/ public class SalaryEmployee extends Employee { public SalaryEmployee() { } public double salary; public double getBiWeeklyPay() { return salary/(52*2) ; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } } /** Hourly Class*/ public class HourlyEmployee extends Employee { public double hourlyRate; public double hoursPerWeek; public HourlyEmployee() { } public double getBiWeeklyPay() { return hourlyRate * (hoursPerWeek *2); } public double getHourlyRate() { return hourlyRate; } public void setHourlyRate(double hourlyRate) { this.hourlyRate = hourlyRate; } public double getHoursPerWeek() { return hoursPerWeek; } public void setHoursPerWeek(double hoursPerWeek) { this.hoursPerWeek = hoursPerWeek; } } /**Test Class*/ import java.util.*; public class EmployeeTest { public static void main(String[] args){ ArrayList&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(); SalaryEmployee mike = new SalaryEmployee(); mike.setFullName("Mike Burns"); mike.setSalary(75000.00); employees.add(mike); HourlyEmployee tim = new HourlyEmployee(); tim.setFullName("Tim Globe"); tim.setHourlyRate(12.00); tim.setHoursPerWeek(40.00); employees.add…
has comment: http://stackoverflow.com/comment/37392022
has comment: http://stackoverflow.com/comment/37392318
has comment: http://stackoverflow.com/comment/37392064
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37392070
has comment: http://stackoverflow.com/comment/37392047
answer count: 2
has comment: http://stackoverflow.com/comment/37392290
tagged with: abstract

http://stackoverflow.com/comment/37418147
score: 0
comment on: http://stackoverflow.com/q/24229106
type: QuestionComment
has text: When you send `.class` file do you send its full-package-name? Do you store it in `foo/bar/YourClass.class` structure inside directory from your classpath so classloader could find it? Can we see code which handles writing send class?
type: Comment

http://stackoverflow.com/a/24163497
has body: To fix your regular expression, make it TOKEN: { &lt;QUOTED: "\"" ( "\\" ~[] //any escaped character | //or ~["\"","\\"] //any character except quote or backslash )* "\"" &gt; }
has comment: http://stackoverflow.com/comment/92027082
type: Answer
upvote count: 16
type: AcceptedAnswer
downvote count: 0
score: 16
answers question: http://stackoverflow.com/q/24156948
has comment: http://stackoverflow.com/comment/37294631
accepted answer of: http://stackoverflow.com/q/24156948

http://stackoverflow.com/q/24154615
type: Question
answer count: 2
has body: I am trying to create a new table with Derby (SQL?) and I keep getting an error claiming that the table name is not a column name in my table. Column 'CAR' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'CAR' is not a column in the target table. This happens whenever I try to run this code: private static final String DERBY_DRIVER = "org.apache.derby.jdbc.EmbeddedDriver"; public static final String JDBC_DERBYURL = "jdbc:derby:cars;create=true"; public CreateInventoryDB(){ try { createDB(); } catch (ClassNotFoundException e) { System.out.println("ClassNotFoundException: " + e); } catch (SQLException e) { System.out.println("SQLException: " + e.printStackTrace()); } } private void createDB() throws ClassNotFoundException, SQLException{ Class.forName(DERBY_DRIVER); Connection connection = DriverManager.getConnection(JDBC_DERBYURL); connection.createStatement().execute( "create table cars(itemid int, type varchar(10), make varchar(10), " + "model varchar(15), caryear int, startinventory varchar(10), " + "datesold varchar(10), dealercost int, sellingprice int, doorwheels int)"); connection.createStatement().execute("insert into cars values " + "(1, car, Ford, Crown_Victoria, 2010, 7/3/2012, 7/23/2012, 8900, 14000, 4),"+ //etc. } I'm assuming it has something to do with the insert into cars values, as that is the only place where I am actually putting information into the table, but I can't find any other way to do this after searching around.
accepted answer: http://stackoverflow.com/a/24154639
has comment: http://stackoverflow.com/comment/37276888
has answer: http://stackoverflow.com/a/24154662
upvote count: 1
has answer: http://stackoverflow.com/a/24154639
tagged with: derby
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24154662
has title: Error message claiming my table name is actually a column in Java Derby (SQL)
tagged with: sql
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37290715
favorite count: 0

http://stackoverflow.com/q/24121255
upvote count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/49702564
has comment: http://stackoverflow.com/comment/37214226
has answer: http://stackoverflow.com/a/24121561
favorite count: 0
score: 1
tagged with: java
has body: I've been working on a really simple mp3 player in java for some weeks now and I'm wondering if I can do playlist with a BufferedReader and BufferedWriter method. For example with JFileChooser I'd choose song and store its path to file (for example "playlist.txt") and then in while loop (BufferedReader.available()) I'd read path and play it. Is this possible? Or Is it better to set chooser.setMultiSelectionEnabled() to true and work in this direction?
has title: Playlists for mp3 files in Java using BufferedReader & BufferedWriter
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/37214108
tagged with: http://stackoverflow.com/tag/mp3
tagged with: playlist
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/a/33832025
has body: I read through the answers and they explain why it doesn't work but I didn't notice any offers for how to solve it. I solved it in my situation by making the method a generic method. public main(){ Map&lt;String, List&lt;Integer&gt;&gt; stuff = service.buildStuff(); consumeStuff(stuff); } private &lt;T extends Number&gt; consumeStuff(Map&lt;String, List&lt;T&gt;&gt; stuff){ ... } So the method consumeStuff() expects the 2nd type of the map to be a List which has a type of something that extends Number (so Integer or Double). By having a map (the var stuff inside main()) with the explicit type of Integer for the List means that Java can infer the type when calling the generic method consumeStuff(). Inside consumeStuff we can treat the contents of the inner list as a number. We can dig into it, grab a value from the list and pass it to a method/constructor that accepts type Number.
type: Answer
answers question: http://stackoverflow.com/q/24262426
score: 0

http://stackoverflow.com/a/24169226
answers question: http://stackoverflow.com/q/24168012
score: 0
type: Answer
has body: You can use a virtual column in 11g. First, create a basic function that will generate an md5 hash based on the fields you believe should determine your identifier: create or replace function get_naddr_hash(i_string in varchar2, i_uppercase in number default 0) return varchar2 deterministic as l_string varchar2(32767); begin l_string := substr(i_string, 1, 32767); if (i_uppercase &gt; 0) then l_string := upper(l_string); end if; return rawtohex( DBMS_CRYPTO.Hash ( UTL_I18N.STRING_TO_RAW (l_string, 'AL32UTF8'), 2) ); end; Note that this function requires that dbms_crypto is already setup on the db. Then create (or recreate via ctas) the table with a virtual column using this function: create table tst_tab ( naddr_hash as (get_naddr_hash(trim(username)||trim(address1)||trim(city)||trim(state), 1)), username varchar2(100) not null, address1 varchar2(100) not null, address2 varchar2(100), city varchar2(100) not null, state varchar2(2) not null, zip varchar2(9), phone varchar2(20) ); Here I think that username, address1, city, state will be the determining fields. After this setup, you should be good to go. insert into tst_tab ( username, address1, address2, city, state, zip, phone ) values ( 'Joe Smith', '123 Main St', 'Ste 100', 'Denver', 'CO', '12345', '5551212' ); insert into tst_tab ( username, address1, address2, city, state ) values ( 'JOE SMITH', '123 Main St', 'Ste 101', 'Denver', 'CO' ); These 2 will have the same naddr_hash. The following will have a different hash: insert into tst_tab ( username, address1, address2, city, state ) values ( 'JANE SMITH', '123 Main St', 'Ste 101', 'Denver', 'CO' ); Looking at the data: NADDR_HASH USERNAME 2ADCBCAC3A26ED5BD189351B84BFA412 Joe Smith 2ADCBCAC3A26ED5BD189351B84BFA412 JOE SMITH C56D5007C89284892FDF03A96C5E15E0 JANE SMITH

http://stackoverflow.com/comment/37199159
has text: I suppose it's a loop, why not just do nothing.
comment on: http://stackoverflow.com/q/24113021
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24242543
upvote count: 0
has comment: http://stackoverflow.com/comment/37457973
answer count: 1
tagged with: variables
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/37443069
tagged with: private
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24242570
has comment: http://stackoverflow.com/comment/37443161
has answer: http://stackoverflow.com/a/24242570
has body: I have a boolean variable, which is false. I would like to change that to true. start.java class start{ static boolean click; public static void main(String[] args) { second class1 = new second(); System.out.println(class1.click); } } second.java public class second{ public boolean click; public void main2(){ click = true; } }
tagged with: java
downvote count: 6
type: Question
tagged with: boolean
has title: Java - Change a variable's value in methods?

http://stackoverflow.com/a/24169996
type: Answer
score: 0
has body: Don't use a KeyListener. Instead use Key Bindings. See Motion Using the Keyboared for more information about the two approaches including working examples of both approaches. The examples use a JLabel to display the image. if (key == 97) Also, don't use "magic numbers". Nobody know what "97" means. Use the fields defined in the API: if (key == KeyEvent.VK_???)
answers question: http://stackoverflow.com/q/24169906
has comment: http://stackoverflow.com/comment/37411116

http://stackoverflow.com/comment/37429233
has text: @GeorgeNetu Edited. I wrote it to Doug Crockford's [JSON-java library](https://github.com/douglascrockford/JSON-java), next time please specify which library you're using.
type: Comment
comment on: http://stackoverflow.com/a/24226427
type: AnswerComment
score: 0

http://stackoverflow.com/a/24226848
answers question: http://stackoverflow.com/q/24226634
score: 1
upvote count: 1
has body: Due to network latency you may need a short delay to wait for the first message to arrive on the queue. Try poll(time, unit) instead. This will wait for the specified time for a message to appear on the queue. If nothing is there it will return a null like poll() is now. A user will probably not notice a 500ms to 1s delay if no message is available.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24226634

http://stackoverflow.com/comment/37284323
has text: I mean, it is not a property conflict, but it is a column name conflict. I edited the title, sorry.
comment on: http://stackoverflow.com/a/24158574
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/43879025
type: Answer
has comment: http://stackoverflow.com/comment/74795160
has comment: http://stackoverflow.com/comment/74798267
answers question: http://stackoverflow.com/q/24177516
has body: Or Just do some simple math. Since Calender.Monday equals 2, it is easy to calculate the number of days that need to be added to the current date. Calendar date1 = Calendar.getInstance(); date1.set(2014, 05, 12); int dayOfWeek = date1.get(Calendar.DAY_OF_WEEK); date1.add(Calendar.DATE, (9 - dayOfWeek) % 7);
has comment: http://stackoverflow.com/comment/74801782
has comment: http://stackoverflow.com/comment/74793496
score: 0

http://stackoverflow.com/a/24261850
accepted answer of: http://stackoverflow.com/q/24261765
has body: by using eclipse IDE you can change the VM argument double click on the server &gt; open Lunch Configuration &gt; Arguments &gt; VM Arguments and append below two lines in your VM Arguments field -Xms256m -Xmx1024m -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote -XX:PermSize=256m -XX:MaxPermSize=512m it will sure solve your problem
answers question: http://stackoverflow.com/q/24261765
has comment: http://stackoverflow.com/comment/37480331
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37480120
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24118574
favorite count: 0
type: Question
has title: In which cases should one override onDestroy()?
type: UnansweredQuestion
tagged with: android
tagged with: activity-lifecycle
has body: I'm reading up on the activity lifecycle, and reading the documentation on starting and destroying activities, at the follow link: http://developer.android.com/training/basics/activity-lifecycle/starting.html The following text is from the link: Destroy the Activity While the activity's first lifecycle callback is onCreate(), its very last callback is onDestroy(). The system calls this method on your activity as the final signal that your activity instance is being completely removed from the system memory. Most apps don't need to implement this method because local class references are destroyed with the activity and your activity should perform most cleanup during onPause() and onStop(). However, if your activity includes background threads that you created during onCreate() or other long-running resources that could potentially leak memory if not properly closed, you should kill them during onDestroy(). Can someone give an example(or examples) of background threads or "other long-running resources" that would warrant an onDestroy() override, and explain how they avoid the regular onDestroy() cleanup? Clarification: I understand how onPause(), onStop() and onDestroy() work, that's not what I'm asking about. I'm asking for a more in-depth clarification of what would warrant overriding onDestroy()
answer count: 2
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24118646
upvote count: 1
tagged with: android-activity
has answer: http://stackoverflow.com/a/24118734

http://stackoverflow.com/a/24229511
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24229106
accepted answer of: http://stackoverflow.com/q/24229106
type: Answer
has body: Since you didn't post any code I am not sure if this is actually your problem but here it goes. Information about package is also written in class file. I base this assumption on fact that there is reflective method getPackage() which returns package. Example System.out.println(String.class.getPackage().getName()); will print java.laang. To be able to load send class you will have to use its full-package-name, in other words Class.forName("foo.bar.YourClass") and class ClassLoader will try to search for YourClass.class file inside directories representing package so this structure must be placed inside ([...] represents directory) [foo] | +-[bar] | +-YourClass.class structure (foo directory must be placed inside directory specified in classpath). So create some directory in your project for such package structures and add it to your class path. Also don't forget to not only send name of file but instead full-package-name.
score: 0

http://stackoverflow.com/a/24237017
accepted answer of: http://stackoverflow.com/q/24236993
has body: Both are same question. If it is possible, we may end up with famous Diamond death problem. The reason that Java's creators chose not to allow multiple inheritance is that it can become quite messy. In a nutshell, the problem is that if a class extended two other classes, and both superclasses had, say, a doStuff() method, which version of doStuff() would the subclass inherit?This issue can lead to a scenario known as the "Deadly Diamond of Death," Because of the shape of the class diagram that can be created in a multiple inheritance design. The diamond is formed when classes B and C both extend A, and both B and C inherit a method from A. If class D extends both B and C, and both B and C have overridden the method in A, class D has, in theory, inherited two different implementations of the same method. Drawn as a class diagram, the shape of the four classes looks like a diamond." So in Java for simplicity, you have one and only one base class. Searching for the base class is a linear search from top to bottom, simple, fast and efficient. But multiple inheritance is useful, it's conceivable that the same class may want to represent itself differently to different clients. That is done by using interfaces. An interface is just like a base class, but carries no data and no methods. When you implement an interface you have to supply all the members it needs, which is simple to understand. When the computer casts to the interface all it needs to do is start from the type object and search upwards through the base classes looking for one that implements the interface. Interfaces do 95% of the work multiple inheritance for 10% of the brain space and 15% of the CPU space. The 5% that interfaces can't do that multiple inheritance can may be simply implemented by composition. That is why its not supported.
score: 2
answers question: http://stackoverflow.com/q/24236993
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37323777
score: 0
has text: @mKorbel I just have a personal issue with using `toString` for the purpose of displaying viewable data and prefer to use a render as it resolves me of the issues where `toString` might change or I want to display the content differently, that's just me. I won't downvote a person for suggesting it...just have my little rant ;)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24179827

http://stackoverflow.com/a/24256795
answers question: http://stackoverflow.com/q/24256733
score: 0
type: Answer
has body: This is due to the fact that onClick() method in the OnClickListener Interface which requires a parameter of type View. When you remove the parameter, Android will still attempt to call method sendMessage(View view) but that method does not exist any more, therefore you get error and app will force close. Parameter view is the actual View (Button in your case) that was clicked. With this, you can assign multiple buttons to invoke the same method and inside the method check which button was clicked. For more information, see this LINK

http://stackoverflow.com/comment/37272439
score: 0
type: AnswerComment
has text: That's not what [this post said](http://stackoverflow.com/questions/18320713/getsupportactionbar-from-inside-of-fragment-actionbarcompat?rq=1)...
comment on: http://stackoverflow.com/a/24152154
type: Comment

http://stackoverflow.com/comment/37443199
type: Comment
type: AnswerComment
has text: `"how can we place some components at the specified/desired location.on the JFrame"` Read [Layout Managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/using.html)
score: 1
comment on: http://stackoverflow.com/a/24241576

http://stackoverflow.com/comment/94846779
type: Comment
comment on: http://stackoverflow.com/a/54004944
has text: this is a **Java** question!
type: AnswerComment
score: 1

http://stackoverflow.com/comment/37426917
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24233174
has text: What is the content of the array? Do you have duplicate elements? Something you've never seen before? Other?
type: Comment

command
tags question: http://stackoverflow.com/q/24141943
tag name: command
tags question: http://stackoverflow.com/q/24257546
tags question: http://stackoverflow.com/q/24228467
type: Tag
tags question: http://stackoverflow.com/q/24148570

http://stackoverflow.com/comment/37353128
has text: @El_Chippo You don't want to `insert`, that _would_ be worse! You just want a simple assignment: `intArray[i] = 0`. I'd actually suggest changing it to `intArray[i] = i` in both programs so the loop won't get optimized away.
comment on: http://stackoverflow.com/a/24194172
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24215914
has title: Can the main method invokeLater be created differently than it normally is in a Java main method?
has answer: http://stackoverflow.com/a/24215947
answer count: 2
has comment: http://stackoverflow.com/comment/37426548
tagged with: java
favorite count: 0
has body: Can the invokeLater be coded so that you can create an instance of Runnable and then @Override the method run() and then send that Runnable variable into the method. I am wanting to see if you can change how the code is generated and still get the same results because that is how I start figuring out how things really work in a programming language. Code: import javax.swing.*; public class DDHSimpleProgram { JFrame f = new JFrame("A simple Swing Program"); JLabel l = new JLabel("Swing powers the modern GUI!"); public DDHSimpleProgram() { f.setLocation(300, 300); f.setSize(500, 500); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(l); f.pack(); f.setVisible(true); } public void run() { new DDHSimpleProgram(); } public static void main(String[] args) { Runnable r = null; SwingUtilities.invokeLater(r); } } This code works: The code below works with the program implementing the Runnable interface and then creates the GUI in the zero argument constructor. The invokeLater creates a new instance of the object as an anonymous class. The Run method actually does not do anything other than write a message to the console. I still think that this is an interesting part of the object oriented design structure that seems odd to me sometimes still because you can actual have the method to anything you want it to do. import javax.swing.*; public class DDHSimpleProgram implements Runnable { JFrame f = new JFrame("A simple Swing Program"); JLabel l = new JLabel("Swing powers the modern GUI!"); public DDHSimpleProgram() { f.setLocation(300, 300); f.setSize(500, 500); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(l); f.pack(); f.setVisible(true); } @Override public void run() { System.out.println("Run Method"); } public static void main(String[] args) { SwingUtilities.invokeLater(new DDHSimpleProgram()); } }
type: Question
has answer: http://stackoverflow.com/a/24216105
type: UnansweredQuestion
downvote count: 2
upvote count: 1
score: -1

http://stackoverflow.com/comment/37447613
comment on: http://stackoverflow.com/q/24244913
score: 0
type: QuestionComment
type: Comment
has text: Looks like the jar containing `org.postgresql.Driver` is missing in your classpath.

http://stackoverflow.com/a/24256806
upvote count: 1
type: Answer
has body: hi do something as follows JSONObject primaryObject = new JSONObject(//yours json string); JSONArray primaryArray = primaryObject.getJSONArray("worldpopulation"); for (int i = 0; i &lt; primaryArray.length(); i++) { JSONObject another = primaryArray.getJSONObject(i); String country = another.getString("country"); String flag = another.getString("flag"); int rank = another.getInt("rank"); String population = another.getString("population"); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("flag", flag); arraylist.add(i, map); }
answers question: http://stackoverflow.com/q/24256566
score: 1
downvote count: 0

http://stackoverflow.com/a/28435473
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: From Google: Try this (Java Based): http://www.linux-magazine.com/Online/Features/Consolidating-Logs-with-Logstash and This http://www.spectorsoft.com/products/server-manager/event-log-management.asp
answers question: http://stackoverflow.com/q/24137701

http://stackoverflow.com/q/24266772
has comment: http://stackoverflow.com/comment/37489374
answer count: 1
has title: Using Java scanner get line number
downvote count: 1
has body: I'm using the code below to compare two file input streams and compare them: java.util.Scanner scInput1 = new java.util.Scanner(InputStream1); java.util.Scanner scInput2 = new java.util.Scanner(InputStream2); while (scInput1 .hasNext() &amp;&amp; scInput2.hasNext()) { // do some stuff // output line number of InputStream1 } scInput1.close(); scInput2.close(); How can I output the line number inside the while loop?
favorite count: 0
linked to: http://stackoverflow.com/q/1332297
has comment: http://stackoverflow.com/comment/37489293
tagged with: java
has answer: http://stackoverflow.com/a/24267092
has comment: http://stackoverflow.com/comment/37489327
score: -1
type: Question
tagged with: java.util.scanner
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24116293
tagged with: javascript
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/24119883
answer count: 2
has answer: http://stackoverflow.com/a/24135091
accepted answer: http://stackoverflow.com/a/24135091
has title: Separate the string and send the string values to list in java
tagged with: java
type: Question
tagged with: jstl
has answer: http://stackoverflow.com/a/24119883
has body: I have a list questionForm and it contains question_id,question,options and I have taken options as a string separated by | symbol. Can anyone give me solution such that separate the string and display the options with radio buttons. list contains 1 java is? object oriented | Procedural | Asembly | Machin Level 2 Static block loaded? Afer the class | Before the class | never | No such variable in java 3 Which is a reserved word in the Java programming language? method | native | subclasses | reference <c:forEach var="opt" items="${questionForm}"> <c:if test="${opt.question_id==1}"> </c:if> </c:forEach> My javascript function is: function check1(type,options){ alert(type); var list = options; alert(list); if(type == "multiple choice"){ alert(list); <% String values = " "; List<String> opts = Arrays.asList(values.split("|")); out.println(opts); } } and the expected output is
tagged with: jsp

http://stackoverflow.com/comment/37226554
comment on: http://stackoverflow.com/q/24126177
score: 0
has text: It's unclear what paths are you talking about. Data files paths?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24241960
type: Question
tagged with: while-loop
tagged with: client
has comment: http://stackoverflow.com/comment/37443450
score: 2
type: AnsweredQuestion
has body: I have problem with my multhreaded server for bridge auction. The topic of it is less important, all I need to do so far is to make the loop inside the run method work for more than only one "lap". I mean my loop is working for each client only once and then It stopped, but I can't solve this problem. It should work all the time and after sequence of players N-> E-> S-> W-> it start another lap from player N, but now it just stand still... Check my code: package serwer; import java.io.*; import java.net.*; import java.util.*; import java.util.logging.*; public class Serwer { public static void main(String[] args) throws Exception { System.out.println("Started server to the bridge auction"); int conCount = 0; ServerSocket serwer = new ServerSocket(9898); ArrayList&lt;connection&gt; connections = new ArrayList&lt;connection&gt;(){}; try { //only 4 players are allowed to play bridge in one table while (connections.size() &lt; 4) { connection p = new connection(serwer.accept(), conCount++); connections.add(p); connections.get(conCount-1).start(); } } finally { serwer.close(); } } /** * static class responsible for the connection in multithreaded server */ static class connection extends Thread { private Socket socket; private int conCount; private static int counter = 0; private final String[] Players; private String stringOnServer = "0"; private int stake = 1; public connection(Socket socket, int conCount) { this.Players = new String[]{"N", "E", "S", "W"}; this.socket = socket; this.conCount = conCount; System.out.println("New connection id: " + Players[conCount]); } public void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); //here is info what player are you out.println("You are player on position " + Players[conCount]); while (true) { synchronized (this) { if (counter % 4 == conCount) { while (true) { out.println("Your turn " + Players[conCount] +…
has title: multithreaded server, loop is working only once
upvote count: 2
has comment: http://stackoverflow.com/comment/37443853
accepted answer: http://stackoverflow.com/a/24242890
tagged with: java
tagged with: multithreading
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24242890
tagged with: loops
favorite count: 0

http://stackoverflow.com/comment/37499106
type: Comment
has text: session = connAmq.createSession(false, Session.AUTO_ACKNOWLEDGE);
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24250491

http://stackoverflow.com/a/24107452
has body: setText() is waiting for a string, but you gave it an ArrayList
type: Answer
answers question: http://stackoverflow.com/q/24107350
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/a/24111421
has body: Basically, because JComponent has no UI delegate, it never paints its background (its paintComponent method essentially does nothing). You could supply a UI delegate that performs the required actions, or simply use JPanel, for example: import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.CompoundBorder; public class TestComponent { public static void main(String[] args) { new TestComponent(); } public TestComponent() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { setBackground(Color.WHITE); setBorder(new CompoundBorder( BorderFactory.createEmptyBorder(0,10,10,10), BorderFactory.createLineBorder(Color.RED) )); } @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } } }
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24110920
has comment: http://stackoverflow.com/comment/37197197
type: Answer

http://stackoverflow.com/a/26304944
answers question: http://stackoverflow.com/q/24158939
type: AcceptedAnswer
downvote count: 0
has body: The answer given by Dinal works for CXF 2.3 and older. For additional info: http://cxf.apache.org/docs/embedding-cxf-inside-spring.html
score: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24158939
upvote count: 2

http://stackoverflow.com/q/24161146
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24161337
linked to: http://stackoverflow.com/q/1580012
has body: I wanted to code from this answer but i have error The import org.bouncycastle.openssl cannot be resolved The import org.bouncycastle.openssl cannot be resolved and i have no idea how coudl i repair this becouse other bouncycastle libs are detected correctly. I will be grateful for any ideas whats wrong. Im using eclipse and i have instaled bouncycastle like in this instruction itcsoultions
downvote count: 0
tagged with: java
has title: BouncyCastle openssl cannot be resolved
upvote count: 10
has comment: http://stackoverflow.com/comment/37287985
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24161337
answer count: 2
tagged with: bouncycastle
possible better answer: http://stackoverflow.com/a/31804992
score: 10
has answer: http://stackoverflow.com/a/31804992

http://stackoverflow.com/q/24231873
has comment: http://stackoverflow.com/comment/37608684
has comment: http://stackoverflow.com/comment/37463083
has comment: http://stackoverflow.com/comment/37453984
has comment: http://stackoverflow.com/comment/37593703
has comment: http://stackoverflow.com/comment/37423978
has comment: http://stackoverflow.com/comment/37473539
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37609499
has comment: http://stackoverflow.com/comment/37468060
has comment: http://stackoverflow.com/comment/37586190
has comment: http://stackoverflow.com/comment/37422953
has comment: http://stackoverflow.com/comment/37430486
has comment: http://stackoverflow.com/comment/37422861
has comment: http://stackoverflow.com/comment/37422847
has comment: http://stackoverflow.com/comment/37454182
has comment: http://stackoverflow.com/comment/37424265
has comment: http://stackoverflow.com/comment/37427366
has comment: http://stackoverflow.com/comment/37464064
has comment: http://stackoverflow.com/comment/37453950
has comment: http://stackoverflow.com/comment/37453525
score: 0
has comment: http://stackoverflow.com/comment/37423087
answer count: 0
has comment: http://stackoverflow.com/comment/37422463
has comment: http://stackoverflow.com/comment/37431616
has comment: http://stackoverflow.com/comment/37422910
tagged with: java
has comment: http://stackoverflow.com/comment/37436004
has body: I have asked this question before and received a lot of answers within regard to how to fix the issue. However the issue still has not been repaired and I am at a loss when it comes to the right means to repair it. I am creating a java web application in Net beans using Tomcat 8 and Java EE 7. The application is a simple form application that takes a users information and writes it to a simple text file in the WEB-INF folder. However I have tried several ways to write to the text file and all but one throw an error the one that doesn't throw an error is the one that is supposed to be correct given the research and information I have found, and the great answers that I have gotten from everyone here. My problem is that none of them work. I have moved from model 1 architecture to model 2 architecture and the like and still haven't found repair. I am posting a link to my Git Repository with all of the code inside. Please if anyone can take a look at it and let me know what is going on that would be great. My GitHub! //doPost Method from servlet @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //get parameters from the form String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String email = request.getParameter("email"); //get relative file name //ServletContext context = getServletContext(); String path = getServletContext().getRealPath("/WEB-INF/my_new_text.txt"); //add info to text file User user = new User(firstName, lastName, email); UserIO.add(user, path); //Store user object in a request object request.setAttribute("user", user); //forward request and response objects to JSP page String url = "/display_email_entry.jsp"; RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); } //UserIO class for writing to file package data; import business.User; import java.io.File; impor…
has comment: http://stackoverflow.com/comment/37422754
tagged with: web-applications
has comment: http://stackoverflow.com/comment/37454040
has comment: http://stackoverflow.com/comment/37615670
tagged with: java-ee-7
upvote count: 1
has comment: http://stackoverflow.com/comment/37423833
has comment: http://stackoverflow.com/comment/37459092
tagged with: tomcat8
has title: How to write to a file from a web application in Tomcat 8?
has comment: http://stackoverflow.com/comment/37454102
has comment: http://stackoverflow.com/comment/37422968
downvote count: 1
has comment: http://stackoverflow.com/comment/37454215
favorite count: 0
has comment: http://stackoverflow.com/comment/37422575
has comment: http://stackoverflow.com/comment/37423031
type: Question
tagged with: netbeans-8

http://stackoverflow.com/comment/37445119
has text: Probably the path to your test.txt file is wrong. Where is that file stored?
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24243599

http://stackoverflow.com/comment/37250390
comment on: http://stackoverflow.com/q/24137994
has text: Good question. Have you tried calling `/bin/bash file.sh` in the background? I think it might survive your Java process.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37266191
score: 0
comment on: http://stackoverflow.com/a/24148589
type: Comment
has text: @vee Added a clarification which might help.
type: AnswerComment

http://stackoverflow.com/comment/37319553
comment on: http://stackoverflow.com/a/24115842
score: 0
type: Comment
has text: @D'Scolz I can't able to approve my own post. There is no option to accept your edit.see http://stackoverflow.com/review/suggested-edits/5040359
type: AnswerComment

http://stackoverflow.com/q/24180819
type: Question
has title: Can schema version be different from jars file?
has comment: http://stackoverflow.com/comment/37324996
accepted answer: http://stackoverflow.com/a/24180931
tagged with: spring
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24180931
score: 1
tagged with: java
answer count: 1
downvote count: 0
tagged with: jar
upvote count: 1
has body: My lib folder has spring jars of the 4.0.4 release. In the applicationContext.xml I use the 3.0 version of the schema. For exemple: I have the following jars: spring-beans-4.0.4 spring-context-4.0.4 spring-core-4.0.4 spring-expression-4.0.4 sprig-web-4.0.4 spring-webmvc-4.0.4 and in the applicationContext.xml I wrote: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; My questions are: Is it possible have different versions between schema and jar? If yes, what are the consequences?
favorite count: 0

http://stackoverflow.com/q/24136774
has body: I am having three Java String arrays, String[] array1 = [a,b,c]; String[] array2 = [d,e]; String[] array3 = [f,g,h]; Now I have to insert these three arrays into mysql database in a below fashion source action destination a d f b d f c d f a e f b e f c e f a d g b d g c d g a e g b e g c e g a d h b d h c d h a e h b e h c e h How can I achieve this using jdbcTemplate ?
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37243123
tagged with: mysql
tagged with: jdbctemplate
has answer: http://stackoverflow.com/a/24137712
type: Question
has answer: http://stackoverflow.com/a/24136849
has comment: http://stackoverflow.com/comment/37243244
type: UnansweredQuestion
tagged with: java
has title: inserting multiple arrays in an order
has comment: http://stackoverflow.com/comment/37243627

http://stackoverflow.com/q/24117606
answer count: 2
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37209328
has comment: http://stackoverflow.com/comment/37206849
has answer: http://stackoverflow.com/a/24117693
has body: Say I have this enum type: public enum Type { VALUEA, VALUEB }; And want to switch from string to this enum, using valueOf(). How to handle this case, making it return a default value? Type.valueOf("NOTVALID");
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24118088
has title: How to handle illegal argument exception on a string->enum conversion?
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/60022068
has text: Lion is referring to a different robot Michael. Perhaps the awt robot is an alternative to the glass robot in this case Lion (I don't know enough about robots to say for sure).
type: AnswerComment
comment on: http://stackoverflow.com/a/36179066
score: 1
type: Comment

http://stackoverflow.com/comment/37214519
score: 0
comment on: http://stackoverflow.com/q/24119916
type: QuestionComment
has text: Just for the fun of it, try do some experiments with all the files being _un_compressed files and see what the speed is then.
type: Comment

http://stackoverflow.com/comment/37320586
type: QuestionComment
comment on: http://stackoverflow.com/q/24178171
type: Comment
score: 2
has text: It's `implements`, not `implement`. And `extends` must be before `implements`. So: `public class Der extends Base implements Car`

http://stackoverflow.com/q/24214952
has answer: http://stackoverflow.com/a/24215051
upvote count: 1
score: 0
has answer: http://stackoverflow.com/a/24215081
has answer: http://stackoverflow.com/a/24214998
tagged with: file-io
has answer: http://stackoverflow.com/a/24216697
tagged with: java
has comment: http://stackoverflow.com/comment/37391081
linked to: http://stackoverflow.com/q/3402735
downvote count: 1
has comment: http://stackoverflow.com/comment/37391005
answer count: 4
has title: Best way to read strings of characters separated by spaces in files
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37391008
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37391021
has body: so I'm working on a project where I'm trying to read thousands of lines from a text file in this format: EMAILADDRESS1@EXAMPLE.COM 1209381231 EMAILADDRESS2@EXAMPLE.NET 1241231231 EMAILADDRESS3@EXAMPLE.ORG 1231585849 EMAILADDRESS4@EXAMPLE.COM 2132389558 ... etc. etc. .... Now, I want to read each email address into a string and completely ignore the numbers that comes after it, they aren't important to me. The numbers are separated from the email addressed by spaces. So, what would be the best way to read each email address into their own string?

aspectj
tags question: http://stackoverflow.com/q/24122672
type: Tag
tags question: http://stackoverflow.com/q/24127169
tags question: http://stackoverflow.com/q/24232657
tags question: http://stackoverflow.com/q/24259712
tags question: http://stackoverflow.com/q/24137596
tags question: http://stackoverflow.com/q/24211943
tags question: http://stackoverflow.com/q/24206634
tag name: aspectj
tags question: http://stackoverflow.com/q/24121117

object-tag
type: Tag
tags question: http://stackoverflow.com/q/24168068
tag name: object-tag

http://stackoverflow.com/comment/37391215
has text: Hmmm, I learned that virtual calls in Java don't incur any performance penalty through searching as you seem to be implying. At least the decompiled bytecode seems to be calling `Animal#jump()` immediately...
type: Comment
comment on: http://stackoverflow.com/a/24215045
score: 0
type: AnswerComment

http://stackoverflow.com/q/24234082
has comment: http://stackoverflow.com/comment/37427291
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37427765
has answer: http://stackoverflow.com/a/24234540
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24234226
has comment: http://stackoverflow.com/comment/37427426
score: -1
has comment: http://stackoverflow.com/comment/37427735
has comment: http://stackoverflow.com/comment/37427769
has title: Thread sleep, and continue thread when input is received
answer count: 2
downvote count: 2
linked to: http://stackoverflow.com/q/3570762
upvote count: 1
has body: I got a problem with my program, when trying to sleep and unsleep a thread. Right now i'm running 2-threads, the standard thread which checking for input from a TCP device (the two devices are connected), and another thread which handle input from keyboard. I have a scenario where I will stop one of the thread for 10 sec so it can receive a command. The code so far: else if ((inputReceived.startsWith("RM20"))) { RM20Received = "Yes"; showMenu(); display = (inputReceived.substring(2,inputReceived.length())); if (scaleInput == null || scaleInput == "B" || scaleInput == "T") { System.out.println("Please enter correct RM20 value within 10 seconds"); Thread.sleep(10000); if () userValue = scaleInput; out.writeBytes("RM20 A " + userValue +"\r\n"); display = inputReceived; showMenu(); scaleInput = null; } } As you can see, I'm using the Thread.sleep(10000). What I want to the sleep the Thread, as I do but "infinite", but as soon as someone enter an input from keyboard, it should keep the thread running after that. Is there some easy way to do this?
tagged with: java
has comment: http://stackoverflow.com/comment/37427672

http://stackoverflow.com/q/24243092
has comment: http://stackoverflow.com/comment/37444536
has body: java.util.HashMap has an implementation of the put method, which has the following code inside it : if (e.hash == hash &amp;&amp; ((k = e.key) == key || key.equals(k))) { V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } In the above code why wasn't the reference check made first (since two objects having the same reference will have the same hash and equals()) ? i.e. something like this : if ((k = e.key) == key) { V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } else if ( compare hash and equals) { // do something again with the value } Wouldn't this have saved a comparision?
tagged with: standard-library
has comment: http://stackoverflow.com/comment/37446564
downvote count: 1
has comment: http://stackoverflow.com/comment/37444212
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24244758
has comment: http://stackoverflow.com/comment/37444354
answer count: 2
has comment: http://stackoverflow.com/comment/37444491
type: UnansweredQuestion
has title: Java HashMap put() implementation. Why not check references first?
score: 13
has comment: http://stackoverflow.com/comment/37444316
has comment: http://stackoverflow.com/comment/37444148
has comment: http://stackoverflow.com/comment/37445169
has comment: http://stackoverflow.com/comment/37444323
has answer: http://stackoverflow.com/a/24246374
has comment: http://stackoverflow.com/comment/37445925
has comment: http://stackoverflow.com/comment/37445845
upvote count: 14
has comment: http://stackoverflow.com/comment/37444911
tagged with: java

http://stackoverflow.com/a/24213885
has body: Following your last question, I can guess the problem is that in your persistence.xml file you are referring to a JTA Data Source named java:/DoDSRDS. The server logs are telling you that it doesn't have a JDBC Datasource with that name. Check in your Jboss admin console in the JDBC Data Sources section to see if your resurce's name is correct. You should have a JDBC Data Source named DoDSRDS. Also, You are using the format java:/DoDSRDS. I don't have much knowledge about Jboss resource naming but after reading other related posts I think the correct format for your resource name should be java:jboss/DoDSRDS. Try using this format in the persistence.xml file and see if it works.
has comment: http://stackoverflow.com/comment/37531076
has comment: http://stackoverflow.com/comment/37450757
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37519539
downvote count: 0
has comment: http://stackoverflow.com/comment/37450618
answers question: http://stackoverflow.com/q/24210439
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37450010
has comment: http://stackoverflow.com/comment/37530764
accepted answer of: http://stackoverflow.com/q/24210439
has comment: http://stackoverflow.com/comment/37389067
has comment: http://stackoverflow.com/comment/37449512
type: Answer
has comment: http://stackoverflow.com/comment/37520655

http://stackoverflow.com/comment/37350866
has text: is the response from the server is just a String JSON?
score: 0
comment on: http://stackoverflow.com/q/24194194
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37232554
type: Comment
comment on: http://stackoverflow.com/q/24130823
type: QuestionComment
has text: @user2444400 post your Construction class
score: 0

http://stackoverflow.com/comment/37473865
comment on: http://stackoverflow.com/a/24168603
score: 0
type: AnswerComment
type: Comment
has text: This might have worked but I rewrote my prototype. There is a bit of a showstopper though: https://github.com/ooyala/spark-jobserver/issues/5

http://stackoverflow.com/q/24231344
accepted answer: http://stackoverflow.com/a/24231409
has comment: http://stackoverflow.com/comment/37425871
tagged with: java
has title: XmlWriter in java
has body: I imported javax.xml.*; and org.w3c.dom.*; into my project in hope to access the same XML methods that are used in this tutorial(the tutorial is in other language, they imported XML by using System.XML;) however when i try to use: XmlWriter writer = XmlWriter.Create(FilePath); It cannot find class XmlWriter and both imports are marked as unused. Should i import something else? java XML tutorials dont mention this XmlWriter or the Create method. Do the same functions even exist in Java version of XML? Im total newb in XML so having the same methods they have in the tutorial video would be nice.
downvote count: 1
score: -1
tagged with: import
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24231409
has comment: http://stackoverflow.com/comment/37421891
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/24237888
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37434453
has answer: http://stackoverflow.com/a/24238008
tagged with: http://stackoverflow.com/tag/xml
type: Question
type: UnansweredQuestion
has title: avoiding repeated rule while reading xml
has body: I am doing yahoo API program where i am getting result as XML format and fetching values from that xml files using the rule name. But in my case the xml file looks like this. Kiran sam www.aaaaaaaaddd.com Pai 22 www.ajsajha.com</url? Kiran tom www.aaaaasdadd.com Pai 22 www.wqeqwjha.com In this i want to take values from the following rules : first, url, lat, age. But i want to take only one value from the rule first, url. if(e.getElementsByTag("url")!=null) { itemStringBuilder.append(e.getElementsByTag("url").text()); } when i use this code i am getting both the url values. How can i check and avoid the second one and just take the first.
tagged with: xml-parsing

http://stackoverflow.com/comment/37462185
type: QuestionComment
has text: Use some simple print statements to check whether or not your counter is working. In the loop print out i, in the if statement print the picture location, then see what actually is not working as expected.'
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24252120

http://stackoverflow.com/q/24219495
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37404895
tagged with: firebase
has title: Firebase onDisconnect() not working
has comment: http://stackoverflow.com/comment/37403790
score: 1
tagged with: java
has body: I'm having issues with Firebase's onDisconnect(). When I register ef.onDisconnect().removeValue() and then disconnect internet and close application (normal or force close, it doesn't matter) it will not remove value (Yes, I waited more then 5 minutes and value was still there). This is how I create firebase and register onDisconnect. Firebase ref = new Firebase("...."); ref.onDisconnect().removeValue(); When I call ref.setValue(...) or ref.removeValue() it works without any problems. Is there something wrong in sdk or should I change something?
downvote count: 0
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/24249939
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37420481

http://stackoverflow.com/comment/37387616
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24209354
type: AnswerComment
has text: oops - forgot to post it...putting it up there now.

http://stackoverflow.com/q/24149755
tagged with: java
tagged with: junit
downvote count: 0
possible better answer: http://stackoverflow.com/a/24150834
favorite count: 0
tagged with: unit-testing
type: Question
has body: I have a class which wraps around spymemcached client and I would like to write some JUnit tests to test if the getValue and addKey methods work or not. The problem is that the spymemcached server is not reachable from the test server so I guess some mocking is required here. My simplified class looks something like this: public class SpyMemcachedClientWrapper { private MemcachedClient spyMemcachedClient; public SpyMemcachedClientWrapper() spyMemcachedClient = new MemcachedClient(new ConnectionFactoryBuilder().build(), AddrUtil.getAddresses("192.168.1.122:11211")); } public Object getValue(Object key) { Object obj = null; Future&lt;Object&gt; f = null; f = spyMemcachedClient.asyncGet(key); try { obj = f.get(2000, TimeUnit.MILLISECONDS); } catch (TimeoutException ex) { f.cancel(false); } return obj; } public boolean addKey(Object key, Object value) { OperationFuture&lt;Boolean&gt; t = spyMemcachedClient.set(key, 0, value); return t.getStatus().isSuccess(); } } Can you please give me some hints or best practice advise how can I write the SpyMemcachedClientWrapperTest for this class? I am thinking that I could use Mockito or EasyMock (Mockito is preferable but if EasyMock is better here, thats fine also) but so far I could not figure out what's the usually preferred way here to write the tests in this scenario. An example would be appreciated also. Many thanks,
accepted answer: http://stackoverflow.com/a/24150157
has answer: http://stackoverflow.com/a/24150157
tagged with: spymemcached
has title: JUnit testing Spymemcached client
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24150834
answer count: 2
tagged with: mocking
upvote count: 2

http://stackoverflow.com/comment/37202763
type: Comment
comment on: http://stackoverflow.com/q/24115015
type: QuestionComment
score: 0
has text: I'm sorry to ask you, what exactly should i specify now?

http://stackoverflow.com/q/24227449
upvote count: 2
type: AnsweredQuestion
score: 0
has title: How is possible to change size(width and height) of the component in codenameone
tagged with: java
tagged with: codenameone
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24227483
possible better answer: http://stackoverflow.com/a/24227483
answer count: 2
downvote count: 2
has body: I want to add some component to the form such as: button, label and more. And i want to set width and height to them but i don't find such a property. Is there any way to do that? edit: here is my code in Main.java file currentForm = new Form(); currentForm.setLayout(new LayeredLayout()); currentForm.applyRTL(true); Container mapContainer = new Container(new LayeredLayout()); Container controlsContainer = new Container(new BorderLayout()); controlsContainer.setRTL(true); currentForm.addComponent(mapContainer); currentForm.addComponent(controlsContainer); Container panelTop = new Container(new BoxLayout(BoxLayout.X_AXIS)); Container panelDown = new Container(new FlowLayout(Component.RIGHT)); panelTop.setSize(new Dimension(40, 20)); controlsContainer.addComponent(BorderLayout.NORTH, panelTop); controlsContainer.addComponent(BorderLayout.SOUTH, panelDown); Button btnRoute = new Button(res.getImage("icon_routing.png")); btnRoute.setSize(new Dimension(5, 5)); TextField txtSearch = new TextField(); txtSearch.setRTL(true); txtSearch.setUIID("searchbox"); txtSearch.setEnabled(true); // search textfield mode txtSearch.putClientProperty("searchField", Boolean.TRUE); txtSearch.setSize(new Dimension(8,10)); Button btnGPSFound = new Button(res.getImage("near_by_menu.png")); btnGPSFound.setSize(new Dimension(5,5)); panelTop.addComponent(btnRoute); panelTop.addComponent(txtSearch); panelTop.addComponent(btnGPSFound); currentForm.show(); btnRoute.setSize(new Dimension(30, 30)); btnRoute.refreshTheme(); panelTop.refreshTheme(); `
has answer: http://stackoverflow.com/a/24283102
accepted answer: http://stackoverflow.com/a/24283102

http://stackoverflow.com/q/24183125
has comment: http://stackoverflow.com/comment/37334245
score: 0
tagged with: java
tagged with: jdbc
has title: Want my swing application with MS ACCESS database connection to be online
has comment: http://stackoverflow.com/comment/37332943
type: Question
has comment: http://stackoverflow.com/comment/37332322
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/24186414
has body: I have built an application in java using swing core classes. I have used database connection with MS Access on my pc using JDBC:ODBC. I want this application to be online. How i can do it? Thanks in advance
has comment: http://stackoverflow.com/comment/37341654

http://stackoverflow.com/a/24195625
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24192785
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37360478
has comment: http://stackoverflow.com/comment/37360210
has comment: http://stackoverflow.com/comment/37364535
downvote count: 0
type: Answer
has body: The best architecture for Camel? That depends on your needs. It seems that you have several applications that will need to integrate with each other. So for each application that needs to integrate with another application there will be a integration route. Lets expand this a little. Assume we have two applications a Customer Management application and an Order Management application. These two will have to be integrated with each other. Conceptually on a high level there will be two routes for the applications that you need to create and maintain. For such simple integration having the application integrate with each other it makes sense to use camel/mule in the application itself(embedded mode).The amount of integration is minimal. Since the two applications are now tightly coupled by the integration routes themselves changes in the customer application might lead to changes in the order application. However since the systems are small this is a minimal amount of work. However if there was more system involved this approach is going to become maintenance nightmare. Lets turn up the complexity a bit. Lets go to four systems. A customer, order, accounting and shipping system that needs to be integrated with each other. Just adding two more system to integrate will bring your total routes to 12 routes. We doubled the amount of system but we increased the amount of routes by a factor of 6. That is a 600% increase in what can go wrong. Using a ESB will simplify this design a lot. Hope you understand a little more. Note: Using camel to just call a web-service from an application is overkill. Rather do this with Apache CXF which is much more suited for this.
has comment: http://stackoverflow.com/comment/37359949
has comment: http://stackoverflow.com/comment/37410264
answers question: http://stackoverflow.com/q/24192785

http://stackoverflow.com/comment/37321740
has text: My only criticism of this approach is it assumes that there is at least one "qid"
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24178869

http://stackoverflow.com/comment/37478754
score: 0
type: Comment
type: QuestionComment
has text: You can use `ctrl + shift + arrow key.`
comment on: http://stackoverflow.com/q/24261325

http://stackoverflow.com/comment/37367382
comment on: http://stackoverflow.com/a/24202548
score: 0
type: Comment
type: AnswerComment
has text: .classpath and .project look fine. In an other project I can execute on package...

http://stackoverflow.com/q/24201168
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has title: Add new node in XML file
accepted answer: http://stackoverflow.com/a/24208091
linked to: http://stackoverflow.com/q/24204893
has body: I have a xml file with a structure like this: <?xml version="1.0"?> Word s. m. This text have i node. Text. B n-1 s. m. This text doesn't have i atribute. Word. I want to add a new node for each word in the RegDef element, so the result could be: <?xml version="1.0"?> Word s. m. <w lemma="A1">This</w> <w lemma="A2">text</w> <w lemma="A3">have</w> <w lemma="A4">i</w> <w lemma="A5">node</w> <w lemma="A6">.</w> Text. B n-1 s. m. <w lemma="A7">This</w> <w lemma="A8">text</w> <w lemma="A8">doesn't</w> <w lemma="A10">have</w> <w lemma="A11">i</w> <w lemma="A12">atribute</w> <w lemma="A13">.</w> Word. If the RegDef node have a < i > node I want to read the text fron the < i > node and write a < w > node for each word. I tried to use XPath like below: Element rootElement = document.getDocumentElement(); Element element = document.createElement("w"); rootElement.appendChild(element); but it appends right after the root node. How can i write a node for each word in RegDef tag and then add an attribute to that node? Thank you.
has answer: http://stackoverflow.com/a/24208091
has comment: http://stackoverflow.com/comment/37393387
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
type: AnsweredQuestion
tagged with: xml-parsing
score: 1
tagged with: java

http://stackoverflow.com/comment/39162364
comment on: http://stackoverflow.com/a/24226379
type: Comment
has text: app unfortunately stopped when used this code: `requestWindowFeature(Window.FEATURE_NO_TITLE);`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37400632
score: 0
has text: you mean you want to close B activity when you reach C actvity?
type: QuestionComment
comment on: http://stackoverflow.com/q/24220258
type: Comment

http://stackoverflow.com/q/24226187
type: Question
has comment: http://stackoverflow.com/comment/37411943
has body: I looked around but haven't found an answer. It'd be easiest to explain with an example. Let's say I have a 2d array that has the values {{1, 2, 3}, {4, 5, 6}} What I want to do is multiply the size of the 2d array such that the resulting array has each of those elements repeated x amount of times (preferably 32). Example end results: {{1, 1, 2, 2, 3, 3}, {1, 1, 2, 2, 3, 3}, {4, 4, 5, 5, 6, 6}, {4, 4, 5, 5, 6, 6}} In this case the original was multiplied by 2, so it made squares 2 by 2 with each value. Any ideas?
type: UnansweredQuestion
tagged with: arrays
has title: Multiplying size of 2d array in a specific way?
has comment: http://stackoverflow.com/comment/37411915
score: 2
has comment: http://stackoverflow.com/comment/37411930
has answer: http://stackoverflow.com/a/24226391
upvote count: 3
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/24173667
tagged with: java
favorite count: 0
type: Question
answer count: 2
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
has answer: http://stackoverflow.com/a/24173759
has body: I've been asked to make a game for my CS (high school) class as my end of semester assignment. We haven't been taught properly all of the coding required to make a game so my knowledge in this area is very poor. Anyways, the game I am trying to make is something like "Flappy Fall" (an Apple appstore game) where objects fall from the top of the screen and descend to the bottom of the screen. The objective is to catch these objects before they reach the bottom. I am able to get one object to fall and have also created the "catcher", but I am not sure how to create multiple falling objects, nor do I know how to remove the object once it has been caught by the catcher. So far I have classes "JavaGame", "Catcher", and "Ball". Any help would be greatly appreciated. int x, y; int t = 1; private Image dbImage; private Graphics dbGraphics; Image player; Image bkg; static Catcher p = new Catcher(150, 450); public JavaGame() { //Game Images ImageIcon b = new ImageIcon("bkg.png"); bkg = b.getImage(); //Game properties setTitle("Game"); setSize(350, 600); setResizable(false); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); addKeyListener(new Keys()); addMouseMotionListener(new Mouse()); } public void paint(Graphics g) { // dbImage = createImage(getWidth(), getHeight()); dbGraphics = dbImage.getGraphics(); draw(dbGraphics); g.drawImage(dbImage, 0, 0, this); } public void draw(Graphics g) { g.drawImage(bkg, 0, 0, this); //Creates background p.draw(g); //while (t &lt; 100) { p.b.draw(g); //t++; //} g.setColor(Color.WHITE); g.drawString(""+p.score, 175, 50); repaint(); } public static void main(String[] args) { JavaGame jg = new JavaGame(); //Threads Thread p1 = new Thread(p); p1.start(); Thread ball = new Thread(p.b); ball.start(); } public class Keys extends KeyAdapter { public void keyPressed(KeyEvent e) { p.keyPressed(e); } public void keyReleased(KeyEvent e) { p.keyReleased(e); } } public class Mouse implements MouseMotionListener …
has answer: http://stackoverflow.com/a/24173773
has title: Creating multiple instances of an object. (Game)

http://stackoverflow.com/comment/37311717
comment on: http://stackoverflow.com/q/24172449
score: 0
has text: @TinaJasmin that doesn't look like the output that `printServerSocketInfo` would print?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37499623
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24233823
type: QuestionComment
has text: Cool, thanks I will have a look (yes a servlet is probably the best way to show the swagger ui)

http://stackoverflow.com/comment/37206011
comment on: http://stackoverflow.com/a/24117130
type: AnswerComment
has text: oops, sorry, small leftover :)
type: Comment
score: 0

http://stackoverflow.com/a/24177399
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24177111
has body: Since you are using the parse(String) method of the DateFormat class which is extended by the SimpleDateFormat here is what the javadoc of parse method reads: Parses text from the beginning of the given string to produce a date. The method may not use the entire text of the given string. The javadoc of parse(String,ParsePosition) reads: By default, parsing is lenient: If the input is not in the form used by this object's format method but can still be parsed as a date, then the parse succeeds. Clients may insist on strict adherence to the format by calling setLenient(false). This parsing operation uses the calendar to produce a Date. As a result, the calendar's date-time fields and the TimeZone value may have been overwritten, depending on subclass implementations. Any TimeZone value that has previously been set by a call to setTimeZone may need to be restored for further operations.
score: 1
downvote count: 0

http://stackoverflow.com/a/24188083
score: 0
type: Answer
has body: e.printStackTrace(); Will tell you exactly which line has the NullPointerException
answers question: http://stackoverflow.com/q/24187199

http://stackoverflow.com/a/24190845
answers question: http://stackoverflow.com/q/24152830
type: Answer
score: 0
has body: I finally figured out , the mask image got to have a alpha channel . On Photoshop you have to add a transparency layer to get set the alpha channel enabled.

http://stackoverflow.com/comment/37235559
score: 0
comment on: http://stackoverflow.com/a/24113696
has text: As shown above, in the `startElement` method you can read the tag name (`qName`) and all attributes you can read from the `atts` variable (`atts.getQName(i)` and `atts.getValue(i)`), but to read the tag's text value you need to use the `characters` method and use flags as shown above. If you run the example above you should get the result you are expecting.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24126886
answers question: http://stackoverflow.com/q/24126810
score: 1
type: Answer
downvote count: 0
upvote count: 1
type: AcceptedAnswer
has body: getQuestion() returns an int, so you should expect the id to be shown. In order to show the string resource associated with that id, you need to call getString() with a Context (such as an Activity): String question = getString(mQuestionBAnk[0].getQuestion());
accepted answer of: http://stackoverflow.com/q/24126810

http://stackoverflow.com/comment/37303925
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24169250
score: 0
has text: The answer is obvious: rowView is null. Why would that be? Because getChildAt(firstVisibleItem) returned null. Why would that happen?

http://stackoverflow.com/q/24209202
tagged with: android
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/24209327
type: Question
upvote count: 0
has body: I want to get rid of the menu button that is on my action bar in my app, but still keep the action bar itself. How do I go about doing this? Thanks so much for the help!
answer count: 1
tagged with: android-actionbar
tagged with: android-menu
downvote count: 1
favorite count: 0
has title: (Android) get rid of menu button without getting rid of action bar?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24209327

http://stackoverflow.com/comment/37410664
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24225504
has text: You need more sophisticated Layout Manager if you want to use a single panel.

http://stackoverflow.com/comment/37283042
comment on: http://stackoverflow.com/q/24158129
type: Comment
type: QuestionComment
score: 0
has text: Both `Java` and `Javac` is working

http://stackoverflow.com/a/24126103
type: AcceptedAnswer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/37224210
has body: Can't really see why you would ever make everything in the Data class static, however: public class Data { static StringProperty name = new SimpleStringProperty(); static StringProperty domain = new SimpleStringProperty(); static StringProperty FQDN = new SimpleStringProperty(); static { FQDN.bind(Bindings.format("%s@%s", name, domain)); } public static String setName(String string) { name.set(string); } public static String setDomain(String string) { domain.set(string); } public static ObservableStringValue getFQDN() { return FQDN; } }
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/24125949
accepted answer of: http://stackoverflow.com/q/24125949

http://stackoverflow.com/a/24172460
score: 2
has comment: http://stackoverflow.com/comment/37310395
has body: Right now you have 5 threads that we know about call doStuff, the Timer threads created in the loop. If more than one thread interacts with a method than you have concurrent calls to the same method and you obviously need to consider thread safety. BUT having a single thread call a method is not enough to provide thread safety. Consider this code: private int value; void add(int x) { value+=x; } void sub(int x) { value-=x; } Given 2 threads each calling one of these methods the code is obviously not thread safe. The point is: Thread safety is about state, not about methods.
downvote count: 0
answers question: http://stackoverflow.com/q/24172106
upvote count: 2
has comment: http://stackoverflow.com/comment/37310441
type: Answer

http://stackoverflow.com/comment/37269489
comment on: http://stackoverflow.com/a/24150425
type: Comment
score: 0
type: AnswerComment
has text: Maybe mapForId(storeTest).toArray() is null.

http://stackoverflow.com/comment/37358187
type: QuestionComment
comment on: http://stackoverflow.com/q/24198009
has text: Is this input through a Java thing such as Swing/JavaFX or through a native Windows thing such as the console? (sorry, brain is too fried to think of a more fitting word than "thing") If memory serves, Java should use `\n` internally, so you might not need the `line.separator` property as long as you don't interact with any native Windows components. Not 100% sure about that though.
score: 0
type: Comment

http://stackoverflow.com/comment/37330151
score: 1
comment on: http://stackoverflow.com/a/24183199
has text: Just try to print available.getText() value after mouse hovering. If it is printing properly/required value ((Available)) for available seats.. it clicks.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24242453
has body: continue start over; for(int i=0;i&lt;5;i++){ continue; // restart iteration with next value in index i=1; } break execute code after loop for(int i=0;i&lt;5;i++)) { break; // execute from from next line } // next line
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24242395

http://stackoverflow.com/q/24146800
favorite count: 0
has comment: http://stackoverflow.com/comment/37261729
has answer: http://stackoverflow.com/a/24147127
score: 1
tagged with: java
has title: What would be the correct GridbagLayout configuration to get such a display?
has comment: http://stackoverflow.com/comment/37262438
type: Question
tagged with: gridbaglayout
has body: Here is what I want to obtain: The problem I'm faced with relates to this top right part: With my code, the blue block is desperately not spanning under both green blocks. It is stuck either to the left or to the right (depending on the weights I apply, the gridx and gridy values staying the same): or I have correct gridx/gridy values, but I can not manage to get correct weights. What would be the correct code? Edit : here is a minimal working example : Code: import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Test { public static void main(String[] args) { JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.add(panel); panel.setLayout(new GridBagLayout()); JLabel score1 = new JLabel("Score1"); JLabel score2 = new JLabel("Score2"); JLabel team1 = new JLabel("Team1TestTest"); JLabel team2 = new JLabel("Team2TestTest"); JLabel clock = new JLabel("Clock"); // Layout GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(10,10,10,10); gbc.anchor = GridBagConstraints.CENTER; gbc.weighty = gbc.weightx = 1; // First two lines gbc.gridy=0; // -teams gbc.gridx=0; gbc.gridheight = 1; gbc.gridwidth = 2; panel.add(team1,gbc); gbc.gridx=2; gbc.gridheight = 1; gbc.gridwidth = GridBagConstraints.REMAINDER; panel.add(team2,gbc); // -score 1 gbc.gridy=1; gbc.gridx=0; gbc.gridheight = 1; gbc.gridwidth = 1; panel.add(score1,gbc); // -clock gbc.gridx=1; gbc.gridheight = 1; gbc.gridwidth = 2; panel.add(clock,gbc); // -score 2 gbc.gridx=3; gbc.gridheight = 1; gbc.gridwidth = GridBagConstraints.REMAINDER; panel.add(score2,gbc); frame.setContentPane(panel); frame.setVisible(true); frame.pack(); while(true) {} } } Result:
upvote count: 2
has comment: http://stackoverflow.com/comment/37297534
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/37261812
tagged with: layout-manager
downvote count: 1

jdbc
tags question: http://stackoverflow.com/q/24122646
tags question: http://stackoverflow.com/q/24135363
tags question: http://stackoverflow.com/q/24211080
tags question: http://stackoverflow.com/q/24265827
tags question: http://stackoverflow.com/q/24188472
tags question: http://stackoverflow.com/q/24151026
tags question: http://stackoverflow.com/q/24244913
tags question: http://stackoverflow.com/q/24242137
tags question: http://stackoverflow.com/q/24210590
tags question: http://stackoverflow.com/q/24212592
tags question: http://stackoverflow.com/q/24261210
tags question: http://stackoverflow.com/q/24242715
tags question: http://stackoverflow.com/q/24116962
tags question: http://stackoverflow.com/q/24232091
tags question: http://stackoverflow.com/q/24228580
tags question: http://stackoverflow.com/q/24244301
tags question: http://stackoverflow.com/q/24209130
tags question: http://stackoverflow.com/q/24144449
tags question: http://stackoverflow.com/q/24183125
tags question: http://stackoverflow.com/q/24210559
tags question: http://stackoverflow.com/q/24231631
tags question: http://stackoverflow.com/q/24136223
tags question: http://stackoverflow.com/q/24171507
tags question: http://stackoverflow.com/q/24140785
tags question: http://stackoverflow.com/q/24215414
tags question: http://stackoverflow.com/q/24153328
tags question: http://stackoverflow.com/q/24157194
tags question: http://stackoverflow.com/q/24197610
tags question: http://stackoverflow.com/q/24215950
tags question: http://stackoverflow.com/q/24127176
tags question: http://stackoverflow.com/q/24242898
tags question: http://stackoverflow.com/q/24168217
tags question: http://stackoverflow.com/q/24184059
type: Tag
tags question: http://stackoverflow.com/q/24146089
tags question: http://stackoverflow.com/q/24223631
tags question: http://stackoverflow.com/q/24160748
tags question: http://stackoverflow.com/q/24256319
tags question: http://stackoverflow.com/q/24161845
tags question: http://stackoverflow.com/q/24259152
tags question: http://stackoverflow.com/q/24167780
tags question: http://stackoverflow.com/q/24129764
tag name: jdbc
tags question: http://stackoverflow.com/q/24257339
tags question: http://stackoverflow.com/q/24218540
tags question: http://stackoverflow.com/q/24186818
tags question: http://stackoverflow.com/q/24246352
tags question: http://stackoverflow.com/q/24130912
tags question: http://stackoverflow.com/q/24229442
tags question: http://stackoverflow.com/q/24144418
tags question: http://stackoverflow.com/q/24165920
tags question: http://stackoverflow.com/q/24188926
tags question: http://stackoverflow.com/q/24165529
tags question: http://stackoverflow.com/q/24217590
tags question: http://stackoverflow.com/q/24116476
tags question: http://stackoverflow.com/q/24203911
tags question: http://stackoverflow.com/q/24123649
tags question: http://stackoverflow.com/q/24215218
tags question: http://stackoverflow.com/q/24144706
tags question: http://stackoverflow.com/q/24174829
tags question: http://stackoverflow.com/q/24191493
tags question: http://stackoverflow.com/q/24111912
tags question: http://stackoverflow.com/q/24160031
tags question: http://stackoverflow.com/q/24198032
tags question: http://stackoverflow.com/q/24217306
tags question: http://stackoverflow.com/q/24214829
tags question: http://stackoverflow.com/q/24217656

http://stackoverflow.com/comment/37398901
type: QuestionComment
comment on: http://stackoverflow.com/q/24111349
score: 0
has text: This is O(n^3) btw.. It asks for an O(n) solution..
type: Comment

http://stackoverflow.com/q/24173810
has comment: http://stackoverflow.com/comment/37313912
has title: Filtering collections with simple domain specific languages
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
tagged with: pojo
score: 2
has body: I need the ability to filter a list of POJOs to have filter out items I don't care about. They're basically streams of POJOs... Say we have a stream of User objects with firstName, lastName, telephone, zipcode. I would want a simple expression like: firstName = 'John' and obviously this would only match objects which have that field. It would be ideal if we could do boolean logic such as: (firstName = 'John' or firstName = 'Allen') and lastName = 'Smith' I want the language to NOT support loops or arbitrary Java code. For example.Someone could just submit while(true) {} ... which would DoS a server. Further, functions and calling into the standard library isn't acceptable either. Otherwise they can submit System.exit(1). The filtering language used in wireshark is nice: http://www.wireshark.org/docs/wsug_html_chunked/ChCapCaptureFilterSection.html tcp port 23 and not src host 10.0.0.5 ... but I need something in Java.
has answer: http://stackoverflow.com/a/24173970
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37313901

http://stackoverflow.com/q/24256855
type: UnansweredQuestion
tagged with: java
has body: Entity interface: public interface Entity&lt;Id&gt; { Id getId(); } and the Dao: public interface Dao&lt;T extends Entity&lt;Id&gt;, Id&gt; { T find(Id id); } If I try to remove the second type parameter on Dao (Id) I get "Id cannot be resolved to a type". My question is if it's somehow possible to get rid of the second type parameter on Dao as it's essentially redundant. To be clear, I'm trying to avoid having to repeat the Id type everywhere that I'm using the Dao. It should be enough to specify that type once in the Entity interface. As it's now I have to repeat myself like this: private Dao&lt;Car, UUID&gt; carDb; everywhere that I'm using the Car Dao.
has answer: http://stackoverflow.com/a/24257807
tagged with: generics
has comment: http://stackoverflow.com/comment/37470864
has comment: http://stackoverflow.com/comment/37471049
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/37471831
upvote count: 3
answer count: 1
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37471013
has title: How to reference generic type parameter of generic type parameter?
score: 3
has comment: http://stackoverflow.com/comment/37472133

http://stackoverflow.com/q/24208380
has body: I have list of Comments that contains a list of Tags. I want to iterate over my list of Comments, and if one comment has a Tag DEPRECATE_OTHERS, I want to add a tag DEPRECATED to ALL other comments. So far I've been able to come up with a too cluttered solution, but I'm wondering if there's some facility that could help me make it cleaner: for (int i = 0; i &lt; comments.size(); i++) { Comment comment = comments.get(i); for (Tag tag : comment.getTags()) { if(MyEnum.DEPRECATE_OTHERS.equals(tag)) { for(int j = 0; j &lt; comments.size(); j++) { if(j != i) { comments.get(j).getTags().add(MyEnum.DEPRECATED) } } } } } OBS: I might have multiple DEPRECATE_OTHERS and I'd like to add multiple DEPRECATED flags in that case
downvote count: 0
upvote count: 1
tagged with: collections
has comment: http://stackoverflow.com/comment/37378327
favorite count: 0
has title: How to modify all elements except the current one when iterating
has comment: http://stackoverflow.com/comment/37378083
has comment: http://stackoverflow.com/comment/37378524
tagged with: java
has comment: http://stackoverflow.com/comment/37378476
has answer: http://stackoverflow.com/a/24208463
has comment: http://stackoverflow.com/comment/37378411
has answer: http://stackoverflow.com/a/24208537
type: Question
has comment: http://stackoverflow.com/comment/37378748
answer count: 2
has comment: http://stackoverflow.com/comment/37378370
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/127638076
type: AnswerComment
has text: This, to me, is more intuitive. - especially taking into consideration that here YOU CAN NOT assign that value to anything because that 'anything' must be final inside lambda. What a great advantage then
comment on: http://stackoverflow.com/a/43627779
score: 2
type: Comment

http://stackoverflow.com/q/24232833
tagged with: android-keypad
linked to: http://stackoverflow.com/q/5357455
upvote count: 2
type: AnsweredQuestion
score: 2
answer count: 2
downvote count: 0
has title: Is there a keypad widget for Android?
tagged with: java
tagged with: user-interface
has answer: http://stackoverflow.com/a/24233225
accepted answer: http://stackoverflow.com/a/24233225
favorite count: 0
type: Question
tagged with: android-studio
has body: I'm working on a checkbook app, and I'd like to use a small widget like a TimePickerDialog or DatePickerDialog but one that acts like a keypad so the user can enter an account or transaction balance. I know I can use an EditText but I would like to be able to implement a keypad. Does Android have any predefined UI elements to support this? I have tried to find some, but without luck. I did find an interesting article to implement my own using a GridLayout, but wondered if someone was aware of any Android classes that could already do this. The GridLayout method: http://code.tutsplus.com/tutorials/android-user-interface-design-creating-a-numeric-keypad-with-gridlayout--mobile-8677
tagged with: android
has answer: http://stackoverflow.com/a/24232928
possible better answer: http://stackoverflow.com/a/24232928

http://stackoverflow.com/comment/37295405
score: 1
type: QuestionComment
has text: you cannot create a system service unless you create your own ROM
comment on: http://stackoverflow.com/q/24164811
type: Comment

http://stackoverflow.com/q/24201481
answer count: 2
has body: I'm trying to color and make transparent the same JLabel When I click on it. int leftP=4; //initialized at start of code if (leftP&gt;0){ if (lbl.getBackground()!=Color.YELLOW){ lbl.setBackground(Color.yellow); lbl.setOpaque(true); leftP--; }else{ lbl.setOpaque(false); lbl.repaint(); leftP++; } } The problem here is that when leftP&gt;0 if checks if the Background of the Label is already Yellow. if it is ... it uncolor it but if its not it colors it. It works for the first time. I click on label and it becomes yellow and leftP=3. I reclick on label it becomes without yellow color as background and leftP=4. When I click the third time. I expect it to become Yellow with leftP=3 ... but unfortunately I don't understand why it remains without color and it continues entering in ELSE Loop whenever I click on label.
linked to: http://stackoverflow.com/q/18654930
has comment: http://stackoverflow.com/comment/37365570
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/24201543
score: 0
has title: JLabel coloring and making transparent
tagged with: colors
has comment: http://stackoverflow.com/comment/37365289
tagged with: java
has answer: http://stackoverflow.com/a/24201599
type: Question
tagged with: jlabel

http://stackoverflow.com/q/24119032
tagged with: java
has title: Logback rolling file appender - can I zip many logs into one file?
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24119427
favorite count: 0
has body: My current logback config looks like this: ${log.dir}/${log.package}.log ${log.pattern} ${log.dir}/${log.package}.%d{yyyy-MM-dd}.%i.log.zip <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> 1MB </timeBasedFileNamingAndTriggeringPolicy> 90 true This works fine but irritatingly creates multiple zip file ...1.zip ...2.zip etc. Is there any way I can specify the zip file name as ${log.dir}/${log.package}.%d{yyyy-MM-dd}.log.zip but the name of the files in the zip file as ${log.dir}/${log.package}.%i.log? I.e. make one zip file per day but each time the file reaches 1mb I zip it as ....1.log, ...2.log etc.
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24119427
tagged with: logback
linked to: http://stackoverflow.com/q/7934829
score: 2
tagged with: rollingfileappender
type: AnsweredQuestion

http://stackoverflow.com/comment/37464324
type: AnswerComment
has text: do you want to retrieve unique keys or values from Map? Simply loop over values and call `intersection.retainAll(values)`, check for size after it if `intersection.size()==0` then there is no need to iterate all the values, simply come out of the loop.
comment on: http://stackoverflow.com/a/24253171
score: 0
type: Comment

semaphore
type: Tag
tags question: http://stackoverflow.com/q/24251383
tag name: semaphore

http://stackoverflow.com/a/24207439
type: Answer
answers question: http://stackoverflow.com/q/24207155
has comment: http://stackoverflow.com/comment/37377229
has body: On second line you can assign an array of subclass (Manager [] mans) to a reference to an array of superclass (Employee[] emps). No problems on that... but after this line the real type of emps is Manager[] The real type of the array is determined at run-time and it is worth nothing it is referenced by a reference to Employee[], it sitll is an array of Manager. So emps[0] is expected to be of type Manager.
has comment: http://stackoverflow.com/comment/37377137
has comment: http://stackoverflow.com/comment/37376361
score: 0

http://stackoverflow.com/a/24177555
score: 53
upvote count: 53
accepted answer of: http://stackoverflow.com/q/24177516
downvote count: 0
answers question: http://stackoverflow.com/q/24177516
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/107271357
has body: Java 8+ LocalDate ld = LocalDate.of(2014, Month.JUNE, 12); System.out.println(ld); ld = ld.with(TemporalAdjusters.next(DayOfWeek.MONDAY)); System.out.println(ld); Which prints... 2014-06-12 2014-06-16 Because it's possible that the date my actually be a Monday, you could also use... ld = ld.with(TemporalAdjusters.nextOrSame(DayOfWeek.MONDAY)); Java &lt;= 7 You should be using the ThreeTen Backport, which gives you the support of the Java 8 Date/Time API Original Answer Instead of System.out.println(date1); use System.out.println(date1.getTime()); getTime returns an instance of Date which represents the current state of the Calendar Which will output Mon Jul 14 00:00:00 EST 2014 System.out.println(date1) is the equivlent of using System.out.println(date1.toString()), which, in this case, is dumping a bunch of useful info about the state of the Calendar object, but not really human readable data. System.out.println(date1.getTime()) will use the Date's to toString method to display a date value, formatted based on the current local settings, which will provide more useful information. Updated Instead of using GregorianCalendar, you should use the system Calendar, for example... Calendar date1 = Calendar.getInstance(); date1.set(2014, 06, 12); Also, months are 0 indexed, meaning that Janurary is actually 0 not 1, so in your example, you've specified the month as July, not June. So, instead, using... Calendar date1 = Calendar.getInstance(); date1.set(2014, 05, 12); while (date1.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { date1.add(Calendar.DATE, 1); } System.out.println(date1.getTime()); Which outputted... Mon Jun 16 16:22:26 EST 2014 Which is next Monday from today...more or less ;)
type: Answer

http://stackoverflow.com/comment/37459528
type: AnswerComment
comment on: http://stackoverflow.com/a/24250618
has text: thank you, I will try it now and tell you if it works :D
score: 0
type: Comment

http://stackoverflow.com/comment/37200010
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24113604
score: 0
has text: @user3553031 Can you run this one and give any suggestion on this.It really helpful for me ..

http://stackoverflow.com/q/24145120
downvote count: 0
upvote count: 1
has body: Issue with XML prefixes I would like to have the prefix always displayed on every child of my XML. For that, I annotated each of the classes with corresponding @Namespace(reference = "uri", prefix = "pre"), and annotated the attributes with @Namespace(reference = "uri"). So for some of my annotated classes, I get the expected result: <?xml version="1.0" encoding= "UTF-8" standalone="yes"?> <pre:myClass1 xmlns:pre="uri" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"> <pre:attr1>value1</pre:attr1> <pre:attr2>value2</pre:attr2> <pre:myClass1> But some others, I get this (unprefixed result): <?xml version="1.0" encoding= "UTF-8" standalone="yes"?> <myClass2 xmlns="uri" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"> value1 value2 <myClass2> As you can see, it gives the prefix xmime to the second namespace, and just puts the namespace uri to the current node, without putting the prefix everywhere. I know it is not supposed to change the meaning of the XML file, but the norm I have to follow specifies that the prefix should appear everywhere. Annotated Java classes My classes look like this: @NamespaceList(value = { @Namespace(reference = "http://www.w3.org/2005/05/xmlmime", prefix = "xmime"), @Namespace(reference = "uri", prefix = "pre") }) public abstract class Ancestor { ... } And both MyClass1 and MyClass2 extend Ancestor in the same way. @Namespace(reference = "uri", prefix = "pre") public class MyClass1 extends Ancestor { // Or MyClass2 @Element(required = false) @Namespace(reference = "uri") protected String attr1; @Element(required = false) @Namespace(reference = "uri") protected String attr2; } Why and how? Why is there such a difference in the XML output, and how to obtain the prefixed version? Could it even be a bug or so?
favorite count: 0
type: Question
tagged with: simple-framework
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-namespaces
has title: How to always display the prefix namespace in Simple framework?
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/37251144
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24140992
has text: You just did my Work Thanks A Lot.
type: Comment

http://stackoverflow.com/a/24127047
score: 0
answers question: http://stackoverflow.com/q/24126810
has body: You are trying to put string into a integer variable, so you get an integer value(id) instead of string. change int question = mQuestionBank[0].getQuestion(); to String question = mQuestionBank[0].getQuestion();
type: Answer

http://stackoverflow.com/q/24150521
downvote count: 1
score: 8
favorite count: 0
has comment: http://stackoverflow.com/comment/38558393
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38557876
tagged with: jndi
type: UnansweredQuestion
tagged with: glassfish-4
tagged with: glassfish
upvote count: 9
tagged with: java
linked to: http://stackoverflow.com/q/3431357
answer count: 1
has answer: http://stackoverflow.com/a/24308158
has body: I use EJB inside OSGi bundles. And now when I need to get EJB I have long jndi, for example: bean = (InterfaceName) ctx.lookup("java:global/longBundleName_version/OrganizationDirBean!and.plus.path.and.InterfaceName"); I want to change this part: longBundleName_version I mean, when I deploy bundle this part must be set from [glassfish-]application.xml or from [glassfish-]-ejb-jar.xml or from any other xml descriptor. I want jndi name for my ejb to be like: java:global/newBundleNameWithoutVersion/etc The problem that I can't find what I must set in these files. All variants I found in internet are not supported anymore and all I tried myself didn't work. Could you help me? Please, don't offer mappedName as it can be used only(!) for remote beans. I do use beans which are at the same time both local and remote. If someone is involved in glassfish development, could you at least point what bundles I must examine to find the question by myself? I will be very grateful.
has title: Glassfish 4: how to set application or module name for JNDI

http://stackoverflow.com/comment/37428419
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24151410
type: QuestionComment
has text: How much memory do you have on your machine?

http://stackoverflow.com/q/24114569
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24117003
tagged with: java
tagged with: http-headers
has body: I am building a webcrawler ( a tiny one). Few sites like NYTIMES checks for cookies whenever we visit them. It seems they first check cookie, if not available it sets it. If it goes wrong, it redirects to Login Page. Now, how this behavior can be handled using programming and prevent redirection.
tagged with: web-crawler
tagged with: jsoup
score: 2
upvote count: 2
type: UnansweredQuestion
downvote count: 0
answer count: 1
has title: How To handle cookies in a crawler
tagged with: http

http://stackoverflow.com/q/24138509
downvote count: 0
linked to: http://stackoverflow.com/q/16298279
answer count: 1
tagged with: jsch
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/37298136
has body: I'm having a requirement where I need to open one SftpChannel for file transfer and one exec channel to execute the commands on remote system.So,Can I open these channels using a single jsch object and single session object.If I can please give me a small code snippet or please do suggest me is there any other way to do this?
favorite count: 0
has title: Can I open more than one channel using single Jsch Object?
tagged with: linux
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/24166535
score: 2
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24166535

http://stackoverflow.com/a/24200140
upvote count: 3
has body: You can use MPJ Express and I assume that you have already given it a go and environment set up is done. MPJ Express can execute parallel Java applications on both multiocore mode and cluster mode. It must be mentioned there that the same application works for both modes without any modification so you have the option of developing and testing your application in multicore mode and when done it would seamly run cluster mode as well. Although It is not quite clear what you want to develop in the end but as far as its Java docs are concerned you can find them here: http://mpj-express.org/docs/javadocs/index.html. These are all the classes and methods that you need to develop any parallel java application. Learning cluster Programming with MPJ Express is quite easy as you can access a comprehensive set of working examples. For this purpose unzip MPJ Express and explore test directory. It contains multiple test cases and working examples of parallel Java applications. You can have examples of point-to-point and collective communication in mpj-v0_xx/test/mpi/pt2pt and mpj-v0_xx/test/mpi/ccl respectively. You can develop any basic parallel application by just using point-to-point and collective communication methods. It would give you head start in learning cluster Programming using Java. Let me know if you encounter any problem in setting up MPJ Express on cluster or executing examples provided in test directory. You can also post your queries on MPJ Express mailing list on following page: http://sourceforge.net/p/mpjexpress/mailman/?source=navbar
has comment: http://stackoverflow.com/comment/37403598
downvote count: 0
answers question: http://stackoverflow.com/q/24192426
has comment: http://stackoverflow.com/comment/37479112
has comment: http://stackoverflow.com/comment/37378741
score: 3
has comment: http://stackoverflow.com/comment/37476217
type: Answer
has comment: http://stackoverflow.com/comment/37378710
has comment: http://stackoverflow.com/comment/37476316

http://stackoverflow.com/comment/37373134
type: Comment
score: 0
has text: No.. Just one redirect
type: QuestionComment
comment on: http://stackoverflow.com/q/24196499

http://stackoverflow.com/comment/107370379
type: Comment
comment on: http://stackoverflow.com/a/39279776
type: AnswerComment
score: 0
has text: @Dave C - not disagreeing that this is a bit convoluted, having said that propose something better, I would love to see a simple way of abstract class implementation. All in all, If you do not need an abstract class like functionality simply DO NOT USE presented pattern.

http://stackoverflow.com/comment/37319322
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24177431
has text: I'm almost sure it's used for decimals.

http://stackoverflow.com/comment/37236363
comment on: http://stackoverflow.com/a/24132838
score: 0
type: Comment
type: AnswerComment
has text: @Nifty62 yes but you can change it later its just when you set it to 8 it will make that folder again the one that you deleted

http://stackoverflow.com/a/24112109
answers question: http://stackoverflow.com/q/24112096
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24112096
score: 20
upvote count: 20
has body: Pass false to the append parameter to overwrite the file: pw = new PrintWriter(new FileOutputStream("Foo.txt", false)); Passing true for the second parameter indicates that you want to append to the file; passing false means that you want to overwrite the file.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37197301

http://stackoverflow.com/comment/37262718
has text: I will see if I can push a pared down version of the project to github. It will take sometime though to strip it down so I don't intrude on IP rights of the company.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24132185
type: Comment

http://stackoverflow.com/comment/37204801
score: 0
type: Comment
has text: everything from main(String[] args) { should be moved to the constructor, super.doLayout(); should be inside renderer, put all pieces together, important question is Whats your goal,
type: QuestionComment
comment on: http://stackoverflow.com/q/24115907

http://stackoverflow.com/comment/37283444
score: 0
comment on: http://stackoverflow.com/q/24150017
has text: I would assume that `Message` either does something with `item` or exposes it through a getter. That's what I'd assert. I wouldn't assert on `toString()`, because many people (including me) only use it informally, for logging and debugging. Hence its format might change for reasons completely unrelated to the functionality you want to test. And you don't want to have to adapt your test every time that happens.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37304676
comment on: http://stackoverflow.com/a/24169573
type: AnswerComment
score: 0
has text: the file is a hundred thousand words, the algorithm takes a word and finds all Anagrams then sorts them in a HashMap with the Word(Key), and a ArrayList(Value) of the words anagrams.
type: Comment

http://stackoverflow.com/comment/37364849
comment on: http://stackoverflow.com/q/24201349
type: QuestionComment
has text: add one variable with @Column(name = "BUILDING_ID") and add insertable=false,updatebale=false in JoinColumn.
score: 0
type: Comment

http://stackoverflow.com/comment/37322006
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24170096
has text: I don't know: I've little experience with Swing.
type: Comment

http://stackoverflow.com/q/24232111
type: AnsweredQuestion
score: 3
upvote count: 3
downvote count: 0
has body: How to connect to server with different IP address I really don't know what to do... Let me explain first. i have a client and server that works great when sending messages between the two if i am on the same network as my computer. i have an android device and i would like to wish when ever i am placed far away and when i will click some button it will send message to server even if i am not on the same network. Client try { client = new Socket("IpAddress", 4444); BufferedReader in = new BufferedReader( new InputStreamReader(client.getInputStream())); printlng = new PrintWriter(client.getOutputStream()); printlng.println(mlng); printlng.flush(); while (true) { if ((Response= in.readLine()) != null) { Log.i("Response:", Response); dlng = Double.valueOf(Response); System.out.println(dlng); break; } } Server: public static void main(String[] args) { try { serverSocket = new ServerSocket(4444); // Server socket } catch (IOException e) { System.out.println("Could not listen on port: 4444"); } System.out.println("Server started. Listening to the port 4444"); while (true) { try { clientSocket = serverSocket.accept(); // accept the client inputStreamReader = new InputStreamReader( clientSocket.getInputStream()); bufferedReader = new BufferedReader(inputStreamReader); // get // the // client PrintWriter out = new PrintWriter( clientSocket.getOutputStream(), true); InputStream inputStream = new ByteArrayInputStream( bufferedReader.readLine().getBytes( Charset.forName("UTF-8"))); BufferedReader bufferedReader2 = new BufferedReader( new InputStreamReader(inputStream)); String output = bufferedReader2.readLine(); System.out.println(output.toString()); out.println(output.toString()); out.flush(); out.close(); inputStreamReader.close(); clientSocket.close(); } catch (IOException ex) { System.out.println("Problem in message reading"); } } }
tagged with: java
has answer: http://stackoverflow.com/a/24232226
possible better answer: http://stackoverflow.com/a/24232226
has title: Android java How to connect to server with different network/ip address
favorite count: 0
type: Question
answer count: 2
tagged with: network-programming
has answer: http://stackoverflow.com/a/24240268
tagged with: android
accepted answer: http://stackoverflow.com/a/24240268
tagged with: client

http://stackoverflow.com/a/24153946
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/24153477
has comment: http://stackoverflow.com/comment/37301039
has body: Given below are the steps to do this - (1) Create a domain Object for Department public class Department{ private String departmentName; private String departmentCode; //getters and setters omitted for brevity } (2) Create a RowMapper class to map the result set to the Department Object public class DepartmentRowMapper implements RowMapper&lt;Department&gt; { public Department mapRow(ResultSet rs, int rowNum) throws SQLException { Department department= new Department (); department.setDepartmentName(rs.getString("DEPT_NAME")); department.setDepartmentCode(rs.getString("DEPT_CODE")); return department; } } (3) Create the Dao class public class DepartmentDao private JdbcTemplate jdbcTemplate; //getters and setters omitted for brevity public Department getDepartment(int deptId){ return (Department)jdbcTemplate.queryForObject("SELECT DEPT_NAME FROM DEPT WHERE DEPT_ID = ?",new Object[] {deptId}, new DepartmentRowMapper ()); } }
downvote count: 1
type: Answer

http://stackoverflow.com/a/63682904
type: Answer
score: -1
answers question: http://stackoverflow.com/q/24208828
downvote count: 2
upvote count: 1
has body: @GetMapping(value = "getSunny/{userId}") public Map<String, SunnyVO> getSunny(@PathVariable int sunnyId) { Map<String, SunnyVO> newObj = new HashMap<String, SunnyVO>(); final String url = "http://localhost:8085/Sunny/getSunny/{sunnyId}"; RestTemplate restTemplate = new RestTemplate(); newObj = restTemplate.getForObject(url, Map.class, sunnyId); return newObj; } It is working for me ...

http://stackoverflow.com/q/24117071
type: Question
has comment: http://stackoverflow.com/comment/40004825
has comment: http://stackoverflow.com/comment/40005938
has body: I have some code written for the awt library. I want to port that to Android. But I'm not really sure hot to port a few methods. Here is what I have so far. The part that is commented out is the original awt code. The part that is not commented out, is my new Android code. I'm not sure if I can translate awt's t.translate() to Androids t.postTranslate(), along with some other lines of code. And I also don't know how to transport some other awt methods at all. So I'm looking for an answer how to port the below code to Android equivalent functionality. //AffineTransform t = new AffineTransform(); //Point2D.Float p = new Point2D.Float(); Matrix t = new Matrix(); PointF p = new PointF(); //t.setToIdentity(); //t.translate( cx+f*translateX, cy+f*translateY ); t.No Idea How To Set to Identity(); t.postTranslate(cx+f*translateX, cy+f*translateY); //t.scale( s, s ); t.postScale( s, s ); //t.rotate( -rotation*f ); t.postRotate(-rotation*f); //t.translate( -cx, -cy ); t.postTranslate(-cx, -cy); //t.transform( p, p ); //t.mapPoints(p); t.No Idea How TO Transform(); t.no Idea how to Map Pounts?();
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40002692
downvote count: 0
has comment: http://stackoverflow.com/comment/40007428
answer count: 0
score: 1
upvote count: 1
has title: Converting awt Math function to Android Math function
has comment: http://stackoverflow.com/comment/37206452
tagged with: java
has comment: http://stackoverflow.com/comment/37207206
linked to: http://stackoverflow.com/q/5783624
tagged with: awt
favorite count: 0

http://stackoverflow.com/a/24115189
has comment: http://stackoverflow.com/comment/37216293
answers question: http://stackoverflow.com/q/24113604
type: Answer
score: 2
upvote count: 2
has body: Your server (Java) is expecting a message from the client before it sends anything. It will block until it receives such a message. Since the server seems to not receive this message, either the client is not actually sending its message (ie, it's queueing it until it receives more data to send), or the server is expecting to receive more data. The documentation for DataInputStream.readUTF() claims that it expects length-prefixed strings. That's not what your client is writing. The server is probably interpreting the first two bytes of your string as a length, then trying to read that many bytes of data, Since there isn't that much data available, it's going to wait for more from the client. Try using BufferedReader.readLine() instead, and make sure that your client is sending a newline at the end of its output. If that doesn't work, try finding a way to flush the socket on the client side. I don't know Node.js, but a quick skim of the documentation suggests that socket.end() might help, although that won't work if you need to send more data later on.
downvote count: 0

jaxb
tags question: http://stackoverflow.com/q/24148848
tags question: http://stackoverflow.com/q/24138534
type: Tag
tags question: http://stackoverflow.com/q/24181638
tags question: http://stackoverflow.com/q/24116586
tag name: jaxb
tags question: http://stackoverflow.com/q/24127116
tags question: http://stackoverflow.com/q/24118103
tags question: http://stackoverflow.com/q/24116463
tags question: http://stackoverflow.com/q/24167833
tags question: http://stackoverflow.com/q/24117309
tags question: http://stackoverflow.com/q/24170393
tags question: http://stackoverflow.com/q/24168673
tags question: http://stackoverflow.com/q/24263042
tags question: http://stackoverflow.com/q/24131822
tags question: http://stackoverflow.com/q/24128132
tags question: http://stackoverflow.com/q/24152433
tags question: http://stackoverflow.com/q/24164735
tags question: http://stackoverflow.com/q/24160059
tags question: http://stackoverflow.com/q/24161121
tags question: http://stackoverflow.com/q/24230612
tags question: http://stackoverflow.com/q/24242923
tags question: http://stackoverflow.com/q/24250294
tags question: http://stackoverflow.com/q/24132884
tags question: http://stackoverflow.com/q/24251183
tags question: http://stackoverflow.com/q/24257815
tags question: http://stackoverflow.com/q/24228672
tags question: http://stackoverflow.com/q/24232708
tags question: http://stackoverflow.com/q/24180499
tags question: http://stackoverflow.com/q/24208087
tags question: http://stackoverflow.com/q/24201272
tags question: http://stackoverflow.com/q/24201825
tags question: http://stackoverflow.com/q/24138133
tags question: http://stackoverflow.com/q/24204177
tags question: http://stackoverflow.com/q/24150326

http://stackoverflow.com/a/24158563
score: 1
type: Answer
has body: I'm sorry, but you have to be more explicit. What do you intend to do exactly? Have you tryed to create a method the executes right after it leaves the sleep() that informs the main method? run() { while(true) { Thread.sleep(1000); animation.warn(); //Rest of the loop. } }
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/24158250

http://stackoverflow.com/q/24223003
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24223282
has body: In my database there are records having lat, lng columns. On the middle tier I use Tomcat/Servlets. Client side I use Leaflet. I want the servlet to create a GeoJSON response for all the records (lat, lng). Is there a tool available? Or, should I do it manually? Thanks
score: -1
has title: return GeoJSON from Java servlet
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19311526
upvote count: 0
tagged with: java
answer count: 1
tagged with: gis
accepted answer: http://stackoverflow.com/a/24223282
downvote count: 1

http://stackoverflow.com/comment/37674427
type: AnswerComment
has text: Hmmm...It does work. Nice. Although by now I changed my architecture so much it doesn't require this now. Will have this in in mind.
comment on: http://stackoverflow.com/a/24351588
type: Comment
score: 0

http://stackoverflow.com/comment/37188938
comment on: http://stackoverflow.com/a/24107702
score: 0
has text: ListUtils doesn't do it. it just deletes occurrences, but does not make any actions with elements at all.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37388110
comment on: http://stackoverflow.com/q/24213435
type: Comment
has text: The "some devices" part is probably because other countries use a comma as a decimal separator and those devices might default to that. A quick regex should fix that.
type: QuestionComment
score: 0

http://stackoverflow.com/a/24242843
score: 0
has body: you want to add extra information on the marker? If i understood correctly then you can add a snipper. LatLng mark = new LatLng(Double.parseDouble(lat), Double.parseDouble(longi)); map.addMarker(new MarkerOptions().title("MY Position").snippet("Extra info").position(mark));
type: Answer
answers question: http://stackoverflow.com/q/24241344

http://stackoverflow.com/comment/37403633
type: Comment
has text: Copy the error message here. It must tell you which class is not found. This error indicates a missing jar - we just need to find out which one.
type: QuestionComment
comment on: http://stackoverflow.com/q/24218442
score: 0

http://stackoverflow.com/comment/37385667
comment on: http://stackoverflow.com/q/24208202
has text: Have you tried debugging? The dashboard datasource must be null.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24246391
has comment: http://stackoverflow.com/comment/37556545
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37569214
has answer: http://stackoverflow.com/a/24252434
tagged with: linux
has comment: http://stackoverflow.com/comment/37478929
has comment: http://stackoverflow.com/comment/37450897
tagged with: mailx
has comment: http://stackoverflow.com/comment/37477698
has comment: http://stackoverflow.com/comment/37479091
has body: Since my SMTP provider has limit on number of emails that can be sent in a day, I wrote a Java code to call the "mailx" of Linux system, my java-program is running on. Here is that code: package sys.cmd; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; public class IntermediateJavaLinuxMailX { public static void main(String[]args) throws IOException{ email( new ArrayList&lt;String&gt;(){{ add("myemailid@myserver.com"); add("myothermailid@otherserver.com"); }}, "Error Message", "Hello World!\r\n This is message" ); } public static void email( List&lt;String&gt;toEmailIds, String subject, String msgText ) throws IOException{ String toEmails = toString(toEmailIds); String[]args=new String[]{"/bin/sh" , "-c", "mailx -s \""+subject+"\" "+toEmails}; System.out.println("The command for bash is: "+args[2]); Process proc= Runtime.getRuntime().exec(args); OutputStream o = proc.getOutputStream();//probable output for text InputStream i = new ByteArrayInputStream(msgText.getBytes());//probable input for message-text read2end(i, o); o.close(); } private static String toString(List&lt;String&gt; toEmailIds) { StringBuilder sb= new StringBuilder(); for(String toEmailId:toEmailIds){ sb.append(toEmailId).append(' '); } return sb.toString(); } private static void read2end(InputStream i, OutputStream o) throws IOException { byte[]b=new byte[1000]; for(int a=0;(a=i.read(b))&gt;-1;) o.write(b, 0, a); i.close(); } } The problem is: The email received on the recipients side, the text is not in the message-body, but it is in an attachment-file named "noname". The question is: How can I make the string in msgText appear in email's message-body. Adding one more thing I did so far: I wrote another code, that uses temporary files for storing message-text &amp; then uses file-redirection (&lt;) for adding message-text &amp; it gives desired result. But that is an indirect …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37569059
has comment: http://stackoverflow.com/comment/37450797
has title: Calling Linux's "mailx" through java code: message-text always goes into attachment
has comment: http://stackoverflow.com/comment/37564687
score: 1
has comment: http://stackoverflow.com/comment/37568225
tagged with: java
tagged with: email
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37568429
has comment: http://stackoverflow.com/comment/37451016
upvote count: 1
accepted answer: http://stackoverflow.com/a/24252434

http://stackoverflow.com/comment/37473548
comment on: http://stackoverflow.com/q/24258377
score: 1
type: Comment
type: QuestionComment
has text: That's not what you said before - "it returns" is very different from "the system kills the process". Which is it?

http://stackoverflow.com/comment/37263369
comment on: http://stackoverflow.com/q/24147557
has text: i tried but i am nt able to get what is the logic i should use
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37366331
has text: @BBHeeMAA You probably forgot to initialize myData
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24201647
type: QuestionComment

http://stackoverflow.com/comment/37221808
has text: Thanks for the suggestions. I already cache most GUI information inside the HTTP session object, some other information in memcache and still other pieces in the datastore. If I set the pending latencies to some rather high number things work semi-well. But there are still vexing situations where a request takes a bit too long and a new instance is spawned or where (like you point out) an instance just dies (these are becoming somewhat rarer).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24125009
type: Comment

http://stackoverflow.com/comment/37309171
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24171259
type: Comment
has text: It workes if I check if `rocedure[1].getClass() == Integer.TYPE` and then use `getDeclaredMethod((String)procedure[0], Integer.TYPE)`. I don't have to tell you, how ugly that looks. Java is so messed up!

http://stackoverflow.com/q/24217621
has body: I am new in Android and I don't really understand why a Fragment's content which was added dynamically (for example some image which was added after a button click) is disappearing after scrolling some count of Fragments and then come back. There is really simple code Activity and Fragment: public class MyActivity extends FragmentActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); final CustomAdapter adapter = new CustomAdapter(getSupportFragmentManager()); viewPager.setAdapter(adapter); } class CustomFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getView().findViewById(R.id.clickMeButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getView().findViewById(R.id.image).setVisibility(View.VISIBLE); } }); } } class CustomAdapter extends FragmentStatePagerAdapter { private List&lt;CustomFragment&gt; fragments = Arrays.asList( new CustomFragment(), new CustomFragment(), new CustomFragment() ); public CustomAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { return fragments.get(i); } @Override public int getCount() { return fragments.size(); } } } and appropriate xmls: main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;android.support.v4.view.ViewPager android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/viewPager" /&gt; &lt;/LinearLayout&gt; fragment.xml &lt…
type: AnsweredQuestion
score: 3
tagged with: android-viewpager
tagged with: android-fragments
tagged with: android
has title: Android Viewpager fragments refreshed when swiped
tagged with: android-pageradapter
answer count: 4
has answer: http://stackoverflow.com/a/24217697
possible better answer: http://stackoverflow.com/a/24217697
has answer: http://stackoverflow.com/a/24217695
accepted answer: http://stackoverflow.com/a/24217695
upvote count: 3
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24217859
has answer: http://stackoverflow.com/a/36860795
favorite count: 0
type: Question

http://stackoverflow.com/q/24217522
accepted answer: http://stackoverflow.com/a/24227476
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37396081
has comment: http://stackoverflow.com/comment/37399085
tagged with: jpa-2.1
has answer: http://stackoverflow.com/a/24220078
possible better answer: http://stackoverflow.com/a/24220078
tagged with: jpa
downvote count: 0
tagged with: annotations
type: AnsweredQuestion
answer count: 2
linked to: http://stackoverflow.com/q/2327971
has title: How to map a HashMap that contains ArrayList
has comment: http://stackoverflow.com/comment/37404296
tagged with: eclipselink
score: 1
upvote count: 1
has body: I am working on a Java project on my spare time, I started using JPA 2.1 and learning to use annotations. I have a class named Schedule that I want to contain this field: private HashMap<LocalDate, ArrayList<Lesson>> theLessons Lesson is another entity in my Database, LocalDate is the Java class. Is that possible? I tried to do it combining @OneToMany with @MapKey like in How do you map a "Map" in hibernate using annotations? but with no effect. I am thinking that maybe I will need to create other Entities to facilitate this, like maybe a ListOfLessons, that will contain the ArrayList<Lesson> in order to shorten the HashMap to : private HashMap<LocalDate, ListOfLessons> Any help welcome
tagged with: java
has answer: http://stackoverflow.com/a/24227476

http://stackoverflow.com/comment/128458942
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24145678
has text: it didn't work for me :( I get display not found error even though the ip is correct
type: Comment

http://stackoverflow.com/q/24235050
has comment: http://stackoverflow.com/comment/37458841
tagged with: swing
has comment: http://stackoverflow.com/comment/37486823
tagged with: performance
has comment: http://stackoverflow.com/comment/37429044
has comment: http://stackoverflow.com/comment/37429353
tagged with: java
has comment: http://stackoverflow.com/comment/37429087
has title: OpenGL (LWJGL) GL_QUADS behaves oddly
has body: I know all this stuff with glBegin \ glEnd is deprecated for years, but I was just experimenting and found strange behaviour of GL_QUAD rendering mode. I am making a map editor with LWJGL + Swing. So I am rendering the whole (at once) map of 256x256 tiles. I know it is wrong, but it is just a test. As you know, the fewer draw calls you make, the better. So according to the logic if I do something like this: glBegin(GL_QUADS); for (x = 0 to.. xSize) for (y = 0 to.. ySize) world.getTile(x, y).render(); glEnd(); It will be much faster than: for (x = 0 to.. xSize) for (y = 0 to.. ySize) { glBegin(GL_QUADS); world.getTile(x, y).render(); glEnd(); } But the practise shows the opposite. Here are the screens. 1st way (1 drawCall): 2nd way (many drawCalls): if you'd like to see the actual code for rendering there it is: 1) if (needsRecompile) { needsRecompile = false; glNewList(terrainList, GL_COMPILE); GRenderEngine.startDrawingQuads(); for (int i = 0; i &lt; world.xSize; i++) { for (int j = 0; j &lt; world.ySize; j++) { Tile t = world.getTile(i, j); t.renderTile(world, i, j); } } GRenderEngine.stopDrawing(); glEndList(); } 2) if (needsRecompile) { needsRecompile = false; glNewList(terrainList, GL_COMPILE); for (int i = 0; i &lt; world.xSize; i++) { for (int j = 0; j &lt; world.ySize; j++) { GRenderEngine.startDrawingQuads(); Tile t = world.getTile(i, j); t.renderTile(world, i, j); GRenderEngine.stopDrawing(); } } glEndList(); } What is wrong with this or I do not understand something well? EDIT: Just made another test: if (needsRecompile) { needsRecompile = false; glNewList(terrainList, GL_COMPILE); int sectors = 2; for (int k = 0; k &lt; sectors; k++) { GRenderEngine.startDrawingTriangles(); for (int i = world.xSize/sectors*k; i &lt; world.xSize/sectors*(k+1); i++) { for (int j = 0; j &lt; world.ySize; j++) { Tile t = world.getTile(i, j); t.renderTile(world, i, j); } } GRenderEngine.stopDrawing(); } glEndList(); } Now it gives almost 0% CPU usage, the best perfomance. And…
type: Question
has comment: http://stackoverflow.com/comment/37429009
has comment: http://stackoverflow.com/comment/37491974
score: 0
answer count: 0
tagged with: opengl
type: UnansweredQuestion
tagged with: lwjgl

http://stackoverflow.com/q/24229739
has answer: http://stackoverflow.com/a/24229963
accepted answer: http://stackoverflow.com/a/24229963
has title: Broadcasting Objects to multiple clients
type: Question
has body: Currently I try to implement a Server/Client - Application and came up with a problem, I cant find a solution for. Im running a Server, which is waiting for Clients to login, adding them to a cachedThreadPool and starting a new Runnable for each Client, to handle their individual requests etc. Now there are some answers to these requests, which have to be broadcasted after the server did his processing. this.mOos = new ObjectOutputStream(this.mSocket.getOutputStream()); this.mOos.flush(); this.mOis = new ObjectInputStream(this.mSocket.getInputStream()); while(true) { Object o = this.mOis.readObject(); if(o !=null &amp;&amp; this.mInputList.size() &lt; 20) { this.mInputList.add(o); } if(!this.mInputList.isEmpty()) { handleIncomingObject(); } if(!this.mOutputList.isEmpty()) { try { this.mOos.writeObject(this.mOutputList.remove(0)); this.mOos.flush(); this.mOos.reset(); } catch (IOException e) { e.printStackTrace(); } } } Now what I'm having trouble with is, that when I process a request in: handleIncomingObject(); which needs to be broadcasted. My approach is to give a reference to the ExecutorService Object, when I create the runnable, to have access to the threadpool IN the different threads. As you may see, every client got his own LinkedList&lt;Object&gt; mInputList LinkedList&lt;Object&gt; mOutputList to buffer incoming and outgoing messages. In handleIncomingObject() I'd like to do something like: //assume exec as ExecutorService for(Thread t : exec) { mOutputList.add(new Message(message)); } Thanks in advance any every help or suggestions. Greetings, Ben.
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
tagged with: broadcasting

http://stackoverflow.com/q/24168856
tagged with: java
has answer: http://stackoverflow.com/a/24174955
has body: So I'm programming a game in Processing where a character moves in 4 directions, and wherever it moves, it stores its coordinate in a 2D array on a 500x700 dimension. If the character moved to coordinate (5,10) per say, then array[5][10] will be set to 1. Otherwise, 0. What I want to find is an rectangular enclosed area in this array. How will I even go on about doing this? I have no idea and I've tried everything by trial and error but could someone help me out? Thank you in advance! Edit **** So let's say I have a 2D array of 10x10: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 My question is, when there is a surrounding "rectangle" of 1, how will I search for that? For example: 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 the 1's that start from [1][1] should be detected as a rectangle of area 42. 6 in width and 7 in length. What I've tried was to run through the array with a for-loop then whenever there is a 1, searched the length and height, and determined if existed on the other side, the same length at position "n" away. Is this appropriate to do so? What would be a more efficient solution?
has comment: http://stackoverflow.com/comment/37314378
has comment: http://stackoverflow.com/comment/37314022
has title: Find an enclosed area in a 2D array
tagged with: arrays
answer count: 1
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/37303153
favorite count: 0
type: Question
tagged with: 2d
type: UnansweredQuestion
score: -2

http://stackoverflow.com/a/24126230
has comment: http://stackoverflow.com/comment/37225490
type: Answer
has comment: http://stackoverflow.com/comment/37230860
score: 0
has body: Is there any other way to detect on the client side that all data was sent so the socket can be disconnected without data loss on the server side? Your assumption that data will be lost if you just close the socket is incorrect. TCP will ensure that all pending data is delivered if you close the socket normally. Just close the socket. No sleep necessary. If you want to know that the peer received all the data, shutdown the socket for output and have the peer send an application-protocol acknowledgement when it reads end-of-stream before it closes the socket. At the sender, read this acknowledgement after you do the shutdown and before you close. If you get it, all is well.
answers question: http://stackoverflow.com/q/24123373

http://stackoverflow.com/a/24248522
has comment: http://stackoverflow.com/comment/37614902
answers question: http://stackoverflow.com/q/24178568
has comment: http://stackoverflow.com/comment/37615072
has comment: http://stackoverflow.com/comment/37473970
score: 1
has body: According to the IAP Reference: public Offset getOffset() Returns an Offset that you can pass to PurchasingManager.initiatePurchaseUpdatesRequest(Offset) if isMore() indicates that more results are available. In the IAP Quick Start Guide, it said: If PurchaseUpdatesResponse.isMore() returns true, make a recursive call to PurchasingManager.initiatePurchaseUpdatesRequest() with the value returned in PurchaseUpdatesResponse.getOffset(). @yasiriqbal776, I think you may have misread the documentation. Otherwise, can you please provide the URL to the documentation you're referring to?
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24178568

http://stackoverflow.com/q/24223780
duplicate of: http://stackoverflow.com/q/1834826
answer count: 0
upvote count: 2
downvote count: 0
has body: I am using NetBeans IDE and I get this warning when writing a simple class that can play a WAV file: As shown in the picture the same message appears at several parts in the sourcecode. Is the Java audio API outdated? If so, what can I adjust in my code to get rid of this warning? public class Sound{ private AudioStream sound; public Sound(String location){ try{ InputStream file = new FileInputStream(location); sound = new AudioStream(file); } catch(IOException error){ //error } } public void play(){ AudioPlayer.player.start(sound); } } Thanks in advance!
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37407346
has comment: http://stackoverflow.com/comment/37407358
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2416935
linked to: http://stackoverflow.com/q/1834826
has comment: http://stackoverflow.com/comment/37407331
has comment: http://stackoverflow.com/comment/37407530
has title: Warning When using AudioPlayer in Java
has comment: http://stackoverflow.com/comment/37407305
score: 2
tagged with: audio
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37407409

http://stackoverflow.com/a/24208456
answers question: http://stackoverflow.com/q/24183146
has comment: http://stackoverflow.com/comment/37400269
has comment: http://stackoverflow.com/comment/37400707
has body: You should never let an exception thrown in service layer arrive directly in user browser. As suggested by Vinit Prajapati you can configure a HandlerExceptionResolver that will display appropriate views in case of an exception. You can also have a per controller exception handling mechanisme with one or more @ExceptionHandler annotated method(s) that will be fired in case of a configured exception and that can be used almost like @RequestMapping annotated methods. At a last ressort you can have explicit try-catch blocks in controller methods. Extracts from Spring Framework Reference Manual : You use the @ExceptionHandler method annotation within a controller to specify which method is invoked when an exception of a specific type is thrown during the execution of controller methods ... The @ExceptionHandler value can be set to an array of Exception types. If an exception is thrown matches one of the types in the list, then the method annotated with the matching @ExceptionHandler will be invoked ... Much like standard controller methods annotated with a @RequestMapping annotation, the method arguments and return values of @ExceptionHandler methods are very flexible... The return type can be a String, which is interpreted as a view name or a ModelAndView object. In my own code, I use @ExceptionHandler for general errors such as unaccessible database, but use try-catch blocs in controller if I want to deal with exceptions really caused by business rules and for which I prefere to use <form:errors> tags in the view, explicitely calling Errors.reject() in controller. EDIT: concrete examples Suppose you want to display special view in case of DataIntegrityViolationException In controller @ExceptionHandler(value = {DataIntegrityViolationException.class}) public ModelAndViewexceptionHandler(Exception ex, Locale locale) { String msg = ex.getMessage(); // or if you have a I18n app : String msg = messageSource.getMessage("DUPKEY", null, locale); return new ModelAndView("duplic…
upvote count: 5
has comment: http://stackoverflow.com/comment/37401612
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24183146
has comment: http://stackoverflow.com/comment/37401852
has comment: http://stackoverflow.com/comment/37401872
score: 4
has comment: http://stackoverflow.com/comment/37401797
has comment: http://stackoverflow.com/comment/37401752
has comment: http://stackoverflow.com/comment/37401225
has comment: http://stackoverflow.com/comment/111275959
has comment: http://stackoverflow.com/comment/37400343
has comment: http://stackoverflow.com/comment/37401520
has comment: http://stackoverflow.com/comment/37382428
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/37400391

http://stackoverflow.com/a/37576507
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24218532
has body: Run orb in console your system start orbd -ORBInitialPort 1050 Run YourServer.java -ORBInitialPort 1050 -ORBInitialHost localhost Run YourClient.java -ORBInitialPort 1050 -ORBInitialHost localhost great tutorial: Tutorial for CORBA Hello World using Java
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24218532
upvote count: 1
has comment: http://stackoverflow.com/comment/62664601

http://stackoverflow.com/comment/37427557
type: AnswerComment
comment on: http://stackoverflow.com/a/24234298
type: Comment
has text: @ryvantage Depending on how many reads there are after a write, if you really need speed, you can copy the `Map` to an `Item[]` once all the items are inserted. Obviously the read won't be as fast from a `Map` as from an array, but if you have a good `hashCode` then a `HashMap` is actually very similar to an array access.
score: 0

http://stackoverflow.com/a/24118834
score: 1
type: Answer
has body: You already have it, if you removed the unnecessary key ? Otherwise, create an entryset loop over, and add the required key/values pairs to your new/other hashmap. You can also use a sortedmap, or navigablemap which has additonal functionality for filtering a range. or if using jdk 8 you can uses its uber cool new functioanlity : m.entrySet().stream() .filter(p -&gt; p.getKey() &gt; 1) // or whatever you want .collect(toMap(Entry::getKey, Entry::getValue));
answers question: http://stackoverflow.com/q/24118787
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37209254

http://stackoverflow.com/comment/37400621
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24220258
has text: It looks like you need to do B's logic in C and remove B altogether. You never need an activity in android if it has no View.
type: Comment

http://stackoverflow.com/comment/37233227
has text: Please clarify. What do you mean by set annotations?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24131327
type: Comment

http://stackoverflow.com/q/24125540
has body: I'm creating a very general annotation processor (e.g. xjc) which scans my source and generates extra classes based on it. Ideally the domain-specific library should depend on the annotation processor library (which has no knowledge of the domain). Two of the fields that I'm placing in the annotation processor are minVersion and maxVersion. The code would look something like this: @ProcessMe(minVersion=Version.1_3_5, maxVersion=Version.1_5) private Foo fieldFoo; The goal would be for the annotation processor to create an object which only does special processing if the version of the request is between 1.3.5 and 1.5. Unfortunately, for this to work, the annotation processor needs to know about @ProcessMe and @ProcessMe needs to know about Version and Version is domain specific. My original thought was that I would have a VersionInfo interface which Version implements (all I need is to be able to enumerate the possible values and compare them). Unfortunately, even if VersionInfo extends Enum I am unable to specify it in the annotation as annotations can only include primitive, string, class, annotation, enumeration, and 1-D arrays of the above. So, can anyone think of a way to make this work that doesn't require the annotation processor to have domain specific knowledge (the version is domain specific because one product may use a completely different versioning scheme than another product).
tagged with: annotations
has answer: http://stackoverflow.com/a/24125709
type: AnsweredQuestion
score: 0
tagged with: enums
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/24125709
has title: Enum placeholder in library class
type: Question

http://stackoverflow.com/q/24174935
upvote count: 1
favorite count: 0
type: Question
tagged with: rest
tagged with: ejb
type: UnansweredQuestion
has title: JAAS custom LoginModule
has answer: http://stackoverflow.com/a/25198431
has body: I'm trying to write my costum LoginModule to be used in my REST service with Basic authorization. For this I made following: I wrote my own LoginModule that is called QuarkLoginModule. Added following snippet to web.xml: researcher SecurityConstraint <web-resource-collection> Schedule /ws/* </web-resource-collection> researcher NONE BASIC quark Created file in /ejb/src/main/resources/META-INF/login.config with following contents: quark { edu.quark.auth.QuarkLoginModule required debug=true; } Added following to JBoss runtime configuration to VM arguments section: "-Djava.security.auth.login.config=/home/desertfox/Dresden/cbse/quark/ams-quark-1/ejb/src/main/resources/META-INF/login.config" Added following snippet to standalone.xml: <module-option name="roles" value="researcher"/> <module-option name="realm" value="quark"/> But instead of calling my LoginModule I receive a error message about wrong name/password all the time. And I get following exception: 02:43:44,825 ERROR [org.jboss.security.authentication.JBossCachedAuthenticationManager] (http-localhost-127.0.0.1-8080-1) Login failure: javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:270) [picketbox-4.0.7.Final.jar:4.0.7.Final] at org.jboss.security.auth.spi.UsersRolesLoginModule.login(UsersRolesLoginModule.java:155) [picketbox-4.0.7.Final.jar:4.0.7.Final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21] at javax.security.auth.login.LoginContext.invoke(LoginContext.java:784) [rt.jar:1.7.0_21] at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203) [rt.jar:1.7.0…
tagged with: jaas
score: 1
tagged with: java
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/37310363
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24172298
has text: I have a laptop with a ` and / key though. It's just that the key codes for them are different. Other keys such as numbers, letters and keys like Enter, Backspace, Home etc are fine however.

http://stackoverflow.com/comment/37473042
type: AnswerComment
comment on: http://stackoverflow.com/a/24255545
has text: Hm. I will try to fix that myself later, but do you have a solution for the problem I had with thing being requested as finals? us and c were no problem, but when I had to move the other code into void run() the game no longer ended when hp reached 0
type: Comment
score: 0

http://stackoverflow.com/comment/37407394
type: QuestionComment
type: Comment
score: 0
has text: possible duplicate of [Can I embed a custom font in an Android application?](http://stackoverflow.com/questions/3424165/can-i-embed-a-custom-font-in-an-android-application)
comment on: http://stackoverflow.com/q/24223783

bit-manipulation
tags question: http://stackoverflow.com/q/24116015
tags question: http://stackoverflow.com/q/24224687
tag name: bit-manipulation
tags question: http://stackoverflow.com/q/24239275
type: Tag

javabeans
tags question: http://stackoverflow.com/q/24110532
tags question: http://stackoverflow.com/q/24159023
tags question: http://stackoverflow.com/q/24207039
tags question: http://stackoverflow.com/q/24141904
tags question: http://stackoverflow.com/q/24156813
tags question: http://stackoverflow.com/q/24183780
tag name: javabeans
type: Tag

http://stackoverflow.com/comment/37339016
type: QuestionComment
comment on: http://stackoverflow.com/q/24187762
has text: Not really. I know that I should use forward slash, I'm just unclear why Windows gives me the address in a different way
score: 0
type: Comment

http://stackoverflow.com/q/24128895
has title: Should this drl compile?
answer count: 1
type: Question
has body: I'm working on a project that runs Drools 5.5 for a promotion engine system. I'm having some trouble trying to understand the compilation step when i'm building the KnowledgeBase. This is the case: I have a drl that performs a collect (LHS) on a list with the condition size >= int. The system that generates the drl, did it wrong and now i'm having runtime exceptions. Now, i'm trying to understand how the compilation works on drools for this case. The thing is, on this collect, the constraint (size >= something , where something is not an integer) is not validated by the drools 5.5 compiler, and the exception will only explode in runtime: $COLLECT_ALL : ArrayList (size &gt;= something) from collect ( Product ( ... ) ) But, the same code is validated on drools 5.0.0 and i'm able to remove this rule before the KnowledgeBase creation. I don't know if that is a bug or just a miss understanding of the LHS on drools. Anyway, this is the validation step that i'm working on KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(); builder.add(ResourceFactory.newByteArrayResource(rule.getBytes()) , ResourceType.DRL); if (builder.hasErrors()) { createErrorMessage(builder); }
tagged with: drools
has answer: http://stackoverflow.com/a/24132412
tagged with: mvel
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/37363281
type: QuestionComment
comment on: http://stackoverflow.com/q/24200712
score: 3
has text: Which java-version do you use? `ProcessBuilder.Redirect` is available from java 7
type: Comment

http://stackoverflow.com/comment/37425681
score: 0
has text: No, it is an [javafx Image](http://docs.oracle.com/javafx/2/api/javafx/scene/image/Image.html)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24233364

http://stackoverflow.com/comment/37301322
score: 0
has text: Also, note the comment on the `end_pc` of the exception table. The compiler probably limits a method to 64k - 1 bytes because of this.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24152414

http://stackoverflow.com/a/24208537
upvote count: 2
type: Answer
has body: There are a few methods you could use to simplify this code. Using for each iteration, Collection.contains() and object equality you could get it down to this: for (Comment comment : comments) { if(comment.getTags().contains(MyEnum.DEPRECATE_OTHERS))) { for (Comment otherComment : comments) { if (otherComment != comment) { otherComment.getTags().add(MyEnum.DEPRECATED) } } } } As Adam says, two separate iterations would be neater still.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37378764
answers question: http://stackoverflow.com/q/24208380

http://stackoverflow.com/a/60509917
score: 0
answers question: http://stackoverflow.com/q/24244621
type: Answer
has comment: http://stackoverflow.com/comment/107067038
has body: Instead of using the query hint 'javax.persistence.query.timeout', you should use 'javax.persistence.lock.timeout'. In the latter case, if the query does not return within the specified milliseconds you'll receive a CannotAcquireLockException. In the first case, if the transaction does not finish within the specified milliseconds, you'll receive a QueryTimeoutException and the transaction will be rolled back.

http://stackoverflow.com/q/24162328
has comment: http://stackoverflow.com/comment/37293913
has comment: http://stackoverflow.com/comment/37295350
favorite count: 0
type: AnsweredQuestion
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/24181294
has comment: http://stackoverflow.com/comment/37323825
has body: I want to turn a Settings class into an OSGI declarative service which e4 can inject. I have created the service in OSGI-INF/settingsService.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.recommenders.privacy.rcp"&gt; &lt;implementation class="org.eclipse.recommenders.privacy.rcp.PrivacySettingsService"/&gt; &lt;service&gt; &lt;provide interface="org.eclipse.recommenders.privacy.rcp.IPrivacySettingsService"/&gt; &lt;/service&gt; &lt;/scr:component&gt; And I have annotated the variable with @Inject as described here: http://toedter.com/2010/06/28/eclipse-4-0-dependency-injection-and-osgi-declarative-services/ @Inject private IPrivacySettingsService privacySettingsService; But I am getting a NullPointerException.
score: 1
has comment: http://stackoverflow.com/comment/37295747
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24181294
type: Question
tagged with: e4
has title: Eclipse 4 Injecting an OSGI Service
has comment: http://stackoverflow.com/comment/37325221
downvote count: 0
answer count: 1
upvote count: 1

http://stackoverflow.com/comment/37369023
comment on: http://stackoverflow.com/a/24203713
score: 0
type: AnswerComment
type: Comment
has text: Good call regarding the possible logging issues this might cause, didn't even think about that.

http://stackoverflow.com/comment/37402261
score: 0
type: Comment
type: QuestionComment
has text: Unfortunately I still can't solve my problem. Can anyone just simply tell me how to make this work with fragments?
comment on: http://stackoverflow.com/q/24220675

http://stackoverflow.com/comment/37437501
comment on: http://stackoverflow.com/q/24239558
has text: then how would you implement such functionality? Is there a way to filter messages in a single JMS queue?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24161845
has answer: http://stackoverflow.com/a/24161927
has answer: http://stackoverflow.com/a/24161928
downvote count: 0
has answer: http://stackoverflow.com/a/24162267
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37289350
score: 5
linked to: http://stackoverflow.com/q/5145637
accepted answer: http://stackoverflow.com/a/24161928
possible better answer: http://stackoverflow.com/a/24161927
answer count: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/37289867
tagged with: database
tagged with: jdbc
has title: how can i retrieve data from multiple databases in a single query?
has body: if i have multiple database with same Tables and Columns how can i retrieve Data from those Databases using single Query in Java. Done this for single Database, i am newbie in java, please suggest. public class MultipleDBTest{ public void dbConnect(String db_connect_string, String db_userid, String db_password){ try{ Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password); System.out.println("connected"); Statement statement = conn.createStatement(); String queryString = "select &lt;Col1&gt;, &lt;Col2&gt; from &lt;Table&gt;"; ResultSet rs = statement.executeQuery(queryString); while(rs.next()){ System.out.println(rs.getString(1) + " | " + rs.getString(2)); } } catch(Exception e){ e.printStackTrace(); } } public static void main(String[] args){ ConnectMSSQLServer connServer = new ConnectMSSQLServer(); connServer.dbConnect("jdbc:sqlserver://localhost;databaseName=&lt;Database1&gt;","&lt;Username&gt;","&lt;Password&gt;"); } }
has answer: http://stackoverflow.com/a/53983690
tagged with: sql-server
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24162011
has comment: http://stackoverflow.com/comment/37290703
has comment: http://stackoverflow.com/comment/37289741
tagged with: connectivity
tagged with: java

http://stackoverflow.com/comment/37406232
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24222964
has text: @Squonk fair enough. If you need persistent notifications, at whatever interval, however, the AlarmManager is the *only* way to accomplish it.
score: 0

http://stackoverflow.com/a/24116256
upvote count: 12
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24114932
has body: The property "foo":"bar" consumes 11 bytes in UTF-8 encoded JSON. In BSON it consumes 13: bytes description ============================================ 1 entry type value \x02 3 "foo" 1 NUL \x00 4 int32 string length (4 -- includes the NUL) 3 "bar" 1 NUL \x00 There are many cases in which JSON will be more compact.
score: 12

http://stackoverflow.com/q/24221552
score: 4
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5986050
tagged with: random
has comment: http://stackoverflow.com/comment/37402999
has answer: http://stackoverflow.com/a/24221711
accepted answer: http://stackoverflow.com/a/24221680
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/24221680
has answer: http://stackoverflow.com/a/24221618
has body: Does the random object always contains a seed, even when not given one? And if so is it possible to get this seed? Motivation: I want my program to be random but i want to be able to reproduce it whenever i want. What i currently do is generate a random number, store it and put it as seed into another Random object that i use for the actual program. This way i can look up the generated seed if i want to reproduce anything. I would like to know this for Java and C# since these are my main languages and this question struck me a couple times working in both languages.
favorite count: 0
type: Question
upvote count: 4
tagged with: c#
has title: Get seed of Random object without passing in the seed?
has comment: http://stackoverflow.com/comment/37403058
has answer: http://stackoverflow.com/a/24221644
possible better answer: http://stackoverflow.com/a/24221618

http://stackoverflow.com/q/24142751
tagged with: java
has title: Are methods in namedParameterJdbcTemplate asynchronous?
has comment: http://stackoverflow.com/comment/37451419
answer count: 0
tagged with: frameworks
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37254832
has body: I am inserting into a database using namedParameterJdbcTemplate.update(sql("num_ids"), params); and immediately after running a query to count the number of objects in a database during a Maven test, like so: int count = jdbcTemplate.queryForInt("select count(*) from num_ids where id = '123'); My test fails, as the number of objects in the count query returns 0 when it should be 1. Is this possibly do to an asynchronous nature of the update() method, and if so, what is a correct way to ensure my test runs after the update() method has been completed? EDIT: Not sure if this matters, but this test passes on Java 6 but fails on Java 8.
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37254084
tagged with: sql

http://stackoverflow.com/a/24243447
has comment: http://stackoverflow.com/comment/37445461
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37445050
has body: Your ListView lv1 is null as you can see here: java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: java.lang.NullPointerException .... com.example.taxitabriz.MainActivity.onCreate(MainActivity.java:55) The line 55 of MainActivity should be this call: lv1.setAdapter(listAdapter); Make sure that your listView1 is included within the layout and initialized correctly prior to trying to set an Adapter to it.
has comment: http://stackoverflow.com/comment/37444983
has comment: http://stackoverflow.com/comment/37445380
type: Answer
accepted answer of: http://stackoverflow.com/q/24243161
has comment: http://stackoverflow.com/comment/37446015
answers question: http://stackoverflow.com/q/24243161
score: 0

http://stackoverflow.com/comment/119220135
type: Comment
has text: For my part I read the question as how to format the date part ignoring the time part. And for my part I think I’d add `Locale.forLanguageTag("tr")` and `Locale.getDefault()` Up to you, of course.
type: AnswerComment
comment on: http://stackoverflow.com/a/67449876
score: 1

http://stackoverflow.com/comment/37338437
type: Comment
has text: Sorry, contrived to paste the wrong link in. Read this: http://stackoverflow.com/questions/14187963/passing-parameters-javafx-fxml/
type: QuestionComment
comment on: http://stackoverflow.com/q/24187483
score: 0

http://stackoverflow.com/comment/37461519
comment on: http://stackoverflow.com/q/24250717
type: Comment
has text: Based on your disconnected code snippets, your Thread.sleep example shouldn't work at all, as it would be blocking the EDT. I can't make heads or tails of the drawing loop. Consider providing a runnable example which demonstrates your problem
type: QuestionComment
score: 2

http://stackoverflow.com/comment/37442461
score: 1
has text: Or Print `attribute` to check what values you are getting..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24242224

http://stackoverflow.com/q/24144951
has title: javafx how to get selected row data in table view with checkbox
tagged with: javafx-2
favorite count: 0
type: Question
upvote count: 2
score: -3
downvote count: 5
has body: In this project I can't get whether the Checkbox data was selected or not in the console output. My code: import java.util.Arrays; import java.util.Iterator; import java.util.List; import javafx.application.Application; import javafx.beans.Observable; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellEditEvent; import javafx.scene.control.TablePosition; import javafx.scene.control.TableView; import javafx.scene.control.cell.CheckBoxTableCell; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; import javafx.util.Callback; public class TableWithCheckbox extends Application { final TableView&lt;Player&gt; table = new TableView&lt;Player&gt;(); ObservableList&lt;Player&gt; data ; @Override public void start(Stage primaryStage) { final BorderPane root = new BorderPane(); table.setItems(createData()); final TableColumn&lt;Player, String&gt; firstNameColumn = new TableColumn&lt;&gt;("First Name"); final TableColumn&lt;Player, String&gt; lastNameColumn = new TableColumn&lt;&gt;("Last Name"); final TableColumn&lt;Player, Boolean&gt; injuredColumn = new TableColumn&lt;&gt;("Injured"); firstNameColumn.setCellValueFactory(new PropertyValueFactory&lt;Player, String&gt;("firstName")); lastNameColumn.setCellValueFactory(new PropertyValueFactory&lt;Player, String&gt;("lastName")); inju…
type: AnsweredQuestion
tagged with: javafx-8
accepted answer: http://stackoverflow.com/a/24145872
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24145872
answer count: 1

http://stackoverflow.com/q/24118736
score: 0
has title: using jetty to test a method that performs http post
has body: I am writing a junit test for a program that performs HTTP post, I am trying to use jetty to handle the request, but I can't find good examples or explanation on how to use it for that purpose, does anyone have a good example on how to do that?
accepted answer: http://stackoverflow.com/a/24160593
tagged with: java
has answer: http://stackoverflow.com/a/24160593
type: AnsweredQuestion
answer count: 2
possible better answer: http://stackoverflow.com/a/24119124
tagged with: junit
tagged with: jetty
has answer: http://stackoverflow.com/a/24119124
type: Question

http://stackoverflow.com/q/24202194
has comment: http://stackoverflow.com/comment/37434252
has comment: http://stackoverflow.com/comment/37425676
has answer: http://stackoverflow.com/a/32128199
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6593592
tagged with: gradle
tagged with: android-studio
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37370269
downvote count: 0
has comment: http://stackoverflow.com/comment/37369888
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37370132
has body: Is there a way to access versionName in my build.gradle from xml? I would like to set a TextView's text with this value. Or maybe declare a string with the version in strings.xml and use that in build.gradle? Is there nothing simple like @android:strings:version?
type: Question
has comment: http://stackoverflow.com/comment/37369898
tagged with: android
has title: Access versionName in build.gradle
tagged with: java

http://stackoverflow.com/comment/37292233
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24162737
has text: Thanks, this was exactly the kind of answer I was looking for.
score: 0

http://stackoverflow.com/a/24209713
score: 0
has body: With spring you can pass getBeanNamesForType(Class type) method an interface class name and recieve a list of all classes that implement them.
answers question: http://stackoverflow.com/q/24209094
has comment: http://stackoverflow.com/comment/37434028
type: Answer
has comment: http://stackoverflow.com/comment/37434782

http://stackoverflow.com/a/24547618
answers question: http://stackoverflow.com/q/24242403
type: Answer
score: 0
type: AcceptedAnswer
has body: There is a Improvement filled in official spring jira. See this link to jira.
accepted answer of: http://stackoverflow.com/q/24242403

http://stackoverflow.com/comment/37214922
comment on: http://stackoverflow.com/a/24121616
type: Comment
type: AnswerComment
has text: keyValue type is String.. String KeyValue="";
score: 0

http://stackoverflow.com/q/24160064
tagged with: annotations
tagged with: bigdecimal
has answer: http://stackoverflow.com/a/24176149
score: 19
has body: I have a following class. Class Item { private BigDecimal amount; .... } How I can validate amount that It should contain only two digits after precision. i.e 2.19 is correct and 2.292 is incorrect using annotation @javax.validation.constraints.Digits And how to show custom error message for this ? Thank you :)
type: AnsweredQuestion
upvote count: 19
answer count: 2
has title: Check if bigdecimal has only 2 digits after precision using @javax.validation.constraints.Digits
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/24176149
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37286212
has answer: http://stackoverflow.com/a/24160190
possible better answer: http://stackoverflow.com/a/24160190

http://stackoverflow.com/comment/37430410
type: AnswerComment
comment on: http://stackoverflow.com/a/24235730
has text: I'm not sure I understand what you mean. If your asking if the code compiles without giving number a value when I declare it, then yes.
type: Comment
score: 0

http://stackoverflow.com/a/24159291
has comment: http://stackoverflow.com/comment/37284882
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24159245
has body: There is no String concatenation. The compiler will have created a single long String literal for you.
answers question: http://stackoverflow.com/q/24159245
has comment: http://stackoverflow.com/comment/37284669
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/37284706
score: 5
has comment: http://stackoverflow.com/comment/37284802

json-deserialization
tag name: json-deserialization
type: Tag
tags question: http://stackoverflow.com/q/24233687

http://stackoverflow.com/a/24107415
has body: While I'm not sure how to perfectly solve the problem, I do know that you can still access the package if you try creating a new file in there, for example package-info.java. Try doing that by starting to add a Class as usual, but specify the package to be the package you can't seem to access in the Package Explorer.
answers question: http://stackoverflow.com/q/24107305
downvote count: 0
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/comment/37519127
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24166056
has text: @karl-kildén I already added the sun-jai_codec.jar to my project lib dir and to java lib dir :/ but I have the same error.. :/

http://stackoverflow.com/comment/37418560
type: Comment
comment on: http://stackoverflow.com/a/24224485
score: 0
type: AnswerComment
has text: the reason i didn't go with this method is because the user can delete an item from the list too,so that would mess a lot of things for me ,as i will have to decrease the assigned number for all the items falling after the deleted item

http://stackoverflow.com/a/24342210
has body: Starting from Anubian Noob's answer I tried the same for Maven and the following will get you a Maven project: Create a new Java Maven project: NetBeans -> New Project -> Maven -> Java Application Open up your terminal and navigate to the project's directory, then to src/main/java/ inside the project Run git clone https://github.com/s-u/rJava.git --recursive Anubian Noob's commands also work for initializing the git repository inside src/main/java folder but I couldn't get the submodules.
type: Answer
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24248853
answers question: http://stackoverflow.com/q/24248853

http://stackoverflow.com/a/24211859
upvote count: 16
has comment: http://stackoverflow.com/comment/99606381
score: 16
downvote count: 0
answers question: http://stackoverflow.com/q/24211736
type: Answer
has body: 0XFF00 is hexidecimal. This is a base-16 system where numbers go from 0-9, then A-F. This signifies going from 0 to 15 in our numbering system (base 10). 10 is actually 16 in base 10, followed by 11 which is 17 and so on. Hexidecimal is also called base 16. Each character you see there is represented as 4-bits as we require 4 bits to represent a single hex number in base 16. As such, you can decompose each character in 4 bits. Assuming this is in big-endian, your number is: 0xFF00 ==&gt; F - 1111 F - 1111 0 - 0000 0 - 0000 As such, in binary your number is actually: 1111 1111 0000 0000 Bear in mind this is a 16-bit or 2-byte number. Converting from binary to decimal gives you a decimal number of 65280. In any case, with respect to your code, paramShort is 2 bytes. What you are doing is you are masking out the lower byte of your number, then bit-shifting all of the bits to the right by 8. Essentially, what you are doing is grabbing the most significant byte of your number and seeing what that is. However, masking out using 0xFF00 is a bit superfluous in my opinion. You can simply just bit shift to the right by 8 and as you are bit shifting to the right, the left bits should get filled in with zeroes, so you are effectively doing the same thing by just bitshifting. I'm guessing the masking is there to ensure the reader that extracting the MSB is the intended operation. Hope this helps.

couchdb
tags question: http://stackoverflow.com/q/24238651
type: Tag
tag name: couchdb

atmosphere
tag name: atmosphere
type: Tag
tags question: http://stackoverflow.com/q/24117886

http://stackoverflow.com/comment/37187421
comment on: http://stackoverflow.com/q/24106990
has text: What are the method in Menu class ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37251514
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24141076
type: QuestionComment
has text: What exactly are you trying to achieve in the first place. The task cannot be done by reading the file in a line-wise mode for example? You need to read the whole file for some reason? If you were more specific it could be easier for people to help you

http://stackoverflow.com/comment/37446488
score: 0
has text: My app is an OS service.
type: Comment
comment on: http://stackoverflow.com/q/24244301
type: QuestionComment

http://stackoverflow.com/q/24230238
type: AnsweredQuestion
has title: Save long txt on google app engine
answer count: 2
accepted answer: http://stackoverflow.com/a/24231442
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24231442
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37419398
has body: I am trying to save a long string in the google cloud datastore (more than 500 chars). I searched the web and found out I need to use Text instead of String, so I tried to do so. I changed this: CloudEntity newProfilePicture = new CloudEntity("profiles"); newProfilePicture.put(MainMenu.userNickName, dataToSave); to this: CloudEntity newProfilePicture = new CloudEntity("profiles"); Text dataText = new Text(dataToSave); newProfilePicture.put(MainMenu.userNickName, dataText); but the program crashes.. (If I save short strings, everything works fine) NOTE - if it matters, the import for the Text I used is: com.google.appengine.api.datastore.Text from a jar I downloaded (otherwise, eclipse isn't recognizes the Text type) the logcat: 06-15 16:36:49.710: E/AndroidRuntime(31005): FATAL EXCEPTION: Thread-3184 06-15 16:36:49.710: E/AndroidRuntime(31005): java.lang.NullPointerException 06-15 16:36:49.710: E/AndroidRuntime(31005): at java.util.HashMap.putAll(HashMap.java:507) 06-15 16:36:49.710: E/AndroidRuntime(31005): at com.google.cloud.backend.core.CloudEntity.createCloudEntityFromEntityDto(CloudEntity.java:79) 06-15 16:36:49.710: E/AndroidRuntime(31005): at com.google.cloud.backend.core.CloudBackend.insert(CloudBackend.java:111) 06-15 16:36:49.710: E/AndroidRuntime(31005): at com.google.cloud.backend.core.CloudBackendAsync.access$0(CloudBackendAsync.java:1) 06-15 16:36:49.710: E/AndroidRuntime(31005): at com.google.cloud.backend.core.CloudBackendAsync$1.callBackend(CloudBackendAsync.java:87) 06-15 16:36:49.710: E/AndroidRuntime(31005): at com.google.cloud.backend.core.CloudBackendAsync$1.callBackend(CloudBackendAsync.java:1) 06-15 16:36:49.710: E/AndroidRuntime(31005): at com.google.cloud.backend.core.CloudBackendAsync$BackendCaller.run(CloudBackendAsync.java:402) Any advices? Please HELP! :O
tagged with: google-app-engine
tagged with: android
possible better answer: http://stackoverflow.com/a/24230336
has comment: http://stackoverflow.com/comment/37419275
has comment: http://stackoverflow.com/comment/37419292
has answer: http://stackoverflow.com/a/24230336

http://stackoverflow.com/a/24178699
has comment: http://stackoverflow.com/comment/37382074
upvote count: 4
has comment: http://stackoverflow.com/comment/37416273
has body: The OSM way id is not stored in GraphHopper. You'll need to create e.g. an array of long values while import to maintain them: arr[edgeId]=osmId
type: Answer
has comment: http://stackoverflow.com/comment/37361959
score: 4
answers question: http://stackoverflow.com/q/24155432
downvote count: 0
has comment: http://stackoverflow.com/comment/37346679
has comment: http://stackoverflow.com/comment/37382233

http://stackoverflow.com/comment/37481701
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24262858
score: 0
has text: Which line is Line 70?

http://stackoverflow.com/a/24105162
downvote count: 0
answers question: http://stackoverflow.com/q/24105121
type: Answer
score: 2
upvote count: 2
has body: First, is important to know that the range of a byte in Java is [-128, 127]. Now, according to Java Docs, the nextByte() method (emphasis mine): Throws: InputMismatchException - if the next token does not match the Integer regular expression, or is out of range So, it expects to read a number in the range [-128, 127] from the String. Otherwise, it will throw that exception. An example of how can you use it would be: String si = "-128"; Scanner sc = new Scanner(si); byte d = sc.nextByte(); System.out.println(d); // -128 Edit: One simple solution to access to the characters of an String would be to convert it into an array char[]: char[] chars = si.toCharArray(); System.out.println(chars[index]);

http://stackoverflow.com/comment/37422675
comment on: http://stackoverflow.com/a/24226135
has text: Since the input to me will be such paragraphs where in each signifies a specific unit of information, I am extracting them as paragraph and then needs to apply pattern or scanner classes to operate on the paragraph. Thanks for your reply.
type: Comment
type: AnswerComment
score: 0